this is raspberrypi os source code that a quoted, its linux. i think all linux versions share this source code in the linux/arch/arm64/mm/ folder. i checked that jetson nano has ARMv8 architecture just like raspberry pi. i dont know which linux is commonly installed on jetson nano. if u could let me know and send me link to source code i think i could find the exact same file from there. /mm/ means memory management.
“as part of its “Linux for Tegra” (formerly “L4T”) development kit, also Nvidia provides JetPack SDK with “Linux for Tegra” and other tools with it. The newer and more powerful devices of the Tegra family are now supported by Nvidia’s own Vibrante Linux distribution.” - wikipedia
There you go
Linux for Tegra
https://github.com/OE4T/linux-tegra-5.10/blob/oe4t-patches-l4t-r35.1/arch/arm64/mm/init.c#L56
"…By default ZONE_DMA covers the 32-bit addressable memory
- unless restricted on specific platforms (e.g. 30-bit on Raspberry Pi 4). …"
The code is slightly different because its 5.10 kernel version of the source i found but in the raspberry pi os link its 6.1.
Unfortunately i was not able to find Vibrante source code but i think the same file is there also with the same comment.
Ok i see in case of Tegra i need to look into another folder not arm64 but this instead /linux/arch/arm/.
https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/mm/init.c
/*
- The DMA mask corresponding to the maximum bus address allocatable
- using GFP_DMA. The default here places no restriction on DMA
- allocations. This must be the smallest DMA mask in the system,
- so a successful GFP_DMA allocation will always satisfy this.
*/
Still i was unable to figure out the answer on my own. ZONE_DMA is mentioned in this file but i dont know where the memory range is defined.
u64 mask = (u64)DMA_BIT_MASK(32);
Does ZONE_DMA cover 30 or 32-bits addressable memory on Jetson Nano?
https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/mm/dma-mapping.c#L1569C4-L1569C4
/* currently only 32-bit DMA address space is supported */
if (size > DMA_BIT_MASK(32) + 1)
return ERR_PTR(-ERANGE);
Ok seems that indeed it is 32-bit. If somebody could confirm it would be great.
Oh now wait a minute here, Tegra 2 processor is 64-bit so i should still look into arm64 folder right?
https://github.com/OE4T/linux-tegra-5.10/blob/oe4t-patches-l4t-r35.1/arch/arm64/mm/dma-mapping.c
it not have such mask variable. instead it has method:
void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
enum dma_data_direction dir)
{
unsigned long start = (unsigned long)phys_to_virt(paddr);
dcache_clean_poc(start, start + size);
}
this led me to
https://github.com/OE4T/linux-tegra-5.10/blob/oe4t-patches-l4t-r35.1/kernel/dma/direct.c#L337
which led me to
https://github.com/OE4T/linux-tegra-5.10/blob/oe4t-patches-l4t-r35.1/kernel/dma/mapping.c#L296
i grepped for “dma_sync_sg_for_device” in the source
grep -i -r “dma_sync_sg_for_device” .
got lots of files where this method is mentioned. going through them would take some time.
could somebody that has Nvidia Jetson Nano just
sudo cat /proc/meminfo
for me and copy the output here? i could at least see how much CMA is allocated by default
or if anybody can answer the original question “Does ZONE_DMA cover 30 or 32-bits addressable memory on Jetson Nano?” would be even better.