From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by mx.groups.io with SMTP id smtpd.web10.86654.1674767870284075890 for ; Thu, 26 Jan 2023 13:17:50 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=JUeN1Rmq; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.216.74, mailfrom: 3_e3sywskbuopu0zzmsxmbqs00sxq.o0ypq7qxqpwe.s30614.u0@flex--dionnaglaze.bounces.google.com) Received: by mail-pj1-f74.google.com with SMTP id e11-20020a17090a77cb00b0022925dd66d3so3264804pjs.4 for ; Thu, 26 Jan 2023 13:17:50 -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=1vbxAn4deOmWPK0BC0EtlgBVakvUFeDqvHEVlaNodSA=; b=JUeN1RmqDT5cGP5kokZMTDervRSDzd6C4yJpC2GFfkNp5L+EDNs5wgXFtfVughyc40 /IsbBhi/p6b9E4u/k54rZcvqI6HRyIt43LAgYK9/Hy4RubyGMnEgx9V5JKunYTz+Blbf gVSsdm+Iu95I5zWW2dm9LswXsG4nm0r/pTGTfLtQAJZdoMyF6lho/4Zu2OHos3ByiQ1O wPZ8Hq40Ukdxz1eTcOrGK/3rCYchaOuM35tcywUwiYVvnfFJq7PH7pPIOSmW2jOme5FO jn8ujepokX5RbKHEnauJhS3poicO/a64CfIPd5NI5/qzHNQfNcOUIMAtw6RxLvOzWXfR R9nQ== 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=1vbxAn4deOmWPK0BC0EtlgBVakvUFeDqvHEVlaNodSA=; b=4oIbvnQZaEM4xFxwv4a4swGZGXYkAxPHfA2nihTbopZnne1vXfrDqF0RMycDApNEJM 7NsU/2E9mJ6VAUMoqS+RYCz9/JY65kjDalHbuaa4q4l6b6uY5PFVStRfWh0DsLy1QiEa SUV0EijKfLR7E/Bavbupb3oG4/lMJlo/nMJW2mF0nG0KwJqKgpxEPb1pWsxb3cnFWNDO YtijErC7DvB64eufEG/sugrAwRYFOAKEjCbbcZsxQ/ftdpeUcYWfttKnxaUihwfWx1CC kBmbUO3FJhB83Qvtc0OHuvjI7eW3JiC7TEo0f+7ihtWXMnp2W4dNi9XZzDLB8ccUMEbU bQxQ== X-Gm-Message-State: AO0yUKWbAya2HXZLCwFNqPegyNNCi+4c4KUWjpAZI7ik6jO3mwJRDkJN hJmvbgrBt8Z7towj7r+gZ7asXwRb5CkaXeYSl4IaoDO7scHiFCQhLSwzGOJ6IBsEHV4S09rCyzc 5OxtDStlzvjkYd5X65grJpSbD1Y4EOnG1cF8W3lTynAVZo5d/dDa5N4Kcm/z7T3YzgH40g2Ee X-Google-Smtp-Source: AK7set+AacFezw+pAzGk7EbykqrwNGye/2t7RhCcqZEnAqMN49GreKRbVRKFvm5axBEzLhc6NSv+r92pVuF4IMjnbg== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a62:e30e:0:b0:592:618f:db6c with SMTP id g14-20020a62e30e000000b00592618fdb6cmr22549pfh.34.1674767869619; Thu, 26 Jan 2023 13:17:49 -0800 (PST) Date: Thu, 26 Jan 2023 21:17:38 +0000 In-Reply-To: <20230126211740.3235408-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20230126211740.3235408-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Message-ID: <20230126211740.3235408-3-dionnaglaze@google.com> Subject: [PATCH v11 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. 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}} -- 2.39.1.456.gfc5497dd1b-goog