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

   # arch/arm: consolidate common ARM A/R implementations
   
   ## Summary
   
   Consolidate common ARM A/R implementations used by ARMv7-A, ARMv7-R, and
   ARMv8-R under `arch/arm/src/arm_a_r`. This series removes duplicated GIC,
   performance-monitoring, generic-timer, and MPCore definitions while keeping
   the architecture-specific build integration and behavior intact.
   
   ## Changes
   
   - Unify the GICv2 Kconfig symbol for ARMv7-A and ARMv7-R.
   - Unify the PTM Kconfig symbol for ARMv7-A and ARMv7-R.
   - Unify the GICv2M Kconfig symbol across the ARM architectures.
   - Consolidate `arm_perf.c` into `arch/arm/src/arm_a_r`.
   - Consolidate `arm_gicv2_dump.c` into `arch/arm/src/arm_a_r`.
   - Consolidate the generic ARM timer implementation and common timer header
     into `arch/arm/src/arm_a_r`.
   - Consolidate `gic.h` and `mpcore.h` into the shared ARM A/R directory.
   - Update the ARMv7-A, ARMv7-R, ARMv8-R, FVP, QEMU, Goldfish, and i.MX6
     Kconfig and Make/CMake source selections accordingly.
   - Remove the redundant ARMv7-A GICv2 dump Kconfig option.
   - Preserve the FVP v8-R specific timer implementation while removing the
     duplicated generic timer sources.
   
   ## Rationale
   
   ARMv7-A, ARMv7-R, and ARMv8-R contained several copies of functionality that
   is common to ARM A/R processors. The duplicated implementations increased
   maintenance cost and made it possible for the Make and CMake source lists or
   Kconfig symbols to diverge. Moving the common code into `arm_a_r` establishes
   a single source of truth without intentionally changing the public interfaces
   or runtime behavior.
   
   ## Scope
   
   This change is limited to source ownership, Kconfig symbol consolidation, and
   Make/CMake integration. It does not intentionally change GIC operation,
   performance-monitoring support, generic-timer behavior, MPCore definitions,
   or the FVP-specific timer path.
   
   ## Commits
   
   ```text
   6d7b7629c35 arch/arm: unify GICv2M Kconfig symbol across ARM architectures
   2e768eeb090 arch/arm: unify PTM Kconfig symbol for ARMv7-A and ARMv7-R
   198dd61a8b6 arch/arm: consolidate arm_perf.c into arm_a_r common directory
   71f6046f8f0 arch/arm: unify GICv2 Kconfig symbol for ARMv7-A and ARMv7-R
   772e44a22e4 arch/arm/armv7-a: remove redundant ARMV7A_GICv2_DUMP Kconfig 
option
   84b19e36661 arch/arm: consolidate arm_gicv2_dump.c into arm_a_r
   f50d449ec31 arch/arm: consolidate gic.h into arm_a_r common directory
   b3fe84d786b arch/arm: consolidate ARM generic timer to arm_a_r
   c82a8d2087a arch/arm: move mpcore.h to shared arm_a_r directory
   ```
   
   ## Testing
   
   ### QEMU ARMv7-A OSTest
   
   The consolidated tree was booted with the ARMv7-A QEMU virt machine and the
   NuttX `ostest` application was executed:
   
   ```text
   $ qemu-system-arm -cpu cortex-a7 -semihosting -M virt -m 1024 \
       -nographic -kernel ./nuttx
   nsh> ostest
   ```
   
   The supplied runtime log reports successful completion of the test suite:
   
   ```text
   fpu_test: Succeeded
   fpu_test: Returning
   
   waitpid_test: PASS: PID 28 waitpid failed with ECHILD.  That may be
                 acceptable because child status is disabled on this thread.
   
   wqueue_test: teardown done
   
   mutex_test: PASSED
   timedmutex regression test: PASSED
   
   cancel_test: PASS thread terminated with PTHREAD_CANCELED
   
   robust_test: Test complete with nerrors=0
   
   semtimed_test: PASS: first test returned timeout
   semtimed_test: PASS: sem_timedwait succeeded
   
   pthread_sigqueue_test: SUCCESS
   
   receiver_thread: returning nerrors=0
   timedmqueue_test: Test complete
   
   sigprocmask_test: SUCCESS
   pwait_test: PASS
   
   signest_test: done
   
   timer_test: done
   
   spinlock_test: end......
   
   wdog_test end...
   
   rr_test: Done
   
   barrier_test: Thread 7 completed with result=0
   
   priority_inheritance: PASSED Priority were correctly restored.
   priority_inheritance: Finished
   
   sched_lock: PASSED No pre-emption occurred while scheduler was locked.
   sched_lock: Finished
   
   Final memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena      ff3ffc   ff3ffc
   ordblks         2        6
   mxordblk   fec140   fd5470
   uordblks     7d8c     7ecc
   fordblks   fec270   fec130
   user_main: Exiting
   ostest_main: Exiting with status 0
   nsh> QEMU: Terminated
   ```
   
   Result: **PASS**. `ostest_main` exited with status `0`. The log includes the
   expected skips for unsupported or incompatible tests, including asynchronous
   cancellation, cancellation of message-queue/signal waits, and the condition
   variable test when priority inheritance is enabled.
   
   ### Patch checks
   
   The patch whitespace check was run on the nine-commit range:
   
   ```text
   $ git diff --check HEAD~9..HEAD
   arch/arm/src/fvp-v8r-aarch32/fvp_timer.c:40: new blank line at EOF.
   ```
   
   Result: **FAIL**. The range currently contains one trailing blank line in
   `arch/arm/src/fvp-v8r-aarch32/fvp_timer.c`; this must be removed before
   submission.
   
   The checkpatch command below remains a recommended follow-up check because no
   checkpatch output was provided:
   
   ```text
   $ ./tools/checkpatch.sh -c -u -m -g HEAD~9..HEAD
   ```
   
   ## Change Statistics
   
   The `HEAD~9..HEAD` range changes 38 files:
   
   - 429 insertions
   - 2554 deletions
   - Net reduction of 2125 lines
   
   The reduction is primarily from removing duplicate ARMv7-R and ARMv8-R
   implementations after moving the common code into `arch/arm/src/arm_a_r`.
   
   ## Follow-up Testing
   
   - Build representative ARMv7-A, ARMv7-R, and ARMv8-R configurations with
     both Make and CMake/Ninja.
   - Verify GICv2, GICv2M, PTM, generic timer, and performance-monitoring
     configurations independently.
   - Run FVP v8-R and QEMU-specific configurations.
   - Run protected, SMP, and non-SMP variants where applicable.
   - Run the complete ARM CI build matrix and patch checks.
   


-- 
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]

  • [PR] arch/arm: consolidate co... hujun260 (via GitHub) via commits

Reply via email to