hw/ppc/spapr: Rename SoftMMU -> TCG
cover hw/ppc/spapr: Rename SoftMMU -> TCG
We want to clarify when code depends on a software MMU, or when it depends on TCG system emulation.
This series renames the 'softmmu' mentions in PPC.
Philippe Mathieu-Daudé (4):
hw/ppc/spapr: Add missing license
hw/ppc/spapr_hcall: Allow elision of softmmu_resize_hpt_prepare/commit hw/ppc/spapr_hcall: Rename {softmmu ->
tcgppc}_resize_hpt_prepare/commit
hw/ppc/spapr: Rename 'softmmu' -> 'tcg'
include/hw/ppc/spapr.h | 8 ++++----
hw/ppc/spapr_hcall.c | 12 ++++++++----
hw/ppc/{spapr_softmmu.c => spapr_tcg.c} | 9 +++++++++
target/ppc/tcg-stub.c | 15 ---------------
hw/ppc/meson.build | 2 +-
5 files changed, 22 insertions(+), 24 deletions(-)
rename hw/ppc/{spapr_softmmu.c => spapr_tcg.c} (98%)Signature · 1 line
2.41.0
PATCH 1/4 hw/ppc/spapr: Add missing license
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.
--- hw/ppc/spapr_softmmu.c | 9 +++++++++ 1 file changed, 9 insertions(+)
hw/ppc/spapr_softmmu.c +9 -0
@@ -1,3 +1,12 @@ +/* +* QEMU sPAPR hypercalls for 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.41.0
PATCH 2/4 hw/ppc/spapr_hcall: Allow elision of softmmu_resize_hpt_prepare/commit
In reply to Philippe Mathieu-Daudé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
@@ -124,9 +124,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)
@@ -192,9 +194,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
@@ -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.41.0
PATCH 3/4 hw/ppc/spapr_hcall: Rename {softmmu -> tcgppc}_resize_hpt_prepare/commit
In reply to Philippe Mathieu-DaudéWe use the 'kvmppc' prefix for KVM specific functions:
$ git grep \ kvmppc_ | wc -l
402Following the same pattern for TCG specific functions, use the 'tcgppc' prefix (which is clearer than 'softmmu').
--- include/hw/ppc/spapr.h | 8 ++++---- hw/ppc/spapr_hcall.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
include/hw/ppc/spapr.h +4 -4
@@ -634,10 +634,10 @@ 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 shift); -target_ulong softmmu_resize_hpt_commit (PowerPCCPU *cpu,SpaprMachineState *spapr, -target_ulong flags,target_ulong shift); +target_ulong tcgppc_resize_hpt_prepare (PowerPCCPU *cpu,SpaprMachineState *spapr, +target_ulong shift); +target_ulong tcgppc_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
@@ -125,7 +125,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 tcgppc_resize_hpt_prepare (cpu, spapr, shift); }else {g_assert_not_reached (); }
@@ -195,7 +195,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 tcgppc_resize_hpt_commit (cpu, spapr, flags, shift); }else {g_assert_not_reached (); }
Signature · 1 line
2.41.0
Re: [PATCH 3/4] hw/ppc/spapr_hcall: Rename {softmmu -> tcgppc}_resize_hpt_prepare/commit
Quoted 7 lines · Philippe Mathieu-Daudé
We use the 'kvmppc' prefix for KVM specific functions:
$ git grep \ kvmppc_ | wc -l 402Following the same pattern for TCG specific functions, use the 'tcgppc' prefix (which is clearer than 'softmmu').
In this specific case, I think "softmmu" is more accurate than "tcg". These are specifically related to the emulated MMU, and not really to instruction emulation per se.
Quoted 48 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/ppc/spapr.h | 8 ++++---- hw/ppc/spapr_hcall.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)include/hw/ppc/spapr.h +4
-4@@ -634,10 +634,10 @@ 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 shift); -target_ulong softmmu_resize_hpt_commit (PowerPCCPU *cpu,SpaprMachineState *spapr, -target_ulong flags,target_ulong shift); +target_ulong tcgppc_resize_hpt_prepare (PowerPCCPU *cpu,SpaprMachineState *spapr, +target_ulong shift); +target_ulong tcgppc_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@@ -125,7 +125,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 tcgppc_resize_hpt_prepare (cpu, spapr, shift); }else {g_assert_not_reached (); }@@ -195,7 +195,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 tcgppc_resize_hpt_commit (cpu, spapr, flags, shift); }else {g_assert_not_reached (); }
Signature · 4 lines
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
PATCH 4/4 hw/ppc/spapr: Rename 'softmmu' -> 'tcg'
In reply to Philippe Mathieu-Daudéspapr_softmmu.c isn't related to having a soft MMU, but having the TCG accelerator. Rename it using the 'tcg' suffix.
---
hw/ppc/{spapr_softmmu.c => spapr_tcg.c} | 0
hw/ppc/meson.build | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename hw/ppc/{spapr_softmmu.c => spapr_tcg.c} (100%)hw/ppc/spapr_tcg.c renamed from hw/ppc/spapr_softmmu.c +0 -0
hw/ppc/meson.build +1 -1
@@ -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_tcg.c', )) ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c')) ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_LINUX'], if_true: files(
Signature · 1 line
2.41.0
Re: [PATCH 4/4] hw/ppc/spapr: Rename 'softmmu' -> 'tcg'
Quoted 2 lines · Philippe Mathieu-Daudé
spapr_softmmu.cisn't related to having a soft MMU, but having the TCG accelerator. Rename it using the 'tcg' suffix.
That's not really accurate. The functions in there absolutely are about the emulated MMU. They're not needed for KVM, because KVM has its own MMU emulation, but they're not strictly speaking related to TCG.
Quoted 25 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/ppc/{spapr_softmmu.c => spapr_tcg.c} | 0 hw/ppc/meson.build | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename hw/ppc/{spapr_softmmu.c => spapr_tcg.c} (100%)hw/ppc/spapr_tcg.c renamed from hw/ppc/spapr_softmmu.c +0
-0hw/ppc/meson.build +1
-1@@ -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_tcg.c', )) ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c')) ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_LINUX'], if_true: files(
Signature · 4 lines
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
Re: [PATCH 4/4] hw/ppc/spapr: Rename 'softmmu' -> 'tcg'
Quoted 7 lines · David Gibson
Quoted 2 lines · Philippe Mathieu-Daudé
spapr_softmmu.cisn't related to having a soft MMU, but having the TCG accelerator. Rename it using the 'tcg' suffix.That's not really accurate. The functions in there absolutely are about the emulated MMU. They're not needed for KVM, because KVM has its own MMU emulation, but they're not strictly speaking related to TCG.
Not sure what to do with these.
The spapr facilities names AFAIK don't really differentiate between when they are supplied for KVM vs TCG, so we could use spapr_mmu.c or spapr_hpt.c. Or leave as softmmu? Anyone have preferences? I like hpt.
softmmu_resize_hpt_* could go to spapr_resize_hpt_*
Thanks,
Nick
Quoted 26 lines
Quoted 26 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/ppc/{spapr_softmmu.c => spapr_tcg.c} | 0 hw/ppc/meson.build | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename hw/ppc/{spapr_softmmu.c => spapr_tcg.c} (100%)hw/ppc/spapr_tcg.c renamed from hw/ppc/spapr_softmmu.c +0
-0hw/ppc/meson.build +1
-1@@ -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_tcg.c', )) ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c')) ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_LINUX'], if_true: files(