Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vfio-plugin: refactor and fix bugs in enumeration #1805

Merged
merged 7 commits into from
Jan 20, 2021

Conversation

r-rojo
Copy link
Contributor

@r-rojo r-rojo commented Jan 19, 2021

  • Refactor enumeration in vfio plugin to match PCIe attributes (BDF, socket id)
    • Add functions, pci_matches_filters and pci_matches_filter that are called first during enumeration.
      • If the filters are empty or the the pci attributes in the filters match the device, it is considered for the rest of enumeration
      • Otherwise, it is skipped
    • Move token lists from a static token list into the static list of pci_device_t structures.
    • This helps prevent reading of CSR space by filtering on specific PCIe attributes read from sysfs
      IOW, given a specific PCIe address (segment, bus, device, function), the mmio space will be read only when the PCIe address is
      set in the filter and it matches a device.
  • Fix use of open_vfio_pair so that it is called only when a VF has a PF
    physfn AND that device is bound to the vfio-pci driver.
  • Read afu_id for BAR0 when treating a whole device as an accelerator.

Move reading of mmio until after pci attributes match filters.
* fix use of open_vfio_pair so that it is called only when a VF has a PF
physfn and that device is bound to the vfio-pci driver
* read afu_id for BAR0 when treating a whole device as an accelerator
@r-rojo r-rojo self-assigned this Jan 19, 2021
@coveralls
Copy link

coveralls commented Jan 19, 2021

Coverage Status

Coverage decreased (-0.007%) to 75.361% when pulling 2224392 on rrojo/vfio_plugin_refactor_enum into 86282f4 on master.

anandaravuri
anandaravuri previously approved these changes Jan 19, 2021
tswhison
tswhison previously approved these changes Jan 19, 2021
void free_token_list(vfio_token *tokens)
{
while (tokens) {
vfio_token *t = tokens;;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/;;/;/ :)

@r-rojo r-rojo merged commit c11b260 into master Jan 20, 2021
@r-rojo r-rojo deleted the rrojo/vfio_plugin_refactor_enum branch January 20, 2021 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants