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 2021/10/19 12:34:12 UTC

[GitHub] [incubator-nuttx] zhuyanlinzyl opened a new pull request #4699: arch:cache: add lock & unlock feature

zhuyanlinzyl opened a new pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699


   ## Summary
   
   1 add lock & unlock API for arch
   2 add lock & unlock feature for xtensa
   
   ## Impact
   
   No, add new interface.
   
   ## Testing
   Test pass on xtensa with cache.
   
   


-- 
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 #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#issuecomment-948844412


   > @gustavonihei I think lock_icache have two ways. One is setup transaction the line from memory now, the second is wait the memory be addressed by code, and the lock. I don't think the second is `prefetch`. What's you advice?
   
   Sorry, let me see if I correctly followed your point.
   I understand that the `IPFL` instruction from the Xtensa LX6 ISA prefetches and loads a instruction cache line. Although other ISAs may not implement a similar do-it-all mnemonic, we may still intend `lock_icache` to implement this behavior.
   Looking for some other examples, the [application notes for the Freescale/NXP e300 core](https://www.nxp.com/docs/en/application-note/AN2129.pdf) defines the prefetch of instruction and data as part of the locking procedure (see chapter 2), although not in a singular mnemonic.
   This `lock_icache` proposal may not be most generic, I think it is a good starting point, which may be adapted once other ISAs get it implemented.


-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732187553



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -439,6 +529,96 @@ void up_flush_dcache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_lock_dcache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_DCACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_DCACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_DCACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("dpfl %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("dsync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_dcache
+ *
+ * Description:
+ *   Unlock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_unlock_dcache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_DCACHE_SIZE */

Review comment:
       ```suggestion
     /* align to XCHAL_DCACHE_LINESIZE */
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732184269



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -112,7 +112,7 @@ void up_disable_icache(void)
  ****************************************************************************/
 
 #ifdef CONFIG_XTENSA_ICACHE
-void up_invalidate_icache(uint32_t start, uint32_t end)
+void up_invalidate_icache(uintptr_t start, uint32_t end)
 {
   /* align to XCHAL_ICACHE_SIZE */

Review comment:
       ```suggestion
     /* Align to XCHAL_ICACHE_LINESIZE */
   ```

##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -155,6 +155,96 @@ void up_invalidate_icache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   Prefetch and lock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_lock_icache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_ICACHE_SIZE */

Review comment:
       ```suggestion
     /* Align to XCHAL_ICACHE_LINESIZE */
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732186739



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -439,6 +529,96 @@ void up_flush_dcache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_lock_dcache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_DCACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_DCACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_DCACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("dpfl %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("dsync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_dcache
+ *
+ * Description:
+ *   Unlock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_unlock_dcache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_DCACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_DCACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_DCACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("dhu %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("dsync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_dcache_all
+ *
+ * Description:
+ *   Unlock the entire contents of D cache.

Review comment:
       ```suggestion
    *   Unlock the entire contents of data cache.
   ```
   nit: Use a single method to refer to data cache, just to keep the documentation consistent.




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732191477



##########
File path: include/nuttx/cache.h
##########
@@ -132,6 +132,70 @@ void up_invalidate_icache_all(void);
 #  define up_invalidate_icache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   lock the instruction cache within the specified region.
+ *   If the specified address if not present in the instruction cache,
+ *   Some archs transfer the line from memory, other archs wait the

Review comment:
       ```suggestion
    *   some architectures transfer the line from memory, others wait the
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732189761



##########
File path: include/nuttx/cache.h
##########
@@ -132,6 +132,70 @@ void up_invalidate_icache_all(void);
 #  define up_invalidate_icache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   lock the instruction cache within the specified region.
+ *   If the specified address if not present in the instruction cache,
+ *   Some archs transfer the line from memory, other archs wait the
+ *   address be read from memory, and then lock.
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_ICACHE_LOCK
+void up_lock_icache(uintptr_t start, uint32_t end);
+#else
+#  define up_lock_icache()
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_icache
+ *
+ * Description:
+ *   Unlock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_ICACHE_LOCK
+void up_unlock_icache(uintptr_t start, uint32_t end);
+#else
+#  define up_unlock_icache()
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_icache_all
+ *
+ * Description:
+ *   Unlock the entire contents of I cache.

Review comment:
       ```suggestion
    *   Unlock the entire contents of instruction cache.
   ```




-- 
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] zhuyanlinzyl edited a comment on pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl edited a comment on pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#issuecomment-948335600


   @gustavonihei I think lock_icache have two ways.  One is  setup transaction the line from memory now,  the second is wait the memory be addressed by code, and the lock.  I don't think the second is `prefetch`.  What's you advice? 


-- 
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 merged pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei merged pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699


   


-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732189502



##########
File path: include/nuttx/cache.h
##########
@@ -132,6 +132,70 @@ void up_invalidate_icache_all(void);
 #  define up_invalidate_icache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   lock the instruction cache within the specified region.
+ *   If the specified address if not present in the instruction cache,
+ *   Some archs transfer the line from memory, other archs wait the
+ *   address be read from memory, and then lock.
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_ICACHE_LOCK
+void up_lock_icache(uintptr_t start, uint32_t end);

Review comment:
       ```suggestion
   void up_lock_icache(uintptr_t start, uintptr_t end);
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732186008



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -439,6 +529,96 @@ void up_flush_dcache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_lock_dcache(uintptr_t start, uint32_t end)

Review comment:
       ```suggestion
   void up_lock_dcache(uintptr_t start, uintptr_t end)
   ```

##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -439,6 +529,96 @@ void up_flush_dcache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_lock_dcache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_DCACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_DCACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_DCACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("dpfl %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("dsync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_dcache
+ *
+ * Description:
+ *   Unlock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_unlock_dcache(uintptr_t start, uint32_t end)

Review comment:
       ```suggestion
   void up_unlock_dcache(uintptr_t start, uintptr_t end)
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732189260



##########
File path: include/nuttx/cache.h
##########
@@ -132,6 +132,70 @@ void up_invalidate_icache_all(void);
 #  define up_invalidate_icache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   lock the instruction cache within the specified region.
+ *   If the specified address if not present in the instruction cache,
+ *   Some archs transfer the line from memory, other archs wait the
+ *   address be read from memory, and then lock.
+ * Input Parameters:

Review comment:
       ```suggestion
    *   address be read from memory, and then lock.
    *
    * Input Parameters:
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732185267



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -155,6 +155,96 @@ void up_invalidate_icache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   Prefetch and lock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_lock_icache(uintptr_t start, uint32_t end)

Review comment:
       ```suggestion
   void up_lock_icache(uintptr_t start, uintptr_t end)
   ```

##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -155,6 +155,96 @@ void up_invalidate_icache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   Prefetch and lock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_lock_icache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_ICACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_ICACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_ICACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("ipfl %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("isync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_icache
+ *
+ * Description:
+ *   Unlock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_unlock_icache(uintptr_t start, uint32_t end)

Review comment:
       ```suggestion
   void up_unlock_icache(uintptr_t start, uintptr_t end)
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732184269



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -112,7 +112,7 @@ void up_disable_icache(void)
  ****************************************************************************/
 
 #ifdef CONFIG_XTENSA_ICACHE
-void up_invalidate_icache(uint32_t start, uint32_t end)
+void up_invalidate_icache(uintptr_t start, uint32_t end)
 {
   /* align to XCHAL_ICACHE_SIZE */

Review comment:
       ```suggestion
     /* align to XCHAL_ICACHE_LINESIZE */
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732189078



##########
File path: include/nuttx/cache.h
##########
@@ -132,6 +132,70 @@ void up_invalidate_icache_all(void);
 #  define up_invalidate_icache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   lock the instruction cache within the specified region.

Review comment:
       ```suggestion
    *   Lock the instruction cache within the specified region.
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732185107



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -155,6 +155,96 @@ void up_invalidate_icache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   Prefetch and lock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_lock_icache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_ICACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_ICACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_ICACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("ipfl %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("isync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_icache
+ *
+ * Description:
+ *   Unlock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_unlock_icache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_ICACHE_SIZE */

Review comment:
       ```suggestion
     /* Align to XCHAL_ICACHE_LINESIZE */
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732682421



##########
File path: include/nuttx/cache.h
##########
@@ -132,6 +132,70 @@ void up_invalidate_icache_all(void);
 #  define up_invalidate_icache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   lock the instruction cache within the specified region.

Review comment:
       @zhuyanlinzyl It seems you've addressed all the comments but this one.




-- 
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] zhuyanlinzyl commented on pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#issuecomment-948335600


   @gustavonihei I think lock_icache have two ways.  One is  setup transaction the line from memory now,  the second is wait the memory be addressed by code, and the lock.  I don't think the second is prefetch. 


-- 
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] zhuyanlinzyl commented on pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#issuecomment-949250674


   @gustavonihei  Thanks . I understand you point now,  please review again.


-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732191159



##########
File path: include/nuttx/cache.h
##########
@@ -303,6 +367,71 @@ void up_flush_dcache_all(void);
 #  define up_flush_dcache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *   If the specified address is not present in the data cache,
+ *   Some archs transfer the line from memory, other archs wait the

Review comment:
       ```suggestion
    *   some architectures transfer the line from memory, others wait the
   ```

##########
File path: include/nuttx/cache.h
##########
@@ -303,6 +367,71 @@ void up_flush_dcache_all(void);
 #  define up_flush_dcache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *   If the specified address is not present in the data cache,
+ *   Some archs transfer the line from memory, other archs wait the
+ *   address be read from memory, and then lock.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_DCACHE_LOCK
+void up_lock_dcache(uintptr_t start, uint32_t end);
+#else
+#  define up_lock_dcache()
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_dcache
+ *
+ * Description:
+ *   Unlock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_DCACHE_LOCK
+void up_unlock_dcache(uintptr_t start, uint32_t end);
+#else
+#  define up_unlock_dcache()
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_dcache_all
+ *
+ * Description:
+ *   Unlock the entire contents of D cache.

Review comment:
       ```suggestion
    *   Unlock the entire contents of data cache.
   ```

##########
File path: include/nuttx/cache.h
##########
@@ -303,6 +367,71 @@ void up_flush_dcache_all(void);
 #  define up_flush_dcache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *   If the specified address is not present in the data cache,
+ *   Some archs transfer the line from memory, other archs wait the
+ *   address be read from memory, and then lock.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_DCACHE_LOCK
+void up_lock_dcache(uintptr_t start, uint32_t end);
+#else
+#  define up_lock_dcache()
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_dcache
+ *
+ * Description:
+ *   Unlock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_DCACHE_LOCK
+void up_unlock_dcache(uintptr_t start, uint32_t end);

Review comment:
       ```suggestion
   void up_unlock_dcache(uintptr_t start, uintptr_t end);
   ```

##########
File path: include/nuttx/cache.h
##########
@@ -303,6 +367,71 @@ void up_flush_dcache_all(void);
 #  define up_flush_dcache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *   If the specified address is not present in the data cache,
+ *   Some archs transfer the line from memory, other archs wait the
+ *   address be read from memory, and then lock.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_DCACHE_LOCK
+void up_lock_dcache(uintptr_t start, uint32_t end);

Review comment:
       ```suggestion
   void up_lock_dcache(uintptr_t start, uintptr_t end);
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732189260



##########
File path: include/nuttx/cache.h
##########
@@ -132,6 +132,70 @@ void up_invalidate_icache_all(void);
 #  define up_invalidate_icache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   lock the instruction cache within the specified region.
+ *   If the specified address if not present in the instruction cache,
+ *   Some archs transfer the line from memory, other archs wait the
+ *   address be read from memory, and then lock.
+ * Input Parameters:

Review comment:
       ```suggestion
    *   address be read from memory, and then lock.
    *
    * Input Parameters:
   ```
   Missing empty line




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732189078



##########
File path: include/nuttx/cache.h
##########
@@ -132,6 +132,70 @@ void up_invalidate_icache_all(void);
 #  define up_invalidate_icache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   lock the instruction cache within the specified region.

Review comment:
       ```suggestion
    *   Prefetch and lock the instruction cache within the specified region.
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732191159



##########
File path: include/nuttx/cache.h
##########
@@ -303,6 +367,71 @@ void up_flush_dcache_all(void);
 #  define up_flush_dcache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *   If the specified address is not present in the data cache,
+ *   Some archs transfer the line from memory, other archs wait the

Review comment:
       ```suggestion
    *   some archs transfer the line from memory, other archs wait the
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732187607



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -439,6 +529,96 @@ void up_flush_dcache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_dcache
+ *
+ * Description:
+ *   Prefetch and lock the data cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_DCACHE) && defined(CONFIG_XTENSA_DCACHE_LOCK)
+void up_lock_dcache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_DCACHE_SIZE */

Review comment:
       ```suggestion
     /* align to XCHAL_DCACHE_LINESIZE */
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732188208



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -155,6 +155,96 @@ void up_invalidate_icache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   Prefetch and lock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_lock_icache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_ICACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_ICACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_ICACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("ipfl %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("isync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_icache
+ *
+ * Description:
+ *   Unlock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_unlock_icache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_ICACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_ICACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_ICACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("ihu %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("isync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_icache_all
+ *
+ * Description:
+ *   Unlock the entire contents of I cache.

Review comment:
       ```suggestion
    *   Unlock the entire contents of instruction cache.
   ```




-- 
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] zhuyanlinzyl removed a comment on pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl removed a comment on pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#issuecomment-949251014


   @gustavonihei  thanks.  I get you point now, please review again.


-- 
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] zhuyanlinzyl commented on pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#issuecomment-949251014


   @gustavonihei  thanks.  I get you point now, please review again.


-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732189613



##########
File path: include/nuttx/cache.h
##########
@@ -132,6 +132,70 @@ void up_invalidate_icache_all(void);
 #  define up_invalidate_icache_all()
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   lock the instruction cache within the specified region.
+ *   If the specified address if not present in the instruction cache,
+ *   Some archs transfer the line from memory, other archs wait the
+ *   address be read from memory, and then lock.
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_ICACHE_LOCK
+void up_lock_icache(uintptr_t start, uint32_t end);
+#else
+#  define up_lock_icache()
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_icache
+ *
+ * Description:
+ *   Unlock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_ICACHE_LOCK
+void up_unlock_icache(uintptr_t start, uint32_t end);

Review comment:
       ```suggestion
   void up_unlock_icache(uintptr_t start, uintptr_t end);
   ```




-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732188208



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -155,6 +155,96 @@ void up_invalidate_icache_all(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: up_lock_icache
+ *
+ * Description:
+ *   Prefetch and lock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_lock_icache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_ICACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_ICACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_ICACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("ipfl %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("isync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_icache
+ *
+ * Description:
+ *   Unlock the instruction cache within the specified region.
+ *
+ * Input Parameters:
+ *   start - virtual start address of region
+ *   end   - virtual end address of region + 1
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_XTENSA_ICACHE) && defined(CONFIG_XTENSA_ICACHE_LOCK)
+void up_unlock_icache(uintptr_t start, uint32_t end)
+{
+  /* align to XCHAL_ICACHE_SIZE */
+
+  uint32_t addr = start - (start & (XCHAL_ICACHE_LINESIZE - 1));
+
+  for (; addr < end; addr += XCHAL_ICACHE_LINESIZE)
+    {
+      __asm__ __volatile__ ("ihu %0, 0\n": : "r"(addr));
+    };
+
+  __asm__ __volatile__ ("isync\n");
+}
+#endif
+
+/****************************************************************************
+ * Name: up_unlock_icache_all
+ *
+ * Description:
+ *   Unlock the entire contents of I cache.

Review comment:
       ```suggestion
    *   Unlock the entire contents of instruction cache.
   ```
   nit: Use a single method to refer to instruction cache, just to keep the documentation consistent.




-- 
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 edited a comment on pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei edited a comment on pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#issuecomment-948844412


   > @gustavonihei I think lock_icache have two ways. One is setup transaction the line from memory now, the second is wait the memory be addressed by code, and the lock. I don't think the second is `prefetch`. What's you advice?
   
   Sorry, let me see if I correctly followed your point.
   I understand that the `IPFL` instruction from the Xtensa LX6 ISA prefetches and loads a instruction cache line. Although other ISAs may not implement a similar do-it-all mnemonic, we may still intend `lock_icache` to implement this behavior.
   Looking for some other examples, the [application notes for the Freescale/NXP e300 core](https://www.nxp.com/docs/en/application-note/AN2129.pdf) defines the prefetch of instruction and data as part of the locking procedure (see chapter 2), although not in a singular mnemonic.
   This `lock_icache` proposal may not be most generic, but I still think it is a good starting point, which may be adapted once other ISAs get it implemented.


-- 
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 change in pull request #4699: arch:cache: add lock & unlock feature

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4699:
URL: https://github.com/apache/incubator-nuttx/pull/4699#discussion_r732175030



##########
File path: arch/xtensa/src/common/xtensa_cache.c
##########
@@ -112,7 +112,7 @@ void up_disable_icache(void)
  ****************************************************************************/
 
 #ifdef CONFIG_XTENSA_ICACHE
-void up_invalidate_icache(uint32_t start, uint32_t end)
+void up_invalidate_icache(uintptr_t start, uint32_t end)

Review comment:
       ```suggestion
   void up_invalidate_icache(uintptr_t start, uintptr_t end)
   ```
   `end` is also declared as `uintptr_t` on `cache.h`.




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