[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1648138492-2191-3-git-send-email-mikelley@microsoft.com>
Date: Thu, 24 Mar 2022 09:14:52 -0700
From: Michael Kelley <mikelley@...rosoft.com>
To: sthemmin@...rosoft.com, kys@...rosoft.com, haiyangz@...rosoft.com,
wei.liu@...nel.org, decui@...rosoft.com, rafael@...nel.org,
lenb@...nel.org, lorenzo.pieralisi@....com, robh@...nel.org,
kw@...ux.com, bhelgaas@...gle.com, hch@....de,
m.szyprowski@...sung.com, robin.murphy@....com,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hyperv@...r.kernel.org, linux-pci@...r.kernel.org,
iommu@...ts.linux-foundation.org
Cc: mikelley@...rosoft.com
Subject: [PATCH v3 2/2] 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@...rosoft.com>
Acked-by: Boqun Feng <boqun.feng@...il.com>
Acked-by: Robin Murphy <robin.murphy@....com>
---
drivers/pci/controller/pci-hyperv.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index ae0bc2f..88b3b56 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -3404,6 +3404,15 @@ static int hv_pci_probe(struct hv_device *hdev,
hbus->bridge->domain_nr = dom;
#ifdef CONFIG_X86
hbus->sysdata.domain = dom;
+#elif defined(CONFIG_ARM64)
+ /*
+ * Set the PCI bus parent to be the corresponding VMbus
+ * device. Then the VMbus device will be assigned as the
+ * ACPI companion in pcibios_root_bridge_prepare() and
+ * pci_dma_configure() will propagate device coherence
+ * information to devices created on the bus.
+ */
+ hbus->sysdata.parent = hdev->device.parent;
#endif
hbus->hdev = hdev;
--
1.8.3.1
Powered by blists - more mailing lists