acrn-hypervisor/hypervisor/include
Sainath Grandhi 422330d4ab HV: reimplement PCI device discovery
Major changes:

1. Correct handling of device multi-function capability

We only check function zero for this feature. If it has it, we continue
looking at all remaining functions, ignoring those with invalid vendors.
The PCI spec says we are not to probe beyond function zero if it does
not exist or indicates it is not a multi-function device.

2a. Walk *ALL* buses in the PCI space, however,
Before walking the PCI hierarchy, post-processed ACPI DMAR info is parsed
and a map is created between all device-scopes across all DRHDs and the
corresponding IOMMU index.

This map is used at the time of walking the PCI hierarchy. If a BDF that
ACRN is currently working on, is found in the above-mentioned map, the
BDF device is mapped to the corresponding DRHD in the map.
If the BDF were a bridge type, realized with "Header Type" in config space,
the BDF device along with all its downstream devices are mapped to the
corresponding DRHD in the map.

To avoid walking previously visited buses, we maintain a bitmap that
stores which bus is walked when we handle Bridge type devices.

Once ACPI information is included into ACRN about the PCI-Express Root
Complexes / PCI Host Bridges, we can avoid the final loop which probes
all remainder buses, and instead jump to the next Host Bridge bus.

From prior patches, init_pdev returns the pdev structure it created to
the caller. This allows us to complete initialization by updating its
drhd_idx to the correct DRHD.

Tracked-On: #4134
Signed-off-by: Alexander Merritt <alex.merritt@intel.com>
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
2019-11-27 09:49:32 +08:00
..
arch/x86 HV: add DRHD index to pci_pdev 2019-11-27 09:49:32 +08:00
common hv: sched: add kick_thread to support notification 2019-10-25 13:00:21 +08:00
debug SEP/SOCWATCH change variable names 2019-09-16 15:54:34 +08:00
dm hv: vpci: reshuffle pci_bar structure 2019-11-15 13:54:21 +08:00
hw HV: reimplement PCI device discovery 2019-11-27 09:49:32 +08:00
lib hv: add ACPI support for pre-launched VMs 2019-08-29 10:12:25 +08:00
public hv: make hypercall HC_CREATE_VCPU empty 2019-09-24 11:58:45 +08:00