Skip to content

Commit

Permalink
Upgraded Xen-tools from 4.15 to 4.19.0
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
roja-zededa committed Aug 29, 2024
1 parent c22f581 commit 05a525b
Show file tree
Hide file tree
Showing 18 changed files with 1,377 additions and 30 deletions.
4 changes: 2 additions & 2 deletions pkg/pillar/hypervisor/kvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
36 changes: 18 additions & 18 deletions pkg/pillar/hypervisor/kvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -639,8 +639,8 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
append = "init=/bin/sh"
[realtime]
mlock = "off"
[overcommit]
mem-lock = "off"
[chardev "charmonitor"]
backend = "socket"
Expand Down Expand Up @@ -1099,8 +1099,8 @@ func domConfigArm64() string {
append = "init=/bin/sh"
[realtime]
mlock = "off"
[overcommit]
mem-lock = "off"
[chardev "charmonitor"]
backend = "socket"
Expand Down Expand Up @@ -1381,8 +1381,8 @@ func domConfigAmd64FML() string {
driver = "intel-iommu"
caching-mode = "on"
[realtime]
mlock = "off"
[overcommit]
mem-lock = "off"
[chardev "charmonitor"]
backend = "socket"
Expand Down Expand Up @@ -1674,8 +1674,8 @@ func domConfigAmd64Legacy() string {
driver = "intel-iommu"
caching-mode = "on"
[realtime]
mlock = "off"
[overcommit]
mem-lock = "off"
[chardev "charmonitor"]
backend = "socket"
Expand Down Expand Up @@ -1958,8 +1958,8 @@ func domConfigAmd64() string {
driver = "intel-iommu"
caching-mode = "on"
[realtime]
mlock = "off"
[overcommit]
mem-lock = "off"
[chardev "charmonitor"]
backend = "socket"
Expand Down Expand Up @@ -2238,8 +2238,8 @@ func domConfigContainerVNC() string {
driver = "intel-iommu"
caching-mode = "on"
[realtime]
mlock = "off"
[overcommit]
mem-lock = "off"
[chardev "charmonitor"]
backend = "socket"
Expand Down Expand Up @@ -2539,8 +2539,8 @@ func TestCreateDom(t *testing.T) {
property = "disable_s4"
value = "1"
[realtime]
mlock = "off"
[overcommit]
mem-lock = "off"
[rtc]
base = "localtime"
Expand Down
19 changes: 12 additions & 7 deletions pkg/xen-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 /

Expand All @@ -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
Expand All @@ -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

Expand Down
33 changes: 33 additions & 0 deletions pkg/xen-tools/patches-4.19.0/00-musl-support.patch
Original file line number Diff line number Diff line change
@@ -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) \
13 changes: 13 additions & 0 deletions pkg/xen-tools/patches-4.19.0/01-enable-gmp-patching.patch
Original file line number Diff line number Diff line change
@@ -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 $@
Original file line number Diff line number Diff line change
@@ -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

Loading

0 comments on commit 05a525b

Please sign in to comment.