Generated banner for Doca Devemu
Generated logo for Doca Devemu

Doca Devemu

NVIDIAOfficialCreated by NVIDIA

  • Skill
  • Tool integration
  • Software development
  • Apache-2.0
  • Medium risk

From the author

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.
— the description by NVIDIA

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The doca-devemu skill assists developers in building custom PCIe devices that appear as real peripherals to a host system, while the backend logic runs on a BlueField DPU. It covers the three primary sub-libraries: PCI Generic, virtio-net, and virtio-fs. The skill helps users navigate the lifecycle of emulated devices, including sub-library selection, capability discovery, context initialization, and debugging errors returned by the DOCA Device Emulation API. It is designed for developers writing their own DPU-side backends, rather than those using pre-packaged services like DOCA SNAP.

What it does

  • Guides sub-library selection between PCI Generic, virtio-net, and virtio-fs.
  • Assists with initializing DOCA Core contexts and configuring doorbell/DMA primitives.
  • Provides methods for querying device capabilities via doca_devemu_*_cap_* functions.
  • Helps debug DOCA_ERROR_* codes specific to device emulation.
  • Clarifies the distinction between custom library development and packaged DOCA services.
  • Supports developers working in C/C++ or other languages via FFI.

When to use it

  • When you need to expose a custom PCIe device from a BlueField DPU to a host.
  • When you are writing a DPU-side backend for a virtio-net or virtio-fs device.
  • When you need to verify if your BlueField firmware and DOCA version support a specific emulation class.
  • When you encounter errors during device emulation initialization or feature negotiation.
  • When you need to determine if a custom backend is required or if a packaged DOCA service suffices.

Advantages

  • Provides a clear path for selecting the correct emulation sub-library.
  • Simplifies the complex process of bridging host-side PCIe drivers with DPU-side logic.
  • Offers structured debugging steps for firmware and driver-level issues.
  • Ensures developers follow correct capability discovery patterns before implementation.

Usage examples

“Expose a custom PCIe device from BlueField to the host.”
The agent will guide you through selecting the appropriate sub-library (PCI Generic, virtio-net, or virtio-fs) and initializing the corresponding DOCA Core context.
“lspci does not show my emulated device.”
The agent will help you verify the firmware-level emulation configuration and ensure the host-side kernel driver is correctly bound to the emulated device.
“Why does my virtio-net emulation create call return DOCA_ERROR_NOT_PERMITTED?”
The agent will check if the virtio-net emulation slot is enabled in the BlueField firmware and verify DPU-side process privileges.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/nvidia/doca-devemu/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip doca-devemu.zip -d .agents/skills

Documentation by NVIDIA

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

  1. 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).

  2. 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.

  3. 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".

  • 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.

Files

CAPABILITIES.md

DOCA Device Emulation capabilities, version overlay, errors, observability, safety

Where to start: Pick the H2 anchor that matches your question (umbrella architecture / sub-library selection / per-sub-library Core context / capability discovery / version / errors / safety) and read that section end-to-end. The tables in each section are the load-bearing content; the prose around them is interpretation.

Read this file when the loader sent you here from SKILL.md. For the how of executing each pattern (the verbs configure / build / modify / run / test / debug), jump to TASKS.md. For the canonical DOCA version-handling rules that this skill layers a Device Emulation overlay on top of, see doca-version/SKILL.md. For the host-side kernel driver layer that consumes the emulated PCIe device, route via doca-public-knowledge-map/SKILL.md to the upstream Linux kernel virtio / PCIe documentation — the host kernel driver layer is not part of DOCA and is not re-explained here.

Pattern overview

Every Device Emulation question this skill teaches resolves into one of SEVEN patterns. The patterns are CLASSES — they apply across every Device Emulation release and every BlueField generation + firmware combination, not just the worked examples shown.

PatternWhen it applies (class shape)Where the substance lives
1. Pick the right sub-library FIRSTDecide which Device Emulation sub-library matches the emulated PCIe class the user is building. This skill covers PCI Generic, virtio-net, and virtio-fs end-to-end. For any other installed Device Emulation surface, enumerate the exact pkg-config modules and public headers on that install and route to its verified public guide or packaged service; do not synthesize a shorthand module, symbol family, or source-tree path.## Capabilities and modes sub-library selection table + TASKS.md ## configure step 1
2. Confirm the umbrella architecture is the right shapeThe host must be able to load a kernel driver for the emulated device class; the DPU must be able to run the backend as a user-space DOCA program — Device Emulation is not the answer when standard NIC behavior is enough or when the user wants a packaged service## Capabilities and modes umbrella architecture + path-selection rules
3. Stand up the per-sub-library Core contextDOCA Core lifecycle for the chosen sub-library: one context per emulated device per sub-library; configure → start → host driver attaches → use → stop → destroy## Capabilities and modes per-sub-library context shape + TASKS.md ## configure step 4
4. Discover per-sub-library capabilitiesQuery the matching doca_devemu_<sub>_cap_* family against the active doca_devinfo BEFORE assuming a feature bit or device characteristic is available; sub-libraries do not share capability surfaces## Capabilities and modes capability-query rule + TASKS.md ## configure step 3
5. Honor dual-axis env preconditionsDPU-side privileges to perform PCIe-level emulation (typically sudo) AND BlueField firmware-level enablement of the specific emulation type the user wants; both must be true before any doca_devemu_* create call## Safety policy env-precondition matrix + TASKS.md ## configure step 2
6. Diagnose a Device Emulation errorMap DOCA_ERROR_NOT_SUPPORTED / _NOT_PERMITTED / _BAD_STATE / _INVALID_VALUE / _IO_FAILED to a root cause without leaving the Device Emulation layer prematurely## Error taxonomy + TASKS.md ## debug

Two cross-cutting rules that apply to every pattern above:

  • Sub-library selection precedes everything. "Use DOCA Device Emulation" is not actionable on its own — the API surface, the pkg-config module, the capability-query family, the sample tree under /opt/mellanox/doca/samples/doca_devemu/, and the firmware-level enablement axis ALL depend on whether the user is building a PCI Generic device, a virtio-net device, or a virtio-fs device. An agent that begins writing code (or quoting symbols) before pinning the sub-library is wrong for every Device Emulation release.

  • The library is the building block; the packaged services are different artifacts. DOCA SNAP Service and DOCA Virtio-net Service are packaged daemons built on top of this library. The library is the right answer when the user is writing a custom backend; the service is the right answer when the user wants a packaged solution and is willing to let the service own the backend implementation. Conflating the two is the single most common Device Emulation first-app design error and the cleanest place to fail fast.

Capabilities and modes

DOCA Device Emulation is an umbrella library: a shared architecture across the four sub-libraries covered end-to-end here, each of which exposes its own API surface, pkg-config module, sample tree subdirectory, and capability-query family. The umbrella architecture is constant; the per-sub-library specifics differ.

Umbrella architecture — what every Device Emulation deployment looks like.

SideWhat runs thereWhat the user providesWhat DOCA provides
HostThe host operating system, the host's standard PCIe enumeration, and the host kernel driver matching the emulated device class (e.g. the upstream virtio_net kernel driver for a virtio-net emulation, the upstream virtio_fs kernel driver for a virtio-fs emulation, the host's generic PCIe driver model for a PCI Generic emulation)Nothing DOCA-specific — the host sees a real-looking PCIe device and binds the standard kernel driver to itThe PCIe surface the host's kernel driver sees
DPU (BlueField Arm)User-space DPU code that links against the chosen Device Emulation sub-library, runs the backend logic for the emulated device, and uses the doorbell / DMA primitives the sub-library exposes to react to host driver activityThe backend implementation (e.g. packet forwarding for a virtio-net device, the storage backend for a SNAP-style device, the filesystem implementation for a virtio-fs device)The doca_devemu_<sub>_* C API surface, the DOCA Core context for the sub-library, the doorbell / DMA primitives, and the per-sub-library capability-query family

The agent's rule: when the user asks "what backend should I write", that is a domain question (storage / networking / filesystem design), NOT an API question — route via doca-public-knowledge-map/SKILL.md to the public DOCA Device Emulation umbrella guide and the per-sub-library guides linked from it, plus the user's own domain expertise. When the user asks "how do I expose an emulated PCIe device from the DPU and react to host driver calls", that is this skill's scope.

Sub-library selection — the load-bearing first move. Before any code is written, the agent must pin the sub-library the user needs. Different sub-libraries have different APIs, different pkg-config modules (per the per-sub-library guides reachable via doca-public-knowledge-map/SKILL.md), and different firmware-level enablement axes.

User intentSub-libraryWhy this sub-library is the answer
Build a custom emulated PCIe device whose interface does not match any standard virtio class (e.g. a custom PCIe peripheral for prototyping, a security-isolated device with a custom PCIe surface, a research device with bespoke registers)PCI Generic — raw PCIe device emulationGives the user direct control over the PCIe surface the host sees; the host binds its generic PCIe driver model rather than a class-specific virtio driver. The user owns the entire register / interrupt / BAR / configuration-space contract
Expose a virtio network device to the host backed by custom DPU-side packet processing (e.g. a custom packet-forwarding logic the user wants the host to see as a standard virtio NIC)virtio-net — emulated virtio network deviceThe host sees a standard virtio-net device and binds its upstream virtio_net kernel driver; the user only writes the DPU-side backend. The virtio framing + feature-negotiation is handled by the sub-library
Expose a virtio filesystem to the host backed by custom DPU-side filesystem logic (e.g. a network-attached or specialized filesystem the host should see as a standard virtio-fs device)virtio-fs — emulated virtio filesystem deviceThe host sees a standard virtio-fs device and binds its upstream virtio_fs kernel driver; the user only writes the DPU-side backend. The virtio-fs request shape is handled by the sub-library
Want a packaged NVMe / virtio-blk storage backend without writing the backend code yourselfNone of this skill — DOCA SNAP Service; route via doca-public-knowledge-map/SKILL.mdSNAP is a packaged storage service built on top of Device Emulation; the user does not implement the backend. This skill is the building block the service uses; the service is a separate artifact
Want a packaged virtio-net daemon without writing the backend code yourselfNone of this skill — DOCA Virtio-net Service; route via doca-public-knowledge-map/SKILL.mdVirtio-net Service is a packaged virtio-net daemon built on top of this library's virtio-net sub-library; the user does not implement the backend. The library is the building block; the service is the packaged solution
Want standard NIC behavior on the BlueField (no new emulated device class; just shape the data plane on the existing NIC)None of this skill — use doca-flow/SKILL.md + doca-eth/SKILL.mdDevice Emulation is for new emulated PCIe devices the host did not previously see. The BlueField's built-in NIC personality is shaped by Flow + Eth, not by this library

If the user does not yet know which sub-library they need, the agent's job is to walk the rows above with the user before writing any code. Picking a sub-library for the user when the rows do not pin one is a wrong answer regardless of how clean the rest of the setup goes.

The per-sub-library DOCA Core context — one per emulated device per sub-library.

Object classPerLifetimeWhat it ownsKey calls
The chosen sub-library's emulated-device context (one of: PCI Generic emulated-device context, virtio-net emulated-device context, virtio-fs emulated-device context)One per emulated device the DPU is exposing in that sub-libraryCreated against a doca_dev that maps to a BlueField with the matching emulation type enabled in firmware; lives until the host driver is detached and the context is destroyedThe DOCA-side bookkeeping for that emulated device, the registration of the doorbell / DMA primitives the host driver will interact with, and the host-side observability for the emulated device's stateDOCA Core create / configure / start / stop / destroy on the per-sub-library context object; the per-sub-library doca_devemu_<sub>_cap_* family for capability queries; the per-sub-library doorbell / DMA primitives for host ↔ DPU interaction

A DPU exposing more than one emulated device — or emulated devices in more than one sub-library — needs one per-sub-library context per emulated device. There is no "global Device Emulation context" that spans sub-libraries; the sub-library contexts are independent and follow their own lifecycles.

Doorbell / DMA primitives — the bridge between host driver and DPU backend. Each sub-library exposes its own doorbell and DMA primitives that the host's kernel driver and the DPU-side backend use to coordinate without each side having to poll the other unconditionally. The agent's rule for these primitives is the same as for the Core context: per-sub-library, not global.

SurfaceWhat it doesWhy the agent must surface it explicitly
Doorbell registration on the per-sub-library contextLets the DPU-side backend react to host-side kernel driver activity (e.g. the host driver kicking a virtio queue) without busy-polling the PCIe surfaceA first-app that omits the doorbell wiring will appear to load successfully — the host kernel driver may even bind — but no host-driver activity will produce any DPU-side reaction. The agent must explicitly verify the doorbell wiring before recommending a smoke run
DMA primitives for moving payload bytes between host memory and DPU memory under the emulated device's contractImplements the actual data transfer the emulated device class demands (e.g. virtio descriptor payloads, raw PCIe BAR-mediated DMA for PCI Generic)The DMA primitives the sub-library exposes are its own — they are not a substitute for the general-purpose doca-dma/SKILL.md library and they enforce the emulated device contract. The agent must not recommend hand-rolling the data transfer with doca-dma directly when the sub-library already gives the contract-correct primitives

Per-sub-library capability discovery — the only rule. Each sub-library exposes its own doca_devemu_<sub>_cap_* family. Before assuming a feature bit, a maximum, or a device characteristic is available, call the matching family against the active doca_devinfo for the BlueField device the user is emulating from.

Version compatibility

For the canonical DOCA version-detection chain, the four-way match rule, NGC container semantics, and the headers-win-over-docs rule, see doca-version/SKILL.md. The body lives there; this skill does not duplicate it.

The Device Emulation-specific overlay is:

  • Version handling is per-sub-library, not per-umbrella. Each sub-library has its own pkg-config module installed by the DOCA host packages on the DPU side; the user's build manifest must reference the module for the sub-library they picked (per the sub-library selection table in ## Capabilities and modes). The exact per-sub-library module name lives in the public Device Emulation umbrella guide and the per-sub-library guides linked from it, reachable via doca-public-knowledge-map/SKILL.md; the agent should route the user there to read it off the guide and off their own pkg-config install rather than hardcoding a module name from memory.

  • Cap-query is the runtime authority per sub-library. Per the cross-cutting rule in doca-version CAPABILITIES.md ## Observability (doca-version/CAPABILITIES.md#observability), the per-sub-library doca_devemu_<sub>_cap_* query against the active doca_devinfo is the runtime authority for "is the emulation type I want supported on this BlueField + this DOCA install + this firmware". The public guides are the promise; the cap query is the reality. The four-way-match check (the chosen sub-library's .pc plus doca-common.pc plus doca_caps --version) per doca-version CAPABILITIES.md ## Version compatibility (doca-version/CAPABILITIES.md#version-compatibility) catches the partial-install case where the umbrella is installed but a sub-library is not.

  • The devemu public API changed in DOCA 3.5. DOCA 3.5 introduced breaking public API changes for devemu. Code using the previous devemu API surface must migrate. Removed families include VFS configuration create/destroy/add/remove/user-data-size APIs (doca_devemu_vfs_cfg_*) and the PCI device VF-count and reset getters/controls (doca_devemu_pci_dev_get_num_vfs, _get_total_vfs, _reset_db, _reset_msix), and the PCI capability-type hotplug query (doca_devemu_pci_cap_type_is_hotplug_supported; use doca_devemu_pci_cap_is_hotplug_supported). Added families include the virtio offload engine setters (doca_devemu_virtio_offload_engine_*), vnet capability queries (doca_devemu_vnet_cap_*), vnet counters (doca_devemu_vnet_counters_*), admin request user-data size get/set (doca_devemu_vnet_get_admin_req_user_data_size and doca_devemu_vnet_set_admin_req_user_data_size), and vnet offload engine export/import (doca_devemu_vnet_offload_engine_export and doca_devemu_vnet_offload_engine_create_from_export). Developers must use the devemu public header for exact prototypes and constants for these families; do not hardcode them from memory or from older DOCA releases. The header is the same public Device Emulation header referenced in the headers-win-over-docs bullet below.

  • Headers in $(pkg-config --variable=includedir doca-common) win over docs. Per the headers-win-over-docs rule in doca-version/SKILL.md, if a public Device Emulation doc page mentions a doca_devemu_* symbol that is not in the installed headers, the headers describe what this install can call. The agent must quote the headers (and the cap query), not the docs URL, when the two disagree.

Error taxonomy

Device Emulation-specific overlays on the cross-library DOCA_ERROR_* taxonomy. The cross-library taxonomy itself lives in doca-programming-guide CAPABILITIES.md ## Error taxonomy (doca-programming-guide/CAPABILITIES.md#error-taxonomy); the rows below are the Device Emulation surface meaning that the agent must disambiguate before falling back to the cross-library response.

ErrorDevice Emulation context where it shows upDevice Emulation-specific cause
DOCA_ERROR_BAD_STATEAny doca_devemu_<sub>_* call before doca_ctx_start() on the per-sub-library context, or after doca_ctx_stop(); tearing down the per-sub-library context while the host kernel driver is still attachedLifecycle violation. Walk the call sequence against the lifecycle in doca-programming-guide CAPABILITIES.md ## Capabilities and modes (doca-programming-guide/CAPABILITIES.md#capabilities-and-modes); the most common case is destroying the per-sub-library context before the host kernel driver has been unbound or the emulated device removed.
DOCA_ERROR_NOT_SUPPORTEDPer-sub-library context create / start; the matching installed capability getter returning not supported; first feature-negotiation call (virtio-net / virtio-fs)A false capability result establishes only that this active doca_devinfo cannot use that requested surface in the observed state. It does not by itself prove the firmware slot is disabled. Separately verify installed headers / module, BlueField generation support, and read-only current / next-boot firmware configuration before assigning the cause; then stop or route on the axis that failed
DOCA_ERROR_NOT_PERMITTEDPer-sub-library context create / start; first doorbell registrationDisambiguate all evidence axes before changing anything: (1) confirm the process identity and the install's documented privilege / device-access policy; (2) run the read-only mlxconfig -d <bdf> q current / next-boot configuration probe for the selected emulation class (use VIRTIO_NET_EMULATION_ENABLE only for virtio-net and only when that field is present in the installed MFT / matching public guide); (3) confirm whether a pending next-boot value requires the documented reset; and (4) confirm the exact installed capability getter against the intended doca_devinfo. Missing privilege, disabled current/next-boot configuration, pending activation, and unsupported hardware/install are distinct outcomes. Do not infer one from the API error alone, and route any configuration mutation through doca-hardware-safety/SKILL.md
DOCA_ERROR_INVALID_VALUEPer-sub-library configuration calls — device descriptor / device identity values, virtio feature-bit negotiation mismatches, queue sizing past the capThe per-device descriptor the user supplied is malformed for the chosen sub-library, OR (virtio-net / virtio-fs) the host kernel driver and the emulated device disagreed at feature negotiation, OR a sizing parameter exceeds what the per-sub-library cap-query advertised. Re-read the cap-query baseline; for the virtio cases, re-check the feature set the user opted in to against what the cap-query reports as supported on this combo
DOCA_ERROR_IO_FAILEDHost ↔ DPU interaction after start — host kernel driver reads, writes, kicks; DMA primitives moving payloadThe host-side driver interaction failed below the DOCA layer. Most common cause is the host's kernel driver did not bind cleanly to the emulated device (e.g. the host kernel does not ship the matching virtio driver, or the host's lspci does see the device but the driver bind failed); second most common is a host-side mmap / DMA address that the DPU-side DMA primitive could not resolve. Inspect the host-side dmesg and lspci for the emulated device; the fix is typically host-side rather than DPU-side

The agent's rule: never recommend a retry loop on DOCA_ERROR_* without first identifying which of the rows above is the cause. None of the Device Emulation errors above want a retry — every row points at investigation (env / firmware / sub-library selection / feature negotiation / host-side driver), not at retry.

Observability

Device Emulation observability surface is two-sided: there is a DPU-side observability surface (per-sub-library context state, capability-query snapshots, DOCA logger events on the DPU side) AND a host-side observability surface (the host kernel's view of the emulated PCIe device — lspci, the matching kernel driver's sysfs / debugfs entries, dmesg). The agent must reach for both, not just one — an emulated device that appears to load on the DPU side but is invisible to the host's lspci, or visible but unbound to its driver, is a half-deployment that the DPU-side surface alone cannot fully diagnose.

Three primary signals the agent should reach for:

  1. DPU-side per-sub-library context state and logger. The DPU-side context's state transitions (configure → start → running → stop → destroy), the per-sub-library doorbell / DMA primitives' observability hooks, and the DOCA logger on the DPU side (set DOCA_LOG_LEVEL=trace for first runs) are the primary DPU-side signals. Absence of a doorbell reaction when the host driver is clearly active should first be checked for a missing doca_pe_progress() in the DPU-side main loop, a doorbell registration wired against the wrong sub-library context, or an operation sent to the wrong queue / register.

  2. Per-sub-library capability snapshot at configure time. The output of every doca_devemu_<sub>_cap_* query against the active doca_devinfo is a snapshot of what the library + the hardware + the firmware said was possible before any emulated device was created. Save it; if a later call returns DOCA_ERROR_NOT_SUPPORTED or _INVALID_VALUE the diff against this baseline is the bug.

  3. Host-side enumeration and kernel-driver state. On the host side, lspci shows whether the emulated PCIe device is enumerated at all; the matching kernel driver's sysfs / debugfs entries show whether the driver bound to it; the host's dmesg shows what the kernel saw at bind time (virtio feature negotiation issues, DMA failures, BAR mapping issues). A DPU-side context that started cleanly but produced no host-side enumeration is most often a firmware-side enable that has not taken effect yet (a BlueField reset after the firmware-side flip is typically required); a host-side enumeration without driver bind is most often a host kernel that ships no driver for the emulated class (the host kernel must have the matching driver, the DPU does not provide it).

DOCA 3.5 added five vnet counter query families for TX/VQ error observability: TX VQ header-length errors, TX VQ host-address errors, TX VQ LSO/GSO errors, TX VQ skipped descriptors, and VQ error-handler-scheduled counts. Query these through the doca_devemu_vnet_counters_* family declared in the header that declares the devemu vnet counter queries; treat them as the authoritative counter surface and do not rely on older counter guidance that omits them.

For cross-cutting observability primitives (--sdk-log-level, the DOCA_LOG_LEVEL env var, the trace build flavor) see doca-debug CAPABILITIES.md ## Observability (doca-debug/CAPABILITIES.md#observability). For the install-tree observability (logger names, package layout, sample tree) defer to doca-public-knowledge-map/SKILL.md.

Safety policy

Overlay on the bundle-wide hardware-safety meta-policy. The rules below are this skill's per-artifact overlay on the cross-cutting rules in doca-hardware-safety CAPABILITIES.md ## Safety policy (doca-hardware-safety/CAPABILITIES.md#safety-policy) (specifically ### Per-artifact overlay pattern (doca-hardware-safety/CAPABILITIES.md#per-artifact-overlay-pattern)). When the two layers disagree, the stricter wins; when either layer says STOP, the agent stops.

Device Emulation's safety surface is dual-axis-driven AND host-driver-driven. The three most common Device Emulation first-app failures are (1) the BlueField firmware does not have the chosen emulation type enabled; (2) the DPU-side process lacks the privilege required for PCIe-level emulation; and (3) the host's kernel does not ship the standard driver for the emulated device class the user picked, or the host's kernel ships it but it failed to bind for a feature- negotiation reason. The agent's job is to verify all three before any doca_devemu_<sub>_* create call, not after the first DOCA_ERROR_NOT_PERMITTED or first silent host-side non-enumeration.

The env-precondition matrix the agent must walk for any new Device Emulation setup:

PreconditionWhat must be trueHow the agent verifiesWhere to fix
BlueField generation supports the chosen sub-libraryThe BlueField generation actually carries support for the emulation type the user picked (PCI Generic / virtio-net / virtio-fs); not every BlueField generation supports every sub-libraryThe matching doca_devemu_<sub>_cap_* against the active doca_devinfo returns supported; the BlueField hardware generation is on the public umbrella's supported BlueField generations list (route to doca-public-knowledge-map/SKILL.md for the per-sub-library guide)doca-setup/SKILL.md for the env-side BlueField identification; this is not a code fix — if the hardware does not support the sub-library, the answer is use a different sub-library or different hardware, not a code change
BlueField firmware has the matching emulation type enabledDevice emulation requires firmware configuration for the selected emulation type; this is not a casual setting and not flipped during normal BlueField operationRun read-only mlxconfig -d <bdf> q and inspect both current and next-boot values using the exact field documented by the installed MFT / matching public guide. VIRTIO_NET_EMULATION_ENABLE may be used only for virtio-net and only when documented / present. A false library capability is not proof that configuration is disabled; independently check hardware support, installed headers / module, and firmware configurationRead via doca-setup/SKILL.md; any write or reset routes through doca-hardware-safety/SKILL.md. If the exact field cannot be verified, stop rather than inventing one
DPU-side process privilegesThe DPU-side process running the user's doca_devemu_<sub>_* code can perform PCIe-level emulation; this is privileged and typically requires sudo on the DPU side (the DPU-side baseline is stricter than host-side doca_dev access because exposing a PCIe device is a privileged operation)The DPU-side process can open the target doca_dev; the user is either running with sudo on the DPU or is a member of the DPU-side group the public install profile grants the privilege todoca-setup/SKILL.md for the DPU-side privilege; do not modify the program to silence the failure
Host kernel ships the standard driver for the emulated device classThe host kernel must include the standard kernel driver for the emulated device class the user picked: the upstream virtio-net driver for a virtio-net emulation, the upstream virtio-fs driver for a virtio-fs emulation, the host's generic PCIe driver model for a PCI Generic emulationAfter the DPU-side context is started, lspci on the host shows the emulated device; the matching kernel driver's sysfs entry shows the driver bound. Host-side dmesg around the moment the DPU started the context is the cheapest place to see the bind succeed or failHost-side fix: the user's host kernel must ship (or load via a module) the matching standard driver. This is not a DOCA-side fix — the host kernel ships the driver, the DPU does not provide it. If the user is on a stripped host kernel without the matching driver, the answer is to load the matching kernel module, not to modify the DPU-side program
Single-emulated-device smoke succeeded before scalingA trivial emulated-device setup (one device, one queue if applicable, one DPU-side context, one host-side driver bind, basic operation working) before any sophisticated backend or multi-device deployment is attemptedWalk the smoke step in TASKS.md ## test step 1; a smoke that fails identifies env-side / firmware-side / sub-library-selection / host-driver gaps cheaply, before any backend design effort is wastedDiagnose the smoke failure first; do NOT scale a broken smoke into a complex multi-device deployment

Configuration shape. Mandatory configurations before any doca_ctx_start() on the per-sub-library context: the chosen sub-library's emulated-device context must be created against a doca_dev whose BlueField firmware has the matching emulation type enabled; the per-sub-library doorbell / DMA primitives must be wired; the per-sub-library capability queries (doca_devemu_<sub>_cap_*) must agree that the deployment is supported on this combo; the per- sub-library feature negotiation (virtio-net / virtio-fs only, where the host driver negotiates features with the emulated device) must be set up before the host kernel driver attempts to bind. Optional configurations (per-device queue tuning, per-device user-data) ride on top of the same cap-query rule.

Choosing the library does not preclude later choosing a service. A user who starts with doca-devemu and discovers they would rather adopt the packaged DOCA SNAP Service or DOCA Virtio-net Service can do so — the services are built on top of the same library and the firmware-side preconditions are the same. The agent should surface this escape hatch when the user's intent reveals a packaged solution would suit them better; conversely, the agent should surface this library path when a user trying to adopt a service discovers the service does not implement what they need and they will have to write a custom backend.

Lifecycle ordering is per-sub-library. The per-sub-library context follows the universal DOCA Core teardown order on top of the doca_dev; out-of-order teardown surfaces as DOCA_ERROR_BAD_STATE. The Device Emulation-specific addition is the host-driver-attached state: tearing down the per-sub-library context while the host kernel driver is still attached to the emulated device may leave the host side with a half-removed PCIe surface that produces noisy dmesg output on the host until the next BlueField reset. The agent must surface this ordering explicitly — instruct the user to detach the host kernel driver (or unload the host kernel module) before tearing down the DPU-side context, and to destroy emulated devices before destroying their parent per-sub-library context.

This skill does not define a backend. doca-devemu provides the framework for emulated PCIe devices; it does not implement a specific storage backend, packet processor, or filesystem. When the user asks "what backend should I write", the agent must refuse to invent backend bodies and must route the user to the public DOCA Device Emulation umbrella guide via doca-public-knowledge-map/SKILL.md and to the user's own domain expertise.

Deferred topic boundaries

This skill scopes itself to the library umbrella across the three sub-libraries covered end-to-end here. Adjacent topics the agent will get asked but should route elsewhere:

  • DOCA SNAP Service — packaged NVMe / virtio-blk storage daemon built on top of this library. Out of scope; route via doca-public-knowledge-map/SKILL.md to the DOCA SNAP Services guide. The library is the building block; the service is the packaged solution and is a different artifact than what this skill covers.

  • DOCA Virtio-net Service — packaged virtio-net daemon built on top of this library's virtio-net sub-library. Out of scope; route via doca-public-knowledge-map/SKILL.md to the DOCA Virtio-net Service guide. Same library-vs-service distinction as SNAP above.

  • Host kernel drivers for the emulated device class (upstream virtio-net, virtio-fs, virtio-blk drivers, the host's generic PCIe driver model) — outside DOCA entirely. Route to the upstream Linux kernel documentation; this skill assumes the host kernel ships the matching driver.

  • Designing the backend itself (the storage backend body, the packet-forwarding logic, the filesystem implementation) — outside this skill. Route via doca-public-knowledge-map/SKILL.md to the public DOCA Device Emulation umbrella guide and the per-sub-library guides for sub-library-specific guidance; the backend body itself is the user's domain expertise.

  • Standard NIC behavior on the BlueField data path (doca-flow/SKILL.md + doca-eth/SKILL.md territory) — outside this skill. Device Emulation is for custom emulated PCIe devices; Flow + Eth are for the BlueField's existing NIC personality.

  • General-purpose host ↔ DPU memory copies (doca-dma/SKILL.md) — outside this skill. The per-sub-library DMA primitives in Device Emulation are contract-correct for the emulated device class; for raw general-purpose host ↔ DPU memcpy outside the emulation contract, DMA is the right library.

  • Host ↔ DPU control-plane messaging that does NOT involve the host seeing a new PCIe device class (doca-comch/SKILL.md) — outside this skill. Comch is an explicit host ↔ DPU IPC over PCIe; Device Emulation hides the DPU behind a real-looking PCIe device that uses the host's standard driver path.

  • DOCA Core context and progress engine internals — owned by doca-programming-guide/SKILL.md. This skill uses the Core lifecycle; it does not redefine it.

  • Cross-cutting DOCA_ERROR_* taxonomy — owned by doca-programming-guide CAPABILITIES.md ## Error taxonomy (doca-programming-guide/CAPABILITIES.md#error-taxonomy). This skill adds the Device Emulation overlay, not the taxonomy itself.

  • Cross-cutting debug ladder (install / version / build / link / runtime / program / driver) — owned by doca-debug ## debug (doca-debug/TASKS.md#debug). This skill's ## debug redirects there for layer 1-4; layers 5-7 carry the Device Emulation-specific overlay (including the firmware-side emulation-type enable route, the sub-library mis-selection diagnosis, and the host-kernel- driver bind state).

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

The author says: Requires DOCA SDK installed at /opt/mellanox/doca on BOTH the host AND the BlueField DPU (Ubuntu 22.04/24.04 or RHEL/SLES), with firmware emulation (PCI Generic / virtio-net / virtio-fs) enabled and the host kernel shipping the matching driver (virtio_net / virtio_fs / generic PCIe). Reads pkg-config for the chosen sub-library and inspects /opt/mellanox/doca/{lib,include,samples/doca_devemu}. The validation steps require a live DOCA install.

Security

What our scanner noticed· Medium risk

  • Large base64-encoded blobs

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
NVIDIA
Publisher
NVIDIA (Official)
Source
NVIDIA/skills · skills/doca-devemu · commit fce3cca
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE-APACHE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by NVIDIA or NVIDIA.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download doca-devemu.zip