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)
Thu, May 2, 11:52 PM
Unknown Object (File)
Thu, May 2, 10:22 PM
Unknown Object (File)
Mar 22 2024, 2:59 AM
Unknown Object (File)
Mar 22 2024, 2:59 AM
Unknown Object (File)
Mar 22 2024, 2:58 AM
Unknown Object (File)
Mar 21 2024, 11:26 AM
Unknown Object (File)
Dec 28 2023, 7:44 PM
Unknown Object (File)
Dec 20 2023, 7:44 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