Page MenuHomeFreeBSD

sysutils/edk2: set IO port range properly for bhyve
ClosedPublic

Authored by corvink on Nov 16 2023, 6:09 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 2:19 AM
Unknown Object (File)
Tue, Apr 9, 10:16 PM
Unknown Object (File)
Sun, Apr 7, 4:35 PM
Unknown Object (File)
Sun, Apr 7, 1:32 PM
Unknown Object (File)
Sun, Apr 7, 10:45 AM
Unknown Object (File)
Sun, Mar 31, 11:29 PM
Unknown Object (File)
Sun, Mar 31, 11:29 PM
Unknown Object (File)
Sun, Mar 31, 11:29 PM
Subscribers
None

Details

Summary

Bhyve uses an io port range of [ 0x2000, 0x10000 ] [1]. At the moment,
EDKII is using a subset of this range [ 0xC000, 0x10000 ] [2]. Even
though the EDKII range doesn't exeeds the bhyve range, it's causing
issues on some guests like OpenBSD. We don't know why it's causing
issues yet. However, using the same IO port range in EDKII fixes the
issue.

[1] https://github.com/freebsd/freebsd-src/blob/82ea0132c8b17a7a6067c8a36c6434e587ede6de/usr.sbin/bhyve/pci_emul.c#L133-L134
[2] https://github.com/tianocore/edk2/blob/fb044b7fe893a4545995bfe2701fd38e593355d9/OvmfPkg/Bhyve/PlatformPei/Platform.c#L156-L157

PR: 274389

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

corvink created this revision.
  • set EDKII IO port range to [ 0x2000, 0x10000 ] too
  • set EDKII IO port range to [ 0x2000, 0x10000 ] too

Did you forget a patch ? I don't see any diff between your two diffs

In D42627#972662, @manu wrote:
  • set EDKII IO port range to [ 0x2000, 0x10000 ] too

Did you forget a patch ? I don't see any diff between your two diffs

Old diff:

-  PciIoBase = 0xC000;
-  PciIoSize = 0x4000;
+  PciIoBase = 0x2000;
+  PciIoSize = 0xC000;

New diff:

-  PciIoBase = 0xC000;
-  PciIoSize = 0x4000;
+  PciIoBase = 0x2000;
+  PciIoSize = 0xE000;

In the new diff PciIoSize is 0xE000 now.

In D42627#972662, @manu wrote:
  • set EDKII IO port range to [ 0x2000, 0x10000 ] too

Did you forget a patch ? I don't see any diff between your two diffs

Old diff:

-  PciIoBase = 0xC000;
-  PciIoSize = 0x4000;
+  PciIoBase = 0x2000;
+  PciIoSize = 0xC000;

New diff:

-  PciIoBase = 0xC000;
-  PciIoSize = 0x4000;
+  PciIoBase = 0x2000;
+  PciIoSize = 0xE000;

In the new diff PciIoSize is 0xE000 now.

Ah yeah, I should have read more carefully :)
I'm ok with this as long as this will be upstreamed and that the patch will be dropped in a future update.

This revision is now accepted and ready to land.Nov 16 2023, 8:06 AM
In D42627#972664, @manu wrote:

I'm ok with this as long as this will be upstreamed and that the patch will be dropped in a future update.

I'm going to upstream this patch when someone has confirmed that it solves https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274389.

I had to change the patch to use DOS line endings. With that, I'm able to boot an OpenBSD guest after applying this patch and rebuilding edk2-bhyve.

Will this change make it into the package set used for 14.0-RELEASE? That is, will it go into the quarterly branch?

I had to change the patch to use DOS line endings. With that, I'm able to boot an OpenBSD guest after applying this patch and rebuilding edk2-bhyve.

Will this change make it into the package set used for 14.0-RELEASE? That is, will it go into the quarterly branch?

This can go in quarterly easily if you want, but it will not be in the release_0 packages as it's already taggued, but since those packages are only used for DVD it's ok.

In D42627#972798, @manu wrote:

I had to change the patch to use DOS line endings. With that, I'm able to boot an OpenBSD guest after applying this patch and rebuilding edk2-bhyve.

Will this change make it into the package set used for 14.0-RELEASE? That is, will it go into the quarterly branch?

This can go in quarterly easily if you want

If doing so means that 14.0 users will be able to run OpenBSD (or other affected OSs) in bhyve without hitting the regression, then yes please. :)

This revision now requires review to proceed.Nov 17 2023, 12:33 PM
This revision is now accepted and ready to land.Nov 17 2023, 1:23 PM