]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ptp: kvm: Use decrypted memory in confidential guest on x86
authorJeremi Piotrowski <jpiotrowski@linux.microsoft.com>
Wed, 8 Mar 2023 15:05:31 +0000 (15:05 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Dec 2024 17:08:53 +0000 (18:08 +0100)
commit5ea817f40dbb78dc8fe0b073b2d069eb721e32aa
tree2d9e9dc6192c6910738daddc822f18754ca1722a
parente9c208b29035946f72c4e3223e690608d7d54a9c
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>
drivers/ptp/ptp_kvm_arm.c
drivers/ptp/ptp_kvm_common.c
drivers/ptp/ptp_kvm_x86.c
include/linux/ptp_kvm.h