qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: qemu v8.0-rc3 fails to compile with Xen


From: David Woodhouse
Subject: Re: qemu v8.0-rc3 fails to compile with Xen
Date: Wed, 12 Apr 2023 15:05:06 +0100
User-agent: Evolution 3.44.4-0ubuntu1

On Wed, 2023-04-12 at 14:20 +0200, Olaf Hering wrote:
> Wed, 12 Apr 2023 12:46:23 +0100 Alex Bennée <alex.bennee@linaro.org>:
> 
> > Olaf Hering <olaf@aepfle.de> writes:
> > > Qemu v7.2.1 can be compiled with Xen 4.6, but v8.0.0-rc3 needs now at 
> > > least Xen 4.7.  
> > Was this caused by the addition of the KVM Xen target support or some other 
> > churn since?
> 
> I did not bisect this failure, just checking if bisect is worth the effort.

It'll be something like this. I haven't tested this yet because I can't
even get Xen that old to build locally.

It's reasonable to have a discussion about whether we should
intentionally drop support for older versions of Xen, but less
reasonable for me to break it by accident... :)



From 84125c787737eecc4d90e3e4ace574453eb1085d Mon Sep 17 00:00:00 2001
From: David Woodhouse <dwmw@amazon.co.uk>
Date: Wed, 12 Apr 2023 14:57:33 +0100
Subject: [PATCH] hw/xen: Define xenforeignmemory_map() for Xen < 4.7.1

In restructuring to allow for internal emulation of Xen functionality,
some of the compatibility for older Xen libraries was lost. The actual
backend ops were using the older xc_map_foreign_bulk() function directly,
but the xenforeignmemory_map2() compatibiity wrapper still needed a
definition of xenforeignmemory_map(). Put it back. And in that case the
ops might as well use it instead of doing their own.

Fixes: 15e283c5b684 ("hw/xen: Add foreignmem operations to allow redirection to 
internal emulation")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 hw/xen/xen-operations.c     | 22 ----------------------
 include/hw/xen/xen_native.h | 13 +++++++++++++
 2 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/hw/xen/xen-operations.c b/hw/xen/xen-operations.c
index 3d213d28df..a8e7bda7b0 100644
--- a/hw/xen/xen-operations.c
+++ b/hw/xen/xen-operations.c
@@ -223,26 +223,6 @@ static struct gnttab_backend_ops libxengnttab_backend_ops 
= {
     .unmap = libxengnttab_backend_unmap,
 };
 
-#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40701
-
-static void *libxenforeignmem_backend_map(uint32_t dom, void *addr, int prot,
-                                          size_t pages, xfn_pfn_t *pfns,
-                                          int *errs)
-{
-    if (errs) {
-        return xc_map_foreign_bulk(xen_xc, dom, prot, pfns, errs, pages);
-    } else {
-        return xc_map_foreign_pages(xen_xc, dom, prot, pfns, pages);
-    }
-}
-
-static int libxenforeignmem_backend_unmap(void *addr, size_t pages)
-{
-    return munmap(addr, pages * XC_PAGE_SIZE);
-}
-
-#else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40701 */
-
 static void *libxenforeignmem_backend_map(uint32_t dom, void *addr, int prot,
                                           size_t pages, xen_pfn_t *pfns,
                                           int *errs)
@@ -256,8 +236,6 @@ static int libxenforeignmem_backend_unmap(void *addr, 
size_t pages)
     return xenforeignmemory_unmap(xen_fmem, addr, pages);
 }
 
-#endif
-
 struct foreignmem_backend_ops libxenforeignmem_backend_ops = {
     .map = libxenforeignmem_backend_map,
     .unmap = libxenforeignmem_backend_unmap,
diff --git a/include/hw/xen/xen_native.h b/include/hw/xen/xen_native.h
index 6bcc83baf9..db550cf703 100644
--- a/include/hw/xen/xen_native.h
+++ b/include/hw/xen/xen_native.h
@@ -35,6 +35,19 @@ typedef xc_interface xenforeignmemory_handle;
 #define xenforeignmemory_open(l, f) xen_xc
 #define xenforeignmemory_close(h)
 
+static inline void *xenforeignmemory_map(xc_interface *h, uint32_t dom,
+                                         int prot, size_t pages,
+                                         const xen_pfn_t arr[/*pages*/],
+                                         int err[/*pages*/])
+{
+    if (err)
+        return xc_map_foreign_bulk(h, dom, prot, arr, err, pages);
+    else
+        return xc_map_foreign_pages(h, dom, prot, arr, pages);
+}
+
+#define xenforeignmemory_unmap(h, p, s) munmap(p, s * XC_PAGE_SIZE)
+
 #else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40701 */
 
 #include <xenforeignmemory.h>
-- 
2.34.1


Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]