Skip to contentSkip to conversation

uxen-guest-tools: fix build against kernels 5.4+

PATCH In review Martin Jansa 2 participants 6 messages Dec 1, 2021 – Dec 2, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 uxen-guest-tools: fix build against kernels 5.4+

From: Bruce Ashfield <[email protected]>

This is a compile only fix to update the uxen kernel modules to work against newer kernels.

---
 ...m-support-fix-build-for-kernel-s-5.4.patch | 97 +++++++++++++++++++
 .../uxen/uxen-guest-tools_4.1.8.bb            |  1 +
 2 files changed, 98 insertions(+)
 create mode 100644 recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-kernel-s-5.4.patch
recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-kernel-s-5.4.patch new file +97 -0
new file mode 100644
index 0000000..a3325ce
@@ -0,0 +1,97 @@
+From 21bb6953a64390dd1c5a8b7520eb5e2c18ea3ff1 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <[email protected]>
+Date: Mon, 29 Nov 2021 21:01:03 -0500
+Subject: [PATCH] vm-support: fix build for kernel's > 5.4
+
+Signed-off-by: Bruce Ashfield <[email protected]>
+---
+ a/uxenhc/hypercall.c             | 10 +++++++++-
+ a/v4vvsock/v4v_vsock.c           |  2 ++
+ a/vmdiagnostics/vm_diagnostics.c |  9 ++++++++-
+ 3 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/uxenhc/hypercall.c b/uxenhc/hypercall.c
+index 0b9ef3f..04957a8 100644
+--- a/uxenhc/hypercall.c
++++ b/uxenhc/hypercall.c
+@@ -10,6 +10,7 @@
+ #include <linux/mm.h>
+ #include <linux/spinlock.h>
+ #include <linux/compiler.h>
++#include <linux/version.h>
+ 
+ #include <xen/xen.h>
+ #include <xen/version.h>
+@@ -124,7 +125,11 @@ static int __init uxen_hypercall_init(void)
+     printk(KERN_INFO "using uxen hypervisor\n");
+ 
+     if (!uxen_hcbase) {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0))
+         uxen_hcbase =  __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_EXEC);
++#else
++	uxen_hcbase =  __vmalloc(PAGE_SIZE, GFP_KERNEL);
++#endif
+         if (!uxen_hcbase) {
+             ret = -ENOMEM;
+             goto out;
+@@ -149,8 +154,11 @@ static void __exit uxen_hypercall_exit(void)
+ {
+ }
+ 
++
++#define KBUILD_MODFILE "uxenhc"
++
+ module_init(uxen_hypercall_init);
+ module_exit(uxen_hypercall_exit);
++MODULE_LICENSE("GPL");
+ MODULE_AUTHOR("[email protected]");
+ MODULE_DESCRIPTION("uXen hypercall support");
+-MODULE_LICENSE("GPL");
+diff --git a/v4vvsock/v4v_vsock.c b/v4vvsock/v4v_vsock.c
+index 8d80d7d..cd7e8ce 100644
+--- a/v4vvsock/v4v_vsock.c
++++ b/v4vvsock/v4v_vsock.c
+@@ -578,8 +578,10 @@ static const struct proto_ops vsock_dgram_ops = {
+     .ioctl = sock_no_ioctl,
+     .listen = sock_no_listen,
+     .shutdown = sock_no_shutdown,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0))
+     .setsockopt = sock_no_setsockopt,
+     .getsockopt = sock_no_getsockopt,
++#endif
+     .sendmsg = vsock_sendmsg,
+     .recvmsg = vsock_recvmsg,
+     .mmap = sock_no_mmap,
+diff --git a/vmdiagnostics/vm_diagnostics.c b/vmdiagnostics/vm_diagnostics.c
+index 9ff94fb..db14e57 100644
+--- a/vmdiagnostics/vm_diagnostics.c
++++ b/vmdiagnostics/vm_diagnostics.c
+@@ -22,6 +22,7 @@
+ #include <linux/timekeeping.h>
+ #include <linux/types.h>
+ #include <linux/vmstat.h>
++#include <linux/version.h>
+ 
+ #include <uxen-v4vlib.h>
+ 
+@@ -403,10 +404,16 @@ static void vm_handle_request_stat_task(struct vm_diagnostics_context *context,
+  
+             task_payload.state = task_state_to_char(task);
+             task_payload.num_threads = get_nr_threads(task);
++
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0))
+             task_payload.start_time_nsec = task->real_start_time;
++#else
++            task_payload.start_time_nsec = task->start_boottime;
++#endif
++
+             task_payload.last_run_cpu_id = task_cpu(task);
+ 
+-            thread_group_cputime_adjusted(task, &user_nsec, &system_nsec);
++            //thread_group_cputime_adjusted(task, &user_nsec, &system_nsec);
+             task_payload.user_nsec = user_nsec;
+             task_payload.system_nsec = system_nsec;
+ 
+-- 
+2.19.1
+
recipes-extended/uxen/uxen-guest-tools_4.1.8.bb +1 -0
index 2ca0cb1..06dc376 100644
@@ -9,6 +9,7 @@ SRC_URI = " \
     https://www.bromium.com/wp-content/uploads/2019/11/uxen-${PV}.zip;name=uxen \
     https://www.bromium.com/wp-content/uploads/2019/11/Bromium-4.1.8-Open-Source-Software.pdf;name=license \
     file://fix-Makefile-for-OE-kernel-build.patch \
+    file://0001-vm-support-fix-build-for-kernel-s-5.4.patch \
     "
 
 SRC_URI[uxen.sha384sum] = "be2233bc6506a23350d76c03ac28ea7ea381e1dc6ed5ce996e8ac71e6a3316fcaa2ed070c622618bd226f43a4d6db5d4"
Signature · 1 line
2.32.0
#1 lore raw

PATCH 2/5 uxen-guest-tools: fix build against kernels 5.15+

This is a compile only fix to update the uxen kernel modules to work against newer kernels.

---
 ...-support-fix-build-for-kernel-s-5.15.patch | 46 +++++++++++++++++++
 ...-support-fix-build-for-kernel-s-5.14.patch | 32 +++++++++++++
 .../uxen/uxen-guest-tools_4.1.8.bb            |  4 +-
 3 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 recipes-extended/uxen/uxen-guest-tools/0002-vm-support-fix-build-for-kernel-s-5.15.patch
 create mode 100644 recipes-extended/uxen/uxen-guest-tools/0003-vm-support-fix-build-for-kernel-s-5.14.patch
recipes-extended/uxen/uxen-guest-tools/0002-vm-support-fix-build-for-kernel-s-5.15.patch new file +46 -0
new file mode 100644
index 0000000..6b7f1f8
@@ -0,0 +1,46 @@
+From f8a33a209498b32b0fc06d80baa071f0902b9a85 Mon Sep 17 00:00:00 2001
+From: Martin Jansa <[email protected]>
+Date: Tue, 30 Nov 2021 06:45:34 -0800
+Subject: [PATCH] vm-support: fix build for kernel's > 5.15
+
+* remove callback was changed to return void instead of int in:
+  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc7a6209d5710618eb4f72a77cd81b8d694ecf89
+
+Signed-off-by: Martin Jansa <[email protected]>
+---
+ uxenplatform/platform.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/uxenplatform/platform.c b/uxenplatform/platform.c
+index 99fc76a..5225a00 100644
+--- a/uxenplatform/platform.c
++++ b/uxenplatform/platform.c
+@@ -4,6 +4,7 @@
+ #include <linux/random.h>
+ #include <linux/kthread.h>
+ #include <linux/delay.h>
++#include <linux/version.h>
+ 
+ #include <uxen-hypercall.h>
+ #include <uxen-platform.h>
+@@ -32,14 +33,20 @@ static int bus_probe(struct device *_dev)
+     return drv && drv->probe ? drv->probe(dev) : -ENODEV;
+ }
+ 
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0))
+ static int bus_remove(struct device *_dev)
++#else
++static void bus_remove(struct device *_dev)
++#endif
+ {
+     struct uxen_device *dev = dev_to_uxen(_dev);
+     struct uxen_driver *drv = drv_to_uxen(_dev->driver);
+ 
+     if (dev && drv && drv->remove)
+        drv->remove(dev);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0))
+     return 0;
++#endif
+ }
+ 
+ static int bus_suspend(struct device *_dev, pm_message_t state)
recipes-extended/uxen/uxen-guest-tools/0003-vm-support-fix-build-for-kernel-s-5.14.patch new file +32 -0
new file mode 100644
index 0000000..ec31eea
@@ -0,0 +1,32 @@
+From 59986e91d807591f05dfbd57b459ba71670874f9 Mon Sep 17 00:00:00 2001
+From: Martin Jansa <[email protected]>
+Date: Tue, 30 Nov 2021 15:04:31 +0000
+Subject: [PATCH] vm-support: fix build for kernel's > 5.14
+
+* remove set_driver_byte call
+* not sure if it's still necessary here, but set_driver_byte as well as DRIVER_SENSE was killed in 5.14 with:
+  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=464a00c9e0ad45e3f42ff6ea705491a356df818e
+
+  in some cases it was replaced with set_status_byte(sc, SAM_STAT_CHECK_CONDITION), but I didn't
+  read the implementation carefully enough to decide if this is still needed, I was only interested
+  in fixing the build failure (and I don't use this at all to test it in runtime)
+
+Signed-off-by: Martin Jansa <[email protected]>
+---
+ uxenstor/stor.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/uxenstor/stor.c b/uxenstor/stor.c
+index e07b08e..6bf2184 100644
+--- a/uxenstor/stor.c
++++ b/uxenstor/stor.c
+@@ -109,7 +109,9 @@ static void uxenstor_softirq(unsigned long opaque)
+                                          sc->sense_buffer,
+                                          sizeof(hdr) + hdr.sense_size,
+                                          0, sizeof(hdr));
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,14,0))
+                 set_driver_byte(sc, DRIVER_SENSE);
++#endif
+             }
+ 
+             set_host_byte(sc, DID_ERROR);
recipes-extended/uxen/uxen-guest-tools_4.1.8.bb +3 -1
index 06dc376..841c71a 100644
@@ -10,7 +10,9 @@ SRC_URI = " \
     https://www.bromium.com/wp-content/uploads/2019/11/Bromium-4.1.8-Open-Source-Software.pdf;name=license \
     file://fix-Makefile-for-OE-kernel-build.patch \
     file://0001-vm-support-fix-build-for-kernel-s-5.4.patch \
-    "
+    file://0002-vm-support-fix-build-for-kernel-s-5.15.patch \
+    file://0003-vm-support-fix-build-for-kernel-s-5.14.patch \
+"
 
 SRC_URI[uxen.sha384sum] = "be2233bc6506a23350d76c03ac28ea7ea381e1dc6ed5ce996e8ac71e6a3316fcaa2ed070c622618bd226f43a4d6db5d4"
 SRC_URI[license.sha384sum] = "92e48c614df3094cb52321d4c4e01f6df5526d46aee5c6fa36c43ee23d4c33f03baa1fc5f6f29efafff636b6d13bc92c"
Signature · 1 line
2.32.0
#2 lore raw

PATCH 3/5 uxen-guest-tools: fix -DMODULE not working when building uxenhc module

In reply to Martin Jansa

* undo the unnecessary and incomplete changes from 0001-vm-support-fix-build-for-kernel-s-5.4.patch because with 5.15 it was still failing with:
ERROR: modpost: missing MODULE_LICENSE() in uxen-guest-tools/4.1.8-r0/uxen-4.1.8-72a4af9/vm-support/linux/uxenhc/uxenhc.o

fix it properly in 0004-uxenhc-fix-DMODULE-not-working-on-module-build-comma.patch

---
 ...m-support-fix-build-for-kernel-s-5.4.patch | 13 -----
 ...LE-not-working-on-module-build-comma.patch | 56 +++++++++++++++++++
 .../uxen/uxen-guest-tools_4.1.8.bb            |  1 +
 3 files changed, 57 insertions(+), 13 deletions(-)
 create mode 100644 recipes-extended/uxen/uxen-guest-tools/0004-uxenhc-fix-DMODULE-not-working-on-module-build-comma.patch
recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-kernel-s-5.4.patch +0 -13
index a3325ce..287170c 100644
@@ -34,19 +34,6 @@ index 0b9ef3f..04957a8 100644
          if (!uxen_hcbase) {
              ret = -ENOMEM;
              goto out;
-@@ -149,8 +154,11 @@ static void __exit uxen_hypercall_exit(void)
- {
- }
- 
-+
-+#define KBUILD_MODFILE "uxenhc"
-+
- module_init(uxen_hypercall_init);
- module_exit(uxen_hypercall_exit);
-+MODULE_LICENSE("GPL");
- MODULE_AUTHOR("[email protected]");
- MODULE_DESCRIPTION("uXen hypercall support");
--MODULE_LICENSE("GPL");
 diff --git a/v4vvsock/v4v_vsock.c b/v4vvsock/v4v_vsock.c
 index 8d80d7d..cd7e8ce 100644
 --- a/v4vvsock/v4v_vsock.c
recipes-extended/uxen/uxen-guest-tools/0004-uxenhc-fix-DMODULE-not-working-on-module-build-comma.patch new file +56 -0

56 lines not on this page · raw message

recipes-extended/uxen/uxen-guest-tools_4.1.8.bb +1 -0
index 841c71a..529efdb 100644
@@ -12,6 +12,7 @@ SRC_URI = " \
     file://0001-vm-support-fix-build-for-kernel-s-5.4.patch \
     file://0002-vm-support-fix-build-for-kernel-s-5.15.patch \
     file://0003-vm-support-fix-build-for-kernel-s-5.14.patch \
+    file://0004-uxenhc-fix-DMODULE-not-working-on-module-build-comma.patch \
 "
 
 SRC_URI[uxen.sha384sum] = "be2233bc6506a23350d76c03ac28ea7ea381e1dc6ed5ce996e8ac71e6a3316fcaa2ed070c622618bd226f43a4d6db5d4"
Signature · 1 line
2.32.0
#3 lore raw

PATCH 4/5 xvisor: uprev to latest master and fix python reference

In reply to Martin Jansa

From: Bruce Ashfield <[email protected]>

Bumping to the latest xvisor tip.

We drop one patch that is now part of the upstream, and we add another to remove /usr/bin/python from scripts called during build, since it breaks the build on hosts without /usr/bin/python.

---
 ...-Allow-Xvisor-to-compile-with-gcc-10.patch | 55 -------------------
 ...d-use-usr-bin-env-for-python-scripts.patch | 36 ++++++++++++
 recipes-extended/xvisor/xvisor_git.bb         |  4 +-
 3 files changed, 38 insertions(+), 57 deletions(-)
 delete mode 100644 recipes-extended/xvisor/files/0001-EMULATORS-Allow-Xvisor-to-compile-with-gcc-10.patch
 create mode 100644 recipes-extended/xvisor/files/0001-build-use-usr-bin-env-for-python-scripts.patch
recipes-extended/xvisor/files/0001-EMULATORS-Allow-Xvisor-to-compile-with-gcc-10.patch deleted +0 -55
deleted file mode 100644
index 221a314..0000000
@@ -1,55 +0,0 @@
-From 417184cc41cfd33ae7b4c11c8396e0f47f43e2ba Mon Sep 17 00:00:00 2001
-From: Jean-Christophe Dubois <[email protected]>
-Date: Fri, 8 May 2020 15:17:36 +0200
-Subject: [PATCH] EMULATORS: Allow Xvisor to compile with gcc 10.
-
-With gcc 10 because some header files do not declare some variable
-definition as extern, the variable get duplicated in all files
-using it.
-
-This patch allow xvisor to compile with the latest gcc.
-
-Signed-off-by: Jean-Christophe Dubois <[email protected]>
-Reviewed-by: Anup Patel <[email protected]>
----
- drivers/mmc/core/core.h    |  2 +-
- emulators/display/drawfn.h | 10 +++++-----
- 2 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
-index d75d135a..e2ca3141 100644
---- a/drivers/mmc/core/core.h
-+++ b/drivers/mmc/core/core.h
-@@ -64,7 +64,7 @@ int mmc_go_idle(struct mmc_host *host);
-  * Note: Must be called with host->lock held.
-  */
- extern struct vmm_bus sdio_bus_type;
--struct vmm_device_type sdio_func_type;
-+extern struct vmm_device_type sdio_func_type;
- 
- int __sdio_attach(struct mmc_host *host);
- 
-diff --git a/emulators/display/drawfn.h b/emulators/display/drawfn.h
-index f9163cff..385deaf6 100644
---- a/emulators/display/drawfn.h
-+++ b/emulators/display/drawfn.h
-@@ -69,14 +69,14 @@ typedef void (*drawfn)(struct vmm_surface *,
- 				 DRAWFN_ORDER_MAX * \
- 				 DRAWFN_FORMAT_MAX)
- 
--drawfn drawfn_surface_fntable_8[DRAWFN_FNTABLE_SIZE];
-+extern drawfn drawfn_surface_fntable_8[DRAWFN_FNTABLE_SIZE];
- 
--drawfn drawfn_surface_fntable_15[DRAWFN_FNTABLE_SIZE];
-+extern drawfn drawfn_surface_fntable_15[DRAWFN_FNTABLE_SIZE];
- 
--drawfn drawfn_surface_fntable_16[DRAWFN_FNTABLE_SIZE];
-+extern drawfn drawfn_surface_fntable_16[DRAWFN_FNTABLE_SIZE];
- 
--drawfn drawfn_surface_fntable_24[DRAWFN_FNTABLE_SIZE];
-+extern drawfn drawfn_surface_fntable_24[DRAWFN_FNTABLE_SIZE];
- 
--drawfn drawfn_surface_fntable_32[DRAWFN_FNTABLE_SIZE];
-+extern drawfn drawfn_surface_fntable_32[DRAWFN_FNTABLE_SIZE];
- 
- #endif
recipes-extended/xvisor/files/0001-build-use-usr-bin-env-for-python-scripts.patch new file +36 -0
new file mode 100644
index 0000000..dfbb00b
@@ -0,0 +1,36 @@
+From eb351ca63a86f53cfb18987284a1445d543dfe56 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <[email protected]>
+Date: Mon, 29 Nov 2021 17:20:00 -0500
+Subject: [PATCH] build: use /usr/bin/env for python scripts
+
+Without this, we break on hosts without /usr/bin/python
+
+Signed-off-by: Bruce Ashfield <[email protected]>
+---
+ tools/scripts/d2c.py    | 2 +-
+ tools/scripts/memimg.py | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/scripts/d2c.py b/tools/scripts/d2c.py
+index b46a7bc4..0a6bce08 100755
+--- a/tools/scripts/d2c.py
++++ b/tools/scripts/d2c.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+ #/**
+ # Copyright (c) 2013 Anup Patel.
+ # All rights reserved.
+diff --git a/tools/scripts/memimg.py b/tools/scripts/memimg.py
+index 423c9c33..ba2f06cb 100755
+--- a/tools/scripts/memimg.py
++++ b/tools/scripts/memimg.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+ #/**
+ # Copyright (c) 2011 Anup Patel.
+ # All rights reserved.
+-- 
+2.19.1
+
recipes-extended/xvisor/xvisor_git.bb +2 -2
index 749fec3..4d2a719 100644
@@ -9,10 +9,10 @@ require xvisor-configs.inc
 inherit autotools-brokensep
 
 # This version support the RISC-V v0.5.0 Hypervisor extensions
-SRCREV = "b3dac5b1f61f23f21dc59b3880897cff78f3b618"
+SRCREV = "6b23764a1439f9d08b2ed2f363da522460d8a22b"
 SRC_URI = "git://github.com/avpatel/xvisor-next.git;branch=master;protocol=https \
     file://0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch \
-    file://0001-EMULATORS-Allow-Xvisor-to-compile-with-gcc-10.patch \
+    file://0001-build-use-usr-bin-env-for-python-scripts.patch \
 "
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.32.0
#4 lore raw

PATCH 5/5 xvisor: set PV

In reply to Martin Jansa

* use something more reasonable than default 'git' from filename
* there wasn't a new tag for a long time, so this is quite far from 0.3.0 as git describe shows:
v0.3.0-231-g6b23764a
but 0.3.0 is still the closest release I've found and matches PROJECT_VERSION in Makefile:
https://github.com/avpatel/xvisor-next/blob/6b23764a1439f9d08b2ed2f363da522460d8a22b/Makefile#L29

---
 recipes-extended/xvisor/xvisor_git.bb | 2 ++
 1 file changed, 2 insertions(+)
recipes-extended/xvisor/xvisor_git.bb +2 -0
index 4d2a719..26b4e0f 100644
@@ -8,6 +8,8 @@ require xvisor-configs.inc
 
 inherit autotools-brokensep
 
+PV = "0.3.0+git${SRCPV}"
+
 # This version support the RISC-V v0.5.0 Hypervisor extensions
 SRCREV = "6b23764a1439f9d08b2ed2f363da522460d8a22b"
 SRC_URI = "git://github.com/avpatel/xvisor-next.git;branch=master;protocol=https \
Signature · 1 line
2.32.0
#5 lore raw
In reply to Martin Jansa

5/5 are now merged to honister.

Thanks!

Bruce

In message: [meta-virtualization][honister][PATCH 1/5] uxen-guest-tools: fix build against kernels 5.4+

Quoted 130 lines · on 01/12/2021 Martin Jansa wrote:

From: Bruce Ashfield <[email protected]>

This is a compile only fix to update the uxen kernel modules to work against newer kernels.

---
 ...m-support-fix-build-for-kernel-s-5.4.patch | 97 +++++++++++++++++++
 .../uxen/uxen-guest-tools_4.1.8.bb            |  1 +
 2 files changed, 98 insertions(+)
 create mode 100644 recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-kernel-s-5.4.patch
recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-kernel-s-5.4.patch new file +97 -0
new file mode 100644
index 0000000..a3325ce
@@ -0,0 +1,97 @@
+From 21bb6953a64390dd1c5a8b7520eb5e2c18ea3ff1 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <[email protected]>
+Date: Mon, 29 Nov 2021 21:01:03 -0500
+Subject: [PATCH] vm-support: fix build for kernel's > 5.4
+
+Signed-off-by: Bruce Ashfield <[email protected]>
+---
+ a/uxenhc/hypercall.c             | 10 +++++++++-
+ a/v4vvsock/v4v_vsock.c           |  2 ++
+ a/vmdiagnostics/vm_diagnostics.c |  9 ++++++++-
+ 3 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/uxenhc/hypercall.c b/uxenhc/hypercall.c
+index 0b9ef3f..04957a8 100644
+--- a/uxenhc/hypercall.c
++++ b/uxenhc/hypercall.c
+@@ -10,6 +10,7 @@
+ #include <linux/mm.h>
+ #include <linux/spinlock.h>
+ #include <linux/compiler.h>
++#include <linux/version.h>
+ 
+ #include <xen/xen.h>
+ #include <xen/version.h>
+@@ -124,7 +125,11 @@ static int __init uxen_hypercall_init(void)
+     printk(KERN_INFO "using uxen hypervisor\n");
+ 
+     if (!uxen_hcbase) {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0))
+         uxen_hcbase =  __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_EXEC);
++#else
++	uxen_hcbase =  __vmalloc(PAGE_SIZE, GFP_KERNEL);
++#endif
+         if (!uxen_hcbase) {
+             ret = -ENOMEM;
+             goto out;
+@@ -149,8 +154,11 @@ static void __exit uxen_hypercall_exit(void)
+ {
+ }
+ 
++
++#define KBUILD_MODFILE "uxenhc"
++
+ module_init(uxen_hypercall_init);
+ module_exit(uxen_hypercall_exit);
++MODULE_LICENSE("GPL");
+ MODULE_AUTHOR("[email protected]");
+ MODULE_DESCRIPTION("uXen hypercall support");
+-MODULE_LICENSE("GPL");
+diff --git a/v4vvsock/v4v_vsock.c b/v4vvsock/v4v_vsock.c
+index 8d80d7d..cd7e8ce 100644
+--- a/v4vvsock/v4v_vsock.c
++++ b/v4vvsock/v4v_vsock.c
+@@ -578,8 +578,10 @@ static const struct proto_ops vsock_dgram_ops = {
+     .ioctl = sock_no_ioctl,
+     .listen = sock_no_listen,
+     .shutdown = sock_no_shutdown,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0))
+     .setsockopt = sock_no_setsockopt,
+     .getsockopt = sock_no_getsockopt,
++#endif
+     .sendmsg = vsock_sendmsg,
+     .recvmsg = vsock_recvmsg,
+     .mmap = sock_no_mmap,
+diff --git a/vmdiagnostics/vm_diagnostics.c b/vmdiagnostics/vm_diagnostics.c
+index 9ff94fb..db14e57 100644
+--- a/vmdiagnostics/vm_diagnostics.c
++++ b/vmdiagnostics/vm_diagnostics.c
+@@ -22,6 +22,7 @@
+ #include <linux/timekeeping.h>
+ #include <linux/types.h>
+ #include <linux/vmstat.h>
++#include <linux/version.h>
+ 
+ #include <uxen-v4vlib.h>
+ 
+@@ -403,10 +404,16 @@ static void vm_handle_request_stat_task(struct vm_diagnostics_context *context,
+  
+             task_payload.state = task_state_to_char(task);
+             task_payload.num_threads = get_nr_threads(task);
++
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0))
+             task_payload.start_time_nsec = task->real_start_time;
++#else
++            task_payload.start_time_nsec = task->start_boottime;
++#endif
++
+             task_payload.last_run_cpu_id = task_cpu(task);
+ 
+-            thread_group_cputime_adjusted(task, &user_nsec, &system_nsec);
++            //thread_group_cputime_adjusted(task, &user_nsec, &system_nsec);
+             task_payload.user_nsec = user_nsec;
+             task_payload.system_nsec = system_nsec;
+ 
+-- 
+2.19.1
+
recipes-extended/uxen/uxen-guest-tools_4.1.8.bb +1 -0
index 2ca0cb1..06dc376 100644
@@ -9,6 +9,7 @@ SRC_URI = " \
     https://www.bromium.com/wp-content/uploads/2019/11/uxen-${PV}.zip;name=uxen \
     https://www.bromium.com/wp-content/uploads/2019/11/Bromium-4.1.8-Open-Source-Software.pdf;name=license \
     file://fix-Makefile-for-OE-kernel-build.patch \
+    file://0001-vm-support-fix-build-for-kernel-s-5.4.patch \
     "
 
 SRC_URI[uxen.sha384sum] = "be2233bc6506a23350d76c03ac28ea7ea381e1dc6ed5ce996e8ac71e6a3316fcaa2ed070c622618bd226f43a4d6db5d4"
Signature · 1 line
2.32.0