Skip to content

Commit 3164899

Browse files
author
Marc Zyngier
committed
KVM: arm64: Add description of FGT bits leading to EC!=0x18
The current FTP tables are only concerned with the bits generating ESR_ELx.EC==0x18. However, we want an exhaustive view of what KVM really knows about. So let's add another small table that provides that extra information. Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 1b8570b commit 3164899

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

arch/arm64/kvm/emulate-nested.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,16 +1279,21 @@ enum fg_filter_id {
12791279
__NR_FG_FILTER_IDS__
12801280
};
12811281

1282-
#define SR_FGF(sr, g, b, p, f) \
1283-
{ \
1284-
.encoding = sr, \
1285-
.end = sr, \
1286-
.tc = { \
1282+
#define __FGT(g, b, p, f) \
1283+
{ \
12871284
.fgt = g ## _GROUP, \
12881285
.bit = g ## _EL2_ ## b ## _SHIFT, \
12891286
.pol = p, \
12901287
.fgf = f, \
1291-
}, \
1288+
}
1289+
1290+
#define FGT(g, b, p) __FGT(g, b, p, __NO_FGF__)
1291+
1292+
#define SR_FGF(sr, g, b, p, f) \
1293+
{ \
1294+
.encoding = sr, \
1295+
.end = sr, \
1296+
.tc = __FGT(g, b, p, f), \
12921297
.line = __LINE__, \
12931298
}
12941299

@@ -1989,6 +1994,18 @@ static const struct encoding_to_trap_config encoding_to_fgt[] __initconst = {
19891994
SR_FGT(SYS_AMEVCNTR0_EL0(0), HAFGRTR, AMEVCNTR00_EL0, 1),
19901995
};
19911996

1997+
/*
1998+
* Additional FGTs that do not fire with ESR_EL2.EC==0x18. This table
1999+
* isn't used for exception routing, but only as a promise that the
2000+
* trap is handled somewhere else.
2001+
*/
2002+
static const union trap_config non_0x18_fgt[] __initconst = {
2003+
FGT(HFGITR, nGCSSTR_EL1, 0),
2004+
FGT(HFGITR, SVC_EL1, 1),
2005+
FGT(HFGITR, SVC_EL0, 1),
2006+
FGT(HFGITR, ERET, 1),
2007+
};
2008+
19922009
static union trap_config get_trap_config(u32 sysreg)
19932010
{
19942011
return (union trap_config) {
@@ -2203,6 +2220,13 @@ int __init populate_nv_trap_config(void)
22032220
}
22042221
}
22052222

2223+
for (int i = 0; i < ARRAY_SIZE(non_0x18_fgt); i++) {
2224+
if (!aggregate_fgt(non_0x18_fgt[i])) {
2225+
ret = -EINVAL;
2226+
kvm_err("non_0x18_fgt[%d] is reserved\n", i);
2227+
}
2228+
}
2229+
22062230
ret = check_all_fgt_masks(ret);
22072231

22082232
kvm_info("nv: %ld fine grained trap handlers\n",

0 commit comments

Comments
 (0)