This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Linux
We are having a problem with non 32 bit aligned access to a PCI switch from our AM5728 RC. We have a PEX 8606 underneath the RC and the switch header type is not getting picked up correctly. I initially discussed this in e2e.ti.com/.../597740.
A summary illustrating the problem is:
debian@arm:~$ lspci -s 0000:01:00.0 -x
0000:01:00.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
00: b5 10 06 86 40 01 10 00 ba 00 04 06 10 00 01 00
10: 00 00 20 20 00 00 00 00 01 02 07 00 f1 01 00 00
20: f0 ff 00 00 f1 ff 01 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 40 00 00 00 00 00 00 00 00 01 01 00
Then do a byte access of the header type:
debian@arm:~$ sudo setpci -s 0001:02:09.0 e.b
00
But do a 32bit access:
debian@arm:~$ sudo setpci -s 0001:02:09.0 c.l
00010010
So PCI device probe fails as follows with the stock code:
[ 1.850281] pci 0000:01:00.0: [10b5:8606] type 00 class 0x060400
[ 1.850311] pci 0000:01:00.0: ignoring class 0x060400 (doesn't match header type 00)
We can modify the kernel driver code, but this operation seems fundamental and there has to be something else wrong.
Any ideas why the non aligned access is failing?
I've come up with a possible work around, but it is a real hack in the PCI driver. I modified KERNEL/drivers/pci/access.c pci_bus_read_config_##size to force 32 bit aligned access using the following macro:
coming up during dra7 initialization and leads to a driver crash with stack trace back in dmesg.
The problems I found related to this is that it is due to PCI interrupts being numbered from 1, not zero, so the irq_domain setup has to use +1. I found a number of other PCI drivers where this problem had been encountered and corrected.
The specific area in our pci-dra7xx.c code appears to have the same error, so I changed:
The workaround provides a successful probe of the switch, however, setpci still fails:
Chris Welch66 said:root@arm:~# uname -a
Linux arm 4.4.49-ti-r89 #22 SMP Mon Jun 5 17:22:45 EDT 2017 armv7l GNU/Linux
This kernel is not official and not tested. Please have a try with the one coming with latest PSDK 3.03 (kernel 4.4.41)
Regards,
Pavel
I've reproduced the problem with the supported TI SDK ti-processor-sdk-linux-am57xx-evm-03.03.00.04
To recap, we have an AM5728 board that is based on the AM5728 EVM design. We've split the PCI into two RCs of one lane each.
There is a PEX 8606 PCI switch under each PCI RC.
root@am57xx-evm:~# uname -a
Linux am57xx-evm 4.4.41-gf9f6f0db2d #6 SMP PREEMPT Wed Jun 7 11:00:14 EDT 2017 armv7l GNU/Linux
There is a hardware problem with the first PEX 8606 on this particular board so it doesn't show up under the first RC in this example.
root@am57xx-evm:~# lspci
0000:00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01)
0001:00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01)
0001:01:00.0 Non-VGA unclassified device: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
As you can see, the listing doesn't show the ports on the second PEX 8606 which illustrates the problem.
Here is the dmesg report highlighting the failure:
[ 0.637531] dra7-pcie 51800000.pcie: PCI host bridge to bus 0001:00
[ 0.637543] pci_bus 0001:00: root bus resource [bus 00-ff]
[ 0.637555] pci_bus 0001:00: root bus resource [io 0x10000-0x1ffff] (bus address [0x0000-0xffff])
[ 0.637564] pci_bus 0001:00: root bus resource [mem 0x30013000-0x3fffffff]
[ 0.637594] pci 0001:00:00.0: [104c:8888] type 01 class 0x060400
[ 0.637632] pci 0001:00:00.0: reg 0x10: [mem 0x00000000-0x000fffff]
[ 0.637653] pci 0001:00:00.0: reg 0x14: [mem 0x00000000-0x0000ffff]
[ 0.637762] pci 0001:00:00.0: supports D1
[ 0.637772] pci 0001:00:00.0: PME# supported from D0 D1 D3hot
[ 0.638001] PCI: bus0: Fast back to back transfers disabled
[ 0.638156] pci 0001:01:00.0: [10b5:8606] type 00 class 0x060400
[ 0.638183] pci 0001:01:00.0: ignoring class 0x060400 (doesn't match header type 00)
The header type is obtained using a byte access to the PEX 8606 header which always returns zero because it is not aligned to a 32 bit address. The type is actually 1 but the only way you can get the correct value is to use a 32 bit aligned access.
This illustrates the problem using setpci:
root@am57xx-evm:~# setpci -s 0001:01:00.0 e.b
00
However, a 32 bit access shows the correct header type:
root@am57xx-evm:~# setpci -s 0001:01:00.0 c.l
00010010
Using a hack to Linux PCI to force aligned access (hack previously posted), I can get some limited operation:
root@am57xx-evm:~$ lspci
0000:00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01)
0001:00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01)
0001:01:00.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
0001:02:01.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
0001:02:04.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
0001:02:05.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
0001:02:07.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
0001:02:09.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
0001:07:00.0 USB controller: Texas Instruments TUSB73x0 SuperSpeed USB 3.0 xHCI Host Controller (rev 02)
Byte access to the switch still fails:
root@am57xx-evm::~$ setpci -s 0001:01:00.0 e.b
00
root@am57xx-evm::~$ setpci -s 0001:01:00.0 c.l
00010010
However the TUSB7340 endpoint doesn't have the problem:
root@am57xx-evm:~$ lspci -s 0001:07:00.0 -x
0001:07:00.0 USB controller: Texas Instruments TUSB73x0 SuperSpeed USB 3.0 xHCI Host Controller (rev 02)
00: 4c 10 41 82 46 05 10 00 02 30 03 0c 10 00 00 00
10: 04 00 20 30 00 00 00 00 04 00 21 30 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 40 00 00 00 00 00 00 00 fa 01 00 00
root@am57xx-evm:~$ setpci -s 0001:07:00.0 0.b
4c
root@am57xx-evm:~$ setpci -s 0001:07:00.0 1.b
10
root@am57xx-evm:~$ setpci -s 0001:07:00.0 2.b
41
root@am57xx-evm:~$ setpci -s 0001:07:00.0 3.b
82
root@am57xx-evm:~$ setpci -s 0001:07:00.0 4.b
46
Any suggestions would be appreciated. Thanks.
Our understanding is that that errata is only applicable to EP operation, not RC. Futhermore there is a work around fix in the pci-da7xx.c (again only applicable to EPs):
/*
* dra7xx_pcie_ep_legacy_mode: workaround for AM572x/AM571x Errata i870
* @dra7xx: the dra7xx device where the workaround should be applied
*
* Access to the PCIe slave port that are not 32-bit aligned will result
* in incorrect mapping to TLP Address and Byte enable fields. Therefore,
* byte and half-word accesses are not possible to byte offset 0x1, 0x2, or
* 0x3.
*
* To avoid this issue set PCIE_SS1_AXI2OCP_LEGACY_MODE_ENABLE to 1.
*/
The fix is activated by setting the syscon-legacy-mode in the EP device tree settings as was found in this TI presentation:
www.linuxplumbersconf.org/.../ep framework.pdf
Given that this is only applicable to end point operation and we are using the PCI as RCs, and the TI configuration example for this problem is only in the context of an EP it doesn't appear that this is the problem we are experiencing.
Any other suggestions?
That is correct, however, we have a similar based design using an i.MX6 ARM based processor and it doesn't have this problem. The PEX 8606 and everything else can be accessed with non aligned 8 bit access without any driver modifications or issues.
This implies something in the TI eco system is potentially causing the problem.