On Sat, Dec 30, 2023 at 10:19:49AM -0600, Michael Roth wrote:
From: Ashish Kalra <ashish.kalra@xxxxxxx>Cleanups ontop, see if the below works too. Especially:
Add a kdump safe version of sev_firmware_shutdown() registered as a
crash_kexec_post_notifier, which is invoked during panic/crash to do
SEV/SNP shutdown. This is required for transitioning all IOMMU pages
to reclaim/hypervisor state, otherwise re-init of IOMMU pages during
crashdump kernel boot fails and panics the crashdump kernel. This
panic notifier runs in atomic context, hence it ensures not to
acquire any locks/mutexes and polls for PSP command completion
instead of depending on PSP command completion interrupt.
Signed-off-by: Ashish Kalra <ashish.kalra@xxxxxxx>
[mdr: remove use of "we" in comments]
Signed-off-by: Michael Roth <michael.roth@xxxxxxx>
* I've zapped the WBINVD before the TMR pages are freed because
__sev_snp_shutdown_locked() will WBINVD anyway.
* The mutex_is_locked() check in snp_shutdown_on_panic() is silly
because the panic notifier runs on one CPU anyway.