Qualcomm CDI generator
Tooling to generate CDI config files to pass devices through to containers
main: Primary development branch. Contributors should develop submissions based on this branch, and submit pull requests to this branch.
The main tool only requires python3 to generate a CDI. To consume it, you need a container runtime like podman or docker.
Recent versions of Podman (5.6.x) and Docker (28.3.x) work out of the box, for earlier Docker versions (26.x) you'll need a /etc/docker/daemon.json file:
{
"features": {
"cdi": true
},
"cdi-spec-dirs": ["/etc/cdi/", "/run/cdi"]
}For Docker 28.0.x only the feature enablement is needed:
{
"features": {
"cdi": true
}
}Either restart the docker daemon or reboot to have this config take effect.
Copy over qualcomm-cdi-generator.py
On the target run the CDI generator:
# mkdir -p /run/cdi
# qualcomm-cdi-generator.pyExample session:
root@qcs6490-rb3gen2-core-kit:~# mkdir -p /run/cdi
root@qcs6490-rb3gen2-core-kit:~# ./qualcomm-cdi-generator.py
{'name': 'renderD128', 'containerEdits': {'deviceNodes': [{'path': '/dev/dri/renderD128'}]}}
{'name': 'video0', 'containerEdits': {'deviceNodes': [{'path': '/dev/video0'}]}}
{'name': 'video1', 'containerEdits': {'deviceNodes': [{'path': '/dev/video1'}]}}
{'name': 'dmaheap-system', 'containerEdits': {'deviceNodes': [{'path': '/dev/dma_heap/system'}]}}
{'name': 'fastrpc-cdsp', 'containerEdits': {'deviceNodes': [{'path': '/dev/fastrpc-cdsp'}]}}
root@qcs6490-rb3gen2-core-kit:~# docker info
[...]
Server:
CDI spec directories:
/etc/cdi
/var/run/cdi
Discovered Devices:
cdi: qualcomm.com/device=dmaheap-system
cdi: qualcomm.com/device=dmaheap-system:all
cdi: qualcomm.com/device=fastrpc-cdsp
cdi: qualcomm.com/device=fastrpc-cdsp:all
cdi: qualcomm.com/device=renderD128
cdi: qualcomm.com/device=renderD:all
cdi: qualcomm.com/device=video0
cdi: qualcomm.com/device=video1
cdi: qualcomm.com/device=video:all
[...]You can then pass one or more of the above entries to the runtime:
root@qcs6490-rb3gen2-core-kit:~# docker run --device qualcomm.com/gpu=render0 --device qualcomm.com/gpu=video:all [..]The resulting CDI from the above session:
{
"cdiVersion": "0.6.0",
"kind": "qualcomm.com/device",
"devices": [
{
"name": "renderD128",
"containerEdits": {
"deviceNodes": [
{ "path": "/dev/dri/renderD128" }
]
}
},
{
"name": "renderD:all",
"containerEdits": {
"deviceNodes": [
{ "path": "/dev/dri/renderD128" }
]
}
},
{
"name": "video0",
"containerEdits": {
"deviceNodes": [
{ "path": "/dev/video0" }
]
}
},
{
"name": "video1",
"containerEdits": {
"deviceNodes": [
{ "path": "/dev/video1" }
]
}
},
{
"name": "video:all",
"containerEdits": {
"deviceNodes": [
{ "path": "/dev/video0" },
{ "path": "/dev/video1" }
]
}
},
{
"name": "dmaheap-system",
"containerEdits": {
"deviceNodes": [
{ "path": "/dev/dma_heap/system" }
]
}
},
{
"name": "dmaheap-system:all",
"containerEdits": {
"deviceNodes": [
{ "path": "/dev/dma_heap/system" }
]
}
},
{
"name": "fastrpc-cdsp",
"containerEdits": {
"deviceNodes": [
{ "path": "/dev/fastrpc-cdsp" }
]
}
},
{
"name": "fastrpc-cdsp:all",
"containerEdits": {
"deviceNodes": [
{ "path": "/dev/fastrpc-cdsp" }
]
}
}
],
"containerEdits": {
"hooks": [
{ "hookname": "createContainer", "path": "/bin/vendor-hook" }
]
}
}How to develop new features/fixes for the software. Maybe different than "usage". Also provide details on how to contribute via a CONTRIBUTING.md file.
How to contact maintainers. E.g. GitHub Issues, GitHub Discussions could be indicated for many cases. However a mail list or list of Maintainer e-mails could be shared for other types of discussions. E.g.
Qualcomm CDI generator is licensed under the BSD-3-clause License. See LICENSE.txt for the full license text.