split the tcg code and separate tcg files.
cover split the tcg code and separate tcg files.
In order to disable tcg, the first phase is to split some tcg code and separate those tcg relative files into one directory. The next phase will disable tcg more easily.
In the first phase, there are three serial patchsets to deal with split code and separate the files.
1) split the tcg exec code.
a)split the tcg accelerators from accel.c file. b)create one accel directory, which will include kvm,
tcg and general exec files.
c)move tcg exec files into ./accel/tcg directory.
2) move tcg relative files into ./tcg directory those files include translate-all.c, translate-common.c and etc.
3) move kvm exec and exec.c file.
a)move kvm relative exec files into ./accel/kvm directory. b)move exec.c in ./accel directory.
The below patchset are the first serial patchset, the other two serial patchsets will be sent out soon.
Yang Zhong (4):
accel: split the tcg accelerator from accel.c file move cputlb.c
move cpu-exec.c
move cpu-exec-common.c
Makefile.objs | 2 +- Makefile.target | 6 +-- accel/Makefile.objs | 2 + accel.c => accel/accel.c | 27 ----------- accel/tcg/Makefile.objs | 3 ++ cpu-exec-common.c => accel/tcg/cpu-exec-common.c | 0 cpu-exec.c => accel/tcg/cpu-exec.c | 5 +- cputlb.c => accel/tcg/cputlb.c | 0 accel/tcg/tcg-all.c | 61 ++++++++++++++++++++++++ accel/tcg/trace-events | 7 +++ trace-events | 5 -- 11 files changed, 80 insertions(+), 38 deletions(-) create mode 100644 accel/Makefile.objs rename accel.c => accel/accel.c (87%) create mode 100644 accel/tcg/Makefile.objs rename cpu-exec-common.c => accel/tcg/cpu-exec-common.c (100%) rename cpu-exec.c => accel/tcg/cpu-exec.c (99%) rename cputlb.c => accel/tcg/cputlb.c (100%) create mode 100644 accel/tcg/tcg-all.c create mode 100644 accel/tcg/trace-events
Signature · 1 line
1.9.1
PATCH 1/4 accel: split the tcg accelerator from accel.c file
there are two accelerators in qemu, kvm and tcg. kvm accelerator is defined in kvm-all.c, but tcg accelerator is defined in accel.c file. we split tcg accelerator from accel.c file and create one new accel directory, which will include kvm and tcg accel files.
--- Makefile.objs | 1 - Makefile.target | 1 + accel/Makefile.objs | 2 ++ accel.c => accel/accel.c | 27 --------------------- accel/tcg/Makefile.objs | 1 + accel/tcg/tcg-all.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 28 deletions(-) create mode 100644 accel/Makefile.objs rename accel.c => accel/accel.c (87%) create mode 100644 accel/tcg/Makefile.objs create mode 100644 accel/tcg/tcg-all.c
Makefile.objs +0 -1
@@ -55,7 +55,6 @@ common-obj-$(CONFIG_SPICE) += spice-qemu-char.o common-obj-y += audio/ common-obj-y += hw/ -common-obj-y += accel.o common-obj-y += replay/
Makefile.target +1 -0
@@ -143,6 +143,7 @@ obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o obj-y += qtest.o bootdevice.o obj-y += hw/ obj-$(CONFIG_KVM) += kvm-all.o +obj-y += accel/ obj-y += memory.o cputlb.o obj-y += memory_mapping.o obj-y += dump.o
accel/Makefile.objs new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_SOFTMMU) += accel.o +obj-y += tcg/
accel/accel.c renamed from accel.c +0 -27
@@ -34,15 +34,6 @@#include "hw/xen/xen.h" #include "qom/object.h" -int tcg_tb_size; -static bool tcg_allowed = true; - -static int tcg_init (MachineState *ms) -{ -tcg_exec_init (tcg_tb_size *1024 *1024 ); -return 0 ; -} -static const TypeInfo accel_type = { .name =TYPE_ACCEL , .parent =TYPE_OBJECT ,
@@ -129,27 +120,9 @@ void configure_accelerator(MachineState *ms) } } - -static void tcg_accel_class_init (ObjectClass *oc,void *data) -{ -AccelClass *ac =ACCEL_CLASS (oc); - ac->name ="tcg" ; - ac->init_machine = tcg_init; - ac->allowed = &tcg_allowed; -} - -#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg") - -static const TypeInfo tcg_accel_type = { - .name =TYPE_TCG_ACCEL , - .parent =TYPE_ACCEL , - .class_init = tcg_accel_class_init, -}; -static void register_accel_types (void ) {type_register_static (&accel_type); -type_register_static (&tcg_accel_type); }type_init (register_accel_types);
accel/tcg/Makefile.objs new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_SOFTMMU) += tcg-all.o
accel/tcg/tcg-all.c new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 2/4 move cputlb.c
In reply to Yang Zhongmove cputlb.c to accel/tcg/
--- Makefile.target | 2 +- accel/tcg/Makefile.objs | 1 + cputlb.c => accel/tcg/cputlb.c | 0 3 files changed, 2 insertions(+), 1 deletion(-) rename cputlb.c => accel/tcg/cputlb.c (100%)
Makefile.target +1 -1
@@ -144,7 +144,7 @@ obj-y += qtest.o bootdevice.o obj-y += hw/ obj-$(CONFIG_KVM) += kvm-all.o obj-y += accel/ -obj-y += memory.o cputlb.o +obj-y += memory.o obj-y += memory_mapping.o obj-y += dump.o obj-y += migration/ram.o migration/savevm.o
accel/tcg/Makefile.objs +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_SOFTMMU) += tcg-all.o +obj-$(CONFIG_SOFTMMU) += cputlb.o
accel/tcg/cputlb.c renamed from cputlb.c +0 -0
Signature · 1 line
1.9.1
PATCH 3/4 move cpu-exec.c
In reply to Yang Zhongmove cpu-exec.c to ./accel/tcg/
--- Makefile.objs | 1 + Makefile.target | 4 ++-- accel/tcg/Makefile.objs | 1 + cpu-exec.c => accel/tcg/cpu-exec.c | 5 +++-- accel/tcg/trace-events | 7 +++++++ trace-events | 5 ----- 6 files changed, 14 insertions(+), 9 deletions(-) rename cpu-exec.c => accel/tcg/cpu-exec.c (99%) create mode 100644 accel/tcg/trace-events
Makefile.objs +1 -0
@@ -163,6 +163,7 @@ trace-events-subdirs += target/ppc trace-events-subdirs += qom trace-events-subdirs += linux-user trace-events-subdirs += qapi +trace-events-subdirs += accel/tcg trace-events-files = $(SRC_PATH)/trace-events $(trace-events-subdirs:%=$(SRC_PATH)/%/trace-events)
Makefile.target +2 -2
@@ -88,7 +88,8 @@ all: $(PROGS) stap ######################################################### # cpu emulator library -obj-y = exec.o translate-all.o cpu-exec.o +obj-y = exec.o translate-all.o +obj-y += accel/ obj-y += translate-common.o obj-y += cpu-exec-common.o obj-y += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o
@@ -143,7 +144,6 @@ obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o obj-y += qtest.o bootdevice.o obj-y += hw/ obj-$(CONFIG_KVM) += kvm-all.o -obj-y += accel/ obj-y += memory.o obj-y += memory_mapping.o obj-y += dump.o
accel/tcg/Makefile.objs +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_SOFTMMU) += tcg-all.o obj-$(CONFIG_SOFTMMU) += cputlb.o +obj-y += cpu-exec.o
accel/tcg/cpu-exec.c renamed from cpu-exec.c +3 -2
@@ -18,7 +18,7 @@*/ #include "qemu/osdep.h" #include "cpu.h" -#include "trace-root.h" +#include "trace.h" #include "disas/disas.h" #include "exec/exec-all.h" #include "tcg.h"
@@ -200,8 +200,9 @@ static void cpu_exec_nocache(CPUState *cpu, int max_cycles,/* Should never happen. We only end up here when an existing TB is too long. */ -if (max_cycles >CF_COUNT_MASK ) +if (max_cycles >CF_COUNT_MASK ) { max_cycles =CF_COUNT_MASK ; + }tb_lock (); tb = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, orig_tb->flags,
accel/tcg/trace-events new file +7 -0
@@ -0,0 +1,7 @@ +# Trace events for debugging and performance instrumentation + +# TCG related tracing (mostly disabled by default) +# cpu-exec.c +disable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR +disable exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR +disable exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=%x"
trace-events +0 -5
@@ -73,11 +73,6 @@ kvm_irqchip_add_msi_route(int virq) "Adding MSI route virq=%d" kvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d" # TCG related tracing (mostly disabled by default) -# cpu-exec.c -disable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR -disable exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR -disable exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=%x" - # translate-all.c translate_block(void *tb, uintptr_t pc, uint8_t *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"
Signature · 1 line
1.9.1
PATCH 4/4 move cpu-exec-common.c
In reply to Yang Zhongmove cpu-exec-common.c to accel/tcg
--- Makefile.target | 1 - accel/tcg/Makefile.objs | 2 +- cpu-exec-common.c => accel/tcg/cpu-exec-common.c | 0 3 files changed, 1 insertion(+), 2 deletions(-) rename cpu-exec-common.c => accel/tcg/cpu-exec-common.c (100%)
Makefile.target +0 -1
@@ -91,7 +91,6 @@ all: $(PROGS) stap obj-y = exec.o translate-all.o obj-y += accel/ obj-y += translate-common.o -obj-y += cpu-exec-common.o obj-y += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o obj-$(CONFIG_TCG_INTERPRETER) += tci.o obj-y += tcg/tcg-common.o
accel/tcg/Makefile.objs +1 -1
@@ -1,3 +1,3 @@ obj-$(CONFIG_SOFTMMU) += tcg-all.o obj-$(CONFIG_SOFTMMU) += cputlb.o -obj-y += cpu-exec.o +obj-y += cpu-exec.o cpu-exec-common.o
accel/tcg/cpu-exec-common.c renamed from cpu-exec-common.c +0 -0
Signature · 1 line
1.9.1