I have built & installed Xen 4.15 onto my Ubuntu20.04 platform successfully according to https://wiki.xenproject.org/wiki/Compiling_Xen_From_Source
After reboot, I entered Domain 0 successfully. The command xl info shows the right version string.
host : xvg
release : 5.13.0-30-generic
version : #33~20.04.1-Ubuntu SMP Mon Feb 7 14:25:10 UTC 2022
machine : x86_64
nr_cpus : 16
max_cpu_id : 31
nr_nodes : 1
cores_per_socket : 8
threads_per_core : 2
cpu_mhz : 2994.377
hw_caps : 178bf3ff:76d8320b:2e500800:244037ff:0000000f:219c91a9:00400004:00000500
virt_caps : pv hvm hvm_directio pv_directio hap shadow
total_memory : 15719
free_memory : 11425
sharing_freed_memory : 0
sharing_used_memory : 0
outstanding_claims : 0
free_cpus : 0
xen_major : 4
xen_minor : 15
xen_extra : .3-pre
xen_version : 4.15.3-pre
xen_caps : xen-3.0-x86_64 hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit2
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : Fri Mar 4 13:33:49 2022 +0800 git:6aa4cdbc31
xen_commandline : placeholder dom0_mem=4096M,max:8192M no-real-mode edd=off
cc_compiler : gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
cc_compile_by : xvg
cc_compile_domain :
cc_compile_date : Fri Mar 4 14:21:33 CST 2022
build_id : 234929adcb7588b1414c2b6e5477fa95052b4ded
xend_config_format : 4
Then my next step is to create ubuntu guest VM(sudo or use root user):
/usr/local/lib/xen/bin/qemu-system-x86_64 -smp 1 -xen-domid 4 -machine xenfv -m 4G -net nic,model=virtio -net user,hostfwd=tcp::2222-:22 -hda ./u2004.qcow2 -boot d -cdrom ./ubuntu-20.04-desktop-amd64.iso
However, I always failed with the following error:
qemu-system-x86_64: failed to map ioreq server resources: error 3 handle=0x55eeb1f6c0b0
qemu-system-x86_64: xen hardware virtual machine initialisation failed
After debugging, the error is caused by osdep_xenforeignmemory_map_resource failed to invoke IOCTL_PRIVCMD_MMAP_RESOURCE. And this IOCTL will return -1.
So my question is, am I using the right qemu command? Anything else is needed to set/config?
Note, if I didn't specify the option ' -xen-domid 4 -machine xenfv ', I can start qemu successfully
Any suggestions/help will be greatly appricated.