aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-kernel-s-5.4.patch
blob: a3325ce69618a1645e6bb1376d39ffee4aad934e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
From 21bb6953a64390dd1c5a8b7520eb5e2c18ea3ff1 Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@gmail.com>
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 <bruce.ashfield@gmail.com>
---
 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("paulian.marinca@bromium.com");
 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