x86/mm: Allow guest.enc_status_change_prepare() to fail
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tue, 6 Jun 2023 09:56:20 +0000 (12:56 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:21:00 +0000 (16:21 +0200)
commitc598fefef3213b9905ac4e53ba6e72be5427128f
treeb526e8fe99da02bc96c2f6d694148f3e857e8985
parent3e03681f072014f3f90dedfa32e0d7fed541ac9e
x86/mm: Allow guest.enc_status_change_prepare() to fail

[ Upstream commit 3f6819dd192ef4f0c568ec3e9d6d408b3fa1ad3d ]

TDX code is going to provide guest.enc_status_change_prepare() that is
able to fail. TDX will use the call to convert the GPA range from shared
to private. This operation can fail.

Add a way to return an error from the callback.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Link: https://lore.kernel.org/all/20230606095622.1939-2-kirill.shutemov%40linux.intel.com
Stable-dep-of: 195edce08b63 ("x86/tdx: Fix race between set_memory_encrypted() and load_unaligned_zeropad()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/include/asm/x86_init.h
arch/x86/kernel/x86_init.c
arch/x86/mm/mem_encrypt_amd.c
arch/x86/mm/pat/set_memory.c