android_kernel_sony_sdm845/drivers/pci
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Bharat Kumar Gogada 5086e479e2 PCI: xilinx-nwl: Fix Multi MSI data programming
[ Upstream commit 181fa434d0514e40ebf6e9721f2b72700287b6e2 ]

According to the PCI Local Bus specification Revision 3.0,
section 6.8.1.3 (Message Control for MSI), endpoints that
are Multiple Message Capable as defined by bits [3:1] in
the Message Control for MSI can request a number of vectors
that is power of two aligned.

As specified in section 6.8.1.6 "Message data for MSI", the Multiple
Message Enable field (bits [6:4] of the Message Control register)
defines the number of low order message data bits the function is
permitted to modify to generate its system software allocated
vectors.

The MSI controller in the Xilinx NWL PCIe controller supports a number
of MSI vectors specified through a bitmap and the hwirq number for an
MSI, that is the value written in the MSI data TLP is determined by
the bitmap allocation.

For instance, in a situation where two endpoints sitting on
the PCI bus request the following MSI configuration, with
the current PCI Xilinx bitmap allocation code (that does not
align MSI vector allocation on a power of two boundary):

Endpoint #1: Requesting 1 MSI vector - allocated bitmap bits 0
Endpoint #2: Requesting 2 MSI vectors - allocated bitmap bits [1,2]

The bitmap value(s) corresponds to the hwirq number that is programmed
into the Message Data for MSI field in the endpoint MSI capability
and is detected by the root complex to fire the corresponding
MSI irqs. The value written in Message Data for MSI field corresponds
to the first bit allocated in the bitmap for Multi MSI vectors.

The current Xilinx NWL MSI allocation code allows a bitmap allocation
that is not a power of two boundaries, so endpoint #2, is allowed to
toggle Message Data bit[0] to differentiate between its two vectors
(meaning that the MSI data will be respectively 0x0 and 0x1 for the two
vectors allocated to endpoint #2).

This clearly aliases with the Endpoint #1 vector allocation, resulting
in a broken Multi MSI implementation.

Update the code to allocate MSI bitmap ranges with a power of two
alignment, fixing the bug.

Fixes: ab597d35ef ("PCI: xilinx-nwl: Add support for Xilinx NWL PCIe Host Controller")
Suggested-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
[lorenzo.pieralisi@arm.com: updated commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-08-04 09:33:38 +02:00
..
host PCI: xilinx-nwl: Fix Multi MSI data programming 2019-08-04 09:33:38 +02:00
hotplug PCI: rpadlpar: Fix leaked device_node references in add/remove paths 2019-06-22 08:17:16 +02:00
pcie PCI: Work around Pericom PCIe-to-PCI bridge Retrain Link erratum 2019-05-25 18:26:53 +02:00
access.c PCI: Avoid possible deadlock on pci_lock and p->pi_lock 2017-11-08 10:08:37 +01:00
ats.c
bus.c
ecam.c
host-bridge.c
hotplug-pci.c
htirq.c
iov.c PCI: Create SR-IOV virtfn/physfn links before attaching driver 2017-12-25 14:23:44 +01:00
irq.c
Kconfig
Makefile
msi.c PCI/MSI: Warn and return error if driver enables MSI/MSI-X twice 2018-11-13 11:16:53 -08:00
of.c
pci-acpi.c ACPI / PCI: Bail early in acpi_pci_add_bus() if there is no ACPI handle 2018-08-09 12:17:59 +02:00
pci-driver.c PCI: Restore config space on runtime resume despite being unbound 2018-05-30 07:50:46 +02:00
pci-label.c
pci-mid.c x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:19:34 +02:00
pci-stub.c
pci-sysfs.c PCI: sysfs: Ignore lockdep for remove attribute 2019-08-04 09:33:38 +02:00
pci.c PCI: Do not poll for PME if the device is in D3cold 2019-08-04 09:33:29 +02:00
pci.h PCI: Remove pci_resource_bar() and pci_iov_resource_bar() 2017-03-22 12:43:36 +01:00
probe.c PCI: Skip MPS logic for Virtual Functions (VFs) 2018-08-24 13:12:42 +02:00
proc.c PCI: Only allow WC mmap on prefetchable resources 2017-05-25 15:44:47 +02:00
quirks.c PCI: Work around Pericom PCIe-to-PCI bridge Retrain Link erratum 2019-05-25 18:26:53 +02:00
remove.c PCI: Detach driver before procfs & sysfs teardown on device remove 2017-12-20 10:07:31 +01:00
rom.c PCI: Add comments about ROM BAR updating 2017-03-22 12:43:36 +01:00
search.c
setup-bus.c x86/ioapic: Ignore root bridges without a companion ACPI device 2016-09-10 20:30:31 +02:00
setup-irq.c
setup-res.c PCI: Make PCI_ROM_ADDRESS_MASK a 32-bit constant 2018-04-08 12:12:43 +02:00
slot.c
syscall.c
vc.c
vpd.c
xen-pcifront.c