All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/arm: Move the "arm-cpu" compat settings out of hw/core/machine.c
@ 2026-01-20 12:21 Thomas Huth
  2026-01-20 12:55 ` Peter Maydell
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Huth @ 2026-01-20 12:21 UTC (permalink / raw)
  To: Peter Maydell, Philippe Mathieu-Daudé, Yanan Wang, Zhao Liu,
	qemu-arm
  Cc: Eduardo Habkost, Marcel Apfelbaum, qemu-devel

From: Thomas Huth <thuth@redhat.com>

The hw_compat_* arrays in hw/core/machine.c should be used for generic
compat settings that might affect all (or at least multiple) machines.
Target specific settings should rather go into the target specific
source files instead. For arm/aarch64, the virt machine is the only
one that cares about compat settings, so move the "arm-cpu" related
switches to hw/arm/virt.c now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/arm/virt.c     | 10 ++++++++++
 hw/core/machine.c |  2 --
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 4badc1a7348..99040e08f6a 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -3571,8 +3571,13 @@ DEFINE_VIRT_MACHINE(10, 0)
 
 static void virt_machine_9_2_options(MachineClass *mc)
 {
+    static GlobalProperty compat_9_2[] = {
+        { "arm-cpu", "backcompat-pauth-default-use-qarma5", "true"},
+    };
+
     virt_machine_10_0_options(mc);
     compat_props_add(mc->compat_props, hw_compat_9_2, hw_compat_9_2_len);
+    compat_props_add(mc->compat_props, compat_9_2, G_N_ELEMENTS(compat_9_2));
 }
 DEFINE_VIRT_MACHINE(9, 2)
 
@@ -3589,9 +3594,14 @@ DEFINE_VIRT_MACHINE(9, 1)
 
 static void virt_machine_9_0_options(MachineClass *mc)
 {
+    static GlobalProperty compat_9_0[] = {
+        { "arm-cpu", "backcompat-cntfrq", "true" },
+    };
+
     virt_machine_9_1_options(mc);
     mc->smbios_memory_device_size = 16 * GiB;
     compat_props_add(mc->compat_props, hw_compat_9_0, hw_compat_9_0_len);
+    compat_props_add(mc->compat_props, compat_9_0, G_N_ELEMENTS(compat_9_0));
 }
 DEFINE_VIRT_MACHINE(9, 0)
 
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 6411e68856b..1c1de7b5d18 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -59,7 +59,6 @@ GlobalProperty hw_compat_10_0[] = {
 const size_t hw_compat_10_0_len = G_N_ELEMENTS(hw_compat_10_0);
 
 GlobalProperty hw_compat_9_2[] = {
-    { "arm-cpu", "backcompat-pauth-default-use-qarma5", "true"},
     { "virtio-balloon-pci", "vectors", "0" },
     { "virtio-balloon-pci-transitional", "vectors", "0" },
     { "virtio-balloon-pci-non-transitional", "vectors", "0" },
@@ -76,7 +75,6 @@ GlobalProperty hw_compat_9_1[] = {
 const size_t hw_compat_9_1_len = G_N_ELEMENTS(hw_compat_9_1);
 
 GlobalProperty hw_compat_9_0[] = {
-    { "arm-cpu", "backcompat-cntfrq", "true" },
     { "scsi-hd", "migrate-emulated-scsi-request", "false" },
     { "scsi-cd", "migrate-emulated-scsi-request", "false" },
     { "vfio-pci", "skip-vsc-check", "false" },
-- 
2.52.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/arm: Move the "arm-cpu" compat settings out of hw/core/machine.c
  2026-01-20 12:21 [PATCH] hw/arm: Move the "arm-cpu" compat settings out of hw/core/machine.c Thomas Huth
@ 2026-01-20 12:55 ` Peter Maydell
  2026-01-20 14:15   ` Thomas Huth
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2026-01-20 12:55 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Philippe Mathieu-Daudé, Yanan Wang, Zhao Liu, qemu-arm,
	Eduardo Habkost, Marcel Apfelbaum, qemu-devel

On Tue, 20 Jan 2026 at 12:21, Thomas Huth <thuth@redhat.com> wrote:
>
> From: Thomas Huth <thuth@redhat.com>
>
> The hw_compat_* arrays in hw/core/machine.c should be used for generic
> compat settings that might affect all (or at least multiple) machines.
> Target specific settings should rather go into the target specific
> source files instead. For arm/aarch64, the virt machine is the only
> one that cares about compat settings, so move the "arm-cpu" related
> switches to hw/arm/virt.c now.

I think it makes more sense for all the compat stuff to
live in one place, rather than being scattered around,
unless it is truly machine-specific (which this isn't).
The hw/core arrays seem to be where we put compat
props which are related to a particular device rather
than a specific machine.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/arm: Move the "arm-cpu" compat settings out of hw/core/machine.c
  2026-01-20 12:55 ` Peter Maydell
@ 2026-01-20 14:15   ` Thomas Huth
  2026-01-20 14:24     ` Peter Maydell
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Huth @ 2026-01-20 14:15 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Philippe Mathieu-Daudé, Yanan Wang, Zhao Liu, qemu-arm,
	Eduardo Habkost, Marcel Apfelbaum, qemu-devel

On 20/01/2026 13.55, Peter Maydell wrote:
> On Tue, 20 Jan 2026 at 12:21, Thomas Huth <thuth@redhat.com> wrote:
>>
>> From: Thomas Huth <thuth@redhat.com>
>>
>> The hw_compat_* arrays in hw/core/machine.c should be used for generic
>> compat settings that might affect all (or at least multiple) machines.
>> Target specific settings should rather go into the target specific
>> source files instead. For arm/aarch64, the virt machine is the only
>> one that cares about compat settings, so move the "arm-cpu" related
>> switches to hw/arm/virt.c now.
> 
> I think it makes more sense for all the compat stuff to
> live in one place, rather than being scattered around,
> unless it is truly machine-specific (which this isn't).

It's only used by the arm virt machine, so it's IMHO machine specific.
If we will ever get other versionized arm machines, they won't use these 
config knobs, so this never will be shared with another machine.

> The hw/core arrays seem to be where we put compat
> props which are related to a particular device rather
> than a specific machine.

IMHO it makes sense if multiple machines use such config knobs, but if it is 
really only related to one machine ... not so much.

  Thomas



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/arm: Move the "arm-cpu" compat settings out of hw/core/machine.c
  2026-01-20 14:15   ` Thomas Huth
@ 2026-01-20 14:24     ` Peter Maydell
  2026-01-21 17:36       ` Cornelia Huck
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2026-01-20 14:24 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Philippe Mathieu-Daudé, Yanan Wang, Zhao Liu, qemu-arm,
	Eduardo Habkost, Marcel Apfelbaum, qemu-devel

On Tue, 20 Jan 2026 at 14:15, Thomas Huth <thuth@redhat.com> wrote:
>
> On 20/01/2026 13.55, Peter Maydell wrote:
> > On Tue, 20 Jan 2026 at 12:21, Thomas Huth <thuth@redhat.com> wrote:
> >>
> >> From: Thomas Huth <thuth@redhat.com>
> >>
> >> The hw_compat_* arrays in hw/core/machine.c should be used for generic
> >> compat settings that might affect all (or at least multiple) machines.
> >> Target specific settings should rather go into the target specific
> >> source files instead. For arm/aarch64, the virt machine is the only
> >> one that cares about compat settings, so move the "arm-cpu" related
> >> switches to hw/arm/virt.c now.
> >
> > I think it makes more sense for all the compat stuff to
> > live in one place, rather than being scattered around,
> > unless it is truly machine-specific (which this isn't).
>
> It's only used by the arm virt machine, so it's IMHO machine specific.
> If we will ever get other versionized arm machines, they won't use these
> config knobs, so this never will be shared with another machine.

It happens to be only used by the virt board, but that's just
a coincidence that we only have one versioned arm board right
now. The config knob itself is not at all board specific:
it applies to a device object that is used by many boards and
sets a behaviour that would usefully apply to all of them.
If we ever did have more arm versioned machines in the future
we'd end up with a weird split where compat properties of the CPU
object that happened to pre-date the addition of that second
machine type would be in one place in the source code, and
properties that happened to post-date the second machine
type would be somewhere else.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/arm: Move the "arm-cpu" compat settings out of hw/core/machine.c
  2026-01-20 14:24     ` Peter Maydell
@ 2026-01-21 17:36       ` Cornelia Huck
  0 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2026-01-21 17:36 UTC (permalink / raw)
  To: Peter Maydell, Thomas Huth
  Cc: Philippe Mathieu-Daudé, Yanan Wang, Zhao Liu, qemu-arm,
	Eduardo Habkost, Marcel Apfelbaum, qemu-devel

On Tue, Jan 20 2026, Peter Maydell <peter.maydell@linaro.org> wrote:

> On Tue, 20 Jan 2026 at 14:15, Thomas Huth <thuth@redhat.com> wrote:
>>
>> On 20/01/2026 13.55, Peter Maydell wrote:
>> > On Tue, 20 Jan 2026 at 12:21, Thomas Huth <thuth@redhat.com> wrote:
>> >>
>> >> From: Thomas Huth <thuth@redhat.com>
>> >>
>> >> The hw_compat_* arrays in hw/core/machine.c should be used for generic
>> >> compat settings that might affect all (or at least multiple) machines.
>> >> Target specific settings should rather go into the target specific
>> >> source files instead. For arm/aarch64, the virt machine is the only
>> >> one that cares about compat settings, so move the "arm-cpu" related
>> >> switches to hw/arm/virt.c now.

FWIW, this is not the only arch-specific setting in there, and I don't
think it's really bothersome. There are many compat settings that might
not be applicable when you spin up a machine, and that's fine.

>> >
>> > I think it makes more sense for all the compat stuff to
>> > live in one place, rather than being scattered around,
>> > unless it is truly machine-specific (which this isn't).
>>
>> It's only used by the arm virt machine, so it's IMHO machine specific.
>> If we will ever get other versionized arm machines, they won't use these
>> config knobs, so this never will be shared with another machine.
>
> It happens to be only used by the virt board, but that's just
> a coincidence that we only have one versioned arm board right
> now. The config knob itself is not at all board specific:
> it applies to a device object that is used by many boards and
> sets a behaviour that would usefully apply to all of them.
> If we ever did have more arm versioned machines in the future
> we'd end up with a weird split where compat properties of the CPU
> object that happened to pre-date the addition of that second
> machine type would be in one place in the source code, and
> properties that happened to post-date the second machine
> type would be somewhere else.

I think there are only two options that really make sense:
- keep the compat setting where it is
- introduce an arm specific compat array that can be included by the
  virt machine and any future versioned arm machine

Not sure if the latter is actually worth the hassle.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-21 17:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-20 12:21 [PATCH] hw/arm: Move the "arm-cpu" compat settings out of hw/core/machine.c Thomas Huth
2026-01-20 12:55 ` Peter Maydell
2026-01-20 14:15   ` Thomas Huth
2026-01-20 14:24     ` Peter Maydell
2026-01-21 17:36       ` Cornelia Huck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.