Expose the system-wide state that we inherited when starting Jailhouse also to non-root cells and only allow modifications of the enable bit. This ensure that non-root cells see the correct MTRR mapping, including the proper default type. Specifically Linux may otherwise get confused and start to map the shared memory regions as uncacheable - obviously reducing the inter-cell communication performance.
Signed-off-by: Jan Kiszka <[email protected]> --- hypervisor/arch/x86/vcpu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/vcpu.c b/hypervisor/arch/x86/vcpu.c index 192a625..33d2b5a 100644 --- a/hypervisor/arch/x86/vcpu.c +++ b/hypervisor/arch/x86/vcpu.c @@ -317,7 +317,8 @@ bool vcpu_handle_msr_write(void) * host-controlled MTRRs define the guest's memory types. */ val = get_wrmsr_value(&cpu_data->guest_regs); - cpu_data->mtrr_def_type = val; + cpu_data->mtrr_def_type &= ~MTRR_ENABLE; + cpu_data->mtrr_def_type |= val & MTRR_ENABLE; vcpu_vendor_set_guest_pat((val & MTRR_ENABLE) ? cpu_data->pat : 0); break; @@ -385,7 +386,7 @@ void vcpu_reset(unsigned int sipi_vector) if (sipi_vector == APIC_BSP_PSEUDO_SIPI) { cpu_data->pat = PAT_RESET_VALUE; - cpu_data->mtrr_def_type = 0; + cpu_data->mtrr_def_type &= ~MTRR_ENABLE; vcpu_vendor_set_guest_pat(0); } } -- 2.1.4 -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
