[edk2-devel] [PATCH v1 0/3] Add support for handling SGI and pending interrupts

Kun Qin posted 3 patches 9 months, 1 week ago
Failed in applying to current master (apply log)
ArmPkg/Drivers/ArmGic/ArmGicLib.c              | 214 +++++++++++++++++++-
ArmPkg/ArmPkg.ci.yaml                          |   3 +
ArmPkg/Drivers/ArmGic/GicV3/AArch64/ArmGicV3.S |  11 +
ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.S     |  10 +
ArmPkg/Include/Library/ArmGicLib.h             |  76 +++++++
5 files changed, 308 insertions(+), 6 deletions(-)
[edk2-devel] [PATCH v1 0/3] Add support for handling SGI and pending interrupts
Posted by Kun Qin 9 months, 1 week ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4466

This patch series introduce a few improvements related to interrupt
handling for ArmGic driver and library.

1. The current implementation of the `ArmGicSendSgiTo` is based on GIC v2
and does not work on GIC v3 and on.
2. The pending interrupt related primitives does not exist for end users.

The change added the SGI support compatible with GIC v3 and v4. A few
pending interrupt related utility functions were also added.

This change was tested on QEMU, FVP and proprietary hardware platforms.

Pathc v1 branch: https://github.com/kuqin12/edk2/tree/improve_gic_v1

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>

Kun Qin (3):
  ArmPkg: ArmGic: Added support to send SGI to NS G1 EL1
  ArmPkg: ArmGicLib: Added GIC v3 and v4 support to ArmGicSendSgiTo
  ArmPkg: ArmGic: Added functionalities to manipulate pending interrupts

 ArmPkg/Drivers/ArmGic/ArmGicLib.c              | 214 +++++++++++++++++++-
 ArmPkg/ArmPkg.ci.yaml                          |   3 +
 ArmPkg/Drivers/ArmGic/GicV3/AArch64/ArmGicV3.S |  11 +
 ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.S     |  10 +
 ArmPkg/Include/Library/ArmGicLib.h             |  76 +++++++
 5 files changed, 308 insertions(+), 6 deletions(-)

-- 
2.41.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107187): https://edk2.groups.io/g/devel/message/107187
Mute This Topic: https://groups.io/mt/100337221/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v1 0/3] Add support for handling SGI and pending interrupts
Posted by Ard Biesheuvel 9 months, 1 week ago
On Mon, 24 Jul 2023 at 22:15, Kun Qin <kuqin12@gmail.com> wrote:
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4466
>
> This patch series introduce a few improvements related to interrupt
> handling for ArmGic driver and library.
>
> 1. The current implementation of the `ArmGicSendSgiTo` is based on GIC v2
> and does not work on GIC v3 and on.
> 2. The pending interrupt related primitives does not exist for end users.
>
> The change added the SGI support compatible with GIC v3 and v4. A few
> pending interrupt related utility functions were also added.
>
> This change was tested on QEMU, FVP and proprietary hardware platforms.
>
> Pathc v1 branch: https://github.com/kuqin12/edk2/tree/improve_gic_v1
>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
>
> Kun Qin (3):
>   ArmPkg: ArmGic: Added support to send SGI to NS G1 EL1
>   ArmPkg: ArmGicLib: Added GIC v3 and v4 support to ArmGicSendSgiTo
>   ArmPkg: ArmGic: Added functionalities to manipulate pending interrupts
>

Hello Kun,

Could you please explain how this will be used by platforms?

SGIs are only used by the MPcore SEC code, which is deprecated and
shouldn't be used. And manipulating pending interrupts is another
thing we should only support if there is a compelling use case.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107266): https://edk2.groups.io/g/devel/message/107266
Mute This Topic: https://groups.io/mt/100337221/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v1 0/3] Add support for handling SGI and pending interrupts
Posted by Kun Qin 9 months, 1 week ago
Hi Ard,

Our current use case is around AP core suspension and wake-ups.

The program can suspend the secondary cores through PSCI interfaces 
(after powering
them on). BSP can then wake up the suspended cores through SGI on demand.

The pending interrupt manipulation is to support BSP suspension and 
wakeup. We
currently use watchdog timer to wake up suspended BSPs after a timeout.

Platforms can perform needed tasks during suspension, such as core power 
consumption
analysis, in UEFI environment.

Please let me if you have any suggestions.

Thanks,
Kun

On 7/26/2023 1:45 AM, Ard Biesheuvel wrote:
> On Mon, 24 Jul 2023 at 22:15, Kun Qin <kuqin12@gmail.com> wrote:
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4466
>>
>> This patch series introduce a few improvements related to interrupt
>> handling for ArmGic driver and library.
>>
>> 1. The current implementation of the `ArmGicSendSgiTo` is based on GIC v2
>> and does not work on GIC v3 and on.
>> 2. The pending interrupt related primitives does not exist for end users.
>>
>> The change added the SGI support compatible with GIC v3 and v4. A few
>> pending interrupt related utility functions were also added.
>>
>> This change was tested on QEMU, FVP and proprietary hardware platforms.
>>
>> Pathc v1 branch: https://github.com/kuqin12/edk2/tree/improve_gic_v1
>>
>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>>
>> Kun Qin (3):
>>    ArmPkg: ArmGic: Added support to send SGI to NS G1 EL1
>>    ArmPkg: ArmGicLib: Added GIC v3 and v4 support to ArmGicSendSgiTo
>>    ArmPkg: ArmGic: Added functionalities to manipulate pending interrupts
>>
> Hello Kun,
>
> Could you please explain how this will be used by platforms?
>
> SGIs are only used by the MPcore SEC code, which is deprecated and
> shouldn't be used. And manipulating pending interrupts is another
> thing we should only support if there is a compelling use case.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107276): https://edk2.groups.io/g/devel/message/107276
Mute This Topic: https://groups.io/mt/100337221/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v1 0/3] Add support for handling SGI and pending interrupts
Posted by Ard Biesheuvel 9 months ago
On Wed, 26 Jul 2023 at 20:45, Kun Qin <kuqin12@gmail.com> wrote:
>
> Hi Ard,
>
> Our current use case is around AP core suspension and wake-ups.
>
> The program can suspend the secondary cores through PSCI interfaces
> (after powering
> them on). BSP can then wake up the suspended cores through SGI on demand.
>

The use of PSCI is already dubious in the context of UEFI - combining
it with the use of SGIs for communication between cores seems like a
slippery slope I don't think we should be going down.

> The pending interrupt manipulation is to support BSP suspension and
> wakeup. We
> currently use watchdog timer to wake up suspended BSPs after a timeout.
>

suspended APs right?

> Platforms can perform needed tasks during suspension, such as core power
> consumption
> analysis, in UEFI environment.
>
> Please let me if you have any suggestions.
>

Is there any basis in the UEFI or PI specifications for this functionality?


> On 7/26/2023 1:45 AM, Ard Biesheuvel wrote:
> > On Mon, 24 Jul 2023 at 22:15, Kun Qin <kuqin12@gmail.com> wrote:
> >> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4466
> >>
> >> This patch series introduce a few improvements related to interrupt
> >> handling for ArmGic driver and library.
> >>
> >> 1. The current implementation of the `ArmGicSendSgiTo` is based on GIC v2
> >> and does not work on GIC v3 and on.
> >> 2. The pending interrupt related primitives does not exist for end users.
> >>
> >> The change added the SGI support compatible with GIC v3 and v4. A few
> >> pending interrupt related utility functions were also added.
> >>
> >> This change was tested on QEMU, FVP and proprietary hardware platforms.
> >>
> >> Pathc v1 branch: https://github.com/kuqin12/edk2/tree/improve_gic_v1
> >>
> >> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> >> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> >> Cc: Sami Mujawar <sami.mujawar@arm.com>
> >>
> >> Kun Qin (3):
> >>    ArmPkg: ArmGic: Added support to send SGI to NS G1 EL1
> >>    ArmPkg: ArmGicLib: Added GIC v3 and v4 support to ArmGicSendSgiTo
> >>    ArmPkg: ArmGic: Added functionalities to manipulate pending interrupts
> >>
> > Hello Kun,
> >
> > Could you please explain how this will be used by platforms?
> >
> > SGIs are only used by the MPcore SEC code, which is deprecated and
> > shouldn't be used. And manipulating pending interrupts is another
> > thing we should only support if there is a compelling use case.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107552): https://edk2.groups.io/g/devel/message/107552
Mute This Topic: https://groups.io/mt/100337221/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v1 0/3] Add support for handling SGI and pending interrupts
Posted by Leif Lindholm 9 months ago
On 2023-08-03 16:33, Ard Biesheuvel wrote:
> On Wed, 26 Jul 2023 at 20:45, Kun Qin <kuqin12@gmail.com> wrote:
>>
>> Hi Ard,
>>
>> Our current use case is around AP core suspension and wake-ups.
>>
>> The program can suspend the secondary cores through PSCI interfaces
>> (after powering
>> them on). BSP can then wake up the suspended cores through SGI on demand.
>>
> 
> The use of PSCI is already dubious in the context of UEFI - combining
> it with the use of SGIs for communication between cores seems like a
> slippery slope I don't think we should be going down.

Well, UEFI has no concept of multiple cores, so I don't think there's 
anything fishy about using PSCI to bring up/down APs. But I agree adding 
interrupt support, not considered by either UEFI nor PI, feels off.

What is the fundamental use-case? (Pre-)silicon testing?

/
     Leif



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107554): https://edk2.groups.io/g/devel/message/107554
Mute This Topic: https://groups.io/mt/100337221/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v1 0/3] Add support for handling SGI and pending interrupts
Posted by Kun Qin 9 months ago
Hi Leif & Ard,

You are correct. The main use case is around silicon testing.

There is currently no UEFI or PI spec around such functionality though.

Manipulating pending interrupts might be a far fetch, but can we fix
"ArmGicSendSgiTo" function on GIC v3 and v4? It is declared as a public
interface provided through ArmGicLib, but the fact that it does not work
on GIC v3 and v4 without any notes seems confusing and misleading.

Please let me know if you have other suggestions.

Regards,
Kun

On 8/3/2023 10:02 AM, Leif Lindholm wrote:
> On 2023-08-03 16:33, Ard Biesheuvel wrote:
>> On Wed, 26 Jul 2023 at 20:45, Kun Qin <kuqin12@gmail.com> wrote:
>>>
>>> Hi Ard,
>>>
>>> Our current use case is around AP core suspension and wake-ups.
>>>
>>> The program can suspend the secondary cores through PSCI interfaces
>>> (after powering
>>> them on). BSP can then wake up the suspended cores through SGI on 
>>> demand.
>>>
>>
>> The use of PSCI is already dubious in the context of UEFI - combining
>> it with the use of SGIs for communication between cores seems like a
>> slippery slope I don't think we should be going down.
>
> Well, UEFI has no concept of multiple cores, so I don't think there's 
> anything fishy about using PSCI to bring up/down APs. But I agree 
> adding interrupt support, not considered by either UEFI nor PI, feels 
> off.
>
> What is the fundamental use-case? (Pre-)silicon testing?
>
> /
>     Leif
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107555): https://edk2.groups.io/g/devel/message/107555
Mute This Topic: https://groups.io/mt/100337221/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-