Xen guest-loader and arm64 build fixes/enhancements
Subsystems (2)
cover Xen guest-loader and arm64 build fixes/enhancements
Hi,
There are two parts to this series, broadly related because they are all to do with Xen. The first half is a re-spin of the guest-loader patches from a few weeks ago. The only changes are to move the generic-loader documentation into the manual and then add some words about the guest-loader.
The second half of the series is an attempt to fix and then clean up the handling of Xen enabled builds. Recent changes to the build system broke the ability to build qemu-system-i386 on arm64 hosts with Xen support enabled. The actual fix for that:
meson.build: fix building of Xen support for aarch64
should probably be rolled into the current release as it fixes a regression. The rest can wait until the tree re-opens. The patches broadly try to:
- clean-up detection and reporting
- be more explicit about linking stubs for accel
- add an explicit CONFIG_XEN_HVM for x86
and finally allow you to build a qemu-system-aarch64 with Xen support.
This is my first major foray into tweaking meson builds and it seems to occasionally come unstuck and requires a distclean and re-configure to un-wedge itself. The following need review:
- meson.build: build a Xen aware qemu-aarch64-system
- xen: only build HVM support under CONFIG_XEN_HVM
- accel/stubs: drop unused cpu.h include
- stubs/xen-hw-stub: drop xenstore_store_pv_console_info stub
- include/hw/xen.h: drop superfluous struct
- meson.build: clean-up summary reporting of XEN and it's features
- meson.build: introduce CONFIG_XEN_HVM flag
- meson.build: fix building of Xen support for aarch64
- accel/meson: you only need accelerator stubs for softmmu builds
- docs: add some documentation for the guest-loader
- docs: move generic-loader documentation into the main manual
Alex Bennée (15):
hw/board: promote fdt from ARM VirtMachineState to MachineState hw/riscv: migrate fdt field to generic MachineState
device_tree: add qemu_fdt_setprop_string_array helper hw/core: implement a guest-loader to support static hypervisor guests
docs: move generic-loader documentation into the main manual
docs: add some documentation for the guest-loader accel/meson: you only need accelerator stubs for softmmu builds meson.build: fix building of Xen support for aarch64 meson.build: introduce CONFIG_XEN_HVM flag
meson.build: clean-up summary reporting of XEN and it's features include/hw/xen.h: drop superfluous struct stubs/xen-hw-stub: drop xenstore_store_pv_console_info stub accel/stubs: drop unused cpu.h include
xen: only build HVM support under CONFIG_XEN_HVM meson.build: build a Xen aware qemu-aarch64-system
docs/generic-loader.txt | 92 ---------- docs/system/generic-loader.rst | 117 ++++++++++++ docs/system/guest-loader.rst | 54 ++++++ docs/system/index.rst | 2 + meson.build | 24 ++- hw/core/guest-loader.h | 34 ++++ include/hw/arm/virt.h | 1 - include/hw/boards.h | 1 + include/hw/riscv/virt.h | 1 - include/hw/xen/xen.h | 2 +- include/sysemu/device_tree.h | 17 ++ include/sysemu/xen-mapcache.h | 2 +- include/sysemu/xen.h | 9 +- accel/stubs/hax-stub.c | 1 - accel/stubs/xen-all-stub.c | 11 ++ accel/stubs/xen-stub.c | 2 - hw/arm/virt.c | 322 +++++++++++++++++---------------- hw/core/guest-loader.c | 140 ++++++++++++++ hw/riscv/virt.c | 20 +- softmmu/device_tree.c | 26 +++ stubs/xen-hw-stub.c | 4 - accel/Kconfig | 3 + accel/meson.build | 4 +- accel/stubs/meson.build | 13 +- hw/core/meson.build | 2 + hw/i386/xen/meson.build | 2 +- 26 files changed, 627 insertions(+), 279 deletions(-) delete mode 100644 docs/generic-loader.txt create mode 100644 docs/system/generic-loader.rst create mode 100644 docs/system/guest-loader.rst create mode 100644 hw/core/guest-loader.h create mode 100644 accel/stubs/xen-all-stub.c create mode 100644 hw/core/guest-loader.c
Signature · 1 line
2.20.1
RFC PATCH 1/15 hw/board: promote fdt from ARM VirtMachineState to MachineState
The use of FDT's is quite common across our various platforms. To allow the generic loader to tweak it we need to make it available in the generic state. This creates the field and migrates the initial user to use the generic field. Other boards will be updated in later patches.
Message-Id: <[email protected]>
--- include/hw/arm/virt.h | 1 - include/hw/boards.h | 1 + hw/arm/virt.c | 322 ++++++++++++++++++++++-------------------- 3 files changed, 170 insertions(+), 154 deletions(-)
include/hw/arm/virt.h +0 -1
@@ -152,7 +152,6 @@ struct VirtMachineState {char *pciehb_nodename;const int *irqmap;int smp_cpus; -void *fdt;int fdt_size;uint32_t clock_phandle;uint32_t gic_phandle;
include/hw/boards.h +1 -0
@@ -257,6 +257,7 @@ struct MachineState {/*< public >*/ +void *fdt;char *dtb;char *dumpdtb;int phandle_start;
hw/arm/virt.c +169 -153
706 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [RFC PATCH 01/15] hw/board: promote fdt from ARM VirtMachineState to MachineState
Quoted 9 lines · Alex Bennée
The use of FDT's is quite common across our various platforms. To allow the generic loader to tweak it we need to make it available in the generic state. This creates the field and migrates the initial user to use the generic field. Other boards will be updated in later patches.
Signed-off-by Alex Bennée <[email protected]>Message-Id: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>
Two S-o-b better than one!
Quoted 5 lines
--- include/hw/arm/virt.h | 1 - include/hw/boards.h | 1 + hw/arm/virt.c | 322 ++++++++++++++++++++++-------------------- 3 files changed, 170 insertions(+), 154 deletions(-)
Re: [RFC PATCH 01/15] hw/board: promote fdt from ARM VirtMachineState to MachineState
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Alex Bennée
The use of FDT's is quite common across our various platforms. To allow the generic loader to tweak it we need to make it available in the generic state. This creates the field and migrates the initial user to use the generic field. Other boards will be updated in later patches.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Alex Bennée <[email protected]>Message-Id: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>Two S-o-b better than one!
Hmm I wonder what happened there? I'm sure b4 applied that patches for me.
Quoted 8 lines
Quoted 6 lines
--- include/hw/arm/virt.h | 1 - include/hw/boards.h | 1 + hw/arm/virt.c | 322 ++++++++++++++++++++++-------------------- 3 files changed, 170 insertions(+), 154 deletions(-)Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Signature · 1 line
Alex Bennée
Re: [Stratos-dev] [RFC PATCH 01/15] hw/board: promote fdt from ARM VirtMachineState to MachineState
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Alex Bennée
The use of FDT's is quite common across our various platforms. To allow the generic loader to tweak it we need to make it available in the generic state. This creates the field and migrates the initial user to use the generic field. Other boards will be updated in later patches.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Alex Bennée <[email protected]>Message-Id: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>Two S-o-b better than one!
Hmm I wonder what happened there? I'm sure b4 applied that patches for me.
Quoted 8 lines
Quoted 6 lines
--- include/hw/arm/virt.h | 1 - include/hw/boards.h | 1 + hw/arm/virt.c | 322 ++++++++++++++++++++++-------------------- 3 files changed, 170 insertions(+), 154 deletions(-)Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Signature · 5 lines
Alex Bennée -- Stratos-dev mailing list [email protected] https://op-lists.linaro.org/mailman/listinfo/stratos-dev
RFC PATCH 2/15 hw/riscv: migrate fdt field to generic MachineState
In reply to Alex BennéeThis is a mechanical change to make the fdt available through MachineState.
Message-Id: <[email protected]>
--- include/hw/riscv/virt.h | 1 - hw/riscv/virt.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-)
include/hw/riscv/virt.h +0 -1
@@ -41,7 +41,6 @@ struct RISCVVirtState {DeviceState *plic[VIRT_SOCKETS_MAX ];PFlashCFI01 *flash[2 ]; -void *fdt;int fdt_size; };
hw/riscv/virt.c +10 -10
@@ -197,14 +197,14 @@ static void create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, dtb_filename =qemu_opt_get (qemu_get_machine_opts (),"dtb" );if (dtb_filename) { - fdt = s->fdt =load_device_tree (dtb_filename, &s->fdt_size); + fdt = mc->fdt =load_device_tree (dtb_filename, &s->fdt_size);if (!fdt) {error_report ("load_device_tree() failed" );exit (1 ); } goto update_bootargs; }else { - fdt = s->fdt =create_device_tree (&s->fdt_size); + fdt = mc->fdt =create_device_tree (&s->fdt_size);if (!fdt) {error_report ("create_device_tree() failed" );exit (1 );
@@ -442,12 +442,12 @@ static void create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,g_free (name); name =g_strdup_printf ("/soc/flash@%" PRIx64, flashbase); -qemu_fdt_add_subnode (s->fdt, name); -qemu_fdt_setprop_string (s->fdt, name,"compatible" ,"cfi-flash" ); -qemu_fdt_setprop_sized_cells (s->fdt, name,"reg" , +qemu_fdt_add_subnode (mc->fdt, name); +qemu_fdt_setprop_string (mc->fdt, name,"compatible" ,"cfi-flash" ); +qemu_fdt_setprop_sized_cells (mc->fdt, name,"reg" ,2 , flashbase,2 , flashsize,2 , flashbase + flashsize,2 , flashsize); -qemu_fdt_setprop_cell (s->fdt, name,"bank-width" ,4 ); +qemu_fdt_setprop_cell (mc->fdt, name,"bank-width" ,4 );g_free (name); update_bootargs:
@@ -631,9 +631,9 @@ static void virt_machine_init(MachineState *machine)hwaddr end =riscv_load_initrd (machine->initrd_filename, machine->ram_size, kernel_entry, &start); -qemu_fdt_setprop_cell (s->fdt,"/chosen" , +qemu_fdt_setprop_cell (machine->fdt,"/chosen" ,"linux,initrd-start" , start); -qemu_fdt_setprop_cell (s->fdt,"/chosen" ,"linux,initrd-end" , +qemu_fdt_setprop_cell (machine->fdt,"/chosen" ,"linux,initrd-end" , end); } }else {
@@ -654,11 +654,11 @@ static void virt_machine_init(MachineState *machine)/* Compute the fdt load address in dram */ fdt_load_addr =riscv_load_fdt (memmap[VIRT_DRAM ].base, - machine->ram_size, s->fdt); + machine->ram_size, machine->fdt);/* load the reset vector */ riscv_setup_rom_reset_vec (start_addr, virt_memmap[VIRT_MROM ].base, virt_memmap[VIRT_MROM ].size, kernel_entry, - fdt_load_addr, s->fdt); + fdt_load_addr, machine->fdt);/* SiFive Test MMIO device */ sifive_test_create (memmap[VIRT_TEST ].base);
Signature · 1 line
2.20.1
Re: [RFC PATCH 02/15] hw/riscv: migrate fdt field to generic MachineState
Quoted 11 lines · Alex Bennée
This is a mechanical change to make the fdt available through MachineState.
Signed-off-by Alex Bennée <[email protected]>Reviewed-by Alistair Francis <[email protected]>Message-Id: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- include/hw/riscv/virt.h | 1 - hw/riscv/virt.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-)
Re: [RFC PATCH 02/15] hw/riscv: migrate fdt field to generic MachineState
In reply to Alex BennéeQuoted 4 lines · Alex Bennée
This is a mechanical change to make the fdt available through MachineState.
Quoted 8 lines
Signed-off-by Alex Bennée <[email protected]>Reviewed-by Alistair Francis <[email protected]>Message-Id: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- include/hw/riscv/virt.h | 1 - hw/riscv/virt.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-)
What about the 'sifive_u' and 'spike' machines?
Regards,
Bin
Re: [RFC PATCH 02/15] hw/riscv: migrate fdt field to generic MachineState
Quoted 14 lines · Bin Meng
Quoted 4 lines · Alex Bennée
This is a mechanical change to make the fdt available through MachineState.
Quoted 8 lines
Signed-off-by Alex Bennée <[email protected]>Reviewed-by Alistair Francis <[email protected]>Message-Id: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- include/hw/riscv/virt.h | 1 - hw/riscv/virt.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-)
Quoted 1 line
What about the '
sifive_u' and 'spike' machines?
If they support direct -kernel loading then we could certainly do the same for them.
Quoted 3 lines
Regards,
Bin
Signature · 1 line
Alex Bennée
Re: [RFC PATCH 02/15] hw/riscv: migrate fdt field to generic MachineState
Quoted 18 lines · Alex Bennée
Quoted 14 lines · Bin Meng
Quoted 12 lines · Alex Bennée
This is a mechanical change to make the fdt available through MachineState.
Signed-off-by Alex Bennée <[email protected]>Reviewed-by Alistair Francis <[email protected]>Message-Id: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- include/hw/riscv/virt.h | 1 - hw/riscv/virt.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-)
Quoted 4 lines
Quoted 1 line
What about the '
sifive_u' and 'spike' machines?If they support direct -kernel loading then we could certainly do the same for them.
Yes, they do.
Regards,
Bin
RFC PATCH 3/15 device_tree: add qemu_fdt_setprop_string_array helper
In reply to Alex BennéeA string array in device tree is simply a series of \0 terminated strings next to each other. As libfdt doesn't support that directly we need to build it ourselves.
Message-Id: <[email protected]>
--- include/sysemu/device_tree.h | 17 +++++++++++++++++ softmmu/device_tree.c | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+)
include/sysemu/device_tree.h +17 -0
@@ -70,6 +70,23 @@ int qemu_fdt_setprop_u64(void *fdt, const char *node_path, const char *property, uint64_t val);int qemu_fdt_setprop_string (void *fdt,const char *node_path,const char *property,const char *string); + +/** +* qemu_fdt_setprop_string_array: set a string array property +* +* @fdt: pointer to the dt blob +* @name: node name +* @prop: property array +* @array: pointer to an array of string pointers +* @len: length of array +* +* assigns a string array to a property. This function converts and +* array of strings to a sequential string with \0 separators before +* setting the property. +*/ +int qemu_fdt_setprop_string_array (void *fdt,const char *node_path, +const char *prop,char **array,int len); +int qemu_fdt_setprop_phandle (void *fdt,const char *node_path,const char *property,const char *target_node_path);
softmmu/device_tree.c +26 -0
@@ -21,6 +21,7 @@#include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/bswap.h" +#include "qemu/cutils.h" #include "sysemu/device_tree.h" #include "sysemu/sysemu.h" #include "hw/loader.h"
@@ -397,6 +398,31 @@ int qemu_fdt_setprop_string(void *fdt, const char *node_path,return r; } +/* +* libfdt doesn't allow us to add string arrays directly but they are +* test a series of null terminated strings with a length. We build +* the string up here so we can calculate the final length. +*/ +int qemu_fdt_setprop_string_array (void *fdt,const char *node_path,const char *prop, +char **array,int len) +{ +int ret, i, total_len =0 ; +char *str, *p; +for (i =0 ; i < len; i++) { + total_len +=strlen (array[i]) +1 ; + } + p = str =g_malloc0 (total_len); +for (i =0 ; i < len; i++) { +int len =strlen (array[i]) +1 ; +pstrcpy (p, len, array[i]); + p += len; + } + + ret =qemu_fdt_setprop (fdt, node_path, prop, str, total_len); +g_free (str); +return ret; +} +const void *qemu_fdt_getprop (void *fdt,const char *node_path,const char *property,int *lenp,Error **errp) {
Signature · 1 line
2.20.1
RFC PATCH 4/15 hw/core: implement a guest-loader to support static hypervisor guests
In reply to Alex BennéeHypervisors, especially type-1 ones, need the firmware/bootcode to put their initial guest somewhere in memory and pass the information to it via platform data. The guest-loader is modelled after the generic loader for exactly this sort of purpose:
$QEMU $ARGS -kernel ~/xen.git/xen/xen \
-append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
-device guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro console=hvc0 earlyprintk=xen" \
-device guest-loader,addr=0x47000000,initrd=rootfs.cpioMessage-Id: <[email protected]>
--- hw/core/guest-loader.h | 34 ++++++++++ hw/core/guest-loader.c | 140 +++++++++++++++++++++++++++++++++++++++++ hw/core/meson.build | 2 + 3 files changed, 176 insertions(+) create mode 100644 hw/core/guest-loader.h create mode 100644 hw/core/guest-loader.c
hw/core/guest-loader.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Guest Loader +* +* Copyright (C) 2020 Linaro +* Written by Alex Bennée <[email protected]> +* (based on the generic-loader by Li Guang <[email protected]>) +* +* SPDX-License-Identifier: GPL-2.0-or-later +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#ifndef GUEST_LOADER_H +#define GUEST_LOADER_H + +#include "hw/qdev-core.h" +#include "qom/object.h" + +struct GuestLoaderState { +/* <private> */ +DeviceState parent_obj; + +/* <public> */ +uint64_t addr; +char *kernel; +char *args; +char *initrd; +}; + +#define TYPE_GUEST_LOADER "guest-loader" +OBJECT_DECLARE_SIMPLE_TYPE(GuestLoaderState, GUEST_LOADER) + +#endif
hw/core/guest-loader.c new file +140 -0
140 lines not on this page · raw message
hw/core/meson.build +2 -0
@@ -37,6 +37,8 @@ softmmu_ss.add(files( 'clock-vmstate.c', )) +softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('guest-loader.c')) + specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files( 'machine-qmp-cmds.c', 'numa.c',
Signature · 1 line
2.20.1
RFC PATCH 5/15 docs: move generic-loader documentation into the main manual
In reply to Alex BennéeWe might as well surface this useful information in the manual so users can find it easily. It is a fairly simple conversion to rst with the only textual fixes being QemuOps to QemuOpts.
--- docs/generic-loader.txt | 92 -------------------------- docs/system/generic-loader.rst | 117 +++++++++++++++++++++++++++++++++ docs/system/index.rst | 1 + 3 files changed, 118 insertions(+), 92 deletions(-) delete mode 100644 docs/generic-loader.txt create mode 100644 docs/system/generic-loader.rst
docs/generic-loader.txt deleted +0 -92
@@ -1,92 +0,0 @@ -Copyright (c) 2016 Xilinx Inc. - -This work is licensed under the terms of the GNU GPL, version 2 or later. See -the COPYING file in the top-level directory. - - -The 'loader' device allows the user to load multiple images or values into -QEMU at startup. - -Loading Data into Memory Values -------------------------------- -The loader device allows memory values to be set from the command line. This -can be done by following the syntax below: - - -device loader,addr=<addr>,data=<data>,data-len=<data-len> - [,data-be=<data-be>][,cpu-num=<cpu-num>] - - <addr> - The address to store the data in. - <data> - The value to be written to the address. The maximum size of - the data is 8 bytes. - <data-len> - The length of the data in bytes. This argument must be - included if the data argument is. - <data-be> - Set to true if the data to be stored on the guest should be - written as big endian data. The default is to write little - endian data. - <cpu-num> - The number of the CPU's address space where the data should - be loaded. If not specified the address space of the first - CPU is used. - -All values are parsed using the standard QemuOps parsing. This allows the user -to specify any values in any format supported. By default the values -will be parsed as decimal. To use hex values the user should prefix the number -with a '0x'. - -An example of loading value 0x8000000e to address 0xfd1a0104 is: - -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4 - -Setting a CPU's Program Counter -------------------------------- -The loader device allows the CPU's PC to be set from the command line. This -can be done by following the syntax below: - - -device loader,addr=<addr>,cpu-num=<cpu-num> - - <addr> - The value to use as the CPU's PC. - <cpu-num> - The number of the CPU whose PC should be set to the - specified value. - -All values are parsed using the standard QemuOps parsing. This allows the user -to specify any values in any format supported. By default the values -will be parsed as decimal. To use hex values the user should prefix the number -with a '0x'. - -An example of setting CPU 0's PC to 0x8000 is: - -device loader,addr=0x8000,cpu-num=0 - -Loading Files -------------- -The loader device also allows files to be loaded into memory. It can load ELF, -U-Boot, and Intel HEX executable formats as well as raw images. The syntax is -shown below: - - -device loader,file=<file>[,addr=<addr>][,cpu-num=<cpu-num>][,force-raw=<raw>] - - <file> - A file to be loaded into memory - <addr> - The memory address where the file should be loaded. This is - required for raw images and ignored for non-raw files. - <cpu-num> - This specifies the CPU that should be used. This is an - optional argument and will cause the CPU's PC to be set to - the memory address where the raw file is loaded or the entry - point specified in the executable format header. This option - should only be used for the boot image. - This will also cause the image to be written to the specified - CPU's address space. If not specified, the default is CPU 0. - <force-raw> - Setting force-raw=on forces the file to be treated as a raw - image. This can be used to load supported executable formats - as if they were raw. - -All values are parsed using the standard QemuOps parsing. This allows the user -to specify any values in any format supported. By default the values -will be parsed as decimal. To use hex values the user should prefix the number -with a '0x'. - -An example of loading an ELF file which CPU0 will boot is shown below: - -device loader,file=./images/boot.elf,cpu-num=0 - -Restrictions and ToDos ----------------------- - - At the moment it is just assumed that if you specify a cpu-num then you - want to set the PC as well. This might not always be the case. In future - the internal state 'set_pc' (which exists in the generic loader now) should - be exposed to the user so that they can choose if the PC is set or not.
docs/system/generic-loader.rst new file +117 -0
117 lines not on this page · raw message
docs/system/index.rst +1 -0
@@ -24,6 +24,7 @@ Contents: usb ivshmem linuxboot + generic-loader vnc-security tls gdb
Signature · 1 line
2.20.1
RFC PATCH 6/15 docs: add some documentation for the guest-loader
In reply to Alex Bennée--- docs/system/guest-loader.rst | 54 ++++++++++++++++++++++++++++++++++++ docs/system/index.rst | 1 + 2 files changed, 55 insertions(+) create mode 100644 docs/system/guest-loader.rst
docs/system/guest-loader.rst new file +54 -0
@@ -0,0 +1,54 @@ +.. + Copyright (c) 2020, Linaro + +Guest Loader +------------ + +The guest loader is similar to the `generic-loader` although it is +aimed at a particular use case of loading hypervisor guests. This is +useful for debugging hypervisors without having to jump through the +hoops of firmware and boot-loaders. + +The guest loader does two things: + + - load blobs (kernels and initial ram disks) into memory + - sets platform FDT data so hypervisors can find and boot them + +This is what is typically done by a boot-loader like grub using it's +multi-boot capability. A typical example would look like: + +.. parsed-literal:: + + |qemu_system| -kernel ~/xen.git/xen/xen \ + -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \ + -device guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro console=hvc0 earlyprintk=xen" \ + -device guest-loader,addr=0x47000000,initrd=rootfs.cpio + +In the above example the Xen hypervisor is loaded by the -kernel +parameter and passed it's boot arguments via -append. The Dom0 guest +is loaded into the areas of memory. Each blob will get +`/chosen/module@<addr>` entry in the FDT to indicate it's location and +size. Additional information can be passed with by using additional +arguments. + +Currently the only supported machines which use FDT data to boot are +the ARM and RiscV `virt` machines. + +Arguments +^^^^^^^^^ + +The full syntax of the guest-loader is:: + + -device guest-loader,addr=<addr>[,kernel=<file>,[bootargs=<args>]][,initrd=<file>] + +``addr=<addr>`` + This is mandatory and indicates the start address of the blob. + +``kernel|initrd=<file>`` + Indicates the filename of the kernel or initrd blob. Both blobs will + have the "multiboot,module" compatibility string as well as + "multiboot,kernel" or "multiboot,ramdisk" as appropriate. + +``bootargs=<args>`` + This is an optional field for kernel blobs which will pass command + like via the `/chosen/module@<addr>/bootargs` node.
docs/system/index.rst +1 -0
@@ -25,6 +25,7 @@ Contents: ivshmem linuxboot generic-loader + guest-loader vnc-security tls gdb
Signature · 1 line
2.20.1
Re: [RFC PATCH 06/15] docs: add some documentation for the guest-loader
Quoted 39 lines · Alex Bennée
Signed-off-by Alex Bennée <[email protected]>--- docs/system/guest-loader.rst | 54 ++++++++++++++++++++++++++++++++++++ docs/system/index.rst | 1 + 2 files changed, 55 insertions(+) create mode 100644 docs/system/guest-loader.rstdocs/system/guest-loader.rst new file +25
-0@@ -0,0 +1,54 @@ +.. + Copyright (c) 2020, Linaro + +Guest Loader +------------ + +The guest loader is similar to the `generic-loader` although it is +aimed at a particular use case of loading hypervisor guests. This is +useful for debugging hypervisors without having to jump through the +hoops of firmware and boot-loaders. + +The guest loader does two things: + + - load blobs (kernels and initial ram disks) into memory + - sets platform FDT data so hypervisors can find and boot them + +This is what is typically done by a boot-loader like grub using it's +multi-boot capability. A typical example would look like: + +.. parsed-literal:: + + |qemu_system| -kernel ~/xen.git/xen/xen \ + -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \ + -device guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro console=hvc0 earlyprintk=xen" \ + -device guest-loader,addr=0x47000000,initrd=rootfs.cpio
docs/system/guest-loader.rst line 35
Quoted 10 lines
docs/system/guest-loader.rst new file +10
-0+ +In the above example the Xen hypervisor is loaded by the -kernel +parameter and passed it's boot arguments via -append. The Dom0 guest +is loaded into the areas of memory. Each blob will get +`/chosen/module@<addr>` entry in the FDT to indicate it's location and +size. Additional information can be passed with by using additional +arguments. + +Currently the only supported machines which use FDT data to boot are +the ARM and RiscV `virt` machines.
RISC-V.
Otherwise:
Alistair
Quoted 35 lines
docs/system/guest-loader.rst new file +19
-0+ +Arguments +^^^^^^^^^ + +The full syntax of the guest-loader is:: + + -device guest-loader,addr=<addr>[,kernel=<file>,[bootargs=<args>]][,initrd=<file>] + +``addr=<addr>`` + This is mandatory and indicates the start address of the blob. + +``kernel|initrd=<file>`` + Indicates the filename of the kernel or initrd blob. Both blobs will + have the "multiboot,module" compatibility string as well as + "multiboot,kernel" or "multiboot,ramdisk" as appropriate. + +``bootargs=<args>`` + This is an optional field for kernel blobs which will pass command + like via the `/chosen/module@<addr>/bootargs` node.docs/system/index.rst +1
-1@@ -25,6 +25,7 @@ Contents: ivshmem linuxboot generic-loader + guest-loader vnc-security tls gdb --2.20.1
Re: [RFC PATCH 06/15] docs: add some documentation for the guest-loader
Quoted 6 lines · Alistair Francis
docs/system/guest-loader.rst line 35
Quoted 2 lines · Alex Bennée
docs/system/guest-loader.rst new file +2
-0+Currently the only supported machines which use FDT data to boot are +the ARM and RiscV `virt` machines.RISC-V.
If we're going to be picky, also "Arm" :-)
-- PMM
RFC PATCH 7/15 accel/meson: you only need accelerator stubs for softmmu builds
In reply to Alex BennéeThis avoids us pulling in Xen headers we don't need. The TCG accelerator will always exist for the *-user builds.
--- accel/meson.build | 4 +++- accel/stubs/meson.build | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-)
accel/meson.build +3 -1
@@ -4,7 +4,9 @@ subdir('qtest') subdir('kvm') subdir('tcg') subdir('xen') -subdir('stubs') +if have_system + subdir('stubs') +endif dummy_ss = ss.source_set() dummy_ss.add(files(
accel/stubs/meson.build +8 -4
@@ -1,4 +1,8 @@ -specific_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c')) -specific_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c')) -specific_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c')) -specific_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c')) +softmmu_stub_ss = ss.source_set() + +softmmu_stub_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c')) +softmmu_stub_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c')) +softmmu_stub_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c')) +softmmu_stub_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c')) + +specific_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: softmmu_stub_ss)
Signature · 1 line
2.20.1
Re: [RFC PATCH 07/15] accel/meson: you only need accelerator stubs for softmmu builds
Quoted 14 lines · Alex Bennée
This avoids us pulling in Xen headers we don't need. The TCG accelerator will always exist for the *-user builds.
Signed-off-by Alex Bennée <[email protected]>--- accel/meson.build | 4 +++- accel/stubs/meson.build | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-)accel/meson.build +0
-0
accel/meson.build subdir('qtest') · line 7
Quoted 5 lines
accel/meson.build +1
-1@@ -4,7 +4,9 @@ subdir('qtest') subdir('kvm') subdir('tcg') subdir('xen') -subdir('stubs') +if have_system
Do we really need this check ...
Quoted 12 lines
accel/meson.build +2
-0+ subdir('stubs') +endif dummy_ss = ss.source_set() dummy_ss.add(files(accel/stubs/meson.build +0
-2@@ -1,4 +1,8 @@ -specific_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c')) -specific_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
accel/stubs/meson.build line 8
Quoted 10 lines
accel/stubs/meson.build +8
-2-specific_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c')) -specific_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c')) +softmmu_stub_ss = ss.source_set() + +softmmu_stub_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c')) +softmmu_stub_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c')) +softmmu_stub_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c')) +softmmu_stub_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c')) + +specific_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: softmmu_stub_ss)
... when we check for CONFIG_SOFTMMU here?
RFC PATCH 8/15 meson.build: fix building of Xen support for aarch64
In reply to Alex BennéeXen is supported on ARM although weirdly using the i386-softmmu model. Checking based on the host CPU meant we never enabled Xen support. It would be nice to enable CONFIG_XEN for aarch64-softmmu to make it not seem weird but that will require further build surgery.
--- meson.build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
meson.build +6 -1
@@ -74,10 +74,15 @@ else endif accelerator_targets = { 'CONFIG_KVM': kvm_targets } +if cpu in ['x86', 'x86_64', 'arm', 'aarch64'] + # i368 emulator provides xenpv machine type for multiple architectures + accelerator_targets += { + 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], + } +endif if cpu in ['x86', 'x86_64'] accelerator_targets += { 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], - 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], 'CONFIG_HVF': ['x86_64-softmmu'], 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'], }
Signature · 1 line
2.20.1
Re: [RFC PATCH 08/15] meson.build: fix building of Xen support for aarch64
Quoted 12 lines · Alex Bennée
Xen is supported on ARM although weirdly using the i386-softmmu model. Checking based on the host CPU meant we never enabled Xen support. It would be nice to enable
CONFIG_XENfor aarch64-softmmu to make it not seem weird but that will require further build surgery.Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Alex Bennée <[email protected]>Cc Masami Hiramatsu <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>Cc Paul Durrant <[email protected]>Fixes 8a19980e3f ("configure: move accelerator logic to meson")
Quoted 3 lines
--- meson.build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
RFC PATCH 9/15 meson.build: introduce CONFIG_XEN_HVM flag
In reply to Alex BennéeWhile Xen traditionally uses i386-softmmu to run it's PV models on all architectures some models are very much x86 only. This includes the full hardware virtualisation (HVM) which is only used on x86 HW. By introducing the symbol we can also fix the inclusion of XEN_PCI_PASSTHROUGH which should only be built for x86 (and Linux) systems.
--- meson.build | 6 +++++- accel/Kconfig | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-)
meson.build +5 -1
@@ -83,6 +83,7 @@ endif if cpu in ['x86', 'x86_64'] accelerator_targets += { 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], + 'CONFIG_XEN_HVM': ['i386-softmmu', 'x86_64-softmmu'], 'CONFIG_HVF': ['x86_64-softmmu'], 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'], }
@@ -204,6 +205,9 @@ if not get_option('kvm').disabled() and targetos == 'linux' endif if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host accelerators += 'CONFIG_XEN' + if host_machine.cpu() == 'x86_64' + accelerators += 'CONFIG_XEN_HVM' + endif have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux' else have_xen_pci_passthrough = false
@@ -916,7 +920,7 @@ foreach target : target_dirs if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, []) config_target += { sym: 'y' } config_all += { sym: 'y' } - if sym == 'CONFIG_XEN' and have_xen_pci_passthrough + if sym == 'CONFIG_XEN_HVM' and have_xen_pci_passthrough config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' } endif have_accel = true
accel/Kconfig +3 -0
@@ -7,3 +7,6 @@ config KVM config XEN bool select FSDEV_9P if VIRTFS + +config XEN_HVM + bool
Signature · 1 line
2.20.1
Re: [RFC PATCH 09/15] meson.build: introduce CONFIG_XEN_HVM flag
Quoted 7 lines · Alex Bennée
While Xen traditionally uses i386-softmmu to run it's PV models on all architectures some models are very much x86 only. This includes the full hardware virtualisation (HVM) which is only used on x86 HW. By introducing the symbol we can also fix the inclusion of
XEN_PCI_PASSTHROUGHwhich should only be built for x86 (and Linux) systems.
Quoted 6 lines
Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Alex Bennée <[email protected]>--- meson.build | 6 +++++- accel/Kconfig | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-)
Re: [RFC PATCH 09/15] meson.build: introduce CONFIG_XEN_HVM flag
In reply to Alex BennéeQuoted 19 lines · Alex Bennée
While Xen traditionally uses i386-softmmu to run it's PV models on all architectures some models are very much x86 only. This includes the full hardware virtualisation (HVM) which is only used on x86 HW. By introducing the symbol we can also fix the inclusion of
XEN_PCI_PASSTHROUGHwhich should only be built for x86 (and Linux) systems.Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Alex Bennée <[email protected]>--- meson.build | 6 +++++- accel/Kconfig | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-)meson.build +0
-0
meson.build endif · line 86
Quoted 4 lines
meson.build +1
-0@@ -83,6 +83,7 @@ endif if cpu in ['x86', 'x86_64'] accelerator_targets += { 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], + 'CONFIG_XEN_HVM': ['i386-softmmu', 'x86_64-softmmu'],
I'm confused while looking at
https://wiki.xen.org/wiki/Xen_Project_Software_Overview#ARM_Hosts
Maybe it makes sense to add both CONFIG_XEN_PV /CONFIG_XEN_HVM accelerators?
meson.build if not get_option('kvm').disabled() and targetos == 'linux' · line 208
Quoted 8 lines
meson.build +1
-0'CONFIG_HVF': ['x86_64-softmmu'], 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'], }@@ -204,6 +205,9 @@ if not get_option('kvm').disabled() and targetos == 'linux' endif if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host accelerators += 'CONFIG_XEN' + if host_machine.cpu() == 'x86_64'
Are you sure it is restricted to 64-bit host? I can't find the reference.
Quoted 3 lines
meson.build +2
-0+ accelerators += 'CONFIG_XEN_HVM' + endif have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux'
RFC PATCH 10/15 meson.build: clean-up summary reporting of XEN and it's features
In reply to Alex BennéeReport XEN support along with the rest of the accelerators. Repurposed the existing Xen support line to display details about the control API version and the additional enabled features.
--- meson.build | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
meson.build +9 -1
@@ -2078,8 +2078,15 @@ if vnc.found() summary_info += {'VNC JPEG support': jpeg.found()} summary_info += {'VNC PNG support': png.found()} endif -summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')} if config_host.has_key('CONFIG_XEN_BACKEND') + xen_features = ['backend'] + if config_all.has_key('CONFIG_XEN_HVM') + xen_features += 'HVM' + endif + if config_all.has_key('CONFIG_XEN_PCI_PASSTHROUGH') + xen_features += 'PCI Passthrough' + endif + summary_info += {'xen features': ' '.join(xen_features)} summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']} endif summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
@@ -2092,6 +2099,7 @@ summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_ summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')} summary_info += {'Install blobs': get_option('install_blobs')} summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')} +summary_info += {'XEN support': config_all.has_key('CONFIG_XEN')} summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')} summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')} summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
Signature · 1 line
2.20.1
Re: [RFC PATCH 10/15] meson.build: clean-up summary reporting of XEN and it's features
Quoted 17 lines · Alex Bennée
Report XEN support along with the rest of the accelerators. Repurposed the existing Xen support line to display details about the control API version and the additional enabled features.
Signed-off-by Alex Bennée <[email protected]>--- meson.build | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)meson.build +0
-0@@ -2078,8 +2078,15 @@ if vnc.found() summary_info += {'VNC JPEG support': jpeg.found()} summary_info += {'VNC PNG support': png.found()} endif
meson.build if vnc.found() · line 2089
Quoted 10 lines
meson.build +8
-1-summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')} if config_host.has_key('CONFIG_XEN_BACKEND') + xen_features = ['backend'] + if config_all.has_key('CONFIG_XEN_HVM') + xen_features += 'HVM' + endif + if config_all.has_key('CONFIG_XEN_PCI_PASSTHROUGH') + xen_features += 'PCI Passthrough' + endif + summary_info += {'xen features': ' '.join(xen_features)}
Maybe ','.join, as ' ' already in 'PCI Passthrough'.
Otherwise:
Quoted 12 lines
meson.build +1
-0summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']} endif summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}@@ -2092,6 +2099,7 @@ summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_ summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')} summary_info += {'Install blobs': get_option('install_blobs')} summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')} +summary_info += {'XEN support': config_all.has_key('CONFIG_XEN')} summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')} summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')} summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')}
RFC PATCH 11/15 include/hw/xen.h: drop superfluous struct
In reply to Alex BennéeChardev is already a typedef'ed struct.
--- include/hw/xen/xen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/xen/xen.h +1 -1
@@ -28,7 +28,7 @@ int xen_is_pirq_msi(uint32_t msi_data);qemu_irq *xen_interrupt_controller_init (void ); -void xenstore_store_pv_console_info (int i,struct Chardev *chr); +void xenstore_store_pv_console_info (int i,Chardev *chr);void xen_register_framebuffer (struct MemoryRegion *mr);
Signature · 1 line
2.20.1
Re: [RFC PATCH 11/15] include/hw/xen.h: drop superfluous struct
Quoted 6 lines · Alex Bennée
Chardev is already a typedef'ed struct.
Signed-off-by Alex Bennée <[email protected]>--- include/hw/xen/xen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
RFC PATCH 12/15 stubs/xen-hw-stub: drop xenstore_store_pv_console_info stub
In reply to Alex BennéeWe should never build something that calls this without having it.
--- stubs/xen-hw-stub.c | 4 ---- 1 file changed, 4 deletions(-)
stubs/xen-hw-stub.c +0 -4
@@ -10,10 +10,6 @@#include "hw/xen/xen.h" #include "hw/xen/xen-x86.h" -void xenstore_store_pv_console_info (int i,Chardev *chr) -{ -} -int xen_pci_slot_get_pirq (PCIDevice *pci_dev,int irq_num) {return -1 ;
Signature · 1 line
2.20.1
Re: [RFC PATCH 12/15] stubs/xen-hw-stub: drop xenstore_store_pv_console_info stub
Quoted 1 line · Alex Bennée
We should never build something that calls this without having it.
"because ..."?
Quoted 22 lines
Signed-off-by Alex Bennée <[email protected]>--- stubs/xen-hw-stub.c | 4 ---- 1 file changed, 4 deletions(-)stubs/xen-hw-stub.c +0
-4@@ -10,10 +10,6 @@#include "hw/xen/xen.h" #include "hw/xen/xen-x86.h" -void xenstore_store_pv_console_info (int i,Chardev *chr) -{ -} -int xen_pci_slot_get_pirq (PCIDevice *pci_dev,int irq_num) {return -1 ;
Re: [RFC PATCH 12/15] stubs/xen-hw-stub: drop xenstore_store_pv_console_info stub
Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 1 line · Alex Bennée
We should never build something that calls this without having it.
"because ..."?
xen-all.c is only built when we have CONFIG_XEN which also gates the only call-site in xen-console.c
Quoted 25 lines
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Quoted 22 lines
Signed-off-by Alex Bennée <[email protected]>--- stubs/xen-hw-stub.c | 4 ---- 1 file changed, 4 deletions(-)stubs/xen-hw-stub.c +0
-4@@ -10,10 +10,6 @@#include "hw/xen/xen.h" #include "hw/xen/xen-x86.h" -void xenstore_store_pv_console_info (int i,Chardev *chr) -{ -} -int xen_pci_slot_get_pirq (PCIDevice *pci_dev,int irq_num) {return -1 ;
Signature · 1 line
Alex Bennée
RFC PATCH 13/15 accel/stubs: drop unused cpu.h include
In reply to Alex Bennée--- accel/stubs/hax-stub.c | 1 - 1 file changed, 1 deletion(-)
accel/stubs/hax-stub.c +0 -1
@@ -14,7 +14,6 @@*/ #include "qemu/osdep.h" -#include "cpu.h" #include "sysemu/hax.h" int hax_sync_vcpus (void )
Signature · 1 line
2.20.1
Re: [RFC PATCH 13/15] accel/stubs: drop unused cpu.h include
Quoted 11 lines · Alex Bennée
Signed-off-by Alex Bennée <[email protected]>--- accel/stubs/hax-stub.c | 1 - 1 file changed, 1 deletion(-)accel/stubs/hax-stub.c +0
-0
accel/stubs/hax-stub.c line 19
Quoted 7 lines
accel/stubs/hax-stub.c +0
-1@@ -14,7 +14,6 @@*/ #include "qemu/osdep.h" -#include "cpu.h" #include "sysemu/hax.h" int hax_sync_vcpus (void )
RFC PATCH 14/15 xen: only build HVM support under CONFIG_XEN_HVM
In reply to Alex BennéeWhen running on non-x86 systems there is no point building HVM support because we will never see such things. To achieve this we need to shuffle a little bit of the inline and other stubs about.
--- include/sysemu/xen-mapcache.h | 2 +- include/sysemu/xen.h | 9 +++++---- accel/stubs/xen-all-stub.c | 11 +++++++++++ accel/stubs/xen-stub.c | 2 -- accel/stubs/meson.build | 3 ++- hw/i386/xen/meson.build | 2 +- 6 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 accel/stubs/xen-all-stub.c
include/sysemu/xen-mapcache.h +1 -1
@@ -13,7 +13,7 @@typedef hwaddr (*phys_offset_to_gaddr_t )(hwaddr phys_offset,ram_addr_t size); -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_HVM void xen_map_cache_init (phys_offset_to_gaddr_t f,void *opaque);
include/sysemu/xen.h +5 -4
@@ -24,7 +24,7 @@ extern bool xen_allowed;#define xen_enabled () (xen_allowed) -#ifndef CONFIG_USER_ONLY +#ifdef CONFIG_XEN_HVM void xen_hvm_modified_memory (ram_addr_t start,ram_addr_t length);void xen_ram_alloc (ram_addr_t ram_addr,ram_addr_t size,struct MemoryRegion *mr,Error **errp);
@@ -33,7 +33,10 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,#else /* !CONFIG_XEN_IS_POSSIBLE */ #define xen_enabled () 0 -#ifndef CONFIG_USER_ONLY + +#endif /* CONFIG_XEN_IS_POSSIBLE */ + +#if !defined(CONFIG_XEN_HVM ) && !defined(CONFIG_USER_ONLY )static inline void xen_hvm_modified_memory (ram_addr_t start,ram_addr_t length) {/* nothing */
@@ -45,6 +48,4 @@ static inline void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, }#endif -#endif /* CONFIG_XEN_IS_POSSIBLE */ -#endif
accel/stubs/xen-all-stub.c new file +11 -0
@@ -0,0 +1,11 @@ +/* +* Copyright (C) 2014 Citrix Systems UK Ltd. +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#include "qemu/osdep.h" +#include "sysemu/xen.h" + +bool xen_allowed;
accel/stubs/xen-stub.c +0 -2
@@ -9,8 +9,6 @@#include "sysemu/xen.h" #include "qapi/qapi-commands-migration.h" -bool xen_allowed; -void qmp_xen_set_global_dirty_log (bool enable,Error **errp) { }
accel/stubs/meson.build +2 -1
@@ -1,7 +1,8 @@ softmmu_stub_ss = ss.source_set() softmmu_stub_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c')) -softmmu_stub_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c')) +softmmu_stub_ss.add(when: 'CONFIG_XEN', if_false: files('xen-all-stub.c')) +softmmu_stub_ss.add(when: 'CONFIG_XEN_HVM', if_false: files('xen-stub.c')) softmmu_stub_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c')) softmmu_stub_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
hw/i386/xen/meson.build +1 -1
@@ -1,4 +1,4 @@ -i386_ss.add(when: 'CONFIG_XEN', if_true: files( +i386_ss.add(when: 'CONFIG_XEN_HVM', if_true: files( 'xen-hvm.c', 'xen-mapcache.c', 'xen_apic.c',
Signature · 1 line
2.20.1
RFC PATCH 15/15 meson.build: build a Xen aware qemu-aarch64-system
In reply to Alex BennéeThe i386-softmmu is a bit of an oddity for running ARM Xen guests so lets allow us to build an aarch64 binary with a reasonable name as well.
--- meson.build | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
meson.build +6 -5
@@ -74,15 +74,16 @@ else endif accelerator_targets = { 'CONFIG_KVM': kvm_targets } -if cpu in ['x86', 'x86_64', 'arm', 'aarch64'] - # i368 emulator provides xenpv machine type for multiple architectures +if cpu in ['arm', 'aarch64'] + # i386 emulator used to provide xenpv machine type for all + # supported architectures accelerator_targets += { - 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], + 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu', 'arm-softmmu', 'aarch64-softmmu'], } -endif -if cpu in ['x86', 'x86_64'] +elif cpu in ['x86', 'x86_64'] accelerator_targets += { 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], + 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], 'CONFIG_XEN_HVM': ['i386-softmmu', 'x86_64-softmmu'], 'CONFIG_HVF': ['x86_64-softmmu'], 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
Signature · 1 line
2.20.1
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [RFC PATCH 00/15] Xen guest-loader and arm64 build fixes/enhancements
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
27a1c8e meson.build: build a Xen aware qemu-aarch64-system c2531b0 xen: only build HVM support under CONFIG_XEN_HVM
a4e2d49 accel/stubs: drop unused cpu.h include
8e6bdd0 stubs/xen-hw-stub: drop xenstore_store_pv_console_info stub c89ecab include/hw/xen.h: drop superfluous struct
f76f5a8 meson.build: clean-up summary reporting of XEN and it's features 739b93f meson.build: introduce CONFIG_XEN_HVM flag
e739aac meson.build: fix building of Xen support for aarch64 f28183e accel/meson: you only need accelerator stubs for softmmu builds 8227889 docs: add some documentation for the guest-loader
5d2e6b4 docs: move generic-loader documentation into the main manual 97eabd7 hw/core: implement a guest-loader to support static hypervisor guests d3af3c7 device_tree: add qemu_fdt_setprop_string_array helper 57bb510 hw/riscv: migrate fdt field to generic MachineState 4d28909 hw/board: promote fdt from ARM VirtMachineState to MachineState
=== OUTPUT BEGIN ===
1/15 Checking commit 4d289091b31a (hw/board: promote fdt from ARM VirtMachineState to MachineState) 2/15 Checking commit 57bb510cbd7f (hw/riscv: migrate fdt field to generic MachineState) 3/15 Checking commit d3af3c7f5650 (device_tree: add qemu_fdt_setprop_string_array helper)
WARNING: line over 80 characters
#66: FILE: softmmu/device_tree.c:406:
+int qemu_fdt_setprop_string_array(void *fdt, const char *node_path, const char *prop,
total: 0 errors, 1 warnings, 61 lines checked
Patch 3/15 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/15 Checking commit 97eabd73472c (hw/core: implement a guest-loader to support static hypervisor guests)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#23:
new file mode 100644
WARNING: line over 80 characters
#69: FILE: hw/core/guest-loader.c:42:
+static void loader_insert_platform_data(GuestLoaderState *s, int size, Error **errp)
ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead #73: FILE: hw/core/guest-loader.c:46:
+ g_autofree char *node = g_strdup_printf("/chosen/module@%#08lx", s->addr);
WARNING: line over 80 characters
#87: FILE: hw/core/guest-loader.c:60:
+ (fdt, node, "compatible", (char **) &compat, ARRAY_SIZE(compat)) < 0) {
ERROR: "foo * bar" should be "foo *bar"
#97: FILE: hw/core/guest-loader.c:70:
+ const char * compat[2] = { "multiboot,module", "multiboot,ramdisk" };
WARNING: line over 80 characters
#99: FILE: hw/core/guest-loader.c:72:
+ (fdt, node, "compatible", (char **) &compat, ARRAY_SIZE(compat)) < 0) {
WARNING: line over 80 characters
#114: FILE: hw/core/guest-loader.c:87:
+ error_setg(errp, "Cannot specify a kernel and initrd in the same stanza");
total: 2 errors, 5 warnings, 182 lines checked
Patch 4/15 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
5/15 Checking commit 5d2e6b45a0ff (docs: move generic-loader documentation into the main manual)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#15:
deleted file mode 100644
ERROR: trailing whitespace
#204: FILE: docs/system/generic-loader.rst:87:
+ $
total: 1 errors, 1 warnings, 124 lines checked
Patch 5/15 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
6/15 Checking commit 82278896e117 (docs: add some documentation for the guest-loader)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #11:
new file mode 100644
total: 0 errors, 1 warnings, 61 lines checked
Patch 6/15 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
7/15 Checking commit f28183e58873 (accel/meson: you only need accelerator stubs for softmmu builds) 8/15 Checking commit e739aac98546 (meson.build: fix building of Xen support for aarch64) 9/15 Checking commit 739b93f74453 (meson.build: introduce CONFIG_XEN_HVM flag)
10/15 Checking commit f76f5a8ae6f4 (meson.build: clean-up summary reporting of XEN and it's features) 11/15 Checking commit c89ecab617c8 (include/hw/xen.h: drop superfluous struct)
12/15 Checking commit 8e6bdd0b268e (stubs/xen-hw-stub: drop xenstore_store_pv_console_info stub) 13/15 Checking commit a4e2d49e005e (accel/stubs: drop unused cpu.h include)
14/15 Checking commit c2531b00f4b8 (xen: only build HVM support under CONFIG_XEN_HVM)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#29:
new file mode 100644
total: 0 errors, 1 warnings, 66 lines checked
Patch 14/15 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
15/15 Checking commit 27a1c8ef9d5d (meson.build: build a Xen aware qemu-aarch64-system) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]