Page MenuHomeFreeBSD

bhyve: read OpRegion address and size for GVT-d
ClosedPublic

Authored by corvink on May 10 2023, 12:45 PM.
Tags
None
Referenced Files
F82737466: D40040.diff
Thu, May 2, 4:10 AM
Unknown Object (File)
Tue, Apr 23, 8:12 AM
Unknown Object (File)
Feb 16 2024, 4:17 PM
Unknown Object (File)
Jan 27 2024, 10:35 AM
Unknown Object (File)
Jan 27 2024, 10:35 AM
Unknown Object (File)
Jan 27 2024, 10:34 AM
Unknown Object (File)
Jan 27 2024, 10:34 AM
Unknown Object (File)
Jan 27 2024, 10:34 AM
Subscribers

Details

Summary

The OpRegion provides some configuration bits and ACPI methods used by
some Intel drivers. The guest needs access to it. In the first step,
we're reading it's address and size.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 51442
Build 48333: arc lint + arc unit

Event Timeline

usr.sbin/bhyve/pci_gvt-d.c
168

It can't be O_RDONLY?

201

memfd is leaked here, no? We should be able to close it after mapping the header, I believe. In general we don't want to leave a fd for /dev/mem lying around.

  • don't leak memfd
  • open memfd readonly
usr.sbin/bhyve/pci_gvt-d.c
186
188
190

The header is guaranteed to be page-aligned?

usr.sbin/bhyve/pci_gvt-d.c
190

No, it doesn't have to be page aligned. On my systems it has an offset of +0x18 to page boundary. Don't know why.

  • don't return errno
  • make use of warn instead of warnx

@jhb @markj Any additional comments?

This revision is now accepted and ready to land.Jun 7 2023, 6:35 PM