tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PVH boot with qemu



On Mon, Dec 11, 2023 at 08:26:01AM +0100, Emile `iMil' Heitor wrote:
> 
> Here is a clean(er) patch https://github.com/NetBSD/src/compare/trunk...NetBSDfr:NetBSD-src:GENPVH
> 
> Rationale
> 
> Like previously explained, locore.S expects start_info being passed by the
> calling hypervisor on %ebx to be located at the end of the symbol table.
> Qemu and Firecracker don't follow this rule which is not part of the
> official Xen ABI https://xenbits.xen.org/docs/unstable/misc/pvh.html
> 
> What our patch first does is make memory mapping loops happy by copying
> the start_info structure where it's expected.
> After that, memory locations and boot parameters are correctly found and
> boot can proceed.
> Of course, the hypervisor not being Xen, a lot of Xen-related code is
> useless, hence the new VM_GUEST_GENPVH (for Generic PVH) vm_guest type,
> as first suggested by Manuel, and a new kernel option, GENPVH.
> I kept the Xen code structure as it was and changed very little code, only
> some || vm_guest == VM_GUEST_GENPVH and a couple #ifndef GENPVH.
> 
> In order to build a Generic PVH kernel, the following options are needed
> 
> #Xen PV support for PVH and HVM guests
> options         XENPVHVM
> options         XEN
> # Generic PVH support (qemu, firecracker...)
> options         GENPVH
> 
> I've added https://github.com/NetBSDfr/NetBSD-src/blob/GENPVH/sys/arch/amd64/conf/MICROVM
> as an example config file.
> I'll probably end up ditching XENPVHVM and XEN but there's still quite
> some work in there.
> 
> We still need to check if we didn't break anything on Xen side and test
> Firecracker. FYI qemu-system-x86_64 also works with the "microvm"
> machine type.
> 
> Feedback very welcome.


Hello,
I don't understand this part:


#ifndef GENPVH
	/* get a page for HYPERVISOR_shared_info */
	addl	$PAGE_SIZE, %ebx
	addl	$PGOFSET,%ebx
	andl	$~PGOFSET,%ebx
	movl	$RELOC(HYPERVISOR_shared_info_pa),%ebp
	movl	%ebx,(%ebp)
	movl	$0,4(%ebp)
#endif

How can this work on Xen when GENPVH is defined ?
Shouldn't this be made conditional on vm_guest == VM_GUEST_XENPVH ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index