Mailing List Archive

OvmfXen and PVH
Hello,
I read in an old post from 2019 that the specific OVMF target platform
OvmfXen can boot in a PVH type domU. And in another old post I read that
a new console type was built for use with this PVH domUs.
I was hoping that I could use it to boot Linux PVH DomUs with EFIstub
kernels or systemd-boot, but I can't get it to work.

I use a simple pvh-domu.cfg:
type = "pvh"
kernel = "/usr/lib/xen/boot/ovmf.bin"
disk = [...]
vif = [...]
...

In the verbose output of xl toolstack (xl -vvv create -c pvh-domu.cfg) I
can see that the domU is destroyed right after creation. The same domU
configuration works as HVM domU and as PVH domU with pygrub bootloader.

Is there any way to get this to work with Xen 4.16.0?

--
THX,
Stefan
Re: OvmfXen and PVH [ In reply to ]
On Tue, Jan 04, 2022 at 03:37:12PM +0100, Stefan Kadow wrote:
> Hello,
> I read in an old post from 2019 that the specific OVMF target platform
> OvmfXen can boot in a PVH type domU. And in another old post I read that a
> new console type was built for use with this PVH domUs.
> I was hoping that I could use it to boot Linux PVH DomUs with EFIstub
> kernels or systemd-boot, but I can't get it to work.

Thanks for testing this! Unfortunately, there's still a little bit of
work on the project. OvmfXen doesn't know how to shutdown when run as
PVH yet, and this is checked at boot time so it doesn't even try to boot
the operating system.

> I use a simple pvh-domu.cfg:
> type = "pvh"
> kernel = "/usr/lib/xen/boot/ovmf.bin"
> disk = [...]
> vif = [...]
> ...
>
> In the verbose output of xl toolstack (xl -vvv create -c pvh-domu.cfg) I can
> see that the domU is destroyed right after creation. The same domU
> configuration works as HVM domU and as PVH domU with pygrub bootloader.

I don't know why the guest would be destroyed, is there some information
before that? Maybe `xl` didn't recognized "ovmf.bin" as a PVH "kernel"?

In the issue I've mention above, I think OvmfXen would just run an
infinite loop, so the guess wouldn't be destroyed.

> Is there any way to get this to work with Xen 4.16.0?

By hacking OVMF and rebuilding it. Otherwise not really. Sorry.

For you or anyone looking at testing OVMF on PVH, the hack is going to
be:

diff --git a/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c b/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c
--- a/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c
+++ b/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c
@@ -35,9 +35,7 @@ DxeResetInit (
mAcpiPmBaseAddress = ICH9_PMBASE_VALUE;
break;
default:
- ASSERT (FALSE);
- CpuDeadLoop ();
- return EFI_UNSUPPORTED;
+ break;
}

return EFI_SUCCESS;


With that, the guest should boot, but shutdown isn't going to work so
one will have to destroy the guest after trying to shutdown.

There's also a build option to have OVMF logging somewhere when run as
PVH, "-D DEBUG_ON_HYPERVISOR_CONSOLE", which would log to the host
serial console. But that might only work with a debug build of xen and
one would probably need a serial port.

Cheers,

--
Anthony PERARD
Re: OvmfXen and PVH [ In reply to ]
Am Mittwoch, 5. Januar 2022, 18:19:19 CET schrieb Anthony PERARD:
> On Tue, Jan 04, 2022 at 03:37:12PM +0100, Stefan Kadow wrote:
> > Hello,
> > I read in an old post from 2019 that the specific OVMF target platform
> > OvmfXen can boot in a PVH type domU. And in another old post I read that a
> > new console type was built for use with this PVH domUs.
> > I was hoping that I could use it to boot Linux PVH DomUs with EFIstub
> > kernels or systemd-boot, but I can't get it to work.
>
> Thanks for testing this! Unfortunately, there's still a little bit of
> work on the project. OvmfXen doesn't know how to shutdown when run as
> PVH yet, and this is checked at boot time so it doesn't even try to
> boot
> the operating system.
>
> > I use a simple pvh-domu.cfg:
> > type = "pvh"
> > kernel = "/usr/lib/xen/boot/ovmf.bin"
> > disk = [...]
> > vif = [...]
> > ...
> >
> > In the verbose output of xl toolstack (xl -vvv create -c pvh-domu.cfg) I
> > can see that the domU is destroyed right after creation. The same domU
> > configuration works as HVM domU and as PVH domU with pygrub bootloader.
> I don't know why the guest would be destroyed, is there some
> information
> before that? Maybe `xl` didn't recognized "ovmf.bin" as a PVH "kernel"?
>
> In the issue I've mention above, I think OvmfXen would just run an
> infinite loop, so the guess wouldn't be destroyed.
Obviously i misinterpreted the log outputs, because after i installed
your patch, the system behaved as you predicted and the log outputs were
the same.

> > Is there any way to get this to work with Xen 4.16.0?
>
> By hacking OVMF and rebuilding it. Otherwise not really. Sorry.
>
> For you or anyone looking at testing OVMF on PVH, the hack is going to
> be:
>
> diff --git a/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c
> b/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c ---
> a/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c
> +++ b/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c
> @@ -35,9 +35,7 @@ DxeResetInit (
> mAcpiPmBaseAddress = ICH9_PMBASE_VALUE;
> break;
> default:
> - ASSERT (FALSE);
> - CpuDeadLoop ();
> - return EFI_UNSUPPORTED;
> + break;
> }
>
> return EFI_SUCCESS;
>
>
> With that, the guest should boot, but shutdown isn't going to work so
> one will have to destroy the guest after trying to shutdown.
>
> There's also a build option to have OVMF logging somewhere when run as
> PVH, "-D DEBUG_ON_HYPERVISOR_CONSOLE", which would log to the host
> serial console. But that might only work with a debug build of xen and
> one would probably need a serial port.

Thanks for this patch!
This is a very nice way to boot a pvh type guest, it boots very fast and
allows configuring the boot manager inside the guest. I hope that this
feature will be included in a future release as soon as possible.

I will try to create a debug build of xen to help test this feature in
the future xen release candidate.

--
THX