]> asedeno.scripts.mit.edu Git - linux.git/commit
PCI: iproc: Add sorted dma ranges resource entries to host bridge
authorSrinath Mannam <srinath.mannam@broadcom.com>
Fri, 3 May 2019 14:05:34 +0000 (19:35 +0530)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 6 May 2019 21:03:50 +0000 (16:03 -0500)
commit90199c951bd2a6248e55a8db3368a2568e3b3edc
treece4de577f8cc36a800d231ec01a792f77fa7c219
parentaadad097cd46f783b75c235cffa5c21fcffbf189
PCI: iproc: Add sorted dma ranges resource entries to host bridge

The iProc host controller allows only a subset of physical address space as
target of inbound PCI memory transaction addresses.

PCI device memory transactions targeting memory regions that are not
allowed for inbound transactions in the host controller are rejected by the
host controller and cannot reach the upstream buses.

The firmware device tree description defines the DMA ranges that are
addressable by devices DMA transactions; parse the device tree dma-ranges
property and add its ranges to the PCI host bridge dma_ranges list; the
iova_reserve_pci_windows() call executed at iommu_dma_init_domain() will
reserve the IOVA address ranges that are not addressable (ie memory holes
in the dma-ranges set) so that they are not allocated to PCI devices for
DMA transfers.

All allowed address ranges are listed in the dma-ranges DT parameter.  For
example:

  dma-ranges = < \
    0x43000000 0x00 0x80000000 0x00 0x80000000 0x00 0x80000000 \
    0x43000000 0x08 0x00000000 0x08 0x00000000 0x08 0x00000000 \
    0x43000000 0x80 0x00000000 0x80 0x00000000 0x40 0x00000000>

In the above example of dma-ranges, memory address from

  0x0 - 0x80000000,
  0x100000000 - 0x800000000,
  0x1000000000 - 0x8000000000 and
  0x10000000000 - 0xffffffffffffffff.

are not allowed to be used as inbound addresses.

Based-on-a-patch-by: Oza Pawandeep <oza.oza@broadcom.com>
Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
[lorenzo.pieralisi@arm.com: updated commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
[bhelgaas: fix function prototype style]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Oza Pawandeep <poza@codeaurora.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
drivers/pci/controller/pcie-iproc.c