From: Bruce Ashfield <[email protected]>

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

Signed-off-by: Bruce Ashfield <[email protected]>
---
 ...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

diff --git 
a/recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-kernel-s-5.4.patch
 
b/recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-kernel-s-5.4.patch
new file mode 100644
index 0000000..a3325ce
--- /dev/null
+++ 
b/recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-kernel-s-5.4.patch
@@ -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
+
diff --git a/recipes-extended/uxen/uxen-guest-tools_4.1.8.bb 
b/recipes-extended/uxen/uxen-guest-tools_4.1.8.bb
index 2ca0cb1..06dc376 100644
--- a/recipes-extended/uxen/uxen-guest-tools_4.1.8.bb
+++ b/recipes-extended/uxen/uxen-guest-tools_4.1.8.bb
@@ -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"
-- 
2.32.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6934): 
https://lists.yoctoproject.org/g/meta-virtualization/message/6934
Mute This Topic: https://lists.yoctoproject.org/mt/87432340/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to