You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/08/26 01:22:54 UTC
[GitHub] [incubator-nuttx] gustavonihei opened a new pull request, #6924: xtensa: Fix allocation of FPU registers in exception context
gustavonihei opened a new pull request, #6924:
URL: https://github.com/apache/incubator-nuttx/pull/6924
## Summary
This PR intends to fix the allocation of FPU (and other coprocessors) registers in exception context.
## Impact
Fix `FPU Test` in `ostest` for Xtensa chips.
Solved memory corruption reported in #6914:
```sh
user_main: FPU test
Starting task FPU#1
fpu_test: Started task FPU#1 at PID=4
FPU#1: pass 1
Starting task FPU#2
fpu_test: Started task FPU#2 at PID=5
FPU#2: pass 1
FPU#1: pass 2
FPU#2: pass 2
FPU#1: pass 3
FPU#2: pass 3
FPU#1: pass 4
FPU#2: pass 4
FPU#1: pass 5
FPU#2: pass 5
FPU#1: pass 6
FPU#2: pass 6
FPU#1: pass 7
FPU#2: pass 7
FPU#1: pass 8
FPU#2: pass 8
FPU#1: pass 9
FPU#2: pass 9
FPU#1: pass 10
FPU#2: pass 10
FPU#1: pass 11
FPU#2: pass 11
FPU#1: pass 12
FPU#2: pass 12
FPU#1: pass 13
FPU#2: pass 13
FPU#1: pass 14
FPU#2: pass 14
FPU#1: pass 15
FPU#2: pass 15
FPU#1: pass 16
FPU#2: pass 16
FPU#1: Succeeded
FPU#2: Succeeded
fpu_test: Returning
```
## Testing
Successful execution of `ostest` in the following targets:
- `esp32-devkitc:nsh`
- `esp32-devkitc:smp`
- `esp32s3-devkit:nsh` (`CONFIG_XTENSA_CP_INITSET=0x001` and `CONFIG_XTENSA_CP_INITSET=0x009`)
- `esp32s3-devkit:smp` (`CONFIG_XTENSA_CP_INITSET=0x001` and `CONFIG_XTENSA_CP_INITSET=0x009`)
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #6924: xtensa: Fix allocation of FPU registers in exception context
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #6924:
URL: https://github.com/apache/incubator-nuttx/pull/6924
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6924: xtensa: Fix allocation of FPU registers in exception context
Posted by GitBox <gi...@apache.org>.
gustavonihei commented on code in PR #6924:
URL: https://github.com/apache/incubator-nuttx/pull/6924#discussion_r955572525
##########
arch/xtensa/src/common/xtensa_fpucmp.c:
##########
@@ -59,8 +72,23 @@ bool up_fpucmp(const void *saveregs1, const void *saveregs2)
{
const uint32_t *regs1 = saveregs1;
const uint32_t *regs2 = saveregs2;
+ uint32_t cpenable = xtensa_get_cpenable();
+ int ndx = 0;
+ bool ret = true;
+ int i;
+
+ while (ret && (i = __builtin_ffs(cpenable)))
Review Comment:
Fixed!
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] gustavonihei commented on pull request #6924: xtensa: Fix allocation of FPU registers in exception context
Posted by GitBox <gi...@apache.org>.
gustavonihei commented on PR #6924:
URL: https://github.com/apache/incubator-nuttx/pull/6924#issuecomment-1227912988
@no1wudi Please, take a look these patches.
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6924: xtensa: Fix allocation of FPU registers in exception context
Posted by GitBox <gi...@apache.org>.
gustavonihei commented on code in PR #6924:
URL: https://github.com/apache/incubator-nuttx/pull/6924#discussion_r955572437
##########
arch/xtensa/src/common/xtensa_fpucmp.c:
##########
@@ -30,11 +30,23 @@
#include "xtensa.h"
+#ifdef CONFIG_ARCH_FPU
+
/****************************************************************************
- * Pre-processor Definitions
+ * Private Data
****************************************************************************/
-#ifdef CONFIG_ARCH_FPU
+static uint32_t coproc_sa_offsets[] =
Review Comment:
Done.
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6924: xtensa: Fix allocation of FPU registers in exception context
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6924:
URL: https://github.com/apache/incubator-nuttx/pull/6924#discussion_r955566236
##########
arch/xtensa/src/common/xtensa_fpucmp.c:
##########
@@ -59,8 +72,23 @@ bool up_fpucmp(const void *saveregs1, const void *saveregs2)
{
const uint32_t *regs1 = saveregs1;
const uint32_t *regs2 = saveregs2;
+ uint32_t cpenable = xtensa_get_cpenable();
+ int ndx = 0;
+ bool ret = true;
+ int i;
+
+ while (ret && (i = __builtin_ffs(cpenable)))
Review Comment:
call ffs instead?
##########
arch/xtensa/src/common/xtensa_fpucmp.c:
##########
@@ -30,11 +30,23 @@
#include "xtensa.h"
+#ifdef CONFIG_ARCH_FPU
+
/****************************************************************************
- * Pre-processor Definitions
+ * Private Data
****************************************************************************/
-#ifdef CONFIG_ARCH_FPU
+static uint32_t coproc_sa_offsets[] =
Review Comment:
add g_ prefix
##########
arch/xtensa/src/common/xtensa_fpucmp.c:
##########
@@ -30,11 +30,23 @@
#include "xtensa.h"
+#ifdef CONFIG_ARCH_FPU
+
/****************************************************************************
- * Pre-processor Definitions
+ * Private Data
****************************************************************************/
-#ifdef CONFIG_ARCH_FPU
+static uint32_t coproc_sa_offsets[] =
+{
+ XTENSA_CP0_SA, XTENSA_CP1_SA, XTENSA_CP2_SA, XTENSA_CP3_SA,
+ XTENSA_CP4_SA, XTENSA_CP5_SA, XTENSA_CP6_SA, XTENSA_CP7_SA
+};
+
+static uint32_t coproc_sa_sizes[] =
Review Comment:
ditto
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org