x86/msr: Virtualise MSR_PLATFORM_ID properly
PATCH 1/1 x86/msr: Virtualise MSR_PLATFORM_ID properly
This is an Intel-only, read-only MSR related to microcode loading. Expose it in similar circumstances as the PATCHLEVEL MSR.
This should have been alongside c/s 013896cb8b2 "x86/msr: Fix handling of MSR_AMD_PATCHLEVEL/MSR_IA32_UCODE_REV"
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
Turns out I wrote this nearly a year ago and didn't send it. It obviously got dropped in the leadup to MDS.
--- xen/arch/x86/msr.c | 8 ++++++++ 1 file changed, 8 insertions(+)
xen/arch/x86/msr.c +8 -0
@@ -143,6 +143,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)/* Not offered to guests. */ goto gp_fault; +case MSR_IA32_PLATFORM_ID : +if ( !(cp->x86_vendor &X86_VENDOR_INTEL ) || + !(boot_cpu_data.x86_vendor &X86_VENDOR_INTEL ) ) + goto gp_fault; +rdmsrl (MSR_IA32_PLATFORM_ID , *val); +break ; +case MSR_AMD_PATCHLEVEL :BUILD_BUG_ON (MSR_IA32_UCODE_REV !=MSR_AMD_PATCHLEVEL );/*
@@ -275,6 +282,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) {uint64_t rsvd; +case MSR_IA32_PLATFORM_ID :case MSR_INTEL_CORE_THREAD_COUNT :case MSR_INTEL_PLATFORM_INFO :case MSR_ARCH_CAPABILITIES :
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Andrew Cooper
This is an Intel-only, read-only MSR related to microcode loading. Expose it in similar circumstances as the PATCHLEVEL MSR.
This should have been alongside c/s
013896cb8b2"x86/msr: Fix handling of MSR_AMD_PATCHLEVEL/MSR_IA32_UCODE_REV"Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
xen/arch/x86/msr.c int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val) · line 148
Quoted 9 lines · Andrew Cooper
xen/arch/x86/msr.c +3
-0@@ -143,6 +143,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)/* Not offered to guests. */ goto gp_fault; +case MSR_IA32_PLATFORM_ID : +if ( !(cp->x86_vendor &X86_VENDOR_INTEL ) || + !(boot_cpu_data.x86_vendor &X86_VENDOR_INTEL ) )
This has turned out to be an unfortunate trap for backporting. While I understand using & here is the more modern form, could we perhaps settle on using == / != where possible (i.e. just a single vendor checked) until 4.12 has gone out of at least regular support? (The prevailing use with more than one vendor is with AMD and Hygon, which doesn't go silent as X86_VENDOR_HYGON doesn't exist yet in 4.12.)
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel