summaryrefslogtreecommitdiffstats
path: root/drivers/ptp/ptp_kvm_common.c
diff options
context:
space:
mode:
authorJeremi Piotrowski <jpiotrowski@linux.microsoft.com>2023-03-08 15:05:31 +0000
committerJakub Kicinski <kuba@kernel.org>2023-03-17 21:57:52 -0700
commit6365ba64b4dbe8b59ddaeaa724b281f3787715d5 (patch)
tree22b37a8da0da4dcbb9ef3d98511d60c9f9ab3bcf /drivers/ptp/ptp_kvm_common.c
parent1118aa4c70a6978afb0c4391ad29826c14b842b3 (diff)
downloadlinux-stable-6365ba64b4dbe8b59ddaeaa724b281f3787715d5.tar.gz
linux-stable-6365ba64b4dbe8b59ddaeaa724b281f3787715d5.tar.bz2
linux-stable-6365ba64b4dbe8b59ddaeaa724b281f3787715d5.zip
ptp: kvm: Use decrypted memory in confidential guest on x86
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>
Diffstat (limited to 'drivers/ptp/ptp_kvm_common.c')
-rw-r--r--drivers/ptp/ptp_kvm_common.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/ptp/ptp_kvm_common.c b/drivers/ptp/ptp_kvm_common.c
index 9141162c4237..2418977989be 100644
--- a/drivers/ptp/ptp_kvm_common.c
+++ b/drivers/ptp/ptp_kvm_common.c
@@ -130,6 +130,7 @@ static struct kvm_ptp_clock kvm_ptp_clock;
static void __exit ptp_kvm_exit(void)
{
ptp_clock_unregister(kvm_ptp_clock.ptp_clock);
+ kvm_arch_ptp_exit();
}
static int __init ptp_kvm_init(void)