This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new f7abf7446f arch/arm64: Optimized SGI to avoid VM exit.
f7abf7446f is described below

commit f7abf7446f342bcccb133577b181c69321106bf0
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Thu Nov 7 19:55:41 2024 +0800

    arch/arm64: Optimized SGI to avoid VM exit.
    
    In the virtualized environment, each time an SGI is sent, the value of 
IGROUPR0 needs to be read once. Since the GIC Redistributor is a purely 
emulated device, each read of IGROUPR0 will cause a VM exit, causing serious 
performance degradation. This patch replaces the read with the value previously 
set in `gicv3_cpuif_init`, and we assume that this value has not been modified 
after initialization.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 arch/arm64/src/common/arm64_gicv3.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/src/common/arm64_gicv3.c 
b/arch/arm64/src/common/arm64_gicv3.c
index 74b2859966..3852fd1c06 100644
--- a/arch/arm64/src/common/arm64_gicv3.c
+++ b/arch/arm64/src/common/arm64_gicv3.c
@@ -378,9 +378,7 @@ static int arm64_gic_send_sgi(unsigned int sgi_id, uint64_t 
target_aff,
   uint32_t aff1;
   uint64_t sgi_val;
   uint32_t regval;
-  unsigned long base;
 
-  base = gic_get_rdist() + GICR_SGI_BASE_OFF;
   ASSERT(GIC_IS_SGI(sgi_id));
 
   /* Extract affinity fields from target */
@@ -394,7 +392,9 @@ static int arm64_gic_send_sgi(unsigned int sgi_id, uint64_t 
target_aff,
 
   ARM64_DSB();
 
-  regval = getreg32(IGROUPR(base, 0));
+  /* Read the IGROUPR0 value we set in `gicv3_cpuif_init` */
+
+  regval = IGROUPR_SGI_VAL;
 
   if (regval & BIT(sgi_id))
     {

Reply via email to