From: Nikunj A Dadhania <nikunj@amd.com>
To: <seanjc@google.com>, <pbonzini@redhat.com>, <kvm@vger.kernel.org>
Cc: <thomas.lendacky@amd.com>, <santosh.shukla@amd.com>,
<bp@alien8.de>, <nikunj@amd.com>, <isaku.yamahata@intel.com>
Subject: [PATCH v3 0/5] Enable Secure TSC for SEV-SNP
Date: Mon, 17 Feb 2025 15:52:32 +0530 [thread overview]
Message-ID: <20250217102237.16434-1-nikunj@amd.com> (raw)
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 patch set is also available at:
https://github.com/AMDESE/linux-kvm/tree/sectsc-host-latest
and is based on kvm-x86/next
Testing Secure TSC
-----------------
Secure TSC guest patches are available as part of v6.14-rc1.
QEMU changes:
https://github.com/nikunjad/qemu/tree/snp-securetsc-latest
QEMU command line SEV-SNP with Secure TSC:
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:
----------
v3:
* Rebased on top of kvm-x86/next
* Collect Acked-by
* Separate patch to add missing desired_tsc_khz field (Tom)
* Invoke kvm_set_msr_common() for non-SecureTSC guests (Tom)
* To align desired_tsc_khz to 4-byte boundary, move the 2-byte pad0 above it (Tom)
* Update commit logs (Tom, Sean)
v2: https://lore.kernel.org/all/20250210092230.151034-1-nikunj@amd.com/
* Address cpufeatures comment from Boris
* Squashed Secure TSC enablement and setting frequency patch
* Set the default TSC KHz for proper calculation of guest offset/multiplier
Ketan Chaturvedi (1):
KVM: SVM: Enable Secure TSC for SNP guests
Nikunj A Dadhania (4):
x86/cpufeatures: Add SNP Secure TSC
crypto: ccp: Add missing member in SNP_LAUNCH_START command structure
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 | 15 +++++++++++++++
arch/x86/kvm/svm/svm.h | 11 ++++++++++-
include/linux/psp-sev.h | 2 ++
7 files changed, 53 insertions(+), 2 deletions(-)
base-commit: fed48e2967f402f561d80075a20c5c9e16866e53
--
2.43.0
next reply other threads:[~2025-02-17 10:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 10:22 Nikunj A Dadhania [this message]
2025-02-17 10:22 ` [PATCH v3 1/5] x86/cpufeatures: Add SNP Secure TSC Nikunj A Dadhania
2025-02-17 10:22 ` [PATCH v3 2/5] crypto: ccp: Add missing member in SNP_LAUNCH_START command structure Nikunj A Dadhania
2025-02-17 19:18 ` Tom Lendacky
2025-02-18 7:57 ` Nikunj A Dadhania
2025-02-17 10:22 ` [PATCH v3 3/5] KVM: SVM: Add GUEST_TSC_FREQ MSR for Secure TSC enabled guests Nikunj A Dadhania
2025-02-17 18:28 ` Tom Lendacky
2025-02-18 8:07 ` Nikunj A Dadhania
2025-02-17 10:22 ` [PATCH v3 4/5] KVM: SVM: Prevent writes to TSC MSR when Secure TSC is enabled Nikunj A Dadhania
2025-02-17 18:58 ` Tom Lendacky
2025-02-18 9:20 ` Nikunj A Dadhania
2025-02-17 10:22 ` [PATCH v3 5/5] KVM: SVM: Enable Secure TSC for SNP guests Nikunj A Dadhania
2025-02-17 18:34 ` Tom Lendacky
2025-02-18 8:10 ` Nikunj A Dadhania
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250217102237.16434-1-nikunj@amd.com \
--to=nikunj@amd.com \
--cc=bp@alien8.de \
--cc=isaku.yamahata@intel.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=santosh.shukla@amd.com \
--cc=seanjc@google.com \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox