target/ppc: Few cleanups in kvm_ppc.h
v3 cover target/ppc: Few cleanups in kvm_ppc.h
PPC specific changes of a bigger KVM cleanup, remove "kvm_ppc.h" from user emulation. Mostly trivial IMO.
Philippe Mathieu-Daudé (6):
target/ppc: Have 'kvm_ppc.h' include 'sysemu/kvm.h' target/ppc: Reorder #ifdef'ry in kvm_ppc.h
target/ppc: Move CPU QOM definitions to cpu-qom.h target/ppc: Define TYPE_HOST_POWERPC_CPU in cpu-qom.h target/ppc: Restrict 'kvm_ppc.h' to sysemu in cpu_init.c target/ppc: Remove pointless checks of CONFIG_USER_ONLY in 'kvm_ppc.h'
target/ppc/cpu-qom.h | 7 +++++ target/ppc/cpu.h | 6 ---- target/ppc/kvm_ppc.h | 70 ++++++++++++++++++------------------------- target/ppc/cpu_init.c | 2 +- 4 files changed, 37 insertions(+), 48 deletions(-)
Signature · 1 line
2.38.1
PATCH v3 1/6 target/ppc: Have 'kvm_ppc.h' include 'sysemu/kvm.h'
"kvm_ppc.h" declares:
int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run);
'struct kvm_run' is declared in "sysemu/kvm.h", include it.
--- target/ppc/kvm_ppc.h | 1 + 1 file changed, 1 insertion(+)
target/ppc/kvm_ppc.h +1 -0
@@ -9,6 +9,7 @@#ifndef KVM_PPC_H #define KVM_PPC_H +#include "sysemu/kvm.h" #include "exec/hwaddr.h" #include "cpu.h"
Signature · 1 line
2.38.1
Re: [PATCH v3 1/6] target/ppc: Have 'kvm_ppc.h' include 'sysemu/kvm.h'
Quoted 8 lines · On Tue, 27 Jun 2023 13:51:19 +0200 Philippe Mathieu-Daudé <[email protected]>…
"
kvm_ppc.h" declares:int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run);'struct
kvm_run' is declared in "sysemu/kvm.h", include it.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 15 lines
target/ppc/kvm_ppc.h | 1 + 1 file changed, 1 insertion(+)target/ppc/kvm_ppc.h +1
-0@@ -9,6 +9,7 @@#ifndef KVM_PPC_H #define KVM_PPC_H +#include "sysemu/kvm.h" #include "exec/hwaddr.h" #include "cpu.h"
Signature · 1 line
Greg
Re: [PATCH v3 1/6] target/ppc: Have 'kvm_ppc.h' include 'sysemu/kvm.h'
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
"
kvm_ppc.h" declares:int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run);'struct
kvm_run' is declared in "sysemu/kvm.h", include it.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 16 lines
--- target/ppc/kvm_ppc.h | 1 + 1 file changed, 1 insertion(+)target/ppc/kvm_ppc.h +1
-0@@ -9,6 +9,7 @@#ifndef KVM_PPC_H #define KVM_PPC_H +#include "sysemu/kvm.h" #include "exec/hwaddr.h" #include "cpu.h"
PATCH v3 2/6 target/ppc: Reorder #ifdef'ry in kvm_ppc.h
In reply to Philippe Mathieu-DaudéKeep a single if/else/endif block checking CONFIG_KVM.
--- target/ppc/kvm_ppc.h | 62 ++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 34 deletions(-)
target/ppc/kvm_ppc.h +28 -34
@@ -93,7 +93,34 @@ void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset);int kvm_handle_nmi (PowerPCCPU *cpu,struct kvm_run *run); -#else +#define kvmppc_eieio () \ + do { \ + if (kvm_enabled()) { \ + asm volatile("eieio" : : : "memory"); \ + } \ + } while (0) + +/* Store data cache blocks back to memory */ +static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len) +{ +uint8_t *p; + +for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) { + asmvolatile ("dcbst 0,%0" : :"r" (p) :"memory" ); + } +} + +/* Invalidate instruction cache blocks */ +static inline void kvmppc_icbi_range (PowerPCCPU *cpu,uint8_t *addr,int len) +{ +uint8_t *p; + +for (p = addr; p < addr + len; p += cpu->env.icache_line_size) { + asmvolatile ("icbi 0,%0" : :"r" (p)); + } +} + +#else /* !CONFIG_KVM */ static inline uint32_t kvmppc_get_tbfreq (void ) {
@@ -440,10 +467,6 @@ static inline bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu)return false; } -#endif - -#ifndef CONFIG_KVM -#define kvmppc_eieio () do { } while (0)static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len)
@@ -454,35 +477,6 @@ static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len) { } -#else /* CONFIG_KVM */ - -#define kvmppc_eieio () \ - do { \ - if (kvm_enabled()) { \ - asm volatile("eieio" : : : "memory"); \ - } \ - } while (0) - -/* Store data cache blocks back to memory */ -static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len) -{ -uint8_t *p; - -for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) { - asmvolatile ("dcbst 0,%0" : :"r" (p) :"memory" ); - } -} - -/* Invalidate instruction cache blocks */ -static inline void kvmppc_icbi_range (PowerPCCPU *cpu,uint8_t *addr,int len) -{ -uint8_t *p; - -for (p = addr; p < addr + len; p += cpu->env.icache_line_size) { - asmvolatile ("icbi 0,%0" : :"r" (p)); - } -} -#endif /* CONFIG_KVM */ #endif /* KVM_PPC_H */
Signature · 1 line
2.38.1
Re: [PATCH v3 2/6] target/ppc: Reorder #ifdef'ry in kvm_ppc.h
Quoted 59 lines · On Tue, 27 Jun 2023 13:51:20 +0200 Philippe Mathieu-Daudé <[email protected]>…
Keep a single if/else/endif block checking
CONFIG_KVM.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/ppc/kvm_ppc.h | 62 ++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 34 deletions(-)target/ppc/kvm_ppc.h +28
-5@@ -93,7 +93,34 @@ void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset);int kvm_handle_nmi (PowerPCCPU *cpu,struct kvm_run *run); -#else +#define kvmppc_eieio () \ + do { \ + if (kvm_enabled()) { \ + asm volatile("eieio" : : : "memory"); \ + } \ + } while (0) + +/* Store data cache blocks back to memory */ +static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len) +{ +uint8_t *p; + +for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) { + asmvolatile ("dcbst 0,%0" : :"r" (p) :"memory" ); + } +} + +/* Invalidate instruction cache blocks */ +static inline void kvmppc_icbi_range (PowerPCCPU *cpu,uint8_t *addr,int len) +{ +uint8_t *p; + +for (p = addr; p < addr + len; p += cpu->env.icache_line_size) { + asmvolatile ("icbi 0,%0" : :"r" (p)); + } +} + +#else /* !CONFIG_KVM */ static inline uint32_t kvmppc_get_tbfreq (void ) {@@ -440,10 +467,6 @@ static inline bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu)return false; } -#endif - -#ifndef CONFIG_KVM -#define kvmppc_eieio () do { } while (0)static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len)
target/ppc/kvm_ppc.h static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len) · line 459
Quoted 6 lines
target/ppc/kvm_ppc.h +0
-3@@ -454,35 +477,6 @@ static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len) { } -#else /* CONFIG_KVM */ - -#define kvmppc_eieio () \
Arguably the kvm and non-kvm implementations will now come from different commits in git blame. I personally favor keeping the git blame consistency over bare code movement that doesn't fix any actual bug.
Also this patch doesn't seem to be strictly needed to reach the goal of kicking "kvm_ppc.h" out of user emulation.
Quoted 29 lines
target/ppc/kvm_ppc.h +0
-26-do { \ -if (kvm_enabled ()) { \ - asmvolatile ("eieio" : : :"memory" ); \ - } \ - }while (0 ) - -/* Store data cache blocks back to memory */ -static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len) -{ -uint8_t *p; - -for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) { - asmvolatile ("dcbst 0,%0" : :"r" (p) :"memory" ); - } -} - -/* Invalidate instruction cache blocks */ -static inline void kvmppc_icbi_range (PowerPCCPU *cpu,uint8_t *addr,int len) -{ -uint8_t *p; - -for (p = addr; p < addr + len; p += cpu->env.icache_line_size) { - asmvolatile ("icbi 0,%0" : :"r" (p)); - } -} -#endif /* CONFIG_KVM */ #endif /* KVM_PPC_H */
Signature · 1 line
Greg
Re: [PATCH v3 2/6] target/ppc: Reorder #ifdef'ry in kvm_ppc.h
In reply to Philippe Mathieu-DaudéQuoted 3 lines · Philippe Mathieu-Daudé
Keep a single if/else/endif block checking
CONFIG_KVM.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 91 lines
--- target/ppc/kvm_ppc.h | 62 ++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 34 deletions(-)target/ppc/kvm_ppc.h +28
-34@@ -93,7 +93,34 @@ void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset);int kvm_handle_nmi (PowerPCCPU *cpu,struct kvm_run *run); -#else +#define kvmppc_eieio () \ + do { \ + if (kvm_enabled()) { \ + asm volatile("eieio" : : : "memory"); \ + } \ + } while (0) + +/* Store data cache blocks back to memory */ +static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len) +{ +uint8_t *p; + +for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) { + asmvolatile ("dcbst 0,%0" : :"r" (p) :"memory" ); + } +} + +/* Invalidate instruction cache blocks */ +static inline void kvmppc_icbi_range (PowerPCCPU *cpu,uint8_t *addr,int len) +{ +uint8_t *p; + +for (p = addr; p < addr + len; p += cpu->env.icache_line_size) { + asmvolatile ("icbi 0,%0" : :"r" (p)); + } +} + +#else /* !CONFIG_KVM */ static inline uint32_t kvmppc_get_tbfreq (void ) {@@ -440,10 +467,6 @@ static inline bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu)return false; } -#endif - -#ifndef CONFIG_KVM -#define kvmppc_eieio () do { } while (0)static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len)@@ -454,35 +477,6 @@ static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len) { } -#else /* CONFIG_KVM */ - -#define kvmppc_eieio () \ - do { \ - if (kvm_enabled()) { \ - asm volatile("eieio" : : : "memory"); \ - } \ - } while (0) - -/* Store data cache blocks back to memory */ -static inline void kvmppc_dcbst_range (PowerPCCPU *cpu,uint8_t *addr,int len) -{ -uint8_t *p; - -for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) { - asmvolatile ("dcbst 0,%0" : :"r" (p) :"memory" ); - } -} - -/* Invalidate instruction cache blocks */ -static inline void kvmppc_icbi_range (PowerPCCPU *cpu,uint8_t *addr,int len) -{ -uint8_t *p; - -for (p = addr; p < addr + len; p += cpu->env.icache_line_size) { - asmvolatile ("icbi 0,%0" : :"r" (p)); - } -} -#endif /* CONFIG_KVM */ #endif /* KVM_PPC_H */
PATCH v3 3/6 target/ppc: Move CPU QOM definitions to cpu-qom.h
In reply to Philippe Mathieu-Daudé--- target/ppc/cpu-qom.h | 5 +++++ target/ppc/cpu.h | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-)
target/ppc/cpu-qom.h +5 -0
@@ -31,6 +31,11 @@ OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU) +#define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU +#define POWERPC_CPU_TYPE_NAME (model) model POWERPC_CPU_TYPE_SUFFIX +#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU +#define cpu_list ppc_cpu_list +ObjectClass *ppc_cpu_class_by_name (const char *name);typedef struct CPUArchState CPUPPCState ;
target/ppc/cpu.h +0 -6
@@ -1468,12 +1468,6 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,uint32_t *valp);int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,uint32_t val); -#define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU -#define POWERPC_CPU_TYPE_NAME (model) model POWERPC_CPU_TYPE_SUFFIX -#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU - -#define cpu_list ppc_cpu_list -/* MMU modes definitions */ #define MMU_USER_IDX 0static inline int cpu_mmu_index (CPUPPCState *env,bool ifetch)
Signature · 1 line
2.38.1
Re: [PATCH v3 3/6] target/ppc: Move CPU QOM definitions to cpu-qom.h
Quoted 27 lines · On Tue, 27 Jun 2023 13:51:21 +0200 Philippe Mathieu-Daudé <[email protected]>…
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/ppc/cpu-qom.h | 5 +++++ target/ppc/cpu.h | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-)target/ppc/cpu-qom.h +5
-0@@ -31,6 +31,11 @@ OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU) +#define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU +#define POWERPC_CPU_TYPE_NAME (model) model POWERPC_CPU_TYPE_SUFFIX +#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU +#define cpu_list ppc_cpu_list +ObjectClass *ppc_cpu_class_by_name (const char *name);typedef struct CPUArchState CPUPPCState ;target/ppc/cpu.h +0
-0
target/ppc/cpu.h static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn) · line 1474
Quoted 7 lines
target/ppc/cpu.h +0
-4@@ -1468,12 +1468,6 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,uint32_t *valp);int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,uint32_t val); -#define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU -#define POWERPC_CPU_TYPE_NAME (model) model POWERPC_CPU_TYPE_SUFFIX -#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU -
These seem appropriate to be moved to "cpu-qom.h".
target/ppc/cpu.h static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn) · line 1475
Quoted 1 line
target/ppc/cpu.h +0
-1-#define cpu_list ppc_cpu_list
This one is much older according to git blame :
c913706581460 target/ppc/cpu.h (Igor Mammedov 2017-08-30 1469) #define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU c913706581460 target/ppc/cpu.h (Igor Mammedov 2017-08-30 1470) #define POWERPC_CPU_TYPE_NAME(model) model POWERPC_CPU_TYPE_SUFFIX 0dacec874fa3b target/ppc/cpu.h (Igor Mammedov 2018-02-07 1471) #define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU c913706581460 target/ppc/cpu.h (Igor Mammedov 2017-08-30 1472) c732abe222795 target-ppc/cpu.h (Jocelyn Mayer 2007-10-12 1473) #define cpu_list ppc_cpu_list
It is some plumbing used for -cpu help, not exactly QOM stuff. Maybe keep it in "cpu.h" as all other targets do ?
Quoted 4 lines
target/ppc/cpu.h +0
-1-/* MMU modes definitions */ #define MMU_USER_IDX 0static inline int cpu_mmu_index (CPUPPCState *env,bool ifetch)
Signature · 1 line
Greg
Re: [PATCH v3 3/6] target/ppc: Move CPU QOM definitions to cpu-qom.h
Phil,
Quoted 44 lines · Greg Kurz
Quoted 27 lines · On Tue, 27 Jun 2023 13:51:21 +0200 Philippe Mathieu-Daudé <[email protected]>…
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/ppc/cpu-qom.h | 5 +++++ target/ppc/cpu.h | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-)target/ppc/cpu-qom.h +5
-0@@ -31,6 +31,11 @@ OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU) +#define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU +#define POWERPC_CPU_TYPE_NAME (model) model POWERPC_CPU_TYPE_SUFFIX +#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU +#define cpu_list ppc_cpu_list +ObjectClass *ppc_cpu_class_by_name (const char *name);typedef struct CPUArchState CPUPPCState ;target/ppc/cpu.h +0
-0target/ppc/cpu.h static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn) · line 1474
Quoted 7 lines
target/ppc/cpu.h +0
-4@@ -1468,12 +1468,6 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,uint32_t *valp);int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,uint32_t val); -#define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU -#define POWERPC_CPU_TYPE_NAME (model) model POWERPC_CPU_TYPE_SUFFIX -#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU -These seem appropriate to be moved to "
cpu-qom.h".target/ppc/cpu.h static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn) · line 1475
Quoted 1 line
target/ppc/cpu.h +0
-1-#define cpu_list ppc_cpu_listThis one is much older according to git blame :
Quoted 8 lines
c913706581460 target/ppc/cpu.h (Igor Mammedov 2017-08-30 1469) #define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU c913706581460 target/ppc/cpu.h (Igor Mammedov 2017-08-30 1470) #define POWERPC_CPU_TYPE_NAME(model) model POWERPC_CPU_TYPE_SUFFIX 0dacec874fa3b target/ppc/cpu.h (Igor Mammedov 2018-02-07 1471) #define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU c913706581460 target/ppc/cpu.h (Igor Mammedov 2017-08-30 1472) c732abe222795 target-ppc/cpu.h (Jocelyn Mayer 2007-10-12 1473) #define cpu_list ppc_cpu_listIt is some plumbing used for
-cpu help, not exactly QOM stuff. Maybe keep it in "cpu.h" as all other targets do ?
Greg has a point:
$ git grep '#define cpu_list' target/alpha/cpu.h:#define cpu_list alpha_cpu_list target/arm/cpu.h:#define cpu_list arm_cpu_list target/avr/cpu.h:#define cpu_list avr_cpu_list target/cris/cpu.h:#define cpu_list cris_cpu_list target/hexagon/cpu.h:#define cpu_list hexagon_cpu_list target/i386/cpu.h:#define cpu_list x86_cpu_list target/loongarch/cpu.h:#define cpu_list loongarch_cpu_list target/m68k/cpu.h:#define cpu_list m68k_cpu_list target/mips/cpu.h:#define cpu_list mips_cpu_list target/openrisc/cpu.h:#define cpu_list cpu_openrisc_list target/ppc/cpu.h:#define cpu_list ppc_cpu_list target/riscv/cpu.h:#define cpu_list riscv_cpu_list target/rx/cpu.h:#define cpu_list rx_cpu_list target/s390x/cpu.h:#define cpu_list s390_cpu_list target/sh4/cpu.h:#define cpu_list sh4_cpu_list target/sparc/cpu.h:#define cpu_list sparc_cpu_list target/tricore/cpu.h:#define cpu_list tricore_cpu_list target/xtensa/cpu.h:#define cpu_list xtensa_cpu_list
I'm not against moving this define to cpu-qom.h per se but I believe that, for the sake of consistency, this change should be done in a single swoop across all archs.
For now, if you agree with keeping the 'cpu_list' define in cpu.h, I'll queue this up and amend it in-tree.
Thanks,
Daniel
Quoted 8 lines
Quoted 5 lines
target/ppc/cpu.h +0
-1-/* MMU modes definitions */ #define MMU_USER_IDX 0static inline int cpu_mmu_index (CPUPPCState *env,bool ifetch)
Re: [PATCH v3 3/6] target/ppc: Move CPU QOM definitions to cpu-qom.h
In reply to Philippe Mathieu-DaudéQuoted 1 line · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 38 lines
--- target/ppc/cpu-qom.h | 5 +++++ target/ppc/cpu.h | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-)target/ppc/cpu-qom.h +5
-0@@ -31,6 +31,11 @@ OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU) +#define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU +#define POWERPC_CPU_TYPE_NAME (model) model POWERPC_CPU_TYPE_SUFFIX +#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU +#define cpu_list ppc_cpu_list +ObjectClass *ppc_cpu_class_by_name (const char *name);typedef struct CPUArchState CPUPPCState ;target/ppc/cpu.h +0
-6@@ -1468,12 +1468,6 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env, int gprn)int ppc_dcr_read (ppc_dcr_t *dcr_env,int dcrn,uint32_t *valp);int ppc_dcr_write (ppc_dcr_t *dcr_env,int dcrn,uint32_t val); -#define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU -#define POWERPC_CPU_TYPE_NAME (model) model POWERPC_CPU_TYPE_SUFFIX -#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU - -#define cpu_list ppc_cpu_list -/* MMU modes definitions */ #define MMU_USER_IDX 0static inline int cpu_mmu_index (CPUPPCState *env,bool ifetch)
PATCH v3 4/6 target/ppc: Define TYPE_HOST_POWERPC_CPU in cpu-qom.h
In reply to Philippe Mathieu-DaudéTYPE_HOST_POWERPC_CPU is used in various places of cpu_init.c, in order to restrict "kvm_ppc.h" to sysemu, move this QOM-related definition to cpu-qom.h.
--- target/ppc/cpu-qom.h | 2 ++ target/ppc/kvm_ppc.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
target/ppc/cpu-qom.h +2 -0
@@ -36,6 +36,8 @@ OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU)#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU#define cpu_list ppc_cpu_list +#define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host") +ObjectClass *ppc_cpu_class_by_name (const char *name);typedef struct CPUArchState CPUPPCState ;
target/ppc/kvm_ppc.h +0 -2
@@ -13,8 +13,6 @@#include "exec/hwaddr.h" #include "cpu.h" -#define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host") -#ifdef CONFIG_KVM uint32_t kvmppc_get_tbfreq (void );
Signature · 1 line
2.38.1
Re: [PATCH v3 4/6] target/ppc: Define TYPE_HOST_POWERPC_CPU in cpu-qom.h
Quoted 5 lines · Philippe Mathieu-Daudé
TYPE_HOST_POWERPC_CPUis used in various places ofcpu_init.c, in order to restrict "kvm_ppc.h" to sysemu, move this QOM-related definition tocpu-qom.h.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 31 lines
--- target/ppc/cpu-qom.h | 2 ++ target/ppc/kvm_ppc.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)target/ppc/cpu-qom.h +2
-0@@ -36,6 +36,8 @@ OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU)#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU#define cpu_list ppc_cpu_list +#define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host") +ObjectClass *ppc_cpu_class_by_name (const char *name);typedef struct CPUArchState CPUPPCState ;target/ppc/kvm_ppc.h +0
-2@@ -13,8 +13,6 @@#include "exec/hwaddr.h" #include "cpu.h" -#define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host") -#ifdef CONFIG_KVM uint32_t kvmppc_get_tbfreq (void );
Re: [PATCH v3 4/6] target/ppc: Define TYPE_HOST_POWERPC_CPU in cpu-qom.h
In reply to Philippe Mathieu-DaudéQuoted 6 lines · On Tue, 27 Jun 2023 13:51:22 +0200 Philippe Mathieu-Daudé <[email protected]>…
TYPE_HOST_POWERPC_CPUis used in various places ofcpu_init.c, in order to restrict "kvm_ppc.h" to sysemu, move this QOM-related definition tocpu-qom.h.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 30 lines
target/ppc/cpu-qom.h | 2 ++ target/ppc/kvm_ppc.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)target/ppc/cpu-qom.h +2
-0@@ -36,6 +36,8 @@ OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU)#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU#define cpu_list ppc_cpu_list +#define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host") +ObjectClass *ppc_cpu_class_by_name (const char *name);typedef struct CPUArchState CPUPPCState ;target/ppc/kvm_ppc.h +0
-2@@ -13,8 +13,6 @@#include "exec/hwaddr.h" #include "cpu.h" -#define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host") -#ifdef CONFIG_KVM uint32_t kvmppc_get_tbfreq (void );
Signature · 1 line
Greg
PATCH v3 5/6 target/ppc: Restrict 'kvm_ppc.h' to sysemu in cpu_init.c
In reply to Philippe Mathieu-DaudéUser emulation shouldn't need any of the KVM prototypes declared in "kvm_ppc.h".
--- target/ppc/cpu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/cpu_init.c +1 -1
@@ -21,7 +21,6 @@#include "qemu/osdep.h" #include "disas/dis-asm.h" #include "gdbstub/helpers.h" -#include "kvm_ppc.h" #include "sysemu/cpus.h" #include "sysemu/hw_accel.h" #include "sysemu/tcg.h"
@@ -49,6 +48,7 @@#ifndef CONFIG_USER_ONLY #include "hw/boards.h" #include "hw/intc/intc.h" +#include "kvm_ppc.h" #endif /* #define PPC_DEBUG_SPR */
Signature · 1 line
2.38.1
Re: [PATCH v3 5/6] target/ppc: Restrict 'kvm_ppc.h' to sysemu in cpu_init.c
Quoted 4 lines · Philippe Mathieu-Daudé
User emulation shouldn't need any of the KVM prototypes declared in "
kvm_ppc.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 24 lines
--- target/ppc/cpu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/ppc/cpu_init.c +1
-1@@ -21,7 +21,6 @@#include "qemu/osdep.h" #include "disas/dis-asm.h" #include "gdbstub/helpers.h" -#include "kvm_ppc.h" #include "sysemu/cpus.h" #include "sysemu/hw_accel.h" #include "sysemu/tcg.h" @@ -49,6 +48,7 @@#ifndef CONFIG_USER_ONLY #include "hw/boards.h" #include "hw/intc/intc.h" +#include "kvm_ppc.h" #endif /* #define PPC_DEBUG_SPR */
Re: [PATCH v3 5/6] target/ppc: Restrict 'kvm_ppc.h' to sysemu in cpu_init.c
In reply to Philippe Mathieu-DaudéQuoted 5 lines · On Tue, 27 Jun 2023 13:51:23 +0200 Philippe Mathieu-Daudé <[email protected]>…
User emulation shouldn't need any of the KVM prototypes declared in "
kvm_ppc.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 23 lines
target/ppc/cpu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/ppc/cpu_init.c +1
-1@@ -21,7 +21,6 @@#include "qemu/osdep.h" #include "disas/dis-asm.h" #include "gdbstub/helpers.h" -#include "kvm_ppc.h" #include "sysemu/cpus.h" #include "sysemu/hw_accel.h" #include "sysemu/tcg.h" @@ -49,6 +48,7 @@#ifndef CONFIG_USER_ONLY #include "hw/boards.h" #include "hw/intc/intc.h" +#include "kvm_ppc.h" #endif /* #define PPC_DEBUG_SPR */
Signature · 1 line
Greg
PATCH v3 6/6 target/ppc: Remove pointless checks of CONFIG_USER_ONLY in 'kvm_ppc.h'
In reply to Philippe Mathieu-Daudé--- target/ppc/kvm_ppc.h | 5 ----- 1 file changed, 5 deletions(-)
target/ppc/kvm_ppc.h +0 -5
@@ -42,7 +42,6 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu);target_ulong kvmppc_configure_v3_mmu (PowerPCCPU *cpu,bool radix,bool gtse,uint64_t proc_tbl); -#ifndef CONFIG_USER_ONLY bool kvmppc_spapr_use_multitce (void );int kvmppc_spapr_enable_inkernel_multitce (void ); void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
@@ -52,7 +51,6 @@ int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);int kvmppc_reset_htab (int shift_hint);uint64_t kvmppc_vrma_limit (unsigned int hash_shift);bool kvmppc_has_cap_spapr_vfio (void ); -#endif /* !CONFIG_USER_ONLY */ bool kvmppc_has_cap_epr (void );int kvmppc_define_rtas_kernel_token (uint32_t token,const char *function);int kvmppc_get_htab_fd (bool write,uint64_t index,Error **errp);
@@ -262,7 +260,6 @@ static inline void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset) { } -#ifndef CONFIG_USER_ONLY static inline bool kvmppc_spapr_use_multitce (void ) {return false;
@@ -322,8 +319,6 @@ static inline void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1)abort (); } -#endif /* !CONFIG_USER_ONLY */ -static inline bool kvmppc_has_cap_epr (void ) {return false;
Signature · 1 line
2.38.1
Re: [PATCH v3 6/6] target/ppc: Remove pointless checks of CONFIG_USER_ONLY in 'kvm_ppc.h'
Quoted 1 line · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
I guess the MemoryRegion code has sufficiently changed since commit 98efaf75282a ("ppc: Fix up usermode only builds") ?
Thanks,
C.
Quoted 41 lines
--- target/ppc/kvm_ppc.h | 5 ----- 1 file changed, 5 deletions(-)target/ppc/kvm_ppc.h +0
-5@@ -42,7 +42,6 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu);target_ulong kvmppc_configure_v3_mmu (PowerPCCPU *cpu,bool radix,bool gtse,uint64_t proc_tbl); -#ifndef CONFIG_USER_ONLY bool kvmppc_spapr_use_multitce (void );int kvmppc_spapr_enable_inkernel_multitce (void ); void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,@@ -52,7 +51,6 @@ int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);int kvmppc_reset_htab (int shift_hint);uint64_t kvmppc_vrma_limit (unsigned int hash_shift);bool kvmppc_has_cap_spapr_vfio (void ); -#endif /* !CONFIG_USER_ONLY */ bool kvmppc_has_cap_epr (void );int kvmppc_define_rtas_kernel_token (uint32_t token,const char *function);int kvmppc_get_htab_fd (bool write,uint64_t index,Error **errp);@@ -262,7 +260,6 @@ static inline void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset) { } -#ifndef CONFIG_USER_ONLY static inline bool kvmppc_spapr_use_multitce (void ) {return false;@@ -322,8 +319,6 @@ static inline void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1)abort (); } -#endif /* !CONFIG_USER_ONLY */ -static inline bool kvmppc_has_cap_epr (void ) {return false;
Re: [PATCH v3 6/6] target/ppc: Remove pointless checks of CONFIG_USER_ONLY in 'kvm_ppc.h'
In reply to Philippe Mathieu-DaudéQuoted 2 lines · On Tue, 27 Jun 2023 13:51:24 +0200 Philippe Mathieu-Daudé <[email protected]>…
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 40 lines
target/ppc/kvm_ppc.h | 5 ----- 1 file changed, 5 deletions(-)target/ppc/kvm_ppc.h +0
-5@@ -42,7 +42,6 @@ int kvmppc_booke_watchdog_enable(PowerPCCPU *cpu);target_ulong kvmppc_configure_v3_mmu (PowerPCCPU *cpu,bool radix,bool gtse,uint64_t proc_tbl); -#ifndef CONFIG_USER_ONLY bool kvmppc_spapr_use_multitce (void );int kvmppc_spapr_enable_inkernel_multitce (void ); void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,@@ -52,7 +51,6 @@ int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);int kvmppc_reset_htab (int shift_hint);uint64_t kvmppc_vrma_limit (unsigned int hash_shift);bool kvmppc_has_cap_spapr_vfio (void ); -#endif /* !CONFIG_USER_ONLY */ bool kvmppc_has_cap_epr (void );int kvmppc_define_rtas_kernel_token (uint32_t token,const char *function);int kvmppc_get_htab_fd (bool write,uint64_t index,Error **errp);@@ -262,7 +260,6 @@ static inline void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset) { } -#ifndef CONFIG_USER_ONLY static inline bool kvmppc_spapr_use_multitce (void ) {return false;@@ -322,8 +319,6 @@ static inline void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1)abort (); } -#endif /* !CONFIG_USER_ONLY */ -static inline bool kvmppc_has_cap_epr (void ) {return false;
Signature · 1 line
Greg
Phil,
I queued all patches to ppc-next. I fixed up patch 3 to not move the cpu_list macro as Greg suggested. If you're strongly attached to it let me know and I'll remove it from the queue.
Greg, feel free to send your R-b in patch 3 if patch 3 with this change pleases you.
Daniel
Quoted 17 lines · Philippe Mathieu-Daudé
PPC specific changes of a bigger KVM cleanup, remove "
kvm_ppc.h" from user emulation. Mostly trivial IMO.Philippe Mathieu-Daudé (6):
target/ppc: Have 'kvm_ppc.h' include 'sysemu/kvm.h' target/ppc: Reorder #ifdef'ry inkvm_ppc.h
target/ppc: Move CPU QOM definitions tocpu-qom.htarget/ppc: DefineTYPE_HOST_POWERPC_CPUincpu-qom.htarget/ppc: Restrict 'kvm_ppc.h' to sysemu incpu_init.ctarget/ppc: Remove pointless checks ofCONFIG_USER_ONLYin 'kvm_ppc.h'target/ppc/cpu-qom.h | 7 +++++ target/ppc/cpu.h | 6 ---- target/ppc/kvm_ppc.h | 70 ++++++++++++++++++------------------------- target/ppc/cpu_init.c | 2 +- 4 files changed, 37 insertions(+), 48 deletions(-)
Quoted 5 lines · Daniel Henrique Barboza
Phil,
I queued all patches to ppc-next. I fixed up patch 3 to not move the
cpu_listmacro as Greg suggested. If you're strongly attached to it let me know and I'll remove it from the queue.
Sorry for missing that earlier, sure, no problem!
Quoted 5 lines
Greg, feel free to send your R-b in patch 3 if patch 3 with this change pleases you.
Daniel