summaryrefslogtreecommitdiff
path: root/arch/x86/pci/vmd.c
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2016-03-03 01:31:03 +0300
committerBjorn Helgaas <bhelgaas@google.com>2016-03-10 23:52:13 +0300
commit83cc54a608b66d3fffa7355503263d20f491bb44 (patch)
treedad3fe08459f1f0f0402e982f41b34f9b36f38cd /arch/x86/pci/vmd.c
parent92e963f50fc74041b5e9e744c330dca48e04f08d (diff)
downloadlinux-83cc54a608b66d3fffa7355503263d20f491bb44.tar.xz
x86/PCI: VMD: Document code for maintainability
Comment the less obvious portion of the code for setting up memory windows, and the platform dependency for initializing the h/w with appropriate resources. Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/x86/pci/vmd.c')
-rw-r--r--arch/x86/pci/vmd.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c
index d57e48016f15..29aebbcb510b 100644
--- a/arch/x86/pci/vmd.c
+++ b/arch/x86/pci/vmd.c
@@ -532,6 +532,23 @@ static int vmd_enable_domain(struct vmd_dev *vmd)
.flags = IORESOURCE_BUS | IORESOURCE_PCI_FIXED,
};
+ /*
+ * If the window is below 4GB, clear IORESOURCE_MEM_64 so we can
+ * put 32-bit resources in the window.
+ *
+ * There's no hardware reason why a 64-bit window *couldn't*
+ * contain a 32-bit resource, but pbus_size_mem() computes the
+ * bridge window size assuming a 64-bit window will contain no
+ * 32-bit resources. __pci_assign_resource() enforces that
+ * artificial restriction to make sure everything will fit.
+ *
+ * The only way we could use a 64-bit non-prefechable MEMBAR is
+ * if its address is <4GB so that we can convert it to a 32-bit
+ * resource. To be visible to the host OS, all VMD endpoints must
+ * be initially configured by platform BIOS, which includes setting
+ * up these resources. We can assume the device is configured
+ * according to the platform needs.
+ */
res = &vmd->dev->resource[VMD_MEMBAR1];
upper_bits = upper_32_bits(res->end);
flags = res->flags & ~IORESOURCE_SIZEALIGN;