From: Jan Kiszka <jan.kis...@siemens.com>

Several things changed and require tuning:

 - __get_vm_area is gone, switch to __get_vm_area_caller which now
   requires another kernel patch to export it (pointless to try
   RESOLVE_EXTERNAL_SYMBOL since 5.7)

 - cr4_init_shadow was hidden from modules; set/clear VMXE directly
   instead so that the shadow is aligned to the real state; no action
   needed on AMD as EFER is carrying SVME

 - include asm/apic.h explicitly for lapic_timer_period

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
---
 driver/main.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/driver/main.c b/driver/main.c
index ec302639..edb1e4d4 100644
--- a/driver/main.c
+++ b/driver/main.c
@@ -42,6 +42,7 @@
 #endif
 #ifdef CONFIG_X86
 #include <asm/msr.h>
+#include <asm/apic.h>
 #endif
 
 #include "cell.h"
@@ -199,6 +200,12 @@ static long get_max_cpus(u32 cpu_set_size,
        return -EINVAL;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
+#define __get_vm_area(size, flags, start, end)                 \
+       __get_vm_area_caller(size, flags, start, end,           \
+                            __builtin_return_address(0))
+#endif
+
 void *jailhouse_ioremap(phys_addr_t phys, unsigned long virt,
                        unsigned long size)
 {
@@ -250,7 +257,13 @@ static void enter_hypervisor(void *info)
 
 #if defined(CONFIG_X86) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
        /* on Intel, VMXE is now on - update the shadow */
-       cr4_init_shadow();
+       if (boot_cpu_has(X86_FEATURE_VMX)) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)
+               cr4_set_bits_irqsoff(X86_CR4_VMXE);
+#else
+               cr4_set_bits(X86_CR4_VMXE);
+#endif
+       }
 #endif
 
        atomic_inc(&call_done);
@@ -653,7 +666,13 @@ static void leave_hypervisor(void *info)
 
 #if defined(CONFIG_X86) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
        /* on Intel, VMXE is now off - update the shadow */
-       cr4_init_shadow();
+       if (boot_cpu_has(X86_FEATURE_VMX)) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)
+               cr4_clear_bits_irqsoff(X86_CR4_VMXE);
+#else
+               cr4_clear_bits(X86_CR4_VMXE);
+#endif
+       }
 #endif
 
        atomic_inc(&call_done);
-- 
2.26.2

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/bf1953f94603d8222e545d531221f93ed640f97e.1599473999.git.jan.kiszka%40siemens.com.

Reply via email to