applicabilité et source de ArmSoM
La table des produits source ne énumère que RK3588 et RV1106 / Linux 5.10. Le chapitre 4 RK-DMA-HEAP est spécifique à RV1106, pas automatiquement disponible sur RK3588 simplement parce que les deux utilisent Linux 5.10. Il s’agit d’une référence de plateforme Rockchip, pas d’une revendication de support sur chaque ArmSoM. Vérifier la carte exacte SoC, SDK/BSP, les pilotes du noyau, la configuration du tas, les nœuds de périphérique et les capacités périphériques DMA/IOMMU. Aucune validation matérielle n’a été effectuée. Seule la source chinoise V1.0.0 (RK-KF-YF-469, 10 pages) a été fournie; l’anglais, le russe et l’allemand la traduisent pleinement. La source n’a pas de chiffres techniques, et aucun original anglais n’est inventé. Les journaux complets, les entrées de périphériques dupliqués et les adresses sources sont conservés; ce ne sont pas des mesures ArmSoM.
Notes de rédaction · Documentation ArmSoM
Aperçu technique et versions de produits
Ce guide présente des alcoators de mémoire sur la plateforme Rockchip Linux 5.10. Linux 5.10 ajoute l’alcoator DMA-HEAP sous drivers/dma-buf/heaps/, spécialement pour l’attribution de la mémoire DMABUF ; un ioctl renvoie son descripteur de fichier (fd) à l’espace utilisateur.
| Puce | Version du noyau |
|---|---|
| RK3588, RV1106 | Linux-5.10 |
1. Allocator un: DMA-HEAP {#1-allocator-one-dma-heap}
Les pilotes allocator sont sous drivers/dma-buf/heaps/.
drivers/dma-buf/heaps/
├── cma_heap.c 物理地址连续内存分配器驱动
├── deferred-free-helper.c 内存延迟释放驱动
├── deferred-free-helper.h
├── Kconfig
├── Makefile
├── page_pool.c 内存⻚缓存驱动
├── page_pool.h
└── system_heap.c 物理地址不连续虚拟地址连续内存分配器驱动
Descriptions de fichiers à partir de la source : cma_heap.c alloue la mémoire physiquement contiguë ; deferred-free-helper.c gère le freeing différé ; page_pool.c fournit le cache de page ; system_heap.c alloue la mémoire physiquement non contiguë mais pratiquement contiguë.
Un pilote lourd représente un allocatateur pour un type de mémoire et prend en charge les constructions de module. Linux fournit deux pilotes typiques: le système-pap et le cma-pap.
1.1 Levure de système {#11-system-heap}
système-heap permet de cache CPU par défaut. L’accès au processeur est mis en cache et rapide, mais le logiciel doit maintenir la cohérence des données entre l’appareil et le processeur. Le pilote fournit également un système-pap sans cache CPU.
système-heap prend en charge défer-free par défaut, retardant la libération de mémoire. L’allocation est rapide tandis que son cache de page est non vide; mm rétrécisseur récupère ce cache selon le cas.
system-heap utilise add_dma_heap() pour ajouter un allocateur à dma-heap, obtenir un index unique et créer des périphériques sous /dev/dma_heap/, tels que /dev/dma_heap/system-heap et /dev/dma_heap/system-uncached-heap.
1,2 cma de lourd {#12-cma-heap}
cma-heap permet par défaut la mise en cache du processeur. L’accès au processeur est mis en cache et rapide, mais le logiciel doit maintenir la cohérence entre l’appareil et le processeur.
cma-heap alloue des pages avec cma_alloc. Le pilote CMA détermine la région; voir la référence de la RMR de Linux. La mémoire attribuée est physiquement contiguë et convient pour un accès direct par des périphériques sans OIMMU.
2. Allocateur deux : DRM-GEM {#2-allocator-two-drm-gem}
Le pilote d’allocator est sous drivers/gpu/drm/rockchip/.
3. Alcoator trois: VB2-MEMOPS {#3-allocator-three-vb2-memops}
Le pilote d’allocator est sous drivers/media/common/videobuf2/.
4. Alcoator spécifique à RV1106: RK-DMA-HEAP {#4-rv1106-specific-allocator-rk-dma-heap}
RK-DMA-HEAP est un allocatateur DMABUF spécifique à RV1106 basé sur DMA-HEAP. Ses principales différences avec DMA-HEAP suivent.
| Opération Linux | API Linux | RETURN |
|---|---|---|
| Allouer le DMABUF | rk_dma_heap_buffer_alloc |
struct dma_buf * |
| Allocate tableau PAGE | rk_dma_heap_alloc_contig_pages |
struct page * |
| Supporte la liste debug |
Le DMA-HEAP attribue des objets DMABUF; le RK-DMA-HEAP prend en charge à la fois l’allocation DMABUF et l’attribution de pages ordinaires.
4.1 rk-dma-heap-info {#41-rk-dma-heap-info}
Le nœud de débogage RK-DMA-HEAP est /proc/rk_dma_heap/rk-dma-heap-info. Lecture qui produit l’exemple de document source complet suivant, et non un résultat de test ArmSoM.
# cat /proc/rk_dma_heap/rk-dma-heap-info
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5656
Alloc by (vmpi ) [0x03e1b000-0x03e33fff] 0x00019000 (100 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5655
Alloc by (vmpi ) [0x03e02000-0x03e1afff] 0x00019000 (100 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5654
Alloc by (vmpi ) [0x03d96000-0x03e01fff] 0x0006c000 (432 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5653
Alloc by (vmpi ) [0x03d86000-0x03d95fff] 0x00010000 (64 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5652
Alloc by (vmpi ) [0x03d76000-0x03d85fff] 0x00010000 (64 KiB)
Attached Devices:
ffa50000.rkvenc
ffa50000.rkvenc
Total 2 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5637
Alloc by (vmpi ) [0x03c76000-0x03d75fff] 0x00100000 (1024 KiB)
Attached Devices:
ffa50000.rkvenc
ffa50000.rkvenc
Total 2 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5636
Alloc by (vmpi ) [0x03c74000-0x03c75fff] 0x00002000 (8 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5635
Alloc by (vmpi ) [0x03c72000-0x03c73fff] 0x00002000 (8 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5626
Alloc by (vmpi ) [0x03c40000-0x03c71fff] 0x00032000 (200 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5625
Alloc by (vmpi ) [0x03c3f000-0x03c3ffff] 0x00001000 (4 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5624
Alloc by (vmpi ) [0x03c37000-0x03c3efff] 0x00008000 (32 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5623
Alloc by (vmpi ) [0x03c36000-0x03c36fff] 0x00001000 (4 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5622
Alloc by (vmpi ) [0x03c2e000-0x03c35fff] 0x00008000 (32 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5621
Alloc by (vmpi ) [0x03b64000-0x03c2dfff] 0x000ca000 (808 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5610
Alloc by (vmpi ) [0x03acf000-0x03b63fff] 0x00095000 (596 KiB)
Attached Devices:
ffa00000.rkisp
ffa50000.rkvenc
ffa00000.rkisp
ffa00000.rkisp
ffa00000.rkisp
Total 5 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5609
Alloc by (vmpi ) [0x03ac0000-0x03acefff] 0x0000f000 (60 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5608
Alloc by (vmpi ) [0x03ab1000-0x03abffff] 0x0000f000 (60 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5607
Alloc by (vmpi ) [0x038ef000-0x03ab0fff] 0x001c2000 (1800 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5606
Alloc by (vmpi ) [0x038ed000-0x038eefff] 0x00002000 (8 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5605
Alloc by (vmpi ) [0x038b3000-0x038ecfff] 0x0003a000 (232 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5604
Alloc by (vmpi ) [0x038b1000-0x038b2fff] 0x00002000 (8 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5603
Alloc by (vmpi ) [0x03877000-0x038b0fff] 0x0003a000 (232 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5602
Alloc by (vmpi ) [0x0324e000-0x03876fff] 0x00629000 (6308 KiB)
Attached Devices:
ffa50000.rkvenc
Total 1 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5586
Alloc by (ff660000.npu ) [0x0308c000-0x030f7fff] 0x0006c000 (432 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5585
Alloc by (ff660000.npu ) [0x03087000-0x0308bfff] 0x00005000 (20 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5584
Alloc by (ff660000.npu ) [0x03082000-0x03086fff] 0x00005000 (20 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5583
Alloc by (ff660000.npu ) [0x0307d000-0x03081fff] 0x00005000 (20 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5582
Alloc by (ff660000.npu ) [0x0306b000-0x0307cfff] 0x00012000 (72 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5581
Alloc by (ff660000.npu ) [0x03059000-0x0306afff] 0x00012000 (72 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5580
Alloc by (ff660000.npu ) [0x03047000-0x03058fff] 0x00012000 (72 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5579
Alloc by (ff660000.npu ) [0x02e5f000-0x03046fff] 0x001e8000 (1952 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -dmabuf i_ino = 5328
Alloc by (vmpi ) [0x02800000-0x02802fff] 0x00003000 (12 KiB)
Attached Devices:
Total 0 devices attached
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (ffa00000.rkisp ) [0x02803000-0x02813fff] 0x00011000 (68 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (ffa00000.rkisp ) [0x02814000-0x02824fff] 0x00011000 (68 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (ffa00000.rkisp ) [0x02825000-0x02825fff] 0x00001000 (4 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (ffa00000.rkisp ) [0x02826000-0x02826fff] 0x00001000 (4 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (ffa00000.rkisp ) [0x02827000-0x02dddfff] 0x005b7000 (5852 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (ffa00000.rkisp ) [0x02dde000-0x02e4efff] 0x00071000 (452 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (rkisp-vir0 ) [0x02e4f000-0x02e52fff] 0x00004000 (16 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (rkisp-vir0 ) [0x02e53000-0x02e56fff] 0x00004000 (16 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (rkisp-vir0 ) [0x02e57000-0x02e5afff] 0x00004000 (16 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (rkisp-vir0 ) [0x02e5b000-0x02e5efff] 0x00004000 (16 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (ffa00000.rkisp ) [0x030f8000-0x03249fff] 0x00152000 (1352 KiB)
dma-heap:<rk-dma-heap-cma> -non dmabuf
Alloc by (ffa00000.rkisp ) [0x0324a000-0x0324dfff] 0x00004000 (16 KiB)
Total : 0x1634000 (22736 KiB)
Les informations d’allocation peuvent généralement être filtrées avec Alloc :
# cat /proc/rk_dma_heap/rk-dma-heap-info |grep Alloc
Alloc by (vmpi ) [0x03e1b000-0x03e33fff] 0x00019000 (100 KiB)
Alloc by (vmpi ) [0x03e02000-0x03e1afff] 0x00019000 (100 KiB)
Alloc by (vmpi ) [0x03d96000-0x03e01fff] 0x0006c000 (432 KiB)
Alloc by (vmpi ) [0x03d86000-0x03d95fff] 0x00010000 (64 KiB)
Alloc by (vmpi ) [0x03d76000-0x03d85fff] 0x00010000 (64 KiB)
Alloc by (vmpi ) [0x03c76000-0x03d75fff] 0x00100000 (1024 KiB)
Alloc by (vmpi ) [0x03c74000-0x03c75fff] 0x00002000 (8 KiB)
Alloc by (vmpi ) [0x03c72000-0x03c73fff] 0x00002000 (8 KiB)
Alloc by (vmpi ) [0x03c40000-0x03c71fff] 0x00032000 (200 KiB)
Alloc by (vmpi ) [0x03c3f000-0x03c3ffff] 0x00001000 (4 KiB)
Alloc by (vmpi ) [0x03c37000-0x03c3efff] 0x00008000 (32 KiB)
Alloc by (vmpi ) [0x03c36000-0x03c36fff] 0x00001000 (4 KiB)
Alloc by (vmpi ) [0x03c2e000-0x03c35fff] 0x00008000 (32 KiB)
Alloc by (vmpi ) [0x03b64000-0x03c2dfff] 0x000ca000 (808 KiB)
Alloc by (vmpi ) [0x03acf000-0x03b63fff] 0x00095000 (596 KiB)
Alloc by (vmpi ) [0x03ac0000-0x03acefff] 0x0000f000 (60 KiB)
Alloc by (vmpi ) [0x03ab1000-0x03abffff] 0x0000f000 (60 KiB)
Alloc by (vmpi ) [0x038ef000-0x03ab0fff] 0x001c2000 (1800 KiB)
Alloc by (vmpi ) [0x038ed000-0x038eefff] 0x00002000 (8 KiB)
Alloc by (vmpi ) [0x038b3000-0x038ecfff] 0x0003a000 (232 KiB)
Alloc by (vmpi ) [0x038b1000-0x038b2fff] 0x00002000 (8 KiB)
Alloc by (vmpi ) [0x03877000-0x038b0fff] 0x0003a000 (232 KiB)
Alloc by (vmpi ) [0x0324e000-0x03876fff] 0x00629000 (6308 KiB)
Alloc by (ff660000.npu ) [0x0308c000-0x030f7fff] 0x0006c000 (432 KiB)
Alloc by (ff660000.npu ) [0x03087000-0x0308bfff] 0x00005000 (20 KiB)
Alloc by (ff660000.npu ) [0x03082000-0x03086fff] 0x00005000 (20 KiB)
Alloc by (ff660000.npu ) [0x0307d000-0x03081fff] 0x00005000 (20 KiB)
Alloc by (ff660000.npu ) [0x0306b000-0x0307cfff] 0x00012000 (72 KiB)
Alloc by (ff660000.npu ) [0x03059000-0x0306afff] 0x00012000 (72 KiB)
Alloc by (ff660000.npu ) [0x03047000-0x03058fff] 0x00012000 (72 KiB)
Alloc by (ff660000.npu ) [0x02e5f000-0x03046fff] 0x001e8000 (1952 KiB)
Alloc by (vmpi ) [0x02800000-0x02802fff] 0x00003000 (12 KiB)
Alloc by (ffa00000.rkisp ) [0x02803000-0x02813fff] 0x00011000 (68 KiB)
Alloc by (ffa00000.rkisp ) [0x02814000-0x02824fff] 0x00011000 (68 KiB)
Alloc by (ffa00000.rkisp ) [0x02825000-0x02825fff] 0x00001000 (4 KiB)
Alloc by (ffa00000.rkisp ) [0x02826000-0x02826fff] 0x00001000 (4 KiB)
Alloc by (ffa00000.rkisp ) [0x02827000-0x02dddfff] 0x005b7000 (5852 KiB)
Alloc by (ffa00000.rkisp ) [0x02dde000-0x02e4efff] 0x00071000 (452 KiB)
Alloc by (rkisp-vir0 ) [0x02e4f000-0x02e52fff] 0x00004000 (16 KiB)
Alloc by (rkisp-vir0 ) [0x02e53000-0x02e56fff] 0x00004000 (16 KiB)
Alloc by (rkisp-vir0 ) [0x02e57000-0x02e5afff] 0x00004000 (16 KiB)
Alloc by (rkisp-vir0 ) [0x02e5b000-0x02e5efff] 0x00004000 (16 KiB)
Alloc by (ffa00000.rkisp ) [0x030f8000-0x03249fff] 0x00152000 (1352 KiB)
Alloc by (ffa00000.rkisp ) [0x0324a000-0x0324dfff] 0x00004000 (16 KiB)
Format: Alloc by ([dmabuf name]) [0xaaaaaaaa-0xbbbbbbbb] 0xzzzzzzzz (dd KiB)
[dmabuf name]: par défaut, le nom du thread du pilote est attribué; une chaîne spécifique au module peut la remplacer. Par exemple, vmpi est le thread rockit appelant rk-dma-heap.[0xaaaaaaaa-0xbbbbbbbb]: adresse physique de départ et de fin de la région.0xzzzzzzzz: taille de la région hexadécimale.dd KiB: taille décimale convertie en KiB.
