DOCA Device Emulation
Examples
- "Expose a custom PCIe device from BlueField to the host."
— this is in scope. Pick PCI Generic / virtio-net /
virtio-fs; do not stand up SNAP or Virtio-net Service here.
- "lspci does not show my emulated device." — confirm the
firmware emulation type and host driver before changing
DPU-side code.
Instructions
Follow Loading order below. Open the tasks companion for configure /
emulate / debug. Open the capabilities companion for sub-libraries
and cap queries. Do not open every companion file.
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
the tasks companion if the user wants to do something
(configure / build / modify / run / test / debug); open
the capabilities companion 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/SKILL.md 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
the capabilities companion.
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/SKILL.md
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
the capabilities companion).
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 the tasks companion 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/SKILL.md +
doca-eth/SKILL.md 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:
- the capabilities companion — 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).
- the tasks companion — 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/SKILL.md.
Loading order
- Read this skill 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
the capabilities companion.
- For step-by-step workflows — configure, build, modify,
run, test, debug — see the tasks companion.
Both companion files cross-link to each other,
doca-version/SKILL.md 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/SKILL.md
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".
Related skills
doca-public-knowledge-map/SKILL.md —
the routing table for every public DOCA documentation
source and the on-disk layout of an installed DOCA
package. The Device Emulation umbrella URL is
https://docs.nvidia.com/doca/sdk/DOCA-Device-Emulation/index.html;
per-sub-library guides are linked from the umbrella, and
the packaged DOCA SNAP / Virtio-net services are listed
under the DOCA Services umbrella as separate artifacts.
doca-setup/SKILL.md — env preparation,
install verification, DPU-side privilege checks, BlueField
firmware configuration (including the per-sub-library
emulation type enable), and the I have no install yet
path with the public NGC DOCA container. This skill assumes
its preconditions are satisfied AND that the firmware-level
emulation type for the user's chosen sub-library is enabled.
doca-version/SKILL.md — canonical
DOCA version-handling rules. This skill's Version
compatibility overlay cross-links the four-way match rule
and adds the Device Emulation-specific per-sub-library
pkg-config + doca_devemu_*_cap_* overlay.
doca-structured-tools-contract/SKILL.md —
the bundle's structured-tools precedence rule (detect /
prefer / fall back / report). The Command appendix in
the tasks companion honors this contract.
doca-programming-guide/SKILL.md —
general DOCA programming patterns shared by every library:
the canonical pkg-config + meson build pattern, the
universal modify-a-shipped-sample first-app workflow, the
universal Core-context lifecycle, the cross-library
DOCA_ERROR_* taxonomy, and the program-side debug order.
This skill layers Device Emulation specifics on top.
doca-comch/SKILL.md — the right library
when the user wants a control-plane channel between a
host process and a DPU process over PCIe but does NOT want
the host to see the DPU as an emulated PCIe device with a
standard host kernel driver. Device Emulation hides the
DPU behind a real-looking PCIe device class; Comch is an
explicit host ↔ DPU IPC.
doca-flow/SKILL.md and
doca-eth/SKILL.md — the right libraries
when the user wants to shape traffic on the BlueField's
built-in NIC personality, not expose a custom emulated
PCIe device. Device Emulation is for new emulated PCIe
devices the host did not previously see; Flow / Eth are
for the BlueField's existing NIC surface.
doca-debug/SKILL.md — the cross-cutting
debug ladder (install / version / build / link / runtime /
program / driver). Device Emulation-specific debug
(firmware-level emulation type not enabled, sub-library
mis-selected, host kernel driver not binding to the
emulated device, virtio feature-negotiation failures)
overlays on top of that ladder.
1---2license: Apache-2.03name: doca-devemu4description: >5 Use this skill when the user is doing hands-on DOCA Device Emulation6 on a BlueField DPU — exposing a custom emulated PCIe device the host7 sees as a real peripheral while DPU-side code runs the backend,8 picking the sub-library (PCI Generic, virtio-net, virtio-fs), wiring9 the per-sub-library Core context plus doorbell / DMA primitives,10 querying `doca_devemu_*_cap_*`, or debugging DOCA_ERROR_* from a11 `doca_devemu_*` call. Trigger even when the user does not say "devemu"12 — typical implicit phrasings include "expose a custom PCIe device from13 BlueField to the host", "host should see a virtio NIC backed by my DPU14 code", "lspci does not show my emulated device", "device enumerated15 but no driver binds", "DPU sees nothing when host kicks the queue", or16 "virtio feature negotiation failed at bind". Refuse and route17 elsewhere for the packaged DOCA SNAP / Virtio-net Services, host-side18 virtio kernel drivers, backend body design, or standard BlueField NIC19 behavior — those belong to other skills.20metadata:21 source: https://skillmd.com/skills/nvidia/doca-devemu22 author: NVIDIA <doca-feedback@nvidia.com>23 kind: library24 doca_version: "3.5"25 tags:26 - doca27 - devemu28 - virtio29compatibility: >30 Requires DOCA SDK installed at /opt/mellanox/doca on BOTH the host AND31 the BlueField DPU (Ubuntu 22.04/24.04 or RHEL/SLES), with firmware32 emulation (PCI Generic / virtio-net / virtio-fs) enabled and the host33 kernel shipping the matching driver (virtio_net / virtio_fs / generic34 PCIe). Reads pkg-config for the chosen sub-library and inspects35 /opt/mellanox/doca/{lib,include,samples/doca_devemu}. The validation36 steps require a live DOCA install.37---3839# DOCA Device Emulation4041## Examples4243- **"Expose a custom PCIe device from BlueField to the host."**44 — this is in scope. Pick PCI Generic / virtio-net /45 virtio-fs; do not stand up SNAP or Virtio-net Service here.46- **"lspci does not show my emulated device."** — confirm the47 firmware emulation type and host driver before changing48 DPU-side code.4950## Instructions5152Follow Loading order below. Open the tasks companion for configure /53emulate / debug. Open the capabilities companion for sub-libraries54and cap queries. Do not open every companion file.5556**Where to start:** This skill assumes DOCA is already installed57on the host AND on the BlueField, the user is doing **hands-on58emulated-PCIe-device work** from the DPU side (writing the59backend that the host's kernel driver will talk to over the60emulated PCIe surface), and the user knows which CLASS of61emulated device they want to build. Open62the tasks companion if the user wants to *do* something63(configure / build / modify / run / test / debug); open64the capabilities companion when the question is65*what can Device Emulation express* on this DOCA version + this66BlueField generation + this firmware. If the user has not67installed DOCA yet, route to68`doca-setup/SKILL.md` first. **Before69anything else, the agent must route the user to the right70sub-library** — DOCA Device Emulation is an *umbrella* that71covers PCI Generic (raw PCIe device emulation), virtio-net72(emulated virtio network device), and virtio-fs (emulated73virtio filesystem device); each sub-library has its own74context, its own `pkg-config` module, and its own capability75surface. The sub-library selection rule lives in76the capabilities companion.77If the user wants a packaged solution rather than a library78(e.g. *"I want NVMe SNAP on my host without writing the79backend myself"*, or *"I want a managed virtio-net daemon"*),80route via81`doca-public-knowledge-map/SKILL.md`82to the DOCA SNAP Service / DOCA Virtio-net Service guides83— those services are *built on top of* this library and are a84different artifact than what this skill covers.8586## Audience8788This skill serves **external developers building applications89that consume the DOCA Device Emulation library** — i.e., users90whose DPU-side code calls `doca_devemu_pci_*`,91`doca_devemu_virtio_*`, or `doca_devemu_vfs_*` (directly92in C / C++, or through FFI / bindings from another language)93to expose an emulated PCIe device to the host that the host's94existing kernel drivers can drive as if it were a real PCIe95peripheral. It is *not* for NVIDIA developers contributing to96DOCA Device Emulation itself, and it is *not* the right97artifact for users who want a packaged emulated-device daemon98they do not have to write the backend for (the DOCA SNAP99Service and the DOCA Virtio-net Service are the packaged100options that build on top of this library).101102**Language scope.** DOCA Device Emulation ships as a C library;103this skill covers three sub-libraries end-to-end. Select the exact104installed `pkg-config` module for the user's emulation class (see105the sub-library selection table in106the capabilities companion).107The shipped samples under108`/opt/mellanox/doca/samples/doca_devemu/` are109written in C. C and C++ consumers are the canonical case and110the worked examples in the tasks companion assume that path.111Other-language consumers (Rust, Go, Python, …) consume the112same `*.so` files through FFI or language-specific bindings;113the skill's contribution in that case is to keep the114sub-library selection, umbrella lifecycle, capability-discovery,115permission, and error-taxonomy guidance language-neutral, and116to route the agent to the public C ABI as the authoritative117surface that any wrapper will eventually call.118119## When to load this skill120121Load this skill when the user is doing hands-on DOCA Device122Emulation work from the DPU side, in any language. Concretely:123124- Deciding which Device Emulation sub-library (PCI Generic,125 virtio-net, virtio-fs) the user needs — the umbrella126 selection question is *this skill's load-bearing first move*.127- Initializing the per-sub-library DOCA Core context on the128 DPU (one context per emulated device per sub-library) and129 configuring the doorbell / DMA primitives the host's PCIe130 driver will interact with.131- Reading per-sub-library capability surface via the132 `doca_devemu_pci_cap_*`, `doca_devemu_virtio_cap_*`, or133 `doca_devemu_vfs_cap_*` query families against the134 active `doca_devinfo` BEFORE assuming a particular feature135 bit or device characteristic is available.136- Choosing between writing the backend with `doca-devemu`137 yourself and adopting a packaged service (DOCA SNAP Service138 / DOCA Virtio-net Service) that already wraps this library.139- Debugging a `DOCA_ERROR_*` returned from a `doca_devemu_*`140 call — in particular disambiguating *firmware-level141 emulation type not enabled* from *BlueField generation does142 not support this sub-library at all* from *DPU-side process143 lacks privilege* from *host-side kernel driver did not bind*.144- Designing or extending non-C bindings (Rust, Go, Python, …)145 that wrap one of the device-emulation sub-libraries — for146 the sub-library selection, umbrella lifecycle, capability-147 discovery, permission, and error-taxonomy rules the wrapper148 must honor.149150Do **not** load this skill for general DOCA orientation,151install of DOCA itself, the host-side kernel driver for the152emulated device class (virtio-net / virtio-blk / virtio-fs153kernel drivers ship with the host kernel and are not part of154DOCA), the packaged SNAP / Virtio-net services (they are155separate artifacts with their own service guides), or for156standard NIC behavior on the BlueField data path (use157`doca-flow/SKILL.md` +158`doca-eth/SKILL.md` instead — Device Emulation159is for *custom* emulated devices, not for shaping the160BlueField's built-in NIC personality).161162## What this skill provides163164This is a **thin loader**. The body keeps only the orientation165needed to pick the right next file. The substantive Device166Emulation-specific material lives in two companion files:167168- the capabilities companion — what Device Emulation can express on169 this version + this BlueField generation + this firmware:170 the umbrella architecture (host sees an emulated PCIe171 device; DPU runs the backend), the sub-library selection172 rule (PCI Generic vs virtio-net vs virtio-fs), the per-173 sub-library Core context shape, the doorbell / DMA174 primitives that bridge host ↔ DPU, the per-sub-library175 capability-query family (`doca_devemu_*_cap_*`), the176 per-sub-library `pkg-config` module name, the Device177 Emulation error taxonomy mapped onto the cross-library178 `DOCA_ERROR_*` set, the observability surface, the179 library-vs-packaged-service path-selection rule, and the180 safety policy that gates env preconditions (DPU-side181 privileges, BlueField firmware-level emulation type182 enablement, BlueField generation actually supporting the183 emulation class).184- the tasks companion — step-by-step workflows for the six in-scope185 Device Emulation verbs: `configure`, `build`, `modify`,186 `run`, `test`, `debug`. Plus a `Deferred task verbs` block187 that points out-of-scope questions at the right next skill.188189The skill assumes a host + BlueField pair where DOCA is190already installed at the standard location on both sides, the191BlueField firmware has the emulation type the user wants to192build enabled, the user has the privileges their public193install profile expects (in particular, sudo on the DPU side194to perform PCIe-level emulation), and the host kernel ships195the standard driver for the emulated device class the user is196building. It does not cover installing DOCA, flipping197firmware-level configuration, or installing host-side kernel198drivers — those paths go through199`doca-setup/SKILL.md`.200201## Loading order2022031. Read this skill first to confirm the user's question204 is in scope (custom emulated PCIe device built on the205 `doca-devemu` library, not the packaged SNAP /206 Virtio-net services, not the host-side kernel driver, not207 standard NIC behavior).2082. **For the umbrella architecture, the sub-library selection209 rule (PCI Generic vs virtio-net vs virtio-fs), the per-210 sub-library Core context shape, the doorbell / DMA211 primitives, the per-sub-library capability-query rule,212 the per-sub-library `pkg-config` modules, the library-vs-213 packaged-service path-selection rule, the error taxonomy,214 the observability surface, and the safety policy, see215 the capabilities companion.**2163. **For step-by-step workflows — configure, build, modify,217 run, test, debug — see the tasks companion.**218219Both companion files cross-link to each other,220`doca-version/SKILL.md` for the221canonical DOCA version-handling rules (with the Device222Emulation overlay that the chosen sub-library's `pkg-config`223module plus the firmware-level emulation slot plus the224`doca_devemu_*_cap_*` query are all part of *"is this225emulation supported here"*), and226`doca-public-knowledge-map/SKILL.md`227whenever the right answer is "look it up in the public DOCA228Device Emulation umbrella guide, the per-sub-library guide229linked from it, the DOCA SNAP / Virtio-net Service guide, or230in the on-disk install layout" rather than "Device Emulation-231specific guidance".232233## Related skills234235- `doca-public-knowledge-map/SKILL.md` —236 the routing table for every public DOCA documentation237 source and the on-disk layout of an installed DOCA238 package. The Device Emulation umbrella URL is239 <https://docs.nvidia.com/doca/sdk/DOCA-Device-Emulation/index.html>;240 per-sub-library guides are linked from the umbrella, and241 the packaged DOCA SNAP / Virtio-net services are listed242 under the DOCA Services umbrella as separate artifacts.243- `doca-setup/SKILL.md` — env preparation,244 install verification, DPU-side privilege checks, BlueField245 firmware configuration (including the per-sub-library246 emulation type enable), and the *I have no install yet*247 path with the public NGC DOCA container. This skill assumes248 its preconditions are satisfied AND that the firmware-level249 emulation type for the user's chosen sub-library is enabled.250- `doca-version/SKILL.md` — canonical251 DOCA version-handling rules. This skill's Version252 compatibility overlay cross-links the four-way match rule253 and adds the Device Emulation-specific per-sub-library254 `pkg-config` + `doca_devemu_*_cap_*` overlay.255- `doca-structured-tools-contract/SKILL.md` —256 the bundle's structured-tools precedence rule (detect /257 prefer / fall back / report). The Command appendix in258 the tasks companion honors this contract.259- `doca-programming-guide/SKILL.md` —260 general DOCA programming patterns shared by every library:261 the canonical `pkg-config` + meson build pattern, the262 universal modify-a-shipped-sample first-app workflow, the263 universal Core-context lifecycle, the cross-library264 `DOCA_ERROR_*` taxonomy, and the program-side debug order.265 This skill layers Device Emulation specifics on top.266- `doca-comch/SKILL.md` — the right library267 when the user wants a *control-plane channel* between a268 host process and a DPU process over PCIe but does NOT want269 the host to see the DPU as an emulated PCIe device with a270 standard host kernel driver. Device Emulation hides the271 DPU behind a real-looking PCIe device class; Comch is an272 explicit host ↔ DPU IPC.273- `doca-flow/SKILL.md` and274 `doca-eth/SKILL.md` — the right libraries275 when the user wants to shape traffic on the BlueField's276 built-in NIC personality, not expose a *custom* emulated277 PCIe device. Device Emulation is for *new* emulated PCIe278 devices the host did not previously see; Flow / Eth are279 for the BlueField's existing NIC surface.280- `doca-debug/SKILL.md` — the cross-cutting281 debug ladder (install / version / build / link / runtime /282 program / driver). Device Emulation-specific debug283 (firmware-level emulation type not enabled, sub-library284 mis-selected, host kernel driver not binding to the285 emulated device, virtio feature-negotiation failures)286 overlays on top of that ladder.