Skip to content

Commit d19592a

Browse files
binbinwu1acrnsi
authored andcommitted
hv: vmsr: disable prmrr related msrs in vm
PRMRR related MSRs need to be configured by platform BIOS / bootloader. These settings are not allowed to be changed by guest. VMs currently have no requirement to access these MSRs even when vSGX is enabled. So, this patch disables PRMRR related MSRs in VM. Tracked-On: #3739 Signed-off-by: Binbin Wu <binbin.wu@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
1 parent de0a5a4 commit d19592a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

hypervisor/arch/x86/guest/vmsr.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static const uint32_t mtrr_msrs[NUM_MTRR_MSRS] = {
7878
};
7979

8080
/* Following MSRs are intercepted, but it throws GPs for any guest accesses */
81-
#define NUM_UNSUPPORTED_MSRS 99U
81+
#define NUM_UNSUPPORTED_MSRS 104U
8282
static const uint32_t unsupported_msrs[NUM_UNSUPPORTED_MSRS] = {
8383
/* Variable MTRRs are not supported */
8484
MSR_IA32_MTRR_PHYSBASE_0,
@@ -212,6 +212,13 @@ static const uint32_t unsupported_msrs[NUM_UNSUPPORTED_MSRS] = {
212212
MSR_IA32_MCG_EXT_CTL,
213213
/* MSR 0x280 ... 0x29F, not in this array */
214214
/* MSR 0x400 ... 0x473, not in this array */
215+
216+
/* PRMRR related MSRs are configured by native BIOS / bootloader */
217+
MSR_PRMRR_PHYS_BASE,
218+
MSR_PRMRR_PHYS_MASK,
219+
MSR_PRMRR_VALID_CONFIG,
220+
MSR_UNCORE_PRMRR_PHYS_BASE,
221+
MSR_UNCORE_PRMRR_PHYS_MASK,
215222
};
216223

217224
/* emulated_guest_msrs[] shares same indexes with array vcpu->arch->guest_msrs[] */

hypervisor/include/arch/x86/msr.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,13 @@
408408
#define MSR_LASTBRANCH_1 0x000001DCU
409409
#define MSR_LASTBRANCH_2 0x000001DDU
410410
#define MSR_LASTBRANCH_3 0x000001DEU
411+
#define MSR_PRMRR_PHYS_BASE 0x000001F4U
412+
#define MSR_PRMRR_PHYS_MASK 0x000001F5U
411413
#define MSR_PRMRR_VALID_CONFIG 0x000001FBU
412414
#define MSR_POWER_CTL 0x000001FCU
415+
#define MSR_UNCORE_PRMRR_PHYS_BASE 0x000002F4U
416+
#define MSR_UNCORE_PRMRR_PHYS_MASK 0x000002F5U
417+
413418
#define MSR_BR_DETECT_CTRL 0x00000350U
414419
#define MSR_BR_DETECT_STATUS 0x00000351U
415420
#define MSR_UNCORE_PERF_GLOBAL_OVF_CTRL 0x00000393U

0 commit comments

Comments
 (0)