]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
PCI: designware-ep: Fix find_first_zero_bit() usage
authorNiklas Cassel <niklas.cassel@axis.com>
Thu, 14 Dec 2017 13:01:44 +0000 (14:01 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 26 Sep 2019 04:34:52 +0000 (00:34 -0400)
commit56241974449f37b8985a06df59bfc390384b881a
tree9367131c95b88222fded35bef1a2537a597d9391
parent494024ec1f98d00385029a832fde0360e0ca5f17
PCI: designware-ep: Fix find_first_zero_bit() usage

BugLink: https://bugs.launchpad.net/bugs/1844558
commit ad4a5becc689c3f32bbbc2b37eff89efe19dc2f9 upstream.

find_first_zero_bit()'s parameter 'size' is defined in bits,
not in bytes.

find_first_zero_bit() is called with size in bytes rather than bits,
which thus defines a too low upper limit, causing
dw_pcie_ep_inbound_atu() to assign iatu index #4 to both bar 4
and bar 5, which makes bar 5 overwrite the settings set by bar 4.

Since the sizes of the bitmaps are known, dynamically allocate the
bitmaps, and use the correct size when calling find_first_zero_bit().

Additionally, make sure that ep->num_ob_windows and ep->num_ib_windows,
which are obtained from device tree, are smaller than the maximum number
of iATUs (MAX_IATU_IN/MAX_IATU_OUT).

Fixes: f8aed6ec624f ("PCI: dwc: designware: Add EP mode support")
Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/pci/dwc/pcie-designware-ep.c
drivers/pci/dwc/pcie-designware.h