All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Enable Secure TSC for SEV-SNP
@ 2025-02-10  9:22 Nikunj A Dadhania
  2025-02-10  9:22 ` [PATCH v2 1/4] x86/cpufeatures: Add SNP Secure TSC Nikunj A Dadhania
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Nikunj A Dadhania @ 2025-02-10  9:22 UTC (permalink / raw)
  To: seanjc, pbonzini, kvm
  Cc: thomas.lendacky, santosh.shukla, bp, ketanch, nikunj,
	isaku.yamahata

The hypervisor controls TSC value calculations for the guest. A malicious
hypervisor can prevent the guest from progressing. The Secure TSC feature for
SEV-SNP allows guests to securely use the RDTSC and RDTSCP instructions. This
ensures the guest has a consistent view of time and prevents a malicious
hypervisor from manipulating time, such as making it appear to move backward or
advance too quickly. For more details, refer to the "Secure Nested Paging
(SEV-SNP)" section, subsection "Secure TSC" in APM Volume 2.

This patchset is also available at:

  https://github.com/AMDESE/linux-kvm/tree/sectsc-host-latest

and is based on kvm/next

Testing SecureTSC
-----------------

SecureTSC guest patches are available as part of v6.14-rc1.

QEMU changes:
https://github.com/nikunjad/qemu/tree/snp-securetsc-latest

QEMU commandline SEV-SNP with SecureTSC:

  qemu-system-x86_64 -cpu EPYC-Milan-v2 -smp 4 \
    -object memory-backend-memfd,id=ram1,size=1G,share=true,prealloc=false,reserve=false \
    -object sev-snp-guest,id=sev0,cbitpos=51,reduced-phys-bits=1,secure-tsc=on,stsc-freq=2000000000 \
    -machine q35,confidential-guest-support=sev0,memory-backend=ram1 \
    ...

Changelog:
----------
v2:
* Address cpufeatures comment from Boris
* Squashed Secure TSC enablement and setting frequency patch
* Set the default TSC KHz for proper calulation of guest offset/multiplier

Ketan Chaturvedi (1):
  KVM: SVM: Enable Secure TSC for SNP guests

Nikunj A Dadhania (3):
  x86/cpufeatures: Add SNP Secure TSC
  KVM: SVM: Add GUEST_TSC_FREQ MSR for Secure TSC enabled guests
  KVM: SVM: Prevent writes to TSC MSR when Secure TSC is enabled

 arch/x86/include/asm/cpufeatures.h |  1 +
 arch/x86/include/asm/svm.h         |  1 +
 arch/x86/include/uapi/asm/kvm.h    |  3 ++-
 arch/x86/kvm/svm/sev.c             | 22 ++++++++++++++++++++++
 arch/x86/kvm/svm/svm.c             | 12 ++++++++++++
 arch/x86/kvm/svm/svm.h             | 14 +++++++++++++-
 include/linux/psp-sev.h            |  2 ++
 7 files changed, 53 insertions(+), 2 deletions(-)


base-commit: 43fb96ae78551d7bfa4ecca956b258f085d67c40
-- 
2.43.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-02-14  5:37 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10  9:22 [PATCH v2 0/4] Enable Secure TSC for SEV-SNP Nikunj A Dadhania
2025-02-10  9:22 ` [PATCH v2 1/4] x86/cpufeatures: Add SNP Secure TSC Nikunj A Dadhania
2025-02-11 14:30   ` Borislav Petkov
2025-02-10  9:22 ` [PATCH v2 2/4] KVM: SVM: Add GUEST_TSC_FREQ MSR for Secure TSC enabled guests Nikunj A Dadhania
2025-02-10  9:22 ` [PATCH v2 3/4] KVM: SVM: Prevent writes to TSC MSR when Secure TSC is enabled Nikunj A Dadhania
2025-02-10 20:21   ` Tom Lendacky
2025-02-11  8:24     ` Nikunj A Dadhania
2025-02-11 14:03       ` Tom Lendacky
2025-02-11 14:42         ` Tom Lendacky
2025-02-12  4:26           ` Nikunj A Dadhania
2025-02-11 22:37     ` Sean Christopherson
2025-02-12  8:37       ` Nikunj A Dadhania
2025-02-12 14:04         ` Sean Christopherson
2025-02-14  5:14           ` Nikunj A. Dadhania
2025-02-14  5:37             ` subscribe list archives
2025-02-10  9:22 ` [PATCH v2 4/4] KVM: SVM: Enable Secure TSC for SNP guests Nikunj A Dadhania
2025-02-10 20:41   ` Tom Lendacky
2025-02-11  8:11     ` Nikunj A Dadhania

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.