hmp-commands-info.hx | 32 ++++++++++ hw/nvme/meson.build | 2 +- hw/nvme/monitor.c | 139 +++++++++++++++++++++++++++++++++++++++++++ qapi/machine.json | 36 +++++++++++ 4 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 hw/nvme/monitor.c
Add two HMP commands for inspecting emulated NVMe controllers from
the QEMU monitor without attaching gdb to the QEMU process:
- 'info nvme' - per-controller summary (PCI, identify
fields, CC/CSTS/AQA, queue counts)
- 'info nvme-queues' - per-queue listing of admin and I/O SQ/CQ
(size, head/tail, PRP1, doorbell offset,
phase tag)
Useful for verifying queue setup, doorbell rings, AERs held in the
admin SQ and similar driver/controller interaction details from a
running QEMU monitor.
Changes in v3:
- Gate the new x-query-nvme[-queues] commands and their 'info'
counterparts behind CONFIG_NVME_PCI. They were registered
unconditionally while the implementations live in hw/nvme/, so
targets built without NVMe (e.g. riscv64-softmmu) failed to link
with an undefined reference to qmp_x_query_nvme.
- hw/nvme/meson.build: keep the source file list alphabetically
sorted (Markus).
Changes in v2:
- hw/nvme/meson.build: add the missing trailing newline (Markus).
- Pick up Acked-by tags from Dr. David Alan Gilbert and Markus
Armbruster on both patches.
v2: https://lore.kernel.org/qemu-devel/cover.1778694320.git.mateusz.nowicki@posteo.net/
v1: https://lore.kernel.org/qemu-devel/cover.1778409416.git.mateusz.nowicki@posteo.net/
Mateusz Nowicki (2):
hw/nvme: add 'info nvme' HMP command
hw/nvme: add 'info nvme-queues' HMP command
hmp-commands-info.hx | 32 ++++++++++
hw/nvme/meson.build | 2 +-
hw/nvme/monitor.c | 139 +++++++++++++++++++++++++++++++++++++++++++
qapi/machine.json | 36 +++++++++++
4 files changed, 208 insertions(+), 1 deletion(-)
create mode 100644 hw/nvme/monitor.c
--
2.53.0
On Jun 26 11:21, Mateusz Nowicki wrote:
> Add two HMP commands for inspecting emulated NVMe controllers from
> the QEMU monitor without attaching gdb to the QEMU process:
>
> - 'info nvme' - per-controller summary (PCI, identify
> fields, CC/CSTS/AQA, queue counts)
> - 'info nvme-queues' - per-queue listing of admin and I/O SQ/CQ
> (size, head/tail, PRP1, doorbell offset,
> phase tag)
>
> Useful for verifying queue setup, doorbell rings, AERs held in the
> admin SQ and similar driver/controller interaction details from a
> running QEMU monitor.
>
> Changes in v3:
> - Gate the new x-query-nvme[-queues] commands and their 'info'
> counterparts behind CONFIG_NVME_PCI. They were registered
> unconditionally while the implementations live in hw/nvme/, so
> targets built without NVMe (e.g. riscv64-softmmu) failed to link
> with an undefined reference to qmp_x_query_nvme.
> - hw/nvme/meson.build: keep the source file list alphabetically
> sorted (Markus).
>
> Changes in v2:
> - hw/nvme/meson.build: add the missing trailing newline (Markus).
> - Pick up Acked-by tags from Dr. David Alan Gilbert and Markus
> Armbruster on both patches.
>
> v2: https://lore.kernel.org/qemu-devel/cover.1778694320.git.mateusz.nowicki@posteo.net/
> v1: https://lore.kernel.org/qemu-devel/cover.1778409416.git.mateusz.nowicki@posteo.net/
>
> Mateusz Nowicki (2):
> hw/nvme: add 'info nvme' HMP command
> hw/nvme: add 'info nvme-queues' HMP command
>
> hmp-commands-info.hx | 32 ++++++++++
> hw/nvme/meson.build | 2 +-
> hw/nvme/monitor.c | 139 +++++++++++++++++++++++++++++++++++++++++++
> qapi/machine.json | 36 +++++++++++
> 4 files changed, 208 insertions(+), 1 deletion(-)
> create mode 100644 hw/nvme/monitor.c
>
> --
> 2.53.0
>
>
With this, my build complains about CONFIG_NVME_PCI being poisoned now:
qapi/qapi-introspect.c:1743:13: error: attempt to use poisoned ‘CONFIG_NVME_PCI’
1743 | #if defined(CONFIG_NVME_PCI)
| ^
In file included from /home/kjensen/src/qemu/include/exec/poison.h:7,
from /home/kjensen/src/qemu/include/qemu/osdep.h:38,
from qapi/qapi-introspect.c:12:
./config-poison.h:277:20: note: poisoned here
277 | #pragma GCC poison CONFIG_NVME_PCI
| ^~~~~~~~~~~~~~~
qapi/qapi-introspect.c:1756:13: error: attempt to use poisoned ‘CONFIG_NVME_PCI’
1756 | #if defined(CONFIG_NVME_PCI)
| ^
./config-poison.h:277:20: note: poisoned here
277 | #pragma GCC poison CONFIG_NVME_PCI
| ^~~~~~~~~~~~~~~
CONFIG_NVME_PCI is poisoned in common code, so the schema 'if' can't work. v4 drops it: the commands stay unconditional and hw/nvme/monitor-stub.c provides the qmp_x_query_nvme[_queues]() stubs via meson if_false (like hw/i386/sgx-stub.c). Verified it links with and without NVMe (x86_64 / avr). v4: https://lore.kernel.org/qemu-devel/cover.1782819251.git.mateusz.nowicki@posteo.net/ Thanks, Mateusz On 6/30/2026 12:31 PM, Klaus Jensen wrote: > On Jun 26 11:21, Mateusz Nowicki wrote: >> Add two HMP commands for inspecting emulated NVMe controllers from >> the QEMU monitor without attaching gdb to the QEMU process: >> >> - 'info nvme' - per-controller summary (PCI, identify >> fields, CC/CSTS/AQA, queue counts) >> - 'info nvme-queues' - per-queue listing of admin and I/O SQ/CQ >> (size, head/tail, PRP1, doorbell offset, >> phase tag) >> >> Useful for verifying queue setup, doorbell rings, AERs held in the >> admin SQ and similar driver/controller interaction details from a >> running QEMU monitor. >> >> Changes in v3: >> - Gate the new x-query-nvme[-queues] commands and their 'info' >> counterparts behind CONFIG_NVME_PCI. They were registered >> unconditionally while the implementations live in hw/nvme/, so >> targets built without NVMe (e.g. riscv64-softmmu) failed to link >> with an undefined reference to qmp_x_query_nvme. >> - hw/nvme/meson.build: keep the source file list alphabetically >> sorted (Markus). >> >> Changes in v2: >> - hw/nvme/meson.build: add the missing trailing newline (Markus). >> - Pick up Acked-by tags from Dr. David Alan Gilbert and Markus >> Armbruster on both patches. >> >> v2: https://lore.kernel.org/qemu-devel/cover.1778694320.git.mateusz.nowicki@posteo.net/ >> v1: https://lore.kernel.org/qemu-devel/cover.1778409416.git.mateusz.nowicki@posteo.net/ >> >> Mateusz Nowicki (2): >> hw/nvme: add 'info nvme' HMP command >> hw/nvme: add 'info nvme-queues' HMP command >> >> hmp-commands-info.hx | 32 ++++++++++ >> hw/nvme/meson.build | 2 +- >> hw/nvme/monitor.c | 139 +++++++++++++++++++++++++++++++++++++++++++ >> qapi/machine.json | 36 +++++++++++ >> 4 files changed, 208 insertions(+), 1 deletion(-) >> create mode 100644 hw/nvme/monitor.c >> >> -- >> 2.53.0 >> >> > With this, my build complains about CONFIG_NVME_PCI being poisoned now: > > qapi/qapi-introspect.c:1743:13: error: attempt to use poisoned ‘CONFIG_NVME_PCI’ > 1743 | #if defined(CONFIG_NVME_PCI) > | ^ > In file included from /home/kjensen/src/qemu/include/exec/poison.h:7, > from /home/kjensen/src/qemu/include/qemu/osdep.h:38, > from qapi/qapi-introspect.c:12: > ./config-poison.h:277:20: note: poisoned here > 277 | #pragma GCC poison CONFIG_NVME_PCI > | ^~~~~~~~~~~~~~~ > qapi/qapi-introspect.c:1756:13: error: attempt to use poisoned ‘CONFIG_NVME_PCI’ > 1756 | #if defined(CONFIG_NVME_PCI) > | ^ > ./config-poison.h:277:20: note: poisoned here > 277 | #pragma GCC poison CONFIG_NVME_PCI > | ^~~~~~~~~~~~~~~ >
© 2016 - 2026 Red Hat, Inc.