Hi Marc,
On 4/26/25 13:28, Marc Zyngier wrote:
Just like we allow sysreg ranges for Coarse Grained Trap descriptors,
allow them for Fine Grain Traps as well.
This comes with a warning that not all ranges are suitable for this
particular definition of ranges.
Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
---
arch/arm64/kvm/emulate-nested.c | 120 +++++++++++---------------------
1 file changed, 39 insertions(+), 81 deletions(-)
diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c
index e2a843675da96..9c7ecfccbd6e9 100644
--- a/arch/arm64/kvm/emulate-nested.c
+++ b/arch/arm64/kvm/emulate-nested.c
@@ -622,6 +622,11 @@ struct encoding_to_trap_config {
const unsigned int line;
};
+/*
+ * WARNING: using ranges is a treacherous endeavour, as sysregs that
+ * are part of an architectural range are not necessarily contiguous
+ * in the [Op0,Op1,CRn,CRm,Ops] space. Tread carefully.
+ */
#define SR_RANGE_TRAP(sr_start, sr_end, trap_id) \
{ \
.encoding = sr_start, \
@@ -1289,15 +1294,19 @@ enum fg_filter_id {
#define FGT(g, b, p) __FGT(g, b, p, __NO_FGF__)
-#define SR_FGF(sr, g, b, p, f) \
+/* Same warning applies: use carefully */
Nit: The other warning is a few hundred lines away. Consider identifying
it more precisely.
+#define SR_FGF_RANGE(sr, e, g, b, p, f) \
{ \
.encoding = sr, \
- .end = sr, \
+ .end = e, \
.tc = __FGT(g, b, p, f), \
.line = __LINE__, \
}
Thanks,
Ben