From: David Woodhouse <dwmw2@infradead.org>
To: "Olaf Hering" <olaf@aepfle.de>, "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org,
Stefano Stabellini <sstabellini@kernel.org>,
Anthony Perard <anthony.perard@citrix.com>,
Paul Durrant <paul@xen.org>
Subject: Re: qemu v8.0-rc3 fails to compile with Xen
Date: Wed, 12 Apr 2023 15:05:06 +0100 [thread overview]
Message-ID: <80e7920a8947fe58d94003c7591af6e876edf706.camel@infradead.org> (raw)
In-Reply-To: <20230412142022.4b88df69.olaf@aepfle.de>
[-- Attachment #1: Type: text/plain, Size: 4154 bytes --]
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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]
next prev parent reply other threads:[~2023-04-12 14:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 10:58 qemu v8.0-rc3 fails to compile with Xen Olaf Hering
2023-04-12 11:46 ` Alex Bennée
2023-04-12 12:20 ` Olaf Hering
2023-04-12 14:05 ` David Woodhouse [this message]
2023-04-12 16:41 ` Olaf Hering
2023-04-12 16:57 ` David Woodhouse
2023-04-12 17:32 ` Peter Maydell
2023-04-12 17:55 ` David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=80e7920a8947fe58d94003c7591af6e876edf706.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=alex.bennee@linaro.org \
--cc=anthony.perard@citrix.com \
--cc=olaf@aepfle.de \
--cc=paul@xen.org \
--cc=qemu-devel@nongnu.org \
--cc=sstabellini@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).