jerenkrantz commented on PR #17493:
URL: https://github.com/apache/nuttx/pull/17493#issuecomment-3682331108

   In digging into this a bit more, it appears that there is already an 
`up_invalidate_dcache_all` in `litex_cache.S`.  
   
   If I further look upstream at 
https://github.com/enjoy-digital/litex/blob/master/litex/soc/cores/cpu/vexriscv_smp/system.h,
 `flush_cpu_dcache` is defined `0x500F` as flushing rather than invalidating.  
nuttx on litex is currently doing `0x500F` as invalidation.  (I believe this 
system.h is intended for inclusion in Linux distributions.)
   
   Adding the below diff to `litex_cache.S` does allow it to build with 
BOARDCTL_RESET=y override in place.
   
   Before submitting a separate PR, I'd like to ensure that this is the right 
track.   IOW, I suspect that the invalidating might actually be flushing based 
upon upstream definitions.  I'm not sure whether breaking that assumption for 
invalidation would have any effects.  (I'm not seeing any a declared mechanism 
for invalidation in litex repos, but perhaps it is there in another location?)
   
   ```
   diff --git a/arch/risc-v/src/litex/litex_cache.S 
b/arch/risc-v/src/litex/litex_cache.S
   index 37bb1d65b8..2820a38431 100644
   --- a/arch/risc-v/src/litex/litex_cache.S
   +++ b/arch/risc-v/src/litex/litex_cache.S
   @@ -56,6 +56,28 @@ up_invalidate_dcache_all:
      .word 0x500F
    #endif
   
   
+/****************************************************************************
   + * Name: up_flush_dcache_all
   + *
   + * Description:
   + *   Flush the entire contents of D cache.
   + *
   + * Input Parameters:
   + *   None
   + *
   + * Returned Value:
   + *   None
   + *
   + 
****************************************************************************/
   +
   +#ifdef CONFIG_ARCH_DCACHE
   +  .globl  up_flush_dcache_all
   +  .type   up_flush_dcache_all, function
   +
   +up_flush_dcache_all:
   +  .word 0x500F
   +#endif
   +
    
/****************************************************************************
     * Name: up_invalidate_icache_all
     *
     ```


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

Reply via email to