Multi-Arch Phase 1
cover Multi-Arch Phase 1
This is the first set of patches needed to enable Multi-arch system emulation. For full context refer to RFCv3:
[PATCH v3 00/35] Multi Architecture System Emulation
https://lists.gnu.org/archive/html/qemu-devel/2015-07/msg03929.html
This is the first patch-pack intended for merge.
Original cover, as well as overall series state below for further information.
Regards,
Peter
Original Multi-arch arch patch series cover:
***
This is target-multi, a system-mode build that can support multiple cpu-types.
Two architectures are initially converted. Microblaze and ARM. Step by step conversion in done for each. A microblaze is added to Xilinx Zynq platform as a test case. This will be elaborted more in future spins. This use case is valid, as Microblazes can be added (any number of them!) in Zynq FPGA programmable logic configuration.
The general approach (radically different to approach in V1 RFC) is to build and prelink an object (arch-obj.o) per-arch containing:
1: target-foo/*
2: All uses of env internals and CPU_GET_ENV
* cputlb, translate-all, cpu-exec
* TCG backend
This means cputlb and friends are compiled multiple times fo each arch. The symbols for each of these pre-links are then localised to avoid link time name collisions. This is based on Paolo's suggestion to templatify cputlb and friends. Just the net of what to multi-compile is widened to include the TCG stuff as well now.
Despite being some "major surgery" this approach actually solves many of big the problems raised in V1. Big problems sovled:
1: With the multi-compile TCG backends there are now multiple tcg_ctx's for each architecture. This solves the issue PMM raised WRT false positives on TB hashing as archs no longer share translation context.
2: There is no longer a need to reorder the CPU_COMMON within the ENV or the ENV within the CPU. This was flagged as a performance issue by multiple people in V1.
All users of the env internals as well as ENV_GET_CPU are now in multi-compile code and so multi-arch does not need to define a generic ENV nor does in need to def the problematic ENV_GET_CPU.
3: With the prelink symbol localisation, link time namespace collision of helpers from multiple arches is no longer an issue. No need to bloat all the function names with arch specific prefixes.
4: The architecture specifics used/defined by cpu-defs can now vary from arch to arch (incl. target_ulong) greatly reducing coversion effort needed. The list of restrictions for multi-arch capability is much reduced since V1. No target_long issues anymore.
include/exec/*.h and some of the common code needs some refactoring to setup this single vs multi compile split. Mostly code movements.
Some functions (like tcg_enabled) need to be listified for each of the now-multiple TCG engines.
The interface between the multi compile and single compiled files needs to be virtualised using QOM cpu functions. But this is now a very low footprint change as most of the virtualised hooks are now in mutli-compiled code (they only exist as text once). There are more new hooks than before, but the per target change pattern is reduced.
For the implementation of the series, the trickiest part is (still) cpu.h inclusion management. There are now more than one cpu.h's and different parts of the tree need a different include scheme. target-multi defines it's own cpu.h which is bare minimum defs as needed by core code only. target-foo/cpu.h are mostly the same but refactored to avoid collisions with other cpu.h's. Inclusion scheme goes something like
this (for the multi-arch build):
*: Core code includes only target-multi/cpu.h
*: target-foo/ implementation code includes target-foo/cpu.h locally *: System level code (e.g. mach models) can use multiple target-foo/cpu.h's
The hardest unasnwered Q is (still) what to do about bootloading. Currently each arch has it's own architecture specific bootloading which may assume a single architecture. I have applied some hacks to at least get this RFC testable using a -kernel -firmware split but going forward being able to associate an elf/image with a cpu explictitly needs to be solved.
No support for KVM, im not sure if a mix of TCG and KVM is supported even for a single arch? (which would be prerequisite to MA KVM).
***
Current review state of full multi-arch work in progress branch:
cpu-exec: Migrate some generic fns to cpu-exec-common
translate: Listify tcg_exec_init() R:rth
translate-all: Move tcg_handle_interrupt() to -common R:rth
tcg: split tcg_op_defs to -common
tcg: Move tcg_tb_ptr to -common
translate: move real_host_page setting to -common
cpus: Listify cpu_list() function
translate-common: Listify tcg_enabled()
core: Convert tcg_enabled() uses to any/all variants
exec-all: Move cpu_can_do_io() to qom/cpu.h R:rth
cputlb: move CPU_LOOP() for tlb_reset() to exec.c
cputlb: Change tlb_set_dirty() arg to cpuinclude/exec: Move cputlb exec.c defs out R:rth
cpu-common: Define tb_page_addr_t for everyone
monitor: uninclude cpu_ldst
disas: s390x: QOMify target specific disas setup A:rth
disas: moxie: QOMify target specific disas setup
disas: m68k: QOMify target specific disas setup R:laurentv R:gerg
disas: sparc: QOMify target specific disas setup
disas: lm32: QOMify target specific disas setup A:mwalle
disas: sh4: QOMify target specific disas setup A:aurel
disas: mips: QOMify target specific disas setup A:lalrae
disas: alpha: QOMify target specific disas setup A:rthlinux_user: elfload: Default ELF_MACHINE to ELF_ARCH R:rth
linux-user: elfload: Provide default for elf_check_arch R:rthelf_ops: Fix coding style for EM alias case statement R:rth
elf: Update EM_MOXIE definition R:rth
arm: Remove ELF_MACHINE from cpu.h R:rth
mb: Remove ELF_MACHINE from cpu.h R:rth
m68k: Remove ELF_MACHINE from cpu.h R:rth R:gerg R:laurentv
cris: Remove ELF_MACHINE from cpu.h R:rth
moxie: Remove ELF_MACHINE from cpu.h R:rth
unicore: Remove ELF_MACHINE from cpu.h R:rth
lm32: Remove ELF_MACHINE from cpu.h R:rth
or32: Remove ELF_MACHINE from cpu.h R:rth
tricore: Remove ELF_MACHINE from cpu.h R:rth
xtensa: Remove ELF_MACHINE from cpu.h R:rth
sh4: Remove ELF_MACHINE from cpu.h A:aurel R:rth
s390: Remove ELF_MACHINE from cpu.h R:rth
sparc: Remove ELF_MACHINE from cpu.h R:rth
mips: Remove ELF_MACHINE from cpu.h R:aurel R:rth
alpha: Remove ELF_MACHINE from cpu.h R:rth
i386: Rename ELF_MACHINE to be x86 specific R:eduardo A:eduardo R:rth
ppc: Rename ELF_MACHINE to be PPC specific R:rth
arm: cpu: assert() on no-EL2 virt IRQ error condition. R:pmm
arm: Remove hw_error() usages. R:pmm
configure: factor out adding disas configure R:pmm
target-*: Don't redefine cpu_exec() include/exec: Split target_long def to new header
cpu-defs: Allow multiple inclusions
target-*: cpu.h: Undefine core code symbols Makefile.target: Introduce arch-obj
core: virtualise CPU interfaces completely
core: Introduce multi-arch build
arm: cpu: static inline cpu_arm_init()
target-arm: Split cp helper API to new C file
arm: register cpu_list() function
arm: enable multi-arch
hw: arm: Explicitly include cpu.h for consumers
hw: mb: Explicitly include cpu.h for consumers
microblaze: enable multi-arch
arm: boot: Don't assume all CPUs are ARM
arm: xilinx_zynq: Add a Microblaze
HACK: mb: boot: Assume using -firmware for mb software
HACK: mb: boot: Disable dtb load in multi-arch
Peter Crosthwaite (15):
cpu-exec: Migrate some generic fns to cpu-exec-common
translate: Listify tcg_exec_init()
translate-all: Move tcg_handle_interrupt() to -common
tcg: split tcg_op_defs to -common
tcg: Move tcg_tb_ptr to -common
translate: move real_host_page setting to -common
cpus: Listify cpu_list() function
translate-common: Listify tcg_enabled()
core: Convert tcg_enabled() uses to any/all variants
exec-all: Move cpu_can_do_io() to qom/cpu.h
cputlb: move CPU_LOOP() for tlb_reset() to exec.c
cputlb: Change tlb_set_dirty() arg to cpu include/exec: Move cputlb exec.c defs out
cpu-common: Define tb_page_addr_t for everyone
monitor: uninclude cpu_ldst
Makefile.target | 3 ++ cpu-exec-common.c | 108 ++++++++++++++++++++++++++++++++++++++ cpu-exec.c | 49 ----------------- cpus.c | 10 +--- cputlb.c | 30 +++++------ exec.c | 13 ++--- include/exec/cpu-common.h | 4 ++ include/exec/cputlb.h | 16 ------ include/exec/exec-all.h | 20 ++++++- include/exec/ram_addr.h | 5 +- include/qemu-common.h | 6 +++ include/qom/cpu.h | 22 ++++++++ include/sysemu/cpus.h | 7 +++ memory.c | 8 +-- monitor.c | 1 - tcg/tcg-common.c | 35 +++++++++++++ tcg/tcg.c | 8 +-- tcg/tci/tcg-target.c | 2 +- tci.c | 6 --- translate-all.c | 46 ++++------------ translate-common.c | 130 ++++++++++++++++++++++++++++++++++++++++++++++ 21 files changed, 375 insertions(+), 154 deletions(-) create mode 100644 cpu-exec-common.c create mode 100644 tcg/tcg-common.c create mode 100644 translate-common.c
Signature · 1 line
1.9.1
PATCH 1/15 cpu-exec: Migrate some generic fns to cpu-exec-common
The goal is to split the functions such that cpu-exec is CPU specific content, while cpus-exec-common.c is generic code only. The function interface to cpu-exec needs to be virtualised to prepare support for multi-arch and moving these definitions out saves bloating the QOM interface. So move these definitions out of cpu-exec to a new module, cpu-exec-common.
---
Changed since RFCv3
Get rid of CPU_HOOK (paolo review)
Changed since RFCv2
Make a new file instead of move stuff to cpus.c
Makefile.target | 1 + cpu-exec-common.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ cpu-exec.c | 49 ----------------------------------- 3 files changed, 77 insertions(+), 49 deletions(-) create mode 100644 cpu-exec-common.c
Makefile.target +1 -0
@@ -85,6 +85,7 @@ all: $(PROGS) stap ######################################################### # cpu emulator library obj-y = exec.o translate-all.o cpu-exec.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) += disas/tci.o
cpu-exec-common.c new file +76 -0
76 lines not on this page · raw message
cpu-exec.c +0 -49
67 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 2/15 translate: Listify tcg_exec_init()
In reply to Peter CrosthwaiteCreate a global list of tcg_exec_init() functions that is populated at startup. Multiple translation engines can register an init function and all will be called on the master call to tcg_exec_init().
Introduce a new module, translate-common. This is common code for translation functionality such as this.
---
Changed since RFCv2
Move to obj-y (needed by linux-user)
Makefile.target | 1 + include/qemu-common.h | 1 + translate-all.c | 7 ++++++- translate-common.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 translate-common.c
Makefile.target +1 -0
@@ -85,6 +85,7 @@ all: $(PROGS) stap ######################################################### # cpu emulator library obj-y = exec.o translate-all.o cpu-exec.o +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
include/qemu-common.h +1 -0
@@ -309,6 +309,7 @@ typedef struct PCIHostDeviceAddress {unsigned int function; } PCIHostDeviceAddress; +void tcg_exec_init_add (void (*fn)(unsigned long ));void tcg_exec_init (unsigned long tb_size);bool tcg_enabled (void );
translate-all.c +6 -1
@@ -681,7 +681,7 @@ static inline void code_gen_alloc(size_t tb_size)/* Must be called before using the QEMU cpus. 'tb_size' is the size (in bytes) allocated to the translation buffer. Zero means default size. */ -void tcg_exec_init (unsigned long tb_size) +static void do_tcg_exec_init (unsigned long tb_size) {cpu_gen_init ();code_gen_alloc (tb_size);
@@ -695,6 +695,11 @@ void tcg_exec_init(unsigned long tb_size)#endif } +static __attribute__((constructor))void register_tcg_exec_init (void ) +{ +tcg_exec_init_add (do_tcg_exec_init); +} +bool tcg_enabled (void ) {return tcg_ctx.code_gen_buffer !=NULL ;
translate-common.c new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 3/15 translate-all: Move tcg_handle_interrupt() to -common
In reply to Peter CrosthwaiteMove this function to common code. It has no arch specific dependencies. Prepares support for multi-arch where the translate-all interface needs to be virtualised. One less thing to virtualise.
---
translate-all.c | 32 -------------------------------- translate-common.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 32 deletions(-)
translate-all.c +0 -32
@@ -1457,38 +1457,6 @@ void tb_check_watchpoint(CPUState *cpu) }#ifndef CONFIG_USER_ONLY -/* mask must never be zero, except for A20 change call */ -static void tcg_handle_interrupt (CPUState *cpu,int mask) -{ -int old_mask; - - old_mask = cpu->interrupt_request; - cpu->interrupt_request |= mask; - -/* -* If called from iothread context, wake the target cpu in -* case its halted. -*/ -if (!qemu_cpu_is_self (cpu)) { -qemu_cpu_kick (cpu); -return ; - } - -if (use_icount) { - cpu->icount_decr.u16.high =0xffff ; -if (!cpu->can_do_io - && (mask & ~old_mask) !=0 ) { -cpu_abort (cpu,"Raised interrupt while not in I/O function" ); - } - }else { - cpu->tcg_exit_req =1 ; - } -} - -CPUInterruptHandler cpu_interrupt_handler = tcg_handle_interrupt; - -/* in deterministic execution mode, instructions doing device I/Os -must be at the end of the TB */ void cpu_io_recompile (CPUState *cpu,uintptr_t retaddr) {#if defined(TARGET_MIPS ) || defined(TARGET_SH4 )
translate-common.c +34 -0
@@ -1,6 +1,7 @@/* * Host code generation common components * +* Copyright (c) 2003 Fabrice Bellard * Copyright (c) 2015 Peter Crosthwaite <[email protected]> * * This library is free software; you can redistribute it and/or
@@ -18,6 +19,39 @@*/ #include "qemu-common.h" +#include "qom/cpu.h" + +#ifndef CONFIG_USER_ONLY +/* mask must never be zero, except for A20 change call */ +static void tcg_handle_interrupt (CPUState *cpu,int mask) +{ +int old_mask; + + old_mask = cpu->interrupt_request; + cpu->interrupt_request |= mask; + +/* +* If called from iothread context, wake the target cpu in +* case its halted. +*/ +if (!qemu_cpu_is_self (cpu)) { +qemu_cpu_kick (cpu); +return ; + } + +if (use_icount) { + cpu->icount_decr.u16.high =0xffff ; +if (!cpu->can_do_io + && (mask & ~old_mask) !=0 ) { +cpu_abort (cpu,"Raised interrupt while not in I/O function" ); + } + }else { + cpu->tcg_exit_req =1 ; + } +} + +CPUInterruptHandler cpu_interrupt_handler = tcg_handle_interrupt; +#endif typedef struct TCGExecInitFn { void (*do_tcg_exec_init)(unsigned long tb_size);
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH v1 03/15] translate-all: Move tcg_handle_interrupt() to -common
translate-all.c void tb_check_watchpoint(CPUState *cpu) · line 1460
Quoted 5 lines · Peter Crosthwaite
translate-all.c +0
-4-CPUInterruptHandler cpu_interrupt_handler = tcg_handle_interrupt; - -/* in deterministic execution mode, instructions doing device I/Os -must be at the end of the TB */ void cpu_io_recompile (CPUState *cpu,uintptr_t retaddr)
Deleting the block comment for the next function?
r~
PATCH 4/15 tcg: split tcg_op_defs to -common
In reply to Peter Crosthwaitetcg_op_defs (and the _max) are both needed by the TCI disassembler. For multi-arch, tcg.c will be multiple-compiled (arch-obj) with its symbols hidden from common code. So split the definition off to new file, tcg-common.c which will remain a regular obj-y for use by both the TCI disas as well as the multiple tcg.c's.
---
Changed since v3:
Fix 80 char violation on moved code.
Makefile.target | 1 + tcg/tcg-common.c | 33 +++++++++++++++++++++++++++++++++ tcg/tcg.c | 8 +------- tcg/tci/tcg-target.c | 2 +- 4 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 tcg/tcg-common.c
Makefile.target +1 -0
@@ -89,6 +89,7 @@ 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 obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o obj-y += fpu/softfloat.o obj-y += target-$(TARGET_BASE_ARCH)/
tcg/tcg-common.c new file +33 -0
@@ -0,0 +1,33 @@ +/* +* Tiny Code Generator for QEMU +* +* Copyright (c) 2008 Fabrice Bellard +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ + +#include "tcg/tcg.h" + +TCGOpDef tcg_op_defs[] = { +#define DEF(s, oargs, iargs, cargs, flags) \ + { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags }, +#include "tcg-opc.h" +#undef DEF +}; +const size_t tcg_op_defs_max =ARRAY_SIZE (tcg_op_defs);
tcg/tcg.c +1 -7
@@ -113,12 +113,6 @@ static void tcg_out_tb_init(TCGContext *s);static void tcg_out_tb_finalize (TCGContext *s); -TCGOpDef tcg_op_defs[] = { -#define DEF(s, oargs, iargs, cargs, flags) { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags }, -#include "tcg-opc.h" -#undef DEF -}; -const size_t tcg_op_defs_max =ARRAY_SIZE (tcg_op_defs);static TCGRegSet tcg_target_available_regs[2 ];static TCGRegSet tcg_target_call_clobber_regs;
@@ -1240,7 +1234,7 @@ void tcg_add_target_add_op_defs(const TCGTargetOpDef *tdefs)#if defined(CONFIG_DEBUG_TCG ) i =0 ; -for (op =0 ; op <ARRAY_SIZE (tcg_op_defs); op++) { +for (op =0 ; op < tcg_op_defs_max; op++) {const TCGOpDef *def = &tcg_op_defs[op];if (def->flags &TCG_OPF_NOT_PRESENT ) {/* Wrong entry in op definitions? */
tcg/tci/tcg-target.c +1 -1
@@ -850,7 +850,7 @@ static void tcg_target_init(TCGContext *s)#endif /* The current code uses uint8_t for tcg operations. */ -assert (ARRAY_SIZE (tcg_op_defs) <=UINT8_MAX ); +assert (tcg_op_defs_max <=UINT8_MAX );/* Registers available for 32 bit operations. */ tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0,
Signature · 1 line
1.9.1
PATCH 5/15 tcg: Move tcg_tb_ptr to -common
In reply to Peter CrosthwaiteThis requires global visibility to common code. Move to tcg-common.
---
tcg/tcg-common.c | 2 ++ tci.c | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-)
tcg/tcg-common.c +2 -0
@@ -24,6 +24,8 @@#include "tcg/tcg.h" +uintptr_t tci_tb_ptr; +TCGOpDef tcg_op_defs[] = { #define DEF(s, oargs, iargs, cargs, flags) \ { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags },
tci.c +0 -6
@@ -52,12 +52,6 @@ typedef uint64_t (*helper_function)(tcg_target_ulong, tcg_target_ulong, tcg_target_ulong);#endif -/* Targets which don't use GETPC also don't need tci_tb_ptr -which makes them a little faster. */ -#if defined(GETPC ) -uintptr_t tci_tb_ptr; -#endif -static tcg_target_ulong tci_reg[TCG_TARGET_NB_REGS ];static tcg_target_ulong tci_read_reg (TCGReg index)
Signature · 1 line
1.9.1
PATCH 6/15 translate: move real_host_page setting to -common
In reply to Peter CrosthwaiteMove the size and mask globals for the "real" host page size to translate-common. This is to allow system-level code to use REAL_HOST_PAGE_ALIGN and friends in builds which hide translate-all behind arch-obj.
---
translate-all.c | 2 -- translate-common.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-)
translate-all.c +0 -2
@@ -117,8 +117,6 @@ typedef struct PageDesc {#define V_L1_SHIFT (L1_MAP_ADDR_SPACE_BITS - TARGET_PAGE_BITS - V_L1_BITS) -uintptr_t qemu_real_host_page_size; -uintptr_t qemu_real_host_page_mask;uintptr_t qemu_host_page_size;uintptr_t qemu_host_page_mask;
translate-common.c +3 -0
@@ -21,6 +21,9 @@#include "qemu-common.h" #include "qom/cpu.h" +uintptr_t qemu_real_host_page_size; +uintptr_t qemu_real_host_page_mask; +#ifndef CONFIG_USER_ONLY /* mask must never be zero, except for A20 change call */ static void tcg_handle_interrupt (CPUState *cpu,int mask)
Signature · 1 line
1.9.1
PATCH 7/15 cpus: Listify cpu_list() function
In reply to Peter CrosthwaiteMultiple multi-arch targets may wish to implement cpu_list(). When the command is called each should be called one after other. Create a list to allow registrations. When cpu_list() is called the list is iterated calling all implementors.
The original singleton #define'able cpu_list() mechanism remains in place to allow gradual conversion of the target arches to the new way.
cpu_list_add() needs to visible from target-foo/*.c which means it cannot be placed in cpus.c (common-obj). So put it in cpu-exec-common.c. For consistency, move cpu_list() alongside it.
---
cpu-exec-common.c | 32 ++++++++++++++++++++++++++++++++ cpus.c | 8 -------- include/sysemu/cpus.h | 7 +++++++ 3 files changed, 39 insertions(+), 8 deletions(-)
cpu-exec-common.c +32 -0
@@ -74,3 +74,35 @@ typedef struct CPUListFn {void (*do_cpu_list)(FILE *f,fprintf_function cpu_fprintf);QLIST_ENTRY (CPUListFn) list; } CPUListFn; + +static bool cpu_list_list_inited; +static QLIST_HEAD(, CPUListFn) cpu_list_list; + +void cpu_list_add (void (*fn)(FILE *,fprintf_function )) +{ +CPUListFn *lelem =g_malloc0 (sizeof (*lelem)); + +if (!cpu_list_list_inited) { + cpu_list_list_inited = true; +QLIST_INIT (&cpu_list_list); + } + + lelem->do_cpu_list = fn; +QLIST_INSERT_HEAD (&cpu_list_list, lelem, list); +} + +void list_cpus (FILE *f,fprintf_function cpu_fprintf,const char *optarg) +{ +CPUListFn *c; + +/* XXX: implement xxx_cpu_list for targets that still miss it */ +#if defined(cpu_list) +cpu_list (f, cpu_fprintf); +#endif +if (!cpu_list_list_inited) { +return ; + } + QLIST_FOREACH(c, &cpu_list_list, list) { + c->do_cpu_list (f, cpu_fprintf); + } +}
cpus.c +0 -8
@@ -1443,14 +1443,6 @@ static void tcg_exec_all(void) exit_request =0 ; } -void list_cpus (FILE *f,fprintf_function cpu_fprintf,const char *optarg) -{ -/* XXX: implement xxx_cpu_list for targets that still miss it */ -#if defined(cpu_list) -cpu_list (f, cpu_fprintf); -#endif -} -CpuInfoList *qmp_query_cpus (Error **errp) {CpuInfoList *head =NULL , *cur_item =NULL ;
include/sysemu/cpus.h +7 -0
@@ -24,6 +24,13 @@ extern int smp_threads;#define smp_threads 1#endif +void cpu_list_add (void (*fn)(FILE *,fprintf_function cpu_fprintf));void list_cpus (FILE *f,fprintf_function cpu_fprintf,const char *optarg); +#define cpu_list_register (fn) \ +static __attribute__((constructor)) void register_cpu_list ## fn(void) \ +{ \ + cpu_list_add(fn); \ +} +#endif
Signature · 1 line
1.9.1
PATCH 8/15 translate-common: Listify tcg_enabled()
In reply to Peter CrosthwaiteAdd an interface for TCG engines to register their tcg_enabled() function for addition to a global list. Each TCG engine will register and then two functions, tcg_any_enabled() & tcg_all_enabled() can be used to query the overall tcg enablement state.
---
include/qemu-common.h | 5 +++++ translate-all.c | 5 +++++ translate-common.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+)
include/qemu-common.h +5 -0
@@ -311,6 +311,11 @@ typedef struct PCIHostDeviceAddress {void tcg_exec_init_add (void (*fn)(unsigned long ));void tcg_exec_init (unsigned long tb_size); + +void tcg_enabled_add (bool (*fn)(void )); +bool tcg_any_enabled (void ); +bool tcg_all_enabled (void ); +bool tcg_enabled (void );void cpu_exec_init_all (void );
translate-all.c +5 -0
@@ -703,6 +703,11 @@ bool tcg_enabled(void)return tcg_ctx.code_gen_buffer !=NULL ; } +static __attribute__((constructor))void register_tcg_enabled (void ) +{ +tcg_enabled_add (tcg_enabled); +} +/* Allocate a new translation block. Flush the translation buffer if too many translation blocks or too much generated code. */ static TranslationBlock *tb_alloc (target_ulong pc)
translate-common.c +43 -0
46 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 9/15 core: Convert tcg_enabled() uses to any/all variants
In reply to Peter CrosthwaiteConvert core code usages of tcg_enabled() which don't have a specific CPU associated with, to either tcg_any_enabled() or tcg_all_enabled(). This is to prepare support for multiple tcg engines, where queries must query a specific CPU or use global any/all logic.
---
Changed since RFCv3:
Tweak commit subject (too long)
cpus.c | 2 +- exec.c | 4 ++-- include/exec/ram_addr.h | 5 +++-- memory.c | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-)
cpus.c +1 -1
@@ -1165,7 +1165,7 @@ void qemu_mutex_lock_iothread(void)/* In the simple case there is no need to bump the VCPU thread out of * TCG code execution. */ -if (!tcg_enabled () ||qemu_in_vcpu_thread () || +if (!tcg_any_enabled () ||qemu_in_vcpu_thread () || !first_cpu || !first_cpu->thread) {qemu_mutex_lock (&qemu_global_mutex);atomic_dec (&iothread_requesting_mutex);
exec.c +2 -2
@@ -926,7 +926,7 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start, dirty =bitmap_test_and_clear_atomic (ram_list.dirty_memory[client], page, end - page); -if (dirty &&tcg_enabled ()) { +if (dirty &&tcg_any_enabled ()) {tlb_reset_dirty_range_all (start, length); }
@@ -2592,7 +2592,7 @@ void cpu_flush_icache_range(hwaddr start, int len)* so there is no need to flush anything. For KVM / Xen we need to flush * the host's instruction cache at least. */ -if (tcg_enabled ()) { +if (!tcg_all_enabled ()) {return ; }
include/exec/ram_addr.h +3 -2
@@ -164,14 +164,15 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,atomic_or (&d[DIRTY_MEMORY_MIGRATION ][page + k], temp);atomic_or (&d[DIRTY_MEMORY_VGA ][page + k], temp); -if (tcg_enabled ()) { +if (tcg_any_enabled ()) {atomic_or (&d[DIRTY_MEMORY_CODE ][page + k], temp); } } }xen_modified_memory (start, pages <<TARGET_PAGE_BITS ); }else { -uint8_t clients =tcg_enabled () ?DIRTY_CLIENTS_ALL :DIRTY_CLIENTS_NOCODE ; +uint8_t clients =tcg_any_enabled () ?DIRTY_CLIENTS_ALL + :DIRTY_CLIENTS_NOCODE ;/* * bitmap-traveling is faster than memory-traveling (for addr...) * especially when most of the memory is not dirty.
memory.c +4 -4
@@ -1198,7 +1198,7 @@ void memory_region_init_ram(MemoryRegion *mr, mr->terminates = true; mr->destructor = memory_region_destructor_ram; mr->ram_addr =qemu_ram_alloc (size, mr, errp); - mr->dirty_log_mask =tcg_enabled () ? (1 <<DIRTY_MEMORY_CODE ) :0 ; + mr->dirty_log_mask =tcg_any_enabled () ? (1 <<DIRTY_MEMORY_CODE ) :0 ; } void memory_region_init_resizeable_ram(MemoryRegion *mr,
@@ -1216,7 +1216,7 @@ void memory_region_init_resizeable_ram(MemoryRegion *mr, mr->terminates = true; mr->destructor = memory_region_destructor_ram; mr->ram_addr =qemu_ram_alloc_resizeable (size, max_size, resized, mr, errp); - mr->dirty_log_mask =tcg_enabled () ? (1 <<DIRTY_MEMORY_CODE ) :0 ; + mr->dirty_log_mask =tcg_any_enabled () ? (1 <<DIRTY_MEMORY_CODE ) :0 ; }#ifdef __linux__
@@ -1233,7 +1233,7 @@ void memory_region_init_ram_from_file(MemoryRegion *mr, mr->terminates = true; mr->destructor = memory_region_destructor_ram; mr->ram_addr =qemu_ram_alloc_from_file (size, mr, share, path, errp); - mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0; + mr->dirty_log_mask = tcg_any_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0; }#endif
@@ -1247,7 +1247,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr, mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram_from_ptr; - mr->dirty_log_mask =tcg_enabled () ? (1 <<DIRTY_MEMORY_CODE ) :0 ; + mr->dirty_log_mask =tcg_any_enabled () ? (1 <<DIRTY_MEMORY_CODE ) :0 ;/* qemu_ram_alloc_from_ptr cannot fail with ptr != NULL. */ assert (ptr !=NULL );
Signature · 1 line
1.9.1
PATCH 10/15 exec-all: Move cpu_can_do_io() to qom/cpu.h
In reply to Peter CrosthwaiteThis function has no architecture specific dependencies and should be callable from core code. Move it to qom/cpu.h.
---
include/qom/cpu.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
include/qom/cpu.h +21 -0
@@ -696,6 +696,27 @@ void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)GCC_FMT_ATTR (2 ,3 );void cpu_exec_exit (CPUState *cpu); +/** +* cpu_can_do_io: +* @cpu: The CPU for which to check IO. +* +* Deterministic execution requires that IO only be performed on the last +* instruction of a TB so that interrupts take effect immediately. +* +* Returns: %true if memory-mapped IO is safe, %false otherwise. +*/ +static inline bool cpu_can_do_io (CPUState *cpu) +{ +if (!use_icount) { +return true; + } +/* If not executing code then assume we are ok. */ +if (cpu->current_tb ==NULL ) { +return true; + } +return cpu->can_do_io !=0 ; +} +#ifdef CONFIG_SOFTMMU extern const struct VMStateDescription vmstate_cpu_common;#else
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH v1 10/15] exec-all: Move cpu_can_do_io() to qom/cpu.h
Quoted 2 lines · Peter Crosthwaite
This function has no architecture specific dependencies and should be callable from core code.
It also does not exist anymore. :-P
Paolo
PATCH 11/15 cputlb: move CPU_LOOP() for tlb_reset() to exec.c
In reply to Peter CrosthwaiteTo prepare for multi-arch, cputlb.c should only have awareness of one single architecture. This means it should not have access to the full CPU lists which may be heterogeneous. Instead, push the CPU_LOOP() up to the one and only caller in exec.c.
---
Easier reading with git diff -w
Changed since RFCv2:
split off to new patch (previously part of core virtualisation patch)
cputlb.c | 27 ++++++++++++--------------- exec.c | 5 ++++- include/exec/cputlb.h | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-)
cputlb.c +12 -15
@@ -262,27 +262,24 @@ static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr)return ram_addr; } -void cpu_tlb_reset_dirty_all (ram_addr_t start1,ram_addr_t length) +void tlb_reset_dirty (CPUState *cpu,ram_addr_t start1,ram_addr_t length) { -CPUState *cpu;CPUArchState *env; -CPU_FOREACH (cpu) { -int mmu_idx; +int mmu_idx; - env = cpu->env_ptr; -for (mmu_idx =0 ; mmu_idx <NB_MMU_MODES ; mmu_idx++) { -unsigned int i; + env = cpu->env_ptr; +for (mmu_idx =0 ; mmu_idx <NB_MMU_MODES ; mmu_idx++) { +unsigned int i; -for (i =0 ; i <CPU_TLB_SIZE ; i++) { -tlb_reset_dirty_range (&env->tlb_table[mmu_idx][i], - start1, length); - } +for (i =0 ; i <CPU_TLB_SIZE ; i++) { +tlb_reset_dirty_range (&env->tlb_table[mmu_idx][i], + start1, length); + } -for (i =0 ; i <CPU_VTLB_SIZE ; i++) { -tlb_reset_dirty_range (&env->tlb_v_table[mmu_idx][i], - start1, length); - } +for (i =0 ; i <CPU_VTLB_SIZE ; i++) { +tlb_reset_dirty_range (&env->tlb_v_table[mmu_idx][i], + start1, length); } } }
exec.c +4 -1
@@ -894,6 +894,7 @@ found:static void tlb_reset_dirty_range_all (ram_addr_t start,ram_addr_t length) { +CPUState *cpu;ram_addr_t start1;RAMBlock *block;ram_addr_t end;
@@ -905,7 +906,9 @@ static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length) block =qemu_get_ram_block (start);assert (block ==qemu_get_ram_block (end -1 )); start1 = (uintptr_t )ramblock_ptr (block, start - block->offset); -cpu_tlb_reset_dirty_all (start1, length); +CPU_FOREACH (cpu) { +tlb_reset_dirty (cpu, start1, length); + }rcu_read_unlock (); }
include/exec/cputlb.h +1 -1
@@ -25,7 +25,7 @@ void tlb_protect_code(ram_addr_t ram_addr);void tlb_unprotect_code (ram_addr_t ram_addr);void tlb_reset_dirty_range (CPUTLBEntry *tlb_entry,uintptr_t start,uintptr_t length); -void cpu_tlb_reset_dirty_all (ram_addr_t start1,ram_addr_t length); +void tlb_reset_dirty (CPUState *cpu,ram_addr_t start1,ram_addr_t length);void tlb_set_dirty (CPUArchState *env,target_ulong vaddr);extern int tlb_flush_count;
Signature · 1 line
1.9.1
PATCH 12/15 cputlb: Change tlb_set_dirty() arg to cpu
In reply to Peter CrosthwaiteChange tlb_set_dirty() to accept a CPU instead of an env pointer. This allows for removal of another CPUArchState usage from prototypes that need to be QOMified.
---
cputlb.c | 3 ++- exec.c | 3 +-- include/exec/cputlb.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
cputlb.c +2 -1
@@ -293,8 +293,9 @@ static inline void tlb_set_dirty1(CPUTLBEntry *tlb_entry, target_ulong vaddr)/* update the TLB corresponding to virtual page vaddr so that it is no longer dirty */ -void tlb_set_dirty (CPUArchState *env,target_ulong vaddr) +void tlb_set_dirty (CPUState *cpu,target_ulong vaddr) { +CPUArchState *env = cpu->env_ptr;int i;int mmu_idx;
exec.c +1 -2
@@ -1903,8 +1903,7 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,/* we remove the notdirty callback only if the code has been flushed */ if (!cpu_physical_memory_is_clean (ram_addr)) { -CPUArchState *env = current_cpu->env_ptr; -tlb_set_dirty (env, current_cpu->mem_io_vaddr); +tlb_set_dirty (current_cpu, current_cpu->mem_io_vaddr); } }
include/exec/cputlb.h +1 -1
@@ -26,7 +26,7 @@ void tlb_unprotect_code(ram_addr_t ram_addr);void tlb_reset_dirty_range (CPUTLBEntry *tlb_entry,uintptr_t start,uintptr_t length);void tlb_reset_dirty (CPUState *cpu,ram_addr_t start1,ram_addr_t length); -void tlb_set_dirty (CPUArchState *env,target_ulong vaddr); +void tlb_set_dirty (CPUState *cpu,target_ulong vaddr);extern int tlb_flush_count;/* exec.c */
Signature · 1 line
1.9.1
PATCH 13/15 include/exec: Move cputlb exec.c defs out
In reply to Peter CrosthwaiteMove the architecture agnostic function prototypes for exec.c out of cputlb.h to exec-all.h. This allows hiding of the arch specific cputlb.h from exec.c which should be getting close to having no architecture specifics. Prepares support for multi-arch, which will have a minimal cpu.h that services exec.c but not cputlb.h.
---
Possible follow up (Paolo):
Since you are at it, tlb_protect_code/tlb_unprotect_code can also be moved to this new header (and to translate-common.c).
exec.c | 1 - include/exec/cputlb.h | 16 ---------------- include/exec/exec-all.h | 18 ++++++++++++++++++ 3 files changed, 18 insertions(+), 17 deletions(-)
exec.c +0 -1
@@ -49,7 +49,6 @@#include "exec/cpu-all.h" #include "qemu/rcu_queue.h" #include "qemu/main-loop.h" -#include "exec/cputlb.h" #include "translate-all.h" #include "exec/memory-internal.h"
include/exec/cputlb.h +0 -16
@@ -25,23 +25,7 @@ void tlb_protect_code(ram_addr_t ram_addr);void tlb_unprotect_code (ram_addr_t ram_addr);void tlb_reset_dirty_range (CPUTLBEntry *tlb_entry,uintptr_t start,uintptr_t length); -void tlb_reset_dirty (CPUState *cpu,ram_addr_t start1,ram_addr_t length); -void tlb_set_dirty (CPUState *cpu,target_ulong vaddr);extern int tlb_flush_count; -/* exec.c */ -void tb_flush_jmp_cache (CPUState *cpu,target_ulong addr); - -MemoryRegionSection * -address_space_translate_for_iotlb (CPUState *cpu,hwaddr addr,hwaddr *xlat, -hwaddr *plen); -hwaddr memory_region_section_get_iotlb (CPUState *cpu, -MemoryRegionSection *section, -target_ulong vaddr, -hwaddr paddr,hwaddr xlat, -int prot, -target_ulong *address); -bool memory_region_is_unassigned (MemoryRegion *mr); -#endif #endif
include/exec/exec-all.h +18 -0
@@ -381,6 +381,24 @@ static inline tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong#else /* cputlb.c */ tb_page_addr_t get_page_addr_code (CPUArchState *env1,target_ulong addr); + +void tlb_reset_dirty (CPUState *cpu,ram_addr_t start1,ram_addr_t length); +void tlb_set_dirty (CPUState *cpu,target_ulong vaddr); + +/* exec.c */ +void tb_flush_jmp_cache (CPUState *cpu,target_ulong addr); + +MemoryRegionSection * +address_space_translate_for_iotlb (CPUState *cpu,hwaddr addr,hwaddr *xlat, +hwaddr *plen); +hwaddr memory_region_section_get_iotlb (CPUState *cpu, +MemoryRegionSection *section, +target_ulong vaddr, +hwaddr paddr,hwaddr xlat, +int prot, +target_ulong *address); +bool memory_region_is_unassigned (MemoryRegion *mr); +#endif /* vl.c */
Signature · 1 line
1.9.1
PATCH 14/15 cpu-common: Define tb_page_addr_t for everyone
In reply to Peter CrosthwaiteIn system mode emulation (at least) this definition has no architecture specific dependencies. Move it to common code such that common code can use it (primarily for defining function prototypes).
---
So this is the same as in RFCv2 and the comment there was that it will not work for linux-user mode WRT to qom/cpu.h fn prototypes needed this def. But the solution there is instead to conditionalise the def of those hooks on NEED_CPU_H. Then this patch is just needed for some misc. system-mode-only core code usages.
include/exec/cpu-common.h | 4 ++++ include/exec/exec-all.h | 2 -- include/qom/cpu.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-)
include/exec/cpu-common.h +4 -0
@@ -53,6 +53,10 @@ typedef uintptr_t ram_addr_t;# define RAM_ADDR_FMT "%" PRIxPTR#endif +#ifndef CONFIG_USER_ONLY +typedef ram_addr_t tb_page_addr_t ; +#endif +extern ram_addr_t ram_size;ram_addr_t get_current_ram_size (void );
include/exec/exec-all.h +0 -2
@@ -30,8 +30,6 @@type. */ #if defined(CONFIG_USER_ONLY )typedef abi_ulong tb_page_addr_t ; -#else -typedef ram_addr_t tb_page_addr_t ;#endif /* is_jmp field values */
include/qom/cpu.h +1 -0
@@ -24,6 +24,7 @@#include <setjmp.h> #include "hw/qdev-core.h" #include "disas/bfd.h" +#include "exec/cpu-common.h" #include "exec/hwaddr.h" #include "exec/memattrs.h" #include "qemu/queue.h"
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH v1 14/15] cpu-common: Define tb_page_addr_t for everyone
Quoted 5 lines · Peter Crosthwaite
So this is the same as in RFCv2 and the comment there was that it will not work for linux-user mode WRT to
qom/cpu.hfn prototypes needed this def. But the solution there is instead to conditionalise the def of those hooks onNEED_CPU_H. Then this patch is just needed for some misc. system-mode-only core code usages.
Sounds good, please squash that in this patch.
Paolo
PATCH 15/15 monitor: uninclude cpu_ldst
In reply to Peter CrosthwaiteThis header is non-needed anymore and wont work in multi-arch where this service is not provided to core code.
---
monitor.c | 1 - 1 file changed, 1 deletion(-)
monitor.c +0 -1
@@ -67,7 +67,6 @@#include "trace/simple.h" #endif #include "exec/memory.h" -#include "exec/cpu_ldst.h" #include "qmp-commands.h" #include "hmp.h" #include "qemu/thread.h"
Signature · 1 line
1.9.1
Quoted 10 lines · Peter Crosthwaite
This is the first set of patches needed to enable Multi-arch system emulation. For full context refer to RFCv3:
[PATCH v3 00/35] Multi Architecture System Emulation
https://lists.gnu.org/archive/html/qemu-devel/2015-07/msg03929.htmlThis is the first patch-pack intended for merge.
Original cover, as well as overall series state below for further information.
I think we can already merge patches 1, 3, 4, 5, 6, 11, 12, 13, 15 (plus, patch 10 is gone). The others do not make much sense without multiarch support.
I suppose the next part of the surgery could be
target-*: Don't redefine cpu_exec()
target-*: cpu.h: Undefine core code symbols
arm: cpu: static inline cpu_arm_init()
target-arm: Split cp helper API to new C file
hw: arm: Explicitly include cpu.h for consumers
hw: mb: Explicitly include cpu.h for consumers
Paolo
Quoted 202 lines
Regards,
PeterOriginal Multi-arch arch patch series cover:
***
This is target-multi, a system-mode build that can support multiple cpu-types.
Two architectures are initially converted. Microblaze and ARM. Step by step conversion in done for each. A microblaze is added to Xilinx Zynq platform as a test case. This will be elaborted more in future spins. This use case is valid, as Microblazes can be added (any number of them!) in Zynq FPGA programmable logic configuration.
The general approach (radically different to approach in V1 RFC) is to build and prelink an object (arch-obj.o) per-arch containing:
1: target-foo/*
2: All uses of env internals andCPU_GET_ENV
* cputlb, translate-all, cpu-exec
* TCG backendThis means cputlb and friends are compiled multiple times fo each arch. The symbols for each of these pre-links are then localised to avoid link time name collisions. This is based on Paolo's suggestion to templatify cputlb and friends. Just the net of what to multi-compile is widened to include the TCG stuff as well now.
Despite being some "major surgery" this approach actually solves many of big the problems raised in V1. Big problems sovled:
1: With the multi-compile TCG backends there are now multiple tcg_ctx's for each architecture. This solves the issue PMM raised WRT false positives on TB hashing as archs no longer share translation context.
2: There is no longer a need to reorder the
CPU_COMMONwithin the ENV or the ENV within the CPU. This was flagged as a performance issue by multiple people in V1.
All users of the env internals as well asENV_GET_CPUare now in multi-compile code and so multi-arch does not need to define a generic ENV nor does in need to def the problematicENV_GET_CPU.3: With the prelink symbol localisation, link time namespace collision of helpers from multiple arches is no longer an issue. No need to bloat all the function names with arch specific prefixes.
4: The architecture specifics used/defined by cpu-defs can now vary from arch to arch (incl.
target_ulong) greatly reducing coversion effort needed. The list of restrictions for multi-arch capability is much reduced since V1. Notarget_longissues anymore.
include/exec/*.hand some of the common code needs some refactoring to setup this single vs multi compile split. Mostly code movements.Some functions (like
tcg_enabled) need to be listified for each of the now-multiple TCG engines.The interface between the multi compile and single compiled files needs to be virtualised using QOM cpu functions. But this is now a very low footprint change as most of the virtualised hooks are now in mutli-compiled code (they only exist as text once). There are more new hooks than before, but the per target change pattern is reduced.
For the implementation of the series, the trickiest part is (still)
cpu.hinclusion management. There are now more than one cpu.h's and different parts of the tree need a different include scheme. target-multi defines it's owncpu.hwhich is bare minimum defs as needed by core code only.target-foo/cpu.hare mostly the same but refactored to avoid collisions with other cpu.h's. Inclusion scheme goes something like
this (for the multi-arch build):*: Core code includes only
target-multi/cpu.h
*: target-foo/ implementation code includestarget-foo/cpu.hlocally *: System level code (e.g. mach models) can use multiple target-foo/cpu.h'sThe hardest unasnwered Q is (still) what to do about bootloading. Currently each arch has it's own architecture specific bootloading which may assume a single architecture. I have applied some hacks to at least get this RFC testable using a -kernel -firmware split but going forward being able to associate an elf/image with a cpu explictitly needs to be solved.
No support for KVM, im not sure if a mix of TCG and KVM is supported even for a single arch? (which would be prerequisite to MA KVM).
***
Current review state of full multi-arch work in progress branch:
cpu-exec: Migrate some generic fns to cpu-exec-common
translate: Listifytcg_exec_init()R:rth
translate-all: Movetcg_handle_interrupt()to -common R:rth
tcg: splittcg_op_defsto -common
tcg: Movetcg_tb_ptrto -common
translate: movereal_host_pagesetting to -common
cpus: Listifycpu_list()function
translate-common: Listifytcg_enabled()
core: Converttcg_enabled()uses to any/all variants
exec-all: Movecpu_can_do_io()toqom/cpu.hR:rth
cputlb: moveCPU_LOOP()fortlb_reset()toexec.c
cputlb: Changetlb_set_dirty()arg to cpuinclude/exec: Move cputlbexec.cdefs out R:rth
cpu-common: Definetb_page_addr_tfor everyone
monitor: unincludecpu_ldst
disas: s390x: QOMify target specific disas setup A:rth
disas: moxie: QOMify target specific disas setup
disas: m68k: QOMify target specific disas setup R:laurentv R:gerg
disas: sparc: QOMify target specific disas setup
disas: lm32: QOMify target specific disas setup A:mwalle
disas: sh4: QOMify target specific disas setup A:aurel
disas: mips: QOMify target specific disas setup A:lalrae
disas: alpha: QOMify target specific disas setup A:rthlinux_user: elfload: DefaultELF_MACHINEtoELF_ARCHR:rth
linux-user: elfload: Provide default forelf_check_archR:rthelf_ops: Fix coding style for EM alias case statement R:rth
elf: UpdateEM_MOXIEdefinition R:rth
arm: RemoveELF_MACHINEfromcpu.hR:rth
mb: RemoveELF_MACHINEfromcpu.hR:rth
m68k: RemoveELF_MACHINEfromcpu.hR:rth R:gerg R:laurentv
cris: RemoveELF_MACHINEfromcpu.hR:rth
moxie: RemoveELF_MACHINEfromcpu.hR:rth
unicore: RemoveELF_MACHINEfromcpu.hR:rth
lm32: RemoveELF_MACHINEfromcpu.hR:rth
or32: RemoveELF_MACHINEfromcpu.hR:rth
tricore: RemoveELF_MACHINEfromcpu.hR:rth
xtensa: RemoveELF_MACHINEfromcpu.hR:rth
sh4: RemoveELF_MACHINEfromcpu.hA:aurel R:rth
s390: RemoveELF_MACHINEfromcpu.hR:rth
sparc: RemoveELF_MACHINEfromcpu.hR:rth
mips: RemoveELF_MACHINEfromcpu.hR:aurel R:rth
alpha: RemoveELF_MACHINEfromcpu.hR:rth
i386: RenameELF_MACHINEto be x86 specific R:eduardo A:eduardo R:rth
ppc: RenameELF_MACHINEto be PPC specific R:rth
arm: cpu:assert()on no-EL2 virt IRQ error condition. R:pmm
arm: Removehw_error()usages. R:pmm
configure: factor out adding disas configure R:pmm
target-*: Don't redefinecpu_exec()include/exec: Splittarget_longdef to new header
cpu-defs: Allow multiple inclusions
target-*:cpu.h: Undefine core code symbols Makefile.target: Introduce arch-obj
core: virtualise CPU interfaces completely
core: Introduce multi-arch build
arm: cpu: static inlinecpu_arm_init()
target-arm: Split cp helper API to new C file
arm: registercpu_list()function
arm: enable multi-arch
hw: arm: Explicitly includecpu.hfor consumers
hw: mb: Explicitly includecpu.hfor consumers
microblaze: enable multi-arch
arm: boot: Don't assume all CPUs are ARM
arm:xilinx_zynq: Add a Microblaze
HACK: mb: boot: Assume using -firmware for mb software
HACK: mb: boot: Disable dtb load in multi-archPeter Crosthwaite (15):
cpu-exec: Migrate some generic fns to cpu-exec-common
translate: Listifytcg_exec_init()
translate-all: Movetcg_handle_interrupt()to -common
tcg: splittcg_op_defsto -common
tcg: Movetcg_tb_ptrto -common
translate: movereal_host_pagesetting to -common
cpus: Listifycpu_list()function
translate-common: Listifytcg_enabled()
core: Converttcg_enabled()uses to any/all variants
exec-all: Movecpu_can_do_io()toqom/cpu.h
cputlb: moveCPU_LOOP()fortlb_reset()toexec.c
cputlb: Changetlb_set_dirty()arg to cpuinclude/exec: Move cputlbexec.cdefs out
cpu-common: Definetb_page_addr_tfor everyone
monitor: unincludecpu_ldstMakefile.target | 3 ++ cpu-exec-common.c | 108 ++++++++++++++++++++++++++++++++++++++ cpu-exec.c | 49 ----------------- cpus.c | 10 +--- cputlb.c | 30 +++++------ exec.c | 13 ++--- include/exec/cpu-common.h | 4 ++ include/exec/cputlb.h | 16 ------ include/exec/exec-all.h | 20 ++++++- include/exec/ram_addr.h | 5 +- include/qemu-common.h | 6 +++ include/qom/cpu.h | 22 ++++++++ include/sysemu/cpus.h | 7 +++ memory.c | 8 +-- monitor.c | 1 - tcg/tcg-common.c | 35 +++++++++++++ tcg/tcg.c | 8 +-- tcg/tci/tcg-target.c | 2 +- tci.c | 6 --- translate-all.c | 46 ++++------------ translate-common.c | 130 ++++++++++++++++++++++++++++++++++++++++++++++ 21 files changed, 375 insertions(+), 154 deletions(-) create mode 100644 cpu-exec-common.c create mode 100644 tcg/tcg-common.c create mode 100644 translate-common.c