From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by mx.groups.io with SMTP id smtpd.web11.63461.1674694617004374831 for ; Wed, 25 Jan 2023 16:56:57 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=bsqfHm8B; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.214.201, mailfrom: 32m_rywskbemintssflqfejlttlqj.htrijajqjiph.lwtzux.nt@flex--dionnaglaze.bounces.google.com) Received: by mail-pl1-f201.google.com with SMTP id u6-20020a170903124600b00188cd4769bcso309293plh.0 for ; Wed, 25 Jan 2023 16:56:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=0Vo0eOdY8tNa7L6a54L4TbDuKftRSOsT2/pCerUxv8I=; b=bsqfHm8BjL58ReR+EYnixGlR89E7JGALFqoSpolAgVLlOCuU5KuECvznfgW9pXIhRI +1Rm9H9W+jUuYhQt7VHulQJs6sX7tRRZOfRgX9qjyP/iEwILVkiojyOKiFk3uAsz5QvV FiX2OpbSZXJdSDQLWxfwAh2G6jKkxI4hr4yusUEQ/7u/9wav+CGPxFcu+G1lYpKaoXxG nv9cLpdaJV+NXgX/7B7aSekFta1Jk0IMaAUNg12S74QhwlamnDd7kmc/fy8YBGr87tiz md49JDgQjnd2T/PpT2vc3SGhdXbcm1z4F90SdP/OUsEuCxmkoBaXlE8Jx2M3AxHW09XY zHmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0Vo0eOdY8tNa7L6a54L4TbDuKftRSOsT2/pCerUxv8I=; b=fmdBr45HEBJ8VslalHWLHSFEm3r4Sc7ZhspY8WvkZJHLJgDEEKXfGy0tQf87NNx2FV efMsASqC1r65ebQlhn4sP+wGKVAj2SljXsSD+F+zgez3bN388azbkCP5e/HrpkgtDT5J t2KtaM+0NLDnXve8v3e8zXJekDeHTAhzlnYZAzJlhTaHHnNkirzpuUPy/JzNeDrGWOuG 1DUii7Ro9S6VaC9fY3ySEh7ofjUbvjOYajDSWbMEIcugkYRh8YFqKooULXjyYgBpklp/ 8gSBn4ZOKxP70WFS2MMpAtVFh9/HTWBA18CmRUrvisTtQ6x901U3G55xfbNJAcNR2WKr Wqig== X-Gm-Message-State: AO0yUKVNGTWIeB7GIHCh2/ic0GYlr+g45gFmto+g/dlYMcInOLb7PSNc NStFpQuxijlO4q02rAGlPX4dqU/DkhFe/ymZA3bfFiDSuy++di8bHE4c3bG42JCTvv9jSktpKrH vqn8ZfHyGHyKYWM5LMRKJG6+DbDdILTAdinwEr/k5Ym0SEenhuon7+ZMEYl5I9ufCeChPtUbx X-Google-Smtp-Source: AK7set+HZZ3WBudomVIexNEciM2uHgY4mc20Jyq6R3PlDHmDXQcLqGILsaM4i7WwDwVigFJt19OsZU0LVFJ4QjWv5g== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a17:90b:fc7:b0:226:9980:67f3 with SMTP id gd7-20020a17090b0fc700b00226998067f3mr2501pjb.1.1674694616062; Wed, 25 Jan 2023 16:56:56 -0800 (PST) Date: Thu, 26 Jan 2023 00:56:45 +0000 In-Reply-To: <20230126005647.3019225-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20230126005647.3019225-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Message-ID: <20230126005647.3019225-3-dionnaglaze@google.com> Subject: [PATCH v10 2/4] MdePkg: Introduce the SevMemoryAcceptance protocol From: "Dionna Glaze" To: devel@edk2.groups.io Cc: Dionna Glaze , Gerd Hoffmann , James Bottomley , Jiewen Yao , Tom Lendacky , Ard Biesheuvel , "Min M. Xu" , Andrew Fish , "Michael D. Kinney" Content-Type: text/plain; charset="UTF-8" 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. This is a candidate for standardization. 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 --- MdePkg/Include/Protocol/Bz3987SevMemoryAcceptance.h | 44 ++++++++++++++++++++ MdePkg/MdePkg.dec | 3 ++ 2 files changed, 47 insertions(+) diff --git a/MdePkg/Include/Protocol/Bz3987SevMemoryAcceptance.h b/MdePkg/Include/Protocol/Bz3987SevMemoryAcceptance.h new file mode 100644 index 0000000000..c3691e1c93 --- /dev/null +++ b/MdePkg/Include/Protocol/Bz3987SevMemoryAcceptance.h @@ -0,0 +1,44 @@ +/** @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 BZ3987_SEV_MEMORY_ACCEPTANCE_PROTOCOL_GUID \ + {0xc5a010fe, \ + 0x38a7, \ + 0x4531, \ + {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}} + +typedef struct _BZ3987_SEV_MEMORY_ACCEPTANCE_PROTOCOL \ + BZ3987_SEV_MEMORY_ACCEPTANCE_PROTOCOL; + +/** + @param This A pointer to a BZ3987_SEV_MEMORY_ACCEPTANCE_PROTOCOL. +**/ +typedef + EFI_STATUS +(EFIAPI *BZ3987_SEV_ALLOW_UNACCEPTED_MEMORY)( + IN BZ3987_SEV_MEMORY_ACCEPTANCE_PROTOCOL *This + ); + +/// +/// The BZ3987_SEV_MEMORY_ACCEPTANCE_PROTOCOL allows the OS loader to +/// indicate to EDK2 that ExitBootServices should not accept all memory. +/// +struct _BZ3987_SEV_MEMORY_ACCEPTANCE_PROTOCOL { + BZ3987_SEV_ALLOW_UNACCEPTED_MEMORY AllowUnacceptedMemory; +}; + +extern EFI_GUID gBz3987SevMemoryAcceptanceProtocolGuid; + +#endif diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 3d08f20d15..b82d6e46a4 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -1031,6 +1031,9 @@ gEfiPeiDelayedDispatchPpiGuid = { 0x869c711d, 0x649c, 0x44fe, { 0x8b, 0x9e, 0x2c, 0xbb, 0x29, 0x11, 0xc3, 0xe6 }} [Protocols] + ## Include/Protocol/Bz3987SevMemoryAcceptance.h + gBz3987SevMemoryAcceptanceProtocolGuid = { 0xc5a010fe, 0x38a7, 0x4531, {0x8a, 0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49 }} + ## Include/Protocol/MemoryAccept.h gEdkiiMemoryAcceptProtocolGuid = { 0x38c74800, 0x5590, 0x4db4, { 0xa0, 0xf3, 0x67, 0x5d, 0x9b, 0x8e, 0x80, 0x26 }} -- 2.39.1.456.gfc5497dd1b-goog