Skip to content

Commit 82013ff

Browse files
committed
PCI/ERR: Add printk level to pcie_print_tlp_log()
aer_print_error() produces output at a printk level (KERN_ERR/KERN_WARNING/ etc) that depends on the kind of error, and it calls pcie_print_tlp_log(), which previously always produced output at KERN_ERR. Add a "level" parameter so aer_print_error() can control the level of the pcie_print_tlp_log() output to match. Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent c8f6791 commit 82013ff

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

drivers/pci/pci.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,8 @@ int pcie_read_tlp_log(struct pci_dev *dev, int where, int where2,
613613
struct pcie_tlp_log *log);
614614
unsigned int aer_tlp_log_len(struct pci_dev *dev, u32 aercc);
615615
void pcie_print_tlp_log(const struct pci_dev *dev,
616-
const struct pcie_tlp_log *log, const char *pfx);
616+
const struct pcie_tlp_log *log, const char *level,
617+
const char *pfx);
617618
#endif /* CONFIG_PCIEAER */
618619

619620
#ifdef CONFIG_PCIEPORTBUS

drivers/pci/pcie/aer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
734734
__aer_print_error(dev, info);
735735

736736
if (info->tlp_header_valid)
737-
pcie_print_tlp_log(dev, &info->tlp, dev_fmt(" "));
737+
pcie_print_tlp_log(dev, &info->tlp, level, dev_fmt(" "));
738738

739739
out:
740740
if (info->id && info->error_dev_num > 1 && info->id == id)
@@ -797,7 +797,8 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
797797
aer->uncor_severity);
798798

799799
if (tlp_header_valid)
800-
pcie_print_tlp_log(dev, &aer->header_log, dev_fmt(" "));
800+
pcie_print_tlp_log(dev, &aer->header_log, info.level,
801+
dev_fmt(" "));
801802
}
802803
EXPORT_SYMBOL_NS_GPL(pci_print_aer, "CXL");
803804

drivers/pci/pcie/dpc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static void dpc_process_rp_pio_error(struct pci_dev *pdev)
222222
dpc_tlp_log_len(pdev),
223223
pdev->subordinate->flit_mode,
224224
&tlp_log);
225-
pcie_print_tlp_log(pdev, &tlp_log, dev_fmt(""));
225+
pcie_print_tlp_log(pdev, &tlp_log, KERN_ERR, dev_fmt(""));
226226

227227
if (pdev->dpc_rp_log_size < PCIE_STD_NUM_TLP_HEADERLOG + 1)
228228
goto clear_status;

drivers/pci/pcie/tlp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,14 @@ int pcie_read_tlp_log(struct pci_dev *dev, int where, int where2,
9898
* pcie_print_tlp_log - Print TLP Header / Prefix Log contents
9999
* @dev: PCIe device
100100
* @log: TLP Log structure
101+
* @level: Printk log level
101102
* @pfx: String prefix
102103
*
103104
* Prints TLP Header and Prefix Log information held by @log.
104105
*/
105106
void pcie_print_tlp_log(const struct pci_dev *dev,
106-
const struct pcie_tlp_log *log, const char *pfx)
107+
const struct pcie_tlp_log *log, const char *level,
108+
const char *pfx)
107109
{
108110
/* EE_PREFIX_STR fits the extended DW space needed for the Flit mode */
109111
char buf[11 * PCIE_STD_MAX_TLP_HEADERLOG + 1];
@@ -130,6 +132,6 @@ void pcie_print_tlp_log(const struct pci_dev *dev,
130132
}
131133
}
132134

133-
pci_err(dev, "%sTLP Header%s: %s\n", pfx,
135+
dev_printk(level, &dev->dev, "%sTLP Header%s: %s\n", pfx,
134136
log->flit ? " (Flit)" : "", buf);
135137
}

0 commit comments

Comments
 (0)