hw/xen: Introduce XEN_FV/XEN_PV Kconfig
v3 cover hw/xen: Introduce XEN_FV/XEN_PV Kconfig
Sort the Xen buildsys glue a bit.
The first patches are probably ready now.
Since v2:
- Addressed some of Paolo's comments
- More fixes
- XEN_PV still not buildable alone -> postponed
v2: Considered Paolo's comments from v1
Philippe Mathieu-Daudé (7):
meson: Do not build Xen x86_64-softmmu on Aarch64
hw/xen: Relax dependency on FSDEV_9P
accel/xen: Incorporate xen-mapcache.c
hw/i386/xen: Introduce XEN_FV Kconfig
hw/xen: Make xen_shutdown_fatal_error() available out of X86 HVM hw/xen: Make qmp_xen_set_global_dirty_log() available out of X86 HVM NOTFORMERGE hw/xen/Kconfig: Introduce XEN_PV config
meson.build | 8 ++++++--
accel/xen/trace.h | 1 +
{hw/i386 => accel}/xen/xen-mapcache.c | 0
hw/i386/xen/xen-hvm.c | 24 ------------------------
hw/xen/xen-legacy-backend.c | 3 ++-
hw/xen/xen-migration.c | 22 ++++++++++++++++++++++
hw/xen/xen-utils.c | 25 +++++++++++++++++++++++++
accel/Kconfig | 2 +-
accel/xen/meson.build | 5 ++++-
accel/xen/trace-events | 10 ++++++++++
hw/Kconfig | 1 +
hw/i386/Kconfig | 2 ++
hw/i386/xen/Kconfig | 5 +++++
hw/i386/xen/meson.build | 3 +--
hw/i386/xen/trace-events | 6 ------
hw/xen/Kconfig | 7 +++++++
hw/xen/meson.build | 4 +++-
17 files changed, 90 insertions(+), 38 deletions(-)
create mode 100644 accel/xen/trace.h
rename {hw/i386 => accel}/xen/xen-mapcache.c (100%)
create mode 100644 hw/xen/xen-migration.c
create mode 100644 hw/xen/xen-utils.c
create mode 100644 accel/xen/trace-events
create mode 100644 hw/i386/xen/Kconfig
create mode 100644 hw/xen/KconfigSignature · 1 line
2.26.2
PATCH v3 1/7 meson: Do not build Xen x86_64-softmmu on Aarch64
The Xen on ARM documentation only mentions the i386-softmmu target. As the x86_64-softmmu doesn't seem used, remove it to avoid wasting cpu cycles building it.
--- meson.build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
meson.build +3 -2
@@ -74,10 +74,10 @@ endif accelerator_targets = { 'CONFIG_KVM': kvm_targets } -if cpu in ['x86', 'x86_64', 'arm', 'aarch64'] +if cpu in ['arm', 'aarch64'] # i368 emulator provides xenpv machine type for multiple architectures accelerator_targets += { - 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], + 'CONFIG_XEN': ['i386-softmmu'], } endif if cpu in ['x86', 'x86_64']
@@ -85,6 +85,7 @@ 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], 'CONFIG_HVF': ['x86_64-softmmu'], 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'], + 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], } endif
Signature · 1 line
2.26.2
PATCH v3 2/7 hw/xen: Relax dependency on FSDEV_9P
In reply to Philippe Mathieu-DaudéRelax the dependency on 9pfs by using the 'imply' Kconfig rule. This fixes when XEN_PV without XEN_FV:
/usr/bin/ld: libcommon.fa.p/hw_xen_xen-legacy-backend.c.o: in function `xen_be_register_common':
hw/xen/xen-legacy-backend.c:754: undefined reference to `xen_9pfs_ops'
--- hw/xen/xen-legacy-backend.c | 3 ++- accel/Kconfig | 2 +- hw/xen/meson.build | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)
hw/xen/xen-legacy-backend.c +2 -1
@@ -33,6 +33,7 @@#include "hw/xen/xen-legacy-backend.h" #include "hw/xen/xen_pvdev.h" #include "monitor/qdev.h" +#include CONFIG_DEVICES DeviceState *xen_sysdev;BusState *xen_sysbus;
@@ -750,7 +751,7 @@ void xen_be_register_common(void)xen_be_register ("console" , &xen_console_ops);xen_be_register ("vkbd" , &xen_kbdmouse_ops); -#ifdef CONFIG_VIRTFS +#ifdef CONFIG_FSDEV_9P xen_be_register ("9pfs" , &xen_9pfs_ops);#endif #ifdef CONFIG_USB_LIBUSB
accel/Kconfig +1 -1
@@ -15,4 +15,4 @@ config KVM config XEN bool - select FSDEV_9P if VIRTFS + imply FSDEV_9P
hw/xen/meson.build +1 -1
@@ -2,12 +2,12 @@ 'xen-backend.c', 'xen-bus-helper.c', 'xen-bus.c', - 'xen-legacy-backend.c', 'xen_devconfig.c', 'xen_pvdev.c', )) xen_specific_ss = ss.source_set() +xen_specific_ss.add(files('xen-legacy-backend.c')) xen_specific_ss.add(when: 'CONFIG_XEN_PCI_PASSTHROUGH', if_true: files( 'xen-host-pci-device.c', 'xen_pt.c',
Signature · 1 line
2.26.2
PATCH v3 3/7 accel/xen: Incorporate xen-mapcache.c
In reply to Philippe Mathieu-Daudéxen-mapcache.c contains accelerator related routines, not particular to the X86 HVM machine. Move this file to accel/xen/ (adapting the buildsys machinery).
---
meson.build | 3 +++
accel/xen/trace.h | 1 +
{hw/i386 => accel}/xen/xen-mapcache.c | 0
hw/i386/xen/xen-hvm.c | 1 -
accel/xen/meson.build | 5 ++++-
accel/xen/trace-events | 10 ++++++++++
hw/i386/xen/meson.build | 1 -
hw/i386/xen/trace-events | 6 ------
8 files changed, 18 insertions(+), 9 deletions(-)
create mode 100644 accel/xen/trace.h
rename {hw/i386 => accel}/xen/xen-mapcache.c (100%)
create mode 100644 accel/xen/trace-eventsmeson.build +3 -0
@@ -1706,6 +1706,9 @@ 'crypto', 'monitor', ] +if 'CONFIG_XEN' in accelerators + trace_events_subdirs += [ 'accel/xen' ] +endif if have_user trace_events_subdirs += [ 'linux-user' ] endif
accel/xen/trace.h new file +1 -0
@@ -0,0 +1 @@ +#include "trace/trace-accel_xen.h"
accel/xen/xen-mapcache.c renamed from hw/i386/xen/xen-mapcache.c +0 -0
hw/i386/xen/xen-hvm.c +0 -1
@@ -31,7 +31,6 @@#include "sysemu/runstate.h" #include "sysemu/sysemu.h" #include "sysemu/xen.h" -#include "sysemu/xen-mapcache.h" #include "trace.h" #include "exec/address-spaces.h"
accel/xen/meson.build +4 -1
@@ -1 +1,4 @@ -specific_ss.add(when: 'CONFIG_XEN', if_true: files('xen-all.c')) +specific_ss.add(when: 'CONFIG_XEN', if_true: files( + 'xen-all.c', + 'xen-mapcache.c', +))
accel/xen/trace-events new file +10 -0
@@ -0,0 +1,10 @@ +# See docs/devel/tracing.txt for syntax documentation. + +# xen-hvm.c +xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%lx, size 0x%lx" + +# xen-mapcache.c +xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 +xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 +xen_map_cache_return(void* ptr) "%p" +
hw/i386/xen/meson.build +0 -1
@@ -1,6 +1,5 @@ i386_ss.add(when: 'CONFIG_XEN', if_true: files( 'xen-hvm.c', - 'xen-mapcache.c', 'xen_apic.c', 'xen_platform.c', 'xen_pvdevice.c',
hw/i386/xen/trace-events +0 -6
@@ -20,9 +20,3 @@ cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint6 xen_map_resource_ioreq(uint32_t id, void *addr) "id: %u addr: %p" cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x" cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x" - -# xen-mapcache.c -xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 -xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 -xen_map_cache_return(void* ptr) "%p" -
Signature · 1 line
2.26.2
Re: [PATCH v3 3/7] accel/xen: Incorporate xen-mapcache.c
Quoted 18 lines · Philippe Mathieu-Daudé
xen-mapcache.ccontains accelerator related routines, not particular to the X86 HVM machine. Move this file to accel/xen/ (adapting the buildsys machinery).Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- meson.build | 3 +++ accel/xen/trace.h | 1 + {hw/i386 => accel}/xen/xen-mapcache.c | 0 hw/i386/xen/xen-hvm.c | 1 - accel/xen/meson.build | 5 ++++- accel/xen/trace-events | 10 ++++++++++ hw/i386/xen/meson.build | 1 - hw/i386/xen/trace-events | 6 ------ 8 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 accel/xen/trace.h rename {hw/i386 => accel}/xen/xen-mapcache.c (100%) create mode 100644 accel/xen/trace-events
...
accel/xen/trace-events line 4
Quoted 10 lines
accel/xen/trace-events new file +4
-0@@ -0,0 +1,10 @@ +# See docs/devel/tracing.txt for syntax documentation. + +# xen-hvm.c +xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%lx, size 0x%lx"
Self-Nack, this should not be here ^
Quoted 5 lines
accel/xen/trace-events new file +5
-0+ +# xen-mapcache.c +xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 +xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 +xen_map_cache_return(void* ptr) "%p"
PATCH v3 4/7 hw/i386/xen: Introduce XEN_FV Kconfig
In reply to Philippe Mathieu-DaudéIntroduce XEN_FV to differency the machine from the accelerator.
--- hw/i386/Kconfig | 2 ++ hw/i386/xen/Kconfig | 5 +++++ hw/i386/xen/meson.build | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 hw/i386/xen/Kconfig
hw/i386/Kconfig +2 -0
@@ -1,3 +1,5 @@ +source xen/Kconfig + config SEV bool depends on KVM
hw/i386/xen/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +config XEN_FV + bool + default y if XEN + depends on XEN + select I440FX
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_FV', if_true: files( 'xen-hvm.c', 'xen_apic.c', 'xen_platform.c',
Signature · 1 line
2.26.2
PATCH v3 5/7 hw/xen: Make xen_shutdown_fatal_error() available out of X86 HVM
In reply to Philippe Mathieu-Daudéxen_shutdown_fatal_error() is also used by XEN_PV.
This fixes when XEN_PV without XEN_FV:
/usr/bin/ld: libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt_config_init.c.o: in function `xen_pt_status_reg_init':
hw/xen/xen_pt_config_init.c:281: undefined reference to xen_shutdown_fatal_error' /usr/bin/ld: hw/xen/xen_pt_config_init.c:275: undefined reference to xen_shutdown_fatal_error' /usr/bin/ld: libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt.c.o: in function `xen_pt_pci_read_config':
hw/xen/xen_pt.c:220: undefined reference to `xen_shutdown_fatal_error'
/usr/bin/ld: libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt.c.o: in function `xen_pt_pci_write_config':
hw/xen/xen_pt.c:369: undefined reference to `xen_shutdown_fatal_error'
--- hw/i386/xen/xen-hvm.c | 13 ------------- hw/xen/xen-utils.c | 25 +++++++++++++++++++++++++ hw/xen/meson.build | 1 + 3 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 hw/xen/xen-utils.c
hw/i386/xen/xen-hvm.c +0 -13
@@ -28,7 +28,6 @@#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/range.h" -#include "sysemu/runstate.h" #include "sysemu/sysemu.h" #include "sysemu/xen.h" #include "trace.h"
@@ -1570,18 +1569,6 @@ void xen_register_framebuffer(MemoryRegion *mr) framebuffer = mr; } -void xen_shutdown_fatal_error (const char *fmt, ...) -{ -va_list ap; - -va_start (ap, fmt); -vfprintf (stderr, fmt, ap); -va_end (ap); -fprintf (stderr,"Will destroy the domain.\n" ); -/* destroy the domain */ -qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_ERROR ); -} -void xen_hvm_modified_memory (ram_addr_t start,ram_addr_t length) {if (unlikely (xen_in_migration)) {
hw/xen/xen-utils.c new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2010 Citrix Ltd. +* +* This work is licensed under the terms of the GNU GPL, version 2. See +* the COPYING file in the top-level directory. +* +* Contributions after 2012-01-13 are licensed under the terms of the +* GNU GPL, version 2 or (at your option) any later version. +*/ + +#include "qemu/osdep.h" +#include "sysemu/runstate.h" +#include "hw/xen/xen_common.h" + +void xen_shutdown_fatal_error (const char *fmt, ...) +{ +va_list ap; + +va_start (ap, fmt); +vfprintf (stderr, fmt, ap); +va_end (ap); +fprintf (stderr,"Will destroy the domain.\n" ); +/* destroy the domain */ +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_ERROR ); +}
hw/xen/meson.build +1 -0
@@ -4,6 +4,7 @@ 'xen-bus.c', 'xen_devconfig.c', 'xen_pvdev.c', + 'xen-utils.c', )) xen_specific_ss = ss.source_set()
Signature · 1 line
2.26.2
Re: [PATCH v3 5/7] hw/xen: Make xen_shutdown_fatal_error() available out of X86 HVM
Quoted 25 lines · Philippe Mathieu-Daudé
xen_shutdown_fatal_error()is also used byXEN_PV.This fixes when
XEN_PVwithoutXEN_FV:
/usr/bin/ld:libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt_config_init.c.o: in function `xen_pt_status_reg_init':
hw/xen/xen_pt_config_init.c:281: undefined reference toxen_shutdown_fatal_error' /usr/bin/ld: hw/xen/xen_pt_config_init.c:275: undefined reference toxen_shutdown_fatal_error'/usr/bin/ld:libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt.c.o: in function `xen_pt_pci_read_config':
hw/xen/xen_pt.c:220: undefined reference to `xen_shutdown_fatal_error'
/usr/bin/ld:libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt.c.o: in function `xen_pt_pci_write_config':
hw/xen/xen_pt.c:369: undefined reference to `xen_shutdown_fatal_error'Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/xen/xen-hvm.c | 13 ------------- hw/xen/xen-utils.c | 25 +++++++++++++++++++++++++ hw/xen/meson.build | 1 + 3 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 hw/xen/xen-utils.chw/i386/xen/xen-hvm.c +0
-0
hw/i386/xen/xen-hvm.c line 31
Quoted 4 lines
hw/i386/xen/xen-hvm.c +0
-1@@ -28,7 +28,6 @@#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/range.h" -#include "sysemu/runstate.h"
^ self-nack, was not supposed to remove this.
Quoted 6 lines
hw/i386/xen/xen-hvm.c +0
-0#include "sysemu/sysemu.h" #include "sysemu/xen.h" #include "trace.h" @@ -1570,18 +1569,6 @@ void xen_register_framebuffer(MemoryRegion *mr) framebuffer = mr; }
PATCH v3 6/7 hw/xen: Make qmp_xen_set_global_dirty_log() available out of X86 HVM
In reply to Philippe Mathieu-Daudéqmp_xen_set_global_dirty_log() is also used by XEN_PV.
This fixes when XEN_PV without XEN_FV:
/usr/bin/ld: libqemuutil.a(meson-generated_.._qapi_qapi-commands-migration.c.o): in function `qmp_marshal_xen_set_global_dirty_log':
qapi/qapi-commands-migration.c:626: undefined reference to `qmp_xen_set_global_dirty_log'
--- hw/i386/xen/xen-hvm.c | 10 ---------- hw/xen/xen-migration.c | 22 ++++++++++++++++++++++ hw/xen/meson.build | 1 + 3 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 hw/xen/xen-migration.c
hw/i386/xen/xen-hvm.c +0 -10
@@ -24,7 +24,6 @@#include "hw/xen/xen-bus.h" #include "hw/xen/xen-x86.h" #include "qapi/error.h" -#include "qapi/qapi-commands-migration.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/range.h"
@@ -1591,12 +1590,3 @@ void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) } } } - -void qmp_xen_set_global_dirty_log (bool enable,Error **errp) -{ -if (enable) { -memory_global_dirty_log_start (); - }else { -memory_global_dirty_log_stop (); - } -}
hw/xen/xen-migration.c new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Copyright (C) 2010 Citrix Ltd. +* +* This work is licensed under the terms of the GNU GPL, version 2. See +* the COPYING file in the top-level directory. +* +* Contributions after 2012-01-13 are licensed under the terms of the +* GNU GPL, version 2 or (at your option) any later version. +*/ + +#include "qemu/osdep.h" +#include "exec/memory.h" +#include "qapi/qapi-commands-migration.h" + +void qmp_xen_set_global_dirty_log (bool enable,Error **errp) +{ +if (enable) { +memory_global_dirty_log_start (); + }else { +memory_global_dirty_log_stop (); + } +}
hw/xen/meson.build +1 -0
@@ -4,6 +4,7 @@ 'xen-bus.c', 'xen_devconfig.c', 'xen_pvdev.c', + 'xen-migration.c', 'xen-utils.c', ))
Signature · 1 line
2.26.2
PATCH v3 7/7 NOTFORMERGE hw/xen/Kconfig: Introduce XEN_PV config
In reply to Philippe Mathieu-Daudéxenpv machine requires USB, IDE_PIIX and PCI:
/usr/bin/ld:
libcommon.fa.p/hw_xen_xen-legacy-backend.c.o: in function `xen_be_register_common':
hw/xen/xen-legacy-backend.c:757: undefined reference to xen_usb_ops' libqemu-i386-softmmu.fa.p/hw_i386_xen_xen_platform.c.o: in function unplug_disks':
hw/i386/xen/xen_platform.c:153: undefined reference to pci_piix3_xen_ide_unplug' libqemu-i386-softmmu.fa.p/hw_i386_xen_xen_platform.c.o: in function pci_unplug_nics':
hw/i386/xen/xen_platform.c:137: undefined reference to pci_for_each_device' libqemu-i386-softmmu.fa.p/hw_i386_xen_xen_platform.c.o: in function xen_platform_realize':
hw/i386/xen/xen_platform.c:483: undefined reference to `pci_register_bar'
---
Unfinished:
/usr/bin/ld: libqemu-x86_64-softmmu.fa.p/softmmu_physmem.c.o: in function `cpu_physical_memory_set_dirty_range':include/exec/ram_addr.h:333: undefined reference to `xen_hvm_modified_memory'/usr/bin/ld: libqemu-x86_64-softmmu.fa.p/softmmu_physmem.c.o: in function `ram_block_add':softmmu/physmem.c:1873: undefined reference to xen_ram_alloc' /usr/bin/ld: libqemu-x86_64-softmmu.fa.p/softmmu_physmem.c.o: in function cpu_physical_memory_set_dirty_range':include/exec/ram_addr.h:333: undefined reference to `xen_hvm_modified_memory'/usr/bin/ld: include/exec/ram_addr.h:333: undefined reference to `xen_hvm_modified_memory'/usr/bin/ld: libqemu-x86_64-softmmu.fa.p/softmmu_memory.c.o: in function `cpu_physical_memory_set_dirty_range':include/exec/ram_addr.h:333: undefined reference to `xen_hvm_modified_memory'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
TODO another day: Paolo's suggestion:
"modify xen_hvm_modified_memory to become a virtual function in AccelClass."
--- hw/Kconfig | 1 + hw/xen/Kconfig | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 hw/xen/Kconfig
hw/Kconfig +1 -0
@@ -39,6 +39,7 @@ source usb/Kconfig source virtio/Kconfig source vfio/Kconfig source watchdog/Kconfig +source xen/Kconfig # arch Kconfig source arm/Kconfig
hw/xen/Kconfig new file +7 -0
@@ -0,0 +1,7 @@ +config XEN_PV + bool + default y if XEN + depends on XEN + select PCI + select USB + select IDE_PIIX
Signature · 1 line
2.26.2