首页 > 解决方案 > QEMU 找不到设备“nvme”的“PCI”总线

问题描述

我正在使用 QEMU 调试 NVME 代码,QEMU 返回错误消息:No 'PCI' bus found for device 'nvme'。

但是,我检查了设备信息,它显示支持 PCI。

root@linux:/home/#qemu-system-arm -machine  vexpress-a9  -device help
Storage devices:
name "am53c974", bus PCI, desc "AMD Am53c974 PCscsi-PCI SCSI adapter"
name "nvme", bus PCI, desc "Non-Volatile Memory Express"
name "nvme-ns", bus nvme-bus, desc "Virtual NVMe namespace"
name "nvme-subsys", desc "Virtual NVMe subsystem"

有人可以给我一些提示吗?

QEMU 命令:

root@linux:~/run-kernel/$ qemu-system-arm -nographic -M vexpress-a9 -m 1024M -kernel arch/arm/boot/zImage -append "rdinit=/linuxrc console=ttyAMA0 loglevel=8" -dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb -device nvme,drive=nvme0,serial=deadbeaf1,num_queues=8 -drive file=disk.qcow2,if=none,id=nvme0

输出:

WARNING: Image format was not specified for 'disk.qcow2' and probing guessed raw.
     Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
     Specify the 'raw' format explicitly to remove the restrictions.
qemu-system-arm: -device nvme,drive=nvme0,serial=deadbeaf1,num_queues=8: No 'PCI' bus found for device 'nvme'

QEMU 版本:

root@linux:/home/# qemu-system-arm -version
QEMU emulator version 6.0.94
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers

标签: armqemu

解决方案


您正在尝试在没有 PCI 总线 (vexpress-a9) 的机器类型上使用 PCI 设备 (nvme)。这不起作用,就像试图将真正的硬件 PCI 卡插入没有 PCI 插槽的机器一样是不可能的。

您可能对“-device help”输出感到困惑:该输出列出了编译到该 QEMU 二进制文件中的所有设备,并且不会根据您同时传递的任何其他“-machine”选项对其进行过滤。所以它总是会向你展示一切。


推荐阅读