Xen Queue
From: "Edgar E. Iglesias" <[email protected]>
The following changes since commit 423be09ab9492735924e73a2d36069784441ebc6:
Merge tag 'warn-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2024-10-03 10:32:54 +0100)
are available in the Git repository at:
https://gitlab.com/edgar.iglesias/qemu.git tags/edgar/xen-queue-2024-10-03.for-upstream
for you to fetch changes up to 507118c2a066b70e8069702c120461ad8c98ccd5:
hw/arm: xenpvh: Enable PCI for ARM PVH (2024-10-03 15:24:42 +0200)
----------------------------------------------------------------
Edgars Xen Queue.
----------------------------------------------------------------
Dr. David Alan Gilbert (1):
hw/xen: Remove deadcode
Edgar E. Iglesias (4):
hw/xen: Expose handle_bufioreq in xen_register_ioreq hw/xen: xenpvh: Disable buffered IOREQs for ARM hw/xen: xenpvh: Add pci-intx-irq-base property hw/arm: xenpvh: Enable PCI for ARM PVH
hw/arm/xen-pvh.c | 17 ++++++ hw/i386/xen/xen-hvm.c | 4 +- hw/i386/xen/xen-pvh.c | 3 ++ hw/xen/xen-hvm-common.c | 101 ++++++++++++++++++++++-------------- hw/xen/xen-legacy-backend.c | 18 ------- hw/xen/xen-pvh-common.c | 40 +++++++++++++- hw/xen/xen_devconfig.c | 8 --- include/hw/xen/xen-hvm-common.h | 3 ++ include/hw/xen/xen-legacy-backend.h | 5 -- include/hw/xen/xen-pvh-common.h | 3 ++ include/hw/xen/xen_native.h | 3 +- 11 files changed, 133 insertions(+), 72 deletions(-)
Signature · 1 line
2.43.0
[PULL v1 1/5] hw/xen: Remove deadcode
From: "Dr. David Alan Gilbert" <[email protected]>
xen_be_copy_grant_refs is unused since 2019's
19f87870ba ("xen: remove the legacy 'xen_disk' backend")
xen_config_dev_console is unused since 2018's
6d7c06c213 ("Remove broken Xen PV domain builder")
Remove them.
--- hw/xen/xen-legacy-backend.c | 18 ------------------ hw/xen/xen_devconfig.c | 8 -------- include/hw/xen/xen-legacy-backend.h | 5 ----- 3 files changed, 31 deletions(-)
hw/xen/xen-legacy-backend.c +0 -18
@@ -147,24 +147,6 @@ void xen_be_unmap_grant_refs(struct XenLegacyDevice *xendev, void *ptr, } } -int xen_be_copy_grant_refs (struct XenLegacyDevice *xendev, -bool to_domain, -XenGrantCopySegment segs[], -unsigned int nr_segs) -{ -int rc; - -assert (xendev->ops->flags &DEVOPS_FLAG_NEED_GNTDEV ); - - rc =qemu_xen_gnttab_grant_copy (xendev->gnttabdev, to_domain, xen_domid, - segs, nr_segs,NULL ); -if (rc) { -xen_pv_printf (xendev,0 ,"xengnttab_grant_copy failed: %s\n" , -strerror (-rc)); - } -return rc; -} -/* * get xen backend device, allocate a new one if it doesn't exist. */
hw/xen/xen_devconfig.c +0 -8
@@ -66,11 +66,3 @@ int xen_config_dev_vkbd(int vdev)xen_config_dev_dirs ("vkbd" ,"vkbd" , vdev, fe, be,sizeof (fe));return xen_config_dev_all (fe, be); } - -int xen_config_dev_console (int vdev) -{ -char fe[256 ], be[256 ]; - -xen_config_dev_dirs ("console" ,"console" , vdev, fe, be,sizeof (fe)); -return xen_config_dev_all (fe, be); -}
include/hw/xen/xen-legacy-backend.h +0 -5
@@ -50,10 +50,6 @@ void *xen_be_map_grant_refs(struct XenLegacyDevice *xendev, uint32_t *refs,void xen_be_unmap_grant_refs (struct XenLegacyDevice *xendev,void *ptr,uint32_t *refs,unsigned int nr_refs); -int xen_be_copy_grant_refs (struct XenLegacyDevice *xendev, -bool to_domain,XenGrantCopySegment segs[], -unsigned int nr_segs); -static inline void *xen_be_map_grant_ref (struct XenLegacyDevice *xendev,uint32_t ref,int prot) {
@@ -70,6 +66,5 @@ static inline void xen_be_unmap_grant_ref(struct XenLegacyDevice *xendev,void xen_config_cleanup (void );int xen_config_dev_vfb (int vdev,const char *type);int xen_config_dev_vkbd (int vdev); -int xen_config_dev_console (int vdev);#endif /* HW_XEN_LEGACY_BACKEND_H */
Signature · 1 line
2.43.0
[PULL v1 2/5] hw/xen: Expose handle_bufioreq in xen_register_ioreq
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
Expose handle_bufioreq in xen_register_ioreq().
This is to allow machines to enable or disable buffered ioreqs.
No functional change since all callers still set it to HVM_IOREQSRV_BUFIOREQ_ATOMIC.
--- hw/i386/xen/xen-hvm.c | 4 +- hw/xen/xen-hvm-common.c | 101 ++++++++++++++++++++------------ hw/xen/xen-pvh-common.c | 4 +- include/hw/xen/xen-hvm-common.h | 3 + include/hw/xen/xen_native.h | 3 +- 5 files changed, 74 insertions(+), 41 deletions(-)
hw/i386/xen/xen-hvm.c +3 -1
@@ -614,7 +614,9 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) state =g_new0 (XenIOState,1 ); -xen_register_ioreq (state, max_cpus, &xen_memory_listener); +xen_register_ioreq (state, max_cpus, +HVM_IOREQSRV_BUFIOREQ_ATOMIC , + &xen_memory_listener); xen_is_stubdomain =xen_check_stubdomain (state->xenstore);
hw/xen/xen-hvm-common.c +63 -38
155 lines not on this page · raw message
hw/xen/xen-pvh-common.c +3 -1
@@ -194,7 +194,9 @@ static void xen_pvh_init(MachineState *ms) }xen_pvh_init_ram (s, sysmem); -xen_register_ioreq (&s->ioreq, ms->smp.max_cpus, &xen_memory_listener); +xen_register_ioreq (&s->ioreq, ms->smp.max_cpus, +HVM_IOREQSRV_BUFIOREQ_ATOMIC , + &xen_memory_listener);if (s->cfg.virtio_mmio_num) {xen_create_virtio_mmio_devices (s);
include/hw/xen/xen-hvm-common.h +3 -0
@@ -81,6 +81,8 @@ typedef struct XenIOState { QLIST_HEAD(, XenPciDevice) dev_list;DeviceListener device_listener; +bool has_bufioreq; +Notifier exit; } XenIOState;
@@ -95,6 +97,7 @@ void xen_device_unrealize(DeviceListener *listener, DeviceState *dev);void xen_hvm_change_state_handler (void *opaque,bool running,RunState rstate);void xen_register_ioreq (XenIOState *state,unsigned int max_cpus, +uint8_t handle_bufioreq,const MemoryListener *xen_memory_listener);void cpu_ioreq_pio (ioreq_t *req);
include/hw/xen/xen_native.h +2 -1
@@ -464,10 +464,11 @@ static inline void xen_unmap_pcidev(domid_t dom, }static inline int xen_create_ioreq_server (domid_t dom, +int handle_bufioreq,ioservid_t *ioservid) {int rc =xendevicemodel_create_ioreq_server (xen_dmod, dom, -HVM_IOREQSRV_BUFIOREQ_ATOMIC , + handle_bufioreq, ioservid);if (rc ==0 ) {
Signature · 1 line
2.43.0
[PULL v1 4/5] hw/xen: xenpvh: Add pci-intx-irq-base property
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
--- hw/xen/xen-pvh-common.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
hw/xen/xen-pvh-common.c +36 -0
@@ -218,6 +218,11 @@ static void xen_pvh_init(MachineState *ms)error_report ("pci-ecam-size only supports values 0 or 0x10000000" );exit (EXIT_FAILURE ); } +if (!s->cfg.pci_intx_irq_base) { +error_report ("PCI enabled but pci-intx-irq-base not set" ); +exit (EXIT_FAILURE ); + } +xenpvh_gpex_init (s, xpc, sysmem); }
@@ -273,6 +278,30 @@ XEN_PVH_PROP_MEMMAP(pci_ecam)XEN_PVH_PROP_MEMMAP (pci_mmio)XEN_PVH_PROP_MEMMAP (pci_mmio_high) +static void xen_pvh_set_pci_intx_irq_base (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ + XenPVHMachineState *xp = XEN_PVH_MACHINE(obj); +uint32_t value; + + if (!visit_type_uint32(v, name, &value, errp)) { +return ; + } + + xp->cfg.pci_intx_irq_base = value; +} + +static void xen_pvh_get_pci_intx_irq_base (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +XenPVHMachineState *xp =XEN_PVH_MACHINE (obj); +uint32_t value = xp->cfg.pci_intx_irq_base; + +visit_type_uint32 (v, name, &value, errp); +} +void xen_pvh_class_setup_common_props (XenPVHMachineClass *xpc) {ObjectClass *oc =OBJECT_CLASS (xpc);
@@ -318,6 +347,13 @@ do { \OC_MEMMAP_PROP (oc,"pci-ecam" , pci_ecam);OC_MEMMAP_PROP (oc,"pci-mmio" , pci_mmio);OC_MEMMAP_PROP (oc,"pci-mmio-high" , pci_mmio_high); + +object_class_property_add (oc,"pci-intx-irq-base" ,"uint32_t" , + xen_pvh_get_pci_intx_irq_base, + xen_pvh_set_pci_intx_irq_base, +NULL ,NULL ); +object_class_property_set_description (oc,"pci-intx-irq-base" , +"Set PCI INTX interrupt base line." ); }#ifdef CONFIG_TPM
Signature · 1 line
2.43.0
[PULL v1 3/5] hw/xen: xenpvh: Disable buffered IOREQs for ARM
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
Add a way to enable/disable buffered IOREQs for PVH machines and disable them for ARM. ARM does not support buffered IOREQ's nor the legacy way to map IOREQ info pages.
See the following for more details:
https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=2fbd7e609e1803ac5e5c26e22aa8e4b5a6cddbb1
https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/arm/ioreq.c;h=2e829d2e7f3760401b96fa7c930e2015fb1cf463;hb=HEAD#l138
--- hw/arm/xen-pvh.c | 3 +++ hw/i386/xen/xen-pvh.c | 3 +++ hw/xen/xen-pvh-common.c | 2 +- include/hw/xen/xen-pvh-common.h | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-)
hw/arm/xen-pvh.c +3 -0
@@ -66,6 +66,9 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data)*/ mc->max_cpus =GUEST_MAX_VCPUS ; +/* Xen/ARM does not use buffered IOREQs. */ + xpc->handle_bufioreq =HVM_IOREQSRV_BUFIOREQ_OFF ; +/* List of supported features known to work on PVH ARM. */ xpc->has_tpm = true; xpc->has_virtio_mmio = true;
hw/i386/xen/xen-pvh.c +3 -0
@@ -89,6 +89,9 @@ static void xen_pvh_machine_class_init(ObjectClass *oc, void *data)/* We have an implementation specific init to create CPU objects. */ xpc->init = xen_pvh_init; +/* Enable buffered IOREQs. */ + xpc->handle_bufioreq =HVM_IOREQSRV_BUFIOREQ_ATOMIC ; +/* * PCI INTX routing. *
hw/xen/xen-pvh-common.c +1 -1
@@ -195,7 +195,7 @@ static void xen_pvh_init(MachineState *ms)xen_pvh_init_ram (s, sysmem);xen_register_ioreq (&s->ioreq, ms->smp.max_cpus, -HVM_IOREQSRV_BUFIOREQ_ATOMIC , + xpc->handle_bufioreq, &xen_memory_listener);if (s->cfg.virtio_mmio_num) {
include/hw/xen/xen-pvh-common.h +3 -0
@@ -43,6 +43,9 @@ struct XenPVHMachineClass {*/ int (*set_pci_link_route)(uint8_t line,uint8_t irq); +/* Allow implementations to optionally enable buffered ioreqs. */ +uint8_t handle_bufioreq; +/* * Each implementation can optionally enable features that it * supports and are known to work.
Signature · 1 line
2.43.0
[PULL v1 5/5] hw/arm: xenpvh: Enable PCI for ARM PVH
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
Enable PCI support for the ARM Xen PVH machine.
--- hw/arm/xen-pvh.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
hw/arm/xen-pvh.c +14 -0
@@ -39,6 +39,16 @@ static void xen_arm_instance_init(Object *obj) VIRTIO_MMIO_DEV_SIZE }; } +static void xen_pvh_set_pci_intx_irq (void *opaque,int intx_irq,int level) +{ +XenPVHMachineState *s =XEN_PVH_MACHINE (opaque); +int irq = s->cfg.pci_intx_irq_base + intx_irq; + +if (xendevicemodel_set_irq_level (xen_dmod, xen_domid, irq, level)) { +error_report ("xendevicemodel_set_pci_intx_level failed" ); + } +} +static void xen_arm_machine_class_init (ObjectClass *oc,void *data) {XenPVHMachineClass *xpc =XEN_PVH_MACHINE_CLASS (oc);
@@ -69,7 +79,11 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data)/* Xen/ARM does not use buffered IOREQs. */ xpc->handle_bufioreq =HVM_IOREQSRV_BUFIOREQ_OFF ; +/* PCI INTX delivery. */ + xpc->set_pci_intx_irq = xen_pvh_set_pci_intx_irq; +/* List of supported features known to work on PVH ARM. */ + xpc->has_pci = true; xpc->has_tpm = true; xpc->has_virtio_mmio = true;
Signature · 1 line
2.43.0
Quoted 22 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
The following changes since commit
423be09ab9492735924e73a2d36069784441ebc6:Merge tag 'warn-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2024-10-03 10:32:54 +0100)
are available in the Git repository at:
https://gitlab.com/edgar.iglesias/qemu.git tags/edgar/xen-queue-2024-10-03.for-upstream
for you to fetch changes up to
507118c2a066b70e8069702c120461ad8c98ccd5:hw/arm: xenpvh: Enable PCI for ARM PVH (2024-10-03 15:24:42 +0200)
----------------------------------------------------------------
Edgars Xen Queue.----------------------------------------------------------------
Dr. David Alan Gilbert (1):
hw/xen: Remove deadcode
Quoted 5 lines
Edgar E. Iglesias (4):
hw/xen: Exposehandle_bufioreqinxen_register_ioreqhw/xen: xenpvh: Disable buffered IOREQs for ARM hw/xen: xenpvh: Add pci-intx-irq-base property hw/arm: xenpvh: Enable PCI for ARM PVH
Hi; this failed the tsan-build CI job:
https://gitlab.com/qemu-project/qemu/-/jobs/7986783747
../hw/xen/xen-hvm-common.c:711:48: error: variable 'ioreq_pfn' is uninitialized when used here [-Werror,-Wuninitialized]
trace_xen_map_ioreq_server_shared_page(ioreq_pfn);
^~~~~~~~~
../hw/xen/xen-hvm-common.c:667:24: note: initialize the variable
'ioreq_pfn' to silence this warning
xen_pfn_t ioreq_pfn;
^
= 0thanks
-- PMM
Quoted 35 lines · Peter Maydell
Quoted 22 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
The following changes since commit
423be09ab9492735924e73a2d36069784441ebc6:Merge tag 'warn-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2024-10-03 10:32:54 +0100)
are available in the Git repository at:
https://gitlab.com/edgar.iglesias/qemu.git tags/edgar/xen-queue-2024-10-03.for-upstream
for you to fetch changes up to
507118c2a066b70e8069702c120461ad8c98ccd5:hw/arm: xenpvh: Enable PCI for ARM PVH (2024-10-03 15:24:42 +0200)
----------------------------------------------------------------
Edgars Xen Queue.----------------------------------------------------------------
Dr. David Alan Gilbert (1):
hw/xen: Remove deadcodeQuoted 5 lines
Edgar E. Iglesias (4):
hw/xen: Exposehandle_bufioreqinxen_register_ioreqhw/xen: xenpvh: Disable buffered IOREQs for ARM hw/xen: xenpvh: Add pci-intx-irq-base property hw/arm: xenpvh: Enable PCI for ARM PVHHi; this failed the tsan-build CI job:
https://gitlab.com/qemu-project/qemu/-/jobs/7986783747
../hw/xen/xen-hvm-common.c:711:48: error: variable 'ioreq_pfn' is uninitialized when used here [-Werror,-Wuninitialized]
Quoted 8 lines
trace_xen_map_ioreq_server_shared_page(ioreq_pfn);
^~~~~~~~~
../hw/xen/xen-hvm-common.c:667:24: note: initialize the variable
'ioreq_pfn' to silence this warning
xen_pfn_t ioreq_pfn;
^
= 0Thanks Peter,
I had moved that trace call but forgot to remove the original line. Will send a v2 PR.
Cheers,
Edgar