Hi Eric,

> -----Original Message-----
> From: Eric Auger <[email protected]>
> Sent: 26 August 2026 10:36
> To: [email protected]; [email protected]; qemu-
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> Shameer Kolothum Thodi <[email protected]>;
> [email protected]
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]
> Subject: [RFC PATCH v8 15/20] target/arm/kvm: Ignore and trace unexpected
> writable reserved fields
> 
> External email: Use caution opening links or attachments
> 
> 
> KVM currently reports some bits as writable whereas they are
> RES0 or RAZ. The code easily allows to do some sanity checking
> for such inconsistencies. Let's add a trace event when this is
> encountered and skip the field
> 
> Signed-off-by: Eric Auger <[email protected]>
> ---
>  target/arm/kvm.c        | 8 ++++++++
>  target/arm/trace-events | 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index 2557d7b0d9..8ec9bc51cd 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -433,6 +433,14 @@ decode_idreg_writemap(Object *obj,
> ARM64SysReg *reg)
>          }
>          lower = field->shift;
>          upper = field->shift + field->length - 1;
> +
> +        /* Sanity check the field is not a reserved field */
> +        if (strstr(field->name, "RES0") || strstr(field->name, "RES1") ||
> +            strstr(field->name, "RAZ")) {
> +            trace_unexpected_writable_reserved_field(reg->name, field->name,
> +                                                     lower, upper);

This hangs QEMU on my setup, the guest never starts.
I think, we need to advance map/i: 

+            map &= ~MAKE_64BIT_MASK(lower, field->length);
+            i = ctz64(map);

Thanks,
Shameer


Reply via email to