[Qemu-devel] [PATCH] ppc/pnv: introduce new skiboot platform properties

Cédric Le Goater posted 1 patch 4 years, 11 months ago
Test FreeBSD passed
Test docker-clang@ubuntu passed
Test s390x passed
Test asan passed
Test checkpatch passed
Test docker-mingw@fedora passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190527071749.31499-1-clg@kaod.org
Maintainers: "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>
hw/ppc/pnv.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
[Qemu-devel] [PATCH] ppc/pnv: introduce new skiboot platform properties
Posted by Cédric Le Goater 4 years, 11 months ago
Newer skiboots (after 6.3) support QEMU platforms that have
characteristics closer to real OpenPOWER systems. The CPU type is used
to define the BMC drivers: Aspeed AST2400 for POWER8 processors and
AST2500 for POWER9s.

Advertise the new platform property names, "qemu,powernv8" and
"qemu,powernv9", using the CPU type chosen for the QEMU PowerNV
machine. Also, advertise the original platform name "qemu,powernv" in
case of POWER8 processors for compatibility with older skiboots.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/pnv.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index dfb4ea5742c1..1f22cbf833a8 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -450,7 +450,8 @@ static void pnv_dt_power_mgt(void *fdt)
 
 static void *pnv_dt_create(MachineState *machine)
 {
-    const char plat_compat[] = "qemu,powernv\0ibm,powernv";
+    const char plat_compat8[] = "qemu,powernv8\0qemu,powernv\0ibm,powernv";
+    const char plat_compat9[] = "qemu,powernv9\0ibm,powernv";
     PnvMachineState *pnv = PNV_MACHINE(machine);
     void *fdt;
     char *buf;
@@ -465,8 +466,14 @@ static void *pnv_dt_create(MachineState *machine)
     _FDT((fdt_setprop_cell(fdt, 0, "#size-cells", 0x2)));
     _FDT((fdt_setprop_string(fdt, 0, "model",
                              "IBM PowerNV (emulated by qemu)")));
-    _FDT((fdt_setprop(fdt, 0, "compatible", plat_compat,
-                      sizeof(plat_compat))));
+    if (pnv_is_power9(pnv)) {
+        _FDT((fdt_setprop(fdt, 0, "compatible", plat_compat9,
+                          sizeof(plat_compat9))));
+    } else {
+        _FDT((fdt_setprop(fdt, 0, "compatible", plat_compat8,
+                          sizeof(plat_compat8))));
+    }
+
 
     buf =  qemu_uuid_unparse_strdup(&qemu_uuid);
     _FDT((fdt_setprop_string(fdt, 0, "vm,uuid", buf)));
-- 
2.21.0


Re: [Qemu-devel] [PATCH] ppc/pnv: introduce new skiboot platform properties
Posted by David Gibson 4 years, 11 months ago
On Mon, May 27, 2019 at 09:17:49AM +0200, Cédric Le Goater wrote:
> Newer skiboots (after 6.3) support QEMU platforms that have
> characteristics closer to real OpenPOWER systems. The CPU type is used
> to define the BMC drivers: Aspeed AST2400 for POWER8 processors and
> AST2500 for POWER9s.
> 
> Advertise the new platform property names, "qemu,powernv8" and
> "qemu,powernv9", using the CPU type chosen for the QEMU PowerNV
> machine. Also, advertise the original platform name "qemu,powernv" in
> case of POWER8 processors for compatibility with older skiboots.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Applied, thanks.

> ---
>  hw/ppc/pnv.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index dfb4ea5742c1..1f22cbf833a8 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -450,7 +450,8 @@ static void pnv_dt_power_mgt(void *fdt)
>  
>  static void *pnv_dt_create(MachineState *machine)
>  {
> -    const char plat_compat[] = "qemu,powernv\0ibm,powernv";
> +    const char plat_compat8[] = "qemu,powernv8\0qemu,powernv\0ibm,powernv";
> +    const char plat_compat9[] = "qemu,powernv9\0ibm,powernv";
>      PnvMachineState *pnv = PNV_MACHINE(machine);
>      void *fdt;
>      char *buf;
> @@ -465,8 +466,14 @@ static void *pnv_dt_create(MachineState *machine)
>      _FDT((fdt_setprop_cell(fdt, 0, "#size-cells", 0x2)));
>      _FDT((fdt_setprop_string(fdt, 0, "model",
>                               "IBM PowerNV (emulated by qemu)")));
> -    _FDT((fdt_setprop(fdt, 0, "compatible", plat_compat,
> -                      sizeof(plat_compat))));
> +    if (pnv_is_power9(pnv)) {
> +        _FDT((fdt_setprop(fdt, 0, "compatible", plat_compat9,
> +                          sizeof(plat_compat9))));
> +    } else {
> +        _FDT((fdt_setprop(fdt, 0, "compatible", plat_compat8,
> +                          sizeof(plat_compat8))));
> +    }
> +
>  
>      buf =  qemu_uuid_unparse_strdup(&qemu_uuid);
>      _FDT((fdt_setprop_string(fdt, 0, "vm,uuid", buf)));

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson