Skip to content

Commit a274a4e

Browse files
committed
Merge branch 'pci/aer'
- Unexport pci_save_aer_state() since it's only used in drivers/pci/ (Bjorn Helgaas) - Drop recommendation for drivers to configure AER Capability, since the PCI core does this for all devices (Dave Jiang, Bjorn Helgaas) * pci/aer: Documentation: PCI: Tidy AER documentation Documentation: PCI: Update cross references to .rst files Documentation: PCI: Drop recommendation to configure AER Capability PCI: Unexport pci_save_aer_state()
2 parents ac9a786 + 11502fe commit a274a4e

File tree

4 files changed

+70
-123
lines changed

4 files changed

+70
-123
lines changed

Documentation/PCI/pci-error-recovery.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ Note, however, not all failures are truly "permanent". Some are
364364
caused by over-heating, some by a poorly seated card. Many
365365
PCI error events are caused by software bugs, e.g. DMA's to
366366
wild addresses or bogus split transactions due to programming
367-
errors. See the discussion in powerpc/eeh-pci-error-recovery.txt
367+
errors. See the discussion in Documentation/powerpc/eeh-pci-error-recovery.rst
368368
for additional detail on real-life experience of the causes of
369369
software errors.
370370

Documentation/PCI/pcieaer-howto.rst

Lines changed: 65 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -16,62 +16,61 @@ Overview
1616
About this guide
1717
----------------
1818

19-
This guide describes the basics of the PCI Express Advanced Error
19+
This guide describes the basics of the PCI Express (PCIe) Advanced Error
2020
Reporting (AER) driver and provides information on how to use it, as
21-
well as how to enable the drivers of endpoint devices to conform with
22-
PCI Express AER driver.
21+
well as how to enable the drivers of Endpoint devices to conform with
22+
the PCIe AER driver.
2323

2424

25-
What is the PCI Express AER Driver?
26-
-----------------------------------
25+
What is the PCIe AER Driver?
26+
----------------------------
2727

28-
PCI Express error signaling can occur on the PCI Express link itself
29-
or on behalf of transactions initiated on the link. PCI Express
28+
PCIe error signaling can occur on the PCIe link itself
29+
or on behalf of transactions initiated on the link. PCIe
3030
defines two error reporting paradigms: the baseline capability and
3131
the Advanced Error Reporting capability. The baseline capability is
32-
required of all PCI Express components providing a minimum defined
32+
required of all PCIe components providing a minimum defined
3333
set of error reporting requirements. Advanced Error Reporting
34-
capability is implemented with a PCI Express advanced error reporting
34+
capability is implemented with a PCIe Advanced Error Reporting
3535
extended capability structure providing more robust error reporting.
3636

37-
The PCI Express AER driver provides the infrastructure to support PCI
38-
Express Advanced Error Reporting capability. The PCI Express AER
39-
driver provides three basic functions:
37+
The PCIe AER driver provides the infrastructure to support PCIe Advanced
38+
Error Reporting capability. The PCIe AER driver provides three basic
39+
functions:
4040

4141
- Gathers the comprehensive error information if errors occurred.
4242
- Reports error to the users.
4343
- Performs error recovery actions.
4444

45-
AER driver only attaches root ports which support PCI-Express AER
46-
capability.
45+
The AER driver only attaches to Root Ports and RCECs that support the PCIe
46+
AER capability.
4747

4848

4949
User Guide
5050
==========
5151

52-
Include the PCI Express AER Root Driver into the Linux Kernel
53-
-------------------------------------------------------------
52+
Include the PCIe AER Root Driver into the Linux Kernel
53+
------------------------------------------------------
5454

55-
The PCI Express AER Root driver is a Root Port service driver attached
56-
to the PCI Express Port Bus driver. If a user wants to use it, the driver
57-
has to be compiled. Option CONFIG_PCIEAER supports this capability. It
58-
depends on CONFIG_PCIEPORTBUS, so pls. set CONFIG_PCIEPORTBUS=y and
59-
CONFIG_PCIEAER = y.
55+
The PCIe AER driver is a Root Port service driver attached
56+
via the PCIe Port Bus driver. If a user wants to use it, the driver
57+
must be compiled. It is enabled with CONFIG_PCIEAER, which
58+
depends on CONFIG_PCIEPORTBUS.
6059

61-
Load PCI Express AER Root Driver
62-
--------------------------------
60+
Load PCIe AER Root Driver
61+
-------------------------
6362

6463
Some systems have AER support in firmware. Enabling Linux AER support at
65-
the same time the firmware handles AER may result in unpredictable
64+
the same time the firmware handles AER would result in unpredictable
6665
behavior. Therefore, Linux does not handle AER events unless the firmware
67-
grants AER control to the OS via the ACPI _OSC method. See the PCI FW 3.0
66+
grants AER control to the OS via the ACPI _OSC method. See the PCI Firmware
6867
Specification for details regarding _OSC usage.
6968

7069
AER error output
7170
----------------
7271

7372
When a PCIe AER error is captured, an error message will be output to
74-
console. If it's a correctable error, it is output as a warning.
73+
console. If it's a correctable error, it is output as an info message.
7574
Otherwise, it is printed as an error. So users could choose different
7675
log level to filter out correctable error messages.
7776

@@ -82,9 +81,9 @@ Below shows an example::
8281
0000:50:00.0: [20] Unsupported Request (First)
8382
0000:50:00.0: TLP Header: 04000001 00200a03 05010000 00050100
8483

85-
In the example, 'Requester ID' means the ID of the device who sends
86-
the error message to root port. Pls. refer to pci express specs for
87-
other fields.
84+
In the example, 'Requester ID' means the ID of the device that sent
85+
the error message to the Root Port. Please refer to PCIe specs for other
86+
fields.
8887

8988
AER Statistics / Counters
9089
-------------------------
@@ -96,90 +95,81 @@ Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats
9695
Developer Guide
9796
===============
9897

99-
To enable AER aware support requires a software driver to configure
100-
the AER capability structure within its device and to provide callbacks.
98+
To enable error recovery, a software driver must provide callbacks.
10199

102-
To support AER better, developers need understand how AER does work
103-
firstly.
100+
To support AER better, developers need to understand how AER works.
104101

105-
PCI Express errors are classified into two types: correctable errors
106-
and uncorrectable errors. This classification is based on the impacts
102+
PCIe errors are classified into two types: correctable errors
103+
and uncorrectable errors. This classification is based on the impact
107104
of those errors, which may result in degraded performance or function
108105
failure.
109106

110107
Correctable errors pose no impacts on the functionality of the
111-
interface. The PCI Express protocol can recover without any software
108+
interface. The PCIe protocol can recover without any software
112109
intervention or any loss of data. These errors are detected and
113-
corrected by hardware. Unlike correctable errors, uncorrectable
110+
corrected by hardware.
111+
112+
Unlike correctable errors, uncorrectable
114113
errors impact functionality of the interface. Uncorrectable errors
115-
can cause a particular transaction or a particular PCI Express link
114+
can cause a particular transaction or a particular PCIe link
116115
to be unreliable. Depending on those error conditions, uncorrectable
117116
errors are further classified into non-fatal errors and fatal errors.
118117
Non-fatal errors cause the particular transaction to be unreliable,
119-
but the PCI Express link itself is fully functional. Fatal errors, on
118+
but the PCIe link itself is fully functional. Fatal errors, on
120119
the other hand, cause the link to be unreliable.
121120

122-
When AER is enabled, a PCI Express device will automatically send an
123-
error message to the PCIe root port above it when the device captures
121+
When PCIe error reporting is enabled, a device will automatically send an
122+
error message to the Root Port above it when it captures
124123
an error. The Root Port, upon receiving an error reporting message,
125-
internally processes and logs the error message in its PCI Express
126-
capability structure. Error information being logged includes storing
124+
internally processes and logs the error message in its AER
125+
Capability structure. Error information being logged includes storing
127126
the error reporting agent's requestor ID into the Error Source
128127
Identification Registers and setting the error bits of the Root Error
129-
Status Register accordingly. If AER error reporting is enabled in Root
130-
Error Command Register, the Root Port generates an interrupt if an
128+
Status Register accordingly. If AER error reporting is enabled in the Root
129+
Error Command Register, the Root Port generates an interrupt when an
131130
error is detected.
132131

133-
Note that the errors as described above are related to the PCI Express
132+
Note that the errors as described above are related to the PCIe
134133
hierarchy and links. These errors do not include any device specific
135134
errors because device specific errors will still get sent directly to
136135
the device driver.
137136

138-
Configure the AER capability structure
139-
--------------------------------------
140-
141-
AER aware drivers of PCI Express component need change the device
142-
control registers to enable AER. They also could change AER registers,
143-
including mask and severity registers. Helper function
144-
pci_enable_pcie_error_reporting could be used to enable AER. See
145-
section 3.3.
146-
147137
Provide callbacks
148138
-----------------
149139

150-
callback reset_link to reset pci express link
151-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140+
callback reset_link to reset PCIe link
141+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
152142

153-
This callback is used to reset the pci express physical link when a
154-
fatal error happens. The root port aer service driver provides a
155-
default reset_link function, but different upstream ports might
156-
have different specifications to reset pci express link, so all
157-
upstream ports should provide their own reset_link functions.
143+
This callback is used to reset the PCIe physical link when a
144+
fatal error happens. The Root Port AER service driver provides a
145+
default reset_link function, but different Upstream Ports might
146+
have different specifications to reset the PCIe link, so
147+
Upstream Port drivers may provide their own reset_link functions.
158148

159149
Section 3.2.2.2 provides more detailed info on when to call
160150
reset_link.
161151

162152
PCI error-recovery callbacks
163153
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
164154

165-
The PCI Express AER Root driver uses error callbacks to coordinate
155+
The PCIe AER Root driver uses error callbacks to coordinate
166156
with downstream device drivers associated with a hierarchy in question
167157
when performing error recovery actions.
168158

169159
Data struct pci_driver has a pointer, err_handler, to point to
170160
pci_error_handlers who consists of a couple of callback function
171-
pointers. AER driver follows the rules defined in
172-
pci-error-recovery.txt except pci express specific parts (e.g.
173-
reset_link). Pls. refer to pci-error-recovery.txt for detailed
161+
pointers. The AER driver follows the rules defined in
162+
pci-error-recovery.rst except PCIe-specific parts (e.g.
163+
reset_link). Please refer to pci-error-recovery.rst for detailed
174164
definitions of the callbacks.
175165

176-
Below sections specify when to call the error callback functions.
166+
The sections below specify when to call the error callback functions.
177167

178168
Correctable errors
179169
~~~~~~~~~~~~~~~~~~
180170

181171
Correctable errors pose no impacts on the functionality of
182-
the interface. The PCI Express protocol can recover without any
172+
the interface. The PCIe protocol can recover without any
183173
software intervention or any loss of data. These errors do not
184174
require any recovery actions. The AER driver clears the device's
185175
correctable error status register accordingly and logs these errors.
@@ -190,12 +180,12 @@ Non-correctable (non-fatal and fatal) errors
190180
If an error message indicates a non-fatal error, performing link reset
191181
at upstream is not required. The AER driver calls error_detected(dev,
192182
pci_channel_io_normal) to all drivers associated within a hierarchy in
193-
question. for example::
183+
question. For example::
194184

195-
EndPoint<==>DownstreamPort B<==>UpstreamPort A<==>RootPort
185+
Endpoint <==> Downstream Port B <==> Upstream Port A <==> Root Port
196186

197-
If Upstream port A captures an AER error, the hierarchy consists of
198-
Downstream port B and EndPoint.
187+
If Upstream Port A captures an AER error, the hierarchy consists of
188+
Downstream Port B and Endpoint.
199189

200190
A driver may return PCI_ERS_RESULT_CAN_RECOVER,
201191
PCI_ERS_RESULT_DISCONNECT, or PCI_ERS_RESULT_NEED_RESET, depending on
@@ -212,36 +202,11 @@ to reset the link. If error_detected returns PCI_ERS_RESULT_CAN_RECOVER
212202
and reset_link returns PCI_ERS_RESULT_RECOVERED, the error handling goes
213203
to mmio_enabled.
214204

215-
helper functions
216-
----------------
217-
::
218-
219-
int pci_enable_pcie_error_reporting(struct pci_dev *dev);
220-
221-
pci_enable_pcie_error_reporting enables the device to send error
222-
messages to root port when an error is detected. Note that devices
223-
don't enable the error reporting by default, so device drivers need
224-
call this function to enable it.
225-
226-
::
227-
228-
int pci_disable_pcie_error_reporting(struct pci_dev *dev);
229-
230-
pci_disable_pcie_error_reporting disables the device to send error
231-
messages to root port when an error is detected.
232-
233-
::
234-
235-
int pci_aer_clear_nonfatal_status(struct pci_dev *dev);`
236-
237-
pci_aer_clear_nonfatal_status clears non-fatal errors in the uncorrectable
238-
error status register.
239-
240205
Frequent Asked Questions
241206
------------------------
242207

243208
Q:
244-
What happens if a PCI Express device driver does not provide an
209+
What happens if a PCIe device driver does not provide an
245210
error recovery handler (pci_driver->err_handler is equal to NULL)?
246211

247212
A:
@@ -257,24 +222,6 @@ A:
257222
Fatal error recovery will fail if the errors are reported by the
258223
upstream ports who are attached by the service driver.
259224

260-
Q:
261-
How does this infrastructure deal with driver that is not PCI
262-
Express aware?
263-
264-
A:
265-
This infrastructure calls the error callback functions of the
266-
driver when an error happens. But if the driver is not aware of
267-
PCI Express, the device might not report its own errors to root
268-
port.
269-
270-
Q:
271-
What modifications will that driver need to make it compatible
272-
with the PCI Express AER Root driver?
273-
274-
A:
275-
It could call the helper functions to enable AER in devices and
276-
cleanup uncorrectable status register. Pls. refer to section 3.3.
277-
278225

279226
Software error injection
280227
========================
@@ -296,5 +243,5 @@ from:
296243

297244
https://git.kernel.org/cgit/linux/kernel/git/gong.chen/aer-inject.git/
298245

299-
More information about aer-inject can be found in the document comes
300-
with its source code.
246+
More information about aer-inject can be found in the document in
247+
its source code.

drivers/pci/pci.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,13 +686,17 @@ extern const struct attribute_group aer_stats_attr_group;
686686
void pci_aer_clear_fatal_status(struct pci_dev *dev);
687687
int pci_aer_clear_status(struct pci_dev *dev);
688688
int pci_aer_raw_clear_status(struct pci_dev *dev);
689+
void pci_save_aer_state(struct pci_dev *dev);
690+
void pci_restore_aer_state(struct pci_dev *dev);
689691
#else
690692
static inline void pci_no_aer(void) { }
691693
static inline void pci_aer_init(struct pci_dev *d) { }
692694
static inline void pci_aer_exit(struct pci_dev *d) { }
693695
static inline void pci_aer_clear_fatal_status(struct pci_dev *dev) { }
694696
static inline int pci_aer_clear_status(struct pci_dev *dev) { return -EINVAL; }
695697
static inline int pci_aer_raw_clear_status(struct pci_dev *dev) { return -EINVAL; }
698+
static inline void pci_save_aer_state(struct pci_dev *dev) { }
699+
static inline void pci_restore_aer_state(struct pci_dev *dev) { }
696700
#endif
697701

698702
#ifdef CONFIG_ACPI

include/linux/aer.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ struct aer_capability_regs {
4545
int pci_enable_pcie_error_reporting(struct pci_dev *dev);
4646
int pci_disable_pcie_error_reporting(struct pci_dev *dev);
4747
int pci_aer_clear_nonfatal_status(struct pci_dev *dev);
48-
void pci_save_aer_state(struct pci_dev *dev);
49-
void pci_restore_aer_state(struct pci_dev *dev);
5048
#else
5149
static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)
5250
{
@@ -60,8 +58,6 @@ static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
6058
{
6159
return -EINVAL;
6260
}
63-
static inline void pci_save_aer_state(struct pci_dev *dev) {}
64-
static inline void pci_restore_aer_state(struct pci_dev *dev) {}
6561
#endif
6662

6763
void cper_print_aer(struct pci_dev *dev, int aer_severity,

0 commit comments

Comments
 (0)