[PATCH v6 08/11] hw/arm/virt: Declare AArch32 DBGDTRTX as safe to ignore in incoming stream

Eric Auger posted 11 patches 1 week, 4 days ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>
[PATCH v6 08/11] hw/arm/virt: Declare AArch32 DBGDTRTX as safe to ignore in incoming stream
Posted by Eric Auger 1 week, 4 days ago
With the new infrastructure in place it is now feasible to teach
qemu that it is safe to ignore a sysreg in the incoming migration
stream. So with the plan to revert commit 4f2b82f60431 ("target/arm:
Reinstate bogus AArch32 DBGDTRTX register for migration compat") from
qemu 11.0 onwards, let's add a compat in 10.2 machine options stating
that this reg is safe to ignore. from 11.0 onwards we will not need
that register anymore.

Signed-off-by: Eric Auger <eric.auger@redhat.com>

---

v4 -> v5:
- rebased on top of latest machine types (Connie)

v3 -> v4:
- add a comment related to DBGDTRTX (Connie)
---
 hw/arm/virt.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index baa4e31aac1..03d5af18f26 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -100,6 +100,15 @@ static GlobalProperty arm_virt_compat_defaults[] = {
 static const size_t arm_virt_compat_defaults_len =
     G_N_ELEMENTS(arm_virt_compat_defaults);
 
+/* Register erronously exposed on 10.2 and earlier */
+#define DBGDTRTX 0x40200000200e0298
+
+static GlobalProperty arm_virt_compat_10_2[] = {
+    { TYPE_ARM_CPU, "x-mig-safe-missing-regs", stringify(DBGDTRTX)},
+};
+static const size_t arm_virt_compat_10_2_len =
+    G_N_ELEMENTS(arm_virt_compat_10_2);
+
 /*
  * This cannot be called from the virt_machine_class_init() because
  * TYPE_VIRT_MACHINE is abstract and mc->compat_props g_ptr_array_new()
@@ -3552,6 +3561,7 @@ static void virt_machine_10_2_options(MachineClass *mc)
 {
     virt_machine_11_0_options(mc);
     compat_props_add(mc->compat_props, hw_compat_10_2, hw_compat_10_2_len);
+    compat_props_add(mc->compat_props, arm_virt_compat_10_2, arm_virt_compat_10_2_len);
 }
 DEFINE_VIRT_MACHINE(10, 2)
 
-- 
2.52.0
Re: [PATCH v6 08/11] hw/arm/virt: Declare AArch32 DBGDTRTX as safe to ignore in incoming stream
Posted by Cornelia Huck 1 week, 3 days ago
On Mon, Jan 26 2026, Eric Auger <eric.auger@redhat.com> wrote:

> With the new infrastructure in place it is now feasible to teach
> qemu that it is safe to ignore a sysreg in the incoming migration
> stream. So with the plan to revert commit 4f2b82f60431 ("target/arm:
> Reinstate bogus AArch32 DBGDTRTX register for migration compat") from
> qemu 11.0 onwards, let's add a compat in 10.2 machine options stating
> that this reg is safe to ignore. from 11.0 onwards we will not need
> that register anymore.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>
> ---
>
> v4 -> v5:
> - rebased on top of latest machine types (Connie)
>
> v3 -> v4:
> - add a comment related to DBGDTRTX (Connie)
> ---
>  hw/arm/virt.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index baa4e31aac1..03d5af18f26 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -100,6 +100,15 @@ static GlobalProperty arm_virt_compat_defaults[] = {
>  static const size_t arm_virt_compat_defaults_len =
>      G_N_ELEMENTS(arm_virt_compat_defaults);
>  
> +/* Register erronously exposed on 10.2 and earlier */
> +#define DBGDTRTX 0x40200000200e0298
> +
> +static GlobalProperty arm_virt_compat_10_2[] = {
> +    { TYPE_ARM_CPU, "x-mig-safe-missing-regs", stringify(DBGDTRTX)},
> +};
> +static const size_t arm_virt_compat_10_2_len =
> +    G_N_ELEMENTS(arm_virt_compat_10_2);
> +

Not objecting, but we had a discussion recently regarding where compat
values for arm cpus should live:
https://lore.kernel.org/qemu-devel/20260120122108.131708-1-thuth@redhat.com/ ff.

Could this become relevant for future other versioned machine types? I'd
assume that they just would skip the bogus reg from the start, though.

>  /*
>   * This cannot be called from the virt_machine_class_init() because
>   * TYPE_VIRT_MACHINE is abstract and mc->compat_props g_ptr_array_new()
> @@ -3552,6 +3561,7 @@ static void virt_machine_10_2_options(MachineClass *mc)
>  {
>      virt_machine_11_0_options(mc);
>      compat_props_add(mc->compat_props, hw_compat_10_2, hw_compat_10_2_len);
> +    compat_props_add(mc->compat_props, arm_virt_compat_10_2, arm_virt_compat_10_2_len);
>  }
>  DEFINE_VIRT_MACHINE(10, 2)
>
Re: [PATCH v6 08/11] hw/arm/virt: Declare AArch32 DBGDTRTX as safe to ignore in incoming stream
Posted by Eric Auger 1 week, 1 day ago
Hi Connie,

On 1/27/26 6:19 PM, Cornelia Huck wrote:
> On Mon, Jan 26 2026, Eric Auger <eric.auger@redhat.com> wrote:
>
>> With the new infrastructure in place it is now feasible to teach
>> qemu that it is safe to ignore a sysreg in the incoming migration
>> stream. So with the plan to revert commit 4f2b82f60431 ("target/arm:
>> Reinstate bogus AArch32 DBGDTRTX register for migration compat") from
>> qemu 11.0 onwards, let's add a compat in 10.2 machine options stating
>> that this reg is safe to ignore. from 11.0 onwards we will not need
>> that register anymore.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>
>> ---
>>
>> v4 -> v5:
>> - rebased on top of latest machine types (Connie)
>>
>> v3 -> v4:
>> - add a comment related to DBGDTRTX (Connie)
>> ---
>>  hw/arm/virt.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
>> index baa4e31aac1..03d5af18f26 100644
>> --- a/hw/arm/virt.c
>> +++ b/hw/arm/virt.c
>> @@ -100,6 +100,15 @@ static GlobalProperty arm_virt_compat_defaults[] = {
>>  static const size_t arm_virt_compat_defaults_len =
>>      G_N_ELEMENTS(arm_virt_compat_defaults);
>>  
>> +/* Register erronously exposed on 10.2 and earlier */
>> +#define DBGDTRTX 0x40200000200e0298
>> +
>> +static GlobalProperty arm_virt_compat_10_2[] = {
>> +    { TYPE_ARM_CPU, "x-mig-safe-missing-regs", stringify(DBGDTRTX)},
>> +};
>> +static const size_t arm_virt_compat_10_2_len =
>> +    G_N_ELEMENTS(arm_virt_compat_10_2);
>> +
> Not objecting, but we had a discussion recently regarding where compat
> values for arm cpus should live:
> https://lore.kernel.org/qemu-devel/20260120122108.131708-1-thuth@redhat.com/ ff.
>
> Could this become relevant for future other versioned machine types? I'd
> assume that they just would skip the bogus reg from the start, though.
Thanks for the pointer. Effectively this could have initially lived
in hw/core/machine.c but the problem specific to this array prop is that
in any case this is not something you can aggregate and this requires
infra defined in 10/11 where you register safe missing regs and hidden
regs throgh a specific helper. Currently only one machine requires this
so I would be inclined to leave it in virt arm machine code. So this
patch is something trasncient and replaced in 10/11. Thanks Eric
>
>>  /*
>>   * This cannot be called from the virt_machine_class_init() because
>>   * TYPE_VIRT_MACHINE is abstract and mc->compat_props g_ptr_array_new()
>> @@ -3552,6 +3561,7 @@ static void virt_machine_10_2_options(MachineClass *mc)
>>  {
>>      virt_machine_11_0_options(mc);
>>      compat_props_add(mc->compat_props, hw_compat_10_2, hw_compat_10_2_len);
>> +    compat_props_add(mc->compat_props, arm_virt_compat_10_2, arm_virt_compat_10_2_len);
>>  }
>>  DEFINE_VIRT_MACHINE(10, 2)
>>