Skip to contentSkip to conversation

tcg: split the tcg code and separate tcg files

PATCH Applied Yang Zhong 2 participants 8 messages Jun 2, 2017 – Jun 8, 2017 1 message not in the archive Kbuild

lore
Share & tools
lore

Yang Zhong

author
#0 lore raw

v3 cover tcg: 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 related files into one directory. The next phase will disable tcg more easily and cleanly.

In the first phase, there are four patches to deal with split code and separate files.
1)split the tcg exec code.
a)split the tcg accelerators from accel.c file and re-name
tcg accelerator to tcg-all.c, like kvm-all.c did.
b)create one accel directory, which will include kvm,
tcg and general exec files.
2)move cputlb.c, cpu-exec-common.c and cpu-exec.c related tcg
exec file into accel/tcg/ subdirectory.
3)move tcg related backend files into accel/tcg/ directory
those files include translate-all.(ch), translate-common.c, tci.c and tcg-runtime.c.
4)move kvm and exec.c file.
a)move kvm related accelerator files into accel/kvm/ directory. b)move exec.c in accel/ directory.
c)stubs/ directory was created for kvm and tcg stub files.

after those changes are done, the file tree like below accel

├── accel.c
├── exec.c
├── kvm
│   ├── kvm-all.c
│   ├── Makefile.objs
│   └── trace-events
├── Makefile.objs
├── stubs
│   ├── kvm-stub.c
│   └── Makefile.objs
└── tcg
    ├── cpu-exec.c
    ├── cpu-exec-common.c
    ├── cputlb.c
    ├── Makefile.objs
    ├── tcg-all.c
    ├── tcg-runtime.c
    ├── tci.c
    ├── trace-events
    ├── translate-all.c
    ├── translate-all.h
    └── translate-common.c

3 directories, 19 files

v3: squash patches and move tcg related backend files to accel/tcg/
according to Paolo's comments.
add kvm and tcg exec related patches into one patchset.

Yang Zhong (4):
accel: split the tcg accelerator from accel.c file
tcg: move tcg related files into accel/tcg/ subdirectory
tcg: move tcg backend files into accel/tcg/
accel: move kvm related accelerator files into accel/

 Makefile.objs                                      |  3 +-
 Makefile.target                                    | 10 +---
 accel/Makefile.objs                                |  5 ++
 accel.c => accel/accel.c                           | 27 ----------
 exec.c => accel/exec.c                             |  0
 accel/kvm/Makefile.objs                            |  1 +
 kvm-all.c => accel/kvm/kvm-all.c                   |  2 +-
 accel/kvm/trace-events                             | 13 +++++
 accel/stubs/Makefile.objs                          |  1 +
 kvm-stub.c => accel/stubs/kvm-stub.c               |  0
 accel/tcg/Makefile.objs                            |  4 ++
 cpu-exec-common.c => accel/tcg/cpu-exec-common.c   |  0
 cpu-exec.c => accel/tcg/cpu-exec.c                 |  2 +-
 cputlb.c => accel/tcg/cputlb.c                     |  0
 accel/tcg/tcg-all.c                                | 61 ++++++++++++++++++++++
 tcg-runtime.c => accel/tcg/tcg-runtime.c           |  0
 tci.c => accel/tcg/tci.c                           |  0
 accel/tcg/trace-events                             | 10 ++++
 translate-all.c => accel/tcg/translate-all.c       |  2 +-
 translate-all.h => accel/tcg/translate-all.h       |  0
 translate-common.c => accel/tcg/translate-common.c |  0
 configure                                          |  2 +-
 trace-events                                       | 21 --------
 23 files changed, 103 insertions(+), 61 deletions(-)
 create mode 100644 accel/Makefile.objs
 rename accel.c => accel/accel.c (87%)
 rename exec.c => accel/exec.c (100%)
 create mode 100644 accel/kvm/Makefile.objs
 rename kvm-all.c => accel/kvm/kvm-all.c (99%)
 create mode 100644 accel/kvm/trace-events
 create mode 100644 accel/stubs/Makefile.objs
 rename kvm-stub.c => accel/stubs/kvm-stub.c (100%)
 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
 rename tcg-runtime.c => accel/tcg/tcg-runtime.c (100%)
 rename tci.c => accel/tcg/tci.c (100%)
 create mode 100644 accel/tcg/trace-events
 rename translate-all.c => accel/tcg/translate-all.c (99%)
 rename translate-all.h => accel/tcg/translate-all.h (100%)
 rename translate-common.c => accel/tcg/translate-common.c (100%)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v3 1/4 accel: split the tcg accelerator from accel.c file

there are some types of accelerators in qemu, and all accelerators have their own file except tcg. tcg accelerator is also defined in accel.c file. tcg accelerator file will be splited from accel.c and re-name to tcg-all.c. accel/ directory will be created to include kvm and tcg related 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
index 2100845..5fb6bef 100644
@@ -54,7 +54,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
index ce8dfe4..c3c08ff 100644
@@ -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
new file mode 100644
index 0000000..11ad823
@@ -0,0 +1,2 @@
+obj-$(CONFIG_SOFTMMU) += accel.o
+obj-y += tcg/
accel/accel.c renamed from accel.c +0 -27
similarity index 87%
rename from accel.c
rename to accel/accel.c
index 664bb88..7c079a5 100644
@@ -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
new file mode 100644
index 0000000..6e3211a
@@ -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
author
#2 lore raw

PATCH v3 2/4 tcg: move tcg related files into accel/tcg/ subdirectory

In reply to Yang Zhong

move cputlb.c, cpu-exec-common.c and cpu-exec.c related tcg exec file into accel/tcg/ subdirectory.

---
 Makefile.objs                                    | 1 +
 Makefile.target                                  | 7 +++----
 accel/tcg/Makefile.objs                          | 2 ++
 cpu-exec-common.c => accel/tcg/cpu-exec-common.c | 0
 cpu-exec.c => accel/tcg/cpu-exec.c               | 2 +-
 cputlb.c => accel/tcg/cputlb.c                   | 0
 accel/tcg/trace-events                           | 7 +++++++
 trace-events                                     | 5 -----
 8 files changed, 14 insertions(+), 10 deletions(-)
 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/trace-events
Makefile.objs +1 -0
index 5fb6bef..b703d45 100644
@@ -162,6 +162,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 +3 -4
index c3c08ff..18470dd 100644
@@ -88,9 +88,9 @@ 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
 obj-$(CONFIG_TCG_INTERPRETER) += tci.o
 obj-y += tcg/tcg-common.o
@@ -143,8 +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.o
 obj-y += memory_mapping.o
 obj-y += dump.o
 obj-y += migration/ram.o
accel/tcg/Makefile.objs +2 -0
index 6e3211a..940379b 100644
@@ -1 +1,3 @@
 obj-$(CONFIG_SOFTMMU) += tcg-all.o
+obj-$(CONFIG_SOFTMMU) += cputlb.o
+obj-y += cpu-exec.o cpu-exec-common.o
accel/tcg/cpu-exec-common.c renamed from cpu-exec-common.c +0 -0
similarity index 100%
rename from cpu-exec-common.c
rename to accel/tcg/cpu-exec-common.c
accel/tcg/cpu-exec.c renamed from cpu-exec.c +1 -1
similarity index 99%
rename from cpu-exec.c
rename to accel/tcg/cpu-exec.c
index 63a56d0..689837a 100644
@@ -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"
accel/tcg/cputlb.c renamed from cputlb.c +0 -0
similarity index 100%
rename from cputlb.c
rename to accel/tcg/cputlb.c
accel/tcg/trace-events new file +7 -0
new file mode 100644
index 0000000..f2db388
@@ -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
index 433865f..ffe5e66 100644
@@ -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
author
#3 lore raw

PATCH v3 3/4 tcg: move tcg backend files into accel/tcg/

In reply to Yang Zhong

move tcg-runtime.c, translate-all.(ch) and translate-common.c into accel/tcg/ subdirectory and updated related trace-events file.

---
 Makefile.target                                    | 5 +----
 accel/tcg/Makefile.objs                            | 3 ++-
 tcg-runtime.c => accel/tcg/tcg-runtime.c           | 0
 tci.c => accel/tcg/tci.c                           | 0
 accel/tcg/trace-events                             | 3 +++
 translate-all.c => accel/tcg/translate-all.c       | 2 +-
 translate-all.h => accel/tcg/translate-all.h       | 0
 translate-common.c => accel/tcg/translate-common.c | 0
 configure                                          | 2 +-
 trace-events                                       | 4 ----
 10 files changed, 8 insertions(+), 11 deletions(-)
 rename tcg-runtime.c => accel/tcg/tcg-runtime.c (100%)
 rename tci.c => accel/tcg/tci.c (100%)
 rename translate-all.c => accel/tcg/translate-all.c (99%)
 rename translate-all.h => accel/tcg/translate-all.h (100%)
 rename translate-common.c => accel/tcg/translate-common.c (100%)
Makefile.target +1 -4
index 18470dd..8a270c3 100644
@@ -88,17 +88,14 @@ all: $(PROGS) stap
 
 #########################################################
 # cpu emulator library
-obj-y = exec.o translate-all.o
+obj-y = exec.o
 obj-y += accel/
-obj-y += translate-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
 obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
 obj-y += fpu/softfloat.o
 obj-y += target/$(TARGET_BASE_ARCH)/
 obj-y += disas.o
-obj-y += tcg-runtime.o
 obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
 obj-$(call lnot,$(CONFIG_HAX)) += hax-stub.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
accel/tcg/Makefile.objs +2 -1
index 940379b..a9a68ea 100644
@@ -1,3 +1,4 @@
 obj-$(CONFIG_SOFTMMU) += tcg-all.o
 obj-$(CONFIG_SOFTMMU) += cputlb.o
-obj-y += cpu-exec.o cpu-exec-common.o
+obj-y += cpu-exec.o cpu-exec-common.o tcg-runtime.o translate-all.o translate-common.o
+obj-$(CONFIG_TCG_INTERPRETER) += tci.o
accel/tcg/tcg-runtime.c renamed from tcg-runtime.c +0 -0
similarity index 100%
rename from tcg-runtime.c
rename to accel/tcg/tcg-runtime.c
accel/tcg/tci.c renamed from tci.c +0 -0
similarity index 100%
rename from tci.c
rename to accel/tcg/tci.c
accel/tcg/trace-events +3 -0
index f2db388..2de8359 100644
@@ -5,3 +5,6 @@
 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"
accel/tcg/translate-all.c renamed from translate-all.c +1 -1
similarity index 99%
rename from translate-all.c
rename to accel/tcg/translate-all.c
index b3ee876..7b25a16 100644
@@ -25,7 +25,7 @@
 #include "qemu-common.h"
 #define NO_CPU_IO_DEFS
 #include "cpu.h"
-#include "trace-root.h"
+#include "trace.h"
 #include "disas/disas.h"
 #include "exec/exec-all.h"
 #include "tcg.h"
accel/tcg/translate-all.h renamed from translate-all.h +0 -0
similarity index 100%
rename from translate-all.h
rename to accel/tcg/translate-all.h
accel/tcg/translate-common.c renamed from translate-common.c +0 -0
similarity index 100%
rename from translate-common.c
rename to accel/tcg/translate-common.c
configure +1 -1
index 1a5ee4b..7fcd291 100755
@@ -402,7 +402,7 @@ QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
-QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
+QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/accel/tcg -I\$(SRC_PATH)/include"
 if test "$debug_info" = "yes"; then
     CFLAGS="-g $CFLAGS"
     LDFLAGS="-g $LDFLAGS"
trace-events +0 -4
index ffe5e66..7cf8c76 100644
@@ -72,10 +72,6 @@ kvm_irqchip_commit_routes(void) ""
 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)
-# translate-all.c
-translate_block(void *tb, uintptr_t pc, uint8_t *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"
-
 # memory.c
 memory_region_ops_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
 memory_region_ops_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH v3 4/4 accel: move kvm related accelerator files into accel/

In reply to Yang Zhong

move kvm related accelerator files into accel/ subdirectory, also create one stub subdirectory, which will include accelerator's stub files.

---
 Makefile.objs                        |  1 +
 Makefile.target                      |  3 ---
 accel/Makefile.objs                  |  3 +++
 exec.c => accel/exec.c               |  0
 accel/kvm/Makefile.objs              |  1 +
 kvm-all.c => accel/kvm/kvm-all.c     |  2 +-
 accel/kvm/trace-events               | 13 +++++++++++++
 accel/stubs/Makefile.objs            |  1 +
 kvm-stub.c => accel/stubs/kvm-stub.c |  0
 trace-events                         | 12 ------------
 10 files changed, 20 insertions(+), 16 deletions(-)
 rename exec.c => accel/exec.c (100%)
 create mode 100644 accel/kvm/Makefile.objs
 rename kvm-all.c => accel/kvm/kvm-all.c (99%)
 create mode 100644 accel/kvm/trace-events
 create mode 100644 accel/stubs/Makefile.objs
 rename kvm-stub.c => accel/stubs/kvm-stub.c (100%)
Makefile.objs +1 -0
index b703d45..f8eef79 100644
@@ -163,6 +163,7 @@ trace-events-subdirs += qom
 trace-events-subdirs += linux-user
 trace-events-subdirs += qapi
 trace-events-subdirs += accel/tcg
+trace-events-subdirs += accel/kvm
 
 trace-events-files = $(SRC_PATH)/trace-events $(trace-events-subdirs:%=$(SRC_PATH)/%/trace-events)
 
Makefile.target +0 -3
index 8a270c3..7056961 100644
@@ -88,7 +88,6 @@ all: $(PROGS) stap
 
 #########################################################
 # cpu emulator library
-obj-y = exec.o
 obj-y += accel/
 obj-y += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o
 obj-y += tcg/tcg-common.o
@@ -98,7 +97,6 @@ obj-y += target/$(TARGET_BASE_ARCH)/
 obj-y += disas.o
 obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
 obj-$(call lnot,$(CONFIG_HAX)) += hax-stub.o
-obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
 
 obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/decContext.o
 obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/decNumber.o
@@ -139,7 +137,6 @@ ifdef CONFIG_SOFTMMU
 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 += memory.o
 obj-y += memory_mapping.o
 obj-y += dump.o
accel/Makefile.objs +3 -0
index 11ad823..b6d514f 100644
@@ -1,2 +1,5 @@
 obj-$(CONFIG_SOFTMMU) += accel.o
+obj-y += exec.o
+obj-y += kvm/
 obj-y += tcg/
+obj-y += stubs/
accel/exec.c renamed from exec.c +0 -0
similarity index 100%
rename from exec.c
rename to accel/exec.c
accel/kvm/Makefile.objs new file +1 -0
new file mode 100644
index 0000000..85351e7
@@ -0,0 +1 @@
+obj-$(CONFIG_KVM) += kvm-all.o
accel/kvm/kvm-all.c renamed from kvm-all.c +1 -1
similarity index 99%
rename from kvm-all.c
rename to accel/kvm/kvm-all.c
index 7df27c8..c91667f 100644
@@ -35,7 +35,7 @@
 #include "exec/ram_addr.h"
 #include "exec/address-spaces.h"
 #include "qemu/event_notifier.h"
-#include "trace-root.h"
+#include "trace.h"
 #include "hw/irq.h"
 
 #include "hw/boards.h"
accel/kvm/trace-events new file +13 -0
new file mode 100644
index 0000000..0c11d0d
@@ -0,0 +1,13 @@
+# Trace events for debugging and performance instrumentation
+
+# kvm-all.c
+kvm_ioctl(int type, void *arg) "type 0x%x, arg %p"
+kvm_vm_ioctl(int type, void *arg) "type 0x%x, arg %p"
+kvm_vcpu_ioctl(int cpu_index, int type, void *arg) "cpu_index %d, type 0x%x, arg %p"
+kvm_run_exit(int cpu_index, uint32_t reason) "cpu_index %d, reason %d"
+kvm_device_ioctl(int fd, int type, void *arg) "dev fd %d, type 0x%x, arg %p"
+kvm_failed_reg_get(uint64_t id, const char *msg) "Warning: Unable to retrieve ONEREG %" PRIu64 " from KVM: %s"
+kvm_failed_reg_set(uint64_t id, const char *msg) "Warning: Unable to set ONEREG %" PRIu64 " to KVM: %s"
+kvm_irqchip_commit_routes(void) ""
+kvm_irqchip_add_msi_route(int virq) "Adding MSI route virq=%d"
+kvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d"
accel/stubs/Makefile.objs new file +1 -0
new file mode 100644
index 0000000..bd5794f
@@ -0,0 +1 @@
+obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
accel/stubs/kvm-stub.c renamed from kvm-stub.c +0 -0
similarity index 100%
rename from kvm-stub.c
rename to accel/stubs/kvm-stub.c
trace-events +0 -12
index 7cf8c76..0a39513 100644
@@ -60,18 +60,6 @@ dma_complete(void *dbs, int ret, void *cb) "dbs=%p ret=%d cb=%p"
 dma_blk_cb(void *dbs, int ret) "dbs=%p ret=%d"
 dma_map_wait(void *dbs) "dbs=%p"
 
-# kvm-all.c
-kvm_ioctl(int type, void *arg) "type 0x%x, arg %p"
-kvm_vm_ioctl(int type, void *arg) "type 0x%x, arg %p"
-kvm_vcpu_ioctl(int cpu_index, int type, void *arg) "cpu_index %d, type 0x%x, arg %p"
-kvm_run_exit(int cpu_index, uint32_t reason) "cpu_index %d, reason %d"
-kvm_device_ioctl(int fd, int type, void *arg) "dev fd %d, type 0x%x, arg %p"
-kvm_failed_reg_get(uint64_t id, const char *msg) "Warning: Unable to retrieve ONEREG %" PRIu64 " from KVM: %s"
-kvm_failed_reg_set(uint64_t id, const char *msg) "Warning: Unable to set ONEREG %" PRIu64 " to KVM: %s"
-kvm_irqchip_commit_routes(void) ""
-kvm_irqchip_add_msi_route(int virq) "Adding MSI route virq=%d"
-kvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d"
-
 # memory.c
 memory_region_ops_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
 memory_region_ops_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
Signature · 1 line
1.9.1
#5 lore raw
In reply to Yang Zhong
Quoted 94 lines · Yang Zhong

In order to disable tcg, the first phase is to split some tcg code and separate those tcg related files into one directory. The next phase will disable tcg more easily and cleanly.

In the first phase, there are four patches to deal with split code and separate files.
1)split the tcg exec code.
a)split the tcg accelerators from accel.c file and re-name
tcg accelerator to tcg-all.c, like kvm-all.c did.
b)create one accel directory, which will include kvm,
tcg and general exec files.
2)move cputlb.c, cpu-exec-common.c and cpu-exec.c related tcg
exec file into accel/tcg/ subdirectory.
3)move tcg related backend files into accel/tcg/ directory
those files include translate-all.(ch), translate-common.c, tci.c and tcg-runtime.c.
4)move kvm and exec.c file.
a)move kvm related accelerator files into accel/kvm/ directory. b)move exec.c in accel/ directory.
c)stubs/ directory was created for kvm and tcg stub files.

after those changes are done, the file tree like below accel

├── accel.c
├── exec.c
├── kvm
│   ├── kvm-all.c
│   ├── Makefile.objs
│   └── trace-events
├── Makefile.objs
├── stubs
│   ├── kvm-stub.c
│   └── Makefile.objs
└── tcg
    ├── cpu-exec.c
    ├── cpu-exec-common.c
    ├── cputlb.c
    ├── Makefile.objs
    ├── tcg-all.c
    ├── tcg-runtime.c
    ├── tci.c
    ├── trace-events
    ├── translate-all.c
    ├── translate-all.h
    └── translate-common.c

3 directories, 19 files

v3: squash patches and move tcg related backend files to accel/tcg/
according to Paolo's comments.
add kvm and tcg exec related patches into one patchset.

Yang Zhong (4):
accel: split the tcg accelerator from accel.c file
tcg: move tcg related files into accel/tcg/ subdirectory
tcg: move tcg backend files into accel/tcg/
accel: move kvm related accelerator files into accel/

 Makefile.objs                                      |  3 +-
 Makefile.target                                    | 10 +---
 accel/Makefile.objs                                |  5 ++
 accel.c => accel/accel.c                           | 27 ----------
 exec.c => accel/exec.c                             |  0
 accel/kvm/Makefile.objs                            |  1 +
 kvm-all.c => accel/kvm/kvm-all.c                   |  2 +-
 accel/kvm/trace-events                             | 13 +++++
 accel/stubs/Makefile.objs                          |  1 +
 kvm-stub.c => accel/stubs/kvm-stub.c               |  0
 accel/tcg/Makefile.objs                            |  4 ++
 cpu-exec-common.c => accel/tcg/cpu-exec-common.c   |  0
 cpu-exec.c => accel/tcg/cpu-exec.c                 |  2 +-
 cputlb.c => accel/tcg/cputlb.c                     |  0
 accel/tcg/tcg-all.c                                | 61 ++++++++++++++++++++++
 tcg-runtime.c => accel/tcg/tcg-runtime.c           |  0
 tci.c => accel/tcg/tci.c                           |  0
 accel/tcg/trace-events                             | 10 ++++
 translate-all.c => accel/tcg/translate-all.c       |  2 +-
 translate-all.h => accel/tcg/translate-all.h       |  0
 translate-common.c => accel/tcg/translate-common.c |  0
 configure                                          |  2 +-
 trace-events                                       | 21 --------
 23 files changed, 103 insertions(+), 61 deletions(-)
 create mode 100644 accel/Makefile.objs
 rename accel.c => accel/accel.c (87%)
 rename exec.c => accel/exec.c (100%)
 create mode 100644 accel/kvm/Makefile.objs
 rename kvm-all.c => accel/kvm/kvm-all.c (99%)
 create mode 100644 accel/kvm/trace-events
 create mode 100644 accel/stubs/Makefile.objs
 rename kvm-stub.c => accel/stubs/kvm-stub.c (100%)
 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%)
Quoted 9 lines
 rename cputlb.c => accel/tcg/cputlb.c (100%)
 create mode 100644 accel/tcg/tcg-all.c
 rename tcg-runtime.c => accel/tcg/tcg-runtime.c (100%)
 rename tci.c => accel/tcg/tci.c (100%)
 create mode 100644 accel/tcg/trace-events
 rename translate-all.c => accel/tcg/translate-all.c (99%)
 rename translate-all.h => accel/tcg/translate-all.h (100%)
 rename translate-common.c => accel/tcg/translate-common.c (100%)

Queued, thanks (except I'm not sure why you're moving exec.c, so I've undone that, and tcg-runtime.c probably fits better in tcg/).

Paolo

author
#6 lore raw
Quoted 107 lines · Paolo Bonzini
Quoted 94 lines · Yang Zhong

In order to disable tcg, the first phase is to split some tcg code and separate those tcg related files into one directory. The next phase will disable tcg more easily and cleanly.

In the first phase, there are four patches to deal with split code and separate files.
1)split the tcg exec code.
a)split the tcg accelerators from accel.c file and re-name
tcg accelerator to tcg-all.c, like kvm-all.c did.
b)create one accel directory, which will include kvm,
tcg and general exec files.
2)move cputlb.c, cpu-exec-common.c and cpu-exec.c related tcg
exec file into accel/tcg/ subdirectory.
3)move tcg related backend files into accel/tcg/ directory
those files include translate-all.(ch), translate-common.c, tci.c and tcg-runtime.c.
4)move kvm and exec.c file.
a)move kvm related accelerator files into accel/kvm/ directory. b)move exec.c in accel/ directory.
c)stubs/ directory was created for kvm and tcg stub files.

after those changes are done, the file tree like below accel

├── accel.c
├── exec.c
├── kvm
│   ├── kvm-all.c
│   ├── Makefile.objs
│   └── trace-events
├── Makefile.objs
├── stubs
│   ├── kvm-stub.c
│   └── Makefile.objs
└── tcg
    ├── cpu-exec.c
    ├── cpu-exec-common.c
    ├── cputlb.c
    ├── Makefile.objs
    ├── tcg-all.c
    ├── tcg-runtime.c
    ├── tci.c
    ├── trace-events
    ├── translate-all.c
    ├── translate-all.h
    └── translate-common.c

3 directories, 19 files

v3: squash patches and move tcg related backend files to accel/tcg/
according to Paolo's comments.
add kvm and tcg exec related patches into one patchset.

Yang Zhong (4):
accel: split the tcg accelerator from accel.c file
tcg: move tcg related files into accel/tcg/ subdirectory
tcg: move tcg backend files into accel/tcg/
accel: move kvm related accelerator files into accel/

 Makefile.objs                                      |  3 +-
 Makefile.target                                    | 10 +---
 accel/Makefile.objs                                |  5 ++
 accel.c => accel/accel.c                           | 27 ----------
 exec.c => accel/exec.c                             |  0
 accel/kvm/Makefile.objs                            |  1 +
 kvm-all.c => accel/kvm/kvm-all.c                   |  2 +-
 accel/kvm/trace-events                             | 13 +++++
 accel/stubs/Makefile.objs                          |  1 +
 kvm-stub.c => accel/stubs/kvm-stub.c               |  0
 accel/tcg/Makefile.objs                            |  4 ++
 cpu-exec-common.c => accel/tcg/cpu-exec-common.c   |  0
 cpu-exec.c => accel/tcg/cpu-exec.c                 |  2 +-
 cputlb.c => accel/tcg/cputlb.c                     |  0
 accel/tcg/tcg-all.c                                | 61 ++++++++++++++++++++++
 tcg-runtime.c => accel/tcg/tcg-runtime.c           |  0
 tci.c => accel/tcg/tci.c                           |  0
 accel/tcg/trace-events                             | 10 ++++
 translate-all.c => accel/tcg/translate-all.c       |  2 +-
 translate-all.h => accel/tcg/translate-all.h       |  0
 translate-common.c => accel/tcg/translate-common.c |  0
 configure                                          |  2 +-
 trace-events                                       | 21 --------
 23 files changed, 103 insertions(+), 61 deletions(-)
 create mode 100644 accel/Makefile.objs
 rename accel.c => accel/accel.c (87%)
 rename exec.c => accel/exec.c (100%)
 create mode 100644 accel/kvm/Makefile.objs
 rename kvm-all.c => accel/kvm/kvm-all.c (99%)
 create mode 100644 accel/kvm/trace-events
 create mode 100644 accel/stubs/Makefile.objs
 rename kvm-stub.c => accel/stubs/kvm-stub.c (100%)
 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%)
Quoted 9 lines
 rename cputlb.c => accel/tcg/cputlb.c (100%)
 create mode 100644 accel/tcg/tcg-all.c
 rename tcg-runtime.c => accel/tcg/tcg-runtime.c (100%)
 rename tci.c => accel/tcg/tci.c (100%)
 create mode 100644 accel/tcg/trace-events
 rename translate-all.c => accel/tcg/translate-all.c (99%)
 rename translate-all.h => accel/tcg/translate-all.h (100%)
 rename translate-common.c => accel/tcg/translate-common.c (100%)
Quoted 3 lines

Queued, thanks (except I'm not sure why you're moving exec.c, so I've undone that, and tcg-runtime.c probably fits better in tcg/).

Thanks Paolo for your great help!

as for exec.c, i ever thought this file is related with system and moved it to here.

You are right, tcg-runtime.c is BSD Licenced file, which should be moved to tcg/. Whether can i release V4 for those moving? thanks!

Regards,

Yang.

Quoted 1 line

Paolo

A message that is not in the archive (sent off-list or not yet received): 20170608085503.GA21945@yangzhon-Virtual

#8 lore raw
Quoted 7 lines · Zhong Yang
Quoted 4 lines
Quoted 1 line

Queued, thanks (except I'm not sure why you're moving exec.c, so I've undone that, and tcg-runtime.c probably fits better in tcg/).

Thanks Paolo for your great help!

As for exec.c, i ever thought this file is related with system and moved here.

If we do that, there would many more files to move (e.g. ioport.c, memory.c, user-exec.c). I think it's better to leave exec.c in the root for now.

Quoted 2 lines

You are right, since tcg-runtime.c is BSD Licenced, it should be moved to tcg/. Whether can i release V4 to do this moving?

Don't worry, I can do the moving.

Paolo