Skip to content

Commit

Permalink
arch/arm64: Optimized SGI to avoid VM exit.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Fix-Point authored and xiaoxiang781216 committed Jan 10, 2025
1 parent 5212144 commit aaea4e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/arm64/src/common/arm64_gicv3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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))
{
Expand Down

0 comments on commit aaea4e0

Please sign in to comment.