Instruction
ENQCMDS
Kernel version of ENQCMD that takes the PASID and privilege bit of the 64-byte command from its memory operand instead of the IA32_PASID MSR.
ENQCMDS is the kernel’s form of ENQCMD: it reads a 64-byte command from memory and writes it in one piece to a device’s enqueue register, a shared work queue’s address in MMIO space, and ZF tells whether the device took it. ENQCMD’s page describes the write, its ordering and the retry status. The difference is where the identity of the sender comes from. ENQCMD takes the process address space ID (PASID) from the IA32_PASID MSR and always marks the command as sent by a user; ENQCMDS takes both from the command itself, the PASID from bits 19:0 and the privilege bit, 1 for supervisor, from bit 31. Bits 30:20 of the source must be zero.
Where it runs
Since it lets software claim any address space, ENQCMDS needs CPL 0: at CPL 1 to 3 it raises #GP(0), as it does for a destination that is not aligned to 64 bytes and for nonzero bits 30:20. It also runs in real mode, where the CPL is 0, and raises #GP in virtual-8086 mode. The destination register is an offset in ES, which no prefix can change; #UD comes only from a missing CPUID bit, the same as ENQCMD’s (leaf 7, ECX bit 29), or a LOCK prefix. ZF is set for retry and cleared for success, and the other arithmetic flags are cleared. APX adds an EVEX form for its new registers.
In Linux
Linux 7.3’s arch/x86/include/asm/special_insns.h wraps ENQCMDS as bytes, returning -EAGAIN when ZF is set. The driver for Intel’s data streaming and in-memory analytics accelerators (drivers/dma/idxd) uses it for shared work queues, and MOVDIR64B for dedicated ones: for its own commands it uses a PASID set up for the kernel’s DMA mappings, and when a program submits a command through the driver’s device file, the driver clears the privilege bit and puts in the program’s PASID. A busy queue is retried 32 times by default, a number the administrator can change.
Not run here
Zen 5 reports no ENQCMD in CPUID, so the probe left ENQCMDS unrun.
GCC 14 and Clang 23 provide _enqcmds(dst, src) with -menqcmd, which
returns ZF; for a loop that retries 32 times, GCC 14 at -O2 keeps
ENQCMDS, SETE and a test in a loop, while Clang 23 unrolls all 33 tries
into ENQCMDS and JNE pairs.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
ENQCMDS r16/32/64, m512
ENQCMDS_GPRa_MEMu32 | F3 0F 38 F8 /r | ENQCMD |
ENQCMDS r16/32/64, m512
ENQCMDS_GPRav_MEMu32_APX | EVEX.LLZ.F3.MAP4.SCALABLE F8 /r | APX_F + ENQCMD |
Latency and throughput
| Model | r32, m512 |
|---|---|
| Sapphire Rapids | 1 / 1p49 |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
if CPL > 0:
fault(GP, 0)
a = dest.read() # 64 bits, 32 with a 67 prefix; ES,
# which no prefix overrides
if a % 64:
fault(GP, 0) # 64-byte aligned
v = src.read() # 64 bytes, not read atomically
if v >> 20 & 0x7FF:
fault(GP, 0) # bits 30:20 must be 0
zf = 1 - enqueue(a, v) # the PASID (19:0) and the privilege
# (31) as the source gives them
of = sf = af = pf = cf = 0Not run on a processor: no processor at hand has ENQCMD.
Operands
| Operand | Kind | Action |
|---|---|---|
ENQCMDS r16/32/64, m512 | ||
r16/32/64 | explicit | read |
m512 | explicit | read |
RFLAGS | implicit | write |
Flags
| OF | SF | ZF | AF | PF | CF |
|---|---|---|---|---|---|
| All forms | |||||
| 0 | 0 | M | 0 | 0 | 0 |
Exceptions
The exception class is XED's name for the set of exception conditions that a form follows. How to read.
- Legacy forms
- none in XED
- EVEX forms
APX-EVEX-ENQCMD
Attributes
What else XED records about the forms. How to read.
- All forms
- privileged: CPL 0 only
CPUID and processors
Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.
| ISA set | CPUID | Processors |
|---|---|---|
ENQCMD | ENQCMD | Sapphire Rapids, Emerald Rapids, Granite Rapids, Diamond Rapids, Sierra Forest, Clearwater Forest |
APX_F_ENQCMD | APX_F + ENQCMD | Nova Lake, Diamond Rapids |
More ENQCMD instructions
More APX instructions
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - LLVM 23.1.2's x86 scheduling models (commit
85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2A, page 3-292 (ENQCMDS)
- Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)
- Linux 7.3: arch/x86/include/asm/special_insns.h, drivers/dma/idxd/submit.c and cdev.c, arch/x86/kernel/fpu/core.c and drivers/idle/intel_idle.c (ENQCMDS for Intel's accelerators, TILERELEASE before idle)
The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The timings come from LLVM's scheduling models, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.