mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 19:14:58 -06:00
Enable PV backends with Xen/KVM emulation
This is phase 2, following on from the basic platform support which was already merged. • Add a simple single-tenant internal XenStore implementation • Indirect Xen gnttab/evtchn/foreignmem/xenstore through operations table • Provide emulated back ends for Xen operations • Header cleanups to allow PV back ends to build without Xen itself • Enable PV back ends in emulated mode • Documentation update Tested-by: Paul Durrant <paul@xen.org> ... on real Xen (master branch, 4.18) with a Debian guest. -----BEGIN PGP SIGNATURE----- iQJGBAABCgAwFiEEMUsIrNDeSBEzpfKGm+mA/QrAFUQFAmQHu3wSHGR3bXdAYW1h em9uLmNvLnVrAAoJEJvpgP0KwBVE5LYP/0VodDsQdP7Z4L+/IzgBSgEec7qmyQFB KlBZS/PmvCZKb0DHLI3GhXIyzD+/fnLtGSRl0rYObnKP7im+MpEDGmn97f6nIITk AzkdsVhNEBQFXCkLgQ9y8kTrTmsod9O4sqn0+naa2TX4FPcRN0MaNmpuLEubvaRS +JuyHmwy9ZeeAnsU31uJ0nx4F1hW9IDaatNoDeFcFnKCXQp36rtdZUViMowUJvwu Q+Xyg6dybusznaoiXd485tTPrTt+FK/wEARse3q2gRh9QblLu0r5BFb0rOfhYCTQ jw+5lBsOX+UlffmB9IDakRpVe4RKhvvRQSkRvYkPCshsqud9zMGhaquKg1vKBgca I31XSN0LCcon/ahHGtmVAxyZUpWdEnfzO1TbTNpz9oacROklgVgEYdw5Vwca71VD SURl6uCt9Jb9WmsR4twus4i4qDjQIDOtOF0hcxpl7HGktkxlGxUVI4qVLXARtVCS OTB6N0LlhJ2woj2wYK5BRTiOj03T2MkJEWaYhDdIrQREKWe2Sn4xTOH5kGbQQnOr km93odjBZFRHsAUnzXHXW3+yHjMefH7KrHePbmvsO4foGF77bBxosuC2ehFfvNJ0 VM/H04NDtPYCBwdAr545PSN/q+WzEPQaquLZ0UuTBuPpMMOYd+Ff8YvQWJPyCM18 1mq9v6Xe9RQZ =JGLX -----END PGP SIGNATURE----- Merge tag 'xenfv-2' of git://git.infradead.org/users/dwmw2/qemu into staging Enable PV backends with Xen/KVM emulation This is phase 2, following on from the basic platform support which was already merged. • Add a simple single-tenant internal XenStore implementation • Indirect Xen gnttab/evtchn/foreignmem/xenstore through operations table • Provide emulated back ends for Xen operations • Header cleanups to allow PV back ends to build without Xen itself • Enable PV back ends in emulated mode • Documentation update Tested-by: Paul Durrant <paul@xen.org> ... on real Xen (master branch, 4.18) with a Debian guest. # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCgAwFiEEMUsIrNDeSBEzpfKGm+mA/QrAFUQFAmQHu3wSHGR3bXdAYW1h # em9uLmNvLnVrAAoJEJvpgP0KwBVE5LYP/0VodDsQdP7Z4L+/IzgBSgEec7qmyQFB # KlBZS/PmvCZKb0DHLI3GhXIyzD+/fnLtGSRl0rYObnKP7im+MpEDGmn97f6nIITk # AzkdsVhNEBQFXCkLgQ9y8kTrTmsod9O4sqn0+naa2TX4FPcRN0MaNmpuLEubvaRS # +JuyHmwy9ZeeAnsU31uJ0nx4F1hW9IDaatNoDeFcFnKCXQp36rtdZUViMowUJvwu # Q+Xyg6dybusznaoiXd485tTPrTt+FK/wEARse3q2gRh9QblLu0r5BFb0rOfhYCTQ # jw+5lBsOX+UlffmB9IDakRpVe4RKhvvRQSkRvYkPCshsqud9zMGhaquKg1vKBgca # I31XSN0LCcon/ahHGtmVAxyZUpWdEnfzO1TbTNpz9oacROklgVgEYdw5Vwca71VD # SURl6uCt9Jb9WmsR4twus4i4qDjQIDOtOF0hcxpl7HGktkxlGxUVI4qVLXARtVCS # OTB6N0LlhJ2woj2wYK5BRTiOj03T2MkJEWaYhDdIrQREKWe2Sn4xTOH5kGbQQnOr # km93odjBZFRHsAUnzXHXW3+yHjMefH7KrHePbmvsO4foGF77bBxosuC2ehFfvNJ0 # VM/H04NDtPYCBwdAr545PSN/q+WzEPQaquLZ0UuTBuPpMMOYd+Ff8YvQWJPyCM18 # 1mq9v6Xe9RQZ # =JGLX # -----END PGP SIGNATURE----- # gpg: Signature made Tue 07 Mar 2023 22:32:28 GMT # gpg: using RSA key 314B08ACD0DE481133A5F2869BE980FD0AC01544 # gpg: issuer "dwmw@amazon.co.uk" # gpg: Good signature from "David Woodhouse <dwmw@amazon.co.uk>" [unknown] # gpg: aka "David Woodhouse <dwmw@amazon.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 314B 08AC D0DE 4811 33A5 F286 9BE9 80FD 0AC0 1544 * tag 'xenfv-2' of git://git.infradead.org/users/dwmw2/qemu: (27 commits) docs: Update Xen-on-KVM documentation for PV disk support MAINTAINERS: Add entry for Xen on KVM emulation i386/xen: Initialize Xen backends from pc_basic_device_init() for emulation hw/xen: Implement soft reset for emulated gnttab hw/xen: Map guest XENSTORE_PFN grant in emulated Xenstore hw/xen: Add emulated implementation of XenStore operations hw/xen: Add emulated implementation of grant table operations hw/xen: Hook up emulated implementation for event channel operations hw/xen: Only advertise ring-page-order for xen-block if gnttab supports it hw/xen: Avoid crash when backend watch fires too early hw/xen: Build PV backend drivers for CONFIG_XEN_BUS hw/xen: Rename xen_common.h to xen_native.h hw/xen: Use XEN_PAGE_SIZE in PV backend drivers hw/xen: Move xenstore_store_pv_console_info to xen_console.c hw/xen: Add xenstore operations to allow redirection to internal emulation hw/xen: Add foreignmem operations to allow redirection to internal emulation hw/xen: Pass grant ref to gnttab unmap operation hw/xen: Add gnttab operations to allow redirection to internal emulation hw/xen: Add evtchn operations to allow redirection to internal emulation hw/xen: Create initial XenStore nodes ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
15002921e8
53 changed files with 5811 additions and 934 deletions
|
@ -84,6 +84,6 @@ if libusb.found()
|
|||
hw_usb_modules += {'host': usbhost_ss}
|
||||
endif
|
||||
|
||||
softmmu_ss.add(when: ['CONFIG_USB', 'CONFIG_XEN', libusb], if_true: files('xen-usb.c'))
|
||||
softmmu_ss.add(when: ['CONFIG_USB', 'CONFIG_XEN_BUS', libusb], if_true: files('xen-usb.c'))
|
||||
|
||||
modules += { 'hw-usb': hw_usb_modules }
|
||||
|
|
|
@ -101,6 +101,8 @@ struct usbback_hotplug {
|
|||
struct usbback_info {
|
||||
struct XenLegacyDevice xendev; /* must be first */
|
||||
USBBus bus;
|
||||
uint32_t urb_ring_ref;
|
||||
uint32_t conn_ring_ref;
|
||||
void *urb_sring;
|
||||
void *conn_sring;
|
||||
struct usbif_urb_back_ring urb_ring;
|
||||
|
@ -159,7 +161,7 @@ static int usbback_gnttab_map(struct usbback_req *usbback_req)
|
|||
|
||||
for (i = 0; i < nr_segs; i++) {
|
||||
if ((unsigned)usbback_req->req.seg[i].offset +
|
||||
(unsigned)usbback_req->req.seg[i].length > XC_PAGE_SIZE) {
|
||||
(unsigned)usbback_req->req.seg[i].length > XEN_PAGE_SIZE) {
|
||||
xen_pv_printf(xendev, 0, "segment crosses page boundary\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -183,7 +185,7 @@ static int usbback_gnttab_map(struct usbback_req *usbback_req)
|
|||
|
||||
for (i = 0; i < usbback_req->nr_buffer_segs; i++) {
|
||||
seg = usbback_req->req.seg + i;
|
||||
addr = usbback_req->buffer + i * XC_PAGE_SIZE + seg->offset;
|
||||
addr = usbback_req->buffer + i * XEN_PAGE_SIZE + seg->offset;
|
||||
qemu_iovec_add(&usbback_req->packet.iov, addr, seg->length);
|
||||
}
|
||||
}
|
||||
|
@ -277,10 +279,11 @@ static int usbback_init_packet(struct usbback_req *usbback_req)
|
|||
static void usbback_do_response(struct usbback_req *usbback_req, int32_t status,
|
||||
int32_t actual_length, int32_t error_count)
|
||||
{
|
||||
uint32_t ref[USBIF_MAX_SEGMENTS_PER_REQUEST];
|
||||
struct usbback_info *usbif;
|
||||
struct usbif_urb_response *res;
|
||||
struct XenLegacyDevice *xendev;
|
||||
unsigned int notify;
|
||||
unsigned int notify, i;
|
||||
|
||||
usbif = usbback_req->usbif;
|
||||
xendev = &usbif->xendev;
|
||||
|
@ -293,13 +296,19 @@ static void usbback_do_response(struct usbback_req *usbback_req, int32_t status,
|
|||
}
|
||||
|
||||
if (usbback_req->buffer) {
|
||||
xen_be_unmap_grant_refs(xendev, usbback_req->buffer,
|
||||
for (i = 0; i < usbback_req->nr_buffer_segs; i++) {
|
||||
ref[i] = usbback_req->req.seg[i].gref;
|
||||
}
|
||||
xen_be_unmap_grant_refs(xendev, usbback_req->buffer, ref,
|
||||
usbback_req->nr_buffer_segs);
|
||||
usbback_req->buffer = NULL;
|
||||
}
|
||||
|
||||
if (usbback_req->isoc_buffer) {
|
||||
xen_be_unmap_grant_refs(xendev, usbback_req->isoc_buffer,
|
||||
for (i = 0; i < usbback_req->nr_extra_segs; i++) {
|
||||
ref[i] = usbback_req->req.seg[i + usbback_req->req.nr_buffer_segs].gref;
|
||||
}
|
||||
xen_be_unmap_grant_refs(xendev, usbback_req->isoc_buffer, ref,
|
||||
usbback_req->nr_extra_segs);
|
||||
usbback_req->isoc_buffer = NULL;
|
||||
}
|
||||
|
@ -832,11 +841,11 @@ static void usbback_disconnect(struct XenLegacyDevice *xendev)
|
|||
xen_pv_unbind_evtchn(xendev);
|
||||
|
||||
if (usbif->urb_sring) {
|
||||
xen_be_unmap_grant_ref(xendev, usbif->urb_sring);
|
||||
xen_be_unmap_grant_ref(xendev, usbif->urb_sring, usbif->urb_ring_ref);
|
||||
usbif->urb_sring = NULL;
|
||||
}
|
||||
if (usbif->conn_sring) {
|
||||
xen_be_unmap_grant_ref(xendev, usbif->conn_sring);
|
||||
xen_be_unmap_grant_ref(xendev, usbif->conn_sring, usbif->conn_ring_ref);
|
||||
usbif->conn_sring = NULL;
|
||||
}
|
||||
|
||||
|
@ -889,10 +898,12 @@ static int usbback_connect(struct XenLegacyDevice *xendev)
|
|||
return -1;
|
||||
}
|
||||
|
||||
usbif->urb_ring_ref = urb_ring_ref;
|
||||
usbif->conn_ring_ref = conn_ring_ref;
|
||||
urb_sring = usbif->urb_sring;
|
||||
conn_sring = usbif->conn_sring;
|
||||
BACK_RING_INIT(&usbif->urb_ring, urb_sring, XC_PAGE_SIZE);
|
||||
BACK_RING_INIT(&usbif->conn_ring, conn_sring, XC_PAGE_SIZE);
|
||||
BACK_RING_INIT(&usbif->urb_ring, urb_sring, XEN_PAGE_SIZE);
|
||||
BACK_RING_INIT(&usbif->conn_ring, conn_sring, XEN_PAGE_SIZE);
|
||||
|
||||
xen_be_bind_evtchn(xendev);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue