qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* qemu v8.0-rc3 fails to compile with Xen
@ 2023-04-12 10:58 Olaf Hering
  2023-04-12 11:46 ` Alex Bennée
  0 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2023-04-12 10:58 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 7989 bytes --]

Qemu v7.2.1 can be compiled with Xen 4.6, but v8.0.0-rc3 needs now at least Xen 4.7.

Is Xen older than 4.7 still a supported target? There is a lot compat code, and the meson checks go back to 4.2.

Olaf


FAILED: libcommon.fa.p/hw_xen_xen-operations.c.o 
/usr/bin/gcc-7 -m64 -mcx16 -Ilibcommon.fa.p -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/spice-1 -I/usr/include/p11-kit-1 -I/usr/include/libusb-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/ncursesw -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -isystem /Qc6f3cbca32/linux-headers -isystem linux-headers -iquote . -iquote /Qc6f3cbca32 -iquote /Qc6f3cbca32/include -iquote /Qc6f3cbca32/tcg/i386 -pthread -U_FORTIFY_SOURCE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -Wundef -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wmissing-format-attribute -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -fPIE -DOPENSSL_LOAD_CONF -MD -MQ libcommon.fa.p/hw_xen_xen-operations.c.o -MF libcommon.fa.p/hw_xen_xen-operations.c.o.d -o libcommon.fa.p/hw_xen_xen-operations.c.o -c ../hw/xen/xen-operations.c
In file included from ../hw/xen/xen-operations.c:16:0:
/Qc6f3cbca32/include/hw/xen/xen_native.h: In function 'xenforeignmemory_map2':
/Qc6f3cbca32/include/hw/xen/xen_native.h:121:12: warning: implicit declaration of function 'xenforeignmemory_map'; did you mean 'xenforeignmemory_map2'? [-Wimplicit-function-declaration]
     return xenforeignmemory_map(h, dom, prot, pages, arr, err);
            ^~~~~~~~~~~~~~~~~~~~
            xenforeignmemory_map2
/Qc6f3cbca32/include/hw/xen/xen_native.h:121:12: warning: nested extern declaration of 'xenforeignmemory_map' [-Wnested-externs]
/Qc6f3cbca32/include/hw/xen/xen_native.h:121:12: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return xenforeignmemory_map(h, dom, prot, pages, arr, err);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c: At top level:
../hw/xen/xen-operations.c:37:19: error: conflicting types for 'xenevtchn_handle'
 typedef xc_evtchn xenevtchn_handle;
                   ^~~~~~~~~~~~~~~~
In file included from ../hw/xen/xen-operations.c:17:0:
/Qc6f3cbca32/include/hw/xen/xen_backend_ops.h:33:33: note: previous declaration of 'xenevtchn_handle' was here
 typedef struct xenevtchn_handle xenevtchn_handle;
                                 ^~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:49:19: error: conflicting types for 'xengnttab_handle'
 typedef xc_gnttab xengnttab_handle;
                   ^~~~~~~~~~~~~~~~
In file included from ../hw/xen/xen-operations.c:17:0:
/Qc6f3cbca32/include/hw/xen/xen_backend_ops.h:136:33: note: previous declaration of 'xengnttab_handle' was here
 typedef struct xengntdev_handle xengnttab_handle;
                                 ^~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:193:13: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     .open = libxenevtchn_backend_open,
             ^~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:193:13: note: (near initialization for 'libxenevtchn_backend_ops.open')
../hw/xen/xen-operations.c:194:14: error: 'xenevtchn_close' undeclared here (not in a function); did you mean 'xc_evtchn_close'?
     .close = xenevtchn_close,
              ^~~~~~~~~~~~~~~
              xc_evtchn_close
../hw/xen/xen-operations.c:195:25: error: 'xenevtchn_bind_interdomain' undeclared here (not in a function); did you mean 'xc_evtchn_bind_interdomain'?
     .bind_interdomain = xenevtchn_bind_interdomain,
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
                         xc_evtchn_bind_interdomain
../hw/xen/xen-operations.c:196:15: error: 'xenevtchn_unbind' undeclared here (not in a function); did you mean 'xc_evtchn_unbind'?
     .unbind = xenevtchn_unbind,
               ^~~~~~~~~~~~~~~~
               xc_evtchn_unbind
../hw/xen/xen-operations.c:197:15: error: 'xenevtchn_fd' undeclared here (not in a function); did you mean 'xc_evtchn_fd'?
     .get_fd = xenevtchn_fd,
               ^~~~~~~~~~~~
               xc_evtchn_fd
../hw/xen/xen-operations.c:198:15: error: 'xenevtchn_notify' undeclared here (not in a function); did you mean 'xc_evtchn_notify'?
     .notify = xenevtchn_notify,
               ^~~~~~~~~~~~~~~~
               xc_evtchn_notify
../hw/xen/xen-operations.c:199:15: error: 'xenevtchn_unmask' undeclared here (not in a function); did you mean 'xc_evtchn_unmask'?
     .unmask = xenevtchn_unmask,
               ^~~~~~~~~~~~~~~~
               xc_evtchn_unmask
../hw/xen/xen-operations.c:200:16: error: 'xenevtchn_pending' undeclared here (not in a function); did you mean 'xc_evtchn_pending'?
     .pending = xenevtchn_pending,
                ^~~~~~~~~~~~~~~~~
                xc_evtchn_pending
../hw/xen/xen-operations.c:218:13: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     .open = libxengnttab_backend_open,
             ^~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:218:13: note: (near initialization for 'libxengnttab_backend_ops.open')
../hw/xen/xen-operations.c:219:14: error: 'xengnttab_close' undeclared here (not in a function); did you mean 'xc_gnttab_close'?
     .close = xengnttab_close,
              ^~~~~~~~~~~~~~~
              xc_gnttab_close
../hw/xen/xen-operations.c:220:19: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     .grant_copy = libxengnttab_fallback_grant_copy,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:220:19: note: (near initialization for 'libxengnttab_backend_ops.grant_copy')
../hw/xen/xen-operations.c:221:23: error: 'xengnttab_set_max_grants' undeclared here (not in a function); did you mean 'xc_gnttab_set_max_grants'?
     .set_max_grants = xengnttab_set_max_grants,
                       ^~~~~~~~~~~~~~~~~~~~~~~~
                       xc_gnttab_set_max_grants
../hw/xen/xen-operations.c:222:17: error: 'xengnttab_map_domain_grant_refs' undeclared here (not in a function); did you mean 'xc_gnttab_map_domain_grant_refs'?
     .map_refs = xengnttab_map_domain_grant_refs,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 xc_gnttab_map_domain_grant_refs
../hw/xen/xen-operations.c:223:14: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     .unmap = libxengnttab_backend_unmap,
              ^~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:223:14: note: (near initialization for 'libxengnttab_backend_ops.unmap')
../hw/xen/xen-operations.c:229:57: error: unknown type name 'xfn_pfn_t'; did you mean 'xen_pfn_t'?
                                           size_t pages, xfn_pfn_t *pfns,
                                                         ^~~~~~~~~
                                                         xen_pfn_t
../hw/xen/xen-operations.c:262:12: error: 'libxenforeignmem_backend_map' undeclared here (not in a function); did you mean 'libxenforeignmem_backend_unmap'?
     .map = libxenforeignmem_backend_map,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
            libxenforeignmem_backend_unmap
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:165: run-ninja] Error 1

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: qemu v8.0-rc3 fails to compile with Xen
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Bennée @ 2023-04-12 11:46 UTC (permalink / raw)
  To: Olaf Hering
  Cc: qemu-devel, David Woodhouse, Stefano Stabellini, Anthony Perard,
	Paul Durrant


Olaf Hering <olaf@aepfle.de> writes:

> [[PGP Signed Part:Undecided]]
> 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?

>
> Is Xen older than 4.7 still a supported target? There is a lot compat
> code, and the meson checks go back to 4.2.

We should certainly update that because currently the Xen support pages:

  https://xenbits.xen.org/docs/unstable/support-matrix.html

only list 4.14 and above as still being in security support. The list
only goes back to 4.10 so I would assume anything earlier is out of
scope.

We don't currently document anything about minimum versions of the
hypervisors supported in:

  https://qemu.readthedocs.io/en/latest/about/build-platforms.html

I don't know if we want to make specific statements about hypervisor
versions or just go for the oldest version shipping on the oldest LTS we
support?

Debian Buster 4.11.4
Debian Bullseye 4.14.5
Debian Bookwork (dev) 4.17
Ubuntu 22.04 4.16.0
OpenSUSE 15.4 4.16.0

I couldn't find the RHEL data on repology.org

>
> Olaf
>
>
> FAILED: libcommon.fa.p/hw_xen_xen-operations.c.o 
> /usr/bin/gcc-7 -m64 -mcx16 -Ilibcommon.fa.p -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/spice-1 -I/usr/include/p11-kit-1 -I/usr/include/libusb-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/ncursesw -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -isystem /Qc6f3cbca32/linux-headers -isystem linux-headers -iquote . -iquote /Qc6f3cbca32 -iquote /Qc6f3cbca32/include -iquote /Qc6f3cbca32/tcg/i386 -pthread -U_FORTIFY_SOURCE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -Wundef -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wmissing-format-attribute -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -fPIE -DOPENSSL_LOAD_CONF -MD -MQ libcommon.fa.p/hw_xen_xen-operations.c.o -MF libcommon.fa.p/hw_xen_xen-operations.c.o.d -o libcommon.fa.p/hw_xen_xen-operations.c.o -c ../hw/xen/xen-operations.c
> In file included from ../hw/xen/xen-operations.c:16:0:
> /Qc6f3cbca32/include/hw/xen/xen_native.h: In function 'xenforeignmemory_map2':
> /Qc6f3cbca32/include/hw/xen/xen_native.h:121:12: warning: implicit declaration of function 'xenforeignmemory_map'; did you mean 'xenforeignmemory_map2'? [-Wimplicit-function-declaration]
>      return xenforeignmemory_map(h, dom, prot, pages, arr, err);
>             ^~~~~~~~~~~~~~~~~~~~
>             xenforeignmemory_map2
> /Qc6f3cbca32/include/hw/xen/xen_native.h:121:12: warning: nested extern declaration of 'xenforeignmemory_map' [-Wnested-externs]
> /Qc6f3cbca32/include/hw/xen/xen_native.h:121:12: warning: return makes pointer from integer without a cast [-Wint-conversion]
>      return xenforeignmemory_map(h, dom, prot, pages, arr, err);
>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../hw/xen/xen-operations.c: At top level:
> ../hw/xen/xen-operations.c:37:19: error: conflicting types for 'xenevtchn_handle'
>  typedef xc_evtchn xenevtchn_handle;
>                    ^~~~~~~~~~~~~~~~
> In file included from ../hw/xen/xen-operations.c:17:0:
> /Qc6f3cbca32/include/hw/xen/xen_backend_ops.h:33:33: note: previous declaration of 'xenevtchn_handle' was here
>  typedef struct xenevtchn_handle xenevtchn_handle;
>                                  ^~~~~~~~~~~~~~~~
> ../hw/xen/xen-operations.c:49:19: error: conflicting types for 'xengnttab_handle'
>  typedef xc_gnttab xengnttab_handle;
>                    ^~~~~~~~~~~~~~~~
> In file included from ../hw/xen/xen-operations.c:17:0:
> /Qc6f3cbca32/include/hw/xen/xen_backend_ops.h:136:33: note: previous declaration of 'xengnttab_handle' was here
>  typedef struct xengntdev_handle xengnttab_handle;
>                                  ^~~~~~~~~~~~~~~~
> ../hw/xen/xen-operations.c:193:13: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
>      .open = libxenevtchn_backend_open,
>              ^~~~~~~~~~~~~~~~~~~~~~~~~
> ../hw/xen/xen-operations.c:193:13: note: (near initialization for 'libxenevtchn_backend_ops.open')
> ../hw/xen/xen-operations.c:194:14: error: 'xenevtchn_close' undeclared here (not in a function); did you mean 'xc_evtchn_close'?
>      .close = xenevtchn_close,
>               ^~~~~~~~~~~~~~~
>               xc_evtchn_close
> ../hw/xen/xen-operations.c:195:25: error: 'xenevtchn_bind_interdomain' undeclared here (not in a function); did you mean 'xc_evtchn_bind_interdomain'?
>      .bind_interdomain = xenevtchn_bind_interdomain,
>                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
>                          xc_evtchn_bind_interdomain
> ../hw/xen/xen-operations.c:196:15: error: 'xenevtchn_unbind' undeclared here (not in a function); did you mean 'xc_evtchn_unbind'?
>      .unbind = xenevtchn_unbind,
>                ^~~~~~~~~~~~~~~~
>                xc_evtchn_unbind
> ../hw/xen/xen-operations.c:197:15: error: 'xenevtchn_fd' undeclared here (not in a function); did you mean 'xc_evtchn_fd'?
>      .get_fd = xenevtchn_fd,
>                ^~~~~~~~~~~~
>                xc_evtchn_fd
> ../hw/xen/xen-operations.c:198:15: error: 'xenevtchn_notify' undeclared here (not in a function); did you mean 'xc_evtchn_notify'?
>      .notify = xenevtchn_notify,
>                ^~~~~~~~~~~~~~~~
>                xc_evtchn_notify
> ../hw/xen/xen-operations.c:199:15: error: 'xenevtchn_unmask' undeclared here (not in a function); did you mean 'xc_evtchn_unmask'?
>      .unmask = xenevtchn_unmask,
>                ^~~~~~~~~~~~~~~~
>                xc_evtchn_unmask
> ../hw/xen/xen-operations.c:200:16: error: 'xenevtchn_pending' undeclared here (not in a function); did you mean 'xc_evtchn_pending'?
>      .pending = xenevtchn_pending,
>                 ^~~~~~~~~~~~~~~~~
>                 xc_evtchn_pending
> ../hw/xen/xen-operations.c:218:13: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
>      .open = libxengnttab_backend_open,
>              ^~~~~~~~~~~~~~~~~~~~~~~~~
> ../hw/xen/xen-operations.c:218:13: note: (near initialization for 'libxengnttab_backend_ops.open')
> ../hw/xen/xen-operations.c:219:14: error: 'xengnttab_close' undeclared here (not in a function); did you mean 'xc_gnttab_close'?
>      .close = xengnttab_close,
>               ^~~~~~~~~~~~~~~
>               xc_gnttab_close
> ../hw/xen/xen-operations.c:220:19: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
>      .grant_copy = libxengnttab_fallback_grant_copy,
>                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../hw/xen/xen-operations.c:220:19: note: (near initialization for 'libxengnttab_backend_ops.grant_copy')
> ../hw/xen/xen-operations.c:221:23: error: 'xengnttab_set_max_grants' undeclared here (not in a function); did you mean 'xc_gnttab_set_max_grants'?
>      .set_max_grants = xengnttab_set_max_grants,
>                        ^~~~~~~~~~~~~~~~~~~~~~~~
>                        xc_gnttab_set_max_grants
> ../hw/xen/xen-operations.c:222:17: error: 'xengnttab_map_domain_grant_refs' undeclared here (not in a function); did you mean 'xc_gnttab_map_domain_grant_refs'?
>      .map_refs = xengnttab_map_domain_grant_refs,
>                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                  xc_gnttab_map_domain_grant_refs
> ../hw/xen/xen-operations.c:223:14: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
>      .unmap = libxengnttab_backend_unmap,
>               ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ../hw/xen/xen-operations.c:223:14: note: (near initialization for 'libxengnttab_backend_ops.unmap')
> ../hw/xen/xen-operations.c:229:57: error: unknown type name 'xfn_pfn_t'; did you mean 'xen_pfn_t'?
>                                            size_t pages, xfn_pfn_t *pfns,
>                                                          ^~~~~~~~~
>                                                          xen_pfn_t
> ../hw/xen/xen-operations.c:262:12: error: 'libxenforeignmem_backend_map' undeclared here (not in a function); did you mean 'libxenforeignmem_backend_unmap'?
>      .map = libxenforeignmem_backend_map,
>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>             libxenforeignmem_backend_unmap
> ninja: build stopped: subcommand failed.
> make[1]: *** [Makefile:165: run-ninja] Error 1
>
> [[End of PGP Signed Part]]


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: qemu v8.0-rc3 fails to compile with Xen
  2023-04-12 11:46 ` Alex Bennée
@ 2023-04-12 12:20   ` Olaf Hering
  2023-04-12 14:05     ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2023-04-12 12:20 UTC (permalink / raw)
  To: Alex Bennée
  Cc: qemu-devel, David Woodhouse, Stefano Stabellini, Anthony Perard,
	Paul Durrant

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

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.


Olaf

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: qemu v8.0-rc3 fails to compile with Xen
  2023-04-12 12:20   ` Olaf Hering
@ 2023-04-12 14:05     ` David Woodhouse
  2023-04-12 16:41       ` Olaf Hering
  0 siblings, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2023-04-12 14:05 UTC (permalink / raw)
  To: Olaf Hering, Alex Bennée
  Cc: qemu-devel, Stefano Stabellini, Anthony Perard, Paul Durrant

[-- 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 --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: qemu v8.0-rc3 fails to compile with Xen
  2023-04-12 14:05     ` David Woodhouse
@ 2023-04-12 16:41       ` Olaf Hering
  2023-04-12 16:57         ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2023-04-12 16:41 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Alex Bennée, qemu-devel, Stefano Stabellini, Anthony Perard,
	Paul Durrant

[-- Attachment #1: Type: text/plain, Size: 6922 bytes --]

Wed, 12 Apr 2023 15:05:06 +0100 David Woodhouse <dwmw2@infradead.org>:

> 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.

The error with this patch applied looks like this:

FAILED: libcommon.fa.p/hw_xen_xen-operations.c.o 
/usr/bin/gcc-7 -m64 -mcx16 -Ilibcommon.fa.p -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/spice-1 -I/usr/include/p11-kit-1 -I/usr/include/libusb-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/ncursesw -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -isystem /Qc6f3cbca32/linux-headers -isystem linux-headers -iquote . -iquote /Qc6f3cbca32 -iquote /Qc6f3cbca32/include -iquote /Qc6f3cbca32/tcg/i386 -pthread -U_FORTIFY_SOURCE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -Wundef -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wmissing-format-attribute -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -fPIE -DOPENSSL_LOAD_CONF -MD -MQ libcommon.fa.p/hw_xen_xen-operations.c.o -MF libcommon.fa.p/hw_xen_xen-operations.c.o.d -o libcommon.fa.p/hw_xen_xen-operations.c.o -c ../hw/xen/xen-operations.c
../hw/xen/xen-operations.c:37:19: error: conflicting types for 'xenevtchn_handle'
 typedef xc_evtchn xenevtchn_handle;
                   ^~~~~~~~~~~~~~~~
In file included from ../hw/xen/xen-operations.c:17:0:
/Qc6f3cbca32/include/hw/xen/xen_backend_ops.h:33:33: note: previous declaration of 'xenevtchn_handle' was here
 typedef struct xenevtchn_handle xenevtchn_handle;
                                 ^~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:49:19: error: conflicting types for 'xengnttab_handle'
 typedef xc_gnttab xengnttab_handle;
                   ^~~~~~~~~~~~~~~~
In file included from ../hw/xen/xen-operations.c:17:0:
/Qc6f3cbca32/include/hw/xen/xen_backend_ops.h:136:33: note: previous declaration of 'xengnttab_handle' was here
 typedef struct xengntdev_handle xengnttab_handle;
                                 ^~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:193:13: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     .open = libxenevtchn_backend_open,
             ^~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:193:13: note: (near initialization for 'libxenevtchn_backend_ops.open')
../hw/xen/xen-operations.c:194:14: error: 'xenevtchn_close' undeclared here (not in a function); did you mean 'xc_evtchn_close'?
     .close = xenevtchn_close,
              ^~~~~~~~~~~~~~~
              xc_evtchn_close
../hw/xen/xen-operations.c:195:25: error: 'xenevtchn_bind_interdomain' undeclared here (not in a function); did you mean 'xc_evtchn_bind_interdomain'?
     .bind_interdomain = xenevtchn_bind_interdomain,
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
                         xc_evtchn_bind_interdomain
../hw/xen/xen-operations.c:196:15: error: 'xenevtchn_unbind' undeclared here (not in a function); did you mean 'xc_evtchn_unbind'?
     .unbind = xenevtchn_unbind,
               ^~~~~~~~~~~~~~~~
               xc_evtchn_unbind
../hw/xen/xen-operations.c:197:15: error: 'xenevtchn_fd' undeclared here (not in a function); did you mean 'xc_evtchn_fd'?
     .get_fd = xenevtchn_fd,
               ^~~~~~~~~~~~
               xc_evtchn_fd
../hw/xen/xen-operations.c:198:15: error: 'xenevtchn_notify' undeclared here (not in a function); did you mean 'xc_evtchn_notify'?
     .notify = xenevtchn_notify,
               ^~~~~~~~~~~~~~~~
               xc_evtchn_notify
../hw/xen/xen-operations.c:199:15: error: 'xenevtchn_unmask' undeclared here (not in a function); did you mean 'xc_evtchn_unmask'?
     .unmask = xenevtchn_unmask,
               ^~~~~~~~~~~~~~~~
               xc_evtchn_unmask
../hw/xen/xen-operations.c:200:16: error: 'xenevtchn_pending' undeclared here (not in a function); did you mean 'xc_evtchn_pending'?
     .pending = xenevtchn_pending,
                ^~~~~~~~~~~~~~~~~
                xc_evtchn_pending
../hw/xen/xen-operations.c:218:13: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     .open = libxengnttab_backend_open,
             ^~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:218:13: note: (near initialization for 'libxengnttab_backend_ops.open')
../hw/xen/xen-operations.c:219:14: error: 'xengnttab_close' undeclared here (not in a function); did you mean 'xc_gnttab_close'?
     .close = xengnttab_close,
              ^~~~~~~~~~~~~~~
              xc_gnttab_close
../hw/xen/xen-operations.c:220:19: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     .grant_copy = libxengnttab_fallback_grant_copy,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:220:19: note: (near initialization for 'libxengnttab_backend_ops.grant_copy')
../hw/xen/xen-operations.c:221:23: error: 'xengnttab_set_max_grants' undeclared here (not in a function); did you mean 'xc_gnttab_set_max_grants'?
     .set_max_grants = xengnttab_set_max_grants,
                       ^~~~~~~~~~~~~~~~~~~~~~~~
                       xc_gnttab_set_max_grants
../hw/xen/xen-operations.c:222:17: error: 'xengnttab_map_domain_grant_refs' undeclared here (not in a function); did you mean 'xc_gnttab_map_domain_grant_refs'?
     .map_refs = xengnttab_map_domain_grant_refs,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 xc_gnttab_map_domain_grant_refs
../hw/xen/xen-operations.c:223:14: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     .unmap = libxengnttab_backend_unmap,
              ^~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xen/xen-operations.c:223:14: note: (near initialization for 'libxengnttab_backend_ops.unmap')


Olaf

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: qemu v8.0-rc3 fails to compile with Xen
  2023-04-12 16:41       ` Olaf Hering
@ 2023-04-12 16:57         ` David Woodhouse
  2023-04-12 17:32           ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2023-04-12 16:57 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Alex Bennée, qemu-devel, Stefano Stabellini, Anthony Perard,
	Paul Durrant

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

On Wed, 2023-04-12 at 18:41 +0200, Olaf Hering wrote:
> The error with this patch applied looks like this:

Thanks. So I think I fixed that one but there are others. I'll make
myself a build environment rather than getting you to help me play
whack-a-mole.

Thanks.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: qemu v8.0-rc3 fails to compile with Xen
  2023-04-12 16:57         ` David Woodhouse
@ 2023-04-12 17:32           ` Peter Maydell
  2023-04-12 17:55             ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2023-04-12 17:32 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Olaf Hering, Alex Bennée, qemu-devel, Stefano Stabellini,
	Anthony Perard, Paul Durrant

On Wed, 12 Apr 2023 at 17:58, David Woodhouse <dwmw2@infradead.org> wrote:
>
> On Wed, 2023-04-12 at 18:41 +0200, Olaf Hering wrote:
> > The error with this patch applied looks like this:
>
> Thanks. So I think I fixed that one but there are others. I'll make
> myself a build environment rather than getting you to help me play
> whack-a-mole.

Is it worth the effort if this version of Xen
is old enough that it's outside our standard supported
build platforms policy?
https://www.qemu.org/docs/master/about/build-platforms.html
You could just remove all the no-longer-needed compat code
instead...

thanks
-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: qemu v8.0-rc3 fails to compile with Xen
  2023-04-12 17:32           ` Peter Maydell
@ 2023-04-12 17:55             ` David Woodhouse
  0 siblings, 0 replies; 8+ messages in thread
From: David Woodhouse @ 2023-04-12 17:55 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Olaf Hering, Alex Bennée, qemu-devel, Stefano Stabellini,
	Anthony Perard, Paul Durrant

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

On Wed, 2023-04-12 at 18:32 +0100, Peter Maydell wrote:
> On Wed, 12 Apr 2023 at 17:58, David Woodhouse <dwmw2@infradead.org>
> wrote:
> > 
> > On Wed, 2023-04-12 at 18:41 +0200, Olaf Hering wrote:
> > > The error with this patch applied looks like this:
> > 
> > Thanks. So I think I fixed that one but there are others. I'll make
> > myself a build environment rather than getting you to help me play
> > whack-a-mole.
> 
> Is it worth the effort if this version of Xen
> is old enough that it's outside our standard supported
> build platforms policy?
> https://www.qemu.org/docs/master/about/build-platforms.html
> You could just remove all the no-longer-needed compat code
> instead...

Indeed. I'll rip out everything before 4.7.1, which is plenty ancient
enough and the compat support for it is fairly minimal (and builds fine
here).

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-04-12 17:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).