qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC v2 26/34] core: Introduce multi-arch build


From: Peter Crosthwaite
Subject: [Qemu-devel] [RFC v2 26/34] core: Introduce multi-arch build
Date: Sat, 30 May 2015 23:11:59 -0700

Create the multi-softmmu build target. The multi-arch build will be
a combination of all softmmu targets that are:

1: also configured for build (as --target-list items)
2: support multi-arch

target-multi will define TARGET_FOO for each supported target. This is
to allow access to these defs from common code as needed (even though
the multiple #ifs are mutually exclusive).

Multi-arch must provide a cpu.h header. This cpu.h has no cpu-defs.h
inclusion (core code no longer requires it). It will define
target_[u]long as that is needed by core code. It is 64b. ENV_GET_CPU
is not defined (woot!).

the arch-obj.o builds for all the component architectures are linked
in all-obj-y. These are built as a dependency using a sub-make of the
relevant peer foo-softmmu target subdir.

There are no arch-obj-y objects for the multi-arch build itself.

Signed-off-by: Peter Crosthwaite <address@hidden>
---
The default-config needs work. I don't like listing out all the
supported archs like this so configure and Makefile should be able
to autogenerate or combine existing ones as needed.
---
 Makefile.target                   | 15 +++++++++++++--
 arch_init.c                       |  4 +++-
 configure                         | 21 +++++++++++++++++++--
 default-configs/multi-softmmu.mak |  2 ++
 include/sysemu/arch_init.h        |  1 +
 target-multi/cpu.h                | 16 ++++++++++++++++
 6 files changed, 54 insertions(+), 5 deletions(-)
 create mode 100644 default-configs/multi-softmmu.mak
 create mode 100644 target-multi/cpu.h

diff --git a/Makefile.target b/Makefile.target
index c20ca06..af54602 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -13,6 +13,12 @@ QEMU_CFLAGS += -I../linux-headers
 endif
 QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H
 
+ifeq ($(TARGET_BASE_ARCH), multi)
+ARCH_DIRS=$(MULTI_BASE_TARGETS)
+else
+ARCH_DIRS=$(TARGET_BASE_ARCH)
+endif
+
 QEMU_CFLAGS+=-I$(SRC_PATH)/include
 
 ifdef CONFIG_USER_ONLY
@@ -93,7 +99,7 @@ obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
 obj-y += fpu/softfloat.o
 obj-$(CONFIG_ARCH_SINGLE) += target-$(TARGET_BASE_ARCH)/
 arch-obj-$(CONFIG_ARCH_MULTI) += target-$(TARGET_BASE_ARCH)/
-obj-$(CONFIG_ARCH_MULTI) += target-$(TARGET_BASE_ARCH)/hw/
+obj-y += $(foreach a, $(ARCH_DIRS), target-$(a)/hw/)
 obj-y += disas.o
 obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
@@ -152,7 +158,7 @@ obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o
 ifeq ($(TARGET_NAME), sparc64)
 obj-y += hw/sparc64/
 else
-obj-y += hw/$(TARGET_BASE_ARCH)/
+obj-y += $(foreach a, $(ARCH_DIRS), hw/$(a)/)
 endif
 
 GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
@@ -169,6 +175,10 @@ arch-obj.o: $(arch-obj-y)
        $(call quiet-command,$(LD) $(filter-out %.mak, $^) -r -o $@,"LINK $@")
        $(call quiet-command,$(OBJCOPY) -w -L "*" $@,"OBJCOPY $@")
 
+.PHONY: %/arch-obj.o
+%/arch-obj.o:
+       $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" 
TARGET_DIR="$*/" arch-obj.o,)
+
 all-obj-y := $(obj-y)
 
 target-obj-y :=
@@ -187,6 +197,7 @@ all-obj-y += $(common-obj-y)
 all-obj-y += $(target-obj-y)
 all-obj-$(CONFIG_ARCH_SINGLE) += $(arch-obj-y)
 all-obj-$(CONFIG_ARCH_MULTI) += arch-obj.o
+all-obj-y += $(foreach a, $(MULTI_TARGETS), ../$(a)/arch-obj.o)
 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
 
 $(QEMU_PROG_BUILD): config-devices.mak
diff --git a/arch_init.c b/arch_init.c
index 23d3feb..3d33480 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -74,7 +74,9 @@ int graphic_depth = 32;
 #endif
 
 
-#if defined(TARGET_ALPHA)
+#if defined(TARGET_MULTI)
+#define QEMU_ARCH QEMU_ARCH_MULTI
+#elif defined(TARGET_ALPHA)
 #define QEMU_ARCH QEMU_ARCH_ALPHA
 #elif defined(TARGET_ARM)
 #define QEMU_ARCH QEMU_ARCH_ARM
diff --git a/configure b/configure
index 353d323..31612ab 100755
--- a/configure
+++ b/configure
@@ -5154,6 +5154,16 @@ if test "$linux" = "yes" ; then
     fi
 fi
 
+target_multi_dir="multi-softmmu"
+config_target_multi_mak=$target_multi_dir/config-target.mak
+
+for target in $target_list; do
+target_dir="$target"
+config_target_mak=$target_dir/config-target.mak
+mkdir -p $target_dir
+echo "# Automatically generated by configure - do not modify" > 
$config_target_mak
+done
+
 for target in $target_list; do
 target_dir="$target"
 config_target_mak=$target_dir/config-target.mak
@@ -5193,8 +5203,6 @@ case "$target" in
     ;;
 esac
 
-mkdir -p $target_dir
-echo "# Automatically generated by configure - do not modify" > 
$config_target_mak
 
 bflt="no"
 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
@@ -5251,6 +5259,8 @@ case "$target_name" in
   ;;
   moxie)
   ;;
+  multi)
+  ;;
   or32)
     TARGET_ARCH=openrisc
     TARGET_BASE_ARCH=openrisc
@@ -5323,6 +5333,9 @@ upper() {
 
 target_arch_name="`upper $TARGET_ARCH`"
 echo "TARGET_$target_arch_name=y" >> $config_target_mak
+if [ -e $config_target_multi_mak ]; then
+  echo "TARGET_$target_arch_name=y" >> $config_target_multi_mak
+fi
 echo "TARGET_NAME=$target_name" >> $config_target_mak
 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
 if [ "$TARGET_ABI_DIR" = "" ]; then
@@ -5492,6 +5505,10 @@ fi
 case "$TARGET_BASE_ARCH" in
 microblaze|arm)
   echo "CONFIG_ARCH_MULTI=y" >> $config_target_mak
+  if [ -e $config_target_multi_mak ]; then
+    echo "MULTI_BASE_TARGETS+= $TARGET_BASE_ARCH" >> $config_target_multi_mak
+    echo "MULTI_TARGETS+= $target" >> $config_target_multi_mak
+  fi
 ;;
 *)
   echo "CONFIG_ARCH_SINGLE=y"  >> $config_target_mak
diff --git a/default-configs/multi-softmmu.mak 
b/default-configs/multi-softmmu.mak
new file mode 100644
index 0000000..db7e598
--- /dev/null
+++ b/default-configs/multi-softmmu.mak
@@ -0,0 +1,2 @@
+include aarch64-softmmu.mak
+include microblazeel-softmmu.mak
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index 54b36c1..c539dec 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -23,6 +23,7 @@ enum {
     QEMU_ARCH_UNICORE32 = (1 << 14),
     QEMU_ARCH_MOXIE = (1 << 15),
     QEMU_ARCH_TRICORE = (1 << 16),
+    QEMU_ARCH_MULTI = (1 << 17),
 };
 
 extern const uint32_t arch_type;
diff --git a/target-multi/cpu.h b/target-multi/cpu.h
new file mode 100644
index 0000000..70a1d6b
--- /dev/null
+++ b/target-multi/cpu.h
@@ -0,0 +1,16 @@
+#ifndef MULTI_CPU_H
+#define MULTI_CPU_H
+
+#include "config.h"
+
+#define TARGET_LONG_BITS 64
+#define TARGET_PAGE_BITS 12 /* Thou shalt still use 4k pages only! */
+
+#define CPUArchState void
+
+#include "exec/target-long.h"
+#include "exec/cpu-all.h"
+#include "exec/exec-all.h"
+#include "qom/cpu.h"
+
+#endif
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]