DOCA Device Emulation
Where to start: This skill assumes DOCA is already installed
on the host AND on the BlueField, the user is doing hands-on
emulated-PCIe-device work from the DPU side (writing the
backend that the host's kernel driver will talk to over the
emulated PCIe surface), and the user knows which CLASS of
emulated device they want to build. Open
TASKS.md if the user wants to do something
(configure / build / modify / run / test / debug); open
CAPABILITIES.md when the question is
what can Device Emulation express on this DOCA version + this
BlueField generation + this firmware. If the user has not
installed DOCA yet, route to
doca-setup first. Before
anything else, the agent must route the user to the right
sub-library — DOCA Device Emulation is an umbrella that
covers PCI Generic (raw PCIe device emulation), virtio-net
(emulated virtio network device), and virtio-fs (emulated
virtio filesystem device); each sub-library has its own
context, its own pkg-config module, and its own capability
surface. The sub-library selection rule lives in
CAPABILITIES.md ## Capabilities and modes.
If the user wants a packaged solution rather than a library
(e.g. "I want NVMe SNAP on my host without writing the
backend myself", or "I want a managed virtio-net daemon"),
route via
doca-public-knowledge-map
to the DOCA SNAP Service / DOCA Virtio-net Service guides
— those services are built on top of this library and are a
different artifact than what this skill covers.
Audience
This skill serves external developers building applications
that consume the DOCA Device Emulation library — i.e., users
whose DPU-side code calls doca_devemu_pci_*,
doca_devemu_virtio_*, or doca_devemu_vfs_* (directly
in C / C++, or through FFI / bindings from another language)
to expose an emulated PCIe device to the host that the host's
existing kernel drivers can drive as if it were a real PCIe
peripheral. It is not for NVIDIA developers contributing to
DOCA Device Emulation itself, and it is not the right
artifact for users who want a packaged emulated-device daemon
they do not have to write the backend for (the DOCA SNAP
Service and the DOCA Virtio-net Service are the packaged
options that build on top of this library).
Language scope. DOCA Device Emulation ships as a C library;
this skill covers three sub-libraries end-to-end. Select the exact
installed pkg-config module for the user's emulation class (see
the sub-library selection table in
CAPABILITIES.md ## Capabilities and modes).
The shipped samples under
/opt/mellanox/doca/samples/doca_devemu/ are
written in C. C and C++ consumers are the canonical case and
the worked examples in TASKS.md assume that path.
Other-language consumers (Rust, Go, Python, …) consume the
same *.so files through FFI or language-specific bindings;
the skill's contribution in that case is to keep the
sub-library selection, umbrella lifecycle, capability-discovery,
permission, and error-taxonomy guidance language-neutral, and
to route the agent to the public C ABI as the authoritative
surface that any wrapper will eventually call.
When to load this skill
Load this skill when the user is doing hands-on DOCA Device
Emulation work from the DPU side, in any language. Concretely:
- Deciding which Device Emulation sub-library (PCI Generic,
virtio-net, virtio-fs) the user needs — the umbrella
selection question is this skill's load-bearing first move.
- Initializing the per-sub-library DOCA Core context on the
DPU (one context per emulated device per sub-library) and
configuring the doorbell / DMA primitives the host's PCIe
driver will interact with.
- Reading per-sub-library capability surface via the
doca_devemu_pci_cap_*, doca_devemu_virtio_cap_*, or
doca_devemu_vfs_cap_* query families against the
active doca_devinfo BEFORE assuming a particular feature
bit or device characteristic is available.
- Choosing between writing the backend with
doca-devemu
yourself and adopting a packaged service (DOCA SNAP Service
/ DOCA Virtio-net Service) that already wraps this library.
- Debugging a
DOCA_ERROR_* returned from a doca_devemu_*
call — in particular disambiguating firmware-level
emulation type not enabled from BlueField generation does
not support this sub-library at all from DPU-side process
lacks privilege from host-side kernel driver did not bind.
- Designing or extending non-C bindings (Rust, Go, Python, …)
that wrap one of the device-emulation sub-libraries — for
the sub-library selection, umbrella lifecycle, capability-
discovery, permission, and error-taxonomy rules the wrapper
must honor.
Do not load this skill for general DOCA orientation,
install of DOCA itself, the host-side kernel driver for the
emulated device class (virtio-net / virtio-blk / virtio-fs
kernel drivers ship with the host kernel and are not part of
DOCA), the packaged SNAP / Virtio-net services (they are
separate artifacts with their own service guides), or for
standard NIC behavior on the BlueField data path (use
doca-flow +
doca-eth instead — Device Emulation
is for custom emulated devices, not for shaping the
BlueField's built-in NIC personality).
What this skill provides
This is a thin loader. The body keeps only the orientation
needed to pick the right next file. The substantive Device
Emulation-specific material lives in two companion files:
CAPABILITIES.md — what Device Emulation can express on
this version + this BlueField generation + this firmware:
the umbrella architecture (host sees an emulated PCIe
device; DPU runs the backend), the sub-library selection
rule (PCI Generic vs virtio-net vs virtio-fs), the per-
sub-library Core context shape, the doorbell / DMA
primitives that bridge host ↔ DPU, the per-sub-library
capability-query family (doca_devemu_*_cap_*), the
per-sub-library pkg-config module name, the Device
Emulation error taxonomy mapped onto the cross-library
DOCA_ERROR_* set, the observability surface, the
library-vs-packaged-service path-selection rule, and the
safety policy that gates env preconditions (DPU-side
privileges, BlueField firmware-level emulation type
enablement, BlueField generation actually supporting the
emulation class).
TASKS.md — step-by-step workflows for the six in-scope
Device Emulation verbs: configure, build, modify,
run, test, debug. Plus a Deferred task verbs block
that points out-of-scope questions at the right next skill.
The skill assumes a host + BlueField pair where DOCA is
already installed at the standard location on both sides, the
BlueField firmware has the emulation type the user wants to
build enabled, the user has the privileges their public
install profile expects (in particular, sudo on the DPU side
to perform PCIe-level emulation), and the host kernel ships
the standard driver for the emulated device class the user is
building. It does not cover installing DOCA, flipping
firmware-level configuration, or installing host-side kernel
drivers — those paths go through
doca-setup.
Loading order
- Read this
SKILL.md first to confirm the user's question
is in scope (custom emulated PCIe device built on the
doca-devemu library, not the packaged SNAP /
Virtio-net services, not the host-side kernel driver, not
standard NIC behavior).
- For the umbrella architecture, the sub-library selection
rule (PCI Generic vs virtio-net vs virtio-fs), the per-
sub-library Core context shape, the doorbell / DMA
primitives, the per-sub-library capability-query rule,
the per-sub-library
pkg-config modules, the library-vs-
packaged-service path-selection rule, the error taxonomy,
the observability surface, and the safety policy, see
CAPABILITIES.md.
- For step-by-step workflows — configure, build, modify,
run, test, debug — see TASKS.md.
Both companion files cross-link to each other,
doca-version for the
canonical DOCA version-handling rules (with the Device
Emulation overlay that the chosen sub-library's pkg-config
module plus the firmware-level emulation slot plus the
doca_devemu_*_cap_* query are all part of "is this
emulation supported here"), and
doca-public-knowledge-map
whenever the right answer is "look it up in the public DOCA
Device Emulation umbrella guide, the per-sub-library guide
linked from it, the DOCA SNAP / Virtio-net Service guide, or
in the on-disk install layout" rather than "Device Emulation-
specific guidance".
Example questions this skill answers well
See references/details.md.
What this skill deliberately does not ship
See references/details.md.
Related skills
See references/details.md.
1---2name: doca-devemu3description: Use this skill when the user is doing hands-on DOCA Device Emulation on a BlueField DPU — exposing a custom emulated PCIe device the host sees as a real peripheral while DPU-side code runs the backend, picking the sub-library (PCI Generic, virtio-net, virtio-fs), wiring the per-sub-library Core context plus doorbell / DMA primitives, querying `doca_devemu_*_cap_*`, or debugging DOCA_ERROR_* from a `doca_devemu_*` call. Trigger even when the user does not say "devemu" — typical implicit phrasings include "expose a custom PCIe device from BlueField to the host", "host should see a virtio NIC backed by my DPU code", "lspci does not show my emulated device", "device enumerated but no driver binds", "DPU sees nothing when host kicks the queue", or "virtio feature negotiation failed at bind". Refuse and route elsewhere for the packaged DOCA SNAP / Virtio-net Services, host-side virtio kernel drivers, backend body design, or standard BlueField NIC behavior — those belong to other skills.4license: Apache-2.05---67# DOCA Device Emulation89**Where to start:** This skill assumes DOCA is already installed10on the host AND on the BlueField, the user is doing **hands-on11emulated-PCIe-device work** from the DPU side (writing the12backend that the host's kernel driver will talk to over the13emulated PCIe surface), and the user knows which CLASS of14emulated device they want to build. Open15[`TASKS.md`](TASKS.md) if the user wants to *do* something16(configure / build / modify / run / test / debug); open17[`CAPABILITIES.md`](CAPABILITIES.md) when the question is18*what can Device Emulation express* on this DOCA version + this19BlueField generation + this firmware. If the user has not20installed DOCA yet, route to21[`doca-setup`](../../doca-setup/SKILL.md) first. **Before22anything else, the agent must route the user to the right23sub-library** — DOCA Device Emulation is an *umbrella* that24covers PCI Generic (raw PCIe device emulation), virtio-net25(emulated virtio network device), and virtio-fs (emulated26virtio filesystem device); each sub-library has its own27context, its own `pkg-config` module, and its own capability28surface. The sub-library selection rule lives in29[`CAPABILITIES.md ## Capabilities and modes`](CAPABILITIES.md#capabilities-and-modes).30If the user wants a packaged solution rather than a library31(e.g. *"I want NVMe SNAP on my host without writing the32backend myself"*, or *"I want a managed virtio-net daemon"*),33route via34[`doca-public-knowledge-map`](../../doca-public-knowledge-map/SKILL.md)35to the DOCA SNAP Service / DOCA Virtio-net Service guides36— those services are *built on top of* this library and are a37different artifact than what this skill covers.3839## Audience4041This skill serves **external developers building applications42that consume the DOCA Device Emulation library** — i.e., users43whose DPU-side code calls `doca_devemu_pci_*`,44`doca_devemu_virtio_*`, or `doca_devemu_vfs_*` (directly45in C / C++, or through FFI / bindings from another language)46to expose an emulated PCIe device to the host that the host's47existing kernel drivers can drive as if it were a real PCIe48peripheral. It is *not* for NVIDIA developers contributing to49DOCA Device Emulation itself, and it is *not* the right50artifact for users who want a packaged emulated-device daemon51they do not have to write the backend for (the DOCA SNAP52Service and the DOCA Virtio-net Service are the packaged53options that build on top of this library).5455**Language scope.** DOCA Device Emulation ships as a C library;56this skill covers three sub-libraries end-to-end. Select the exact57installed `pkg-config` module for the user's emulation class (see58the sub-library selection table in59[`CAPABILITIES.md ## Capabilities and modes`](CAPABILITIES.md#capabilities-and-modes)).60The shipped samples under61`/opt/mellanox/doca/samples/doca_devemu/` are62written in C. C and C++ consumers are the canonical case and63the worked examples in `TASKS.md` assume that path.64Other-language consumers (Rust, Go, Python, …) consume the65same `*.so` files through FFI or language-specific bindings;66the skill's contribution in that case is to keep the67sub-library selection, umbrella lifecycle, capability-discovery,68permission, and error-taxonomy guidance language-neutral, and69to route the agent to the public C ABI as the authoritative70surface that any wrapper will eventually call.7172## When to load this skill7374Load this skill when the user is doing hands-on DOCA Device75Emulation work from the DPU side, in any language. Concretely:7677- Deciding which Device Emulation sub-library (PCI Generic,78 virtio-net, virtio-fs) the user needs — the umbrella79 selection question is *this skill's load-bearing first move*.80- Initializing the per-sub-library DOCA Core context on the81 DPU (one context per emulated device per sub-library) and82 configuring the doorbell / DMA primitives the host's PCIe83 driver will interact with.84- Reading per-sub-library capability surface via the85 `doca_devemu_pci_cap_*`, `doca_devemu_virtio_cap_*`, or86 `doca_devemu_vfs_cap_*` query families against the87 active `doca_devinfo` BEFORE assuming a particular feature88 bit or device characteristic is available.89- Choosing between writing the backend with `doca-devemu`90 yourself and adopting a packaged service (DOCA SNAP Service91 / DOCA Virtio-net Service) that already wraps this library.92- Debugging a `DOCA_ERROR_*` returned from a `doca_devemu_*`93 call — in particular disambiguating *firmware-level94 emulation type not enabled* from *BlueField generation does95 not support this sub-library at all* from *DPU-side process96 lacks privilege* from *host-side kernel driver did not bind*.97- Designing or extending non-C bindings (Rust, Go, Python, …)98 that wrap one of the device-emulation sub-libraries — for99 the sub-library selection, umbrella lifecycle, capability-100 discovery, permission, and error-taxonomy rules the wrapper101 must honor.102103Do **not** load this skill for general DOCA orientation,104install of DOCA itself, the host-side kernel driver for the105emulated device class (virtio-net / virtio-blk / virtio-fs106kernel drivers ship with the host kernel and are not part of107DOCA), the packaged SNAP / Virtio-net services (they are108separate artifacts with their own service guides), or for109standard NIC behavior on the BlueField data path (use110[`doca-flow`](../doca-flow/SKILL.md) +111[`doca-eth`](../doca-eth/SKILL.md) instead — Device Emulation112is for *custom* emulated devices, not for shaping the113BlueField's built-in NIC personality).114115## What this skill provides116117This is a **thin loader**. The body keeps only the orientation118needed to pick the right next file. The substantive Device119Emulation-specific material lives in two companion files:120121- `CAPABILITIES.md` — what Device Emulation can express on122 this version + this BlueField generation + this firmware:123 the umbrella architecture (host sees an emulated PCIe124 device; DPU runs the backend), the sub-library selection125 rule (PCI Generic vs virtio-net vs virtio-fs), the per-126 sub-library Core context shape, the doorbell / DMA127 primitives that bridge host ↔ DPU, the per-sub-library128 capability-query family (`doca_devemu_*_cap_*`), the129 per-sub-library `pkg-config` module name, the Device130 Emulation error taxonomy mapped onto the cross-library131 `DOCA_ERROR_*` set, the observability surface, the132 library-vs-packaged-service path-selection rule, and the133 safety policy that gates env preconditions (DPU-side134 privileges, BlueField firmware-level emulation type135 enablement, BlueField generation actually supporting the136 emulation class).137- `TASKS.md` — step-by-step workflows for the six in-scope138 Device Emulation verbs: `configure`, `build`, `modify`,139 `run`, `test`, `debug`. Plus a `Deferred task verbs` block140 that points out-of-scope questions at the right next skill.141142The skill assumes a host + BlueField pair where DOCA is143already installed at the standard location on both sides, the144BlueField firmware has the emulation type the user wants to145build enabled, the user has the privileges their public146install profile expects (in particular, sudo on the DPU side147to perform PCIe-level emulation), and the host kernel ships148the standard driver for the emulated device class the user is149building. It does not cover installing DOCA, flipping150firmware-level configuration, or installing host-side kernel151drivers — those paths go through152[`doca-setup`](../../doca-setup/SKILL.md).153154## Loading order1551561. Read this `SKILL.md` first to confirm the user's question157 is in scope (custom emulated PCIe device built on the158 `doca-devemu` library, not the packaged SNAP /159 Virtio-net services, not the host-side kernel driver, not160 standard NIC behavior).1612. **For the umbrella architecture, the sub-library selection162 rule (PCI Generic vs virtio-net vs virtio-fs), the per-163 sub-library Core context shape, the doorbell / DMA164 primitives, the per-sub-library capability-query rule,165 the per-sub-library `pkg-config` modules, the library-vs-166 packaged-service path-selection rule, the error taxonomy,167 the observability surface, and the safety policy, see168 [CAPABILITIES.md](CAPABILITIES.md).**1693. **For step-by-step workflows — configure, build, modify,170 run, test, debug — see [TASKS.md](TASKS.md).**171172Both companion files cross-link to each other,173[`doca-version`](../../doca-version/SKILL.md) for the174canonical DOCA version-handling rules (with the Device175Emulation overlay that the chosen sub-library's `pkg-config`176module plus the firmware-level emulation slot plus the177`doca_devemu_*_cap_*` query are all part of *"is this178emulation supported here"*), and179[`doca-public-knowledge-map`](../../doca-public-knowledge-map/SKILL.md)180whenever the right answer is "look it up in the public DOCA181Device Emulation umbrella guide, the per-sub-library guide182linked from it, the DOCA SNAP / Virtio-net Service guide, or183in the on-disk install layout" rather than "Device Emulation-184specific guidance".185186## Example questions this skill answers well187188See [`references/details.md`](references/details.md#example-questions-this-skill-answers-well).189## What this skill deliberately does not ship190191See [`references/details.md`](references/details.md#what-this-skill-deliberately-does-not-ship).192## Related skills193194See [`references/details.md`](references/details.md#related-skills).