From: Sughosh Ganu <sughosh.ganu@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
Leif Lindholm <leif.lindholm@linaro.org>,
Achin Gupta <achin.gupta@arm.com>
Subject: Re: [PATCH v4 2/5] ArmPkg/Drivers: Add EFI_MM_COMMUNICATION_PROTOCOL DXE driver.
Date: Tue, 27 Nov 2018 13:42:57 +0530 [thread overview]
Message-ID: <20181127081257.GA24403@arm.com> (raw)
In-Reply-To: <CAKv+Gu_b-W6F+srunZ1O834GJfaxsW9QHY1tB2neOuG4YHeaVw@mail.gmail.com>
hi Ard,
On Tue Nov 27, 2018 at 08:59:30AM +0100, Ard Biesheuvel wrote:
> Hi Sughosh,
>
> On Tue, 27 Nov 2018 at 07:19, Sughosh Ganu <sughosh.ganu@arm.com> wrote:
> >
> > From: Achin Gupta <achin.gupta@arm.com>
> >
> > PI v1.5 Specification Volume 4 defines Management Mode Core Interface
> > and defines EFI_MM_COMMUNICATION_PROTOCOL. This protocol provides a
> > means of communicating between drivers outside of MM and MMI
> > handlers inside of MM.
> >
> > This patch implements the EFI_MM_COMMUNICATION_PROTOCOL DXE runtime
> > driver for AARCH64 platforms. It uses SMCs allocated from the standard
> > SMC range defined in DEN0060A_ARM_MM_Interface_Specification.pdf
> > to communicate with the standalone MM environment in the secure world.
> >
> > This patch also adds the MM Communication driver (.inf) file to
> > define entry point for this driver and other compile
> > related information the driver needs.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
> > ---
> > ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf | 56 +++
> > ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h | 28 ++
> > ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c | 378 ++++++++++++++++++++
> > 3 files changed, 462 insertions(+)
<snip>
> > +/**
> > + The Entry Point for MM Communication
> > +
> > + This function installs the MM communication protocol interface and finds out
> > + what type of buffer management will be required prior to invoking the
> > + communication SMC.
> > +
> > + @param ImageHandle The firmware allocated handle for the EFI image.
> > + @param SystemTable A pointer to the EFI System Table.
> > +
> > + @retval EFI_SUCCESS The entry point is executed successfully.
> > + @retval Other Some error occurred when executing this entry point.
> > +
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +MmCommunicationInitialize (
> > + IN EFI_HANDLE ImageHandle,
> > + IN EFI_SYSTEM_TABLE *SystemTable
> > + )
> > +{
> > + EFI_STATUS Status;
> > +
> > + // Check if we can make the MM call
> > + Status = GetMmCompatibility ();
> > + if (EFI_ERROR(Status)) {
> > + goto ReturnErrorStatus;
> > + }
> > +
> > + mNsCommBuffMemRegion.PhysicalBase = PcdGet64 (PcdMmBufferBase);
> > + // During boot , Virtual and Physical are same
> > + mNsCommBuffMemRegion.VirtualBase = mNsCommBuffMemRegion.PhysicalBase;
> > + mNsCommBuffMemRegion.Length = PcdGet64 (PcdMmBufferSize);
> > +
> > + ASSERT (mNsCommBuffMemRegion.PhysicalBase != 0);
> > +
> > + ASSERT (mNsCommBuffMemRegion.Length != 0);
> > +
> > + Status = gDS->AddMemorySpace (
> > + EfiGcdMemoryTypeReserved,
> > + mNsCommBuffMemRegion.PhysicalBase,
> > + mNsCommBuffMemRegion.Length,
> > + EFI_MEMORY_WB |
> > + EFI_MEMORY_XP |
> > + EFI_MEMORY_RUNTIME
> > + );
> > + if (EFI_ERROR (Status)) {
> > + DEBUG ((DEBUG_ERROR, "MmCommunicateInitialize: "
> > + "Failed to add MM-NS Buffer Memory Space\n"));
> > + goto ReturnErrorStatus;
> > + }
> > +
> > + Status = gDS->SetMemorySpaceAttributes (
> > + mNsCommBuffMemRegion.PhysicalBase,
> > + mNsCommBuffMemRegion.Length,
> > + EFI_MEMORY_WB | EFI_MEMORY_XP | EFI_MEMORY_RUNTIME
> > + );
> > + if (EFI_ERROR (Status)) {
> > + DEBUG ((DEBUG_ERROR, "MmCommunicateInitialize: "
> > + "Failed to set MM-NS Buffer Memory attributes\n"));
> > + goto CleanAddedMemorySpace;
> > + }
> > +
> > + // Install the communication protocol
> > + Status = gBS->InstallProtocolInterface (
> > + &mMmCommunicateHandle,
> > + &gEfiMmCommunicationProtocolGuid,
> > + EFI_NATIVE_INTERFACE,
> > + &mMmCommunication
> > + );
> > + if (EFI_ERROR(Status)) {
> > + DEBUG ((DEBUG_ERROR, "MmCommunicationInitialize: "
> > + "Failed to install MM communication protocol\n"));
> > + goto CleanAllocatedPages;
> > + }
> > +
> > + // Register notification callback when virtual address is associated
> > + // with the physical address.
> > + // Create a Set Virtual Address Map event.
> > + Status = gBS->CreateEvent (
> > + EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
> > + TPL_NOTIFY,
> > + NotifySetVirtualAddressMap,
> > + NULL,
> > + &mSetVirtualAddressMapEvent
> > + );
> > + if (Status == EFI_SUCCESS) {
> > + return Status;
> > + }
> > +
> > + gBS->UninstallProtocolInterface (
> > + mMmCommunicateHandle,
> > + &gEfiMmCommunicationProtocolGuid,
> > + &mMmCommunication
> > + );
> > +
> > +CleanAllocatedPages:
> > + gBS->FreePages (
> > + mNsCommBuffMemRegion.PhysicalBase,
> > + EFI_SIZE_TO_PAGES (mNsCommBuffMemRegion.Length)
> > + );
> > +
>
> Do we still need this?
Oops. No this can now be removed. Will post a V6. Thanks.
-sughosh
next prev parent reply other threads:[~2018-11-27 8:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 6:19 [PATCH v4 0/5] ArmPkg related changes for StandaloneMM package Sughosh Ganu
2018-11-27 6:19 ` [PATCH v4 1/5] ArmPkg: Add PCDs needed for MM communication driver Sughosh Ganu
2018-11-27 6:19 ` [PATCH v4 2/5] ArmPkg/Drivers: Add EFI_MM_COMMUNICATION_PROTOCOL DXE driver Sughosh Ganu
2018-11-27 7:59 ` Ard Biesheuvel
2018-11-27 8:12 ` Sughosh Ganu [this message]
2018-11-27 6:19 ` [PATCH v4 3/5] ArmPkg/Include: Fix the SPM version SVC ID Sughosh Ganu
2018-11-27 6:19 ` [PATCH v4 4/5] ArmPkg/Include: Add MM interface SVC return codes Sughosh Ganu
2018-11-27 6:19 ` [PATCH v4 5/5] ArmPkg/ArmMmuLib: Add MMU Library suitable for use in S-EL0 Sughosh Ganu
2018-11-27 8:14 ` Ard Biesheuvel
2018-11-27 8:36 ` Sughosh Ganu
2018-11-27 8:38 ` Ard Biesheuvel
2018-11-27 8:50 ` Sughosh Ganu
2018-11-27 9:28 ` Ard Biesheuvel
2018-11-27 9:58 ` Sughosh Ganu
2018-11-27 10:00 ` Ard Biesheuvel
2018-11-27 10:04 ` Sughosh Ganu
2018-11-27 10:05 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181127081257.GA24403@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox