From nobody Wed Nov 13 07:08:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+98405+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+98405+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1673568890; cv=none; d=zohomail.com; s=zohoarc; b=eDUyF35a7PB0WkyWTEjXcDHX71vv3DChoAvEJ939gp2q7YDpUMzfsCsnA2KtfBtHQ1ecMvFJWVBJ2wDaIQ8VKbCtdMflSFVbkBYRaIWkX1Q6h5eysbgz9e3NcNkchNrygIZ7t3hoZ0ZPfaRptyv/TJ9GmMGR2Ro+9HFbZYpu/kI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673568890; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=MkvOCXgc5D+V2QF0HzZoNUatyd4WDEpB/HIKNe3UXJ8=; b=aOR3rYtqyBtNSbE0eX+5e0m6bc9HSYo6MkZlFMgEIySt0DVKSxN290BH+IlCLVsgw5WyyndvcaH6ma70xW0VZzJHS/ce5eERljr3UZrJT60hJztmHWhNx4OrOie9xdbFmLH/DKbsLFk7hDNO7M0QAAT7JohPjU+W65UZYJf254E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+98405+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 167356889058248.640599574064936; Thu, 12 Jan 2023 16:14:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id a5T0YY1788612xlnWNfCfchq; Thu, 12 Jan 2023 16:14:50 -0800 X-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.73501.1673568889664138301 for ; Thu, 12 Jan 2023 16:14:49 -0800 X-Received: by mail-pl1-f201.google.com with SMTP id u13-20020a170902e5cd00b001946b7ded08so531219plf.12 for ; Thu, 12 Jan 2023 16:14:49 -0800 (PST) X-Gm-Message-State: SWjU1CcNOZE1u62pWHNy4FENx1787277AA= X-Google-Smtp-Source: AMrXdXsjKCGM90hybDGLXtJwWK8J3OtbD1rQA/4OdaxJHKlXrMew1V9wtzwTRwum6uMLa16b++btDYWd8JvM9YHpTw== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a17:902:7401:b0:194:52ed:7a29 with SMTP id g1-20020a170902740100b0019452ed7a29mr614996pll.66.1673568888764; Thu, 12 Jan 2023 16:14:48 -0800 (PST) Date: Fri, 13 Jan 2023 00:14:18 +0000 In-Reply-To: <20230113001419.2519031-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20230113001419.2519031-1-dionnaglaze@google.com> Message-ID: <20230113001419.2519031-4-dionnaglaze@google.com> Subject: [edk2-devel] [PATCH v9 3/4] OvmfPkg: Implement AcceptAllUnacceptedMemory in CocoDxe From: "Dionna Glaze via groups.io" 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" Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,dionnaglaze@google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673568890; bh=mKVyuEfgejgzTgk+wtDtvf+JaaY33dPHwQLTixDvyjw=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=dFBU0P2yUjIa2M2CI8As7K06VYwvDZ8qHbnk80aSddPC4IBp0hVCs4guuZfyBWFVDSI vQt3B/hXis+bEE1E+aXrS5EyMwUk0RznMrZg4OupVXac0dC0dBgeWtU4tHaCvEu8LSTmv /ebEL8Im1wD2EkT4ZoMAw7YX6oO1z27ijmA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673568891496100014 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This protocol implementation disables the accept-all-memory behavior of the BeforeExitBootServices event this driver adds. 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/CocoDxe/CocoDxe.c | 28 ++++++++++++++++++++++++++++ OvmfPkg/CocoDxe/CocoDxe.inf | 1 + 2 files changed, 29 insertions(+) diff --git a/OvmfPkg/CocoDxe/CocoDxe.c b/OvmfPkg/CocoDxe/CocoDxe.c index da16af32a3..57169b0481 100644 --- a/OvmfPkg/CocoDxe/CocoDxe.c +++ b/OvmfPkg/CocoDxe/CocoDxe.c @@ -18,11 +18,14 @@ #include #include #include +#include =20 STATIC BOOLEAN mAcceptAllMemoryAtEBS =3D TRUE; =20 STATIC EFI_EVENT mAcceptAllMemoryEvent =3D NULL; =20 +STATIC EFI_HANDLE mCocoDxeHandle =3D NULL; + STATIC EFI_STATUS AcceptAllMemory ( @@ -111,6 +114,21 @@ ResolveUnacceptedMemory ( ASSERT_EFI_ERROR (Status); } =20 +STATIC +EFI_STATUS +EFIAPI +AllowUnacceptedMemory ( + IN BZ3987_MEMORY_ACCEPTANCE_PROTOCOL *This + ) +{ + mAcceptAllMemoryAtEBS =3D FALSE; + return EFI_SUCCESS; +} + +STATIC +BZ3987_MEMORY_ACCEPTANCE_PROTOCOL + mMemoryAcceptanceProtocol =3D { AllowUnacceptedMemory }; + EFI_STATUS EFIAPI CocoDxeEntryPoint ( @@ -143,5 +161,15 @@ CocoDxeEntryPoint ( DEBUG ((DEBUG_ERROR, "AllowUnacceptedMemory event creation for EventBe= foreExitBootServices failed.\n")); } =20 + Status =3D gBS->InstallProtocolInterface ( + &mCocoDxeHandle, + &gBz3987MemoryAcceptanceProtocolGuid, + EFI_NATIVE_INTERFACE, + &mMemoryAcceptanceProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Install Bz3987MemoryAcceptanceProtocol failed.\n= ")); + } + return EFI_SUCCESS; } diff --git a/OvmfPkg/CocoDxe/CocoDxe.inf b/OvmfPkg/CocoDxe/CocoDxe.inf index 8d4452e94d..05c2651a89 100644 --- a/OvmfPkg/CocoDxe/CocoDxe.inf +++ b/OvmfPkg/CocoDxe/CocoDxe.inf @@ -42,4 +42,5 @@ gEfiEventBeforeExitBootServicesGuid =20 [Protocols] + gBz3987MemoryAcceptanceProtocolGuid gEdkiiMemoryAcceptProtocolGuid --=20 2.39.0.314.g84b9a713c41-goog -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#98405): https://edk2.groups.io/g/devel/message/98405 Mute This Topic: https://groups.io/mt/96236151/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-