From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.groups.io with SMTP id smtpd.web08.43843.1606172191826242110 for ; Mon, 23 Nov 2020 14:56:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Be7ZLAUn; spf=pass (domain: redhat.com, ip: 63.128.21.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606172191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NGxsaNTw1RL62LsWGqWR8EyUfeJUOzhMlhNQCFIXs9Y=; b=Be7ZLAUn02vCSb2sV9hOoZczUTq+PaCFkp/4ERMctEwtcjnxOwJxFnquJwdmjjg4fXIEo6 FEYkZkqT9pLLa2WDvG3ZjnIuyUGnMskgM/2EJOIKlVFIfFlBTE8mF1tZCkQrnawtsXcE69 SYkFwIOhwZQ7kh+9yYnbwfnaljgkHD8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-352-UyHA16aDO6u4yoc0i0Wqtg-1; Mon, 23 Nov 2020 17:56:26 -0500 X-MC-Unique: UyHA16aDO6u4yoc0i0Wqtg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A04F5802B6D; Mon, 23 Nov 2020 22:56:24 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-230.ams2.redhat.com [10.36.112.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9D0F60C13; Mon, 23 Nov 2020 22:56:21 +0000 (UTC) Subject: Re: [PATCH v2 6/6] OvmfPkg/AmdSev: Expose the Sev Secret area using a configuration table To: James Bottomley , devel@edk2.groups.io Cc: dovmurik@linux.vnet.ibm.com, Dov.Murik1@il.ibm.com, ashish.kalra@amd.com, brijesh.singh@amd.com, tobin@ibm.com, david.kaplan@amd.com, jon.grimm@amd.com, thomas.lendacky@amd.com, frankeh@us.ibm.com, "Dr . David Alan Gilbert" References: <20201120184521.19437-1-jejb@linux.ibm.com> <20201120184521.19437-7-jejb@linux.ibm.com> From: "Laszlo Ersek" Message-ID: <30b7b3eb-88dc-ae77-e147-c9177e758771@redhat.com> Date: Mon, 23 Nov 2020 23:56:20 +0100 MIME-Version: 1.0 In-Reply-To: <20201120184521.19437-7-jejb@linux.ibm.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 11/20/20 19:45, James Bottomley wrote: > Now that the secret area is protected by a boot time HOB, extract its > location details into a configuration table referenced by > gSevLaunchSecretGuid so the boot loader or OS can locate it before a > call to ExitBootServices(). > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3077 > Signed-off-by: James Bottomley > --- > OvmfPkg/OvmfPkg.dec | 1 + > OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + > OvmfPkg/AmdSev/AmdSevX64.fdf | 1 + > OvmfPkg/AmdSev/SecretDxe/SecretDxe.inf | 37 ++++++++++++++++++++++++++ > OvmfPkg/Include/Guid/SevLaunchSecret.h | 28 +++++++++++++++++++ > OvmfPkg/AmdSev/SecretDxe/SecretDxe.c | 25 +++++++++++++++++ > 6 files changed, 93 insertions(+) > create mode 100644 OvmfPkg/AmdSev/SecretDxe/SecretDxe.inf > create mode 100644 OvmfPkg/Include/Guid/SevLaunchSecret.h > create mode 100644 OvmfPkg/AmdSev/SecretDxe/SecretDxe.c > > diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec > index 7d27f8e16040..8a294116efaa 100644 > --- a/OvmfPkg/OvmfPkg.dec > +++ b/OvmfPkg/OvmfPkg.dec > @@ -117,6 +117,7 @@ [Guids] > gLinuxEfiInitrdMediaGuid = {0x5568e427, 0x68fc, 0x4f3d, {0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68}} > gQemuKernelLoaderFsMediaGuid = {0x1428f772, 0xb64a, 0x441e, {0xb8, 0xc3, 0x9e, 0xbd, 0xd7, 0xf8, 0x93, 0xc7}} > gGrubFileGuid = {0xb5ae312c, 0xbc8a, 0x43b1, {0x9c, 0x62, 0xeb, 0xb8, 0x26, 0xdd, 0x5d, 0x07}} > + gSevLaunchSecretGuid = {0xadf956ad, 0xe98c, 0x484c, {0xae, 0x11, 0xb5, 0x1c, 0x7d, 0x33, 0x64, 0x47}} > > [Ppis] > # PPI whose presence in the PPI database signals that the TPM base address > diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc > index a3f75a626e5e..fa2d1d20d551 100644 > --- a/OvmfPkg/AmdSev/AmdSevX64.dsc > +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc > @@ -812,6 +812,7 @@ [Components] > gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE > } > !endif > + OvmfPkg/AmdSev/SecretDxe/SecretDxe.inf > OvmfPkg/AmdSev/Grub/Grub.inf > !if $(BUILD_SHELL) == TRUE > ShellPkg/Application/Shell/Shell.inf { > diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf b/OvmfPkg/AmdSev/AmdSevX64.fdf > index c628e6d8f6e7..b60ff6227a4f 100644 > --- a/OvmfPkg/AmdSev/AmdSevX64.fdf > +++ b/OvmfPkg/AmdSev/AmdSevX64.fdf > @@ -269,6 +269,7 @@ [FV.DXEFV] > !if $(TOOL_CHAIN_TAG) != "XCODE5" && $(BUILD_SHELL) == TRUE > INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf > !endif > +INF OvmfPkg/AmdSev/SecretDxe/SecretDxe.inf > INF OvmfPkg/AmdSev/Grub/Grub.inf > !if $(BUILD_SHELL) == TRUE > INF ShellPkg/Application/Shell/Shell.inf > diff --git a/OvmfPkg/AmdSev/SecretDxe/SecretDxe.inf b/OvmfPkg/AmdSev/SecretDxe/SecretDxe.inf > new file mode 100644 > index 000000000000..62ab00a3d382 > --- /dev/null > +++ b/OvmfPkg/AmdSev/SecretDxe/SecretDxe.inf > @@ -0,0 +1,37 @@ > +## @file > +# Sev Secret configuration Table installer > +# > +# Copyright (C) 2020 James Bottomley, IBM Corporation. > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION = 0x00010005 > + BASE_NAME = SecretDxe > + FILE_GUID = 6e2b9619-8810-4e9d-a177-d432bb9abeda > + MODULE_TYPE = DXE_DRIVER > + VERSION_STRING = 1.0 > + ENTRY_POINT = InitializeSecretDxe > + > +[Sources] > + SecretDxe.c > + > +[Packages] > + OvmfPkg/OvmfPkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + > +[Guids] > + gSevLaunchSecretGuid > + > +[FixedPcd] > + gUefiOvmfPkgTokenSpaceGuid.PcdSevLaunchSecretBase > + gUefiOvmfPkgTokenSpaceGuid.PcdSevLaunchSecretSize > + > +[Depex] > + TRUE > diff --git a/OvmfPkg/Include/Guid/SevLaunchSecret.h b/OvmfPkg/Include/Guid/SevLaunchSecret.h > new file mode 100644 > index 000000000000..fa5f3830bc2b > --- /dev/null > +++ b/OvmfPkg/Include/Guid/SevLaunchSecret.h > @@ -0,0 +1,28 @@ > + /** @file > + UEFI Configuration Table for exposing the SEV Launch Secret location to UEFI > + applications (boot loaders). > + > + Copyright (C) 2020 James Bottomley, IBM Corporation. > + SPDX-License-Identifier: BSD-2-Clause-Patent > + **/ > + > +#ifndef SEV_LAUNCH_SECRET_H_ > +#define SEV_LAUNCH_SECRET_H_ > + > +#include > + > +#define SEV_LAUNCH_SECRET_GUID \ > + { 0xadf956ad, \ > + 0xe98c, \ > + 0x484c, \ > + { 0xae, 0x11, 0xb5, 0x1c, 0x7d, 0x33, 0x64, 0x47 }, \ > + } > + > +typedef struct { > + UINT32 Base; > + UINT32 Size; > +} SEV_LAUNCH_SECRET_LOCATION; > + > +extern EFI_GUID gSevLaunchSecretGuid; > + > +#endif // SEV_LAUNCH_SECRET_H_ > diff --git a/OvmfPkg/AmdSev/SecretDxe/SecretDxe.c b/OvmfPkg/AmdSev/SecretDxe/SecretDxe.c > new file mode 100644 > index 000000000000..e5a1624e3cd7 > --- /dev/null > +++ b/OvmfPkg/AmdSev/SecretDxe/SecretDxe.c > @@ -0,0 +1,25 @@ > +/** @file > + SEV Secret configuration table constructor > + > + Copyright (C) 2020 James Bottomley, IBM Corporation. > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > +#include > +#include > +#include > + > +STATIC SEV_LAUNCH_SECRET_LOCATION mSecretDxeTable = { > + FixedPcdGet32 (PcdSevLaunchSecretBase), > + FixedPcdGet32 (PcdSevLaunchSecretSize), > +}; > + > +EFI_STATUS > +EFIAPI > +InitializeSecretDxe( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + return gBS->InstallConfigurationTable (&gSevLaunchSecretGuid, > + &mSecretDxeTable); > +} > (1) Point (13) from my previous review at https://edk2.groups.io/g/devel/message/67623 https://www.redhat.com/archives/edk2-devel-archive/2020-November/msg00783.html has not been addressed. To re-state it here, please use one of the following indentations: return gBS->InstallConfigurationTable ( &gSevLaunchSecretGuid, &mSecretDxeTable ); or return gBS->InstallConfigurationTable (&gSevLaunchSecretGuid, &mSecretDxeTable); With the indentation fixed, Reviewed-by: Laszlo Ersek Thanks, Laszlo