File 0097-xen-add-a-meaningful-declaration-of.patch of Package qemu-linux-user.13114
From 475f3287ac8dbc1537fa28ff595ec57f3b6bbd0f Mon Sep 17 00:00:00 2001
From: Paul Durrant <paul.durrant@citrix.com>
Date: Thu, 17 May 2018 16:35:50 +0100
Subject: [PATCH] xen: add a meaningful declaration of grant_copy_segment into
xen_common.h
Currently the xen_disk source has to carry #ifdef exclusions to compile
against Xen older then 4.8. This is a bit messy so this patch lifts the
definition of struct xengnttab_grant_copy_segment and adds it into the
pre-4.8 compat area in xen_common.h, which allows xen_disk to be cleaned
up.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 5c0d914a9ba9e0641554d127b62859ac0e954b9e)
[LD: BSC#1100408 - Modified as the Xen interface versioning has changed]
Signed-off-by: Larry Dewey <ldewey@suse.com>
---
hw/block/xen_disk.c | 18 ------------------
include/hw/xen/xen_common.h | 17 +++++++++++++++--
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index 3556ceb6a2..fcbe0f8c81 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -492,8 +492,6 @@ static int ioreq_map(struct ioreq *ioreq)
return 0;
}
-#if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40800
-
static void ioreq_free_copy_buffers(struct ioreq *ioreq)
{
int i;
@@ -575,22 +573,6 @@ static int ioreq_grant_copy(struct ioreq *ioreq)
return rc;
}
-#else
-static void ioreq_free_copy_buffers(struct ioreq *ioreq)
-{
- abort();
-}
-
-static int ioreq_init_copy_buffers(struct ioreq *ioreq)
-{
- abort();
-}
-
-static int ioreq_grant_copy(struct ioreq *ioreq)
-{
- abort();
-}
-#endif
static int ioreq_runio_qemu_aio(struct ioreq *ioreq);
diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h
index 86c7f26106..cf5a296b11 100644
--- a/include/hw/xen/xen_common.h
+++ b/include/hw/xen/xen_common.h
@@ -670,8 +670,21 @@ static inline int xen_domain_create(xc_interface *xc, uint32_t ssidref,
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40800
-
-typedef void *xengnttab_grant_copy_segment_t;
+struct xengnttab_grant_copy_segment {
+ union xengnttab_copy_ptr {
+ void *virt;
+ struct {
+ uint32_t ref;
+ uint16_t offset;
+ uint16_t domid;
+ } foreign;
+ } source, dest;
+ uint16_t len;
+ uint16_t flags;
+ int16_t status;
+};
+
+typedef struct xengnttab_grant_copy_segment xengnttab_grant_copy_segment_t;
static inline int xengnttab_grant_copy(xengnttab_handle *xgt, uint32_t count,
xengnttab_grant_copy_segment_t *segs)