-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Cortex-R Floating Point Support #44753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok in general.
Just a few comments.
@@ -21,21 +21,21 @@ tests: | |||
tags: fpu kernel | |||
timeout: 600 | |||
kernel.fpu_sharing.generic.riscv32: | |||
extra_args: PI_NUM_ITERATIONS=500 | |||
extra_args: PI_NUM_ITERATIONS=500 DISABLE_INT_TEST=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the rationale behind disabling the timer testcase for these platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those particular platforms fail the test. Unfortunately, I don't enough about these platforms to fix them myself. I updated the commit message to note this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make 48b8439a0d4123d8abf83d08e170dbcc798e68cd a separate PR? This needs a more thorough review from the maintainers of all these platforms.
p.s. it also fails on ARC when testing with nSIM. succeeds with PI_NUM_ITERATIONS=500
.
p.s. 2. riscv32 and riscv64 succeed also with PI_NUM_ITERATIONS=500
... anyways, let's review this in a separate PR so as to not block this.
ff42d22
to
20c0bbf
Compare
Just wonder, these are only for v7r vfp, right? |
@julien-massot @povergoing FYI, this needs to be extended to |
Perhaps during the 3.2 cycle? |
@@ -21,21 +21,21 @@ tests: | |||
tags: fpu kernel | |||
timeout: 600 | |||
kernel.fpu_sharing.generic.riscv32: | |||
extra_args: PI_NUM_ITERATIONS=500 | |||
extra_args: PI_NUM_ITERATIONS=500 DISABLE_INT_TEST=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make 48b8439a0d4123d8abf83d08e170dbcc798e68cd a separate PR? This needs a more thorough review from the maintainers of all these platforms.
p.s. it also fails on ARC when testing with nSIM. succeeds with PI_NUM_ITERATIONS=500
.
p.s. 2. riscv32 and riscv64 succeed also with PI_NUM_ITERATIONS=500
... anyways, let's review this in a separate PR so as to not block this.
Reuse the Cortex-M paths for testing the floating point unit. Signed-off-by: Bradley Bolen <[email protected]>
For testing, assume that the Cortex-A/R platforms are using a GIC interrupt controller. Use the last GIC SGI to trigger an interrupt for the test. Signed-off-by: Bradley Bolen <[email protected]>
This commit adds the unified floating-point configuration symbols for the ARM architectures. These configuration symbols allow specification of the floating-point coprocessors, such as VFP (also known as FP for Cortex-M) and NEON, for the ARM architectures. Signed-off-by: Stephanos Ioannidis <[email protected]>
This commit updates the Zephyr build system to support specifying advanced floating-point compilation options derived from the newly introduced unified floating-point configurations. The following changes are introduced by this commit: 1. Specify architecture floating-point option to the `-mcpu` flag. 2. Specify floating-point unit (FPU) type using the `-mfpu` flag. Note that the `-march` flag is not specified separately because the `-mcpu` flag provides more detailed architecture options and this makes the `-march` flag redundant. Signed-off-by: Stephanos Ioannidis <[email protected]>
When Dual-redundant Core Lock-step (DCLS) topology is used, the VFP registers across the two redundant cores must be manually initialised and synchronised, and this requires the `-mfloat-abi=hard` option to be specified. This commit forces the use of FP "hard" ABI on the VFP-equipped cores that are configured in DCLS topology. Signed-off-by: Stephanos Ioannidis <[email protected]>
Cortex-A/R use a descending stack frame and the hardware does not help with the stacking. This led to some less than desirable workarounds in the exception code where the basic stack frame was saved twice. Rearranging the order of the exception stack frame removes that problem and provides a clearer path to saving CPU context in a fully descending manner. Signed-off-by: Bradley Bolen <[email protected]>
Grouping the FPU registers together will make adding FPU support for Cortex-A/R easier later. It provides the ability to get the sizeof and offsetof FPU registers easier. Signed-off-by: Bradley Bolen <[email protected]>
This will enable the VFP unit on boot to handle the case where FPU_SHARING is not enabled. Signed-off-by: Bradley Bolen <[email protected]>
This commit updates the Cortex-R reset routine to initialise (synchronise) the VFP D16-D31 registers when Dual-redundant Core Lock-step (DCLS) is enabled. Signed-off-by: Stephanos Ioannidis <[email protected]>
This adds lazy floating point context switching. On svc/irq entrance, the VFP is disabled and a pointer to the exception stack frame is saved away. If the esf pointer is still valid on exception exit, then no other context used the VFP so the context is still valid and nothing needs to be restored. If the esf pointer is NULL on exception exit, then some other context used the VFP and the floating point context is restored from the esf. The undefined instruction handler is responsible for saving away the floating point context if needed. If the handler is in the first irq/svc context and the current thread uses the VFP, then the float context needs to be saved. Also, if the handler is in a nested context and the previous context was using the FVP, save the float context. Signed-off-by: Bradley Bolen <[email protected]>
This SoC supports vfpv3-d16 with single and double precision and 16 64-bit registers. Signed-off-by: Bradley Bolen <[email protected]>
@stephanosio I created #45286 to review the new interleaved FPU test separately and fixed up the additional issues you pointed out. Thanks. |
Approved too soon, there are some compliance check issues, but should be easy to address. |
This warning can be ignored since typedef usage here is justified.
|
Yes, agreed. @SgrrZhf May take a look |
This PR adds support for the Cortex-R VFP unit. It can also be used to enable floating point support for Cortex-A, though that is untested. A couple of the basic ideas behind this PR:
I pulled (and heavily modified) a couple of patches @stephanosio pointed me to a long time ago. Let me know if you want me to change the author so that git blame won't implicate you if something goes wrong.
Closes #19979