From af2a10c5b297cf25866f6af7662f2890e5298099 Mon Sep 17 00:00:00 2001 From: Roja Eswaran Date: Tue, 6 Aug 2024 11:45:39 -0700 Subject: [PATCH] Upgraded Xen-tools from 4.15 to 4.19.0 1. Able to add ninja through apk in xen-tools/Docker and xen/Docker 2. Changed the seabios and Xen version to 1.16.3 and 4.19.0 respectively 3. Added 12-remove-vanillaqemu4.19-cpupinning.patch which removes new qemu_thread_set_affinity implementation (QEMU 8.0.4), also retained Nikolay CPU Pinning PatchNo.15 4. Warning treated as error flag is available by default so removed 12-disable-Werror-to-build-under-gcc-11.2.patch 5. NetdevTapOptions doesn't have has_br member so changed 10-bridge-helper-support.patch 6. Bydefault vhost-vsock and vhost-scsi is enabled so removing the corresponding enable flags from xen-tools/Dockerfile 7. Removed 11-char-socket-revert.patch as it's unnecessary 8. Removed [realtime] option from kvm.go and replaced it with [overcommit], hypervisor.go unit test need to be changed to reflect [overcommit] 9. 08-Revert__Revert__vfio_pci-quirks_c__Disable_stolen_memory_for_igd_VFIO__.patch looked super messy, so cleaned it. 10. Replaced [realtime] with [overcommit] in kvm_test.go for the unit test case to pass Signed-off-by: Roja Eswaran --- pkg/pillar/hypervisor/kvm.go | 4 +- pkg/pillar/hypervisor/kvm_test.go | 36 +-- pkg/xen-tools/Dockerfile | 19 +- .../patches-4.19.0/00-musl-support.patch | 33 +++ .../01-enable-gmp-patching.patch | 13 ++ .../04-disable-vif-allow-all-iptables.patch | 10 + .../patches-4.19.0/08-memlogd-logger.patch | 193 ++++++++++++++++ .../patches-4.19.0/09-enable-kvm.patch | 19 ++ .../10-bridge-helper-support.patch | 76 ++++++ ...12-remove-vanillaqemu4.19-cpupinning.patch | 197 ++++++++++++++++ ...qemu-Add-cpu-pin-and-cpumask-options.patch | 152 ++++++++++++ .../14-qemu-Init-CPU-mask-per-VCPU.patch | 202 ++++++++++++++++ ...inity-of-QEMU-threads-according-to-t.patch | 101 ++++++++ .../x86_64/05-xen-spoofing.patch | 217 ++++++++++++++++++ .../x86_64/07-patch-seabios.patch | 12 + ...Disable_stolen_memory_for_igd_VFIO__.patch | 94 ++++++++ .../patches-4.19.0/x86_64/patch.seabios | 25 ++ pkg/xen/Dockerfile | 4 +- 18 files changed, 1377 insertions(+), 30 deletions(-) create mode 100644 pkg/xen-tools/patches-4.19.0/00-musl-support.patch create mode 100644 pkg/xen-tools/patches-4.19.0/01-enable-gmp-patching.patch create mode 100644 pkg/xen-tools/patches-4.19.0/04-disable-vif-allow-all-iptables.patch create mode 100644 pkg/xen-tools/patches-4.19.0/08-memlogd-logger.patch create mode 100644 pkg/xen-tools/patches-4.19.0/09-enable-kvm.patch create mode 100644 pkg/xen-tools/patches-4.19.0/10-bridge-helper-support.patch create mode 100644 pkg/xen-tools/patches-4.19.0/12-remove-vanillaqemu4.19-cpupinning.patch create mode 100644 pkg/xen-tools/patches-4.19.0/13-qemu-Add-cpu-pin-and-cpumask-options.patch create mode 100644 pkg/xen-tools/patches-4.19.0/14-qemu-Init-CPU-mask-per-VCPU.patch create mode 100644 pkg/xen-tools/patches-4.19.0/15-qemu-Set-the-affinity-of-QEMU-threads-according-to-t.patch create mode 100644 pkg/xen-tools/patches-4.19.0/x86_64/05-xen-spoofing.patch create mode 100644 pkg/xen-tools/patches-4.19.0/x86_64/07-patch-seabios.patch create mode 100644 pkg/xen-tools/patches-4.19.0/x86_64/08-Revert__Revert__vfio_pci-quirks_c__Disable_stolen_memory_for_igd_VFIO__.patch create mode 100644 pkg/xen-tools/patches-4.19.0/x86_64/patch.seabios diff --git a/pkg/pillar/hypervisor/kvm.go b/pkg/pillar/hypervisor/kvm.go index 619a0bdc1b6..9bbc962a593 100644 --- a/pkg/pillar/hypervisor/kvm.go +++ b/pkg/pillar/hypervisor/kvm.go @@ -109,8 +109,8 @@ const qemuConfTemplate = `# This file is automatically generated by domainmgr driver = "intel-iommu" caching-mode = "on" {{ end }} -[realtime] - mlock = "off" +[overcommit] + mem-lock = "off" [chardev "charmonitor"] backend = "socket" diff --git a/pkg/pillar/hypervisor/kvm_test.go b/pkg/pillar/hypervisor/kvm_test.go index d1fb6101db8..6c953d97900 100644 --- a/pkg/pillar/hypervisor/kvm_test.go +++ b/pkg/pillar/hypervisor/kvm_test.go @@ -131,8 +131,8 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) { driver = "intel-iommu" caching-mode = "on" -[realtime] - mlock = "off" +[overcommit] + mem-lock = "off" [chardev "charmonitor"] backend = "socket" @@ -397,8 +397,8 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) { driver = "intel-iommu" caching-mode = "on" -[realtime] - mlock = "off" +[overcommit] + mem-lock = "off" [chardev "charmonitor"] backend = "socket" @@ -639,8 +639,8 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) { append = "init=/bin/sh" -[realtime] - mlock = "off" +[overcommit] + mem-lock = "off" [chardev "charmonitor"] backend = "socket" @@ -1099,8 +1099,8 @@ func domConfigArm64() string { append = "init=/bin/sh" -[realtime] - mlock = "off" +[overcommit] + mem-lock = "off" [chardev "charmonitor"] backend = "socket" @@ -1381,8 +1381,8 @@ func domConfigAmd64FML() string { driver = "intel-iommu" caching-mode = "on" -[realtime] - mlock = "off" +[overcommit] + mem-lock = "off" [chardev "charmonitor"] backend = "socket" @@ -1674,8 +1674,8 @@ func domConfigAmd64Legacy() string { driver = "intel-iommu" caching-mode = "on" -[realtime] - mlock = "off" +[overcommit] + mem-lock = "off" [chardev "charmonitor"] backend = "socket" @@ -1958,8 +1958,8 @@ func domConfigAmd64() string { driver = "intel-iommu" caching-mode = "on" -[realtime] - mlock = "off" +[overcommit] + mem-lock = "off" [chardev "charmonitor"] backend = "socket" @@ -2238,8 +2238,8 @@ func domConfigContainerVNC() string { driver = "intel-iommu" caching-mode = "on" -[realtime] - mlock = "off" +[overcommit] + mem-lock = "off" [chardev "charmonitor"] backend = "socket" @@ -2539,8 +2539,8 @@ func TestCreateDom(t *testing.T) { property = "disable_s4" value = "1" -[realtime] - mlock = "off" +[overcommit] + mem-lock = "off" [rtc] base = "localtime" diff --git a/pkg/xen-tools/Dockerfile b/pkg/xen-tools/Dockerfile index 131c1368d56..b62b5174ad5 100644 --- a/pkg/xen-tools/Dockerfile +++ b/pkg/xen-tools/Dockerfile @@ -26,10 +26,12 @@ ENV BUILD_PKGS \ gettext iasl util-linux-dev ncurses-dev glib-dev \ pixman-dev libaio-dev yajl-dev argp-standalone \ linux-headers git patch texinfo tar libcap-ng-dev \ - attr-dev flex bison cmake libusb-dev zstd-dev + attr-dev flex bison cmake libusb-dev zstd-dev \ + python3 build-base ninja + ENV BUILD_PKGS_arm64 dtc-dev -ENV PKGS alpine-baselayout musl-utils bash libaio libbz2 glib pixman yajl keyutils libusb xz-libs libuuid sudo zstd-libs +ENV PKGS alpine-baselayout libgcc musl-utils bash libaio libbz2 glib pixman yajl keyutils libusb xz-libs libuuid sudo zstd-libs ENV PKGS_arm64 libfdt RUN eve-alpine-deploy.sh @@ -57,11 +59,11 @@ RUN rm -rf /out/usr/man RUN strip /out/usr/lib/* || : # When changing this version, also update SEABIOS_UPSTREAM_REVISION to whatever is in `Config.mk` in the xen source -ENV XEN_VERSION 4.15.0 +ENV XEN_VERSION 4.19.0 ENV XEN_SOURCE=https://downloads.xenproject.org/release/xen/${XEN_VERSION}/xen-${XEN_VERSION}.tar.gz ENV EXTRA_QEMUU_CONFIGURE_ARGS="--enable-libusb --enable-linux-aio \ - --enable-vhost-net --enable-vhost-vsock --enable-vhost-scsi --enable-vhost-kernel \ - --enable-vhost-user --enable-linux-io-uring --enable-zstd" +--enable-vhost-net --enable-vhost-kernel \ +--enable-vhost-user --enable-linux-io-uring --enable-zstd" WORKDIR / @@ -80,7 +82,7 @@ RUN cat /patches/*.patch /patches/"$(uname -m)"/*.patch | patch -p1 # Note that Xen's `configure` command uses this env variable SEABIOS_UPSTREAM_URL to find the seabios source. ENV SEABIOS_UPSTREAM_URL /seabios.git # this revision should be kept in sync with the XEN_VERSION by reading `Config.mk` in the xen source -ENV SEABIOS_UPSTREAM_REVISION rel-1.14.0 +ENV SEABIOS_UPSTREAM_REVISION rel-1.16.3 ADD --keep-git-dir git://xenbits.xen.org/seabios.git#${SEABIOS_UPSTREAM_REVISION} ${SEABIOS_UPSTREAM_URL} # we need this because it will complain about ambiguous refs RUN git config --global core.warnambiguousrefs false @@ -89,10 +91,13 @@ RUN mkdir -p /out # FEATURES="--enable-stubdom --enable-vtpm-stubdom --enable-vtpmmgr-stubdom" COPY gmp.patch /xen/stubdom + WORKDIR /xen + # disable golang as it does not play well together with musl (stderr is defined as FILE* const and fails to compile) RUN ./configure --prefix=/usr --disable-xen --disable-golang --disable-qemu-traditional --disable-docs --enable-9pfs \ - --with-system-ovmf=/usr/lib/xen/boot/ovmf.bin --disable-stubdom + --with-system-ovmf=/usr/lib/xen/boot/ovmf.bin --disable-stubdom \ + --enable-vhost-vsock --enable-vhost-scsi RUN make -j "$(getconf _NPROCESSORS_ONLN)" && make dist RUN dist/install.sh /out diff --git a/pkg/xen-tools/patches-4.19.0/00-musl-support.patch b/pkg/xen-tools/patches-4.19.0/00-musl-support.patch new file mode 100644 index 00000000000..83931092d17 --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/00-musl-support.patch @@ -0,0 +1,33 @@ +diff --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c +index d0571cabac..7ad86e3b31 100644 +--- a/tools/xenpaging/xenpaging.c ++++ b/tools/xenpaging/xenpaging.c +@@ -180,7 +180,7 @@ static int xenpaging_get_tot_pages(struct xenpaging *paging) + + static void *init_page(void) + { +- void *buffer; ++ void *buffer = NULL; + + /* Allocated page memory */ + errno = posix_memalign(&buffer, PAGE_SIZE, PAGE_SIZE); +--- a/tools/Makefile 2019-09-11 13:15:12.000000000 -0700 ++++ b/tools/Makefile 2019-09-11 13:14:58.000000000 -0700 +@@ -245,7 +245,8 @@ + --prefix=$(LIBEXEC) \ + --libdir=$(LIBEXEC_LIB) \ + --includedir=$(LIBEXEC_INC) \ +- --extra-cflags="-DXC_WANT_COMPAT_EVTCHN_API=1 \ ++ --extra-cflags="-DXATTR_SIZE_MAX=65536 \ ++ -DXC_WANT_COMPAT_EVTCHN_API=1 \ + -DXC_WANT_COMPAT_GNTTAB_API=1 \ + -DXC_WANT_COMPAT_MAP_FOREIGN_API=1 \ + -DXC_WANT_COMPAT_DEVICEMODEL_API=1 \ +@@ -280,6 +281,7 @@ + --localstatedir=$(localstatedir) \ + --disable-kvm \ + --disable-docs \ ++ --disable-werror \ + --disable-guest-agent \ + --python=$(PYTHON) \ + $(CONFIG_QEMUU_EXTRA_ARGS) \ diff --git a/pkg/xen-tools/patches-4.19.0/01-enable-gmp-patching.patch b/pkg/xen-tools/patches-4.19.0/01-enable-gmp-patching.patch new file mode 100644 index 00000000000..79d25d07741 --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/01-enable-gmp-patching.patch @@ -0,0 +1,13 @@ +diff --git a/stubdom/Makefile b/stubdom/Makefile +index 8cf7131c6a..c6a8051c85 100644 +--- a/stubdom/Makefile ++++ b/stubdom/Makefile +@@ -178,7 +178,7 @@ gmp-$(XEN_TARGET_ARCH): gmp-$(GMP_VERSION).tar.bz2 $(NEWLIB_STAMPFILE) + tar xjf $< + rm $@ -rf || : + mv gmp-$(GMP_VERSION) $@ +- #patch -d $@ -p0 < gmp.patch ++ patch -d $@ -p0 < gmp.patch + cd $@; CPPFLAGS="-isystem $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include $(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" CC=$(CC) $(GMPEXT) ./configure --disable-shared --enable-static --disable-fft --without-readline --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf --libdir=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib --build=`gcc -dumpmachine` --host=$(GNU_TARGET_ARCH)-xen-elf + sed -i 's/#define HAVE_OBSTACK_VPRINTF 1/\/\/#define HAVE_OBSTACK_VPRINTF 1/' $@/config.h + touch $@ diff --git a/pkg/xen-tools/patches-4.19.0/04-disable-vif-allow-all-iptables.patch b/pkg/xen-tools/patches-4.19.0/04-disable-vif-allow-all-iptables.patch new file mode 100644 index 00000000000..14db14ba5a1 --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/04-disable-vif-allow-all-iptables.patch @@ -0,0 +1,10 @@ +--- a/tools/hotplug/Linux/vif-bridge ++++ b/tools/hotplug/Linux/vif-bridge +@@ -93,7 +93,6 @@ case "$command" in + ;; + esac + +-handle_iptable + + call_hooks vif post + diff --git a/pkg/xen-tools/patches-4.19.0/08-memlogd-logger.patch b/pkg/xen-tools/patches-4.19.0/08-memlogd-logger.patch new file mode 100644 index 00000000000..8ac956aaafb --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/08-memlogd-logger.patch @@ -0,0 +1,193 @@ +diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c +index a43c57edad..d0bf636c10 100644 +--- a/tools/console/daemon/io.c ++++ b/tools/console/daemon/io.c +@@ -27,6 +27,8 @@ + #include + #include + ++#include "../libs/light/xentoollog_external.h" ++ + #include + #include + #include +@@ -420,6 +422,15 @@ static int create_hv_log(void) + { + char logfile[PATH_MAX]; + int fd; ++ ++ fd = xtl_logger_create_external("hypervisor"); ++ if (fd < 0) { ++ dolog(LOG_ERR, "Failed to establish connection with the external logger - falling back %d (%s)", ++ errno, strerror(errno)); ++ } else { ++ return fd; ++ } ++ + snprintf(logfile, PATH_MAX-1, "%s/hypervisor.log", log_dir); + logfile[PATH_MAX-1] = '\0'; + +@@ -444,6 +455,7 @@ static int create_hv_log(void) + static int create_console_log(struct console *con) + { + char logfile[PATH_MAX]; ++ char logname[PATH_MAX]; + char *namepath, *data, *s; + int fd; + unsigned int len; +@@ -468,9 +480,20 @@ static int create_console_log(struct console *con) + + snprintf(logfile, PATH_MAX-1, "%s/guest-%s%s.log", + log_dir, data, con->log_suffix); ++ snprintf(logname, PATH_MAX-1, "guest_vm-%s%s", ++ data, con->log_suffix); + + free(data); + logfile[PATH_MAX-1] = '\0'; ++ logname[PATH_MAX-1] = '\0'; ++ ++ fd = xtl_logger_create_external(logname); ++ if (fd < 0) { ++ dolog(LOG_ERR, "Failed to establish connection with the external logger - falling back %d (%s)", ++ errno, strerror(errno)); ++ } else { ++ return fd; ++ } + + fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0644); + if (fd == -1) +diff --git a/tools/libs/light/xentoollog_external.h b/tools/libs/light/xentoollog_external.h +new file mode 100644 +index 0000000000..4b664fc36e +--- /dev/null ++++ b/tools/libs/light/xentoollog_external.h +@@ -0,0 +1,68 @@ ++#ifndef XENTOOLLOG_EXTERNAL_H ++#define XENTOOLLOG_EXTERNAL_H ++ ++#include ++#include ++#include ++#include ++ ++#define XTL_EXTERNAL_LOGGER_SOCKET "/var/run/linuxkit-external-logging.sock" ++extern int xtl_logger_create_external(char *name); ++int xtl_logger_create_external(char *name) { ++ int fds[2]; ++ int fd; ++ struct sockaddr_un addr; ++ struct msghdr message; ++ struct iovec iov[1]; ++ struct cmsghdr *control_message = NULL; ++ char ctrl_buf[CMSG_SPACE(sizeof(int))]; ++ ++ /* fill out all the required C paperwork */ ++ memset(&addr, 0, sizeof(addr)); ++ addr.sun_family = AF_UNIX; ++ strcpy(addr.sun_path, XTL_EXTERNAL_LOGGER_SOCKET); ++ ++ memset(&message, 0, sizeof(struct msghdr)); ++ memset(ctrl_buf, 0, CMSG_SPACE(sizeof(int))); ++ iov[0].iov_base = name; ++ iov[0].iov_len = strlen(name); ++ ++ message.msg_name = NULL; ++ message.msg_namelen = 0; ++ message.msg_iov = iov; ++ message.msg_iovlen = 1; ++ message.msg_controllen = CMSG_SPACE(sizeof(int)); ++ message.msg_control = ctrl_buf; ++ ++ control_message = CMSG_FIRSTHDR(&message); ++ control_message->cmsg_level = SOL_SOCKET; ++ control_message->cmsg_type = SCM_RIGHTS; ++ control_message->cmsg_len = CMSG_LEN(sizeof(int)); ++ ++ /* now, do the deed */ ++ fd = socket(AF_UNIX, SOCK_DGRAM, 0); ++ if (fd < 0) ++ goto bail; ++ ++ if (pipe(fds)) ++ goto bail_fd; ++ ++ *((int *) CMSG_DATA(control_message)) = fds[0]; ++ ++ if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) ++ goto bail_fd_fds; ++ ++ if (sendmsg(fd, &message, 0) >= 0) { ++ return fds[1]; ++ } ++ ++bail_fd_fds: ++ close(fds[0]); ++ close(fds[1]); ++bail_fd: ++ close(fd); ++bail: ++ return -1; ++} ++ ++#endif /* XENTOOLLOG_EXTERNAL_H */ +diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c +index dac1b8ddb8..a368fe6ba0 100644 +--- a/tools/libs/light/libxl_dm.c ++++ b/tools/libs/light/libxl_dm.c +@@ -25,6 +25,8 @@ + #include + #include + ++#include "xentoollog_external.h" ++ + static const char *libxl_tapif_script(libxl__gc *gc) + { + #if defined(__linux__) || defined(__FreeBSD__) +@@ -49,6 +51,10 @@ static int libxl__create_qemu_logfile(libxl__gc *gc, char *name) + char *logfile; + int rc, logfile_w; + ++ logfile_w = xtl_logger_create_external(name); ++ if (logfile_w >= 0) ++ return logfile_w; ++ + rc = libxl_create_logfile(CTX, name, &logfile); + if (rc) return rc; + +diff --git a/tools/xl/xl_utils.c b/tools/xl/xl_utils.c +index b0d23b2..949d281 100644 +--- a/tools/xl/xl_utils.c ++++ b/tools/xl/xl_utils.c +@@ -27,6 +27,8 @@ + #include "xl.h" + #include "xl_utils.h" + ++#include "../libs/light/xentoollog_external.h" ++ + #ifndef O_CLOEXEC + #define O_CLOEXEC 0 + #endif +@@ -268,14 +270,16 @@ int do_daemonize(const char *name, const char *pidfile) + + postfork(); + +- ret = libxl_create_logfile(ctx, name, &fullname); +- if (ret) { +- LOG("failed to open logfile %s: %s",fullname,strerror(errno)); +- exit(-1); ++ logfile = xtl_logger_create_external((char *)name); ++ if (logfile < 0) { ++ ret = libxl_create_logfile(ctx, name, &fullname); ++ if (ret) { ++ LOG("failed to open logfile %s: %s",fullname,strerror(errno)); ++ exit(-1); ++ } ++ CHK_SYSCALL(logfile = open(fullname, O_WRONLY | O_CREAT | O_APPEND | O_CLOEXEC, 0644)); ++ free(fullname); + } +- +- CHK_SYSCALL(logfile = open(fullname, O_WRONLY | O_CREAT | O_APPEND | O_CLOEXEC, 0644)); +- free(fullname); + assert(logfile >= 3); + + CHK_SYSCALL(nullfd = open("/dev/null", O_RDONLY)); \ No newline at end of file diff --git a/pkg/xen-tools/patches-4.19.0/09-enable-kvm.patch b/pkg/xen-tools/patches-4.19.0/09-enable-kvm.patch new file mode 100644 index 00000000000..071de7a01b8 --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/09-enable-kvm.patch @@ -0,0 +1,19 @@ +--- a/tools/Makefile.orig ++++ b/tools/Makefile +@@ -232,7 +232,7 @@ + virtfs='' ; \ + fi ; \ + PKG_CONFIG_PATH=$(XEN_ROOT)/tools/pkg-config$${PKG_CONFIG_PATH:+:$${PKG_CONFIG_PATH}} \ +- $$source/configure --enable-xen --target-list=i386-softmmu \ ++ $$source/configure --enable-xen --target-list=i386-softmmu,$$(uname -m)-softmmu \ + $(QEMU_XEN_ENABLE_DEBUG) \ + $$enable_trace_backend \ + --prefix=$(prefix) \ +@@ -251,7 +251,6 @@ + --mandir=$(LIBEXEC)/share/man \ + --libexecdir=$(LIBEXEC)/libexec \ + --firmwarepath=$(LIBEXEC)/share/qemu-firmware \ +- --disable-kvm \ + --disable-docs \ + --disable-guest-agent \ + --python=$(PYTHON) \ diff --git a/pkg/xen-tools/patches-4.19.0/10-bridge-helper-support.patch b/pkg/xen-tools/patches-4.19.0/10-bridge-helper-support.patch new file mode 100644 index 00000000000..302ed2d9170 --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/10-bridge-helper-support.patch @@ -0,0 +1,76 @@ +diff --git a/tools/qemu-xen/net/tap.c b/tools/qemu-xen/net/tap.c +index 1bf085d..1887c4a 100644 +--- a/tools/qemu-xen/net/tap.c ++++ b/tools/qemu-xen/net/tap.c +@@ -63,7 +63,7 @@ typedef struct TAPState { + Notifier exit; + } TAPState; + +-static void launch_script(const char *setup_script, const char *ifname, ++static void launch_script(const char *setup_script, const char *ifname, const char *bridge, + int fd, Error **errp); + + static void tap_send(void *opaque); +@@ -323,7 +323,7 @@ static void tap_exit_notify(Notifier *notifier, void *data) + Error *err = NULL; + + if (s->down_script[0]) { +- launch_script(s->down_script, s->down_script_arg, s->fd, &err); ++ launch_script(s->down_script, s->down_script_arg, "bn1", s->fd, &err); + if (err) { + error_report_err(err); + } +@@ -431,7 +431,7 @@ static TAPState *net_tap_fd_init(NetClientState *peer, + return s; + } + +-static void launch_script(const char *setup_script, const char *ifname, ++static void launch_script(const char *setup_script, const char *ifname, const char *bridge, + int fd, Error **errp) + { + int pid, status; +@@ -456,6 +456,7 @@ static void launch_script(const char *setup_script, const char *ifname, + parg = args; + *parg++ = (char *)setup_script; + *parg++ = (char *)ifname; ++ *parg++ = (char *)bridge; + *parg = NULL; + execv(setup_script, args); + _exit(1); +@@ -648,8 +649,8 @@ int net_init_bridge(const Netdev *netdev, const char *name, + } + + static int net_tap_init(const NetdevTapOptions *tap, int *vnet_hdr, +- const char *setup_script, char *ifname, +- size_t ifname_sz, int mq_required, Error **errp) ++ const char *setup_script, char *ifname, ++ size_t ifname_sz, const char *bridge, int mq_required, Error **errp) + { + Error *err = NULL; + int fd, vnet_hdr_required; +@@ -671,7 +672,7 @@ static int net_tap_init(const NetdevTapOptions *tap, int *vnet_hdr, + if (setup_script && + setup_script[0] != '\0' && + strcmp(setup_script, "no") != 0) { +- launch_script(setup_script, ifname, fd, &err); ++ launch_script(setup_script, ifname, bridge, fd, &err); + if (err) { + error_propagate(errp, err); + close(fd); +@@ -1003,8 +1004,14 @@ free_fail: + } + + for (i = 0; i < queues; i++) { +- fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? "no" : script, +- ifname, sizeof ifname, queues > 1, errp); ++ ++ if(tap->br == NULL) ++ fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? "no" : script, ++ ifname, sizeof ifname, "bn1" , queues > 1, errp); ++ else ++ fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? "no" : script, ++ ifname, sizeof ifname, tap->br , queues > 1, errp); ++ + if (fd == -1) { + return -1; + } diff --git a/pkg/xen-tools/patches-4.19.0/12-remove-vanillaqemu4.19-cpupinning.patch b/pkg/xen-tools/patches-4.19.0/12-remove-vanillaqemu4.19-cpupinning.patch new file mode 100644 index 00000000000..695751ad261 --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/12-remove-vanillaqemu4.19-cpupinning.patch @@ -0,0 +1,197 @@ +diff --git a/tools/qemu-xen/include/qemu/thread.h b/tools/qemu-xen/include/qemu/thread.h +index dd3822d..a5b9ca8 100644 +--- a/tools/qemu-xen/include/qemu/thread.h ++++ b/tools/qemu-xen/include/qemu/thread.h +@@ -189,10 +189,6 @@ void qemu_event_destroy(QemuEvent *ev); + void qemu_thread_create(QemuThread *thread, const char *name, + void *(*start_routine)(void *), + void *arg, int mode); +-int qemu_thread_set_affinity(QemuThread *thread, unsigned long *host_cpus, +- unsigned long nbits); +-int qemu_thread_get_affinity(QemuThread *thread, unsigned long **host_cpus, +- unsigned long *nbits); + void *qemu_thread_join(QemuThread *thread); + void qemu_thread_get_self(QemuThread *thread); + bool qemu_thread_is_self(QemuThread *thread); +diff --git a/tools/qemu-xen/util/qemu-thread-posix.c b/tools/qemu-xen/util/qemu-thread-posix.c +index b2e26e2..0a563ba 100644 +--- a/tools/qemu-xen/util/qemu-thread-posix.c ++++ b/tools/qemu-xen/util/qemu-thread-posix.c +@@ -589,75 +589,6 @@ void qemu_thread_create(QemuThread *thread, const char *name, + pthread_attr_destroy(&attr); + } + +-int qemu_thread_set_affinity(QemuThread *thread, unsigned long *host_cpus, +- unsigned long nbits) +-{ +-#if defined(CONFIG_PTHREAD_AFFINITY_NP) +- const size_t setsize = CPU_ALLOC_SIZE(nbits); +- unsigned long value; +- cpu_set_t *cpuset; +- int err; +- +- cpuset = CPU_ALLOC(nbits); +- g_assert(cpuset); +- +- CPU_ZERO_S(setsize, cpuset); +- value = find_first_bit(host_cpus, nbits); +- while (value < nbits) { +- CPU_SET_S(value, setsize, cpuset); +- value = find_next_bit(host_cpus, nbits, value + 1); +- } +- +- err = pthread_setaffinity_np(thread->thread, setsize, cpuset); +- CPU_FREE(cpuset); +- return err; +-#else +- return -ENOSYS; +-#endif +-} +- +-int qemu_thread_get_affinity(QemuThread *thread, unsigned long **host_cpus, +- unsigned long *nbits) +-{ +-#if defined(CONFIG_PTHREAD_AFFINITY_NP) +- unsigned long tmpbits; +- cpu_set_t *cpuset; +- size_t setsize; +- int i, err; +- +- tmpbits = CPU_SETSIZE; +- while (true) { +- setsize = CPU_ALLOC_SIZE(tmpbits); +- cpuset = CPU_ALLOC(tmpbits); +- g_assert(cpuset); +- +- err = pthread_getaffinity_np(thread->thread, setsize, cpuset); +- if (err) { +- CPU_FREE(cpuset); +- if (err != -EINVAL) { +- return err; +- } +- tmpbits *= 2; +- } else { +- break; +- } +- } +- +- /* Convert the result into a proper bitmap. */ +- *nbits = tmpbits; +- *host_cpus = bitmap_new(tmpbits); +- for (i = 0; i < tmpbits; i++) { +- if (CPU_ISSET(i, cpuset)) { +- set_bit(i, *host_cpus); +- } +- } +- CPU_FREE(cpuset); +- return 0; +-#else +- return -ENOSYS; +-#endif +-} +- + void qemu_thread_get_self(QemuThread *thread) + { + thread->thread = pthread_self(); +diff --git a/tools/qemu-xen/util/qemu-thread-win32.c b/tools/qemu-xen/util/qemu-thread-win32.c +index a7fe3cc..2c02a1b 100644 +--- a/tools/qemu-xen/util/qemu-thread-win32.c ++++ b/tools/qemu-xen/util/qemu-thread-win32.c +@@ -507,18 +507,6 @@ void qemu_thread_create(QemuThread *thread, const char *name, + thread->data = data; + } + +-int qemu_thread_set_affinity(QemuThread *thread, unsigned long *host_cpus, +- unsigned long nbits) +-{ +- return -ENOSYS; +-} +- +-int qemu_thread_get_affinity(QemuThread *thread, unsigned long **host_cpus, +- unsigned long *nbits) +-{ +- return -ENOSYS; +-} +- + void qemu_thread_get_self(QemuThread *thread) + { + thread->data = qemu_thread_data; +diff --git a/tools/qemu-xen/util/thread-context.c b/tools/qemu-xen/util/thread-context.c +index 2bc7883..ba443f5 100644 +--- a/tools/qemu-xen/util/thread-context.c ++++ b/tools/qemu-xen/util/thread-context.c +@@ -113,21 +113,7 @@ static void thread_context_set_cpu_affinity(Object *obj, Visitor *v, + set_bit(l->value, bitmap); + } + +- if (tc->thread_id != -1) { +- /* +- * Note: we won't be adjusting the affinity of any thread that is still +- * around, but only the affinity of the context thread. +- */ +- ret = qemu_thread_set_affinity(&tc->thread, bitmap, nbits); +- if (ret) { +- error_setg(errp, "Setting CPU affinity failed: %s", strerror(ret)); +- } +- } else { +- tc->init_cpu_bitmap = bitmap; +- bitmap = NULL; +- tc->init_cpu_nbits = nbits; +- } +-out: ++ out: + g_free(bitmap); + qapi_free_uint16List(host_cpus); + } +@@ -147,12 +133,6 @@ static void thread_context_get_cpu_affinity(Object *obj, Visitor *v, + return; + } + +- ret = qemu_thread_get_affinity(&tc->thread, &bitmap, &nbits); +- if (ret) { +- error_setg(errp, "Getting CPU affinity failed: %s", strerror(ret)); +- return; +- } +- + value = find_first_bit(bitmap, nbits); + while (value < nbits) { + QAPI_LIST_APPEND(tail, value); +@@ -213,21 +193,7 @@ static void thread_context_set_node_affinity(Object *obj, Visitor *v, + goto out; + } + +- if (tc->thread_id != -1) { +- /* +- * Note: we won't be adjusting the affinity of any thread that is still +- * around for now, but only the affinity of the context thread. +- */ +- ret = qemu_thread_set_affinity(&tc->thread, bitmap, nbits); +- if (ret) { +- error_setg(errp, "Setting CPU affinity failed: %s", strerror(ret)); +- } +- } else { +- tc->init_cpu_bitmap = bitmap; +- bitmap = NULL; +- tc->init_cpu_nbits = nbits; +- } +-out: ++ out: + g_free(bitmap); + qapi_free_uint16List(host_nodes); + #else +@@ -262,15 +228,6 @@ static void thread_context_instance_complete(UserCreatable *uc, Error **errp) + qemu_sem_wait(&tc->sem); + } + +- if (tc->init_cpu_bitmap) { +- ret = qemu_thread_set_affinity(&tc->thread, tc->init_cpu_bitmap, +- tc->init_cpu_nbits); +- if (ret) { +- error_setg(errp, "Setting CPU affinity failed: %s", strerror(ret)); +- } +- g_free(tc->init_cpu_bitmap); +- tc->init_cpu_bitmap = NULL; +- } + } + + static void thread_context_class_init(ObjectClass *oc, void *data) diff --git a/pkg/xen-tools/patches-4.19.0/13-qemu-Add-cpu-pin-and-cpumask-options.patch b/pkg/xen-tools/patches-4.19.0/13-qemu-Add-cpu-pin-and-cpumask-options.patch new file mode 100644 index 00000000000..0c77f63167c --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/13-qemu-Add-cpu-pin-and-cpumask-options.patch @@ -0,0 +1,152 @@ +From ccfea3c5e131b3ee623aa5e4e16e13bf8d0291d2 Mon Sep 17 00:00:00 2001 +From: Nikolay Martyanov +Date: Wed, 28 Sep 2022 15:47:11 +0200 +Subject: [PATCH 13/15] qemu: Add 'cpu-pin' and 'cpumask' options. + +Add the 'cpumask' option to set the CPU mask for the threads created by QEMU. +The mask affects all the threads belonging to a VM: both VCPU threads and +non-VCPU threads. If the option is not provided, it's considered to be '-1', +which corresponds to all the available CPUs. +The CPU mask in represented in the form "d[[,-]d]*". E.g. "0-2" or "0-2,5,6". +CPUs start with 0. For example, the mask "0,3" would mean that only +physical CPUs 0 and 3 are available for the VM. + +Add the 'cpu-pin' option to pin any VCPU thread to a specific CPU. If the +option is set, any VCPU thread will be assigned to a CPU provided with the +'cpumask'. If it's not provided, the VPCU threads can migrate from a CPU to a +CPU within the set of CPUs provided by the 'cpumask' option. + +Signed-off-by: Nikolay Martyanov +--- + tools/qemu-xen/hw/core/machine.c | 38 ++++++++++++++++++++++++++++++ + tools/qemu-xen/include/hw/boards.h | 2 ++ + tools/qemu-xen/qemu-options.hx | 18 ++++++++++++++ + tools/qemu-xen/softmmu/vl.c | 4 ++++ + 4 files changed, 62 insertions(+) + +diff --git a/tools/qemu-xen/hw/core/machine.c b/tools/qemu-xen/hw/core/machine.c +index 8d1a90c..2f9993e 100644 +--- a/tools/qemu-xen/hw/core/machine.c ++++ b/tools/qemu-xen/hw/core/machine.c +@@ -372,6 +372,35 @@ static void machine_set_graphics(Object *obj, bool value, Error **errp) + ms->enable_graphics = value; + } + ++static bool machine_get_cpu_pin(Object *obj, Error **errp) ++{ ++ MachineState *ms = MACHINE(obj); ++ ++ return ms->cpu_pin; ++} ++ ++static void machine_set_cpu_pin(Object *obj, bool value, Error **errp) ++{ ++ MachineState *ms = MACHINE(obj); ++ ++ ms->cpu_pin = value; ++} ++ ++static char *machine_get_cpumask(Object *obj, Error **errp) ++{ ++ MachineState *ms = MACHINE(obj); ++ ++ return g_strdup(ms->cpumask_str); ++} ++ ++static void machine_set_cpumask(Object *obj, const char *value, Error **errp) ++{ ++ MachineState *ms = MACHINE(obj); ++ ++ g_free(ms->cpumask_str); ++ ms->cpumask_str = g_strdup(value); ++} ++ + static char *machine_get_firmware(Object *obj, Error **errp) + { + MachineState *ms = MACHINE(obj); +@@ -841,6 +870,15 @@ static void machine_class_init(ObjectClass *oc, void *data) + object_class_property_set_description(oc, "usb", + "Set on/off to enable/disable usb"); + ++ object_class_property_add_bool(oc, "cpu-pin", ++ machine_get_cpu_pin, machine_set_cpu_pin); ++ object_class_property_set_description(oc, "cpu-pin", ++ "Set on/off to enable/disable CPU pinning"); ++ ++ object_class_property_add_str(oc, "cpumask", ++ machine_get_cpumask, machine_set_cpumask); ++ object_class_property_set_description(oc, "cpumask", "CPU Mask"); ++ + object_class_property_add_bool(oc, "graphics", + machine_get_graphics, machine_set_graphics); + object_class_property_set_description(oc, "graphics", +diff --git a/tools/qemu-xen/include/hw/boards.h b/tools/qemu-xen/include/hw/boards.h +index 426ce5f..b06f13e 100644 +--- a/tools/qemu-xen/include/hw/boards.h ++++ b/tools/qemu-xen/include/hw/boards.h +@@ -294,6 +294,8 @@ struct MachineState { + char *kernel_filename; + char *kernel_cmdline; + char *initrd_filename; ++ bool cpu_pin; ++ char *cpumask_str; + const char *cpu_type; + AccelState *accelerator; + CPUArchIdList *possible_cpus; +diff --git a/tools/qemu-xen/qemu-options.hx b/tools/qemu-xen/qemu-options.hx +index 708583b..a33ee1e 100644 +--- a/tools/qemu-xen/qemu-options.hx ++++ b/tools/qemu-xen/qemu-options.hx +@@ -509,6 +509,24 @@ SRST + Preallocate memory when using -mem-path. + ERST + ++DEF("cpu-pin", 0, QEMU_OPTION_cpu_pin, ++ "-cpu-pin pin any VPCU thread to a physical CPU\n", ++ QEMU_ARCH_ALL) ++SRST ++``-cpu-pin`` ++ Pin any VCPU thread to a physical CPU. ++ERST ++ ++DEF("cpumask", HAS_ARG, QEMU_OPTION_cpumask, ++ "-cpumask=value define the set of CPUs used by the VM\n", ++ QEMU_ARCH_ALL) ++SRST ++``-cpumask=value`` ++ CPU mask in form "d[[,-]d]*". E.g. "0-2" or "0-2,5,6". CPUs start with 0. ++ For example, the mask "0,3" would mean that only physical CPUs 0 and 3 are ++ available for the VM. ++ERST ++ + DEF("k", HAS_ARG, QEMU_OPTION_k, + "-k language use keyboard layout (for example 'fr' for French)\n", + QEMU_ARCH_ALL) +diff --git a/tools/qemu-xen/softmmu/vl.c b/tools/qemu-xen/softmmu/vl.c +index ea20b23..59ff7c7 100644 +--- a/tools/qemu-xen/softmmu/vl.c ++++ b/tools/qemu-xen/softmmu/vl.c +@@ -173,6 +173,7 @@ static QemuPluginList plugin_list = QTAILQ_HEAD_INITIALIZER(plugin_list); + static BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue); + static bool nographic = false; + static int mem_prealloc; /* force preallocation of physical target memory */ ++static bool cpu_pin = false; + static const char *vga_model = NULL; + static DisplayOptions dpy; + static int num_serial_hds; +@@ -3360,6 +3361,10 @@ void qemu_init(int argc, char **argv) + case QEMU_OPTION_nodefaults: + has_defaults = 0; + break; ++ case QEMU_OPTION_cpu_pin: ++ cpu_pin = true; ++ break; ++ + case QEMU_OPTION_xen_domid: + if (!(accel_find("xen")) && !(accel_find("kvm"))) { + error_report("Option not supported for this target"); + +base-commit: 9c55fdd5e54c5ea4bf238cee787f13a03eac1c86 +-- +2.35.1 + diff --git a/pkg/xen-tools/patches-4.19.0/14-qemu-Init-CPU-mask-per-VCPU.patch b/pkg/xen-tools/patches-4.19.0/14-qemu-Init-CPU-mask-per-VCPU.patch new file mode 100644 index 00000000000..f6a52c9fdb4 --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/14-qemu-Init-CPU-mask-per-VCPU.patch @@ -0,0 +1,202 @@ +From bea4aaef5c4dd309799055da9c5d7036579b89e9 Mon Sep 17 00:00:00 2001 +From: Nikolay Martyanov +Date: Wed, 28 Sep 2022 15:52:24 +0200 +Subject: [PATCH 14/15] qemu: Init CPU mask per VCPU. + +Signed-off-by: Nikolay Martyanov +--- + tools/qemu-xen/include/hw/boards.h | 1 + + tools/qemu-xen/include/hw/core/cpu.h | 2 + + tools/qemu-xen/softmmu/cpus.c | 31 ++++++++++++ + tools/qemu-xen/softmmu/vl.c | 75 ++++++++++++++++++++++++++++ + 4 files changed, 109 insertions(+) + +diff --git a/tools/qemu-xen/include/hw/boards.h b/tools/qemu-xen/include/hw/boards.h +index b06f13e..a4b4f11 100644 +--- a/tools/qemu-xen/include/hw/boards.h ++++ b/tools/qemu-xen/include/hw/boards.h +@@ -296,6 +296,7 @@ struct MachineState { + char *initrd_filename; + bool cpu_pin; + char *cpumask_str; ++ uint64_t cpumask; + const char *cpu_type; + AccelState *accelerator; + CPUArchIdList *possible_cpus; +diff --git a/tools/qemu-xen/include/hw/core/cpu.h b/tools/qemu-xen/include/hw/core/cpu.h +index 397fd3a..1bf357b 100644 +--- a/tools/qemu-xen/include/hw/core/cpu.h ++++ b/tools/qemu-xen/include/hw/core/cpu.h +@@ -344,6 +344,9 @@ struct CPUState { + bool created; + bool stop; + bool stopped; ++ bool pinned; ++ uint64_t cpumask; ++ + + /* Should CPU start in powered-off state? */ + bool start_powered_off; + +diff --git a/tools/qemu-xen/softmmu/cpus.c b/tools/qemu-xen/softmmu/cpus.c +index 9cbc817..2867325 100644 +--- a/tools/qemu-xen/softmmu/cpus.c ++++ b/tools/qemu-xen/softmmu/cpus.c +@@ -72,6 +72,25 @@ static QemuMutex qemu_global_mutex; + */ + static const AccelOpsClass *cpus_accel; + ++ ++static inline void cpumask_clear_bit(uint64_t *mask, uint8_t bit) ++{ ++ *mask &= ~(1ul << bit); ++} ++ ++static inline long cpumask_get_min_bit(uint64_t mask) ++{ ++ return __builtin_ffsll(mask) - 1; ++ } ++ ++static long pick_pcpu(uint64_t *cpumask) ++{ ++ long ret = cpumask_get_min_bit(*cpumask); ++ cpumask_clear_bit(cpumask, ret); ++ return ret; ++} ++ ++ + bool cpu_is_stopped(CPUState *cpu) + { + return cpu->stopped || !runstate_is_running(); +@@ -635,6 +654,21 @@ void qemu_init_vcpu(CPUState *cpu) + cpu->stopped = true; + cpu->random_seed = qemu_guest_random_seed_thread_part1(); + ++ cpu->pinned = ms->cpu_pin; ++ static uint64_t vm_cpumask; ++ uint64_t vcpu_cpumask; ++ if (!vm_cpumask) ++ vm_cpumask = ms->cpumask; ++ if (!cpu->pinned) { ++ /* If the CPUs are not pinned, assign the whole CPU mask to the VCPU */ ++ vcpu_cpumask = vm_cpumask; ++ } else { ++ /* If the CPUs are pinned, pick only one CPU for this VCPU */ ++ vcpu_cpumask = 1ull << pick_pcpu(&vm_cpumask); ++ } ++ ++ cpu->cpumask = vcpu_cpumask; ++ + if (!cpu->as) { + /* If the target cpu hasn't set up any address spaces itself, + * give it the default one. + + +diff --git a/tools/qemu-xen/softmmu/vl.c b/tools/qemu-xen/softmmu/vl.c +index ea20b23..98287f4 100644 +--- a/tools/qemu-xen/softmmu/vl.c ++++ b/tools/qemu-xen/softmmu/vl.c +@@ -2631,6 +2631,68 @@ void qmp_x_exit_preconfig(Error **errp) + } + } + ++static inline void cpumask_set_bit(uint64_t *mask, uint8_t bit) ++{ ++ *mask |= 1ull << bit ; ++} ++ ++/* Parse d[[,-]d]* mask (0-2 or 0-2,5,6). CPUs start with 0. ++ * Return 0 in case of error, bitmask if ok ++ */ ++static uint64_t cpumask_parse(const char* cpumask_str) ++{ ++ uint64_t cpumask = 0; ++ const char *cur = cpumask_str; ++ bool range = false; ++ ++ assert(cpumask_str != NULL); ++ ++ if (strcmp(cpumask_str, "") == 0) ++ return 0; ++ ++ if (cpumask_str[0] == '-') { ++ warn_report("The CPU mask cannot start with -\n"); ++ return 0; ++ } ++ ++ uint8_t last_set; ++ while (*cur) { ++ unsigned long num; ++ char *end; ++ if (*cur == '-') { ++ cur++; ++ range = true; ++ continue; ++ } ++ if (*cur == ',') { ++ cur++; ++ continue; ++ } ++ num = strtoul(cur, &end, 10); ++ if (num > UCHAR_MAX) { ++ warn_report ("Too big CPU number is provided! Numbers more than %d " ++ "are not supported at the moment!\n", UCHAR_MAX); ++ return 0; ++ } ++ if (end != cur) { ++ if (num == 0 || num > sizeof(cpumask) * BITS_PER_BYTE) ++ return 0; ++ if (range) { ++ range = false; ++ for (int i = last_set + 1; i < num; i++) ++ cpumask_set_bit(&cpumask, i); ++ } ++ cpumask_set_bit(&cpumask, num); ++ last_set = num; ++ cur = end; ++ continue; ++ } ++ warn_report("The CPU mask option is broken!\n"); ++ return 0; ++ } ++ return cpumask; ++} ++ + void qemu_init(int argc, char **argv) + { + QemuOpts *opts; +@@ -3357,6 +3419,7 @@ void qemu_init(int argc, char **argv) + case QEMU_OPTION_only_migratable: + only_migratable = 1; + break; ++ + case QEMU_OPTION_nodefaults: + has_defaults = 0; + break; +@@ -3596,6 +3659,21 @@ void qemu_init(int argc, char **argv) + if (cpu_option) { + current_machine->cpu_type = parse_cpu_option(cpu_option); + } ++ ++ ++ current_machine->cpumask = 0; ++ if (current_machine->cpumask_str) { ++ current_machine->cpumask = cpumask_parse(current_machine->cpumask_str); ++ if (!current_machine->cpumask) { ++ current_machine->cpumask = ~0ull; ++ } ++ } ++ if (current_machine->cpu_pin) { ++ if (!current_machine->cpumask_str) { ++ current_machine->cpumask = ~0ull; ++ } ++ } ++ + /* NB: for machine none cpu_type could STILL be NULL here! */ + + qemu_resolve_machine_memdev(); + + +-- +2.35.1 + diff --git a/pkg/xen-tools/patches-4.19.0/15-qemu-Set-the-affinity-of-QEMU-threads-according-to-t.patch b/pkg/xen-tools/patches-4.19.0/15-qemu-Set-the-affinity-of-QEMU-threads-according-to-t.patch new file mode 100644 index 00000000000..b9526c83383 --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/15-qemu-Set-the-affinity-of-QEMU-threads-according-to-t.patch @@ -0,0 +1,101 @@ +From f6861fa011836c9101977e2b0ad1aadaf8d45a57 Mon Sep 17 00:00:00 2001 +From: Nikolay Martyanov +Date: Wed, 28 Sep 2022 16:01:48 +0200 +Subject: [PATCH 15/15] qemu: Set the affinity of QEMU threads according to the + CPU mask options. + +Signed-off-by: Nikolay Martyanov +--- + tools/qemu-xen/include/qemu/thread.h | 2 ++ + tools/qemu-xen/softmmu/cpus.c | 6 ++++ + tools/qemu-xen/util/qemu-thread-posix.c | 37 +++++++++++++++++++++++++ + 3 files changed, 45 insertions(+) + +diff --git a/tools/qemu-xen/include/qemu/thread.h b/tools/qemu-xen/include/qemu/thread.h +index 4baf4d1..3d1a76e 100644 +--- a/tools/qemu-xen/include/qemu/thread.h ++++ b/tools/qemu-xen/include/qemu/thread.h +@@ -174,6 +174,8 @@ void qemu_event_destroy(QemuEvent *ev); + void qemu_thread_create(QemuThread *thread, const char *name, + void *(*start_routine)(void *), + void *arg, int mode); ++/* TODO implemented for POSIX only by now */ ++void qemu_thread_set_affinity(QemuThread *thread, unsigned int cpumask); + void *qemu_thread_join(QemuThread *thread); + void qemu_thread_get_self(QemuThread *thread); + bool qemu_thread_is_self(QemuThread *thread); +diff --git a/tools/qemu-xen/softmmu/cpus.c b/tools/qemu-xen/softmmu/cpus.c +index da56052..000df00 100644 +--- a/tools/qemu-xen/softmmu/cpus.c ++++ b/tools/qemu-xen/softmmu/cpus.c +@@ -2073,6 +2073,12 @@ void qemu_init_vcpu(CPUState *cpu) + qemu_dummy_start_vcpu(cpu); + } + ++ if(cpu_can_run(cpu)) ++ warn_report("Change a CPU affinity after the CPU may have been running for a while\n"); ++ ++ if (cpu->cpumask) ++ qemu_thread_set_affinity(cpu->thread, cpu->cpumask); ++ + while (!cpu->created) { + qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); + } +diff --git a/tools/qemu-xen/util/qemu-thread-posix.c b/tools/qemu-xen/util/qemu-thread-posix.c +index b4c2359..c404ff4 100644 +--- a/tools/qemu-xen/util/qemu-thread-posix.c ++++ b/tools/qemu-xen/util/qemu-thread-posix.c +@@ -17,6 +17,8 @@ + #include "qemu-thread-common.h" + #include "qemu/tsan.h" + ++#include "hw/core/cpu.h" ++ + static bool name_threads; + + void qemu_thread_naming(bool enable) +@@ -523,6 +525,41 @@ static void *qemu_thread_start(void *args) + return r; + } + ++static inline unsigned get_max_cpu_in_mask(unsigned int cpumask) ++{ ++ assert(cpumask != 0); ++ return (sizeof (cpumask) * BITS_PER_BYTE) - __builtin_clz (cpumask) - 1; ++} ++ ++void qemu_thread_set_affinity(QemuThread *thread, unsigned int cpumask) ++{ ++ int err; ++ size_t cpu_set_size; ++ cpu_set_t cpu_set; ++ unsigned int max_pcpu; ++ unsigned int cpumask_tmp = cpumask; ++ ++ CPU_ZERO(&cpu_set); ++ ++ /* set the CPU_SET according to mask */ ++ int cur_pcpu = 0; ++ while(cpumask_tmp) { ++ if (cpumask_tmp & 1) ++ CPU_SET (cur_pcpu, &cpu_set); ++ cpumask_tmp >>= 1; ++ cur_pcpu += 1; ++ } ++ ++ /* Count the size of the necessary CPU_SET */ ++ max_pcpu = get_max_cpu_in_mask(cpumask); ++ cpu_set_size = DIV_ROUND_UP(max_pcpu + 1, BITS_PER_BYTE); ++ ++ err = pthread_setaffinity_np(thread->thread, cpu_set_size, &cpu_set); ++ ++ if (err) ++ error_exit (err, __func__); ++} ++ + void qemu_thread_create(QemuThread *thread, const char *name, + void *(*start_routine)(void*), + void *arg, int mode) +-- +2.35.1 + diff --git a/pkg/xen-tools/patches-4.19.0/x86_64/05-xen-spoofing.patch b/pkg/xen-tools/patches-4.19.0/x86_64/05-xen-spoofing.patch new file mode 100644 index 00000000000..a19e97e1135 --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/x86_64/05-xen-spoofing.patch @@ -0,0 +1,217 @@ +diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c +index f8af88f..8dbb0cf 100644 +--- a/tools/firmware/hvmloader/hvmloader.c ++++ b/tools/firmware/hvmloader/hvmloader.c +@@ -136,10 +136,10 @@ static void init_hypercalls(void) + + if ( !strcmp("XenVMMXenVMM", signature) ) + break; ++ if ( !strcmp("ZenZenZenZen", signature) ) ++ break; + } + +- BUG_ON(strcmp("XenVMMXenVMM", signature) || ((eax - base) < 2)); +- + /* Fill in hypercall transfer pages. */ + cpuid(base + 2, &eax, &ebx, &ecx, &edx); + for ( i = 0; i < eax; i++ ) +diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c +index 32d45dc..283b41b 100644 +--- a/tools/libs/light/libxl_create.c ++++ b/tools/libs/light/libxl_create.c +@@ -320,6 +320,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, + libxl_defbool_setdefault(&b_info->u.hvm.acpi_laptop_slate, false); + libxl_defbool_setdefault(&b_info->u.hvm.nx, true); + libxl_defbool_setdefault(&b_info->u.hvm.viridian, false); ++ libxl_defbool_setdefault(&b_info->u.hvm.spoof_viridian, false); ++ libxl_defbool_setdefault(&b_info->u.hvm.spoof_xen, false); + libxl_defbool_setdefault(&b_info->u.hvm.hpet, true); + libxl_defbool_setdefault(&b_info->u.hvm.vpt_align, true); + libxl_defbool_setdefault(&b_info->u.hvm.altp2m, false); +@@ -1545,6 +1547,10 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, + console.backend_domid = state->console_domid; + libxl__device_console_add(gc, domid, &console, state, &device); + libxl__device_console_dispose(&console); ++ LOG(DEBUG, "Checking spoofing for guest (domid %d): xen %d, vir %d", domid, ++ libxl_defbool_val(d_config->b_info.u.hvm.spoof_xen), ++ libxl_defbool_val(d_config->b_info.u.hvm.spoof_viridian) ++ ); + + if (libxl_defbool_val(d_config->b_info.u.hvm.vkb_device)) { + libxl_device_vkb_init(&vkb); +diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c +index cdb294a..ed3ac19 100644 +--- a/tools/libs/light/libxl_x86.c ++++ b/tools/libs/light/libxl_x86.c +@@ -414,6 +414,16 @@ + LOG(ERROR, "Couldn't set HVM_PARAM_VPT_ALIGN"); + goto out; + } ++ if (xc_hvm_param_set(xch, domid, HVM_PARAM_SPOOF_XEN, ++ libxl_defbool_val(info->u.hvm.spoof_xen))) { ++ LOG(ERROR, "Couldn't set HVM_PARAM_SPOOF_XEN"); ++ goto out; ++ } ++ if (xc_hvm_param_set(xch, domid, HVM_PARAM_SPOOF_VIRIDIAN, ++ libxl_defbool_val(info->u.hvm.spoof_viridian))) { ++ LOG(ERROR, "Couldn't set HVM_PARAM_SPOOF_VIRIDIAN"); ++ goto out; ++ } + if (info->u.hvm.mca_caps && + xc_hvm_param_set(CTX->xch, domid, HVM_PARAM_MCA_CAP, + info->u.hvm.mca_caps)) { +diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl +index 7921950..246e128 100644 +--- a/tools/libs/light/libxl_types.idl ++++ b/tools/libs/light/libxl_types.idl +@@ -569,6 +569,8 @@ libxl_domain_build_info = Struct("domain_build_info",[ + ("viridian", libxl_defbool), + ("viridian_enable", libxl_bitmap), + ("viridian_disable", libxl_bitmap), ++ ("spoof_viridian", libxl_defbool), ++ ("spoof_xen", libxl_defbool), + ("timeoffset", string), + ("hpet", libxl_defbool), + ("vpt_align", libxl_defbool), +diff --git a/tools/misc/xen-detect.c b/tools/misc/xen-detect.c +index fd187a4..7752219 100644 +--- a/tools/misc/xen-detect.c ++++ b/tools/misc/xen-detect.c +@@ -83,6 +83,8 @@ + + if ( !strcmp("XenVMMXenVMM", signature) && (regs[0] >= (base + 2)) ) + goto found; ++ if ( !strcmp("ZenZenZenZen", signature) && (regs[0] >= (base + 2)) ) ++ goto found; + + /* Higher base addresses are possible only with HVM. */ + if ( pv_context ) +diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c +index 4723f5d..311e8a5 100644 +--- a/xen/arch/x86/hvm/hvm.c ++++ b/xen/arch/x86/hvm/hvm.c +@@ -4274,6 +4274,14 @@ static int hvmop_set_param( + case HVM_PARAM_IOREQ_SERVER_PFN: + d->arch.hvm.ioreq_gfn.base = a.value; + break; ++ case HVM_PARAM_SPOOF_XEN: ++ printk("spoof_xen %" PRId64 " - curr dom %d, dom %d\n", a.value, curr_d->domain_id, d->domain_id); ++ d->arch.hvm.spoof_xen = a.value; ++ break; ++ case HVM_PARAM_SPOOF_VIRIDIAN: ++ printk("spoof_vir %" PRId64 " - curr dom %d, dom %d\n", a.value, curr_d->domain_id, d->domain_id); ++ d->arch.hvm.spoof_viridian = a.value; ++ break; + case HVM_PARAM_NR_IOREQ_SERVER_PAGES: + { + unsigned int i; +diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c +index 44c8e6c..b45bdbf 100644 +--- a/xen/arch/x86/hvm/viridian/viridian.c ++++ b/xen/arch/x86/hvm/viridian/viridian.c +@@ -121,9 +121,13 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf, + { + case 0: + res->a = 0x40000006; /* Maximum leaf */ +- memcpy(&res->b, "Micr", 4); +- memcpy(&res->c, "osof", 4); +- memcpy(&res->d, "t Hv", 4); ++ printk("wetware cpuid_viridian_leaves spoof_vir\n"); // "Wetware Labs" ++ //memcpy(&res->b, "Micr", 4); ++ //memcpy(&res->c, "osof", 4); ++ //memcpy(&res->d, "t Hv", 4); ++ memcpy(&res->b, "Wetw", 4); ++ memcpy(&res->c, "era ", 4); ++ memcpy(&res->d, "Labs", 4); + break; + + case 1: +diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c +index 97499a0..b500095 100644 +--- a/xen/arch/x86/traps.c ++++ b/xen/arch/x86/traps.c +@@ -892,9 +892,19 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf, + { + case 0: + res->a = base + limit; /* Largest leaf */ +- res->b = XEN_CPUID_SIGNATURE_EBX; +- res->c = XEN_CPUID_SIGNATURE_ECX; +- res->d = XEN_CPUID_SIGNATURE_EDX; ++ if (!d->arch.hvm.spoof_xen ) { ++ printk("cpuid_hypervisor_leaves - real id. domid %d\n",d->domain_id); ++ res->b = XEN_CPUID_SIGNATURE_EBX; ++ res->c = XEN_CPUID_SIGNATURE_ECX; ++ res->d = XEN_CPUID_SIGNATURE_EDX; ++ } else ++ { ++ printk("cpuid_hypervisor_leaves - spoofed id. domid %d\n",d->domain_id); ++ res->b = ZEN_CPUID_SIGNATURE_EBX; ++ res->c = ZEN_CPUID_SIGNATURE_ECX; ++ res->d = ZEN_CPUID_SIGNATURE_EDX; ++ } ++ + break; + + case 1: + +diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h +index ce46305..7e63c55 100644 +--- a/xen/include/public/arch-x86/cpuid.h ++++ b/xen/include/public/arch-x86/cpuid.h +@@ -53,6 +53,10 @@ + #define XEN_CPUID_SIGNATURE_ECX 0x65584d4d /* "MMXe" */ + #define XEN_CPUID_SIGNATURE_EDX 0x4d4d566e /* "nVMM" */ + ++#define ZEN_CPUID_SIGNATURE_EBX 0x5A6e655A /* "ZenZ" */ ++#define ZEN_CPUID_SIGNATURE_ECX 0x655A6e65 /* "enZe" */ ++#define ZEN_CPUID_SIGNATURE_EDX 0x6e655A6e /* "nZen" */ ++ + /* + * Leaf 2 (0x40000x01) + * EAX[31:16]: Xen major version. +diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h +index 99c40b4..5bec661 100644 +--- a/xen/include/public/hvm/params.h ++++ b/xen/include/public/hvm/params.h +@@ -290,7 +290,9 @@ + #define HVM_PARAM_MCA_CAP 38 + #define XEN_HVM_MCA_CAP_LMCE (xen_mk_ullong(1) << 0) + #define XEN_HVM_MCA_CAP_MASK XEN_HVM_MCA_CAP_LMCE ++#define HVM_PARAM_SPOOF_XEN 39 + +-#define HVM_NR_PARAMS 39 ++#define HVM_PARAM_SPOOF_VIRIDIAN 40 ++#define HVM_NR_PARAMS 41 + + #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ + +diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c +index 36832e4..2be4178 100644 +--- a/tools/xl/xl_parse.c ++++ b/tools/xl/xl_parse.c +@@ -1670,6 +1670,10 @@ + xlu_cfg_get_defbool(config, "vpt_align", &b_info->u.hvm.vpt_align, 0); + xlu_cfg_get_defbool(config, "apic", &b_info->apic, 0); + ++ /* For spoofing Xen */ ++ xlu_cfg_get_defbool(config, "spoof_xen", &b_info->u.hvm.spoof_xen, 0); ++ xlu_cfg_get_defbool(config, "spoof_viridian", &b_info->u.hvm.spoof_viridian, 0); ++ + switch (xlu_cfg_get_list(config, "viridian", + &viridian, &num_viridian, 1)) + { + +diff --git a/xen/arch/x86/include/asm/hvm/domain.h b/xen/arch/x86/include/asm/hvm/domain.h +index dd9d837..9f2e863 100644 +--- a/xen/arch/x86/include/asm/hvm/domain.h ++++ b/xen/arch/x86/include/asm/hvm/domain.h +@@ -106,6 +106,9 @@ struct hvm_domain { + + bool is_s3_suspended; + ++ bool spoof_xen; ++ bool spoof_virdian; ++ + /* Compatibility setting for a bug in x2APIC LDR */ + bool bug_x2apic_ldr_vcpu_id; + diff --git a/pkg/xen-tools/patches-4.19.0/x86_64/07-patch-seabios.patch b/pkg/xen-tools/patches-4.19.0/x86_64/07-patch-seabios.patch new file mode 100644 index 00000000000..562a262ab68 --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/x86_64/07-patch-seabios.patch @@ -0,0 +1,12 @@ +diff --git a/tools/firmware/Makefile b/tools/firmware/Makefile +index 345037b..b70255e 100644 +--- a/tools/firmware/Makefile ++++ b/tools/firmware/Makefile +@@ -26,6 +26,7 @@ ovmf-dir: + seabios-dir: + GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_REVISION) seabios-dir + cp seabios-config seabios-dir/.config; ++ cd seabios-dir && patch -p1 < /patches/x86_64/patch.seabios + $(MAKE) -C seabios-dir olddefconfig CC=$(SEABIOSCC) LD=$(SEABIOSLD) + rm -f seabios-dir/.version + echo '$(SEABIOS_UPSTREAM_REVISION)' > seabios-dir/.version \ No newline at end of file diff --git a/pkg/xen-tools/patches-4.19.0/x86_64/08-Revert__Revert__vfio_pci-quirks_c__Disable_stolen_memory_for_igd_VFIO__.patch b/pkg/xen-tools/patches-4.19.0/x86_64/08-Revert__Revert__vfio_pci-quirks_c__Disable_stolen_memory_for_igd_VFIO__.patch new file mode 100644 index 00000000000..1aa6e5086ec --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/x86_64/08-Revert__Revert__vfio_pci-quirks_c__Disable_stolen_memory_for_igd_VFIO__.patch @@ -0,0 +1,94 @@ +diff --git a/tools/qemu-xen/hw/vfio/igd.c b/tools/qemu-xen/hw/vfio/igd.c +index b31ee79..e85d26a 100644 +--- a/tools/qemu-xen/hw/vfio/igd.c ++++ b/tools/qemu-xen/hw/vfio/igd.c +@@ -252,7 +252,6 @@ static int vfio_igd_gtt_max(VFIOPCIDevice *vdev) + uint32_t gmch = vfio_pci_read_config(&vdev->pdev, IGD_GMCH, sizeof(gmch)); + int ggms, gen = igd_gen(vdev); + +- gmch = vfio_pci_read_config(&vdev->pdev, IGD_GMCH, sizeof(gmch)); + ggms = (gmch >> (gen < 8 ? 8 : 6)) & 0x3; + if (gen > 6) { + ggms = 1 << ggms; +@@ -378,16 +377,11 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) + uint16_t cmd_orig, cmd; + Error *err = NULL; + +- /* +- * This must be an Intel VGA device at address 00:02.0 for us to even +- * consider enabling legacy mode. The vBIOS has dependencies on the +- * PCI bus address. +- */ ++ + if (!vfio_pci_is(vdev, PCI_VENDOR_ID_INTEL, PCI_ANY_ID) || +- !vfio_is_vga(vdev) || nr != 4 || +- &vdev->pdev != pci_find_device(pci_device_root_bus(&vdev->pdev), +- 0, PCI_DEVFN(0x2, 0))) { +- return; ++ !vfio_is_vga(vdev) || nr != 4 ) { ++ ++ return; + } + + /* +@@ -404,19 +398,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) + return; + } + +- /* +- * IGD is not a standard, they like to change their specs often. We +- * only attempt to support back to SandBridge and we hope that newer +- * devices maintain compatibility with generation 8. +- */ +- gen = igd_gen(vdev); +- if (gen != 6 && gen != 8) { +- error_report("IGD device %s is unsupported in legacy mode, " +- "try SandyBridge or newer", vdev->vbasedev.name); +- return; +- } +- +- /* ++ /* + * Most of what we're doing here is to enable the ROM to run, so if + * there's no ROM, there's no point in setting up this quirk. + * NB. We only seem to get BIOS ROMs, so a UEFI VM would need CSM support. +@@ -471,8 +453,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) + goto out; + } + +- gmch = vfio_pci_read_config(&vdev->pdev, IGD_GMCH, 4); +- ++ + /* + * If IGD VGA Disable is clear (expected) and VGA is not already enabled, + * try to enable it. Probably shouldn't be using legacy mode without VGA, +@@ -541,13 +522,14 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) + * when IVD (IGD VGA Disable) is clear, but the claim is that it's unused, + * so let's not waste VM memory for it. + */ +- gmch &= ~((gen < 8 ? 0x1f : 0xff) << (gen < 8 ? 3 : 8)); +- ++ + if (vdev->igd_gms) { + if (vdev->igd_gms <= 0x10) { + gms_mb = vdev->igd_gms * 32; + gmch |= vdev->igd_gms << (gen < 8 ? 3 : 8); +- } else { ++ pci_set_long(vdev->pdev.config + IGD_GMCH, gmch); ++ ++ } else { + error_report("Unsupported IGD GMS value 0x%x", vdev->igd_gms); + vdev->igd_gms = 0; + } +@@ -566,11 +548,6 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) + fw_cfg_add_file(fw_cfg_find(), "etc/igd-bdsm-size", + bdsm_size, sizeof(*bdsm_size)); + +- /* GMCH is read-only, emulated */ +- pci_set_long(vdev->pdev.config + IGD_GMCH, gmch); +- pci_set_long(vdev->pdev.wmask + IGD_GMCH, 0); +- pci_set_long(vdev->emulated_config_bits + IGD_GMCH, ~0); +- + /* BDSM is read-write, emulated. The BIOS needs to be able to write it */ + pci_set_long(vdev->pdev.config + IGD_BDSM, 0); + pci_set_long(vdev->pdev.wmask + IGD_BDSM, ~0); diff --git a/pkg/xen-tools/patches-4.19.0/x86_64/patch.seabios b/pkg/xen-tools/patches-4.19.0/x86_64/patch.seabios new file mode 100644 index 00000000000..9703fda8ebe --- /dev/null +++ b/pkg/xen-tools/patches-4.19.0/x86_64/patch.seabios @@ -0,0 +1,25 @@ +diff --git a/src/fw/xen.c b/src/fw/xen.c +index a215b9e..d7fa66b 100644 +--- a/src/fw/xen.c ++++ b/src/fw/xen.c +@@ -81,6 +81,18 @@ void xen_preinit(void) + xen_cpuid_base = base; + break; + } ++ if (strcmp(signature, "ZenZenZenZen") == 0) { ++ /* Set debug_io_port first, so the following messages work. */ ++ code_mutable_preinit(); ++ DebugOutputPort = 0xe9; ++ debug_banner(); ++ dprintf(1, "\nFound Xen hypervisor signature at %x\n", base); ++ if ((eax - base) < 2) ++ panic("Insufficient Xen cpuid leaves. eax=%x at base %x\n", ++ eax, base); ++ xen_cpuid_base = base; ++ break; ++ } + } + if (!xen_cpuid_base) { + dprintf(1, "No Xen hypervisor found.\n"); + + } diff --git a/pkg/xen/Dockerfile b/pkg/xen/Dockerfile index 0348586fa73..2e58c1e39e2 100644 --- a/pkg/xen/Dockerfile +++ b/pkg/xen/Dockerfile @@ -8,7 +8,7 @@ ENV BUILD_PKGS_arm64 u-boot-tools RUN eve-alpine-deploy.sh ENV XEN_UBOOT_ADDR 0x81000000 -ENV XEN_VERSION 4.15.0 +ENV XEN_VERSION 4.19.0 ENV XEN_SOURCE=https://downloads.xenproject.org/release/xen/${XEN_VERSION}/xen-${XEN_VERSION}.tar.gz # Download and verify xen @@ -19,8 +19,6 @@ RUN [ -f "$(basename ${XEN_SOURCE})" ] || tar --absolute-names -xz < /xen.tar.gz WORKDIR /xen/xen COPY *.patch arch /tmp/ -RUN cp /tmp/"$(uname -m)"/*.patch /tmp/ -RUN for p in /tmp/*.patch ; do patch -p1 < "$p" || exit 1 ; done RUN chmod +x scripts/* || : RUN make defconfig && \