PCI/DPC: Fix TLP Prefix register reading offset
Subsystems (2)
PATCH 1/1 PCI/DPC: Fix TLP Prefix register reading offset
The TLP Prefix Log Register consists of multiple DWORDs (PCIe r6.1 sec 7.9.14.13) but the loop in dpc_process_rp_pio_error() keeps reading from the first DWORD. Add the iteration count based offset calculation into the config read.
--- drivers/pci/pcie/dpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pcie/dpc.c +1 -1
@@ -234,7 +234,7 @@ static void dpc_process_rp_pio_error(struct pci_dev *pdev)for (i =0 ; i < pdev->dpc_rp_log_size -5 ; i++) {pci_read_config_dword (pdev, - cap +PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG , &prefix); + cap +PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG + i *4 , &prefix);pci_err (pdev,"TLP Prefix Header: dw%d, %#010x\n" , i, prefix); } clear_status:
Signature · 1 line
2.39.2
Quoted 4 lines · Ilpo Järvinen
The TLP Prefix Log Register consists of multiple DWORDs (PCIe r6.1 sec 7.9.14.13) but the loop in
dpc_process_rp_pio_error()keeps reading from the first DWORD. Add the iteration count based offset calculation into the config read.
So IIUC the user-visible bug is that we print only the first PIO TLP Prefix (duplicated several times), and we never print the second, third, etc Prefixes, right?
I wish we could print them all in a single pci_err(), as we do for the TLP Header Log, instead of dribbling them out one by one.
Quoted 22 lines
Fixes f20c4ea49ec4 ("PCI/DPC: Add eDPC support")Signed-off-by Ilpo Järvinen <[email protected]>--- drivers/pci/pcie/dpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/pcie/dpc.c +1
-1@@ -234,7 +234,7 @@ static void dpc_process_rp_pio_error(struct pci_dev *pdev)for (i =0 ; i < pdev->dpc_rp_log_size -5 ; i++) {pci_read_config_dword (pdev, - cap +PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG , &prefix); + cap +PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG + i *4 , &prefix);pci_err (pdev,"TLP Prefix Header: dw%d, %#010x\n" , i, prefix); } clear_status:Signature · 1 line
2.39.2
Quoted 9 lines · Bjorn Helgaas
Quoted 4 lines · Ilpo Järvinen
The TLP Prefix Log Register consists of multiple DWORDs (PCIe r6.1 sec 7.9.14.13) but the loop in
dpc_process_rp_pio_error()keeps reading from the first DWORD. Add the iteration count based offset calculation into the config read.So IIUC the user-visible bug is that we print only the first PIO TLP Prefix (duplicated several times), and we never print the second, third, etc Prefixes, right?
Yes.
Quoted 2 lines
I wish we could print them all in a single
pci_err(), as we do for the TLP Header Log, instead of dribbling them out one by one.
I've also done some work towards consolidating AER and DPC TLP Header/Prefix Log handling which is when I found this bug (the reading side is already done but printing is still pending).
Quoted 2 lines
Quoted 2 lines
Fixes f20c4ea49ec4 ("PCI/DPC: Add eDPC support")Signed-off-by Ilpo Järvinen <[email protected]>
Signature · 1 line
i.
Bjorn Helgaas
AppliedQuoted 7 lines · Ilpo Järvinen
The TLP Prefix Log Register consists of multiple DWORDs (PCIe r6.1 sec 7.9.14.13) but the loop in
dpc_process_rp_pio_error()keeps reading from the first DWORD. Add the iteration count based offset calculation into the config read.Fixes f20c4ea49ec4 ("PCI/DPC: Add eDPC support")Signed-off-by Ilpo Järvinen <[email protected]>
Applied to pci/dpc for v6.9 with commit log below, thanks!
PCI/DPC: Print all TLP Prefixes, not just the first
The TLP Prefix Log Register consists of multiple DWORDs (PCIe r6.1 sec 7.9.14.13) but the loop in dpc_process_rp_pio_error() keeps reading from the first DWORD, so we print only the first PIO TLP Prefix (duplicated several times), and we never print the second, third, etc., Prefixes.
Add the iteration count based offset calculation into the config read.
Quoted 20 lines
--- drivers/pci/pcie/dpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/pcie/dpc.c +1
-1@@ -234,7 +234,7 @@ static void dpc_process_rp_pio_error(struct pci_dev *pdev)for (i =0 ; i < pdev->dpc_rp_log_size -5 ; i++) {pci_read_config_dword (pdev, - cap +PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG , &prefix); + cap +PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG + i *4 , &prefix);pci_err (pdev,"TLP Prefix Header: dw%d, %#010x\n" , i, prefix); } clear_status:Signature · 1 line
2.39.2