From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web10.97366.1674805509711985235 for ; Thu, 26 Jan 2023 23:45:10 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kAHI6L2+; spf=pass (domain: kernel.org, ip: 145.40.68.75, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3D109B81FB4 for ; Fri, 27 Jan 2023 07:45:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB25DC4339C for ; Fri, 27 Jan 2023 07:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674805505; bh=6U0jOtadarK/86t07goc5CvWTjl8Z2GoxS4AnXjUKaM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kAHI6L2+itUHbQsfbs6u8CVtAYUT8SoTYJcVIur4xqfop5Lophy1bnDBOkwFWuFdi L/vViEZpRVYmxrEfIl1p8OBgJvvrZC/FB/n/GXLS7yBTod3TQQBInS2sVMJykGYXig FGjQplpqMU1wSb7MJB1hgmlIC2igax+6JAEoetwCXuRbdX9BQ67FbN4GaEAUlmx+1N RSflYZ/J8SuXcCDabVtWV5TEps4BDGxv2EjN1IokGeXQK9RAKMTakKc1kCxodJa41x YeJxNbB20RW6TKcV4M5+k4SWQnXyXUx5jvOmSut2aRzuQnPZ/DE7y/ctBsjd4qab1s x87ecFZYaDe6A== Received: by mail-lj1-f169.google.com with SMTP id t12so4616504lji.13 for ; Thu, 26 Jan 2023 23:45:05 -0800 (PST) X-Gm-Message-State: AFqh2kopTtMQQRLlDaWV5ANGU4gMvPUcjCS3VZoJBuHnaaaa59DAFTN7 R+kCIpS2N8jNaR97r8RIhfaCno3DwuJxrDztT5k= X-Google-Smtp-Source: AMrXdXvqzt7oobIpr6xxil+Gsez3BDhKtEEf5SBAawefBPfSA/18hsJxt6v/02vElVv1a/e0kfxf1RnjhfIJ0wJBcSg= X-Received: by 2002:a2e:93ce:0:b0:27f:b76d:2950 with SMTP id p14-20020a2e93ce000000b0027fb76d2950mr2301343ljh.67.1674805503884; Thu, 26 Jan 2023 23:45:03 -0800 (PST) MIME-Version: 1.0 References: <20230126211740.3235408-1-dionnaglaze@google.com> <20230126211740.3235408-3-dionnaglaze@google.com> In-Reply-To: From: "Ard Biesheuvel" Date: Fri, 27 Jan 2023 08:44:52 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v11 2/4] MdePkg: Introduce the SevMemoryAcceptance protocol To: Tom Lendacky Cc: Dionna Glaze , devel@edk2.groups.io, Gerd Hoffmann , James Bottomley , Jiewen Yao , "Min M. Xu" , Andrew Fish , "Michael D. Kinney" Content-Type: text/plain; charset="UTF-8" On Fri, 27 Jan 2023 at 00:11, Tom Lendacky wrote: > > Might want to fix up the commit title from MdePkg to OvmfPkg before > committing. > I've fixed that up - thanks. > On 1/26/23 15:17, Dionna Glaze wrote: > > The default behavior for unaccepted memory in SEV-SNP is to accept all > > memory when ExitBootServices is called. An OS loader can use this > > protocol to disable this behavior to assume responsibility for memory > > acceptance and to affirm that the OS can handle the unaccepted memory > > type. > > > > Cc: Gerd Hoffmann > > Cc: James Bottomley > > Cc: Jiewen Yao > > Cc: Tom Lendacky > > Cc: Ard Biesheuvel > > Cc: "Min M. Xu" > > Cc: Andrew Fish > > Cc: "Michael D. Kinney" > > > > Signed-off-by: Dionna Glaze > > --- > > OvmfPkg/Include/Protocol/SevMemoryAcceptance.h | 42 ++++++++++++++++++++ > > OvmfPkg/OvmfPkg.dec | 1 + > > 2 files changed, 43 insertions(+) > > > > diff --git a/OvmfPkg/Include/Protocol/SevMemoryAcceptance.h b/OvmfPkg/Include/Protocol/SevMemoryAcceptance.h > > new file mode 100644 > > index 0000000000..c45b499006 > > --- /dev/null > > +++ b/OvmfPkg/Include/Protocol/SevMemoryAcceptance.h > > @@ -0,0 +1,42 @@ > > +/** @file > > + The file provides the protocol that disables the behavior that all memory > > + gets accepted at ExitBootServices(). This protocol is only meant to be called > > + by the OS loader, and not EDK2 itself. The SEV naming is due to the coincidence > > + that only SEV-SNP needs this protocol, since SEV-SNP kernel support released > > + before kernel support for unaccepted memory. The technology enablement thus > > + does not strictly imply support for the unaccepted memory type. > > + > > + Copyright (c) 2023, Google LLC. All rights reserved.
> > + SPDX-License-Identifier: BSD-2-Clause-Patent > > +**/ > > + > > +#ifndef SEV_MEMORY_ACCEPTANCE_H_ > > +#define SEV_MEMORY_ACCEPTANCE_H_ > > + > > +#define OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL_GUID \ > > + {0xc5a010fe, \ > > + 0x38a7, \ > > + 0x4531, \ > > + {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}} > > + > > +typedef struct _OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL > > + OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL; > > + > > +/** > > + @param This A pointer to a OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL. > > +**/ > > +typedef > > + EFI_STATUS > > +(EFIAPI *OVMF_SEV_ALLOW_UNACCEPTED_MEMORY)( > > + IN OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL *This > > + ); > > + > > +/// > > +/// The OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL allows the OS loader to > > +/// indicate to EDK2 that ExitBootServices should not accept all memory. > > +/// > > +struct _OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL { > > + OVMF_SEV_ALLOW_UNACCEPTED_MEMORY AllowUnacceptedMemory; > > +}; > > + > > +#endif > > diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec > > index 1b521f2604..a22eb246c6 100644 > > --- a/OvmfPkg/OvmfPkg.dec > > +++ b/OvmfPkg/OvmfPkg.dec > > @@ -184,6 +184,7 @@ > > gEfiLegacyInterruptProtocolGuid = {0x31ce593d, 0x108a, 0x485d, {0xad, 0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe}} > > gEfiVgaMiniPortProtocolGuid = {0xc7735a2f, 0x88f5, 0x4882, {0xae, 0x63, 0xfa, 0xac, 0x8c, 0x8b, 0x86, 0xb3}} > > gOvmfLoadedX86LinuxKernelProtocolGuid = {0xa3edc05d, 0xb618, 0x4ff6, {0x95, 0x52, 0x76, 0xd7, 0x88, 0x63, 0x43, 0xc8}} > > + gOvmfSevMemoryAcceptanceProtocolGuid = {0xc5a010fe, 0x38a7, 0x4531, {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}} > > gQemuAcpiTableNotifyProtocolGuid = {0x928939b2, 0x4235, 0x462f, {0x95, 0x80, 0xf6, 0xa2, 0xb2, 0xc2, 0x1a, 0x4f}} > > gEfiMpInitLibMpDepProtocolGuid = {0xbb00a5ca, 0x8ce, 0x462f, {0xa5, 0x37, 0x43, 0xc7, 0x4a, 0x82, 0x5c, 0xa4}} > > gEfiMpInitLibUpDepProtocolGuid = {0xa9e7cef1, 0x5682, 0x42cc, {0xb1, 0x23, 0x99, 0x30, 0x97, 0x3f, 0x4a, 0x9f}}