sev-guest.c is the driver for the Root of Trust inside the PSP accessed by confidential VMs. It supports a direct access path and one that first goes through the Secure VM Service Module (SVSM) running at VM Privilege Level 0 (VMPL0). This allows the SVSM to mix its own data into the challenge, for instance to bind the vTPM's EK. It also supports both a new and an old report format. Move it into drivers/attestation/amd/sev-guest.c. Module autoloading still uses the platform_driver created by the arch code. Signed-off-by: Jason Gunthorpe --- drivers/attestation/Kconfig | 1 + drivers/attestation/Makefile | 1 + drivers/attestation/amd/Kconfig | 15 +++++++++++++++ drivers/attestation/amd/Makefile | 4 ++++ .../sev-guest => attestation/amd}/sev-guest.c | 2 +- drivers/virt/coco/Kconfig | 2 -- drivers/virt/coco/Makefile | 1 - drivers/virt/coco/sev-guest/Kconfig | 13 ------------- drivers/virt/coco/sev-guest/Makefile | 2 -- 9 files changed, 22 insertions(+), 19 deletions(-) create mode 100644 drivers/attestation/amd/Kconfig create mode 100644 drivers/attestation/amd/Makefile rename drivers/{virt/coco/sev-guest => attestation/amd}/sev-guest.c (99%) delete mode 100644 drivers/virt/coco/sev-guest/Kconfig delete mode 100644 drivers/virt/coco/sev-guest/Makefile diff --git a/drivers/attestation/Kconfig b/drivers/attestation/Kconfig index d632503a55f85a..4312acc27fc47d 100644 --- a/drivers/attestation/Kconfig +++ b/drivers/attestation/Kconfig @@ -17,6 +17,7 @@ menuconfig ATTESTATION If you are unsure, say N. if ATTESTATION +source "drivers/attestation/amd/Kconfig" source "drivers/attestation/arm/Kconfig" source "drivers/attestation/intel/Kconfig" endif # ATTESTATION diff --git a/drivers/attestation/Makefile b/drivers/attestation/Makefile index e12162cb55e30b..2c98a03013f983 100644 --- a/drivers/attestation/Makefile +++ b/drivers/attestation/Makefile @@ -4,5 +4,6 @@ attestation-y := \ tsm-report.o obj-$(CONFIG_ATTESTATION) += attestation.o +obj-$(CONFIG_ATTESTATION_AMD_SEV_GUEST) += amd/ obj-$(CONFIG_ATTESTATION_ARM_CCA_GUEST) += arm/ obj-$(CONFIG_ATTESTATION_INTEL_TDX_GUEST) += intel/ diff --git a/drivers/attestation/amd/Kconfig b/drivers/attestation/amd/Kconfig new file mode 100644 index 00000000000000..c3203d2f184f0c --- /dev/null +++ b/drivers/attestation/amd/Kconfig @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +config ATTESTATION_AMD_SEV_GUEST + tristate "AMD SEV Guest Attestation Driver" + depends on AMD_MEM_ENCRYPT + help + Driver for the SEV-SNP firmware to access the root of trust in the PSP + for confidential VMs. This provides at least two kinds of signed + reports using a GUID scheme to select them. There are no measurement + registers. + + Reports are available in user-created directories under + /sys/kernel/config/tsm/report/ with provider "sev_guest". + + The /dev/sev-guest misc device also provides report and derived-key + ioctls. SVSM service reports and manifests use the TSM interface. diff --git a/drivers/attestation/amd/Makefile b/drivers/attestation/amd/Makefile new file mode 100644 index 00000000000000..2d2f5ca188813b --- /dev/null +++ b/drivers/attestation/amd/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only +attestation_amd_sev_guest-y := sev-guest.o + +obj-$(CONFIG_ATTESTATION_AMD_SEV_GUEST) += attestation_amd_sev_guest.o diff --git a/drivers/virt/coco/sev-guest/sev-guest.c b/drivers/attestation/amd/sev-guest.c similarity index 99% rename from drivers/virt/coco/sev-guest/sev-guest.c rename to drivers/attestation/amd/sev-guest.c index 5fade6cc135727..2a32b5bbf198f7 100644 --- a/drivers/virt/coco/sev-guest/sev-guest.c +++ b/drivers/attestation/amd/sev-guest.c @@ -612,7 +612,7 @@ static bool sev_report_bin_attr_visible(int n) } static struct tsm_report_ops sev_tsm_report_ops = { - .name = KBUILD_MODNAME, + .name = "sev_guest", .report_new = sev_report_new, .report_attr_visible = sev_report_attr_visible, .report_bin_attr_visible = sev_report_bin_attr_visible, diff --git a/drivers/virt/coco/Kconfig b/drivers/virt/coco/Kconfig index 5329f82c2b1e6d..bd226c6ddb3fde 100644 --- a/drivers/virt/coco/Kconfig +++ b/drivers/virt/coco/Kconfig @@ -7,8 +7,6 @@ if VIRT_DRIVERS source "drivers/virt/coco/efi_secret/Kconfig" source "drivers/virt/coco/pkvm-guest/Kconfig" - -source "drivers/virt/coco/sev-guest/Kconfig" endif source "drivers/virt/coco/tdx-host/Kconfig" diff --git a/drivers/virt/coco/Makefile b/drivers/virt/coco/Makefile index ea4e27a5ce5040..dee8fb922755f5 100644 --- a/drivers/virt/coco/Makefile +++ b/drivers/virt/coco/Makefile @@ -4,6 +4,5 @@ # obj-$(CONFIG_EFI_SECRET) += efi_secret/ obj-$(CONFIG_ARM_PKVM_GUEST) += pkvm-guest/ -obj-$(CONFIG_SEV_GUEST) += sev-guest/ obj-$(CONFIG_INTEL_TDX_HOST) += tdx-host/ obj-$(CONFIG_TSM) += tsm-core.o diff --git a/drivers/virt/coco/sev-guest/Kconfig b/drivers/virt/coco/sev-guest/Kconfig deleted file mode 100644 index f615fc9409c86f..00000000000000 --- a/drivers/virt/coco/sev-guest/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -config SEV_GUEST - tristate "AMD SEV Guest driver" - default m - depends on AMD_MEM_ENCRYPT - depends on ATTESTATION - help - SEV-SNP firmware provides the guest a mechanism to communicate with - the PSP without risk from a malicious hypervisor who wishes to read, - alter, drop or replay the messages sent. The driver provides - userspace interface to communicate with the PSP to request the - attestation report and more. - - If you choose 'M' here, this module will be called sev-guest. diff --git a/drivers/virt/coco/sev-guest/Makefile b/drivers/virt/coco/sev-guest/Makefile deleted file mode 100644 index 63d67c27723a60..00000000000000 --- a/drivers/virt/coco/sev-guest/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_SEV_GUEST) += sev-guest.o -- 2.43.0