Re: PVH boot with qemu

2024-01-08 Thread Emile 'iMil' Heitor
On 1/8/24 23:05, Manuel Bouyer wrote: in consinit.c you have: +#if defined(XENPVHVM) || defined(GENPVH) +#ifndef GENPVH if (vm_guest == VM_GUEST_XENPVH) { if (xen_pvh_consinit() != 0) return; /* fallback to native console

Re: PVH boot with qemu

2024-01-08 Thread Manuel Bouyer
On Mon, Jan 08, 2024 at 10:03:07PM +0100, Emile 'iMil' Heitor wrote: > > This morning I was given the idea of having the possibility to build a > Xen-free kernel but still GENPVH capable. > This doesn't impact GENERIC which is still able to boot both Xen and > GENPVH with the following

Re: PVH boot with qemu

2024-01-08 Thread Emile 'iMil' Heitor
This morning I was given the idea of having the possibility to build a Xen-free kernel but still GENPVH capable. This doesn't impact GENERIC which is still able to boot both Xen and GENPVH with the following configuration: options XENPVHVM options XEN hypervisor* at

Re: PVH boot with qemu

2024-01-02 Thread Emile `iMil' Heitor
Here's a final patch https://imil.net/NetBSD/GENPVH.patch It implements PVH boot from both qemu with the -kernel flag and Firecracker with Colin Perceval's PVH patches https://github.com/firecracker-microvm/firecracker/tree/feature/pvh The patch should apply on current as-is https

Re: PVH boot with qemu

2023-12-18 Thread Thor Lancelot Simon
On Mon, Dec 11, 2023 at 10:22:18AM +0100, Emile `iMil' Heitor wrote: > > Or would you prefer the same kernel to be able to boot in both XENPVH and > GENPVH modes? I am focusing on making the resulting kernel smaller but this > could be done also. Yes, the same kernel should be able to boot on

Re: PVH boot with qemu

2023-12-11 Thread Emile `iMil' Heitor
On Mon, 11 Dec 2023, Emile `iMil' Heitor wrote: 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. I am able to boot this patched NetBSD kernel using Colin Percival's PVH-enabled Firecracker

Re: PVH boot with qemu

2023-12-11 Thread Emile `iMil' Heitor
On Mon, 11 Dec 2023, Manuel Bouyer wrote: Yes, right now GENERIC can be used on bare-metal, PVHVM and XENPVH. It would be good to have GENERIC working on GENPVH too. Fair enough, I'll switch to this path then, thanks for the advice.

Re: PVH boot with qemu

2023-12-11 Thread Manuel Bouyer
On Mon, Dec 11, 2023 at 10:22:18AM +0100, Emile `iMil' Heitor wrote: > > Hi Manuel, > > On Mon, 11 Dec 2023, Manuel Bouyer wrote: > > > #ifndef GENPVH > > /* get a page for HYPERVISOR_shared_info */ > > addl$PAGE_SIZE, %ebx > > addl$PGOFSET,%ebx > > andl

Re: PVH boot with qemu

2023-12-11 Thread Martin Husemann
On Mon, Dec 11, 2023 at 10:22:18AM +0100, Emile `iMil' Heitor wrote: > Or would you prefer the same kernel to be able to boot in both XENPVH and > GENPVH modes? I am focusing on making the resulting kernel smaller but this > could be done also. Can you use a separate entry point and optimize the

Re: PVH boot with qemu

2023-12-11 Thread Emile `iMil' Heitor
Hi Manuel, On Mon, 11 Dec 2023, Manuel Bouyer wrote: #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

Re: PVH boot with qemu

2023-12-11 Thread Manuel Bouyer
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

Re: PVH boot with qemu

2023-12-10 Thread Emile `iMil' Heitor
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

Re: PVH boot with qemu

2023-12-06 Thread David Brownlee
On Wed, 6 Dec 2023 at 11:37, Emile `iMil' Heitor wrote: > > I got it working. > > NetBSD/amd64 kernel booting in PVH mode straight from qemu -kernel flag. > It now needs a lot of cleaninig as it's basically a PoC, but here's a > WIP patch if anyone's interested in hacking into it. > >

Re: PVH boot with qemu

2023-12-06 Thread Emile `iMil' Heitor
I got it working. NetBSD/amd64 kernel booting in PVH mode straight from qemu -kernel flag. It now needs a lot of cleaninig as it's basically a PoC, but here's a WIP patch if anyone's interested in hacking into it. https://imil.net/NetBSD/qemu-pvh.patch Let me rephrase: I *know* it is ugly at

Re: PVH boot with qemu

2023-11-29 Thread Manuel Bouyer
On Wed, Nov 29, 2023 at 12:41:53PM +0100, Emile `iMil' Heitor wrote: > On Wed, 29 Nov 2023, Manuel Bouyer wrote: > > > Of course, this is *not* a Xen VM, so no surprise that start_xen32 > > isn't working. > > I'm just sharing the progress here, in case someone is interested. If this > is

Re: PVH boot with qemu

2023-11-29 Thread Emile `iMil' Heitor
On Wed, 29 Nov 2023, Manuel Bouyer wrote: Of course, this is *not* a Xen VM, so no surprise that start_xen32 isn't working. I'm just sharing the progress here, in case someone is interested. If this is annoying, I'll just keep it to myself until I post an -hypothetical- final patch, and sorry

Re: PVH boot with qemu

2023-11-29 Thread Manuel Bouyer
On Wed, Nov 29, 2023 at 08:22:32AM +0100, Emile `iMil' Heitor wrote: > On Thu, 23 Nov 2023, Emile `iMil' Heitor wrote: > > > It seems we have a similar problem to the second bullet point Colin Percival > > noted here > > https://www.daemonology.net/blog/2022-10-18-FreeBSD-Firecracker.html > >

Re: PVH boot with qemu

2023-11-28 Thread Emile `iMil' Heitor
On Thu, 23 Nov 2023, Emile `iMil' Heitor wrote: It seems we have a similar problem to the second bullet point Colin Percival noted here https://www.daemonology.net/blog/2022-10-18-FreeBSD-Firecracker.html When removing the hvm_start_info address save portion, the sym mapping doesn't fall into

Re: PVH boot with qemu

2023-11-23 Thread Emile `iMil' Heitor
On Mon, 13 Nov 2023, Manuel Bouyer wrote: On Mon, Nov 13, 2023 at 06:37:01AM +0100, Emile `iMil' Heitor wrote: The start_xen32 entrypoint is then found, and the kernel start, but falls in an infinite loop in locore.S when mapping symbols and preloaded modules, more precisely, in the

Re: PVH boot with qemu

2023-11-13 Thread Manuel Bouyer
On Mon, Nov 13, 2023 at 06:37:01AM +0100, Emile `iMil' Heitor wrote: > > I first asked guidance in port-xen@ but the topic doesn't seem to have much > success, I'll try my chances here. > > I am trying to make NetBSD/amd64 boot in PVH mode with qemu, using qemu's > -kernel flag. The kernel does

PVH boot with qemu

2023-11-12 Thread Emile `iMil' Heitor
I first asked guidance in port-xen@ but the topic doesn't seem to have much success, I'll try my chances here. I am trying to make NetBSD/amd64 boot in PVH mode with qemu, using qemu's -kernel flag. The kernel does start executing thanks to the first step explained here