mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Support SEV firmware hotloading
@ 2024-11-02  0:08 Dionna Glaze
  2024-11-02  0:08 ` [PATCH v3 1/4] kvm: svm: Fix gctx page leak on invalid inputs Dionna Glaze
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Dionna Glaze @ 2024-11-02  0:08 UTC (permalink / raw)
  To: linux-kernel, x86
  Cc: Dionna Glaze, Sean Christopherson, Paolo Bonzini,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	Ashish Kalra, Tom Lendacky, John Allen, Herbert Xu,
	David S. Miller, Michael Roth, Luis Chamberlain, Russ Weight,
	Danilo Krummrich, Greg Kroah-Hartman, Rafael J. Wysocki,
	Tianfei zhang, Alexey Kardashevskiy

The SEV-SNP API specifies a command for hotloading the SEV firmware.
when no SEV or SEV-ES guests are running. The firmware hotloading
support is dependent on the firmware_upload API for better ease-of-use,
and to not necessarily require SEV firmware hotloading support when
building the ccp driver.

For safety, there are steps the kernel should take before allowing a
firmware to be committed:

1. Writeback invalidate all.
2. Data fabric flush.
3. All GCTX pages must be updated successfully with SNP_GUEST_STATUS

The snp_context_create function had the possibility to leak GCTX pages,
so the first patch fixes that bug in KVM.

The ccp driver must continue to be unloadable, so the second patch in
this series fixes a cyclic refcount bug in firmware_loader.

The third patch adds SEV_CMD_DOWNLOAD_FIRMWARE_EX support with the
required safety conditions and adds a new argument to the platform
initialization arguments to delay legacy platform initialization.
The command allows for firmware to be committed at the time of download,
but due to the safety requirements, its better to leave that to a follow-up
SNP_COMMIT command.

The fourth patch uses the new platform initialization argument when the
vm_type is not legacy SEV/SEV-ES.

The bulk of this series is in the changes to ccp in the third patch.

The KVM_EXIT for requesting certificates on extended guest request is
not part of this patch series. Any such support must be designed with
races between SNP_COMMIT and servicing extended guest requests such that
the REPORTED_TCB in an attestation_report always correctly corresponds
to the certificates returned by the extended guest request handler.

Changes from v2:
  - Fix download_firmware_ex struct definition to be the proper size,
    and clear to 0 before using. Thanks to Alexey Kardashevskiy.
Changes from v1:
  - Fix double-free with incorrect goto label on error.
  - checkpatch cleanup.
  - firmware_loader comment cleanup and one-use local variable inlining.

CC: Sean Christopherson <seanjc@google.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: Borislav Petkov <bp@alien8.de>
CC: Dave Hansen <dave.hansen@linux.intel.com>
CC: Ashish Kalra <ashish.kalra@amd.com>
CC: Tom Lendacky <thomas.lendacky@amd.com>
CC: John Allen <john.allen@amd.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: "David S. Miller" <davem@davemloft.net>
CC: Michael Roth <michael.roth@amd.com>
CC: Luis Chamberlain <mcgrof@kernel.org>
CC: Russ Weight <russ.weight@linux.dev>
CC: Danilo Krummrich <dakr@redhat.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: "Rafael J. Wysocki" <rafael@kernel.org>
CC: Tianfei zhang <tianfei.zhang@intel.com>
CC: Alexey Kardashevskiy <aik@amd.com>

Dionna Glaze (4):
  kvm: svm: Fix gctx page leak on invalid inputs
  firmware_loader: Move module refcounts to allow unloading
  crypto: ccp: Add SNP firmware hotload support
  KVM: SVM: Delay legacy platform initialization on SNP

 arch/x86/kvm/svm/sev.c                      |  10 +-
 drivers/base/firmware_loader/sysfs_upload.c |  16 +-
 drivers/crypto/ccp/Kconfig                  |   2 +
 drivers/crypto/ccp/sev-dev.c                | 399 +++++++++++++++++++-
 drivers/crypto/ccp/sev-dev.h                |  14 +
 include/linux/psp-sev.h                     |  29 ++
 include/uapi/linux/psp-sev.h                |   5 +
 7 files changed, 454 insertions(+), 21 deletions(-)

-- 
2.47.0.163.g1226f6d8fa-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-11-07 17:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-02  0:08 [PATCH v3 0/4] Support SEV firmware hotloading Dionna Glaze
2024-11-02  0:08 ` [PATCH v3 1/4] kvm: svm: Fix gctx page leak on invalid inputs Dionna Glaze
2024-11-02  0:08 ` [PATCH v3 2/4] firmware_loader: Move module refcounts to allow unloading Dionna Glaze
2024-11-02  0:08 ` [PATCH v3 3/4] crypto: ccp: Add SNP firmware hotload support Dionna Glaze
2024-11-04 17:06   ` Tom Lendacky
2024-11-04 19:30     ` Dionna Amalie Glaze
2024-11-04 20:45       ` Tom Lendacky
2024-11-04 21:27         ` Dionna Amalie Glaze
2024-11-07 17:20           ` Tom Lendacky
2024-11-05  2:32   ` Alexey Kardashevskiy
2024-11-02  0:08 ` [PATCH v3 4/4] KVM: SVM: Delay legacy platform initialization on SNP Dionna Glaze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®