My hareware environment:
1. a ARMv8 processor , which runs in 64bit EL3 and 32bit EL2&EL1.
2. a GICv3 interrupt controller
Running in 32bit hyp mode, I try to send a SGI interrupt from core0 to core1, but core1 cannot receive this interrupt. Below are what I've tried.
1. I use ICC_SGI1R to send the interrupt. GICD_SGIR cannot be used because "affinity routing" is enabled.
2. Group0, Group1NS and Group1S interrupt are enabled in GICD_CTLR
3. Write GICR_ISENABLER0 to enable SGI interrupt
4. The IRQ/FIQ are unmasked in core1's cpsr5. Group1 intersuprt is enabled in core1's ICC_IGRPEN1 register
But after writting to ICC_SGI1R, I can not find valid bit in pending state register, and core1's ICC_IAR register are also always invalid.
Do you have any suggestions with this issue?
Thanks in advance.
A couple of thoughts...
Hi Martin,
Thanks so much for your reply!
You said that you'd written GICR_ISENABLER0 to enable the SGI you're sending. Which core's Redistributor did you write to? It needs to have been that of receiving core (or both of course)
- Both core0 & core1 are written
Did you also write GICR_IGROUPR0 to set the interrupt as NS.G1? (Note, you'll need to do this in Secure state)
- No, I didn't, because the core is running in 32 bit hyp mode. But, even so, if everyghing is ok, core 1 will receive a SGI either in group0 or group1, actually core1 see nothing.
Have you written GICR_WAKER to make the cores as awake? (You'll need to do this for sender and receiver)
-Sure, this is done
What's the priority of the SGI (GICR_IPRORITYRn, of the receiver) and what's the PMR value
- PMR is 0xff
Does GICR_ISPENDR0 (of the receiver's Redistributor) show the interrupt as pending after the write to ICC_SGI1R?
- It's always 0
Strictly, you'll need a DSB between the write of the ICC_SGI1R and the read of the GICR_ISPENDR0
- Sure, DSB is used.
moonlight wrote:Did you also write GICR_IGROUPR0 to set the interrupt as NS.G1? (Note, you'll need to do this in Secure state)- No, I didn't, because the core is running in 32 bit hyp mode. But, even so, if everyghing is ok, core 1 will receive a SGI either in group0 or group1, actually core1 see nothing.
moonlight wrote:
The sender indicates the Group (G0, S.G1, NS.G1) of interrupt it wants to send by which SGI register it writes. The Group the sender specified has to match how the receiver(s) have configured that interrupt in their GICR_IGROUPR0/GICR_IGRPMODR0 registers. If they don't, no interrupt is generated.
Take a look at Table 11 in the GICv3 app note for a fuller explanation:
GICv3 Software Overview
Pretty much.
When GICD_CTLR.DS==0, only secure software can access GICR_IGROUPR0 (or GICD_IGROUPRn). So you would need to program Secure software to program these registers, typically before entering Non-secure state for the first time.
In my environment, GICD_CTLR.DS is 0.
The value of GICR_IGROUPR0 is always 0 and I cannot reconfigure it. I think this is because cores are in non-secure state, So does this mean the receiver core will always treat this as a group0 SGI? And according to the document you mention(table 11), a group0 SGI won't be forwarded if the GICR_NSACR is not set correctly in secure state.
So, with the current configuration in non-secure state, I cannot send a SGI from one core to another, is this correct?
Got it. Thank you so much.
Hi Martin
I set GICD_CTLR as 0x47 in secure state. I.e, DS is 1.
Now in my 32bit hyp mode, the value of GICR_ISENABLER0 is 0x300, GICR_IGROUPR0 is 0xffff, GICR_IGRPMODR0 is 0. But I still cannot send out a #8 SGI using icc_sgi1r or GICD_SGIR.
The other SPI interrupt, say timer, works fine in the system.
Do you have any other ideas about this issue?
Thanks.
Couple of questions.
Are you doing this write from Secure state? If so, I would suggest just writing GICR_IGROUPR0 and not setting DS==1. If not, you can't set the DS bit from Non-secure state.
Also, you don't appear to be setting the ARE bits. The ARE bits select between the GICv3 and legacy mode. If you're setting the SRE bits, then the ARE bits should also be set.
EDIT: For reference, attached is a simple assembler program I wrote once to test something. It's a very minimal GICv3 set up sequence, targeting the Base Platform model.
Hi, Can you attach that sample code. I didnt find it so.
Hi, Can you attach that sample code. I have the same issue.