Skip to contentSkip to conversation

hw/arm: add versioning to sbsa-ref machine DT

PATCH Applied Leif Lindholm 3 participants 5 messages May 5, 2022 – May 17, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/arm: add versioning to sbsa-ref machine DT

The sbsa-ref machine is continuously evolving. Some of the changes we want to make in the near future, to align with real components (e.g. the GIC-700), will break compatibility for existing firmware.

Introduce two new properties to the DT generated on machine generation:
- machine-version-major
To be incremented when a platform change makes the machine incompatible with existing firmware.
- machine-version-minor
To be incremented when functionality is added to the machine without causing incompatibility with existing firmware.
to be reset to 0 when machine-version-major is incremented.

This versioning scheme is *neither*:
- A QEMU versioned machine type; a given version of QEMU will emulate a given version of the platform.
- A reflection of level of SBSA (now SystemReady SR) support provided.

The version will increment on guest-visible functional changes only, akin to a revision ID register found on a physical platform.

These properties are both introduced with the value 0. (Hence, a machine where the DT is lacking these nodes is equivalent to version 0.0.)

Cc Peter Maydell <[email protected]>
Cc Radoslaw Biernacki <[email protected]>
Cc Cédric Le Goater <[email protected]>

---

Changes since v1:
- More detail added to commit message.
- Verbose comment added adjacent to code additions.

 hw/arm/sbsa-ref.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
hw/arm/sbsa-ref.c +14 -0
index 2387401963..d0c25ddfcf 100644
@@ -190,6 +190,20 @@ static void create_fdt(SBSAMachineState *sms)
     qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2);
     qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2);
 
+    /*
+     * This versioning scheme is for informing platform fw only. It is neither:
+     * - A QEMU versioned machine type; a given version of QEMU will emulate
+     *   a given version of the platform.
+     * - A reflection of level of SBSA (now SystemReady SR) support provided.
+     *
+     * machine-version-major: updated when changes breaking fw compatibility
+     *                        are introduced.
+     * machine-version-minor: updated when features are added that don't break
+     *                        fw compatibility.
+     */
+    qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0);
+    qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 0);
+
     if (ms->numa_state->have_numa_distance) {
         int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t);
         uint32_t *matrix = g_malloc0(size);
Signature · 1 line
2.30.2
#1 lore raw
Quoted 19 lines · Leif Lindholm

The sbsa-ref machine is continuously evolving. Some of the changes we want to make in the near future, to align with real components (e.g. the GIC-700), will break compatibility for existing firmware.

Introduce two new properties to the DT generated on machine generation:
- machine-version-major
To be incremented when a platform change makes the machine incompatible with existing firmware.
- machine-version-minor
To be incremented when functionality is added to the machine without causing incompatibility with existing firmware.
to be reset to 0 when machine-version-major is incremented.

This versioning scheme is *neither*:
- A QEMU versioned machine type; a given version of QEMU will emulate a given version of the platform.
- A reflection of level of SBSA (now SystemReady SR) support provided.

Quoted 7 lines

The version will increment on guest-visible functional changes only, akin to a revision ID register found on a physical platform.

These properties are both introduced with the value 0. (Hence, a machine where the DT is lacking these nodes is equivalent to version 0.0.)

Applied to target-arm.next, thanks.

-- PMM

#2 lore raw
In reply to Leif Lindholm
Quoted 5 lines · Leif Lindholm

The sbsa-ref machine is continuously evolving. Some of the changes we want to make in the near future, to align with real components (e.g. the GIC-700), will break compatibility for existing firmware.

Quoted 8 lines

Introduce two new properties to the DT generated on machine generation:
- machine-version-major
To be incremented when a platform change makes the machine incompatible with existing firmware.
- machine-version-minor
To be incremented when functionality is added to the machine without causing incompatibility with existing firmware.
to be reset to 0 when machine-version-major is incremented.

Where's the binding documentation for this?

We already have a way to version DTs and that's with compatible. I'm not completely opposed to a version number though, but I am opposed to it not being common. We've rejected vendors (QCom in fact) doing their own thing here.

Quoted 4 lines

This versioning scheme is *neither*:
- A QEMU versioned machine type; a given version of QEMU will emulate a given version of the platform.
- A reflection of level of SBSA (now SystemReady SR) support provided.

FYI, it's planned to certify the virt machine for SR-IR which will include DT schema validation. Undocumented properties are a problem for that.

Quoted 49 lines

The version will increment on guest-visible functional changes only, akin to a revision ID register found on a physical platform.

These properties are both introduced with the value 0. (Hence, a machine where the DT is lacking these nodes is equivalent to version 0.0.)

Cc Peter Maydell <[email protected]>
Cc Radoslaw Biernacki <[email protected]>
Cc Cédric Le Goater <[email protected]>

---

Changes since v1:
- More detail added to commit message.
- Verbose comment added adjacent to code additions.

 hw/arm/sbsa-ref.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
hw/arm/sbsa-ref.c +14 -1
index 2387401963..d0c25ddfcf 100644
@@ -190,6 +190,20 @@ static void create_fdt(SBSAMachineState *sms)
     qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2);
     qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2);
 
+    /*
+     * This versioning scheme is for informing platform fw only. It is neither:
+     * - A QEMU versioned machine type; a given version of QEMU will emulate
+     *   a given version of the platform.
+     * - A reflection of level of SBSA (now SystemReady SR) support provided.
+     *
+     * machine-version-major: updated when changes breaking fw compatibility
+     *                        are introduced.
+     * machine-version-minor: updated when features are added that don't break
+     *                        fw compatibility.
+     */
+    qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0);
+    qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 0);
+
     if (ms->numa_state->have_numa_distance) {
         int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t);
         uint32_t *matrix = g_malloc0(size);
--

2.30.2

#3 lore raw
Quoted 24 lines · Rob Herring
Quoted 5 lines · Leif Lindholm

The sbsa-ref machine is continuously evolving. Some of the changes we want to make in the near future, to align with real components (e.g. the GIC-700), will break compatibility for existing firmware.

Quoted 8 lines

Introduce two new properties to the DT generated on machine generation:
- machine-version-major
To be incremented when a platform change makes the machine incompatible with existing firmware.
- machine-version-minor
To be incremented when functionality is added to the machine without causing incompatibility with existing firmware.
to be reset to 0 when machine-version-major is incremented.

Where's the binding documentation for this?

We already have a way to version DTs and that's with compatible. I'm not completely opposed to a version number though, but I am opposed to it not being common. We've rejected vendors (QCom in fact) doing their own thing here.

Quoted 8 lines
Quoted 4 lines

This versioning scheme is *neither*:
- A QEMU versioned machine type; a given version of QEMU will emulate a given version of the platform.
- A reflection of level of SBSA (now SystemReady SR) support provided.

FYI, it's planned to certify the virt machine for SR-IR which will include DT schema validation. Undocumented properties are a problem for that.

This isn't the 'virt' machine :-)

This dtb fragment is a purely private communication between the QEMU model and the sbsa-ref EL3 firmware. We could in theory equally replace it with a set of hardwired "board revision" registers. There's a comment in the existing sources about this:

/*
* Firmware on this machine only uses ACPI table to load OS, these limited
* device tree nodes are just to let firmware know the info which varies from
* command line parameters, so it is not necessary to be fully compatible
* with the kernel CPU and NUMA binding rules.
*/

Kernels running on sbsa-ref won't see a dtb (let alone one with this version information in it), because firmware will always boot them with ACPI.

thanks
-- PMM

#4 lore raw
Quoted 31 lines · Peter Maydell
Quoted 29 lines · Rob Herring
Quoted 5 lines · Leif Lindholm

The sbsa-ref machine is continuously evolving. Some of the changes we want to make in the near future, to align with real components (e.g. the GIC-700), will break compatibility for existing firmware.

Quoted 8 lines

Introduce two new properties to the DT generated on machine generation:
- machine-version-major
To be incremented when a platform change makes the machine incompatible with existing firmware.
- machine-version-minor
To be incremented when functionality is added to the machine without causing incompatibility with existing firmware.
to be reset to 0 when machine-version-major is incremented.

Where's the binding documentation for this?

We already have a way to version DTs and that's with compatible. I'm not completely opposed to a version number though, but I am opposed to it not being common. We've rejected vendors (QCom in fact) doing their own thing here.

Quoted 4 lines

This versioning scheme is *neither*:
- A QEMU versioned machine type; a given version of QEMU will emulate a given version of the platform.
- A reflection of level of SBSA (now SystemReady SR) support provided.

Quoted 5 lines
Quoted 3 lines

FYI, it's planned to certify the virt machine for SR-IR which will include DT schema validation. Undocumented properties are a problem for that.

This isn't the 'virt' machine :-)

Ah, okay.

Quoted 2 lines

This dtb fragment is a purely private communication between the QEMU model and the sbsa-ref EL3 firmware. We could in

And that interface is tightly coupled and always in sync?

Quoted 11 lines

theory equally replace it with a set of hardwired "board revision" registers. There's a comment in the existing sources about this:

/*
* Firmware on this machine only uses ACPI table to load OS, these limited
* device tree nodes are just to let firmware know the info which varies from
* command line parameters, so it is not necessary to be fully compatible
* with the kernel CPU and NUMA binding rules.
*/

Quoted 3 lines

Kernels running on sbsa-ref won't see a dtb (let alone one with this version information in it), because firmware will always boot them with ACPI.

Okay, if there's no chance this moves up the stack, NM.

Rob