mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-25 08:21:08 +00:00
ef130a3bf9
Issue #3111 - enable vt-x in kernel configuration Kernel patches: - add unrestricted guest support - avoid kernel boot failure when vt-x is not available - avoid nullpointer in kernel when vcpu is not fully setup - avoid vcpu scheduling bug which causes starvation on same/below prio level - save efer register correctly from guest
29 lines
1.2 KiB
Diff
29 lines
1.2 KiB
Diff
--- src/kernel/sel4/src/arch/x86/object/vcpu.c
|
|
+++ src/kernel/sel4/src/arch/x86/object/vcpu.c
|
|
@@ -377,6 +379,12 @@ check_vtx_fixed_values(bool_t useTrueMsrs)
|
|
uint32_t local_cr4_high = x86_rdmsr_low(IA32_VMX_CR4_FIXED0_MSR);
|
|
uint32_t local_cr4_low = x86_rdmsr_low(IA32_VMX_CR4_FIXED1_MSR);
|
|
|
|
+ /* if UG was switched on on boot CPU, do it also on all other CPUs */
|
|
+ if (secondary_control_low & BIT(7)) {
|
|
+ local_secondary_control_high &= BIT(7);
|
|
+ local_cr0_high &= ~(BIT(31) | BIT(0));
|
|
+ }
|
|
+
|
|
/* We want to check that any bits that there are no bits that this core
|
|
* requires to be high, that the BSP did not require to be high. This can
|
|
* be checked with 'local_high & high == local_high'.
|
|
@@ -1067,6 +1075,12 @@ vtx_init(void)
|
|
printf("vt-x: lack of required features\n");
|
|
return false;
|
|
}
|
|
+
|
|
+ /* enable unrestricted guest support if available */
|
|
+ if (secondary_control_low & BIT(7)) {
|
|
+ secondary_control_high |= BIT(7);
|
|
+ cr0_high &= ~(BIT(31) | BIT(0));
|
|
+ }
|
|
}
|
|
if (!check_vtx_fixed_values(vmx_basic_msr_get_true_msrs(vmx_basic))) {
|
|
printf("vt-x: cores have inconsistent features\n");
|