Skip to content

Fix MSR_IA32_PLATFORM_ID access for TDX guests

Binbin Wu kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2KVM: TDX: Allow TDs to read MSR_IA32_PLATFORM_IDarch/x86/kvm/vmx/tdx.c+1 -08 replies
2/2x86/cpu: Skip reading MSR_IA32_PLATFORM_ID in virtualized environmentarch/x86/kernel/cpu/microcode/core.c arch/x86/kernel/cpu/microcode/intel.c arch/x86/kernel/cpu/microcode/internal.h+10 -15 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchXiaoyao Li
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] Fix MSR_IA32_PLATFORM_ID access for TDX guests

Since commit d8630b67ca1e ("x86/cpu: Add platform ID to CPU info structure"), the Linux kernel reads MSR_IA32_PLATFORM_ID during CPU init. This causes unchecked MSR access errors when running as a TDX guest, because KVM doesn't include MSR_IA32_PLATFORM_ID in tdx_has_emulated_msr().

On KVM side, this patch set adds MSR_IA32_PLATFORM_ID to tdx_has_emulated_msr() so that KVM returns 0 for TDs reading this MSR, consistent with how KVM already handles it for normal VMs.

Optionally, in order to provide back-compatibility for newer Linux guests running on older KVM hosts without the fix, the second patch skips the MSR_IA32_PLATFORM_ID read entirely when Linux is running in a virtualized environment. This could be dropped if we think the fix on KVM side is sufficient.

Binbin Wu (2):
KVM: TDX: Allow TDs to read MSR_IA32_PLATFORM_ID
x86/cpu: Skip reading MSR_IA32_PLATFORM_ID in virtualized environment

 arch/x86/kernel/cpu/microcode/core.c     | 2 +-
 arch/x86/kernel/cpu/microcode/intel.c    | 4 ++++
 arch/x86/kernel/cpu/microcode/internal.h | 5 +++++
 arch/x86/kvm/vmx/tdx.c                   | 1 +
 4 files changed, 11 insertions(+), 1 deletion(-)

base-commit: 39704f00f747aba3144289870b5fd8ac230a9aaf

Signature · 1 line
2.46.0