Skip to content

Commit b4643c0

Browse files
maciej-w-rozyckiUlrich Hecht
authored andcommitted
MIPS: Malta: Fix !EVA SOC-it PCI MMIO
commit ebd729fef31620e0bf74cbf8a4c7fda73a2a4e7e upstream. Fix a regression that has caused accesses to the PCI MMIO window to complete unclaimed in non-EVA configurations with the SOC-it family of system controllers, preventing PCI devices from working that use MMIO. In the non-EVA case PHYS_OFFSET is set to 0, meaning that PCI_BAR0 is set with an empty mask (and PCI_HEAD4 matches addresses starting from 0 accordingly). Consequently all addresses are matched for incoming DMA accesses from PCI. This seems to confuse the system controller's logic and outgoing bus cycles targeting the PCI MMIO window seem not to make it to the intended devices. This happens as well when a wider mask is used with PCI_BAR0, such as 0x80000000 or 0xe0000000, that makes addresses match that overlap with the PCI MMIO window, which starts at 0x10000000 in our configuration. Set the mask in PCI_BAR0 to 0xf0000000 for non-EVA then, covering the non-EVA maximum 256 MiB of RAM, which is what YAMON does and which used to work correctly up to the offending commit. Set PCI_P2SCMSKL to match PCI_BAR0 as required by the system controller's specification, and match PCI_P2SCMAPL to PCI_HEAD4 for identity mapping. Verified with: Core board type/revision = 0x0d (Core74K) / 0x01 System controller/revision = MIPS SOC-it 101 OCP / 1.3 SDR-FW-4:1 Processor Company ID/options = 0x01 (MIPS Technologies, Inc.) / 0x1c Processor ID/revision = 0x97 (MIPS 74Kf) / 0x4c for non-EVA and with: Core board type/revision = 0x0c (CoreFPGA-5) / 0x00 System controller/revision = MIPS ROC-it2 / 0.0 FW-1:1 (CLK_unknown) GIC Processor Company ID/options = 0x01 (MIPS Technologies, Inc.) / 0x00 Processor ID/revision = 0xa0 (MIPS interAptiv UP) / 0x20 for EVA/non-EVA, fixing: defxx 0000:00:12.0: assign IRQ: got 10 defxx: v1.12 2021/03/10 Lawrence V. Stefani and others 0000:00:12.0: Could not read adapter factory MAC address! vs: defxx 0000:00:12.0: assign IRQ: got 10 defxx: v1.12 2021/03/10 Lawrence V. Stefani and others 0000:00:12.0: DEFPA at MMIO addr = 0x10142000, IRQ = 10, Hardware addr = 00-00-f8-xx-xx-xx 0000:00:12.0: registered as fddi0 for non-EVA and causing no change for EVA. Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk> Fixes: 422dd25 ("MIPS: Malta: Allow PCI devices DMA to lower 2GB physical") Cc: stable@vger.kernel.org # v4.9+ Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 9ff7c97 commit b4643c0

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

arch/mips/mti-malta/malta-init.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,22 @@ void __init prom_init(void)
244244
#endif
245245

246246
/*
247-
* Setup the Malta max (2GB) memory for PCI DMA in host bridge
248-
* in transparent addressing mode.
247+
* Set up memory mapping in host bridge for PCI DMA masters,
248+
* in transparent addressing mode. For EVA use the Malta
249+
* maximum of 2 GiB memory in the alias space at 0x80000000
250+
* as per PHYS_OFFSET. Otherwise use 256 MiB of memory in
251+
* the regular space, avoiding mapping the PCI MMIO window
252+
* for DMA as it seems to confuse the system controller's
253+
* logic, causing PCI MMIO to stop working.
249254
*/
250-
mask = PHYS_OFFSET | PCI_BASE_ADDRESS_MEM_PREFETCH;
251-
MSC_WRITE(MSC01_PCI_BAR0, mask);
252-
MSC_WRITE(MSC01_PCI_HEAD4, mask);
255+
mask = PHYS_OFFSET ? PHYS_OFFSET : 0xf0000000;
256+
MSC_WRITE(MSC01_PCI_BAR0,
257+
mask | PCI_BASE_ADDRESS_MEM_PREFETCH);
258+
MSC_WRITE(MSC01_PCI_HEAD4,
259+
PHYS_OFFSET | PCI_BASE_ADDRESS_MEM_PREFETCH);
253260

254-
mask &= MSC01_PCI_BAR0_SIZE_MSK;
255261
MSC_WRITE(MSC01_PCI_P2SCMSKL, mask);
256-
MSC_WRITE(MSC01_PCI_P2SCMAPL, mask);
262+
MSC_WRITE(MSC01_PCI_P2SCMAPL, PHYS_OFFSET);
257263

258264
/* Don't handle target retries indefinitely. */
259265
if ((data & MSC01_PCI_CFG_MAXRTRY_MSK) ==

0 commit comments

Comments
 (0)