Skip to content

Commit 4bb5e60

Browse files
ZideChen0lijinxia
authored andcommitted
hv: enable MTRR virtualization
- unmask MTRR from guest CPUID to enable MTRR - MTRR virtualization can be disabled by commenting out CONFIG_MTRR_ENABLED Signed-off-by: bliu11 <baohong.liu@intel.com> Signed-off-by: Zide Chen <zide.chen@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent a41267e commit 4bb5e60

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

hypervisor/arch/x86/cpuid.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,10 @@ void guest_cpuid(struct vcpu *vcpu,
283283
*ebx &= ~APIC_ID_MASK;
284284
*ebx |= (apicid & APIC_ID_MASK);
285285

286+
#ifndef CONFIG_MTRR_ENABLED
286287
/* mask mtrr */
287288
*edx &= ~CPUID_EDX_MTRR;
289+
#endif
288290

289291
/* Patching X2APIC, X2APIC mode is disabled by default. */
290292
if (x2apic_enabled)

hypervisor/arch/x86/guest/vcpu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ int create_vcpu(int cpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle)
107107
/* Create per vcpu vlapic */
108108
vlapic_create(vcpu);
109109

110+
#ifdef CONFIG_MTRR_ENABLED
111+
init_mtrr(vcpu);
112+
#endif
113+
110114
/* Populate the return handle */
111115
*rtn_vcpu_handle = vcpu;
112116

hypervisor/bsp/sbl/include/bsp/bsp_cfg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
#define CONFIG_LOW_RAM_SIZE 0x000CF000
2222
#define CONFIG_RAM_START 0x6E000000
2323
#define CONFIG_RAM_SIZE 0x02000000 /* 32M */
24+
#define CONFIG_MTRR_ENABLED 1
2425
#endif /* BSP_CFG_H */

hypervisor/bsp/uefi/include/bsp/bsp_cfg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@
2525
#define CONFIG_GPU_SBDF 0x00000010 /* 0000:00:02.0 */
2626
#define CONFIG_EFI_STUB 1
2727
#define CONFIG_UEFI_OS_LOADER_NAME "\\EFI\\org.clearlinux\\bootloaderx64.efi"
28+
#define CONFIG_MTRR_ENABLED 1
2829
#endif /* BSP_CFG_H */

0 commit comments

Comments
 (0)