Cannot boot from emulated NVMe with seabios
Host environment
- Operating system: OpenSUSE Tumbleweed
- OS/kernel version: 5.14.6-1-default
- Architecture: x86
- QEMU flavor: qemu-system-x86_64
- QEMU version: 6.0.0 (but see below)
- QEMU command line:
./qemu-system-x86_64 -vga std -m 6144 -cpu host,+svm -smp 2 -enable-kvm -vnc :0 -boot menu=on \ -blockdev driver=file,node-name=hd0-file,filename=disk.img,cache.no-flush=on \ -blockdev driver=qcow2,node-name=hd0,file=hd0-file,cache.no-flush=on \ -device nvme,id=hd0-device,drive=hd0,serial=hd0
Emulated/Virtualized environment
- Operating system: Qubes OS (but doesn't matter - the issue is visible at seabios already)
- OS/kernel version: Xen 4.14.3
- Architecture: x86
Description of problem
SeaBIOS doesn't boot from NVMe disk.
This is regression compared to version 5.1.0. The exact same SeaBIOS binary that works with QEMU 5.1.0, doesn't detect NVMe with QEMU 6.0.0, nor QEMU 6.1.0. Booting from NVMe via OVMF works on all those versions.
Steps to reproduce
- Start the above command
- Press ESC to open boot menu in SeaBIOS
- Observe lack of NVMe entry
Additional information
I've bisected it to this commit:
7f0f1acedf159d00684d495d7a14d52220c1d16b is the first bad commit
commit 7f0f1acedf159d00684d495d7a14d52220c1d16b
Author: Klaus Jensen <k.jensen@samsung.com>
Date: Wed Jun 26 08:51:06 2019 +0200
hw/block/nvme: support multiple namespaces
This adds support for multiple namespaces by introducing a new 'nvme-ns'
device model. The nvme device creates a bus named from the device name
('id'). The nvme-ns devices then connect to this and registers
themselves with the nvme device.
This changes how an nvme device is created. Example with two namespaces:
-drive file=nvme0n1.img,if=none,id=disk1
-drive file=nvme0n2.img,if=none,id=disk2
-device nvme,serial=deadbeef,id=nvme0
-device nvme-ns,drive=disk1,bus=nvme0,nsid=1
-device nvme-ns,drive=disk2,bus=nvme0,nsid=2
The drive property is kept on the nvme device to keep the change
backward compatible, but the property is now optional. Specifying a
drive for the nvme device will always create the namespace with nsid 1.
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
hw/block/meson.build | 2 +-
hw/block/nvme-ns.c | 167 ++++++++++++++++++++++++++++++++++
hw/block/nvme-ns.h | 74 +++++++++++++++
hw/block/nvme.c | 245 ++++++++++++++++++++++++++++++++------------------
hw/block/nvme.h | 46 +++++-----
hw/block/trace-events | 6 +-
6 files changed, 426 insertions(+), 114 deletions(-)
create mode 100644 hw/block/nvme-ns.c
create mode 100644 hw/block/nvme-ns.h
Using -device nvme-ns
as shown above doesn't help either.