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/09/23 11:56:52 UTC

[GitHub] [incubator-nuttx] davids5 opened a new pull request, #7174: stm32h7:SDMMA fix unaligned access for buffers not on 32 bit boundaries

davids5 opened a new pull request, #7174:
URL: https://github.com/apache/incubator-nuttx/pull/7174

   ## Summary
   
      The IDMA needs to have 32 bit word alignment, in fact it will
      AND off the lower 2 bits of the value stored in IDMABASE0R.
      This bug was masked by CONFIG_ARMV7M_DCACHE causing proper word alignment
      and also FAT_DMAMEMORY being aligned.
   
      This commit extends the unaligned logic (used for dcache) to take into account
      the need for a buffer copy when the buffer is ot 32 bit word.
   
       It leverages the fact that when CONFIG_ARMV7M_DCACHE is not defined the up_xxxxx_dcache are nops.
   
   ## Impact
    Fixes configuration without CONFIG_ARMV7M_DCACHE 
   
   ## Testing
   Uses PX4's `sd_bench`
   
   
   
   CONFIG_STM32H7_SDMMC_IDMA | CONFIG_ARMV7M_DCACHE | Build | Test
   -- | -- | -- | --
   Off | Off | Pass | Pass
   On | Off | Pass | Pass
   Off | On | Pass | Pass
   On | On | Pass | Pass
   
   
   
   
   


-- 
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] davids5 commented on pull request #7174: stm32h7:SDMMC fix unaligned access for buffers not on 32 bit boundaries

Posted by GitBox <gi...@apache.org>.
davids5 commented on PR #7174:
URL: https://github.com/apache/incubator-nuttx/pull/7174#issuecomment-1257965356

   > @davids5 do you plan changes to address my optional comment? I'm fine to merge changes as is
   
   Sorry for the delay. It is 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] pkarashchenko commented on a diff in pull request #7174: stm32h7:SDMMA fix unaligned access for buffers not on 32 bit boundaries

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7174:
URL: https://github.com/apache/incubator-nuttx/pull/7174#discussion_r978625123


##########
arch/arm/src/stm32h7/stm32_sdmmc.c:
##########
@@ -381,10 +381,14 @@ struct stm32_dev_s
 #if !defined(CONFIG_STM32H7_SDMMC_IDMA)
   struct work_s      cbfifo;          /* Monitor for Lame FIFO */
 #endif
-  uint8_t            rxfifo[FIFO_SIZE_IN_BYTES] /* To offload with IDMA */
-                     aligned_data(ARMV7M_DCACHE_LINESIZE);
-#if defined(CONFIG_ARMV7M_DCACHE) && defined(CONFIG_STM32H7_SDMMC_IDMA)
-  bool               unaligned_rx; /* read buffer is not cache-line aligned */
+  uint8_t            rxfifo[FIFO_SIZE_IN_BYTES] /* To offload with IDMA and support un-alinged buffers */
+                     __attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));

Review Comment:
   Maybe use a macro from compiler.h?
   Or alloc and uint32_t arrays for rounded up size in bytes divided by 4.



-- 
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 #7174: stm32h7:SDMMC fix unaligned access for buffers not on 32 bit boundaries

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #7174:
URL: https://github.com/apache/incubator-nuttx/pull/7174


-- 
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] pkarashchenko commented on a diff in pull request #7174: stm32h7:SDMMC fix unaligned access for buffers not on 32 bit boundaries

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7174:
URL: https://github.com/apache/incubator-nuttx/pull/7174#discussion_r980093372


##########
arch/arm/src/stm32h7/stm32_sdmmc.c:
##########
@@ -381,10 +382,14 @@ struct stm32_dev_s
 #if !defined(CONFIG_STM32H7_SDMMC_IDMA)
   struct work_s      cbfifo;          /* Monitor for Lame FIFO */
 #endif
-  uint8_t            rxfifo[FIFO_SIZE_IN_BYTES] /* To offload with IDMA */
+  uint8_t            rxfifo[FIFO_SIZE_IN_BYTES] /* To offload with IDMA and support un-alinged buffers */
                      aligned_data(ARMV7M_DCACHE_LINESIZE);
-#if defined(CONFIG_ARMV7M_DCACHE) && defined(CONFIG_STM32H7_SDMMC_IDMA)
-  bool               unaligned_rx; /* read buffer is not cache-line aligned */
+  bool               unaligned_rx; /* read buffer is not cache-line or 32 bit aligned */
+
+  /* Input dma buffer for unaligned transfers */
+#if defined(CONFIG_STM32H7_SDMMC_IDMA)
+  uint8_t sdmmc_rxbuffer[SDMMC_MAX_BLOCK_SIZE]
+  __attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));

Review Comment:
   ```suggestion
     aligned_data(ARMV7M_DCACHE_LINESIZE);
   ```
   Just to use the same as at line 386



-- 
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] pkarashchenko commented on pull request #7174: stm32h7:SDMMA fix unaligned access for buffers not on 32 bit boundaries

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on PR #7174:
URL: https://github.com/apache/incubator-nuttx/pull/7174#issuecomment-1256925976

   @davids5 do you plan changes to address my optional comment?
   I'm fine to merge changes as is


-- 
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] davids5 commented on a diff in pull request #7174: stm32h7:SDMMC fix unaligned access for buffers not on 32 bit boundaries

Posted by GitBox <gi...@apache.org>.
davids5 commented on code in PR #7174:
URL: https://github.com/apache/incubator-nuttx/pull/7174#discussion_r980128559


##########
arch/arm/src/stm32h7/stm32_sdmmc.c:
##########
@@ -381,10 +382,14 @@ struct stm32_dev_s
 #if !defined(CONFIG_STM32H7_SDMMC_IDMA)
   struct work_s      cbfifo;          /* Monitor for Lame FIFO */
 #endif
-  uint8_t            rxfifo[FIFO_SIZE_IN_BYTES] /* To offload with IDMA */
+  uint8_t            rxfifo[FIFO_SIZE_IN_BYTES] /* To offload with IDMA and support un-alinged buffers */
                      aligned_data(ARMV7M_DCACHE_LINESIZE);
-#if defined(CONFIG_ARMV7M_DCACHE) && defined(CONFIG_STM32H7_SDMMC_IDMA)
-  bool               unaligned_rx; /* read buffer is not cache-line aligned */
+  bool               unaligned_rx; /* read buffer is not cache-line or 32 bit aligned */
+
+  /* Input dma buffer for unaligned transfers */
+#if defined(CONFIG_STM32H7_SDMMC_IDMA)
+  uint8_t sdmmc_rxbuffer[SDMMC_MAX_BLOCK_SIZE]
+  __attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));

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] davids5 commented on a diff in pull request #7174: stm32h7:SDMMC fix unaligned access for buffers not on 32 bit boundaries

Posted by GitBox <gi...@apache.org>.
davids5 commented on code in PR #7174:
URL: https://github.com/apache/incubator-nuttx/pull/7174#discussion_r979973508


##########
arch/arm/src/stm32h7/stm32_sdmmc.c:
##########
@@ -381,10 +381,14 @@ struct stm32_dev_s
 #if !defined(CONFIG_STM32H7_SDMMC_IDMA)
   struct work_s      cbfifo;          /* Monitor for Lame FIFO */
 #endif
-  uint8_t            rxfifo[FIFO_SIZE_IN_BYTES] /* To offload with IDMA */
-                     aligned_data(ARMV7M_DCACHE_LINESIZE);
-#if defined(CONFIG_ARMV7M_DCACHE) && defined(CONFIG_STM32H7_SDMMC_IDMA)
-  bool               unaligned_rx; /* read buffer is not cache-line aligned */
+  uint8_t            rxfifo[FIFO_SIZE_IN_BYTES] /* To offload with IDMA and support un-alinged buffers */
+                     __attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));

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] davids5 commented on pull request #7174: stm32h7:SDMMC fix unaligned access for buffers not on 32 bit boundaries

Posted by GitBox <gi...@apache.org>.
davids5 commented on PR #7174:
URL: https://github.com/apache/incubator-nuttx/pull/7174#issuecomment-1257965791

   > @davids5
   > 
   > > stm32h7:SDMMA
   > 
   > Is it SDMMC?
   
   Yes - Thank you!


-- 
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] masayuki2009 commented on pull request #7174: stm32h7:SDMMA fix unaligned access for buffers not on 32 bit boundaries

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #7174:
URL: https://github.com/apache/incubator-nuttx/pull/7174#issuecomment-1256974608

   @davids5 
   
   >stm32h7:SDMMA
   
   Is it SDMMC?
   


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