summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJeremi Piotrowski <jpiotrowski@linux.microsoft.com>2023-03-08 18:05:31 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-19 20:07:20 +0300
commit143304277ffd538f7f022ecba9a75c75408a3d32 (patch)
tree329c78ee8b87a899612d1925417ecf75f5ddf9ff /include
parent80a0c4dc6641bb80e6b1a7acbd9f0bd2c07a0364 (diff)
downloadlinux-143304277ffd538f7f022ecba9a75c75408a3d32.tar.xz
ptp: kvm: Use decrypted memory in confidential guest on x86
[ Upstream commit 6365ba64b4dbe8b59ddaeaa724b281f3787715d5 ] KVM_HC_CLOCK_PAIRING currently fails inside SEV-SNP guests because the guest passes an address to static data to the host. In confidential computing the host can't access arbitrary guest memory so handling the hypercall runs into an "rmpfault". To make the hypercall work, the guest needs to explicitly mark the memory as decrypted. Do that in kvm_arch_ptp_init(), but retain the previous behavior for non-confidential guests to save us from having to allocate memory. Add a new arch-specific function (kvm_arch_ptp_exit()) to free the allocation and mark the memory as encrypted again. Signed-off-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> Link: https://lore.kernel.org/r/20230308150531.477741-1-jpiotrowski@linux.microsoft.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of: 5e7aa97c7acf ("ptp: kvm: x86: Return EOPNOTSUPP instead of ENODEV from kvm_arch_ptp_init()") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ptp_kvm.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/ptp_kvm.h b/include/linux/ptp_kvm.h
index f960a719f0d5..c1636ce76bd2 100644
--- a/include/linux/ptp_kvm.h
+++ b/include/linux/ptp_kvm.h
@@ -12,6 +12,7 @@ struct timespec64;
struct clocksource;
int kvm_arch_ptp_init(void);
+void kvm_arch_ptp_exit(void);
int kvm_arch_ptp_get_clock(struct timespec64 *ts);
int kvm_arch_ptp_get_crosststamp(u64 *cycle,
struct timespec64 *tspec, struct clocksource **cs);