Skip to content

Commit 8d21732

Browse files
kelleymhliuw
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 <mikelley@microsoft.com> Acked-by: Boqun Feng <boqun.feng@gmail.com> Acked-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/1648138492-2191-3-git-send-email-mikelley@microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
1 parent 3720007 commit 8d21732

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/pci/controller/pci-hyperv.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3404,6 +3404,15 @@ static int hv_pci_probe(struct hv_device *hdev,
34043404
hbus->bridge->domain_nr = dom;
34053405
#ifdef CONFIG_X86
34063406
hbus->sysdata.domain = dom;
3407+
#elif defined(CONFIG_ARM64)
3408+
/*
3409+
* Set the PCI bus parent to be the corresponding VMbus
3410+
* device. Then the VMbus device will be assigned as the
3411+
* ACPI companion in pcibios_root_bridge_prepare() and
3412+
* pci_dma_configure() will propagate device coherence
3413+
* information to devices created on the bus.
3414+
*/
3415+
hbus->sysdata.parent = hdev->device.parent;
34073416
#endif
34083417

34093418
hbus->hdev = hdev;

0 commit comments

Comments
 (0)