arch_init.c cleanup
Subsystems (3)
v2 cover arch_init.c cleanup
This series gets rid of most of the code in arch_init.c. It moves the QEMU_ARCH macro definitions to corresponding cpu.h files, and gets rid of kvm_available() and xen_available().
After this series, only two things remain in arch_init.c:
- the arch_type variable, which seems to be a useful feature; and
- the initialization of graphic_width/graphic_height/graphic_depth, which is a hack we must eventually get rid of.
Gerd got rid of the graphic_* initialization hack once (in 2017), but the series was never merged:
https://lore.kernel.org/qemu-devel/[email protected]
Eduardo Habkost (6):
arch_init: Move QEMU_ARCH definitions to cpu.h
accel: accel_available() function
kvm: Remove kvm_available() function
xen: Delete xen_available() function
Remove unnecessary usage of arch_init.h
Rename arch_init.h to arch_type.h
include/sysemu/accel.h | 1 +
include/sysemu/{arch_init.h => arch_type.h} | 3 -
target/alpha/cpu.h | 1 +
target/arm/cpu.h | 1 +
target/avr/cpu.h | 1 +
target/cris/cpu.h | 1 +
target/hppa/cpu.h | 1 +
target/i386/cpu.h | 1 +
target/lm32/cpu.h | 1 +
target/m68k/cpu.h | 1 +
target/microblaze/cpu.h | 1 +
target/mips/cpu.h | 1 +
target/moxie/cpu.h | 1 +
target/nios2/cpu.h | 1 +
target/openrisc/cpu.h | 1 +
target/ppc/cpu.h | 1 +
target/riscv/cpu.h | 1 +
target/rx/cpu.h | 1 +
target/s390x/cpu.h | 1 +
target/sh4/cpu.h | 1 +
target/sparc/cpu.h | 1 +
target/tricore/cpu.h | 1 +
target/unicore32/cpu.h | 1 +
target/xtensa/cpu.h | 1 +
accel/accel.c | 6 +-
blockdev.c | 2 +-
hw/i386/pc.c | 1 -
hw/i386/pc_piix.c | 1 -
hw/i386/pc_q35.c | 1 -
hw/mips/jazz.c | 1 -
hw/mips/malta.c | 1 -
hw/ppc/prep.c | 1 -
hw/riscv/sifive_e.c | 1 -
hw/riscv/sifive_u.c | 1 -
hw/riscv/spike.c | 1 -
hw/riscv/virt.c | 1 -
monitor/qmp-cmds.c | 3 +-
softmmu/arch_init.c | 66 +--------------------
softmmu/qdev-monitor.c | 2 +-
softmmu/vl.c | 8 +--
stubs/arch_type.c | 2 +-
target/i386/cpu.c | 1 -
target/s390x/cpu.c | 1 -
target/s390x/cpu_models.c | 1 -
target/ppc/translate_init.c.inc | 1 -
45 files changed, 37 insertions(+), 92 deletions(-)
rename include/sysemu/{arch_init.h => arch_type.h} (94%)Signature · 1 line
2.28.0
PATCH v2 1/6 arch_init: Move QEMU_ARCH definitions to cpu.h
Instead of a collection of #ifdefs on arch_init.c, define QEMU_ARCH inside each cpu.h file.
---
Cc: Richard Henderson <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Michael Rolnik <[email protected]>
Cc: Sarah Harris <[email protected]>
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: Michael Walle <[email protected]>
Cc: Laurent Vivier <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: Anthony Green <[email protected]>
Cc: Chris Wulff <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Stafford Horne <[email protected]>
Cc: David Gibson <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Mark Cave-Ayland <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Max Filippov <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- target/alpha/cpu.h | 1 + target/arm/cpu.h | 1 + target/avr/cpu.h | 1 + target/cris/cpu.h | 1 + target/hppa/cpu.h | 1 + target/i386/cpu.h | 1 + target/lm32/cpu.h | 1 + target/m68k/cpu.h | 1 + target/microblaze/cpu.h | 1 + target/mips/cpu.h | 1 + target/moxie/cpu.h | 1 + target/nios2/cpu.h | 1 + target/openrisc/cpu.h | 1 + target/ppc/cpu.h | 1 + target/riscv/cpu.h | 1 + target/rx/cpu.h | 1 + target/s390x/cpu.h | 1 + target/sh4/cpu.h | 1 + target/sparc/cpu.h | 1 + target/tricore/cpu.h | 1 + target/unicore32/cpu.h | 1 + target/xtensa/cpu.h | 1 + softmmu/arch_init.c | 46 ----------------------------------------- 23 files changed, 22 insertions(+), 46 deletions(-)
target/alpha/cpu.h +1 -0
@@ -438,6 +438,7 @@ void alpha_translate_init(void);#define ALPHA_CPU_TYPE_SUFFIX "-" TYPE_ALPHA_CPU#define ALPHA_CPU_TYPE_NAME (model) model ALPHA_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_ALPHA_CPU +#define QEMU_ARCH QEMU_ARCH_ALPHAvoid alpha_cpu_list (void );/* you can call this signal handler from your SIGBUS and SIGSEGV
target/arm/cpu.h +1 -0
@@ -2822,6 +2822,7 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync);#define ARM_CPU_TYPE_SUFFIX "-" TYPE_ARM_CPU#define ARM_CPU_TYPE_NAME (name) (name ARM_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_ARM_CPU +#define QEMU_ARCH QEMU_ARCH_ARM#define cpu_signal_handler cpu_arm_signal_handler#define cpu_list arm_cpu_list
target/avr/cpu.h +1 -0
@@ -31,6 +31,7 @@#define AVR_CPU_TYPE_SUFFIX "-" TYPE_AVR_CPU#define AVR_CPU_TYPE_NAME (name) (name AVR_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_AVR_CPU +#define QEMU_ARCH QEMU_ARCH_AVR#define TCG_GUEST_DEFAULT_MO 0
target/cris/cpu.h +1 -0
@@ -249,6 +249,7 @@ enum {#define CRIS_CPU_TYPE_SUFFIX "-" TYPE_CRIS_CPU#define CRIS_CPU_TYPE_NAME (name) (name CRIS_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_CRIS_CPU +#define QEMU_ARCH QEMU_ARCH_CRIS#define cpu_signal_handler cpu_cris_signal_handler
target/hppa/cpu.h +1 -0
@@ -242,6 +242,7 @@ static inline int cpu_mmu_index(CPUHPPAState *env, bool ifetch)void hppa_translate_init (void );#define CPU_RESOLVING_TYPE TYPE_HPPA_CPU +#define QEMU_ARCH QEMU_ARCH_HPPAstatic inline target_ulong hppa_form_gva_psw (target_ureg psw,uint64_t spc,target_ureg off)
target/i386/cpu.h +1 -0
@@ -1971,6 +1971,7 @@ uint64_t cpu_get_tsc(CPUX86State *env);#define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU#define X86_CPU_TYPE_NAME (name) (name X86_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_X86_CPU +#define QEMU_ARCH QEMU_ARCH_I386#ifdef TARGET_X86_64 #define TARGET_DEFAULT_CPU_TYPE X86_CPU_TYPE_NAME("qemu64")
target/lm32/cpu.h +1 -0
@@ -238,6 +238,7 @@ bool lm32_cpu_do_semihosting(CPUState *cs);#define LM32_CPU_TYPE_SUFFIX "-" TYPE_LM32_CPU#define LM32_CPU_TYPE_NAME (model) model LM32_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_LM32_CPU +#define QEMU_ARCH QEMU_ARCH_LM32#define cpu_list lm32_cpu_list#define cpu_signal_handler cpu_lm32_signal_handler
target/m68k/cpu.h +1 -0
@@ -514,6 +514,7 @@ enum {#define M68K_CPU_TYPE_SUFFIX "-" TYPE_M68K_CPU#define M68K_CPU_TYPE_NAME (model) model M68K_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_M68K_CPU +#define QEMU_ARCH QEMU_ARCH_M68K#define cpu_signal_handler cpu_m68k_signal_handler#define cpu_list m68k_cpu_list
target/microblaze/cpu.h +1 -0
@@ -378,6 +378,7 @@ int cpu_mb_signal_handler(int host_signum, void *pinfo, void *puc);#define CPU_RESOLVING_TYPE TYPE_MICROBLAZE_CPU +#define QEMU_ARCH QEMU_ARCH_MICROBLAZE#define cpu_signal_handler cpu_mb_signal_handler
target/mips/cpu.h +1 -0
@@ -1285,6 +1285,7 @@ int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);#define MIPS_CPU_TYPE_SUFFIX "-" TYPE_MIPS_CPU#define MIPS_CPU_TYPE_NAME (model) model MIPS_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_MIPS_CPU +#define QEMU_ARCH QEMU_ARCH_MIPSbool cpu_supports_cps_smp (const char *cpu_type);bool cpu_supports_isa (const char *cpu_type,uint64_t isa);
target/moxie/cpu.h +1 -0
@@ -95,6 +95,7 @@ int cpu_moxie_signal_handler(int host_signum, void *pinfo,#define MOXIE_CPU_TYPE_SUFFIX "-" TYPE_MOXIE_CPU#define MOXIE_CPU_TYPE_NAME (model) model MOXIE_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_MOXIE_CPU +#define QEMU_ARCH QEMU_ARCH_MOXIE#define cpu_signal_handler cpu_moxie_signal_handler
target/nios2/cpu.h +1 -0
@@ -207,6 +207,7 @@ void nios2_check_interrupts(CPUNios2State *env);void do_nios2_semihosting (CPUNios2State *env);#define CPU_RESOLVING_TYPE TYPE_NIOS2_CPU +#define QEMU_ARCH QEMU_ARCH_NIOS2#define cpu_gen_code cpu_nios2_gen_code#define cpu_signal_handler cpu_nios2_signal_handler
target/openrisc/cpu.h +1 -0
@@ -348,6 +348,7 @@ void cpu_openrisc_count_stop(OpenRISCCPU *cpu);#define OPENRISC_CPU_TYPE_SUFFIX "-" TYPE_OPENRISC_CPU#define OPENRISC_CPU_TYPE_NAME (model) model OPENRISC_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_OPENRISC_CPU +#define QEMU_ARCH QEMU_ARCH_OPENRISCtypedef CPUOpenRISCState CPUArchState ;typedef OpenRISCCPU ArchCPU ;
target/ppc/cpu.h +1 -0
@@ -1334,6 +1334,7 @@ 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 QEMU_ARCH QEMU_ARCH_PPC#define cpu_signal_handler cpu_ppc_signal_handler#define cpu_list ppc_cpu_list
target/riscv/cpu.h +1 -0
@@ -33,6 +33,7 @@#define RISCV_CPU_TYPE_SUFFIX "-" TYPE_RISCV_CPU#define RISCV_CPU_TYPE_NAME (name) (name RISCV_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_RISCV_CPU +#define QEMU_ARCH QEMU_ARCH_RISCV#define TYPE_RISCV_CPU_ANY RISCV_CPU_TYPE_NAME("any")#define TYPE_RISCV_CPU_BASE32 RISCV_CPU_TYPE_NAME("rv32")
target/rx/cpu.h +1 -0
@@ -122,6 +122,7 @@ typedef RXCPU ArchCPU;#define RX_CPU_TYPE_SUFFIX "-" TYPE_RX_CPU#define RX_CPU_TYPE_NAME (model) model RX_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_RX_CPU +#define QEMU_ARCH QEMU_ARCH_RXconst char *rx_crname (uint8_t cr);void rx_cpu_do_interrupt (CPUState *cpu);
target/s390x/cpu.h +1 -0
@@ -797,6 +797,7 @@ void s390_set_qemu_cpu_model(uint16_t type, uint8_t gen, uint8_t ec_ga,#define S390_CPU_TYPE_SUFFIX "-" TYPE_S390_CPU#define S390_CPU_TYPE_NAME (name) (name S390_CPU_TYPE_SUFFIX)#define CPU_RESOLVING_TYPE TYPE_S390_CPU +#define QEMU_ARCH QEMU_ARCH_S390X/* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero
target/sh4/cpu.h +1 -0
@@ -249,6 +249,7 @@ void cpu_load_tlb(CPUSH4State * env);#define SUPERH_CPU_TYPE_SUFFIX "-" TYPE_SUPERH_CPU#define SUPERH_CPU_TYPE_NAME (model) model SUPERH_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_SUPERH_CPU +#define QEMU_ARCH QEMU_ARCH_SH4#define cpu_signal_handler cpu_sh4_signal_handler#define cpu_list sh4_cpu_list
target/sparc/cpu.h +1 -0
@@ -662,6 +662,7 @@ int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc);#define SPARC_CPU_TYPE_SUFFIX "-" TYPE_SPARC_CPU#define SPARC_CPU_TYPE_NAME (model) model SPARC_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_SPARC_CPU +#define QEMU_ARCH QEMU_ARCH_SPARC#define cpu_signal_handler cpu_sparc_signal_handler#define cpu_list sparc_cpu_list
target/tricore/cpu.h +1 -0
@@ -402,6 +402,7 @@ static inline void cpu_get_tb_cpu_state(CPUTriCoreState *env, target_ulong *pc,#define TRICORE_CPU_TYPE_SUFFIX "-" TYPE_TRICORE_CPU#define TRICORE_CPU_TYPE_NAME (model) model TRICORE_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_TRICORE_CPU +#define QEMU_ARCH QEMU_ARCH_TRICORE/* helpers.c */ bool tricore_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
target/unicore32/cpu.h +1 -0
@@ -147,6 +147,7 @@ typedef UniCore32CPU ArchCPU;#define UNICORE32_CPU_TYPE_SUFFIX "-" TYPE_UNICORE32_CPU#define UNICORE32_CPU_TYPE_NAME (model) model UNICORE32_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_UNICORE32_CPU +#define QEMU_ARCH QEMU_ARCH_UNICORE32static inline void cpu_get_tb_cpu_state (CPUUniCore32State *env,target_ulong *pc,target_ulong *cs_base,uint32_t *flags)
target/xtensa/cpu.h +1 -0
@@ -589,6 +589,7 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,#define XTENSA_CPU_TYPE_SUFFIX "-" TYPE_XTENSA_CPU#define XTENSA_CPU_TYPE_NAME (model) model XTENSA_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_XTENSA_CPU +#define QEMU_ARCH QEMU_ARCH_XTENSA#ifdef TARGET_WORDS_BIGENDIAN #define XTENSA_DEFAULT_CPU_MODEL "fsf"
softmmu/arch_init.c +0 -46
52 lines not on this page · raw message
Signature · 1 line
2.28.0
Re: [PATCH v2 1/6] arch_init: Move QEMU_ARCH definitions to cpu.h
Quoted 5 lines · Eduardo Habkost
Instead of a collection of #ifdefs on
arch_init.c, defineQEMU_ARCHinside eachcpu.hfile.Signed-off-by Eduardo Habkost <[email protected]>---
Sounds like a good idea to get rid of the #ifdeffery!
Re: [PATCH v2 1/6] arch_init: Move QEMU_ARCH definitions to cpu.h
In reply to Eduardo HabkostQuoted 57 lines · On Wed, 25 Nov 2020 15:56:31 -0500 Eduardo Habkost <[email protected]> wrote:
Instead of a collection of #ifdefs on
arch_init.c, defineQEMU_ARCHinside eachcpu.hfile.Signed-off-by Eduardo Habkost <[email protected]>---
Cc: Richard Henderson <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Michael Rolnik <[email protected]>
Cc: Sarah Harris <[email protected]>
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: Michael Walle <[email protected]>
Cc: Laurent Vivier <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: Anthony Green <[email protected]>
Cc: Chris Wulff <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Stafford Horne <[email protected]>
Cc: David Gibson <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Mark Cave-Ayland <[email protected]>
Cc: Artyom Tarasenko <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Max Filippov <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- target/alpha/cpu.h | 1 + target/arm/cpu.h | 1 + target/avr/cpu.h | 1 + target/cris/cpu.h | 1 + target/hppa/cpu.h | 1 + target/i386/cpu.h | 1 + target/lm32/cpu.h | 1 + target/m68k/cpu.h | 1 + target/microblaze/cpu.h | 1 + target/mips/cpu.h | 1 + target/moxie/cpu.h | 1 + target/nios2/cpu.h | 1 + target/openrisc/cpu.h | 1 + target/ppc/cpu.h | 1 + target/riscv/cpu.h | 1 + target/rx/cpu.h | 1 +
Quoted 8 lines
target/s390x/cpu.h | 1 + target/sh4/cpu.h | 1 + target/sparc/cpu.h | 1 + target/tricore/cpu.h | 1 + target/unicore32/cpu.h | 1 + target/xtensa/cpu.h | 1 + softmmu/arch_init.c | 46 ----------------------------------------- 23 files changed, 22 insertions(+), 46 deletions(-)
Much better :)
PATCH v2 2/6 accel: accel_available() function
In reply to Eduardo HabkostThis function will be used to replace the xen_available() and kvm_available() functions from arch_init.c.
---
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Claudio Fontana <[email protected]>
Cc: Roman Bolshakov <[email protected]>
--- include/sysemu/accel.h | 1 + accel/accel.c | 5 +++++ 2 files changed, 6 insertions(+)
include/sysemu/accel.h +1 -0
@@ -67,6 +67,7 @@ typedef struct AccelClass { OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL)AccelClass *accel_find (const char *opt_name); +bool accel_available (const char *name);int accel_init_machine (AccelState *accel,MachineState *ms);/* Called just before os_setup_post (ie just before drop OS privs) */
accel/accel.c +5 -0
@@ -46,6 +46,11 @@ AccelClass *accel_find(const char *opt_name)return ac; } +bool accel_available (const char *name) +{ +return accel_find (name) !=NULL ; +} +int accel_init_machine (AccelState *accel,MachineState *ms) {AccelClass *acc =ACCEL_GET_CLASS (accel);
Signature · 1 line
2.28.0
Re: [PATCH v2 2/6] accel: accel_available() function
Hi Eduardo,
Quoted 31 lines · Eduardo Habkost
This function will be used to replace the
xen_available()andkvm_available()functions fromarch_init.c.Signed-off-by Eduardo Habkost <[email protected]>---
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Claudio Fontana <[email protected]>
Cc: Roman Bolshakov <[email protected]>--- include/sysemu/accel.h | 1 + accel/accel.c | 5 +++++ 2 files changed, 6 insertions(+)include/sysemu/accel.h +1
-0@@ -67,6 +67,7 @@ typedef struct AccelClass { OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL)AccelClass *accel_find (const char *opt_name); +bool accel_available (const char *name);int accel_init_machine (AccelState *accel,MachineState *ms);/* Called just before os_setup_post (ie just before drop OS privs) */ accel/accel.c +0
-0
accel/accel.c AccelClass *accel_find(const char *opt_name) · line 51
Quoted 6 lines
accel/accel.c +3
-0@@ -46,6 +46,11 @@ AccelClass *accel_find(const char *opt_name)return ac; } +bool accel_available (const char *name) +{ +return accel_find (name) !=NULL ;
accel_find() in its implementation allocates and then frees memory to generate the string, the user of accel_available() might be unaware and overuse leading to fragmentation/performance issues?
Quoted 6 lines
accel/accel.c +2
-0+} +int accel_init_machine (AccelState *accel,MachineState *ms) {AccelClass *acc =ACCEL_GET_CLASS (accel);
Re: [PATCH v2 2/6] accel: accel_available() function
Quoted 37 lines · Claudio Fontana
Hi Eduardo,
Quoted 34 lines · Eduardo Habkost
This function will be used to replace the
xen_available()andkvm_available()functions fromarch_init.c.Signed-off-by Eduardo Habkost <[email protected]>---
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Claudio Fontana <[email protected]>
Cc: Roman Bolshakov <[email protected]>--- include/sysemu/accel.h | 1 + accel/accel.c | 5 +++++ 2 files changed, 6 insertions(+)include/sysemu/accel.h +1
-0@@ -67,6 +67,7 @@ typedef struct AccelClass { OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL)AccelClass *accel_find (const char *opt_name); +bool accel_available (const char *name);int accel_init_machine (AccelState *accel,MachineState *ms);/* Called just before os_setup_post (ie just before drop OS privs) */ accel/accel.c +0
-0@@ -46,6 +46,11 @@ AccelClass *accel_find(const char *opt_name)return ac; }
Quoted 7 lines
accel/accel.c AccelClass *accel_find(const char *opt_name) · line 51
Quoted 3 lines
accel/accel.c +3
-0+bool accel_available (const char *name) +{ +return accel_find (name) !=NULL ;
accel_find()in its implementation allocates and then frees memory to generate the string, the user ofaccel_available()might be unaware and overuse leading to fragmentation/performance issues?
Is that a real issue? We had only 3 users of kvm_available() and xen_available() since those functions were added 10 years ago.
Do you have any suggestions on what we should do?
Signature · 1 line
Eduardo
Re: [PATCH v2 2/6] accel: accel_available() function
Quoted 46 lines · Eduardo Habkost
Quoted 37 lines · Claudio Fontana
Hi Eduardo,
Quoted 34 lines · Eduardo Habkost
This function will be used to replace the
xen_available()andkvm_available()functions fromarch_init.c.Signed-off-by Eduardo Habkost <[email protected]>---
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Claudio Fontana <[email protected]>
Cc: Roman Bolshakov <[email protected]>--- include/sysemu/accel.h | 1 + accel/accel.c | 5 +++++ 2 files changed, 6 insertions(+)include/sysemu/accel.h +1
-0@@ -67,6 +67,7 @@ typedef struct AccelClass { OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL)AccelClass *accel_find (const char *opt_name); +bool accel_available (const char *name);int accel_init_machine (AccelState *accel,MachineState *ms);/* Called just before os_setup_post (ie just before drop OS privs) */ accel/accel.c +0
-0@@ -46,6 +46,11 @@ AccelClass *accel_find(const char *opt_name)return ac; }Quoted 7 lines
accel/accel.c AccelClass *accel_find(const char *opt_name) · line 51
Quoted 3 lines
accel/accel.c +3
-0+bool accel_available (const char *name) +{ +return accel_find (name) !=NULL ;
accel_find()in its implementation allocates and then frees memory to generate the string, the user ofaccel_available()might be unaware and overuse leading to fragmentation/performance issues?
Quoted 5 lines
Is that a real issue? We had only 3 users of
kvm_available()andxen_available()since those functions were added 10 years ago.Do you have any suggestions on what we should do?
One option I see is simply to document the behavior where accel_available() is declared in accel.h (ie do not use in fast path), as well as in accel_find() actually, so that both accel_find() and accel_available() are avoided in fast path and avoid being called frequently at runtime.
Another option could be to remove the allocation completely, and use for example accel_find(ACCEL_CLASS_NAME("tcg")),
or another option again would be to remove the allocation and use either a fixed buffer + snprintf, or alloca -like builtin code to use the stack, ...
Not a big deal, but with a general utility and short name like accel_available(name) it might be tempting to use this more in the future?
Ciao,
Claudio
Paolo Bonzini
maintainerRe: [PATCH v2 2/6] accel: accel_available() function
Quoted 6 lines · Claudio Fontana
One option I see is simply to document the behavior where
accel_available()is declared inaccel.h(ie do not use in fast path), as well as inaccel_find()actually, so that bothaccel_find()andaccel_available()are avoided in fast path and avoid being called frequently at runtime.
Quoted 8 lines
Another option could be to remove the allocation completely, and use for example accel_find(ACCEL_CLASS_NAME("tcg")), or another option again would be to remove the allocation and use either a fixed buffer
+ snprintf, or alloca -like builtin code to use the stack, ...Not a big deal, but with a general utility and short name like
accel_available(name)it might be tempting to use this more in the future?
I think it's just that the usecase is not that common. "Is this accelerator compiled in the binary" is not something you need after startup (or if querying the monitor).
Paolo
Re: [PATCH v2 2/6] accel: accel_available() function
Quoted 16 lines · Paolo Bonzini
Quoted 6 lines · Claudio Fontana
One option I see is simply to document the behavior where
accel_available()is declared inaccel.h(ie do not use in fast path), as well as inaccel_find()actually, so that bothaccel_find()andaccel_available()are avoided in fast path and avoid being called frequently at runtime.Quoted 8 lines
Another option could be to remove the allocation completely, and use for example accel_find(ACCEL_CLASS_NAME("tcg")), or another option again would be to remove the allocation and use either a fixed buffer
+ snprintf, or alloca -like builtin code to use the stack, ...Not a big deal, but with a general utility and short name like
accel_available(name)it might be tempting to use this more in the future?
Quoted 7 lines
I think it's just that the usecase is not that common. "Is this accelerator compiled in the binary" is not something you need after startup (or if querying the monitor).
Paolo
A script that repeatedly uses the QMP interface to query for the status could generate fragmentation this way I think.
Ciao,
Claudio
Re: [PATCH v2 2/6] accel: accel_available() function
Quoted 21 lines · Claudio Fontana
Quoted 20 lines · Paolo Bonzini
Quoted 6 lines · Claudio Fontana
One option I see is simply to document the behavior where
accel_available()is declared inaccel.h(ie do not use in fast path), as well as inaccel_find()actually, so that bothaccel_find()andaccel_available()are avoided in fast path and avoid being called frequently at runtime.Quoted 8 lines
Another option could be to remove the allocation completely, and use for example accel_find(ACCEL_CLASS_NAME("tcg")), or another option again would be to remove the allocation and use either a fixed buffer
+ snprintf, or alloca -like builtin code to use the stack, ...Not a big deal, but with a general utility and short name like
accel_available(name)it might be tempting to use this more in the future?I think it's just that the usecase is not that common. "Is this accelerator compiled in the binary" is not something you need after startup (or if querying the monitor).
Quoted 6 lines
Quoted 3 lines
Paolo
A script that repeatedly uses the QMP interface to query for the status could generate fragmentation this way I think.
Is this a problem? Today, execution of a "query-kvm" command calls g_malloc() 37 times.
Signature · 1 line
Eduardo
Re: [PATCH v2 2/6] accel: accel_available() function
Quoted 26 lines · Eduardo Habkost
Quoted 25 lines · Claudio Fontana
Quoted 23 lines · Paolo Bonzini
Quoted 6 lines · Claudio Fontana
One option I see is simply to document the behavior where
accel_available()is declared inaccel.h(ie do not use in fast path), as well as inaccel_find()actually, so that bothaccel_find()andaccel_available()are avoided in fast path and avoid being called frequently at runtime.Quoted 8 lines
Another option could be to remove the allocation completely, and use for example accel_find(ACCEL_CLASS_NAME("tcg")), or another option again would be to remove the allocation and use either a fixed buffer
+ snprintf, or alloca -like builtin code to use the stack, ...Not a big deal, but with a general utility and short name like
accel_available(name)it might be tempting to use this more in the future?I think it's just that the usecase is not that common. "Is this accelerator compiled in the binary" is not something you need after startup (or if querying the monitor).
Paolo
Quoted 6 lines
Quoted 2 lines
A script that repeatedly uses the QMP interface to query for the status could generate fragmentation this way I think.
Is this a problem? Today, execution of a "query-kvm" command calls
g_malloc()37 times.
Not ideal in my view, but not the end of the world either.
Ciao,
Claudio
Re: [PATCH v2 2/6] accel: accel_available() function
Quoted 27 lines · Claudio Fontana
Quoted 26 lines · Eduardo Habkost
Quoted 25 lines · Claudio Fontana
Quoted 23 lines · Paolo Bonzini
Quoted 6 lines · Claudio Fontana
One option I see is simply to document the behavior where
accel_available()is declared inaccel.h(ie do not use in fast path), as well as inaccel_find()actually, so that bothaccel_find()andaccel_available()are avoided in fast path and avoid being called frequently at runtime.Quoted 8 lines
Another option could be to remove the allocation completely, and use for example accel_find(ACCEL_CLASS_NAME("tcg")), or another option again would be to remove the allocation and use either a fixed buffer
+ snprintf, or alloca -like builtin code to use the stack, ...Not a big deal, but with a general utility and short name like
accel_available(name)it might be tempting to use this more in the future?I think it's just that the usecase is not that common. "Is this accelerator compiled in the binary" is not something you need after startup (or if querying the monitor).
Paolo
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
A script that repeatedly uses the QMP interface to query for the status could generate fragmentation this way I think.
Is this a problem? Today, execution of a "query-kvm" command calls
g_malloc()37 times.Not ideal in my view, but not the end of the world either.
QMP's appetite for malloc is roughly comparable to a pig's for truffles.
Re: [PATCH v2 2/6] accel: accel_available() function
Quoted 32 lines · Markus Armbruster
Quoted 30 lines · Claudio Fontana
Quoted 29 lines · Eduardo Habkost
Quoted 27 lines · Claudio Fontana
Quoted 16 lines · Paolo Bonzini
Quoted 6 lines · Claudio Fontana
One option I see is simply to document the behavior where
accel_available()is declared inaccel.h(ie do not use in fast path), as well as inaccel_find()actually, so that bothaccel_find()andaccel_available()are avoided in fast path and avoid being called frequently at runtime.Quoted 8 lines
Another option could be to remove the allocation completely, and use for example accel_find(ACCEL_CLASS_NAME("tcg")), or another option again would be to remove the allocation and use either a fixed buffer
+ snprintf, or alloca -like builtin code to use the stack, ...Not a big deal, but with a general utility and short name like
accel_available(name)it might be tempting to use this more in the future?Quoted 7 lines
I think it's just that the usecase is not that common. "Is this accelerator compiled in the binary" is not something you need after startup (or if querying the monitor).
Paolo
A script that repeatedly uses the QMP interface to query for the status could generate fragmentation this way I think.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Is this a problem? Today, execution of a "query-kvm" command calls
g_malloc()37 times.Not ideal in my view, but not the end of the world either.
QMP's appetite for malloc is roughly comparable to a pig's for truffles.
:-)
Btw, do we have limits on the maximum size of these objects? I mean, a single QMP command, a single QEMU object type name, etc?
In this case we could do some overall improvement there, and might even avoid some problems down the road..
Ciao,
Claudio
Re: [PATCH v2 2/6] accel: accel_available() function
Quoted 42 lines · Claudio Fontana
Quoted 32 lines · Markus Armbruster
Quoted 30 lines · Claudio Fontana
Quoted 29 lines · Eduardo Habkost
Quoted 27 lines · Claudio Fontana
Quoted 16 lines · Paolo Bonzini
Quoted 6 lines · Claudio Fontana
One option I see is simply to document the behavior where
accel_available()is declared inaccel.h(ie do not use in fast path), as well as inaccel_find()actually, so that bothaccel_find()andaccel_available()are avoided in fast path and avoid being called frequently at runtime.Quoted 8 lines
Another option could be to remove the allocation completely, and use for example accel_find(ACCEL_CLASS_NAME("tcg")), or another option again would be to remove the allocation and use either a fixed buffer
+ snprintf, or alloca -like builtin code to use the stack, ...Not a big deal, but with a general utility and short name like
accel_available(name)it might be tempting to use this more in the future?Quoted 7 lines
I think it's just that the usecase is not that common. "Is this accelerator compiled in the binary" is not something you need after startup (or if querying the monitor).
Paolo
A script that repeatedly uses the QMP interface to query for the status could generate fragmentation this way I think.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Is this a problem? Today, execution of a "query-kvm" command calls
g_malloc()37 times.Not ideal in my view, but not the end of the world either.
QMP's appetite for malloc is roughly comparable to a pig's for truffles.
Quoted 6 lines
:-)
Btw, do we have limits on the maximum size of these objects? I mean, a single QMP command, a single QEMU object type name, etc?
In this case we could do some overall improvement there, and might even avoid some problems down the road..
We have limits, but they are not comprehensive.
The QMP client is trusted. We don't try to guard against a malicious QMP client. We do try to guard against mistakes.
The JSON parser limits token size (in characters), expression size (in tokens), and expression nesting depth. This protects against a malfunctioning QMP client. The limits are ridiculously generous.
The QMP core limits the number of commands in flight per monitor to a somewhat parsimonious 8-9 in-band commands, plus one out-of-band command. This protects against a QMP client sending commands faster than we can execute them.
QMP output is buffered without limit. When a (malfunctioning) QMP client keeps sending commands without reading their output, QEMU keeps buffering until it runs out of memory and crashes.
Paolo Bonzini
maintainerRe: [PATCH v2 2/6] accel: accel_available() function
In reply to Claudio FontanaQuoted 5 lines · Claudio Fontana
Quoted 3 lines
I think it's just that the usecase is not that common. "Is this accelerator compiled in the binary" is not something you need after startup (or if querying the monitor).
A script that repeatedly uses the QMP interface to query for the status could generate fragmentation this way I think.
System malloc should be smarter than that, but anyway this is all but the only allocation in that path.
Paolo
Re: [PATCH v2 2/6] accel: accel_available() function
In reply to Eduardo HabkostQuoted 9 lines · On Wed, 25 Nov 2020 15:56:32 -0500 Eduardo Habkost <[email protected]> wrote:
This function will be used to replace the
xen_available()andkvm_available()functions fromarch_init.c.Signed-off-by Eduardo Habkost <[email protected]>---
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Claudio Fontana <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Quoted 4 lines
--- include/sysemu/accel.h | 1 + accel/accel.c | 5 +++++ 2 files changed, 6 insertions(+)
PATCH v2 3/6 kvm: Remove kvm_available() function
In reply to Eduardo HabkostThe only caller can use accel_available("kvm") instead.
---
Cc: Markus Armbruster <[email protected]>
Cc: [email protected]
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Claudio Fontana <[email protected]>
Cc: Roman Bolshakov <[email protected]>
--- include/sysemu/arch_init.h | 1 - monitor/qmp-cmds.c | 2 +- softmmu/arch_init.c | 9 --------- 3 files changed, 1 insertion(+), 11 deletions(-)
include/sysemu/arch_init.h +0 -1
@@ -32,7 +32,6 @@ enum {extern const uint32_t arch_type; -int kvm_available (void );int xen_available (void );#endif
monitor/qmp-cmds.c +1 -1
@@ -57,7 +57,7 @@ KvmInfo *qmp_query_kvm(Error **errp)KvmInfo *info =g_malloc0 (sizeof (*info)); info->enabled =kvm_enabled (); - info->present =kvm_available (); + info->present =accel_available ("kvm" );return info; }
softmmu/arch_init.c +0 -9
@@ -50,15 +50,6 @@ int graphic_depth = 32;const uint32_t arch_type =QEMU_ARCH ; -int kvm_available (void ) -{ -#ifdef CONFIG_KVM -return 1 ; -#else -return 0 ; -#endif -} -int xen_available (void ) {#ifdef CONFIG_XEN
Signature · 1 line
2.28.0
Re: [PATCH v2 3/6] kvm: Remove kvm_available() function
Quoted 12 lines · On Wed, 25 Nov 2020 15:56:33 -0500 Eduardo Habkost <[email protected]> wrote:
The only caller can use
accel_available("kvm")instead.Signed-off-by Eduardo Habkost <[email protected]>---
Cc: Markus Armbruster <[email protected]>
Cc: [email protected]
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Claudio Fontana <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Quoted 5 lines
--- include/sysemu/arch_init.h | 1 - monitor/qmp-cmds.c | 2 +- softmmu/arch_init.c | 9 --------- 3 files changed, 1 insertion(+), 11 deletions(-)
PATCH v2 4/6 xen: Delete xen_available() function
In reply to Eduardo HabkostThe function can be replaced with accel_available("xen").
---
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Cc: Paul Durrant <[email protected]>
Cc: [email protected]
Cc: Richard Henderson <[email protected]>
Cc: Claudio Fontana <[email protected]>
Cc: Roman Bolshakov <[email protected]>
--- include/sysemu/arch_init.h | 2 -- softmmu/arch_init.c | 9 --------- softmmu/vl.c | 6 +++--- 3 files changed, 3 insertions(+), 14 deletions(-)
include/sysemu/arch_init.h +0 -2
@@ -32,6 +32,4 @@ enum {extern const uint32_t arch_type; -int xen_available (void ); -#endif
softmmu/arch_init.c +0 -9
@@ -49,12 +49,3 @@ int graphic_depth = 32;const uint32_t arch_type =QEMU_ARCH ; - -int xen_available (void ) -{ -#ifdef CONFIG_XEN -return 1 ; -#else -return 0 ; -#endif -}
softmmu/vl.c +3 -3
@@ -3667,21 +3667,21 @@ void qemu_init(int argc, char **argv, char **envp) has_defaults =0 ;break ;case QEMU_OPTION_xen_domid: -if (!(xen_available ())) { +if (!(accel_available ("xen" ))) {error_report ("Option not supported for this target" );exit (1 ); } xen_domid =atoi (optarg);break ;case QEMU_OPTION_xen_attach: -if (!(xen_available ())) { +if (!(accel_available ("xen" ))) {error_report ("Option not supported for this target" );exit (1 ); } xen_mode =XEN_ATTACH ;break ;case QEMU_OPTION_xen_domid_restrict: -if (!(xen_available ())) { +if (!(accel_available ("xen" ))) {error_report ("Option not supported for this target" );exit (1 ); }
Signature · 1 line
2.28.0
Re: [PATCH v2 4/6] xen: Delete xen_available() function
Quoted 13 lines · On Wed, 25 Nov 2020 15:56:34 -0500 Eduardo Habkost <[email protected]> wrote:
The function can be replaced with
accel_available("xen").Signed-off-by Eduardo Habkost <[email protected]>---
Cc: Paolo Bonzini <[email protected]>
Cc: [email protected]
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Cc: Paul Durrant <[email protected]>
Cc: [email protected]
Cc: Richard Henderson <[email protected]>
Cc: Claudio Fontana <[email protected]>
Cc: Roman Bolshakov <[email protected]>
Quoted 5 lines
--- include/sysemu/arch_init.h | 2 -- softmmu/arch_init.c | 9 --------- softmmu/vl.c | 6 +++--- 3 files changed, 3 insertions(+), 14 deletions(-)
Re: [PATCH v2 4/6] xen: Delete xen_available() function
In reply to Eduardo HabkostQuoted 3 lines · Eduardo Habkost
The function can be replaced with
accel_available("xen").Signed-off-by Eduardo Habkost <[email protected]>
Thanks,
Signature · 1 line
Anthony PERARD
PATCH v2 5/6 Remove unnecessary usage of arch_init.h
In reply to Eduardo HabkostThe only declarations in arch_init.h are the arch_type variable and the QEMU_ARCH_* constants. Stop including arch_init.h from code that don't use neither.
Patch generated automatically using the command:
$ sed -i -e '/#include "sysemu.arch_init.h"/d' \
$(comm -23 \
<(git grep -l arch_init.h | sort) \
<((git grep -l -w 'arch_type'; g grep -l QEMU_ARCH;) | sort -u))---
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: "Hervé Poussineau" <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: David Gibson <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- accel/accel.c | 1 - hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 1 - hw/i386/pc_q35.c | 1 - hw/mips/jazz.c | 1 - hw/mips/malta.c | 1 - hw/ppc/prep.c | 1 - hw/riscv/sifive_e.c | 1 - hw/riscv/sifive_u.c | 1 - hw/riscv/spike.c | 1 - hw/riscv/virt.c | 1 - monitor/qmp-cmds.c | 1 - target/i386/cpu.c | 1 - target/s390x/cpu.c | 1 - target/s390x/cpu_models.c | 1 - target/ppc/translate_init.c.inc | 1 - 16 files changed, 16 deletions(-)
accel/accel.c +0 -1
@@ -26,7 +26,6 @@#include "qemu/osdep.h" #include "sysemu/accel.h" #include "hw/boards.h" -#include "sysemu/arch_init.h" #include "sysemu/sysemu.h" #include "qom/object.h"
hw/i386/pc.c +0 -1
@@ -67,7 +67,6 @@#include "ui/qemu-spice.h" #include "exec/memory.h" #include "exec/address-spaces.h" -#include "sysemu/arch_init.h" #include "qemu/bitmap.h" #include "qemu/config-file.h" #include "qemu/error-report.h"
hw/i386/pc_piix.c +0 -1
@@ -44,7 +44,6 @@#include "hw/kvm/clock.h" #include "sysemu/sysemu.h" #include "hw/sysbus.h" -#include "sysemu/arch_init.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/xen/xen-x86.h" #include "exec/memory.h"
hw/i386/pc_q35.c +0 -1
@@ -31,7 +31,6 @@#include "qemu/osdep.h" #include "qemu/units.h" #include "hw/loader.h" -#include "sysemu/arch_init.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/rtc/mc146818rtc.h" #include "sysemu/kvm.h"
hw/mips/jazz.c +0 -1
@@ -34,7 +34,6 @@#include "hw/isa/isa.h" #include "hw/block/fdc.h" #include "sysemu/sysemu.h" -#include "sysemu/arch_init.h" #include "hw/boards.h" #include "net/net.h" #include "hw/scsi/esp.h"
hw/mips/malta.c +0 -1
@@ -38,7 +38,6 @@#include "hw/mips/cpudevs.h" #include "hw/pci/pci.h" #include "sysemu/sysemu.h" -#include "sysemu/arch_init.h" #include "qemu/log.h" #include "hw/mips/bios.h" #include "hw/ide.h"
hw/ppc/prep.c +0 -1
@@ -43,7 +43,6 @@#include "hw/rtc/mc146818rtc.h" #include "hw/isa/pc87312.h" #include "hw/qdev-properties.h" -#include "sysemu/arch_init.h" #include "sysemu/kvm.h" #include "sysemu/qtest.h" #include "sysemu/reset.h"
hw/riscv/sifive_e.c +0 -1
@@ -46,7 +46,6 @@#include "hw/intc/sifive_plic.h" #include "hw/misc/sifive_e_prci.h" #include "chardev/char.h" -#include "sysemu/arch_init.h" #include "sysemu/sysemu.h" #include "exec/address-spaces.h"
hw/riscv/sifive_u.c +0 -1
@@ -53,7 +53,6 @@#include "hw/intc/sifive_plic.h" #include "chardev/char.h" #include "net/eth.h" -#include "sysemu/arch_init.h" #include "sysemu/device_tree.h" #include "sysemu/runstate.h" #include "sysemu/sysemu.h"
hw/riscv/spike.c +0 -1
@@ -38,7 +38,6 @@#include "hw/char/riscv_htif.h" #include "hw/intc/sifive_clint.h" #include "chardev/char.h" -#include "sysemu/arch_init.h" #include "sysemu/device_tree.h" #include "sysemu/qtest.h" #include "sysemu/sysemu.h"
hw/riscv/virt.c +0 -1
@@ -37,7 +37,6 @@#include "hw/intc/sifive_plic.h" #include "hw/misc/sifive_test.h" #include "chardev/char.h" -#include "sysemu/arch_init.h" #include "sysemu/device_tree.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h"
monitor/qmp-cmds.c +0 -1
@@ -26,7 +26,6 @@#include "ui/vnc.h" #include "sysemu/kvm.h" #include "sysemu/runstate.h" -#include "sysemu/arch_init.h" #include "sysemu/blockdev.h" #include "sysemu/block-backend.h" #include "qapi/error.h"
target/i386/cpu.c +0 -1
@@ -44,7 +44,6 @@#include "qapi/qmp/qerror.h" #include "qapi/visitor.h" #include "qom/qom-qobject.h" -#include "sysemu/arch_init.h" #include "qapi/qapi-commands-machine-target.h" #include "standard-headers/asm-x86/kvm_para.h"
target/s390x/cpu.c +0 -1
@@ -39,7 +39,6 @@#ifndef CONFIG_USER_ONLY #include "hw/s390x/pv.h" #include "hw/boards.h" -#include "sysemu/arch_init.h" #include "sysemu/sysemu.h" #include "sysemu/tcg.h" #endif
target/s390x/cpu_models.c +0 -1
@@ -25,7 +25,6 @@#include "qapi/qobject-input-visitor.h" #include "qapi/qmp/qdict.h" #ifndef CONFIG_USER_ONLY -#include "sysemu/arch_init.h" #include "hw/pci/pci.h" #endif #include "qapi/qapi-commands-machine-target.h"
target/ppc/translate_init.c.inc +0 -1
@@ -21,7 +21,6 @@ #include "disas/dis-asm.h" #include "exec/gdbstub.h" #include "kvm_ppc.h" -#include "sysemu/arch_init.h" #include "sysemu/cpus.h" #include "sysemu/hw_accel.h" #include "sysemu/tcg.h"
Signature · 1 line
2.28.0
Re: [PATCH v2 5/6] Remove unnecessary usage of arch_init.h
Quoted 48 lines · On Wed, 25 Nov 2020 15:56:35 -0500 Eduardo Habkost <[email protected]> wrote:
The only declarations in
arch_init.hare thearch_typevariable and the QEMU_ARCH_* constants. Stop includingarch_init.hfrom code that don't use neither.Patch generated automatically using the command:
$ sed -i -e '/#include "sysemu.arch_init.h"/d' \ $(comm -23 \ <(git grep -l arch_init.h | sort) \ <((git grep -l -w 'arch_type'; g grep -l QEMU_ARCH;) | sort -u))Signed-off-by Eduardo Habkost <[email protected]>---
Cc: Richard Henderson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: "Hervé Poussineau" <[email protected]>
Cc: Aleksandar Rikalo <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: David Gibson <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Sagar Karandikar <[email protected]>
Cc: Bastian Koppelmann <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Halil Pasic <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- accel/accel.c | 1 - hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 1 - hw/i386/pc_q35.c | 1 - hw/mips/jazz.c | 1 - hw/mips/malta.c | 1 - hw/ppc/prep.c | 1 - hw/riscv/sifive_e.c | 1 - hw/riscv/sifive_u.c | 1 -
Quoted 8 lines
hw/riscv/spike.c | 1 - hw/riscv/virt.c | 1 - monitor/qmp-cmds.c | 1 - target/i386/cpu.c | 1 - target/s390x/cpu.c | 1 - target/s390x/cpu_models.c | 1 - target/ppc/translate_init.c.inc | 1 - 16 files changed, 16 deletions(-)
PATCH v2 6/6 Rename arch_init.h to arch_type.h
In reply to Eduardo HabkostThe only declarations in arch_init.h are related to the arch_type variable (which is a useful feature that allows us to simplify command line option handling). Rename the header to reflect its purpose.
---
Cc: Markus Armbruster <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: "Daniel P. Berrangé" <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
include/sysemu/{arch_init.h => arch_type.h} | 0
blockdev.c | 2 +-
softmmu/arch_init.c | 2 +-
softmmu/qdev-monitor.c | 2 +-
softmmu/vl.c | 2 +-
stubs/arch_type.c | 2 +-
6 files changed, 5 insertions(+), 5 deletions(-)
rename include/sysemu/{arch_init.h => arch_type.h} (100%)include/sysemu/arch_type.h renamed from include/sysemu/arch_init.h +0 -0
blockdev.c +1 -1
@@ -56,7 +56,7 @@#include "sysemu/iothread.h" #include "block/block_int.h" #include "block/trace.h" -#include "sysemu/arch_init.h" +#include "sysemu/arch_type.h" #include "sysemu/qtest.h" #include "sysemu/runstate.h" #include "sysemu/replay.h"
softmmu/arch_init.c +1 -1
@@ -24,7 +24,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "sysemu/sysemu.h" -#include "sysemu/arch_init.h" +#include "sysemu/arch_type.h" #include "hw/pci/pci.h" #include "hw/audio/soundhw.h" #include "qapi/error.h"
softmmu/qdev-monitor.c +1 -1
@@ -22,7 +22,7 @@#include "monitor/hmp.h" #include "monitor/monitor.h" #include "monitor/qdev.h" -#include "sysemu/arch_init.h" +#include "sysemu/arch_type.h" #include "qapi/error.h" #include "qapi/qapi-commands-qdev.h" #include "qapi/qmp/qdict.h"
softmmu/vl.c +1 -1
@@ -95,7 +95,7 @@#include "trace/control.h" #include "qemu/plugin.h" #include "qemu/queue.h" -#include "sysemu/arch_init.h" +#include "sysemu/arch_type.h" #include "ui/qemu-spice.h" #include "qapi/string-input-visitor.h"
stubs/arch_type.c +1 -1
@@ -1,4 +1,4 @@#include "qemu/osdep.h" -#include "sysemu/arch_init.h" +#include "sysemu/arch_type.h" const uint32_t arch_type =QEMU_ARCH_NONE ;
Signature · 1 line
2.28.0
Re: [PATCH v2 6/6] Rename arch_init.h to arch_type.h
Quoted 15 lines · On Wed, 25 Nov 2020 15:56:36 -0500 Eduardo Habkost <[email protected]> wrote:
The only declarations in
arch_init.hare related to thearch_typevariable (which is a useful feature that allows us to simplify command line option handling). Rename the header to reflect its purpose.Signed-off-by Eduardo Habkost <[email protected]>---
Cc: Markus Armbruster <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: "Daniel P. Berrangé" <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: [email protected]
Cc: [email protected]
Quoted 9 lines
---
include/sysemu/{arch_init.h => arch_type.h} | 0
blockdev.c | 2 +-
softmmu/arch_init.c | 2 +-
softmmu/qdev-monitor.c | 2 +-
softmmu/vl.c | 2 +-
stubs/arch_type.c | 2 +-
6 files changed, 5 insertions(+), 5 deletions(-)
rename include/sysemu/{arch_init.h => arch_type.h} (100%)Quoted 4 lines · Eduardo Habkost
This series gets rid of most of the code in
arch_init.c. It moves theQEMU_ARCHmacro definitions to correspondingcpu.hfiles, and gets rid ofkvm_available()andxen_available().
For the series:
Thanks,
Roman