public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kun Qin" <kuqin12@gmail.com>
To: devel@edk2.groups.io
Cc: Leif Lindholm <quic_llindhol@quicinc.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Sami Mujawar <sami.mujawar@arm.com>
Subject: [edk2-devel] [PATCH v1 1/3] ArmPkg: ArmGic: Added support to send SGI to NS G1 EL1
Date: Mon, 24 Jul 2023 13:15:20 -0700	[thread overview]
Message-ID: <20230724201523.852-2-kuqin12@gmail.com> (raw)
In-Reply-To: <20230724201523.852-1-kuqin12@gmail.com>

From: Kun Qin <kuqin@microsoft.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4466

This change extended the functionality of ArmGic to support sending
software generated interrupts to non-secure group 1 at EL1.

The change made here follows the ARM documentation `ICC_SGI1R_EL1,
Interrupt Controller Software Generated Interrupt Group 1 Register`.

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

Signed-off-by: Kun Qin <kuqin@microsoft.com>
---
 ArmPkg/ArmPkg.ci.yaml                          |  1 +
 ArmPkg/Drivers/ArmGic/GicV3/AArch64/ArmGicV3.S | 11 +++++++++++
 ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.S     | 10 ++++++++++
 ArmPkg/Include/Library/ArmGicLib.h             |  5 +++++
 4 files changed, 27 insertions(+)

diff --git a/ArmPkg/ArmPkg.ci.yaml b/ArmPkg/ArmPkg.ci.yaml
index d31248161189..8a8f738437d5 100644
--- a/ArmPkg/ArmPkg.ci.yaml
+++ b/ArmPkg/ArmPkg.ci.yaml
@@ -158,6 +158,7 @@
           "ipriority",
           "irouter",
           "isenabler",
+          "ishst",
           "istatus",
           "itargets",
           "lable",
diff --git a/ArmPkg/Drivers/ArmGic/GicV3/AArch64/ArmGicV3.S b/ArmPkg/Drivers/ArmGic/GicV3/AArch64/ArmGicV3.S
index 20f83aa85f3b..f2ab57174be3 100644
--- a/ArmPkg/Drivers/ArmGic/GicV3/AArch64/ArmGicV3.S
+++ b/ArmPkg/Drivers/ArmGic/GicV3/AArch64/ArmGicV3.S
@@ -23,6 +23,7 @@
 #define ICC_IAR1_EL1            S3_0_C12_C12_0
 #define ICC_PMR_EL1             S3_0_C4_C6_0
 #define ICC_BPR1_EL1            S3_0_C12_C12_3
+#define ICC_SGI1R_EL1           S3_0_C12_C11_5
 
 #endif
 
@@ -55,6 +56,16 @@ ASM_FUNC(ArmGicV3SetControlSystemRegisterEnable)
 4:  isb
         ret
 
+// VOID
+// ArmGicV3SendNsG1Sgi (
+//  IN UINT64          SgiVal
+//  );
+ASM_FUNC(ArmGicV3SendNsG1Sgi)
+        dsb     ishst
+        msr     ICC_SGI1R_EL1, x0
+        isb
+        ret
+
 //VOID
 //ArmGicV3EnableInterruptInterface (
 //  VOID
diff --git a/ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.S b/ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.S
index 8c43a613dc57..79e57e4afb70 100644
--- a/ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.S
+++ b/ArmPkg/Drivers/ArmGic/GicV3/Arm/ArmGicV3.S
@@ -29,6 +29,16 @@ ASM_FUNC(ArmGicV3SetControlSystemRegisterEnable)
         isb
         bx      lr
 
+// VOID
+// ArmGicV3SendNsG1Sgi (
+//  IN UINT64          SgiVal
+//  );
+ASM_FUNC(ArmGicV3SendNsG1Sgi)
+        dsb     ishst
+        mcrr    p15, 0, r0, r1, c12 // ICC_SGI1R_EL1
+        isb
+        bx      lr
+
 //VOID
 //ArmGicV3EnableInterruptInterface (
 //  VOID
diff --git a/ArmPkg/Include/Library/ArmGicLib.h b/ArmPkg/Include/Library/ArmGicLib.h
index 93ce8aeb1994..773b27954522 100644
--- a/ArmPkg/Include/Library/ArmGicLib.h
+++ b/ArmPkg/Include/Library/ArmGicLib.h
@@ -332,4 +332,9 @@ ArmGicV3SetPriorityMask (
   IN UINTN  Priority
   );
 
+VOID
+ArmGicV3SendNsG1Sgi (
+  IN UINT64  SgiVal
+  );
+
 #endif // ARMGIC_H_
-- 
2.41.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107188): https://edk2.groups.io/g/devel/message/107188
Mute This Topic: https://groups.io/mt/100337222/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-07-24 20:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24 20:15 [edk2-devel] [PATCH v1 0/3] Add support for handling SGI and pending interrupts Kun Qin
2023-07-24 20:15 ` Kun Qin [this message]
2023-07-24 20:15 ` [edk2-devel] [PATCH v1 2/3] ArmPkg: ArmGicLib: Added GIC v3 and v4 support to ArmGicSendSgiTo Kun Qin
2023-07-24 20:15 ` [edk2-devel] [PATCH v1 3/3] ArmPkg: ArmGic: Added functionalities to manipulate pending interrupts Kun Qin
2023-07-26  8:45 ` [edk2-devel] [PATCH v1 0/3] Add support for handling SGI and " Ard Biesheuvel
2023-07-26 18:45   ` Kun Qin
2023-08-03 15:33     ` Ard Biesheuvel
2023-08-03 17:02       ` Leif Lindholm
2023-08-03 18:15         ` Kun Qin

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=20230724201523.852-2-kuqin12@gmail.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