zephyr/drivers/dma
Carlo Caione e4a125b6a4 dt: Make zephyr,memory-attr a capabilities bitmask
This is the final step in making the `zephyr,memory-attr` property
actually useful.

The problem with the current implementation is that `zephyr,memory-attr`
is an enum type, this is making very difficult to use that to actually
describe the memory capabilities. The solution proposed in this PR is to
use the `zephyr,memory-attr` property as an OR-ed bitmask of memory
attributes.

With the change proposed in this PR it is possible in the DeviceTree to
mark the memory regions with a bitmask of attributes by using the
`zephyr,memory-attr` property. This property and the related memory
region can then be retrieved at run-time by leveraging a provided helper
library or the usual DT helpers.

The set of general attributes that can be specified in the property are
defined and explained in
`include/zephyr/dt-bindings/memory-attr/memory-attr.h` (the list can be
extended when needed).

For example, to mark a memory region in the DeviceTree as volatile,
non-cacheable, out-of-order:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_VOLATILE |
			       DT_MEM_NON_CACHEABLE |
			       DT_MEM_OOO )>;
   };

The `zephyr,memory-attr` property can also be used to set
architecture-specific custom attributes that can be interpreted at run
time. This is leveraged, among other things, to create MPU regions out
of DeviceTree defined memory regions on ARM, for example:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-region = "NOCACHE_REGION";
       zephyr,memory-attr = <( DT_ARM_MPU(ATTR_MPU_RAM_NOCACHE) )>;
   };

See `include/zephyr/dt-bindings/memory-attr/memory-attr-mpu.h` to see
how an architecture can define its own special memory attributes (in
this case ARM MPU).

The property can also be used to set custom software-specific
attributes. For example we can think of marking a memory region as
available to be used for memory allocation (not yet implemented):

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_NON_CACHEABLE |
			       DT_MEM_SW_ALLOCATABLE )>;
   };

Or maybe we can leverage the property to specify some alignment
requirements for the region:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_CACHEABLE |
			       DT_MEM_SW_ALIGN(32) )>;
   };

The conventional and recommended way to deal and manage with memory
regions marked with attributes is by using the provided `mem-attr`
helper library by enabling `CONFIG_MEM_ATTR` (or by using the usual DT
helpers).

When this option is enabled the list of memory regions and their
attributes are compiled in a user-accessible array and a set of
functions is made available that can be used to query, probe and act on
regions and attributes, see `include/zephyr/mem_mgmt/mem_attr.h`

Note that the `zephyr,memory-attr` property is only a descriptive
property of the capabilities of the associated memory  region, but it
does not result in any actual setting for the memory to be set. The
user, code or subsystem willing to use this information to do some work
(for example creating an MPU region out of the property) must use either
the provided `mem-attr` library or the usual DeviceTree helpers to
perform the required work / setting.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-09-15 12:46:54 +02:00
..
CMakeLists.txt drivers: dma: add DMA driver for NXP PXP engine 2023-07-25 09:10:52 +02:00
dma_dw_common.c drivers: dma: dma_intel_lpss: Added intel LPSS DMA interface 2023-05-26 10:06:00 -04:00
dma_dw_common.h drivers: dma: dma_intel_lpss: Added intel LPSS DMA interface 2023-05-26 10:06:00 -04:00
dma_dw.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
dma_esp32_gdma.c soc: xtensa,riscv: esp32xx: refactor folder structure 2023-07-25 18:12:33 +02:00
dma_gd32.c treewide: Update clock control API usage 2023-04-05 10:55:46 +02:00
dma_handlers.c drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
dma_intel_adsp_gpdma.c dma: intel_adsp_gpdma: Unmask interrupt on ACE 2023-08-04 10:41:27 +02:00
dma_intel_adsp_hda_host_in.c drivers: hda: use interrupt for timing L1 exit on host DMA 2023-08-31 09:59:10 -04:00
dma_intel_adsp_hda_host_out.c drivers: hda: use interrupt for timing L1 exit on host DMA 2023-08-31 09:59:10 -04:00
dma_intel_adsp_hda_link_in.c drivers: hda: use interrupt for timing L1 exit on host DMA 2023-08-31 09:59:10 -04:00
dma_intel_adsp_hda_link_out.c drivers: hda: use interrupt for timing L1 exit on host DMA 2023-08-31 09:59:10 -04:00
dma_intel_adsp_hda.c drivers: hda: insert an empty ";" statement before switch() labels 2023-09-04 09:49:38 +02:00
dma_intel_adsp_hda.h drivers: hda: use interrupt for timing L1 exit on host DMA 2023-08-31 09:59:10 -04:00
dma_intel_lpss.c drivers: dma: dma_intel_lpss: Added intel LPSS DMA interface 2023-05-26 10:06:00 -04:00
dma_iproc_pax_v1.c dma: callback with 2 status codes for successful transfers 2023-05-08 09:57:32 +02:00
dma_iproc_pax_v1.h
dma_iproc_pax_v2.c dma: iproc_pax_v2: delay initialization after pcie 2023-07-19 20:22:03 +00:00
dma_iproc_pax_v2.h
dma_iproc_pax.h drivers: dma: iproc_pax: use DEVICE_DT_GET 2022-02-21 22:16:10 -05:00
dma_mchp_xec.c drivers: dma: remove unnecessary null check 2023-08-15 11:16:19 +00:00
dma_mcux_edma.c barriers: Move __DSB() to the new API 2023-05-24 13:13:57 -04:00
dma_mcux_edma.h drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
dma_mcux_lpc.c drivers: dma: dma_mcux_lpx: Added parameter in macro for 55S36 2023-07-21 08:58:27 -05:00
dma_mcux_pxp.c drivers: dma: add DMA driver for NXP PXP engine 2023-07-25 09:10:52 +02:00
dma_nios2_msgdma.c dma: callback with 2 status codes for successful transfers 2023-05-08 09:57:32 +02:00
dma_pl330.c drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
dma_pl330.h drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
dma_rpi_pico.c drivers: dma: rpi_pico: add support for RaspberryPi Pico DMA 2023-03-22 09:33:52 +01:00
dma_sam0.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
dma_sam_xdmac.c drivers: sam dma xdmac: implemented dma device get_status() 2023-09-10 00:49:12 +02:00
dma_sam_xdmac.h
dma_stm32_bdma.c dt: Make zephyr,memory-attr a capabilities bitmask 2023-09-15 12:46:54 +02:00
dma_stm32_bdma.h drivers: dma: stm32: bdma support for H7 2023-03-01 15:58:27 +01:00
dma_stm32_v1.c drivers: dma: stm32 disabling stream waits for disable 2023-03-15 15:01:15 +01:00
dma_stm32_v2.c drivers: dma: dma_stm32: add stm32c0-series support 2023-05-27 06:21:39 -04:00
dma_stm32.c drivers: dma: Remove double parentheses in if statements 2023-05-31 14:41:25 -04:00
dma_stm32.h drivers: dma: stm32 dma driver support repeated start/stop 2023-01-19 12:03:50 +01:00
dma_stm32u5.c drivers: dma: stm32u5: set data length in bytes 2023-07-11 09:44:37 +02:00
dma_xmc4xxx.c drivers: dma: Add infineon xmc4xxx dma support 2023-02-21 21:15:53 +01:00
dmamux_stm32.c drivers: dma: stm32 dmamux device must be initialized after dma 2023-06-23 09:21:59 +02:00
Kconfig drivers: dma: add DMA driver for NXP PXP engine 2023-07-25 09:10:52 +02:00
Kconfig.dma_pl330 drivers: dma: Update drivers to use devicetree Kconfig symbol 2022-08-26 14:27:23 +00:00
Kconfig.dw drivers: dma: Update drivers to use devicetree Kconfig symbol 2022-08-26 14:27:23 +00:00
Kconfig.dw_common drivers: dma: dma_intel_lpss: Added intel LPSS DMA interface 2023-05-26 10:06:00 -04:00
Kconfig.esp32 drivers: dma: esp32c3: add gdma driver 2023-01-12 19:09:01 +01:00
Kconfig.gd32 dts: bindings: dma: gd32: split gd,gd32-dma-v1 for support F4xx feature 2022-12-22 13:43:49 +01:00
Kconfig.intel_adsp_gpdma drivers: remove references to old CAVS platforms 2023-04-06 18:51:56 +02:00
Kconfig.intel_adsp_hda drivers: hda: use interrupt for timing L1 exit on host DMA 2023-08-31 09:59:10 -04:00
Kconfig.intel_lpss drivers: dma: dma_intel_lpss: Added intel LPSS DMA interface 2023-05-26 10:06:00 -04:00
Kconfig.iproc_pax dma: iproc_pax_v2: delay initialization after pcie 2023-07-19 20:22:03 +00:00
Kconfig.mcux_edma drivers: dma: Update drivers to use devicetree Kconfig symbol 2022-08-26 14:27:23 +00:00
Kconfig.mcux_lpc drivers: dma_mcux_lpc: Add Kconfig to reduce data 2023-07-17 13:06:01 -05:00
Kconfig.mcux_pxp drivers: dma: add DMA driver for NXP PXP engine 2023-07-25 09:10:52 +02:00
Kconfig.nios2_msgdma drivers: dma: Update drivers to use devicetree Kconfig symbol 2022-08-26 14:27:23 +00:00
Kconfig.rpi_pico drivers: dma: rpi_pico: add support for RaspberryPi Pico DMA 2023-03-22 09:33:52 +01:00
Kconfig.sam0 drivers: dma: Update drivers to use devicetree Kconfig symbol 2022-08-26 14:27:23 +00:00
Kconfig.sam_xdmac drivers: dma: Update drivers to use devicetree Kconfig symbol 2022-08-26 14:27:23 +00:00
Kconfig.stm32 drivers: dma: stm32 dmamux device must be initialized after dma 2023-06-23 09:21:59 +02:00
Kconfig.xec drivers: dma: Add Microchip XEC DMA driver 2023-02-19 20:38:21 -05:00
Kconfig.xmc4xxx drivers: dma: Add infineon xmc4xxx dma support 2023-02-21 21:15:53 +01:00