kvm-host icon indicating copy to clipboard operation
kvm-host copied to clipboard

Replace BAR flags with unified `layout` parameter

Open otischung opened this issue 10 months ago • 1 comments

This change updates pci_set_bar() to accept a single layout bitmask instead of separate boolean flags, simplifying BAR configuration. The new layout argument encodes I/O vs. memory space, 32-/64-bit decoding, and prefetchable settings via standard PCI_BASE_ADDRESS_* macros. Existing callers can now pass any combination of:

  • PCI_BASE_ADDRESS_SPACE_IO or PCI_BASE_ADDRESS_SPACE_MEMORY
  • PCI_BASE_ADDRESS_MEM_TYPE_32 or PCI_BASE_ADDRESS_MEM_TYPE_64
  • PCI_BASE_ADDRESS_MEM_PREFETCH The function writes the full layout to the BAR, derives bar_is_io_space from bit[0], and initializes the region with the provided callback. Docstrings updated with Doxygen examples illustrating MMIO and port I/O.

BREAKING CHANGE: pci_set_bar() signature changed; call sites must be updated to pass the new layout parameter rather than separate flags.

otischung avatar Jul 01 '25 13:07 otischung

I've completed the requested changes to simplify the PCI-related comments and make them more consistent with the existing codebase style. Please review and approve when ready.

otischung avatar Jul 17 '25 09:07 otischung