public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Does ARM platform produce MP protocol?
@ 2019-03-06  5:44 Ni, Ray
  2019-03-06  7:38 ` Ard Biesheuvel
  0 siblings, 1 reply; 8+ messages in thread
From: Ni, Ray @ 2019-03-06  5:44 UTC (permalink / raw)
  To: Ard Biesheuvel, 'leif.lindholm@linaro.org'
  Cc: edk2-devel@lists.01.org

Ard, Leif,
I am a bit interested in how ARM platform supports the MP?
PI Spec defines below protocol but I failed to find a driver in ARM platform producing this protocol.
Or did I miss anything?

typedef struct _EFI_MP_SERVICES_PROTOCOL {
EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;
EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;
EFI_MP_SERVICES_WHOAMI WhoAmI;
} EFI_MP_SERVICES_PROTOCOL;

Thanks,
Ray


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Does ARM platform produce MP protocol?
  2019-03-06  5:44 Does ARM platform produce MP protocol? Ni, Ray
@ 2019-03-06  7:38 ` Ard Biesheuvel
  2019-03-06  9:16   ` Ni, Ray
  0 siblings, 1 reply; 8+ messages in thread
From: Ard Biesheuvel @ 2019-03-06  7:38 UTC (permalink / raw)
  To: Ni, Ray; +Cc: leif.lindholm@linaro.org, edk2-devel@lists.01.org

On Wed, 6 Mar 2019 at 06:44, Ni, Ray <ray.ni@intel.com> wrote:
>
> Ard, Leif,
> I am a bit interested in how ARM platform supports the MP?
> PI Spec defines below protocol but I failed to find a driver in ARM platform producing this protocol.
> Or did I miss anything?
>

No you are right. We don't expose that on ARM, since UEFI only runs on
a single core. Bringing up and taking down cores is done via a
protocol called PSCI, which is implemented by firmware running at a
higher privilege level.

So while it would be possible to implement the MP protocol on top of
PSCI, we haven't identified a use case for it yet. (The OS calls PSCI
directly to boot the secondary cores)

> typedef struct _EFI_MP_SERVICES_PROTOCOL {
> EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;
> EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
> EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
> EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
> EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
> EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;
> EFI_MP_SERVICES_WHOAMI WhoAmI;
> } EFI_MP_SERVICES_PROTOCOL;
>
> Thanks,
> Ray


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Does ARM platform produce MP protocol?
  2019-03-06  7:38 ` Ard Biesheuvel
@ 2019-03-06  9:16   ` Ni, Ray
  2019-03-06  9:37     ` Ard Biesheuvel
  0 siblings, 1 reply; 8+ messages in thread
From: Ni, Ray @ 2019-03-06  9:16 UTC (permalink / raw)
  To: 'Ard Biesheuvel'; +Cc: edk2-devel@lists.01.org

> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Ard
> Biesheuvel
> Sent: Wednesday, March 6, 2019 3:38 PM
> To: Ni, Ray <ray.ni@intel.com>
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] Does ARM platform produce MP protocol?
> 
> On Wed, 6 Mar 2019 at 06:44, Ni, Ray <ray.ni@intel.com> wrote:
> >
> > Ard, Leif,
> > I am a bit interested in how ARM platform supports the MP?
> > PI Spec defines below protocol but I failed to find a driver in ARM platform
> producing this protocol.
> > Or did I miss anything?
> >
> 
> No you are right. We don't expose that on ARM, since UEFI only runs on a
> single core. Bringing up and taking down cores is done via a protocol called
> PSCI, which is implemented by firmware running at a higher privilege level.
> 
> So while it would be possible to implement the MP protocol on top of PSCI,
> we haven't identified a use case for it yet. (The OS calls PSCI directly to boot
> the secondary cores)

Is below EFI_MM_MP_PROTOCOL (added in PI spec 1.6) implemented in ARM?
Or will it be implemented by an ARM module?
I am asking this because MP_SERVICES protocol exposes CPU location information
(Package/Core/Thread) through *GetProcessorInfo*, but MM_MP protocol doesn't
have a way to expose that information.
If such location information isn't exposed by MM_MP, is that because ARM doesn't
care about the location information? Or because ARM cares but forgot to add similar
*GetProcessorInfo* interface to MM_MP when changing the PI spec?
Or ARM doesn't use the MM_MP at all?

typedef struct _EFI_MM_MP_PROTOCOL {
	UINT32                           Revision,
	UINT32                           Attributes,
	EFI_MM_ GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors,
	EFI_MM_DISPATCH_PROCEDURE        DispatchProcedure,
	EFI_MM_BROADCAST_PROCEDURE       BroadcastProcedure,
	EFI_MM_SET_STARTUP_PROCEDURE     SetStartupProcedure,
	EFI_CHECK_FOR_PROCEDURE          CheckOnProcedure,
	EFI_WAIT_FOR_PROCEDURE           WaitForProcedure,
}EFI_MM_MP_PROTOCOL;
> 
> > typedef struct _EFI_MP_SERVICES_PROTOCOL {
> > EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS
> GetNumberOfProcessors;
> > EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
> > EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
> > EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
> > EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
> EFI_MP_SERVICES_ENABLEDISABLEAP
> > EnableDisableAP; EFI_MP_SERVICES_WHOAMI WhoAmI; }
> > EFI_MP_SERVICES_PROTOCOL;
> >
> > Thanks,
> > Ray
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Does ARM platform produce MP protocol?
  2019-03-06  9:16   ` Ni, Ray
@ 2019-03-06  9:37     ` Ard Biesheuvel
  2019-03-06 12:41       ` Achin Gupta
  0 siblings, 1 reply; 8+ messages in thread
From: Ard Biesheuvel @ 2019-03-06  9:37 UTC (permalink / raw)
  To: Ni, Ray, Achin Gupta, Charles Garcia-Tobin; +Cc: edk2-devel@lists.01.org

(adding Achin and Charles)

On Wed, 6 Mar 2019 at 10:16, Ni, Ray <ray.ni@intel.com> wrote:
>
> > -----Original Message-----
> > From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Ard
> > Biesheuvel
> > Sent: Wednesday, March 6, 2019 3:38 PM
> > To: Ni, Ray <ray.ni@intel.com>
> > Cc: edk2-devel@lists.01.org
> > Subject: Re: [edk2] Does ARM platform produce MP protocol?
> >
> > On Wed, 6 Mar 2019 at 06:44, Ni, Ray <ray.ni@intel.com> wrote:
> > >
> > > Ard, Leif,
> > > I am a bit interested in how ARM platform supports the MP?
> > > PI Spec defines below protocol but I failed to find a driver in ARM platform
> > producing this protocol.
> > > Or did I miss anything?
> > >
> >
> > No you are right. We don't expose that on ARM, since UEFI only runs on a
> > single core. Bringing up and taking down cores is done via a protocol called
> > PSCI, which is implemented by firmware running at a higher privilege level.
> >
> > So while it would be possible to implement the MP protocol on top of PSCI,
> > we haven't identified a use case for it yet. (The OS calls PSCI directly to boot
> > the secondary cores)
>
> Is below EFI_MM_MP_PROTOCOL (added in PI spec 1.6) implemented in ARM?
> Or will it be implemented by an ARM module?

No it is currently not implemented, and I am not aware of any plans to do so.

> I am asking this because MP_SERVICES protocol exposes CPU location information
> (Package/Core/Thread) through *GetProcessorInfo*, but MM_MP protocol doesn't
> have a way to expose that information.
> If such location information isn't exposed by MM_MP, is that because ARM doesn't
> care about the location information? Or because ARM cares but forgot to add similar
> *GetProcessorInfo* interface to MM_MP when changing the PI spec?
> Or ARM doesn't use the MM_MP at all?
>

I don't know the history of this protocol and who proposed it, but
today, we don't have a need for running per-CPU initialization code in
the context of MM. Even if MM is a component of the more privileged
firmware running on an ARM system, it is running in a sandbox that was
primarily designed around exposing MM services to UEFI code running at
the same privilege level as the OS (such as the authenticated variable
store). Platform initialization code (which is more likely to require
dispatch to each core) runs in the secure world as well, but not in
the context of MM.

I will let Achin chime in here as well.


> typedef struct _EFI_MM_MP_PROTOCOL {
>         UINT32                           Revision,
>         UINT32                           Attributes,
>         EFI_MM_ GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors,
>         EFI_MM_DISPATCH_PROCEDURE        DispatchProcedure,
>         EFI_MM_BROADCAST_PROCEDURE       BroadcastProcedure,
>         EFI_MM_SET_STARTUP_PROCEDURE     SetStartupProcedure,
>         EFI_CHECK_FOR_PROCEDURE          CheckOnProcedure,
>         EFI_WAIT_FOR_PROCEDURE           WaitForProcedure,
> }EFI_MM_MP_PROTOCOL;
> >
> > > typedef struct _EFI_MP_SERVICES_PROTOCOL {
> > > EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS
> > GetNumberOfProcessors;
> > > EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
> > > EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
> > > EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
> > > EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
> > EFI_MP_SERVICES_ENABLEDISABLEAP
> > > EnableDisableAP; EFI_MP_SERVICES_WHOAMI WhoAmI; }
> > > EFI_MP_SERVICES_PROTOCOL;
> > >
> > > Thanks,
> > > Ray
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Does ARM platform produce MP protocol?
  2019-03-06  9:37     ` Ard Biesheuvel
@ 2019-03-06 12:41       ` Achin Gupta
  2019-03-06 13:22         ` Ard Biesheuvel
  0 siblings, 1 reply; 8+ messages in thread
From: Achin Gupta @ 2019-03-06 12:41 UTC (permalink / raw)
  To: Ard Biesheuvel, ray.ni@intel.com
  Cc: Ni, Ray, Charles Garcia-Tobin, edk2-devel@lists.01.org

On Wed, Mar 06, 2019 at 10:37:58AM +0100, Ard Biesheuvel wrote:
> (adding Achin and Charles)
>
> On Wed, 6 Mar 2019 at 10:16, Ni, Ray <ray.ni@intel.com> wrote:
> >
> > > -----Original Message-----
> > > From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Ard
> > > Biesheuvel
> > > Sent: Wednesday, March 6, 2019 3:38 PM
> > > To: Ni, Ray <ray.ni@intel.com>
> > > Cc: edk2-devel@lists.01.org
> > > Subject: Re: [edk2] Does ARM platform produce MP protocol?
> > >
> > > On Wed, 6 Mar 2019 at 06:44, Ni, Ray <ray.ni@intel.com> wrote:
> > > >
> > > > Ard, Leif,
> > > > I am a bit interested in how ARM platform supports the MP?
> > > > PI Spec defines below protocol but I failed to find a driver in ARM platform
> > > producing this protocol.
> > > > Or did I miss anything?
> > > >
> > >
> > > No you are right. We don't expose that on ARM, since UEFI only runs on a
> > > single core. Bringing up and taking down cores is done via a protocol called
> > > PSCI, which is implemented by firmware running at a higher privilege level.
> > >
> > > So while it would be possible to implement the MP protocol on top of PSCI,
> > > we haven't identified a use case for it yet. (The OS calls PSCI directly to boot
> > > the secondary cores)

IIUC, the MP protocol enables communication between processors that are already
up instead of bringing them up or taking them down. So, it is orthogonal to
PSCI. Is that what you meant?

> >
> > Is below EFI_MM_MP_PROTOCOL (added in PI spec 1.6) implemented in ARM?
> > Or will it be implemented by an ARM module?
>
> No it is currently not implemented, and I am not aware of any plans to do so.

+1. There is no need to do this until UEFI runs on a single core on Arm.

>
> > I am asking this because MP_SERVICES protocol exposes CPU location information
> > (Package/Core/Thread) through *GetProcessorInfo*, but MM_MP protocol doesn't
> > have a way to expose that information.
> > If such location information isn't exposed by MM_MP, is that because ARM doesn't
> > care about the location information? Or because ARM cares but forgot to add similar
> > *GetProcessorInfo* interface to MM_MP when changing the PI spec?
> > Or ARM doesn't use the MM_MP at all?

Even if Arm used this protocol, it can work with the logical processor number. I
don't see a need to expose the location information to the caller. It seems very
Intel specific. Is the EFI_MP_SERVICES_PROTOCOL used on Arm?

> >
>
> I don't know the history of this protocol and who proposed it, but
> today, we don't have a need for running per-CPU initialization code in
> the context of MM. Even if MM is a component of the more privileged
> firmware running on an ARM system, it is running in a sandbox that was
> primarily designed around exposing MM services to UEFI code running at
> the same privilege level as the OS (such as the authenticated variable
> store). Platform initialization code (which is more likely to require
> dispatch to each core) runs in the secure world as well, but not in
> the context of MM.
>
> I will let Achin chime in here as well.

+1.

I will let Charles comment on the history. Maybe this protocol was designed
for Arm systems where MM is the most privileged firmware. The upstream
implementation runs MM in the lowest privilege level. Either way, this protocol
sense only when MM on Arm is MP capable.

cheers,
Achin


>
>
> > typedef struct _EFI_MM_MP_PROTOCOL {
> >         UINT32                           Revision,
> >         UINT32                           Attributes,
> >         EFI_MM_ GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors,
> >         EFI_MM_DISPATCH_PROCEDURE        DispatchProcedure,
> >         EFI_MM_BROADCAST_PROCEDURE       BroadcastProcedure,
> >         EFI_MM_SET_STARTUP_PROCEDURE     SetStartupProcedure,
> >         EFI_CHECK_FOR_PROCEDURE          CheckOnProcedure,
> >         EFI_WAIT_FOR_PROCEDURE           WaitForProcedure,
> > }EFI_MM_MP_PROTOCOL;
> > >
> > > > typedef struct _EFI_MP_SERVICES_PROTOCOL {
> > > > EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS
> > > GetNumberOfProcessors;
> > > > EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
> > > > EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
> > > > EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
> > > > EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
> > > EFI_MP_SERVICES_ENABLEDISABLEAP
> > > > EnableDisableAP; EFI_MP_SERVICES_WHOAMI WhoAmI; }
> > > > EFI_MP_SERVICES_PROTOCOL;
> > > >
> > > > Thanks,
> > > > Ray
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Does ARM platform produce MP protocol?
  2019-03-06 12:41       ` Achin Gupta
@ 2019-03-06 13:22         ` Ard Biesheuvel
  2019-03-06 17:04           ` Andrew Fish
  2019-03-07 11:16           ` Achin Gupta
  0 siblings, 2 replies; 8+ messages in thread
From: Ard Biesheuvel @ 2019-03-06 13:22 UTC (permalink / raw)
  To: Achin Gupta
  Cc: ray.ni@intel.com, Charles Garcia-Tobin, edk2-devel@lists.01.org

On Wed, 6 Mar 2019 at 13:41, Achin Gupta <Achin.Gupta@arm.com> wrote:
>
> On Wed, Mar 06, 2019 at 10:37:58AM +0100, Ard Biesheuvel wrote:
> > (adding Achin and Charles)
> >
> > On Wed, 6 Mar 2019 at 10:16, Ni, Ray <ray.ni@intel.com> wrote:
> > >
> > > > -----Original Message-----
> > > > From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Ard
> > > > Biesheuvel
> > > > Sent: Wednesday, March 6, 2019 3:38 PM
> > > > To: Ni, Ray <ray.ni@intel.com>
> > > > Cc: edk2-devel@lists.01.org
> > > > Subject: Re: [edk2] Does ARM platform produce MP protocol?
> > > >
> > > > On Wed, 6 Mar 2019 at 06:44, Ni, Ray <ray.ni@intel.com> wrote:
> > > > >
> > > > > Ard, Leif,
> > > > > I am a bit interested in how ARM platform supports the MP?
> > > > > PI Spec defines below protocol but I failed to find a driver in ARM platform
> > > > producing this protocol.
> > > > > Or did I miss anything?
> > > > >
> > > >
> > > > No you are right. We don't expose that on ARM, since UEFI only runs on a
> > > > single core. Bringing up and taking down cores is done via a protocol called
> > > > PSCI, which is implemented by firmware running at a higher privilege level.
> > > >
> > > > So while it would be possible to implement the MP protocol on top of PSCI,
> > > > we haven't identified a use case for it yet. (The OS calls PSCI directly to boot
> > > > the secondary cores)
>
> IIUC, the MP protocol enables communication between processors that are already
> up instead of bringing them up or taking them down. So, it is orthogonal to
> PSCI. Is that what you meant?
>

Surely, StartupThisAP starts up the AP, no?

In any case, I didn't dig any deeper, but I know that PSCI can be used
(even in the UEFI context) to execute pieces of code on another core
(ACS uses this IIRC)

> > >
> > > Is below EFI_MM_MP_PROTOCOL (added in PI spec 1.6) implemented in ARM?
> > > Or will it be implemented by an ARM module?
> >
> > No it is currently not implemented, and I am not aware of any plans to do so.
>
> +1. There is no need to do this until UEFI runs on a single core on Arm.
>

until -> as long as ??

> >
> > > I am asking this because MP_SERVICES protocol exposes CPU location information
> > > (Package/Core/Thread) through *GetProcessorInfo*, but MM_MP protocol doesn't
> > > have a way to expose that information.
> > > If such location information isn't exposed by MM_MP, is that because ARM doesn't
> > > care about the location information? Or because ARM cares but forgot to add similar
> > > *GetProcessorInfo* interface to MM_MP when changing the PI spec?
> > > Or ARM doesn't use the MM_MP at all?
>
> Even if Arm used this protocol, it can work with the logical processor number. I
> don't see a need to expose the location information to the caller. It seems very
> Intel specific. Is the EFI_MP_SERVICES_PROTOCOL used on Arm?
>

No, that is what started the discussion.

> > >
> >
> > I don't know the history of this protocol and who proposed it, but
> > today, we don't have a need for running per-CPU initialization code in
> > the context of MM. Even if MM is a component of the more privileged
> > firmware running on an ARM system, it is running in a sandbox that was
> > primarily designed around exposing MM services to UEFI code running at
> > the same privilege level as the OS (such as the authenticated variable
> > store). Platform initialization code (which is more likely to require
> > dispatch to each core) runs in the secure world as well, but not in
> > the context of MM.
> >
> > I will let Achin chime in here as well.
>
> +1.
>
> I will let Charles comment on the history. Maybe this protocol was designed
> for Arm systems where MM is the most privileged firmware. The upstream
> implementation runs MM in the lowest privilege level. Either way, this protocol
> sense only when MM on Arm is MP capable.
>
> cheers,
> Achin
>
>
> >
> >
> > > typedef struct _EFI_MM_MP_PROTOCOL {
> > >         UINT32                           Revision,
> > >         UINT32                           Attributes,
> > >         EFI_MM_ GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors,
> > >         EFI_MM_DISPATCH_PROCEDURE        DispatchProcedure,
> > >         EFI_MM_BROADCAST_PROCEDURE       BroadcastProcedure,
> > >         EFI_MM_SET_STARTUP_PROCEDURE     SetStartupProcedure,
> > >         EFI_CHECK_FOR_PROCEDURE          CheckOnProcedure,
> > >         EFI_WAIT_FOR_PROCEDURE           WaitForProcedure,
> > > }EFI_MM_MP_PROTOCOL;
> > > >
> > > > > typedef struct _EFI_MP_SERVICES_PROTOCOL {
> > > > > EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS
> > > > GetNumberOfProcessors;
> > > > > EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
> > > > > EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
> > > > > EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
> > > > > EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
> > > > EFI_MP_SERVICES_ENABLEDISABLEAP
> > > > > EnableDisableAP; EFI_MP_SERVICES_WHOAMI WhoAmI; }
> > > > > EFI_MP_SERVICES_PROTOCOL;
> > > > >
> > > > > Thanks,
> > > > > Ray
> > > > _______________________________________________
> > > > edk2-devel mailing list
> > > > edk2-devel@lists.01.org
> > > > https://lists.01.org/mailman/listinfo/edk2-devel
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Does ARM platform produce MP protocol?
  2019-03-06 13:22         ` Ard Biesheuvel
@ 2019-03-06 17:04           ` Andrew Fish
  2019-03-07 11:16           ` Achin Gupta
  1 sibling, 0 replies; 8+ messages in thread
From: Andrew Fish @ 2019-03-06 17:04 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: Achin Gupta, edk2-devel@lists.01.org, Charles Garcia-Tobin



> On Mar 6, 2019, at 5:22 AM, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> 
> On Wed, 6 Mar 2019 at 13:41, Achin Gupta <Achin.Gupta@arm.com <mailto:Achin.Gupta@arm.com>> wrote:
>> 
>> On Wed, Mar 06, 2019 at 10:37:58AM +0100, Ard Biesheuvel wrote:
>>> (adding Achin and Charles)
>>> 
>>> On Wed, 6 Mar 2019 at 10:16, Ni, Ray <ray.ni@intel.com> wrote:
>>>> 
>>>>> -----Original Message-----
>>>>> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Ard
>>>>> Biesheuvel
>>>>> Sent: Wednesday, March 6, 2019 3:38 PM
>>>>> To: Ni, Ray <ray.ni@intel.com>
>>>>> Cc: edk2-devel@lists.01.org
>>>>> Subject: Re: [edk2] Does ARM platform produce MP protocol?
>>>>> 
>>>>> On Wed, 6 Mar 2019 at 06:44, Ni, Ray <ray.ni@intel.com> wrote:
>>>>>> 
>>>>>> Ard, Leif,
>>>>>> I am a bit interested in how ARM platform supports the MP?
>>>>>> PI Spec defines below protocol but I failed to find a driver in ARM platform
>>>>> producing this protocol.
>>>>>> Or did I miss anything?
>>>>>> 
>>>>> 
>>>>> No you are right. We don't expose that on ARM, since UEFI only runs on a
>>>>> single core. Bringing up and taking down cores is done via a protocol called
>>>>> PSCI, which is implemented by firmware running at a higher privilege level.
>>>>> 
>>>>> So while it would be possible to implement the MP protocol on top of PSCI,
>>>>> we haven't identified a use case for it yet. (The OS calls PSCI directly to boot
>>>>> the secondary cores)
>> 
>> IIUC, the MP protocol enables communication between processors that are already
>> up instead of bringing them up or taking them down. So, it is orthogonal to
>> PSCI. Is that what you meant?
>> 
> 
> Surely, StartupThisAP starts up the AP, no?
> 
> In any case, I didn't dig any deeper, but I know that PSCI can be used
> (even in the UEFI context) to execute pieces of code on another core
> (ACS uses this IIRC)

Ard,

I take it that the PSCI is replacing the INIT SIPI SIPI mechanism on x86. For PI you need to setup the APs (BSP is running EFI) and the MP protocol gets used for this on boot. Things like setting up SMM, syncing page tables, and MTRR registers. Seems like PSCI kind of replaces this usage on ARM. 

Since the APs don't run EFI, and it is not safe to call EFI APIs on APIs the usage for running code on the APs is limited. What I've seen is mostly utilities and diagnostics. For example you can write a utility to dump out the MTRR and MSR registers that are per CPU. From a diagnostic point of view it is easier to generate more memory and cache traffic if you have code running on the APs. 

Note: BSP and AP are terms from the original MP Spec on x86. BSP == Boot Strap Processor (so runs EFI) and AP == Application Processor (all the CPUs not running EFI).

Note: The INIT SIPI SIPI is painful to code since the SIPI sends a real mode address for code to run so it involves a lot of complex mode transitions so this is why it makes sense to centralize that code for x86. 

Thanks,

Andrew Fish


> 
>>>> 
>>>> Is below EFI_MM_MP_PROTOCOL (added in PI spec 1.6) implemented in ARM?
>>>> Or will it be implemented by an ARM module?
>>> 
>>> No it is currently not implemented, and I am not aware of any plans to do so.
>> 
>> +1. There is no need to do this until UEFI runs on a single core on Arm.
>> 
> 
> until -> as long as ??
> 
>>> 
>>>> I am asking this because MP_SERVICES protocol exposes CPU location information
>>>> (Package/Core/Thread) through *GetProcessorInfo*, but MM_MP protocol doesn't
>>>> have a way to expose that information.
>>>> If such location information isn't exposed by MM_MP, is that because ARM doesn't
>>>> care about the location information? Or because ARM cares but forgot to add similar
>>>> *GetProcessorInfo* interface to MM_MP when changing the PI spec?
>>>> Or ARM doesn't use the MM_MP at all?
>> 
>> Even if Arm used this protocol, it can work with the logical processor number. I
>> don't see a need to expose the location information to the caller. It seems very
>> Intel specific. Is the EFI_MP_SERVICES_PROTOCOL used on Arm?
>> 
> 
> No, that is what started the discussion.
> 
>>>> 
>>> 
>>> I don't know the history of this protocol and who proposed it, but
>>> today, we don't have a need for running per-CPU initialization code in
>>> the context of MM. Even if MM is a component of the more privileged
>>> firmware running on an ARM system, it is running in a sandbox that was
>>> primarily designed around exposing MM services to UEFI code running at
>>> the same privilege level as the OS (such as the authenticated variable
>>> store). Platform initialization code (which is more likely to require
>>> dispatch to each core) runs in the secure world as well, but not in
>>> the context of MM.
>>> 
>>> I will let Achin chime in here as well.
>> 
>> +1.
>> 
>> I will let Charles comment on the history. Maybe this protocol was designed
>> for Arm systems where MM is the most privileged firmware. The upstream
>> implementation runs MM in the lowest privilege level. Either way, this protocol
>> sense only when MM on Arm is MP capable.
>> 
>> cheers,
>> Achin
>> 
>> 
>>> 
>>> 
>>>> typedef struct _EFI_MM_MP_PROTOCOL {
>>>>        UINT32                           Revision,
>>>>        UINT32                           Attributes,
>>>>        EFI_MM_ GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors,
>>>>        EFI_MM_DISPATCH_PROCEDURE        DispatchProcedure,
>>>>        EFI_MM_BROADCAST_PROCEDURE       BroadcastProcedure,
>>>>        EFI_MM_SET_STARTUP_PROCEDURE     SetStartupProcedure,
>>>>        EFI_CHECK_FOR_PROCEDURE          CheckOnProcedure,
>>>>        EFI_WAIT_FOR_PROCEDURE           WaitForProcedure,
>>>> }EFI_MM_MP_PROTOCOL;
>>>>> 
>>>>>> typedef struct _EFI_MP_SERVICES_PROTOCOL {
>>>>>> EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS
>>>>> GetNumberOfProcessors;
>>>>>> EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
>>>>>> EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
>>>>>> EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
>>>>>> EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
>>>>> EFI_MP_SERVICES_ENABLEDISABLEAP
>>>>>> EnableDisableAP; EFI_MP_SERVICES_WHOAMI WhoAmI; }
>>>>>> EFI_MP_SERVICES_PROTOCOL;
>>>>>> 
>>>>>> Thanks,
>>>>>> Ray
>>>>> _______________________________________________
>>>>> edk2-devel mailing list
>>>>> edk2-devel@lists.01.org
>>>>> https://lists.01.org/mailman/listinfo/edk2-devel
>> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Does ARM platform produce MP protocol?
  2019-03-06 13:22         ` Ard Biesheuvel
  2019-03-06 17:04           ` Andrew Fish
@ 2019-03-07 11:16           ` Achin Gupta
  1 sibling, 0 replies; 8+ messages in thread
From: Achin Gupta @ 2019-03-07 11:16 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: ray.ni@intel.com, Charles Garcia-Tobin, edk2-devel@lists.01.org,
	nd

On Wed, Mar 06, 2019 at 02:22:25PM +0100, Ard Biesheuvel wrote:
> On Wed, 6 Mar 2019 at 13:41, Achin Gupta <Achin.Gupta@arm.com> wrote:
> >
> > On Wed, Mar 06, 2019 at 10:37:58AM +0100, Ard Biesheuvel wrote:
> > > (adding Achin and Charles)
> > >
> > > On Wed, 6 Mar 2019 at 10:16, Ni, Ray <ray.ni@intel.com> wrote:
> > > >
> > > > > -----Original Message-----
> > > > > From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Ard
> > > > > Biesheuvel
> > > > > Sent: Wednesday, March 6, 2019 3:38 PM
> > > > > To: Ni, Ray <ray.ni@intel.com>
> > > > > Cc: edk2-devel@lists.01.org
> > > > > Subject: Re: [edk2] Does ARM platform produce MP protocol?
> > > > >
> > > > > On Wed, 6 Mar 2019 at 06:44, Ni, Ray <ray.ni@intel.com> wrote:
> > > > > >
> > > > > > Ard, Leif,
> > > > > > I am a bit interested in how ARM platform supports the MP?
> > > > > > PI Spec defines below protocol but I failed to find a driver in ARM platform
> > > > > producing this protocol.
> > > > > > Or did I miss anything?
> > > > > >
> > > > >
> > > > > No you are right. We don't expose that on ARM, since UEFI only runs on a
> > > > > single core. Bringing up and taking down cores is done via a protocol called
> > > > > PSCI, which is implemented by firmware running at a higher privilege level.
> > > > >
> > > > > So while it would be possible to implement the MP protocol on top of PSCI,
> > > > > we haven't identified a use case for it yet. (The OS calls PSCI directly to boot
> > > > > the secondary cores)
> >
> > IIUC, the MP protocol enables communication between processors that are already
> > up instead of bringing them up or taking them down. So, it is orthogonal to
> > PSCI. Is that what you meant?
> >
>
> Surely, StartupThisAP starts up the AP, no?

I was talking about the EFI_MM_MP_PROTOCOL which I thought was the original bone
of contention.

PSCI has a direct intersection with the EFI_MP_SERVICES_PROTOCOL.

cheers,
Achin

>
> In any case, I didn't dig any deeper, but I know that PSCI can be used
> (even in the UEFI context) to execute pieces of code on another core
> (ACS uses this IIRC)
>
> > > >
> > > > Is below EFI_MM_MP_PROTOCOL (added in PI spec 1.6) implemented in ARM?
> > > > Or will it be implemented by an ARM module?
> > >
> > > No it is currently not implemented, and I am not aware of any plans to do so.
> >
> > +1. There is no need to do this until UEFI runs on a single core on Arm.
> >
>
> until -> as long as ??
>
> > >
> > > > I am asking this because MP_SERVICES protocol exposes CPU location information
> > > > (Package/Core/Thread) through *GetProcessorInfo*, but MM_MP protocol doesn't
> > > > have a way to expose that information.
> > > > If such location information isn't exposed by MM_MP, is that because ARM doesn't
> > > > care about the location information? Or because ARM cares but forgot to add similar
> > > > *GetProcessorInfo* interface to MM_MP when changing the PI spec?
> > > > Or ARM doesn't use the MM_MP at all?
> >
> > Even if Arm used this protocol, it can work with the logical processor number. I
> > don't see a need to expose the location information to the caller. It seems very
> > Intel specific. Is the EFI_MP_SERVICES_PROTOCOL used on Arm?
> >
>
> No, that is what started the discussion.
>
> > > >
> > >
> > > I don't know the history of this protocol and who proposed it, but
> > > today, we don't have a need for running per-CPU initialization code in
> > > the context of MM. Even if MM is a component of the more privileged
> > > firmware running on an ARM system, it is running in a sandbox that was
> > > primarily designed around exposing MM services to UEFI code running at
> > > the same privilege level as the OS (such as the authenticated variable
> > > store). Platform initialization code (which is more likely to require
> > > dispatch to each core) runs in the secure world as well, but not in
> > > the context of MM.
> > >
> > > I will let Achin chime in here as well.
> >
> > +1.
> >
> > I will let Charles comment on the history. Maybe this protocol was designed
> > for Arm systems where MM is the most privileged firmware. The upstream
> > implementation runs MM in the lowest privilege level. Either way, this protocol
> > sense only when MM on Arm is MP capable.
> >
> > cheers,
> > Achin
> >
> >
> > >
> > >
> > > > typedef struct _EFI_MM_MP_PROTOCOL {
> > > >         UINT32                           Revision,
> > > >         UINT32                           Attributes,
> > > >         EFI_MM_ GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors,
> > > >         EFI_MM_DISPATCH_PROCEDURE        DispatchProcedure,
> > > >         EFI_MM_BROADCAST_PROCEDURE       BroadcastProcedure,
> > > >         EFI_MM_SET_STARTUP_PROCEDURE     SetStartupProcedure,
> > > >         EFI_CHECK_FOR_PROCEDURE          CheckOnProcedure,
> > > >         EFI_WAIT_FOR_PROCEDURE           WaitForProcedure,
> > > > }EFI_MM_MP_PROTOCOL;
> > > > >
> > > > > > typedef struct _EFI_MP_SERVICES_PROTOCOL {
> > > > > > EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS
> > > > > GetNumberOfProcessors;
> > > > > > EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
> > > > > > EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
> > > > > > EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
> > > > > > EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
> > > > > EFI_MP_SERVICES_ENABLEDISABLEAP
> > > > > > EnableDisableAP; EFI_MP_SERVICES_WHOAMI WhoAmI; }
> > > > > > EFI_MP_SERVICES_PROTOCOL;
> > > > > >
> > > > > > Thanks,
> > > > > > Ray
> > > > > _______________________________________________
> > > > > edk2-devel mailing list
> > > > > edk2-devel@lists.01.org
> > > > > https://lists.01.org/mailman/listinfo/edk2-devel
> > IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-03-07 11:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-06  5:44 Does ARM platform produce MP protocol? Ni, Ray
2019-03-06  7:38 ` Ard Biesheuvel
2019-03-06  9:16   ` Ni, Ray
2019-03-06  9:37     ` Ard Biesheuvel
2019-03-06 12:41       ` Achin Gupta
2019-03-06 13:22         ` Ard Biesheuvel
2019-03-06 17:04           ` Andrew Fish
2019-03-07 11:16           ` Achin Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox