[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1722520012.git.ashish.kalra@amd.com>
Date: Thu, 1 Aug 2024 19:14:02 +0000
From: Ashish Kalra <Ashish.Kalra@....com>
To: <dave.hansen@...ux.intel.com>, <tglx@...utronix.de>, <mingo@...hat.com>,
<bp@...en8.de>, <x86@...nel.org>
CC: <hpa@...or.com>, <rafael@...nel.org>, <peterz@...radead.org>,
<adrian.hunter@...el.com>, <sathyanarayanan.kuppuswamy@...ux.intel.com>,
<jun.nakajima@...el.com>, <kirill.shutemov@...ux.intel.com>,
<rick.p.edgecombe@...el.com>, <linux-kernel@...r.kernel.org>,
<thomas.lendacky@....com>, <michael.roth@....com>, <seanjc@...gle.com>,
<kai.huang@...el.com>, <bhe@...hat.com>, <bdas@...hat.com>,
<vkuznets@...hat.com>, <dionnaglaze@...gle.com>, <anisinha@...hat.com>,
<ardb@...nel.org>, <dyoung@...hat.com>, <kexec@...ts.infradead.org>,
<linux-coco@...ts.linux.dev>, <jroedel@...e.de>
Subject: [PATCH v13 0/3] x86/snp: Add kexec support
From: Ashish Kalra <ashish.kalra@....com>
The patchset adds bits and pieces to get kexec (and crashkernel) work on
SNP guest.
This patchset requires the following fix for preventing EFI memory map
corruption while doing SNP guest kexec:
https://lore.kernel.org/all/16131a10-b473-41cc-a96e-d71a4d930353@amd.com/T/#m77f2f33f5521d1369b0e8d461802b99005b4ffd6
The series is based off and tested against tree:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
----
v13:
- fix potential kernel build issue without CONFIG_AMD_MEM_ENCRYPT set.
v12:
- cleanups as suggested as per upstream review.
- Moved unshare_all_bss_decrypted_memory() into unshare_all_memory().
- Zap make_pte_private() and merge into unshare_all_memory().
v11:
- Refactored __set_clr_pte_enc() and added two new helper functions to
set/clear PTE C-bit from early SEV/SNP initialization code and
later during normal system operations and shutdown/kexec.
- Removed kexec_last_addr_to_make_private and now skip per-cpu
GHCB addresses when making all pages private and then after
converting all pages to private in snp_kexec_finish(), go over
the per-cpu GHCB addresses and convert them to private explicitly.
- Fixed comments and commit logs as per upstream review.
v10:
- Removed pr_debug() calls as per upstream review feedback.
- Add review tags.
v9:
- Rebased onto current tip/master;
- Rebased on top of [PATCH] x86/sev: Move SEV compilation units
and uses the coco directory hierarchy for SEV guest kexec patches.
- Includes the above mentioned patch as part of this patch-set to
fix any kernel test robot/build issues.
- Includes the massaged version of patch 2/3 as per upstream
review/feedback.
v8:
- removed fix EFI memory map corruption with kexec patch as this
is a use-after-free bug that is not specific to SNP/TDX or kexec
and a generic fix for the same has been posted.
- Add new early_sev_detect() and move detection of SEV-ES/SNP guest
and skip accessing video RAM during decompressor stage into
this function as per feedback from upstream review.
v7:
- Rebased onto current tip/master;
- Moved back to checking the md attribute instead of checking the
efi_setup for detecting if running under kexec kernel as
suggested in upstream review feedback.
v6:
- Updated and restructured the commit message for patch 1/3 to
explain the issue in detail.
- Updated inline comments in patch 1/3 to explain the issue in
detail.
- Moved back to checking efi_setup for detecting if running
under kexec kernel.
v5:
- Removed sev_es_enabled() function and using sev_status directly to
check for SEV-ES/SEV-SNP guest.
- used --base option to generate patches to specify Kirill's TDX guest
kexec patches as prerequisite patches to fix kernel test robot
build errors.
v4:
- Rebased to current tip/master.
- Reviewed-bys from Sathya.
- Remove snp_kexec_unprep_rom_memory() as it is not needed any more as
SEV-SNP code is not validating the ROM range in probe_roms() anymore.
- Fix kernel test robot build error/warnings.
v3:
- Rebased;
- moved Keep page tables that maps E820_TYPE_ACPI patch to Kirill's tdx
guest kexec patch series.
- checking the md attribute instead of checking the efi_setup for
detecting if running under kexec kernel.
- added new sev_es_enabled() function.
- skip video memory access in decompressor for SEV-ES/SNP systems to
prevent guest termination as boot stage2 #VC handler does not handle
MMIO.
v2:
- address zeroing of unaccepted memory table mappings at all page table levels
adding phys_pte_init(), phys_pud_init() and phys_p4d_init().
- include skip efi_arch_mem_reserve() in case of kexec as part of this
patch set.
- rename last_address_shd_kexec to a more appropriate
kexec_last_address_to_make_private.
- remove duplicate code shared with TDX and use common interfaces
defined for SNP and TDX for kexec/kdump.
- remove set_pte_enc() dependency on pg_level_to_pfn() and make the
function simpler.
- rename unshare_pte() to make_pte_private().
- clarify and make the comment for using kexec_last_address_to_make_private
more understandable.
- general cleanup.
Ashish Kalra (3):
x86/boot: Skip video memory access in the decompressor for SEV-ES/SNP
x86/mm: refactor __set_clr_pte_enc()
x86/snp: Convert shared memory back to private on kexec
arch/x86/boot/compressed/misc.c | 15 ++++
arch/x86/coco/sev/core.c | 132 ++++++++++++++++++++++++++++++++
arch/x86/include/asm/sev.h | 24 ++++++
arch/x86/mm/mem_encrypt_amd.c | 77 ++++++++++++-------
4 files changed, 222 insertions(+), 26 deletions(-)
--
2.34.1
Powered by blists - more mailing lists