aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/vboxguestdrivers/vboxguestdrivers/0003-fixes_for_changes_in_cpu_tlbstate.patch
blob: 6a3e63f63dee0ae50039c1e21f8bdfd50f30ac6d (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
From 6089974a81b1b44e1d2dfa5af1fdc110dfee40c1 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Tue, 18 Aug 2020 17:51:24 +0800
Subject: [PATCH 3/3] fixes_for_changes_in_cpu_tlbstate

Upstream-Status: Backport [https://www.virtualbox.org/ticket/19644]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
index c7d0d99a..2e7aa6e1 100644
--- a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
+++ b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
@@ -757,12 +757,19 @@ EXPORT_SYMBOL(SUPDrvLinuxIDC);
 RTCCUINTREG VBOXCALL supdrvOSChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
     RTCCUINTREG uOld = this_cpu_read(cpu_tlbstate.cr4);
+#else
+    RTCCUINTREG uOld = __read_cr4();
+#endif
     RTCCUINTREG uNew = (uOld & fAndMask) | fOrMask;
     if (uNew != uOld)
     {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
         this_cpu_write(cpu_tlbstate.cr4, uNew);
         __write_cr4(uNew);
+#endif
+        ASMSetCR4(uNew);
     }
 #else
     RTCCUINTREG uOld = ASMGetCR4();
-- 
2.18.2