Skip to content

Commit 50955df

Browse files
kelleymhallenpais
authored andcommitted
PCI: hv: Propagate coherence from VMbus device to PCI device
PCI pass-thru devices in a Hyper-V VM are represented as a VMBus device and as a PCI device. The coherence of the VMbus device is set based on the VMbus node in ACPI, but the PCI device has no ACPI node and defaults to not hardware coherent. This results in extra software coherence management overhead on ARM64 when devices are hardware coherent. Fix this by setting up the PCI host bus so that normal PCI mechanisms will propagate the coherence of the VMbus device to the PCI device. There's no effect on x86/x64 where devices are always hardware coherent. Signed-off-by: Michael Kelley <[email protected]> (cherry picked from commit 5e837f35e803dd6b28e3323126ff479376c79772)
1 parent 3800daf commit 50955df

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/pci/controller/pci-hyperv.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3395,6 +3395,15 @@ static int hv_pci_probe(struct hv_device *hdev,
33953395
hbus->bridge->domain_nr = dom;
33963396
#ifdef CONFIG_X86
33973397
hbus->sysdata.domain = dom;
3398+
#elif defined(CONFIG_ARM64)
3399+
/*
3400+
* Set the PCI bus parent to be the corresponding VMbus
3401+
* device. Then the VMbus device will be assigned as the
3402+
* ACPI companion in pcibios_root_bridge_prepare() and
3403+
* pci_dma_configure() will propagate device coherence
3404+
* information to devices created on the bus.
3405+
*/
3406+
hbus->sysdata.parent = hdev->device.parent;
33983407
#endif
33993408

34003409
hbus->hdev = hdev;

0 commit comments

Comments
 (0)