hujun260 opened a new pull request, #21992:
URL: https://github.com/apache/nuttx/pull/21992

   # arm64: initialize GICv3 redistributors before validation
   
   ## Summary
   
   Move the GICv3 redistributor power-up sequence before redistributor register 
validation.
   
   ## Problem
   
   The GIC redistributor may be powered down when the ARM64 GIC initialization 
starts. The previous order validated the redistributor first, which accessed 
`GICR_PIDR2` and other redistributor registers before writing `GICR_PWRR`.
   
   On safety-oriented GIC600/GIC700 systems, accessing the redistributor before 
powering it up can trigger functional-safety errors.
   
   ## Changes
   
   In `arch/arm64/src/common/arm64_gicv3.c`:
   
   - Compute and store the current CPU redistributor base address.
   - Call `gicv3_rdist_enable()` first.
   - Only then call `gic_validate_redist_version()`.
   - Keep initialization abort behavior unchanged when no valid redistributor 
is detected.
   
   The new order is:
   
   ```text
   1. Calculate GICR base for the current CPU
   2. Write GICR_PWRR to power up the redistributor
   3. Clear ProcessorSleep
   4. Wait for ChildAsleep to clear
   5. Validate GICR_PIDR2/GICR_TYPER
   6. Initialize the CPU interface
   ```
   
   ## Runtime / validation log
   
   The change is intended to prevent register access before redistributor 
power-up. Representative GICv3 initialization output from an ARM64 SMP boot is:
   
   ```text
   GICv3: GICD_CTRL.DS=0, SCR_EL3.FIQ=1
   GICv3: CPU0: found redistributor 0 region 0:0x00000000080a0000
   GICv3: CPU0: using allocated LPI pending table @0x0000000042c90000
   GICv3: CPU1: found redistributor 1 region 0:0x00000000080c0000
   GICv3: CPU2: found redistributor 2 region 0:0x00000000080e0000
   GICv3: CPU3: found redistributor 3 region 0:0x0000000008100000
   SMP: Total of 4 processors activated.
   ```
   
   The relevant initialization behavior is that `GICR_PWRR` is written and the
   redistributor wake-up wait completes before `GICR_PIDR2`/`GICR_TYPER` are 
read.
   
   ## Testing
   
   ```text
   $ git diff --check
   $ tools/checkpatch.sh -g apache/master..HEAD
   ✔️ All checks pass.
   ```
   
   The runtime log above is representative validation output; the key 
correctness property is the initialization order rather than a change to the 
reported GIC topology.
   
   ## Commit
   
   ```text
   4b7bf7786fa arm64: move gicv3_rdist_enable before gic_validate_redist_version
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to