You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "crafcat7 (via GitHub)" <gi...@apache.org> on 2023/07/12 15:24:58 UTC
[GitHub] [nuttx] crafcat7 opened a new pull request, #9802: Add Get Cache Information interface
crafcat7 opened a new pull request, #9802:
URL: https://github.com/apache/nuttx/pull/9802
## Summary
In this update brings the api to get cache size, and also fixes the previous case where the default value of CSSELR for ARMv8M/v7M registers was incorrect.
## Impact
## Testing
--
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] [nuttx] crafcat7 commented on a diff in pull request #9802: Add Get Cache Information interface
Posted by "crafcat7 (via GitHub)" <gi...@apache.org>.
crafcat7 commented on code in PR #9802:
URL: https://github.com/apache/nuttx/pull/9802#discussion_r1263973549
##########
arch/arm/src/armv7-a/arm_cache.c:
##########
@@ -189,7 +162,14 @@ void up_disable_icache(void)
size_t up_get_dcache_linesize(void)
{
- return up_get_cache_linesize();
+ static uint32_t clsize;
+
+ if (clsize == 0)
+ {
+ clsize = MAX(cp15_dcache_linesize(), l2cc_linesize());
Review Comment:
Thanks for your advice. I'm going to do a check on the results after get the clsize.
--
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #9802: Add Get Cache Information interface
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #9802:
URL: https://github.com/apache/nuttx/pull/9802#discussion_r1261464744
##########
arch/arm/src/armv7-m/nvic.h:
##########
@@ -679,8 +679,8 @@
/* Cache Size Selection Register (Cortex-M7) */
#define NVIC_CSSELR_IND (1 << 0) /* Bit 0: Selects either instruction or data cache */
-# define NVIC_CSSELR_IND_ICACHE (0 << 0) /* 0=Instruction Cache */
-# define NVIC_CSSELR_IND_DCACHE (1 << 0) /* 1=Data Cache */
+# define NVIC_CSSELR_IND_ICACHE (1 << 0) /* 0=Instruction Cache */
Review Comment:
update comment too
##########
arch/arm/src/armv8-m/nvic.h:
##########
@@ -778,8 +778,8 @@
/* Cache Size Selection Register */
#define NVIC_CSSELR_IND (1 << 0) /* Bit 0: Selects either instruction or data cache */
-# define NVIC_CSSELR_IND_ICACHE (0 << 0) /* 0=Instruction Cache */
-# define NVIC_CSSELR_IND_DCACHE (1 << 0) /* 1=Data Cache */
+# define NVIC_CSSELR_IND_ICACHE (1 << 0) /* 0=Instruction Cache */
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
[GitHub] [nuttx] acassis commented on a diff in pull request #9802: Add Get Cache Information interface
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #9802:
URL: https://github.com/apache/nuttx/pull/9802#discussion_r1261431281
##########
arch/arm/src/armv7-a/arm_cache.c:
##########
@@ -189,7 +162,14 @@ void up_disable_icache(void)
size_t up_get_dcache_linesize(void)
{
- return up_get_cache_linesize();
+ static uint32_t clsize;
+
+ if (clsize == 0)
+ {
+ clsize = MAX(cp15_dcache_linesize(), l2cc_linesize());
Review Comment:
Should we include some DEBUG_ASSERTION in case of the clsize is invalid (i.e. 0 or some value too big that doesn't make sense) ?
--
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] [nuttx] acassis commented on a diff in pull request #9802: Add Get Cache Information interface
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #9802:
URL: https://github.com/apache/nuttx/pull/9802#discussion_r1261431281
##########
arch/arm/src/armv7-a/arm_cache.c:
##########
@@ -189,7 +162,14 @@ void up_disable_icache(void)
size_t up_get_dcache_linesize(void)
{
- return up_get_cache_linesize();
+ static uint32_t clsize;
+
+ if (clsize == 0)
+ {
+ clsize = MAX(cp15_dcache_linesize(), l2cc_linesize());
Review Comment:
Should we include some DEBUG_ASSERTION in case of the clsize is invalid (i.e. 0 or some value too big that doesn't make sense?)
--
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] [nuttx] xiaoxiang781216 merged pull request #9802: Add Get Cache Information interface
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #9802:
URL: https://github.com/apache/nuttx/pull/9802
--
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] [nuttx] acassis commented on a diff in pull request #9802: Add Get Cache Information interface
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #9802:
URL: https://github.com/apache/nuttx/pull/9802#discussion_r1261431281
##########
arch/arm/src/armv7-a/arm_cache.c:
##########
@@ -189,7 +162,14 @@ void up_disable_icache(void)
size_t up_get_dcache_linesize(void)
{
- return up_get_cache_linesize();
+ static uint32_t clsize;
+
+ if (clsize == 0)
+ {
+ clsize = MAX(cp15_dcache_linesize(), l2cc_linesize());
Review Comment:
Should we include some DEBUG_ASSERTION in fact the clsize is invalid (i.e. 0 or some value too big that doesn't make sense?)
##########
arch/arm/src/armv7-a/cp15_cacheops.c:
##########
@@ -44,9 +44,19 @@ static inline uint32_t ilog2(uint32_t u)
return i;
}
-static inline uint32_t cp15_cache_get_info(uint32_t *sets, uint32_t *ways)
+static inline uint32_t cp15_cache_get_info(uint32_t *sets, uint32_t *ways,
+ bool icache)
{
- uint32_t ccsidr = CP15_GET(CCSIDR);
+ uint32_t ccsidr;
+ uint32_t csselr;
+
+ csselr = CP15_GET(CSSELR);
+
+ csselr = (csselr & ~0x01) | (icache & 0x01);
Review Comment:
Instead of hard-coding 0x01 please use NVIC_CSSELR_IND (strange, it's only defined to armv7-m, but it should to armv7-a as well, PTAL)
##########
arch/arm/src/armv7-r/cp15_cacheops.c:
##########
@@ -44,9 +44,19 @@ static inline uint32_t ilog2(uint32_t u)
return i;
}
-static inline uint32_t cp15_cache_get_info(uint32_t *sets, uint32_t *ways)
+static inline uint32_t cp15_cache_get_info(uint32_t *sets, uint32_t *ways,
+ bool icache)
{
- uint32_t ccsidr = CP15_GET(CCSIDR);
+ uint32_t ccsidr;
+ uint32_t csselr;
+
+ csselr = CP15_GET(CSSELR);
+
+ csselr = (csselr & ~0x01) | (icache & 0x01);
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
[GitHub] [nuttx] crafcat7 commented on a diff in pull request #9802: Add Get Cache Information interface
Posted by "crafcat7 (via GitHub)" <gi...@apache.org>.
crafcat7 commented on code in PR #9802:
URL: https://github.com/apache/nuttx/pull/9802#discussion_r1263973549
##########
arch/arm/src/armv7-a/arm_cache.c:
##########
@@ -189,7 +162,14 @@ void up_disable_icache(void)
size_t up_get_dcache_linesize(void)
{
- return up_get_cache_linesize();
+ static uint32_t clsize;
+
+ if (clsize == 0)
+ {
+ clsize = MAX(cp15_dcache_linesize(), l2cc_linesize());
Review Comment:
LGTM! I'm going to do a check on the results after get the clsize.
##########
arch/arm/src/armv7-a/cp15_cacheops.c:
##########
@@ -44,9 +44,19 @@ static inline uint32_t ilog2(uint32_t u)
return i;
}
-static inline uint32_t cp15_cache_get_info(uint32_t *sets, uint32_t *ways)
+static inline uint32_t cp15_cache_get_info(uint32_t *sets, uint32_t *ways,
+ bool icache)
{
- uint32_t ccsidr = CP15_GET(CCSIDR);
+ uint32_t ccsidr;
+ uint32_t csselr;
+
+ csselr = CP15_GET(CSSELR);
+
+ csselr = (csselr & ~0x01) | (icache & 0x01);
Review Comment:
Done
##########
arch/arm/src/armv7-r/cp15_cacheops.c:
##########
@@ -44,9 +44,19 @@ static inline uint32_t ilog2(uint32_t u)
return i;
}
-static inline uint32_t cp15_cache_get_info(uint32_t *sets, uint32_t *ways)
+static inline uint32_t cp15_cache_get_info(uint32_t *sets, uint32_t *ways,
+ bool icache)
{
- uint32_t ccsidr = CP15_GET(CCSIDR);
+ uint32_t ccsidr;
+ uint32_t csselr;
+
+ csselr = CP15_GET(CSSELR);
+
+ csselr = (csselr & ~0x01) | (icache & 0x01);
Review Comment:
Done
##########
arch/arm/src/armv7-m/nvic.h:
##########
@@ -679,8 +679,8 @@
/* Cache Size Selection Register (Cortex-M7) */
#define NVIC_CSSELR_IND (1 << 0) /* Bit 0: Selects either instruction or data cache */
-# define NVIC_CSSELR_IND_ICACHE (0 << 0) /* 0=Instruction Cache */
-# define NVIC_CSSELR_IND_DCACHE (1 << 0) /* 1=Data Cache */
+# define NVIC_CSSELR_IND_ICACHE (1 << 0) /* 0=Instruction Cache */
Review Comment:
Done
##########
arch/arm/src/armv8-m/nvic.h:
##########
@@ -778,8 +778,8 @@
/* Cache Size Selection Register */
#define NVIC_CSSELR_IND (1 << 0) /* Bit 0: Selects either instruction or data cache */
-# define NVIC_CSSELR_IND_ICACHE (0 << 0) /* 0=Instruction Cache */
-# define NVIC_CSSELR_IND_DCACHE (1 << 0) /* 1=Data Cache */
+# define NVIC_CSSELR_IND_ICACHE (1 << 0) /* 0=Instruction Cache */
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] [nuttx] crafcat7 commented on a diff in pull request #9802: Add Get Cache Information interface
Posted by "crafcat7 (via GitHub)" <gi...@apache.org>.
crafcat7 commented on code in PR #9802:
URL: https://github.com/apache/nuttx/pull/9802#discussion_r1263973549
##########
arch/arm/src/armv7-a/arm_cache.c:
##########
@@ -189,7 +162,14 @@ void up_disable_icache(void)
size_t up_get_dcache_linesize(void)
{
- return up_get_cache_linesize();
+ static uint32_t clsize;
+
+ if (clsize == 0)
+ {
+ clsize = MAX(cp15_dcache_linesize(), l2cc_linesize());
Review Comment:
Thanks for the advice. I'm going to do a check on the results after get the clsize.
--
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