Skip to contentSkip to conversation

hw/ppc/spapr: Rename 'softmmu'

PATCH In review Nicholas Piggin 2 participants 6 messages Jan 18, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

v2 cover hw/ppc/spapr: Rename 'softmmu'

I grabbed Philippe's series series and tried to use a more agreeable name. Further disagreement is okay, but must come with a better alternative :) would be good to get this out of the way. I actually don't think softmmu is a great term for it either even in isolation, so would be good to move away from it.

Previous discussion:
https://lists.gnu.org/archive/html/qemu-ppc/2023-10/msg00016.html

Thanks,
Nick

Philippe Mathieu-Daudé (4):
hw/ppc/spapr: Add missing license hw/ppc/spapr_hcall: Allow elision of softmmu_resize_hpt_prep hw/ppc/spapr_hcall: Rename {softmmu -> vhyp_mmu}_resize_hpt_pr hw/ppc/spapr: Rename 'softmmu' -> 'vhyp_mmu'

 include/hw/ppc/spapr.h                       |  9 ++++++---
 hw/ppc/spapr_hcall.c                         | 12 ++++++++----
 hw/ppc/{spapr_softmmu.c => spapr_vhyp_mmu.c} | 13 +++++++++++--
 target/ppc/tcg-stub.c                        | 15 ---------------
 hw/ppc/meson.build                           |  2 +-
 5 files changed, 26 insertions(+), 25 deletions(-)
 rename hw/ppc/{spapr_softmmu.c => spapr_vhyp_mmu.c} (97%)
Signature · 1 line
2.42.0
#1 lore raw

PATCH v2 1/4 hw/ppc/spapr: Add missing license

From: Philippe Mathieu-Daudé <[email protected]>

Commit 9fdf0c2995 ("Start implementing pSeries logical partition machine") added hw/ppc/spapr_hcall.c, then commit 962104f044 ("hw/ppc: moved hcalls that depend on softmmu") extracted the system code to hw/ppc/spapr_softmmu.c. Take the license and copyrights from the original spapr_hcall.c at commit 9fdf0c2995.

[npiggin: Update file description.]
---
 hw/ppc/spapr_softmmu.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/ppc/spapr_softmmu.c +9 -0
index fc1bbc0b61..2fade94029 100644
@@ -1,3 +1,12 @@
+/*
+ * MMU hypercalls for the sPAPR (pseries) vHyp hypervisor that is used by TCG
+ *
+ * Copyright (c) 2004-2007 Fabrice Bellard
+ * Copyright (c) 2007 Jocelyn Mayer
+ * Copyright (c) 2010 David Gibson, IBM Corporation.
+ *
+ * SPDX-License-Identifier: MIT
+ */
 #include "qemu/osdep.h"
 #include "qemu/cutils.h"
 #include "qemu/memalign.h"
Signature · 1 line
2.42.0
#2 lore raw

PATCH v2 2/4 hw/ppc/spapr_hcall: Allow elision of softmmu_resize_hpt_prep

In reply to Nicholas Piggin

From: Philippe Mathieu-Daudé <[email protected]>

Check tcg_enabled() before calling softmmu_resize_hpt_prepare() and softmmu_resize_hpt_commit() to allow the compiler to elide their calls. The stubs are then unnecessary, remove them.

---
 hw/ppc/spapr_hcall.c  | 12 ++++++++----
 target/ppc/tcg-stub.c | 15 ---------------
 2 files changed, 8 insertions(+), 19 deletions(-)
hw/ppc/spapr_hcall.c +8 -4
index fcefd1d1c7..0d7d523e6d 100644
@@ -123,9 +123,11 @@ static target_ulong h_resize_hpt_prepare(PowerPCCPU *cpu,
 
     if (kvm_enabled()) {
         return H_HARDWARE;
+    } else if (tcg_enabled()) {
+        return softmmu_resize_hpt_prepare(cpu, spapr, shift);
+    } else {
+        g_assert_not_reached();
     }
-
-    return softmmu_resize_hpt_prepare(cpu, spapr, shift);
 }
 
 static void do_push_sregs_to_kvm_pr(CPUState *cs, run_on_cpu_data data)
@@ -191,9 +193,11 @@ static target_ulong h_resize_hpt_commit(PowerPCCPU *cpu,
 
     if (kvm_enabled()) {
         return H_HARDWARE;
+    } else if (tcg_enabled()) {
+        return softmmu_resize_hpt_commit(cpu, spapr, flags, shift);
+    } else {
+        g_assert_not_reached();
     }
-
-    return softmmu_resize_hpt_commit(cpu, spapr, flags, shift);
 }
 
 
target/ppc/tcg-stub.c +0 -15
index aadcf59d26..740d796b98 100644
@@ -28,18 +28,3 @@ void create_ppc_opcodes(PowerPCCPU *cpu, Error **errp)
 void destroy_ppc_opcodes(PowerPCCPU *cpu)
 {
 }
-
-target_ulong softmmu_resize_hpt_prepare(PowerPCCPU *cpu,
-                                        SpaprMachineState *spapr,
-                                        target_ulong shift)
-{
-    g_assert_not_reached();
-}
-
-target_ulong softmmu_resize_hpt_commit(PowerPCCPU *cpu,
-                                       SpaprMachineState *spapr,
-                                       target_ulong flags,
-                                       target_ulong shift)
-{
-    g_assert_not_reached();
-}
Signature · 1 line
2.42.0
#3 lore raw

PATCH v2 3/4 hw/ppc/spapr_hcall: Rename {softmmu -> vhyp_mmu}_resize_hpt_pr

In reply to Nicholas Piggin

From: Philippe Mathieu-Daudé <[email protected]>

Since 'softmmu' is quite a loaded term in QEMU, rename the vhyp MMU facilities to use the vhyp_mmu_ prefix rather than softmmu_.

[npiggin: Pick a different name.]
---
 include/hw/ppc/spapr.h | 9 ++++++---
 hw/ppc/spapr_hcall.c   | 4 ++--
 hw/ppc/spapr_softmmu.c | 4 ++--
 3 files changed, 10 insertions(+), 7 deletions(-)
include/hw/ppc/spapr.h +6 -3
index e91791a1a9..5b5ba9ef77 100644
@@ -634,10 +634,13 @@ void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn);
 target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode,
                              target_ulong *args);
 
-target_ulong softmmu_resize_hpt_prepare(PowerPCCPU *cpu, SpaprMachineState *spapr,
+target_ulong vhyp_mmu_resize_hpt_prepare(PowerPCCPU *cpu,
+                                         SpaprMachineState *spapr,
                                          target_ulong shift);
-target_ulong softmmu_resize_hpt_commit(PowerPCCPU *cpu, SpaprMachineState *spapr,
-                                        target_ulong flags, target_ulong shift);
+target_ulong vhyp_mmu_resize_hpt_commit(PowerPCCPU *cpu,
+                                        SpaprMachineState *spapr,
+                                        target_ulong flags,
+                                        target_ulong shift);
 bool is_ram_address(SpaprMachineState *spapr, hwaddr addr);
 void push_sregs_to_kvm_pr(SpaprMachineState *spapr);
 
hw/ppc/spapr_hcall.c +2 -2
index 0d7d523e6d..75c2d12978 100644
@@ -124,7 +124,7 @@ static target_ulong h_resize_hpt_prepare(PowerPCCPU *cpu,
     if (kvm_enabled()) {
         return H_HARDWARE;
     } else if (tcg_enabled()) {
-        return softmmu_resize_hpt_prepare(cpu, spapr, shift);
+        return vhyp_mmu_resize_hpt_prepare(cpu, spapr, shift);
     } else {
         g_assert_not_reached();
     }
@@ -194,7 +194,7 @@ static target_ulong h_resize_hpt_commit(PowerPCCPU *cpu,
     if (kvm_enabled()) {
         return H_HARDWARE;
     } else if (tcg_enabled()) {
-        return softmmu_resize_hpt_commit(cpu, spapr, flags, shift);
+        return vhyp_mmu_resize_hpt_commit(cpu, spapr, flags, shift);
     } else {
         g_assert_not_reached();
     }
hw/ppc/spapr_softmmu.c +2 -2
index 2fade94029..b3dd8b3a59 100644
@@ -378,7 +378,7 @@ static void cancel_hpt_prepare(SpaprMachineState *spapr)
     free_pending_hpt(pending);
 }
 
-target_ulong softmmu_resize_hpt_prepare(PowerPCCPU *cpu,
+target_ulong vhyp_mmu_resize_hpt_prepare(PowerPCCPU *cpu,
                                          SpaprMachineState *spapr,
                                          target_ulong shift)
 {
@@ -562,7 +562,7 @@ static int rehash_hpt(PowerPCCPU *cpu,
     return H_SUCCESS;
 }
 
-target_ulong softmmu_resize_hpt_commit(PowerPCCPU *cpu,
+target_ulong vhyp_mmu_resize_hpt_commit(PowerPCCPU *cpu,
                                         SpaprMachineState *spapr,
                                         target_ulong flags,
                                         target_ulong shift)
Signature · 1 line
2.42.0
#4 lore raw

PATCH v2 4/4 hw/ppc/spapr: Rename 'softmmu' -> 'vhyp_mmu'

In reply to Nicholas Piggin

From: Philippe Mathieu-Daudé <[email protected]>

In the spirit of reducing use of the term 'softmmu', rename spapr_softmmu.c to spapr_vhyp_mmu.c.

Logically, the TLB loading code that walks the hash table is the implementation of the ppc hash MMU, and the code that manipulates the hash table is the implementation of the PAPR hypervisor interface (called vhyp).

[npiggin: Pick a different name, explain it in changelog.]
---
 hw/ppc/{spapr_softmmu.c => spapr_vhyp_mmu.c} | 0
 hw/ppc/meson.build                           | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename hw/ppc/{spapr_softmmu.c => spapr_vhyp_mmu.c} (100%)
hw/ppc/spapr_vhyp_mmu.c renamed from hw/ppc/spapr_softmmu.c +0 -0
similarity index 100%
rename from hw/ppc/spapr_softmmu.c
rename to hw/ppc/spapr_vhyp_mmu.c
hw/ppc/meson.build +1 -1
index eba3406e7f..30bd2aaccf 100644
@@ -31,7 +31,7 @@ ppc_ss.add(when: 'CONFIG_PSERIES', if_true: files(
   'pef.c',
 ))
 ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_TCG'], if_true: files(
-  'spapr_softmmu.c',
+  'spapr_vhyp_mmu.c',
 ))
 ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c'))
 if host_os == 'linux'
Signature · 1 line
2.42.0
Reviewed-by on the v2 series
#5 lore raw
In reply to Nicholas Piggin
Quoted 5 lines · Nicholas Piggin

I grabbed Philippe's series series and tried to use a more agreeable name. Further disagreement is okay, but must come with a better alternative :) would be good to get this out of the way. I actually don't think softmmu is a great term for it either even in isolation, so would be good to move away from it.

Eh thanks for the respin Nicholas! I'm happy with the new name :)

Series: