virtio-pmem not working on microvm: virtio-pmem missing request data

Host environment

  • Operating system: Debian 6.0.3-1
  • OS/kernel version: Linux 6.0.0-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.0.3-1 (2022-10-21) x86_64 GNU/Linux
  • Architecture: amd64
  • QEMU flavor: qemu-system-x86_64
  • QEMU version: QEMU emulator version 7.1.0 (Debian 1:7.1+dfsg-2+b1)
  • QEMU command line:
qemu-system-x86_64 \
    -machine microvm,x-option-roms=off,pit=off,pic=off,isa-serial=off,rtc=off \
    -enable-kvm \
    -cpu host \
    -m 512m,slots=2,maxmem=4G \
    -smp 2 \
    -nodefaults \
    -no-user-config \
    -nographic \
    -kernel buildroot/output/images/vmlinux \
    -append 'root=/dev/pmem0 rootflags=dax rootfstype=erofs' \
    -object memory-backend-file,id=mem1,mem-path=rootfs.erofs.align,size=2097152 \
    -device virtio-pmem,memdev=mem1 \
    -chardev stdio,mux=on,id=con \
    -mon chardev=con \
    -device virtio-serial-device \
    -device virtconsole,chardev=con

# An equivalent command with q35 works:

qemu-system-x86_64 \
    -machine q35 \
    -enable-kvm \
    -cpu host \
    -m 512m,slots=2,maxmem=4G \
    -smp 2 \
    -nodefaults \
    -no-user-config \
    -nographic \
    -kernel buildroot/output/images/vmlinux 
    -append 'root=/dev/pmem0 rootflags=dax rootfstype=erofs'
    -object memory-backend-file,id=mem1,mem-path=rootfs.erofs.align,size=2097152 \
    -device virtio-pmem-pci,memdev=mem1 \
    -chardev stdio,mux=on,id=con \
    -mon chardev=con \
    -device virtio-serial-pci \
    -device virtconsole,chardev=con

Emulated/Virtualized environment

  • Operating system: linux-5.17.15
  • Architecture: amd64

Description of problem

When using micorvm, qemu does not "connect" the memory backend mem1 with the pmem device.

When using the first command is executed, qemu shows the following starts message:

qemu-system-x86_64: virtio-pmem missing request data 

and the kernel outputs following messages:

[    0.043871] nd_pmem namespace0.0: could not reserve region [mem 0x00000000-0x001fffff]
[    0.043923] IPI shorthand broadcast: enabled
[    0.044022] nd_pmem: probe of namespace0.0 failed with error -16