qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] ppc: New reviewers and KVM cleanups
@ 2023-06-20  5:59 Cédric Le Goater
  2023-06-20  5:59 ` [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation Cédric Le Goater
                   ` (9 more replies)
  0 siblings, 10 replies; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20  5:59 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel, Cédric Le Goater

Hello,

Please welcome new reviewers on baremetal POWER systems !

Follow cleanups to report an error when KVM is used on non-KVM
machines.

Thanks,

C.

Cédric Le Goater (9):
  MAINTAINERS: Add reviewers for PowerNV baremetal emulation
  MAINTAINERS: Add reviewer for PowerPC TCG CPUs
  MAINTAINERS: Add reviewer for XIVE
  ppc/prep: Report an error when run with KVM
  ppc/pegasos2: Report an error when run with KVM
  ppc/sam460ex: Report an error when run with KVM
  ppc/bamboo: Report an error when run with KVM
  ppc/pnv: Rephrase error when run with KVM
  target/ppc: Fix timer register accessors when !KVM

 MAINTAINERS            |  4 ++++
 hw/ppc/pegasos2.c      |  7 ++++++-
 hw/ppc/pnv.c           |  3 ++-
 hw/ppc/ppc440_bamboo.c | 17 ++++++-----------
 hw/ppc/prep.c          | 20 +++++++-------------
 hw/ppc/sam460ex.c      | 15 ++++++---------
 target/ppc/kvm.c       | 12 ++++++++++++
 7 files changed, 43 insertions(+), 35 deletions(-)

-- 
2.41.0



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

* [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation
  2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
@ 2023-06-20  5:59 ` Cédric Le Goater
  2023-06-20  7:11   ` Frederic Barrat
                     ` (2 more replies)
  2023-06-20  5:59 ` [PATCH 2/9] MAINTAINERS: Add reviewer for PowerPC TCG CPUs Cédric Le Goater
                   ` (8 subsequent siblings)
  9 siblings, 3 replies; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20  5:59 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Cédric Le Goater, Frédéric Barrat,
	Nicholas Piggin

Fred and Nick have been hacking baremetal POWER systems (OPAL) for
many years. They use and modify the QEMU models regularly. Add them as
PowerNV reviewers.

Cc: Frédéric Barrat <fbarrat@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 88b5a7ee0a79..e6f3dade2230 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1448,6 +1448,8 @@ F: tests/avocado/ppc_pseries.py
 
 PowerNV (Non-Virtualized)
 M: Cédric Le Goater <clg@kaod.org>
+R: Frédéric Barrat <fbarrat@linux.ibm.com>
+R: Nicholas Piggin <npiggin@gmail.com>
 L: qemu-ppc@nongnu.org
 S: Odd Fixes
 F: docs/system/ppc/powernv.rst
-- 
2.41.0



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

* [PATCH 2/9] MAINTAINERS: Add reviewer for PowerPC TCG CPUs
  2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
  2023-06-20  5:59 ` [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation Cédric Le Goater
@ 2023-06-20  5:59 ` Cédric Le Goater
  2023-06-20  9:11   ` Richard Henderson
                     ` (2 more replies)
  2023-06-20  5:59 ` [PATCH 3/9] MAINTAINERS: Add reviewer for XIVE Cédric Le Goater
                   ` (7 subsequent siblings)
  9 siblings, 3 replies; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20  5:59 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Cédric Le Goater, Nicholas Piggin

Nick has great knowledge of the PowerPC CPUs, software and hardware.
Add him as a reviewer on CPU TCG modeling.

Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index e6f3dade2230..90fb83c4cb58 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -302,6 +302,7 @@ M: Daniel Henrique Barboza <danielhb413@gmail.com>
 R: Cédric Le Goater <clg@kaod.org>
 R: David Gibson <david@gibson.dropbear.id.au>
 R: Greg Kurz <groug@kaod.org>
+R: Nicholas Piggin <npiggin@gmail.com>
 L: qemu-ppc@nongnu.org
 S: Odd Fixes
 F: target/ppc/
-- 
2.41.0



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

* [PATCH 3/9] MAINTAINERS: Add reviewer for XIVE
  2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
  2023-06-20  5:59 ` [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation Cédric Le Goater
  2023-06-20  5:59 ` [PATCH 2/9] MAINTAINERS: Add reviewer for PowerPC TCG CPUs Cédric Le Goater
@ 2023-06-20  5:59 ` Cédric Le Goater
  2023-06-20  7:11   ` Frederic Barrat
  2023-06-20  9:11   ` Richard Henderson
  2023-06-20  5:59 ` [PATCH 4/9] ppc/prep: Report an error when run with KVM Cédric Le Goater
                   ` (6 subsequent siblings)
  9 siblings, 2 replies; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20  5:59 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Cédric Le Goater, Frédéric Barrat

Fred discusses frequently with the IBM HW designers, he is fluent in
XIVE logic, add him as a reviewer.

Cc: Frédéric Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 90fb83c4cb58..2e8c715eaca4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2445,6 +2445,7 @@ T: git https://github.com/philmd/qemu.git fw_cfg-next
 
 XIVE
 M: Cédric Le Goater <clg@kaod.org>
+R: Frédéric Barrat <fbarrat@linux.ibm.com>
 L: qemu-ppc@nongnu.org
 S: Odd Fixes
 F: hw/*/*xive*
-- 
2.41.0



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

* [PATCH 4/9] ppc/prep: Report an error when run with KVM
  2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
                   ` (2 preceding siblings ...)
  2023-06-20  5:59 ` [PATCH 3/9] MAINTAINERS: Add reviewer for XIVE Cédric Le Goater
@ 2023-06-20  5:59 ` Cédric Le Goater
  2023-06-20  9:11   ` Richard Henderson
  2023-06-20  5:59 ` [PATCH 5/9] ppc/pegasos2: " Cédric Le Goater
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20  5:59 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Cédric Le Goater, Hervé Poussineau

The 'prep' machine never supported KVM. This piece of code was
probably inherited from another model.

Cc: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/prep.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 33bf232f8b0d..d9231c731775 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -45,7 +45,6 @@
 #include "trace.h"
 #include "elf.h"
 #include "qemu/units.h"
-#include "kvm_ppc.h"
 
 /* SMP is not enabled, for now */
 #define MAX_CPUS 1
@@ -245,6 +244,12 @@ static void ibm_40p_init(MachineState *machine)
     long kernel_size = 0, initrd_size = 0;
     char boot_device;
 
+    if (kvm_enabled()) {
+        error_report("machine %s does not support the KVM accelerator",
+                     MACHINE_GET_CLASS(machine)->name);
+        exit(EXIT_FAILURE);
+    }
+
     /* init CPU */
     cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
     env = &cpu->env;
@@ -392,18 +397,7 @@ static void ibm_40p_init(MachineState *machine)
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
 
-    fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
-    if (kvm_enabled()) {
-        uint8_t *hypercall;
-
-        fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, kvmppc_get_tbfreq());
-        hypercall = g_malloc(16);
-        kvmppc_get_hypercall(env, hypercall, 16);
-        fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16);
-        fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid());
-    } else {
-        fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, NANOSECONDS_PER_SECOND);
-    }
+    fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, NANOSECONDS_PER_SECOND);
     fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, boot_device);
     qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
 
-- 
2.41.0



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

* [PATCH 5/9] ppc/pegasos2: Report an error when run with KVM
  2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
                   ` (3 preceding siblings ...)
  2023-06-20  5:59 ` [PATCH 4/9] ppc/prep: Report an error when run with KVM Cédric Le Goater
@ 2023-06-20  5:59 ` Cédric Le Goater
  2023-06-20  9:11   ` Richard Henderson
  2023-06-20 10:41   ` BALATON Zoltan
  2023-06-20  5:59 ` [PATCH 6/9] ppc/sam460ex: " Cédric Le Goater
                   ` (4 subsequent siblings)
  9 siblings, 2 replies; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20  5:59 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Cédric Le Goater, BALATON Zoltan

The 'pegasos2' machine never supported KVM. This piece of code was
inherited from another model.

Cc: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/pegasos2.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c
index af5489de26ed..830323cc7849 100644
--- a/hw/ppc/pegasos2.c
+++ b/hw/ppc/pegasos2.c
@@ -29,7 +29,6 @@
 #include "qemu/log.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
-#include "kvm_ppc.h"
 #include "exec/address-spaces.h"
 #include "qom/qom-qobject.h"
 #include "qapi/qmp/qdict.h"
@@ -120,6 +119,12 @@ static void pegasos2_init(MachineState *machine)
     int i, sz;
     uint8_t *spd_data;
 
+    if (kvm_enabled()) {
+        error_report("machine %s does not support the KVM accelerator",
+                     MACHINE_GET_CLASS(machine)->name);
+        exit(EXIT_FAILURE);
+    }
+
     /* init CPU */
     pm->cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
     env = &pm->cpu->env;
-- 
2.41.0



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

* [PATCH 6/9] ppc/sam460ex: Report an error when run with KVM
  2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
                   ` (4 preceding siblings ...)
  2023-06-20  5:59 ` [PATCH 5/9] ppc/pegasos2: " Cédric Le Goater
@ 2023-06-20  5:59 ` Cédric Le Goater
  2023-06-20  9:11   ` Richard Henderson
  2023-06-20 10:42   ` BALATON Zoltan
  2023-06-20  5:59 ` [PATCH 7/9] ppc/bamboo: " Cédric Le Goater
                   ` (3 subsequent siblings)
  9 siblings, 2 replies; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20  5:59 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Cédric Le Goater, BALATON Zoltan

The 'sam460ex' machine never supported KVM. This piece of code was
inherited from another model.

Cc: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/sam460ex.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
index cf065aae0eae..24f25e5897b7 100644
--- a/hw/ppc/sam460ex.c
+++ b/hw/ppc/sam460ex.c
@@ -18,7 +18,6 @@
 #include "qapi/error.h"
 #include "hw/boards.h"
 #include "sysemu/kvm.h"
-#include "kvm_ppc.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/block-backend.h"
 #include "hw/loader.h"
@@ -165,14 +164,6 @@ static int sam460ex_load_device_tree(MachineState *machine,
     qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
                             machine->kernel_cmdline);
 
-    /* Copy data from the host device tree into the guest. Since the guest can
-     * directly access the timebase without host involvement, we must expose
-     * the correct frequencies. */
-    if (kvm_enabled()) {
-        tb_freq = kvmppc_get_tbfreq();
-        clock_freq = kvmppc_get_clockfreq();
-    }
-
     qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "clock-frequency",
                               clock_freq);
     qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "timebase-frequency",
@@ -283,6 +274,12 @@ static void sam460ex_init(MachineState *machine)
     uint8_t *spd_data;
     int success;
 
+    if (kvm_enabled()) {
+        error_report("machine %s does not support the KVM accelerator",
+                     MACHINE_GET_CLASS(machine)->name);
+        exit(EXIT_FAILURE);
+    }
+
     cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
     env = &cpu->env;
     if (env->mmu_model != POWERPC_MMU_BOOKE) {
-- 
2.41.0



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

* [PATCH 7/9] ppc/bamboo: Report an error when run with KVM
  2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
                   ` (5 preceding siblings ...)
  2023-06-20  5:59 ` [PATCH 6/9] ppc/sam460ex: " Cédric Le Goater
@ 2023-06-20  5:59 ` Cédric Le Goater
  2023-06-20  9:11   ` Richard Henderson
  2023-06-20  5:59 ` [PATCH 8/9] ppc/pnv: Rephrase " Cédric Le Goater
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20  5:59 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel, Cédric Le Goater

The 'bamboo' machine was used as a KVM platform in the early days (~2008).
It clearly doesn't support it anymore.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/ppc440_bamboo.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
index f969fa3c29ca..f061b8cf3ba3 100644
--- a/hw/ppc/ppc440_bamboo.c
+++ b/hw/ppc/ppc440_bamboo.c
@@ -19,7 +19,6 @@
 #include "hw/pci/pci.h"
 #include "hw/boards.h"
 #include "sysemu/kvm.h"
-#include "kvm_ppc.h"
 #include "sysemu/device_tree.h"
 #include "hw/loader.h"
 #include "elf.h"
@@ -97,16 +96,6 @@ static int bamboo_load_device_tree(MachineState *machine,
         fprintf(stderr, "couldn't set /chosen/bootargs\n");
     }
 
-    /*
-     * Copy data from the host device tree into the guest. Since the guest can
-     * directly access the timebase without host involvement, we must expose
-     * the correct frequencies.
-     */
-    if (kvm_enabled()) {
-        tb_freq = kvmppc_get_tbfreq();
-        clock_freq = kvmppc_get_clockfreq();
-    }
-
     qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "clock-frequency",
                           clock_freq);
     qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "timebase-frequency",
@@ -175,6 +164,12 @@ static void bamboo_init(MachineState *machine)
     int success;
     int i;
 
+    if (kvm_enabled()) {
+        error_report("machine %s does not support the KVM accelerator",
+                     MACHINE_GET_CLASS(machine)->name);
+        exit(EXIT_FAILURE);
+    }
+
     cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
     env = &cpu->env;
 
-- 
2.41.0



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

* [PATCH 8/9] ppc/pnv: Rephrase error when run with KVM
  2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
                   ` (6 preceding siblings ...)
  2023-06-20  5:59 ` [PATCH 7/9] ppc/bamboo: " Cédric Le Goater
@ 2023-06-20  5:59 ` Cédric Le Goater
  2023-06-20  9:12   ` Richard Henderson
  2023-06-20 11:31   ` Philippe Mathieu-Daudé
  2023-06-20  5:59 ` [PATCH 9/9] target/ppc: Fix timer register accessors when !KVM Cédric Le Goater
  2023-06-23  9:29 ` [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
  9 siblings, 2 replies; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20  5:59 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel, Cédric Le Goater

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

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 590fc64b32e9..fc083173f346 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -799,7 +799,8 @@ static void pnv_init(MachineState *machine)
     DeviceState *dev;
 
     if (kvm_enabled()) {
-        error_report("The powernv machine does not work with KVM acceleration");
+        error_report("machine %s does not support the KVM accelerator",
+                     mc->name);
         exit(EXIT_FAILURE);
     }
 
-- 
2.41.0



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

* [PATCH 9/9] target/ppc: Fix timer register accessors when !KVM
  2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
                   ` (7 preceding siblings ...)
  2023-06-20  5:59 ` [PATCH 8/9] ppc/pnv: Rephrase " Cédric Le Goater
@ 2023-06-20  5:59 ` Cédric Le Goater
  2023-06-20  9:10   ` Richard Henderson
  2023-06-23  9:29 ` [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
  9 siblings, 1 reply; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20  5:59 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel, Cédric Le Goater

When the Timer Control and Timer Status registers are modified, avoid
calling the KVM backend when not available

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 target/ppc/kvm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index a7f2de9d1018..a8a935e26726 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1728,6 +1728,10 @@ int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
         .addr = (uintptr_t) &bits,
     };
 
+    if (!kvm_enabled()) {
+        return 0;
+    }
+
     return kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &reg);
 }
 
@@ -1741,6 +1745,10 @@ int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
         .addr = (uintptr_t) &bits,
     };
 
+    if (!kvm_enabled()) {
+        return 0;
+    }
+
     return kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &reg);
 }
 
@@ -1755,6 +1763,10 @@ int kvmppc_set_tcr(PowerPCCPU *cpu)
         .addr = (uintptr_t) &tcr,
     };
 
+    if (!kvm_enabled()) {
+        return 0;
+    }
+
     return kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &reg);
 }
 
-- 
2.41.0



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

* Re: [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation
  2023-06-20  5:59 ` [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation Cédric Le Goater
@ 2023-06-20  7:11   ` Frederic Barrat
  2023-06-20  9:11   ` Richard Henderson
  2023-06-20  9:40   ` Nicholas Piggin
  2 siblings, 0 replies; 32+ messages in thread
From: Frederic Barrat @ 2023-06-20  7:11 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Nicholas Piggin



On 20/06/2023 07:59, Cédric Le Goater wrote:
> Fred and Nick have been hacking baremetal POWER systems (OPAL) for
> many years. They use and modify the QEMU models regularly. Add them as
> PowerNV reviewers.
> 
> Cc: Frédéric Barrat <fbarrat@linux.ibm.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---


Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>

   Fred


>   MAINTAINERS | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 88b5a7ee0a79..e6f3dade2230 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1448,6 +1448,8 @@ F: tests/avocado/ppc_pseries.py
>   
>   PowerNV (Non-Virtualized)
>   M: Cédric Le Goater <clg@kaod.org>
> +R: Frédéric Barrat <fbarrat@linux.ibm.com>
> +R: Nicholas Piggin <npiggin@gmail.com>
>   L: qemu-ppc@nongnu.org
>   S: Odd Fixes
>   F: docs/system/ppc/powernv.rst


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

* Re: [PATCH 3/9] MAINTAINERS: Add reviewer for XIVE
  2023-06-20  5:59 ` [PATCH 3/9] MAINTAINERS: Add reviewer for XIVE Cédric Le Goater
@ 2023-06-20  7:11   ` Frederic Barrat
  2023-06-20  9:11   ` Richard Henderson
  1 sibling, 0 replies; 32+ messages in thread
From: Frederic Barrat @ 2023-06-20  7:11 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel



On 20/06/2023 07:59, Cédric Le Goater wrote:
> Fred discusses frequently with the IBM HW designers, he is fluent in
> XIVE logic, add him as a reviewer.
> 
> Cc: Frédéric Barrat <fbarrat@linux.ibm.com>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>

   Fred


>   MAINTAINERS | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 90fb83c4cb58..2e8c715eaca4 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2445,6 +2445,7 @@ T: git https://github.com/philmd/qemu.git fw_cfg-next
>   
>   XIVE
>   M: Cédric Le Goater <clg@kaod.org>
> +R: Frédéric Barrat <fbarrat@linux.ibm.com>
>   L: qemu-ppc@nongnu.org
>   S: Odd Fixes
>   F: hw/*/*xive*


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

* Re: [PATCH 9/9] target/ppc: Fix timer register accessors when !KVM
  2023-06-20  5:59 ` [PATCH 9/9] target/ppc: Fix timer register accessors when !KVM Cédric Le Goater
@ 2023-06-20  9:10   ` Richard Henderson
  2023-06-20 11:53     ` Cédric Le Goater
  0 siblings, 1 reply; 32+ messages in thread
From: Richard Henderson @ 2023-06-20  9:10 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel

On 6/20/23 07:59, Cédric Le Goater wrote:
> When the Timer Control and Timer Status registers are modified, avoid
> calling the KVM backend when not available
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>   target/ppc/kvm.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index a7f2de9d1018..a8a935e26726 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -1728,6 +1728,10 @@ int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
>           .addr = (uintptr_t) &bits,
>       };
>   
> +    if (!kvm_enabled()) {
> +        return 0;
> +    }

assert(kvm_enabled()) ?


r~


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

* Re: [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation
  2023-06-20  5:59 ` [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation Cédric Le Goater
  2023-06-20  7:11   ` Frederic Barrat
@ 2023-06-20  9:11   ` Richard Henderson
  2023-06-20  9:40   ` Nicholas Piggin
  2 siblings, 0 replies; 32+ messages in thread
From: Richard Henderson @ 2023-06-20  9:11 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Frédéric Barrat, Nicholas Piggin

On 6/20/23 07:59, Cédric Le Goater wrote:
> Fred and Nick have been hacking baremetal POWER systems (OPAL) for
> many years. They use and modify the QEMU models regularly. Add them as
> PowerNV reviewers.
> 
> Cc: Frédéric Barrat<fbarrat@linux.ibm.com>
> Cc: Nicholas Piggin<npiggin@gmail.com>
> Signed-off-by: Cédric Le Goater<clg@kaod.org>
> ---
>   MAINTAINERS | 2 ++
>   1 file changed, 2 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 2/9] MAINTAINERS: Add reviewer for PowerPC TCG CPUs
  2023-06-20  5:59 ` [PATCH 2/9] MAINTAINERS: Add reviewer for PowerPC TCG CPUs Cédric Le Goater
@ 2023-06-20  9:11   ` Richard Henderson
  2023-06-20  9:40   ` Nicholas Piggin
  2023-06-20 10:18   ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 32+ messages in thread
From: Richard Henderson @ 2023-06-20  9:11 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Nicholas Piggin

On 6/20/23 07:59, Cédric Le Goater wrote:
> Nick has great knowledge of the PowerPC CPUs, software and hardware.
> Add him as a reviewer on CPU TCG modeling.
> 
> Cc: Nicholas Piggin<npiggin@gmail.com>
> Signed-off-by: Cédric Le Goater<clg@kaod.org>
> ---
>   MAINTAINERS | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


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

* Re: [PATCH 3/9] MAINTAINERS: Add reviewer for XIVE
  2023-06-20  5:59 ` [PATCH 3/9] MAINTAINERS: Add reviewer for XIVE Cédric Le Goater
  2023-06-20  7:11   ` Frederic Barrat
@ 2023-06-20  9:11   ` Richard Henderson
  1 sibling, 0 replies; 32+ messages in thread
From: Richard Henderson @ 2023-06-20  9:11 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Frédéric Barrat

On 6/20/23 07:59, Cédric Le Goater wrote:
> Fred discusses frequently with the IBM HW designers, he is fluent in
> XIVE logic, add him as a reviewer.
> 
> Cc: Frédéric Barrat<fbarrat@linux.ibm.com>
> Signed-off-by: Cédric Le Goater<clg@kaod.org>
> ---
>   MAINTAINERS | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



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

* Re: [PATCH 4/9] ppc/prep: Report an error when run with KVM
  2023-06-20  5:59 ` [PATCH 4/9] ppc/prep: Report an error when run with KVM Cédric Le Goater
@ 2023-06-20  9:11   ` Richard Henderson
  0 siblings, 0 replies; 32+ messages in thread
From: Richard Henderson @ 2023-06-20  9:11 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Hervé Poussineau

On 6/20/23 07:59, Cédric Le Goater wrote:
> The 'prep' machine never supported KVM. This piece of code was
> probably inherited from another model.
> 
> Cc: Hervé Poussineau<hpoussin@reactos.org>
> Signed-off-by: Cédric Le Goater<clg@kaod.org>
> ---
>   hw/ppc/prep.c | 20 +++++++-------------
>   1 file changed, 7 insertions(+), 13 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 5/9] ppc/pegasos2: Report an error when run with KVM
  2023-06-20  5:59 ` [PATCH 5/9] ppc/pegasos2: " Cédric Le Goater
@ 2023-06-20  9:11   ` Richard Henderson
  2023-06-20 10:41   ` BALATON Zoltan
  1 sibling, 0 replies; 32+ messages in thread
From: Richard Henderson @ 2023-06-20  9:11 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, BALATON Zoltan

On 6/20/23 07:59, Cédric Le Goater wrote:
> The 'pegasos2' machine never supported KVM. This piece of code was
> inherited from another model.
> 
> Cc: BALATON Zoltan<balaton@eik.bme.hu>
> Signed-off-by: Cédric Le Goater<clg@kaod.org>
> ---
>   hw/ppc/pegasos2.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 6/9] ppc/sam460ex: Report an error when run with KVM
  2023-06-20  5:59 ` [PATCH 6/9] ppc/sam460ex: " Cédric Le Goater
@ 2023-06-20  9:11   ` Richard Henderson
  2023-06-20 10:42   ` BALATON Zoltan
  1 sibling, 0 replies; 32+ messages in thread
From: Richard Henderson @ 2023-06-20  9:11 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, BALATON Zoltan

On 6/20/23 07:59, Cédric Le Goater wrote:
> The 'sam460ex' machine never supported KVM. This piece of code was
> inherited from another model.
> 
> Cc: BALATON Zoltan<balaton@eik.bme.hu>
> Signed-off-by: Cédric Le Goater<clg@kaod.org>
> ---
>   hw/ppc/sam460ex.c | 15 ++++++---------
>   1 file changed, 6 insertions(+), 9 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 7/9] ppc/bamboo: Report an error when run with KVM
  2023-06-20  5:59 ` [PATCH 7/9] ppc/bamboo: " Cédric Le Goater
@ 2023-06-20  9:11   ` Richard Henderson
  0 siblings, 0 replies; 32+ messages in thread
From: Richard Henderson @ 2023-06-20  9:11 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel

On 6/20/23 07:59, Cédric Le Goater wrote:
> The 'bamboo' machine was used as a KVM platform in the early days (~2008).
> It clearly doesn't support it anymore.
> 
> Signed-off-by: Cédric Le Goater<clg@kaod.org>
> ---
>   hw/ppc/ppc440_bamboo.c | 17 ++++++-----------
>   1 file changed, 6 insertions(+), 11 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 8/9] ppc/pnv: Rephrase error when run with KVM
  2023-06-20  5:59 ` [PATCH 8/9] ppc/pnv: Rephrase " Cédric Le Goater
@ 2023-06-20  9:12   ` Richard Henderson
  2023-06-20 11:31   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 32+ messages in thread
From: Richard Henderson @ 2023-06-20  9:12 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel

On 6/20/23 07:59, Cédric Le Goater wrote:
> Signed-off-by: Cédric Le Goater<clg@kaod.org>
> ---
>   hw/ppc/pnv.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation
  2023-06-20  5:59 ` [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation Cédric Le Goater
  2023-06-20  7:11   ` Frederic Barrat
  2023-06-20  9:11   ` Richard Henderson
@ 2023-06-20  9:40   ` Nicholas Piggin
  2 siblings, 0 replies; 32+ messages in thread
From: Nicholas Piggin @ 2023-06-20  9:40 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Frédéric Barrat

On Tue Jun 20, 2023 at 3:59 PM AEST, Cédric Le Goater wrote:
> Fred and Nick have been hacking baremetal POWER systems (OPAL) for
> many years. They use and modify the QEMU models regularly. Add them as
> PowerNV reviewers.
>

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>

> Cc: Frédéric Barrat <fbarrat@linux.ibm.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  MAINTAINERS | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 88b5a7ee0a79..e6f3dade2230 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1448,6 +1448,8 @@ F: tests/avocado/ppc_pseries.py
>  
>  PowerNV (Non-Virtualized)
>  M: Cédric Le Goater <clg@kaod.org>
> +R: Frédéric Barrat <fbarrat@linux.ibm.com>
> +R: Nicholas Piggin <npiggin@gmail.com>
>  L: qemu-ppc@nongnu.org
>  S: Odd Fixes
>  F: docs/system/ppc/powernv.rst
> -- 
> 2.41.0



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

* Re: [PATCH 2/9] MAINTAINERS: Add reviewer for PowerPC TCG CPUs
  2023-06-20  5:59 ` [PATCH 2/9] MAINTAINERS: Add reviewer for PowerPC TCG CPUs Cédric Le Goater
  2023-06-20  9:11   ` Richard Henderson
@ 2023-06-20  9:40   ` Nicholas Piggin
  2023-06-20 10:18   ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 32+ messages in thread
From: Nicholas Piggin @ 2023-06-20  9:40 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel

On Tue Jun 20, 2023 at 3:59 PM AEST, Cédric Le Goater wrote:
> Nick has great knowledge of the PowerPC CPUs, software and hardware.
> Add him as a reviewer on CPU TCG modeling.

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>

>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e6f3dade2230..90fb83c4cb58 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -302,6 +302,7 @@ M: Daniel Henrique Barboza <danielhb413@gmail.com>
>  R: Cédric Le Goater <clg@kaod.org>
>  R: David Gibson <david@gibson.dropbear.id.au>
>  R: Greg Kurz <groug@kaod.org>
> +R: Nicholas Piggin <npiggin@gmail.com>
>  L: qemu-ppc@nongnu.org
>  S: Odd Fixes
>  F: target/ppc/
> -- 
> 2.41.0



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

* Re: [PATCH 2/9] MAINTAINERS: Add reviewer for PowerPC TCG CPUs
  2023-06-20  5:59 ` [PATCH 2/9] MAINTAINERS: Add reviewer for PowerPC TCG CPUs Cédric Le Goater
  2023-06-20  9:11   ` Richard Henderson
  2023-06-20  9:40   ` Nicholas Piggin
@ 2023-06-20 10:18   ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-20 10:18 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, Daniel Henrique Barboza
  Cc: qemu-devel, Nicholas Piggin

On 20/6/23 07:59, Cédric Le Goater wrote:
> Nick has great knowledge of the PowerPC CPUs, software and hardware.
> Add him as a reviewer on CPU TCG modeling.
> 
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>   MAINTAINERS | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>




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

* Re: [PATCH 5/9] ppc/pegasos2: Report an error when run with KVM
  2023-06-20  5:59 ` [PATCH 5/9] ppc/pegasos2: " Cédric Le Goater
  2023-06-20  9:11   ` Richard Henderson
@ 2023-06-20 10:41   ` BALATON Zoltan
  1 sibling, 0 replies; 32+ messages in thread
From: BALATON Zoltan @ 2023-06-20 10:41 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: qemu-ppc, Daniel Henrique Barboza, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1670 bytes --]

On Tue, 20 Jun 2023, Cédric Le Goater wrote:
> The 'pegasos2' machine never supported KVM. This piece of code was
> inherited from another model.

Why? These machines are supposed to run with KVM they were just not tested 
yet. I think pegasos2 should work on a G4 host with KVM-PR but you need to 
use the firmware rom for -bios now because VOF uses sc 1 which will not 
work with KVM on G4, it's only supported with TCG. (I plan to solve this 
eventually when needed by replacing that with another hypercall method 
such as OSI used by MOL but that would need two vof binaries or carry 
some unneeded code if using single binary.)

So please drop this patch.

Regards,
BALATON Zoltan

> Cc: BALATON Zoltan <balaton@eik.bme.hu>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> hw/ppc/pegasos2.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c
> index af5489de26ed..830323cc7849 100644
> --- a/hw/ppc/pegasos2.c
> +++ b/hw/ppc/pegasos2.c
> @@ -29,7 +29,6 @@
> #include "qemu/log.h"
> #include "qemu/error-report.h"
> #include "sysemu/kvm.h"
> -#include "kvm_ppc.h"
> #include "exec/address-spaces.h"
> #include "qom/qom-qobject.h"
> #include "qapi/qmp/qdict.h"
> @@ -120,6 +119,12 @@ static void pegasos2_init(MachineState *machine)
>     int i, sz;
>     uint8_t *spd_data;
>
> +    if (kvm_enabled()) {
> +        error_report("machine %s does not support the KVM accelerator",
> +                     MACHINE_GET_CLASS(machine)->name);
> +        exit(EXIT_FAILURE);
> +    }
> +
>     /* init CPU */
>     pm->cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
>     env = &pm->cpu->env;
>

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

* Re: [PATCH 6/9] ppc/sam460ex: Report an error when run with KVM
  2023-06-20  5:59 ` [PATCH 6/9] ppc/sam460ex: " Cédric Le Goater
  2023-06-20  9:11   ` Richard Henderson
@ 2023-06-20 10:42   ` BALATON Zoltan
  2023-06-20 10:52     ` Cédric Le Goater
  1 sibling, 1 reply; 32+ messages in thread
From: BALATON Zoltan @ 2023-06-20 10:42 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: qemu-ppc, Daniel Henrique Barboza, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2080 bytes --]

On Tue, 20 Jun 2023, Cédric Le Goater wrote:
> The 'sam460ex' machine never supported KVM. This piece of code was
> inherited from another model.

This is the same as for pegasos2, it might work on a BookE host if KVM-PR 
on that host is still supported so please keep this around unless there's 
a known problem that can't be fixed.

Regards,
BALATON Zoltan

> Cc: BALATON Zoltan <balaton@eik.bme.hu>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> hw/ppc/sam460ex.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
> index cf065aae0eae..24f25e5897b7 100644
> --- a/hw/ppc/sam460ex.c
> +++ b/hw/ppc/sam460ex.c
> @@ -18,7 +18,6 @@
> #include "qapi/error.h"
> #include "hw/boards.h"
> #include "sysemu/kvm.h"
> -#include "kvm_ppc.h"
> #include "sysemu/device_tree.h"
> #include "sysemu/block-backend.h"
> #include "hw/loader.h"
> @@ -165,14 +164,6 @@ static int sam460ex_load_device_tree(MachineState *machine,
>     qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
>                             machine->kernel_cmdline);
>
> -    /* Copy data from the host device tree into the guest. Since the guest can
> -     * directly access the timebase without host involvement, we must expose
> -     * the correct frequencies. */
> -    if (kvm_enabled()) {
> -        tb_freq = kvmppc_get_tbfreq();
> -        clock_freq = kvmppc_get_clockfreq();
> -    }
> -
>     qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "clock-frequency",
>                               clock_freq);
>     qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "timebase-frequency",
> @@ -283,6 +274,12 @@ static void sam460ex_init(MachineState *machine)
>     uint8_t *spd_data;
>     int success;
>
> +    if (kvm_enabled()) {
> +        error_report("machine %s does not support the KVM accelerator",
> +                     MACHINE_GET_CLASS(machine)->name);
> +        exit(EXIT_FAILURE);
> +    }
> +
>     cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
>     env = &cpu->env;
>     if (env->mmu_model != POWERPC_MMU_BOOKE) {
>

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

* Re: [PATCH 6/9] ppc/sam460ex: Report an error when run with KVM
  2023-06-20 10:42   ` BALATON Zoltan
@ 2023-06-20 10:52     ` Cédric Le Goater
  2023-06-20 10:56       ` BALATON Zoltan
  0 siblings, 1 reply; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20 10:52 UTC (permalink / raw)
  To: BALATON Zoltan; +Cc: qemu-ppc, Daniel Henrique Barboza, qemu-devel

On 6/20/23 12:42, BALATON Zoltan wrote:
> On Tue, 20 Jun 2023, Cédric Le Goater wrote:
>> The 'sam460ex' machine never supported KVM. This piece of code was
>> inherited from another model.
> 
> This is the same as for pegasos2, it might work on a BookE host if KVM-PR on that host is still supported so please keep this around unless there's a known problem that can't be fixed.

That sounds like a lot of 'if' for 2 decade old HW and an abandoned HV
implementation. Nevertheless, if KVM is supported one day, we can remove
easily the couple of lines below. I am sure there will be more changes.

Same comment for the pegasos2,

Thanks,

C.

> 
> Regards,
> BALATON Zoltan
> 
>> Cc: BALATON Zoltan <balaton@eik.bme.hu>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>> hw/ppc/sam460ex.c | 15 ++++++---------
>> 1 file changed, 6 insertions(+), 9 deletions(-)
>>
>> diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
>> index cf065aae0eae..24f25e5897b7 100644
>> --- a/hw/ppc/sam460ex.c
>> +++ b/hw/ppc/sam460ex.c
>> @@ -18,7 +18,6 @@
>> #include "qapi/error.h"
>> #include "hw/boards.h"
>> #include "sysemu/kvm.h"
>> -#include "kvm_ppc.h"
>> #include "sysemu/device_tree.h"
>> #include "sysemu/block-backend.h"
>> #include "hw/loader.h"
>> @@ -165,14 +164,6 @@ static int sam460ex_load_device_tree(MachineState *machine,
>>     qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
>>                             machine->kernel_cmdline);
>>
>> -    /* Copy data from the host device tree into the guest. Since the guest can
>> -     * directly access the timebase without host involvement, we must expose
>> -     * the correct frequencies. */
>> -    if (kvm_enabled()) {
>> -        tb_freq = kvmppc_get_tbfreq();
>> -        clock_freq = kvmppc_get_clockfreq();
>> -    }
>> -
>>     qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "clock-frequency",
>>                               clock_freq);
>>     qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "timebase-frequency",
>> @@ -283,6 +274,12 @@ static void sam460ex_init(MachineState *machine)
>>     uint8_t *spd_data;
>>     int success;
>>
>> +    if (kvm_enabled()) {
>> +        error_report("machine %s does not support the KVM accelerator",
>> +                     MACHINE_GET_CLASS(machine)->name);
>> +        exit(EXIT_FAILURE);
>> +    }
>> +
>>     cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
>>     env = &cpu->env;
>>     if (env->mmu_model != POWERPC_MMU_BOOKE) {
>>



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

* Re: [PATCH 6/9] ppc/sam460ex: Report an error when run with KVM
  2023-06-20 10:52     ` Cédric Le Goater
@ 2023-06-20 10:56       ` BALATON Zoltan
  0 siblings, 0 replies; 32+ messages in thread
From: BALATON Zoltan @ 2023-06-20 10:56 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: qemu-ppc, Daniel Henrique Barboza, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 3024 bytes --]

On Tue, 20 Jun 2023, Cédric Le Goater wrote:
> On 6/20/23 12:42, BALATON Zoltan wrote:
>> On Tue, 20 Jun 2023, Cédric Le Goater wrote:
>>> The 'sam460ex' machine never supported KVM. This piece of code was
>>> inherited from another model.
>> 
>> This is the same as for pegasos2, it might work on a BookE host if KVM-PR 
>> on that host is still supported so please keep this around unless there's a 
>> known problem that can't be fixed.
>
> That sounds like a lot of 'if' for 2 decade old HW and an abandoned HV
> implementation. Nevertheless, if KVM is supported one day, we can remove
> easily the couple of lines below. I am sure there will be more changes.
>
> Same comment for the pegasos2,

If you disable it then nobody can test it so it can't be supported. I need 
people to be able to test it to support it so please leave this enabled. 
(People using these machines don't normally compile their binaries from 
source and don't want to.)

Regards,
BALATON Zoltan

> Thanks,
>
> C.
>
>> 
>> Regards,
>> BALATON Zoltan
>> 
>>> Cc: BALATON Zoltan <balaton@eik.bme.hu>
>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>>> ---
>>> hw/ppc/sam460ex.c | 15 ++++++---------
>>> 1 file changed, 6 insertions(+), 9 deletions(-)
>>> 
>>> diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
>>> index cf065aae0eae..24f25e5897b7 100644
>>> --- a/hw/ppc/sam460ex.c
>>> +++ b/hw/ppc/sam460ex.c
>>> @@ -18,7 +18,6 @@
>>> #include "qapi/error.h"
>>> #include "hw/boards.h"
>>> #include "sysemu/kvm.h"
>>> -#include "kvm_ppc.h"
>>> #include "sysemu/device_tree.h"
>>> #include "sysemu/block-backend.h"
>>> #include "hw/loader.h"
>>> @@ -165,14 +164,6 @@ static int sam460ex_load_device_tree(MachineState 
>>> *machine,
>>>     qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
>>>                             machine->kernel_cmdline);
>>> 
>>> -    /* Copy data from the host device tree into the guest. Since the 
>>> guest can
>>> -     * directly access the timebase without host involvement, we must 
>>> expose
>>> -     * the correct frequencies. */
>>> -    if (kvm_enabled()) {
>>> -        tb_freq = kvmppc_get_tbfreq();
>>> -        clock_freq = kvmppc_get_clockfreq();
>>> -    }
>>> -
>>>     qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "clock-frequency",
>>>                               clock_freq);
>>>     qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "timebase-frequency",
>>> @@ -283,6 +274,12 @@ static void sam460ex_init(MachineState *machine)
>>>     uint8_t *spd_data;
>>>     int success;
>>> 
>>> +    if (kvm_enabled()) {
>>> +        error_report("machine %s does not support the KVM accelerator",
>>> +                     MACHINE_GET_CLASS(machine)->name);
>>> +        exit(EXIT_FAILURE);
>>> +    }
>>> +
>>>     cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
>>>     env = &cpu->env;
>>>     if (env->mmu_model != POWERPC_MMU_BOOKE) {
>>> 
>
>
>

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

* Re: [PATCH 8/9] ppc/pnv: Rephrase error when run with KVM
  2023-06-20  5:59 ` [PATCH 8/9] ppc/pnv: Rephrase " Cédric Le Goater
  2023-06-20  9:12   ` Richard Henderson
@ 2023-06-20 11:31   ` Philippe Mathieu-Daudé
  2023-06-20 11:38     ` [SPAM] " Cédric Le Goater
  1 sibling, 1 reply; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-20 11:31 UTC (permalink / raw)
  To: Cédric Le Goater, Thomas Huth, Richard Henderson,
	Paolo Bonzini, Markus Armbruster
  Cc: qemu-devel, qemu-ppc, Daniel Henrique Barboza, Fabiano Rosas,
	Claudio Fontana

On 20/6/23 07:59, Cédric Le Goater wrote:
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>   hw/ppc/pnv.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 590fc64b32e9..fc083173f346 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -799,7 +799,8 @@ static void pnv_init(MachineState *machine)
>       DeviceState *dev;
>   
>       if (kvm_enabled()) {
> -        error_report("The powernv machine does not work with KVM acceleration");
> +        error_report("machine %s does not support the KVM accelerator",
> +                     mc->name);
>           exit(EXIT_FAILURE);
>       }
>   

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Now thinking loudly, we could have an array of allowed accelerators
in MachineClass, similarly to allowed_dynamic_sysbus_devices[], then
handle this generically.


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

* Re: [SPAM] Re: [PATCH 8/9] ppc/pnv: Rephrase error when run with KVM
  2023-06-20 11:31   ` Philippe Mathieu-Daudé
@ 2023-06-20 11:38     ` Cédric Le Goater
  0 siblings, 0 replies; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20 11:38 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Thomas Huth, Richard Henderson,
	Paolo Bonzini, Markus Armbruster
  Cc: qemu-devel, qemu-ppc, Daniel Henrique Barboza, Fabiano Rosas,
	Claudio Fontana

On 6/20/23 13:31, Philippe Mathieu-Daudé wrote:
> On 20/6/23 07:59, Cédric Le Goater wrote:
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>   hw/ppc/pnv.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
>> index 590fc64b32e9..fc083173f346 100644
>> --- a/hw/ppc/pnv.c
>> +++ b/hw/ppc/pnv.c
>> @@ -799,7 +799,8 @@ static void pnv_init(MachineState *machine)
>>       DeviceState *dev;
>>       if (kvm_enabled()) {
>> -        error_report("The powernv machine does not work with KVM acceleration");
>> +        error_report("machine %s does not support the KVM accelerator",
>> +                     mc->name);
>>           exit(EXIT_FAILURE);
>>       }
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> Now thinking loudly, we could have an array of allowed accelerators
> in MachineClass, similarly to allowed_dynamic_sysbus_devices[], then
> handle this generically.

I agree. I had something like that in mind as a followup.

C.
  


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

* Re: [PATCH 9/9] target/ppc: Fix timer register accessors when !KVM
  2023-06-20  9:10   ` Richard Henderson
@ 2023-06-20 11:53     ` Cédric Le Goater
  0 siblings, 0 replies; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-20 11:53 UTC (permalink / raw)
  To: Richard Henderson, qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel

On 6/20/23 11:10, Richard Henderson wrote:
> On 6/20/23 07:59, Cédric Le Goater wrote:
>> When the Timer Control and Timer Status registers are modified, avoid
>> calling the KVM backend when not available
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>   target/ppc/kvm.c | 12 ++++++++++++
>>   1 file changed, 12 insertions(+)
>>
>> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
>> index a7f2de9d1018..a8a935e26726 100644
>> --- a/target/ppc/kvm.c
>> +++ b/target/ppc/kvm.c
>> @@ -1728,6 +1728,10 @@ int kvmppc_or_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits)
>>           .addr = (uintptr_t) &bits,
>>       };
>> +    if (!kvm_enabled()) {
>> +        return 0;
>> +    }
> 
> assert(kvm_enabled()) ?
> 

Well, the callers store_booke_t[cs]r() can be called from instruction
implementation and from the timer reset handler, which is common to all
accelerators.

This is only important when running some of the emulated BookE machines
on a PPC64 host, which enables KVM. This is not the most common host
config but nevertheless, the machines should run and this fixes it.

Thanks,

C.


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

* Re: [PATCH 0/9] ppc: New reviewers and KVM cleanups
  2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
                   ` (8 preceding siblings ...)
  2023-06-20  5:59 ` [PATCH 9/9] target/ppc: Fix timer register accessors when !KVM Cédric Le Goater
@ 2023-06-23  9:29 ` Cédric Le Goater
  9 siblings, 0 replies; 32+ messages in thread
From: Cédric Le Goater @ 2023-06-23  9:29 UTC (permalink / raw)
  To: qemu-ppc, Daniel Henrique Barboza; +Cc: qemu-devel

On 6/20/23 07:59, Cédric Le Goater wrote:
> Hello,
> 
> Please welcome new reviewers on baremetal POWER systems !
> 
> Follow cleanups to report an error when KVM is used on non-KVM
> machines.
> 
> Thanks,
> 
> C.
> 
> Cédric Le Goater (9):
>    MAINTAINERS: Add reviewers for PowerNV baremetal emulation
>    MAINTAINERS: Add reviewer for PowerPC TCG CPUs
>    MAINTAINERS: Add reviewer for XIVE
>    ppc/prep: Report an error when run with KVM
>    ppc/pegasos2: Report an error when run with KVM
>    ppc/sam460ex: Report an error when run with KVM
>    ppc/bamboo: Report an error when run with KVM
>    ppc/pnv: Rephrase error when run with KVM
>    target/ppc: Fix timer register accessors when !KVM
> 
>   MAINTAINERS            |  4 ++++
>   hw/ppc/pegasos2.c      |  7 ++++++-
>   hw/ppc/pnv.c           |  3 ++-
>   hw/ppc/ppc440_bamboo.c | 17 ++++++-----------
>   hw/ppc/prep.c          | 20 +++++++-------------
>   hw/ppc/sam460ex.c      | 15 ++++++---------
>   target/ppc/kvm.c       | 12 ++++++++++++
>   7 files changed, 43 insertions(+), 35 deletions(-)
> 

Applied to ppc-next, without the sam460ex and pegasos2 changes as requested
by Zoltan.

Thanks,

C.




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

end of thread, other threads:[~2023-06-23  9:30 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-20  5:59 [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater
2023-06-20  5:59 ` [PATCH 1/9] MAINTAINERS: Add reviewers for PowerNV baremetal emulation Cédric Le Goater
2023-06-20  7:11   ` Frederic Barrat
2023-06-20  9:11   ` Richard Henderson
2023-06-20  9:40   ` Nicholas Piggin
2023-06-20  5:59 ` [PATCH 2/9] MAINTAINERS: Add reviewer for PowerPC TCG CPUs Cédric Le Goater
2023-06-20  9:11   ` Richard Henderson
2023-06-20  9:40   ` Nicholas Piggin
2023-06-20 10:18   ` Philippe Mathieu-Daudé
2023-06-20  5:59 ` [PATCH 3/9] MAINTAINERS: Add reviewer for XIVE Cédric Le Goater
2023-06-20  7:11   ` Frederic Barrat
2023-06-20  9:11   ` Richard Henderson
2023-06-20  5:59 ` [PATCH 4/9] ppc/prep: Report an error when run with KVM Cédric Le Goater
2023-06-20  9:11   ` Richard Henderson
2023-06-20  5:59 ` [PATCH 5/9] ppc/pegasos2: " Cédric Le Goater
2023-06-20  9:11   ` Richard Henderson
2023-06-20 10:41   ` BALATON Zoltan
2023-06-20  5:59 ` [PATCH 6/9] ppc/sam460ex: " Cédric Le Goater
2023-06-20  9:11   ` Richard Henderson
2023-06-20 10:42   ` BALATON Zoltan
2023-06-20 10:52     ` Cédric Le Goater
2023-06-20 10:56       ` BALATON Zoltan
2023-06-20  5:59 ` [PATCH 7/9] ppc/bamboo: " Cédric Le Goater
2023-06-20  9:11   ` Richard Henderson
2023-06-20  5:59 ` [PATCH 8/9] ppc/pnv: Rephrase " Cédric Le Goater
2023-06-20  9:12   ` Richard Henderson
2023-06-20 11:31   ` Philippe Mathieu-Daudé
2023-06-20 11:38     ` [SPAM] " Cédric Le Goater
2023-06-20  5:59 ` [PATCH 9/9] target/ppc: Fix timer register accessors when !KVM Cédric Le Goater
2023-06-20  9:10   ` Richard Henderson
2023-06-20 11:53     ` Cédric Le Goater
2023-06-23  9:29 ` [PATCH 0/9] ppc: New reviewers and KVM cleanups Cédric Le Goater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).