From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::d43; helo=mail-io1-xd43.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8CB67211CFFF0 for ; Tue, 5 Mar 2019 07:58:41 -0800 (PST) Received: by mail-io1-xd43.google.com with SMTP id y6so7432554ioq.10 for ; Tue, 05 Mar 2019 07:58:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RbcKAkpvCDT6aMwFYOHbXYHmLyAEFBap0bfBJ55wjWw=; b=Gcnf0s307CJRyp7Iq7JTxUm5jp+pRpORrzhETbTSbmo69v3EIZy99F+DaUPucqPuUp f9Dd/wzCggajjHkdKUZgF4n+F2AwKdipg8+f3+/nNA0bktSYWrlnGbIlvhCznG5j0Fmy bVK1C7hsXK1Ve5FA+ZwEzrNFK1zfU90ujZv3dvMmwbbyteeyCILY3rQzTwF/Adh6KbRH 51QiCSWcPVoU4ITU7hO0YBpUr5EAU2zpA2o0GaYQGrOPVM88W2XHFnUo7FNeQdg1FMRM xjhpHs5ScvGGinQsZxShVxgV9zJLrknGwHSwSmB122Nek2Mvmfao4d5WYzrwD7pX/erO HZGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RbcKAkpvCDT6aMwFYOHbXYHmLyAEFBap0bfBJ55wjWw=; b=aAl3F4cWktsIa1vhX9PA2XFSUi8gSyqLvFEj3SjYOXtY/uhE8VDmQJNECzEn0ZLiFt VaRmszvlnsjbs9LnFHoY+AVDphsqBzgz/nS1crWGcUDO+SUPDvK8CK2t49zQd3zoQ2pd I0TxZtZ5Lr9bjwNM2jo5x6gsxV0Uo26O6lBkiCdfEVT7ihgV16wtuktKMpYymZRVewIy HWLRyNommZSudd5KVAFApcvgRCiQEw4MnqE1a76YqLrLHjVpkqcwS4zNonSCBgXV58e2 ynSvL+/yCSaUJPL+Fh8bhF9qEkiElWNgSJS4tBcS+Uk7yDoFnrg+pwDf+GU4Y8BkyvxU KZWg== X-Gm-Message-State: APjAAAU99qsxGihMpG7Ztj3aVq6sI2F8z7eKDBKzjtAtV4pFG07jmLj0 Ppq/WoO/+RLs9Os/O+RiqND/FKZRZGdKF93xG2MOWg== X-Google-Smtp-Source: APXvYqyLg7/VI8Qd+S2sxWQRwqAZzv9q+Xh5pApbXdGvsZFImC9pvLbcR881dGgZBC7fjskCerds2+mch5/7A+/pdZI= X-Received: by 2002:a6b:7b02:: with SMTP id l2mr481040iop.60.1551801519849; Tue, 05 Mar 2019 07:58:39 -0800 (PST) MIME-Version: 1.0 References: <20190305133248.4828-1-ard.biesheuvel@linaro.org> <20190305133248.4828-11-ard.biesheuvel@linaro.org> <74D8A39837DF1E4DA445A8C0B3885C503F54D1FD@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503F54D1FD@shsmsx102.ccr.corp.intel.com> From: Ard Biesheuvel Date: Tue, 5 Mar 2019 16:58:27 +0100 Message-ID: To: "Yao, Jiewen" Cc: "edk2-devel@lists.01.org" , Achin Gupta , Supreeth Venkatesh , Leif Lindholm , Jagadeesh Ujja Subject: Re: [PATCH 10/10] ArmPkg/MmCommunicationDxe: signal architected PI events into MM context X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2019 15:58:41 -0000 Content-Type: text/plain; charset="UTF-8" On Tue, 5 Mar 2019 at 16:56, Yao, Jiewen wrote: > > Hi > In original SMM infrastructure, there are lots of interaction that SMM has to know the DXE status. > > In StandaloneMm, I don't expect we have many interaction. Is there any specific example? > > I am totally OK to add those. And I just want to know more usage. > > Reviewed-by: Jiewen.yao@intel.com > Jiewen, Thanks for the review. It is not 100% clear at the moment, but since existing third party software designed to run in MM context may make assumptions about security of the platform (e.g., before vs after end of dxe) based on these events, we should at least signal the common ones added in this patch. > > -----Original Message----- > > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > > Sent: Tuesday, March 5, 2019 5:33 AM > > To: edk2-devel@lists.01.org > > Cc: Ard Biesheuvel ; Achin Gupta > > ; Supreeth Venkatesh > > ; Yao, Jiewen ; > > Leif Lindholm ; Jagadeesh Ujja > > > > Subject: [PATCH 10/10] ArmPkg/MmCommunicationDxe: signal architected > > PI events into MM context > > > > PI defines a few architected events that have significance in the MM > > context as well as in the non-secure DXE context. So register notify > > handlers for these events, and relay them into the standalone MM world. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Ard Biesheuvel > > --- > > ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf | 5 +++ > > ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c | 47 > > +++++++++++++++++++- > > 2 files changed, 50 insertions(+), 2 deletions(-) > > > > diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > > b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > > index 88beafa39c05..8bf269270f9d 100644 > > --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > > +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > > @@ -48,6 +48,11 @@ [LibraryClasses] > > [Protocols] > > gEfiMmCommunicationProtocolGuid ## PRODUCES > > > > +[Guids] > > + gEfiEndOfDxeEventGroupGuid > > + gEfiEventExitBootServicesGuid > > + gEfiEventReadyToBootGuid > > + > > [Pcd.common] > > gArmTokenSpaceGuid.PcdMmBufferBase > > gArmTokenSpaceGuid.PcdMmBufferSize > > diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > > b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > > index feb9fa9f4ead..3203cf801a19 100644 > > --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > > +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > > @@ -265,6 +265,43 @@ GetMmCompatibility () > > return Status; > > } > > > > +STATIC EFI_GUID* CONST mGuidedEventGuid[] = { > > + &gEfiEndOfDxeEventGroupGuid, > > + &gEfiEventExitBootServicesGuid, > > + &gEfiEventReadyToBootGuid, > > +}; > > + > > +STATIC EFI_EVENT mGuidedEvent[ARRAY_SIZE (mGuidedEventGuid)]; > > + > > +/** > > + Event notification that is fired when GUIDed Event Group is signaled. > > + > > + @param Event The Event that is being processed, > > not used. > > + @param Context Event Context, not used. > > + > > +**/ > > +STATIC > > +VOID > > +EFIAPI > > +MmGuidedEventNotify ( > > + IN EFI_EVENT Event, > > + IN VOID *Context > > + ) > > +{ > > + EFI_MM_COMMUNICATE_HEADER Header; > > + UINTN Size; > > + > > + // > > + // Use Guid to initialize EFI_SMM_COMMUNICATE_HEADER structure > > + // > > + CopyGuid (&Header.HeaderGuid, Context); > > + Header.MessageLength = 1; > > + Header.Data[0] = 0; > > + > > + Size = sizeof (Header); > > + MmCommunicationCommunicate (&mMmCommunication, &Header, > > &Size); > > +} > > + > > /** > > The Entry Point for MM Communication > > > > @@ -287,6 +324,7 @@ MmCommunicationInitialize ( > > ) > > { > > EFI_STATUS Status; > > + UINTN Index; > > > > // Check if we can make the MM call > > Status = GetMmCompatibility (); > > @@ -351,8 +389,13 @@ MmCommunicationInitialize ( > > NULL, > > &mSetVirtualAddressMapEvent > > ); > > - if (Status == EFI_SUCCESS) { > > - return Status; > > + ASSERT_EFI_ERROR (Status); > > + > > + for (Index = 0; Index < ARRAY_SIZE (mGuidedEventGuid); Index++) { > > + Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, > > + MmGuidedEventNotify, mGuidedEventGuid[Index], > > + mGuidedEventGuid[Index], > > &mGuidedEvent[Index]); > > + ASSERT_EFI_ERROR (Status); > > } > > > > gBS->UninstallProtocolInterface ( > > -- > > 2.20.1 >