diff options
author | Lance Ortiz <lance.ortiz@hp.com> | 2013-01-03 17:34:08 -0500 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2013-01-03 17:34:06 -0500 |
commit | 1d5210008bd3a26daf4b06aed9d6c330dd4c83e2 (patch) | |
tree | dae434fdd145b772b77f003ecb8237cb04c53b79 | |
parent | 1ca1d8d54f925ad0eb6d9806ecd4309738f25301 (diff) |
aerdrv: Enhanced AER logging
This patch will provide a more reliable and easy way for user-space
applications to have access to AER logs rather than reading them from the
message buffer. It also provides a way to notify user-space when an AER
event occurs.
The aer driver is updated to generate a trace event of function 'aer_event'
when a PCIe error is reported over the AER interface. The trace event was
added to both the interrupt based aer path and the firmware first path.
Signed-off-by: Lance Ortiz <lance.ortiz@hp.com>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Boris Petkov <bp@alien8.de>
Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r-- | drivers/acpi/apei/cper.c | 19 | ||||
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_errprint.c | 9 | ||||
-rw-r--r-- | include/linux/aer.h | 4 |
3 files changed, 26 insertions, 6 deletions
diff --git a/drivers/acpi/apei/cper.c b/drivers/acpi/apei/cper.c index e6defd86b424..1e5d8a40101e 100644 --- a/drivers/acpi/apei/cper.c +++ b/drivers/acpi/apei/cper.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/time.h> | 29 | #include <linux/time.h> |
30 | #include <linux/cper.h> | 30 | #include <linux/cper.h> |
31 | #include <linux/acpi.h> | 31 | #include <linux/acpi.h> |
32 | #include <linux/pci.h> | ||
32 | #include <linux/aer.h> | 33 | #include <linux/aer.h> |
33 | 34 | ||
34 | /* | 35 | /* |
@@ -249,6 +250,10 @@ static const char *cper_pcie_port_type_strs[] = { | |||
249 | static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie, | 250 | static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie, |
250 | const struct acpi_hest_generic_data *gdata) | 251 | const struct acpi_hest_generic_data *gdata) |
251 | { | 252 | { |
253 | #ifdef CONFIG_ACPI_APEI_PCIEAER | ||
254 | struct pci_dev *dev; | ||
255 | #endif | ||
256 | |||
252 | if (pcie->validation_bits & CPER_PCIE_VALID_PORT_TYPE) | 257 | if (pcie->validation_bits & CPER_PCIE_VALID_PORT_TYPE) |
253 | printk("%s""port_type: %d, %s\n", pfx, pcie->port_type, | 258 | printk("%s""port_type: %d, %s\n", pfx, pcie->port_type, |
254 | pcie->port_type < ARRAY_SIZE(cper_pcie_port_type_strs) ? | 259 | pcie->port_type < ARRAY_SIZE(cper_pcie_port_type_strs) ? |
@@ -281,10 +286,18 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie, | |||
281 | "%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n", | 286 | "%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n", |
282 | pfx, pcie->bridge.secondary_status, pcie->bridge.control); | 287 | pfx, pcie->bridge.secondary_status, pcie->bridge.control); |
283 | #ifdef CONFIG_ACPI_APEI_PCIEAER | 288 | #ifdef CONFIG_ACPI_APEI_PCIEAER |
284 | if (pcie->validation_bits & CPER_PCIE_VALID_AER_INFO) { | 289 | dev = pci_get_domain_bus_and_slot(pcie->device_id.segment, |
285 | struct aer_capability_regs *aer_regs = (void *)pcie->aer_info; | 290 | pcie->device_id.bus, pcie->device_id.function); |
286 | cper_print_aer(pfx, gdata->error_severity, aer_regs); | 291 | if (!dev) { |
292 | pr_err("PCI AER Cannot get PCI device %04x:%02x:%02x.%d\n", | ||
293 | pcie->device_id.segment, pcie->device_id.bus, | ||
294 | pcie->device_id.slot, pcie->device_id.function); | ||
295 | return; | ||
287 | } | 296 | } |
297 | if (pcie->validation_bits & CPER_PCIE_VALID_AER_INFO) | ||
298 | cper_print_aer(pfx, dev, gdata->error_severity, | ||
299 | (struct aer_capability_regs *) pcie->aer_info); | ||
300 | pci_dev_put(dev); | ||
288 | #endif | 301 | #endif |
289 | } | 302 | } |
290 | 303 | ||
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index 3ea51736f18d..d3e5fc5a2de9 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c | |||
@@ -23,6 +23,9 @@ | |||
23 | 23 | ||
24 | #include "aerdrv.h" | 24 | #include "aerdrv.h" |
25 | 25 | ||
26 | #define CREATE_TRACE_POINTS | ||
27 | #include <trace/events/ras.h> | ||
28 | |||
26 | #define AER_AGENT_RECEIVER 0 | 29 | #define AER_AGENT_RECEIVER 0 |
27 | #define AER_AGENT_REQUESTER 1 | 30 | #define AER_AGENT_REQUESTER 1 |
28 | #define AER_AGENT_COMPLETER 2 | 31 | #define AER_AGENT_COMPLETER 2 |
@@ -194,6 +197,8 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | |||
194 | if (info->id && info->error_dev_num > 1 && info->id == id) | 197 | if (info->id && info->error_dev_num > 1 && info->id == id) |
195 | printk("%s"" Error of this Agent(%04x) is reported first\n", | 198 | printk("%s"" Error of this Agent(%04x) is reported first\n", |
196 | prefix, id); | 199 | prefix, id); |
200 | trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask), | ||
201 | info->severity); | ||
197 | } | 202 | } |
198 | 203 | ||
199 | void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) | 204 | void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) |
@@ -217,7 +222,7 @@ int cper_severity_to_aer(int cper_severity) | |||
217 | } | 222 | } |
218 | EXPORT_SYMBOL_GPL(cper_severity_to_aer); | 223 | EXPORT_SYMBOL_GPL(cper_severity_to_aer); |
219 | 224 | ||
220 | void cper_print_aer(const char *prefix, int cper_severity, | 225 | void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity, |
221 | struct aer_capability_regs *aer) | 226 | struct aer_capability_regs *aer) |
222 | { | 227 | { |
223 | int aer_severity, layer, agent, status_strs_size, tlp_header_valid = 0; | 228 | int aer_severity, layer, agent, status_strs_size, tlp_header_valid = 0; |
@@ -259,5 +264,7 @@ void cper_print_aer(const char *prefix, int cper_severity, | |||
259 | *(tlp + 8), *(tlp + 15), *(tlp + 14), | 264 | *(tlp + 8), *(tlp + 15), *(tlp + 14), |
260 | *(tlp + 13), *(tlp + 12)); | 265 | *(tlp + 13), *(tlp + 12)); |
261 | } | 266 | } |
267 | trace_aer_event(dev_name(&dev->dev), (status & ~mask), | ||
268 | aer_severity); | ||
262 | } | 269 | } |
263 | #endif | 270 | #endif |
diff --git a/include/linux/aer.h b/include/linux/aer.h index 544abdb2238c..ec10e1b24c1c 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h | |||
@@ -49,8 +49,8 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) | |||
49 | } | 49 | } |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | extern void cper_print_aer(const char *prefix, int cper_severity, | 52 | extern void cper_print_aer(const char *prefix, struct pci_dev *dev, |
53 | struct aer_capability_regs *aer); | 53 | int cper_severity, struct aer_capability_regs *aer); |
54 | extern int cper_severity_to_aer(int cper_severity); | 54 | extern int cper_severity_to_aer(int cper_severity); |
55 | extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, | 55 | extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, |
56 | int severity); | 56 | int severity); |