Page MenuHomeFreeBSD

bhyve: Make most I/O port handling specific to amd64
ClosedPublic

Authored by markj on Jun 23 2023, 10:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 3, 12:45 PM
Unknown Object (File)
Mon, Oct 21, 5:11 PM
Unknown Object (File)
Oct 5 2024, 11:26 AM
Unknown Object (File)
Oct 3 2024, 5:54 AM
Unknown Object (File)
Oct 2 2024, 10:04 AM
Unknown Object (File)
Sep 27 2024, 1:27 PM
Unknown Object (File)
Sep 27 2024, 6:51 AM
Unknown Object (File)
Sep 27 2024, 2:25 AM
Subscribers

Details

Summary
  • The qemu_fwcfg interface, as implemented, is I/O port-based, but QEMU implements an MMIO interface that we'll eventually want to port for arm64.
  • Retain support for I/O space PCI BARs, simply treat them like MMIO BARs for most purposes, similar to what the arm64 kernel does. Such BARs are created by virtio devices.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Jun 26 2023, 6:37 AM
usr.sbin/bhyve/pci_emul.c
535

I would maybe structure this as:

#ifdef __amd64__
static int
pci_emul_io_handler(... inout args)
{
   inout version
}
#else
static int
pci_emul_io_handler(... mem args)
{
  mr version
}
#endif
636

I think I'd almost rather do a bit more duplication here instead as I would find it more readable I think:

case PCIBAR_IO:
#ifdef __amd64__
     bzero(&iop, sizeof(struct inout_port));
     ...
#else
     bzero(&mr, sizeof(struct mem_range));
#endif
     break;

One thing that would help perhaps to reduce duplication would be to first move the pe_baraddr calls out of the case statement entirely as they are duplicated for all cases.

markj marked 2 inline comments as done.

Apply jhb's suggestions.

This revision now requires review to proceed.Jul 5 2023, 3:15 PM
This revision is now accepted and ready to land.Jul 5 2023, 8:44 PM