1
votes

I want to learn the NVMe driver in Linux, but I don't have a physical NVMe drive. So, I think QEMU is my current only choice. I setup the system in these steps logined as "root":

  1. built QEMU-2.2.1 from source code cloned from stable branch

    git clone -b stable-2.2 git://git.qemu-project.org/qemu
    ./configure --enable-linux-aio --target-list=x86_64-softmmu
    make clean
    make -j8
    make install

  2. create an img and install CentOS6.6 into this image:

    qemu-img create -f raw ./vdisk/16GB.img 16G
    qemu-system-x86_64 -m 1024 -cdrom ./vdisk/CentOS-6.6-x86_64-minimal.iso -hda ./vdisk/16GB.img

  3. run CentOS6.6 in QEMU with nvme device

    qemu-system-x86_64 -m 1024 -hda ./vdisk/16GB.img -device nvme

    But it shows the error message below:

    qemu-system-x86_64: -device nvme: Device initialization failed.
    qemu-system-x86_64: -device nvme: Device 'nvme' could not be initialized

  4. I also run the CentOS6.6 in QEMU without nvme device, it just runs very well.

    qemu-system-x86_64 -m 1024 -hda ./vdisk/16GB.img

So, how can I get more debug information on this error? Or, how can I solve this issue if you also have similar experience?

Thanks,
-Crane

1

1 Answers

1
votes

Find the solution: create a img for nvme device, and start qemu like this:

qemu-system-x86_64 -m 2048 -hda ./vdisk/16GB.img -drive file=./vdisk/nvme_dut.img,if=none,id=drv0 -device nvme,drive=drv0,serial=foo --enable-kvm -smp 2