Skip to contentSkip to conversation

tcg: move the tcg files into tcg/ subdirectory.

PATCH In review Yang Zhong 3 participants 13 messages May 31, 2017 – Jun 1, 2017 Kbuild

lore
Share & tools
lore

Yang Zhong

author
#0 lore raw

v2 cover tcg: move the tcg files into tcg/ subdirectory.

Move the tcg related files into tcg/ subdirectory, which will make the code more clean in qemu. Next step, we will base on those changes to disable tcg.

Yang Zhong (6):
tcg: move tcg-runtime.c to tcg/ subdirectory
tcg: move translate-all.c to tcg/ subdirectory
tcg: move tcg header file
tcg: move translate-common.c to tcg/ subdirectory
tcg: move tci.c to tcg/ subdirectory
tcg: change tcg related file's compile definition

 Makefile.objs                                | 1 +
 Makefile.target                              | 8 ++------
 tcg/Makefile.objs                            | 2 ++
 tcg-runtime.c => tcg/tcg-runtime.c           | 0
 tci.c => tcg/tci.c                           | 0
 tcg/trace-events                             | 6 ++++++
 translate-all.c => tcg/translate-all.c       | 2 +-
 translate-all.h => tcg/translate-all.h       | 0
 translate-common.c => tcg/translate-common.c | 0
 trace-events                                 | 3 ---
 10 files changed, 12 insertions(+), 10 deletions(-)
 create mode 100644 tcg/Makefile.objs
 rename tcg-runtime.c => tcg/tcg-runtime.c (100%)
 rename tci.c => tcg/tci.c (100%)
 create mode 100644 tcg/trace-events
 rename translate-all.c => tcg/translate-all.c (99%)
 rename translate-all.h => tcg/translate-all.h (100%)
 rename translate-common.c => tcg/translate-common.c (100%)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v2 1/6 tcg: move tcg-runtime.c to tcg/ subdirectory

tcg: move tcg-runtime.c to tcg/ subdirectory

---
 Makefile.target                    | 2 +-
 tcg-runtime.c => tcg/tcg-runtime.c | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename tcg-runtime.c => tcg/tcg-runtime.c (100%)
Makefile.target +1 -1
index ce8dfe4..3ba2074 100644
@@ -98,7 +98,7 @@ 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-y += tcg/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
tcg/tcg-runtime.c renamed from tcg-runtime.c +0 -0
similarity index 100%
rename from tcg-runtime.c
rename to tcg/tcg-runtime.c
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v2 2/6 tcg: move translate-all.c to tcg/ subdirectory

In reply to Yang Zhong

tcg: move translate-all.c to tcg/ subdirectory and also update related trace-events file.

---
 Makefile.objs                          | 1 +
 Makefile.target                        | 3 ++-
 tcg/trace-events                       | 6 ++++++
 translate-all.c => tcg/translate-all.c | 2 +-
 trace-events                           | 3 ---
 5 files changed, 10 insertions(+), 5 deletions(-)
 create mode 100644 tcg/trace-events
 rename translate-all.c => tcg/translate-all.c (99%)
Makefile.objs +1 -0
index 2100845..1de6462 100644
@@ -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 += tcg
 
 trace-events-files = $(SRC_PATH)/trace-events $(trace-events-subdirs:%=$(SRC_PATH)/%/trace-events)
 
Makefile.target +2 -1
index 3ba2074..5d33174 100644
@@ -88,7 +88,8 @@ all: $(PROGS) stap
 
 #########################################################
 # cpu emulator library
-obj-y = exec.o translate-all.o cpu-exec.o
+obj-y = exec.o cpu-exec.o
+obj-y += tcg/translate-all.o
 obj-y += translate-common.o
 obj-y += cpu-exec-common.o
 obj-y += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o
tcg/trace-events new file +6 -0
new file mode 100644
index 0000000..989a06e
@@ -0,0 +1,6 @@
+# Trace events for debugging and performance instrumentation
+#
+# 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"
+
tcg/translate-all.c renamed from translate-all.c +1 -1
similarity index 99%
rename from translate-all.c
rename to 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"
trace-events +0 -3
index 433865f..a25db67 100644
@@ -78,9 +78,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"
-
 # 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
#3 lore raw

PATCH v2 3/6 tcg: move tcg header file

In reply to Yang Zhong

tcg: move translate-all.h to tcg/ subdirectory

---
 translate-all.h => tcg/translate-all.h | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename translate-all.h => tcg/translate-all.h (100%)
tcg/translate-all.h renamed from translate-all.h +0 -0
similarity index 100%
rename from translate-all.h
rename to tcg/translate-all.h
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH v2 4/6 tcg: move translate-common.c to tcg/ subdirectory

In reply to Yang Zhong

tcg: move translate-common.c to tcg/ subdirectory

---
 Makefile.target                              | 2 +-
 translate-common.c => tcg/translate-common.c | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename translate-common.c => tcg/translate-common.c (100%)
Makefile.target +1 -1
index 5d33174..648e61e 100644
@@ -90,7 +90,7 @@ all: $(PROGS) stap
 # cpu emulator library
 obj-y = exec.o cpu-exec.o
 obj-y += tcg/translate-all.o
-obj-y += translate-common.o
+obj-y += tcg/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
tcg/translate-common.c renamed from translate-common.c +0 -0
similarity index 100%
rename from translate-common.c
rename to tcg/translate-common.c
Signature · 1 line
1.9.1
author
#5 lore raw

PATCH v2 5/6 tcg: move tci.c to tcg/ subdirectory

In reply to Yang Zhong

tcg: move tci.c to tcg/ subdirectory

---
 Makefile.target    | 2 +-
 tci.c => tcg/tci.c | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename tci.c => tcg/tci.c (100%)
Makefile.target +1 -1
index 648e61e..8561132 100644
@@ -93,7 +93,7 @@ obj-y += tcg/translate-all.o
 obj-y += tcg/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-$(CONFIG_TCG_INTERPRETER) += tcg/tci.o
 obj-y += tcg/tcg-common.o
 obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
 obj-y += fpu/softfloat.o
tcg/tci.c renamed from tci.c +0 -0
similarity index 100%
rename from tci.c
rename to tcg/tci.c
Signature · 1 line
1.9.1
author
#6 lore raw

PATCH v2 6/6 tcg: change tcg related file's compile definition

In reply to Yang Zhong

tcg: move tcg related compile definitions form Makefile.target to tcg/Makefile.objs

---
 Makefile.target   | 7 +------
 tcg/Makefile.objs | 2 ++
 2 files changed, 3 insertions(+), 6 deletions(-)
 create mode 100644 tcg/Makefile.objs
Makefile.target +1 -6
index 8561132..956aeff 100644
@@ -89,17 +89,12 @@ all: $(PROGS) stap
 #########################################################
 # cpu emulator library
 obj-y = exec.o cpu-exec.o
-obj-y += tcg/translate-all.o
-obj-y += tcg/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) += tcg/tci.o
-obj-y += tcg/tcg-common.o
+obj-y += tcg/
 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/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
tcg/Makefile.objs new file +2 -0
new file mode 100644
index 0000000..f4dcc3b
@@ -0,0 +1,2 @@
+obj-y += translate-all.o translate-common.o tcg.o tcg-op.o optimize.o tcg-common.o tcg-runtime.o
+obj-$(CONFIG_TCG_INTERPRETER) += tci.o
Signature · 1 line
1.9.1
#7 lore raw
In reply to Yang Zhong
Quoted 3 lines · Yang Zhong

Move the tcg related files into tcg/ subdirectory, which will make the code more clean in qemu. Next step, we will base on those changes to disable tcg.

You should also move cpu-exec.c, cpu-exec-common.c and cputlb.c.

Also, feel free to squash everything in a single patch. Thanks,

Paolo

Quoted 27 lines

Yang Zhong (6):
tcg: move tcg-runtime.c to tcg/ subdirectory
tcg: move translate-all.c to tcg/ subdirectory
tcg: move tcg header file
tcg: move translate-common.c to tcg/ subdirectory
tcg: move tci.c to tcg/ subdirectory
tcg: change tcg related file's compile definition

 Makefile.objs                                | 1 +
 Makefile.target                              | 8 ++------
 tcg/Makefile.objs                            | 2 ++
 tcg-runtime.c => tcg/tcg-runtime.c           | 0
 tci.c => tcg/tci.c                           | 0
 tcg/trace-events                             | 6 ++++++
 translate-all.c => tcg/translate-all.c       | 2 +-
 translate-all.h => tcg/translate-all.h       | 0
 translate-common.c => tcg/translate-common.c | 0
 trace-events                                 | 3 ---
 10 files changed, 12 insertions(+), 10 deletions(-)
 create mode 100644 tcg/Makefile.objs
 rename tcg-runtime.c => tcg/tcg-runtime.c (100%)
 rename tci.c => tcg/tci.c (100%)
 create mode 100644 tcg/trace-events
 rename translate-all.c => tcg/translate-all.c (99%)
 rename translate-all.h => tcg/translate-all.h (100%)
 rename translate-common.c => tcg/translate-common.c (100%)
#8 lore raw

Hello,

Quoted 8 lines · Paolo Bonzini
Quoted 3 lines · Yang Zhong

Move the tcg related files into tcg/ subdirectory, which will make the code more clean in qemu. Next step, we will base on those changes to disable tcg.

You should also move cpu-exec.c, cpu-exec-common.c and cputlb.c.

The LICENSE file in tcg directory contains this:

---------------------------------------------------------------------
All the files in this directory and subdirectories are released under a BSD like license (see header in each file). No other license is accepted.
---------------------------------------------------------------------

All source files have an explicit BSD license except tcg-runtime.h which has none and aarch64 files which are licensed under GPL. So we are already not following the rule expressed in LICENSE.

tcg-runtime.c is BSD
tci.c is GPL
translate-all.[ch] are GPL
translate-common.c is GPL
cpu-exec.c cpu-exec-common.c cputlb.c are GPL

I guess the LICENSE file has become obsolete and so should be removed (and Fabrice Bellard should perhaps be let know about that just in case).

Thanks,

Laurent

Quoted 33 lines

Also, feel free to squash everything in a single patch. Thanks,

Paolo

Quoted 27 lines

Yang Zhong (6):
tcg: move tcg-runtime.c to tcg/ subdirectory
tcg: move translate-all.c to tcg/ subdirectory
tcg: move tcg header file
tcg: move translate-common.c to tcg/ subdirectory
tcg: move tci.c to tcg/ subdirectory
tcg: change tcg related file's compile definition

 Makefile.objs                                | 1 +
 Makefile.target                              | 8 ++------
 tcg/Makefile.objs                            | 2 ++
 tcg-runtime.c => tcg/tcg-runtime.c           | 0
 tci.c => tcg/tci.c                           | 0
 tcg/trace-events                             | 6 ++++++
 translate-all.c => tcg/translate-all.c       | 2 +-
 translate-all.h => tcg/translate-all.h       | 0
 translate-common.c => tcg/translate-common.c | 0
 trace-events                                 | 3 ---
 10 files changed, 12 insertions(+), 10 deletions(-)
 create mode 100644 tcg/Makefile.objs
 rename tcg-runtime.c => tcg/tcg-runtime.c (100%)
 rename tci.c => tcg/tci.c (100%)
 create mode 100644 tcg/trace-events
 rename translate-all.c => tcg/translate-all.c (99%)
 rename translate-all.h => tcg/translate-all.h (100%)
 rename translate-common.c => tcg/translate-common.c (100%)
#9 lore raw
Quoted 10 lines · Laurent Desnogues

All source files have an explicit BSD license except tcg-runtime.h which has none and aarch64 files which are licensed under GPL. So we are already not following the rule expressed in LICENSE.

tcg-runtime.c is BSD
tci.c is GPL
translate-all.[ch] are GPL
translate-common.c is GPL
cpu-exec.c cpu-exec-common.c cputlb.c are GPL

Quoted 3 lines

I guess the LICENSE file has become obsolete and so should be removed (and Fabrice Bellard should perhaps be let know about that just in case).

We can change it to "The TCG backend files", followed by a list of files. But even then, aarch64 files are GPL...

Paolo

author
#10 lore raw
In reply to Paolo Bonzini
Quoted 9 lines · Paolo Bonzini
Quoted 3 lines · Yang Zhong

Move the tcg related files into tcg/ subdirectory, which will make the code more clean in qemu. Next step, we will base on those changes to disable tcg.

You should also move cpu-exec.c, cpu-exec-common.c and cputlb.c.

In fact, there are other two patchsets for those files. Since this patchset is only for moving TCG backend files into tcg/ subdirectory, i firstly upload this patchset.

Let me explain my plan here,

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 three 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 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.
c)move tcg exec files into ./accel/tcg directory.
2) move tcg related backend files into tcg/ directory those files include translate-all.(ch), translate-common.c, tci.c and tcg-runtime.c.
3) move kvm exec and exec.c file.
a)move kvm related exec files into ./accel/kvm directory. b)move exec.c in ./accel directory.

after 1) and 3) done, the file tree like below:
accel/

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

please help me check whether this kind of arrange is suitable?

Quoted 1 line

Also, feel free to squash everything in a single patch.

for the tcg/ subdirectory, i will make those 6 patchset to one single patch. thanks!

Quoted 31 lines

Thanks,

Paolo

Quoted 27 lines

Yang Zhong (6):
tcg: move tcg-runtime.c to tcg/ subdirectory
tcg: move translate-all.c to tcg/ subdirectory
tcg: move tcg header file
tcg: move translate-common.c to tcg/ subdirectory
tcg: move tci.c to tcg/ subdirectory
tcg: change tcg related file's compile definition

 Makefile.objs                                | 1 +
 Makefile.target                              | 8 ++------
 tcg/Makefile.objs                            | 2 ++
 tcg-runtime.c => tcg/tcg-runtime.c           | 0
 tci.c => tcg/tci.c                           | 0
 tcg/trace-events                             | 6 ++++++
 translate-all.c => tcg/translate-all.c       | 2 +-
 translate-all.h => tcg/translate-all.h       | 0
 translate-common.c => tcg/translate-common.c | 0
 trace-events                                 | 3 ---
 10 files changed, 12 insertions(+), 10 deletions(-)
 create mode 100644 tcg/Makefile.objs
 rename tcg-runtime.c => tcg/tcg-runtime.c (100%)
 rename tci.c => tcg/tci.c (100%)
 create mode 100644 tcg/trace-events
 rename translate-all.c => tcg/translate-all.c (99%)
 rename translate-all.h => tcg/translate-all.h (100%)
 rename translate-common.c => tcg/translate-common.c (100%)
#11 lore raw
Quoted 33 lines · Zhong Yang

In the first phase, there are three 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 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.
c)move tcg exec files into ./accel/tcg directory.
2) move tcg related backend files into tcg/ directory those files include translate-all.(ch), translate-common.c, tci.c and tcg-runtime.c.
3) move kvm exec and exec.c file.
a)move kvm related exec files into ./accel/kvm directory. b)move exec.c in ./accel directory.

after 1) and 3) done, the file tree like below:
accel/

  ├── accel.c
  ├── exec.c
  ├── kvm
  │   ├── kvm-all.c
  │   ├── kvm-stub.c
  │   ├── Makefile.objs
  │   └── trace-events
  ├── Makefile.objs
  └── tcg
      ├── cpu-exec.c
      ├── cpu-exec-common.c
      ├── cputlb.c
      ├── Makefile.objs
      ├── tcg-all.c
      └── trace-events
Quoted 1 line

please help me check whether this kind of arrange is suitable?

Oh, I see now. I think translate-all.[ch] and translate-common.c belong in accel/tcg more than tcg/.

Thanks,

Paolo

author
#12 lore raw
Quoted 36 lines · Paolo Bonzini
Quoted 33 lines · Zhong Yang

In the first phase, there are three 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 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.
c)move tcg exec files into ./accel/tcg directory.
2) move tcg related backend files into tcg/ directory those files include translate-all.(ch), translate-common.c, tci.c and tcg-runtime.c.
3) move kvm exec and exec.c file.
a)move kvm related exec files into ./accel/kvm directory. b)move exec.c in ./accel directory.

after 1) and 3) done, the file tree like below:
accel/

  ├── accel.c
  ├── exec.c
  ├── kvm
  │   ├── kvm-all.c
  │   ├── kvm-stub.c
  │   ├── Makefile.objs
  │   └── trace-events
  ├── Makefile.objs
  └── tcg
      ├── cpu-exec.c
      ├── cpu-exec-common.c
      ├── cputlb.c
      ├── Makefile.objs
      ├── tcg-all.c
      └── trace-events
Quoted 4 lines
Quoted 1 line

please help me check whether this kind of arrange is suitable?

Oh, I see now. I think translate-all.[ch] and translate-common.c belong in accel/tcg more than tcg/.

okay, i will make those changes into one patchset and send v3 to all, thanks!

Yang.

Quoted 4 lines

Thanks,

Paolo