]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.arch/pseries-set-error_state-correctly-in-eeh_report_reset
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / pseries-set-error_state-correctly-in-eeh_report_reset
CommitLineData
2cb7cef9
BS
1From: Mike Mason <mmlnx@us.ibm.com>
2Date: Fri, 10 Apr 2009 08:57:03 +0000 (+0000)
3Subject: powerpc/pseries: Set error_state to pci_channel_io_normal in eeh_report_reset()
4Patch-mainline: 2.6.30
5Git-commit: c58dc575f3c8bdc69fb868ec51e1c80ee7cae5e7
6References: bnc#509407
7
8powerpc/pseries: Set error_state to pci_channel_io_normal in eeh_report_reset()
9
10While adding native EEH support to Emulex and Qlogic drivers, it was
11discovered that dev->error_state was set to pci_io_channel_normal too
12late in the recovery process. These drivers rely on error_state to
13determine if they can access the device in their slot_reset callback,
14thus error_state needs to be set to pci_io_channel_normal in
15eeh_report_reset(). Below is a detailed explanation (courtesy of Richard
16Lary) as to why this is necessary.
17
18Background:
19PCI MMIO or DMA accesses to a frozen slot generate additional EEH
20errors. If the number of additional EEH errors exceeds EEH_MAX_FAILS the
21adapter will be shutdown. To avoid triggering excessive EEH errors and
22an undesirable adapter shutdown, some drivers use the
23pci_channel_offline(dev) wrapper function to return a Boolean value
24based on the value of pci_dev->error_state to determine if PCI MMIO or
25DMA accesses are safe. If the wrapper returns TRUE, drivers must not
26make PCI MMIO or DMA access to their hardware.
27
28The pci_dev structure member error_state reflects one of three values,
291) pci_channel_io_normal, 2) pci_channel_io_frozen, 3)
30pci_channel_io_perm_failure. Function pci_channel_offline(dev) returns
31TRUE if error_state is pci_channel_io_frozen or pci_channel_io_perm_failure.
32
33The EEH driver sets pci_dev->error_state to pci_channel_io_frozen at the
34point where the PCI slot is frozen. Currently, the EEH driver restores
35dev->error_state to pci_channel_io_normal in eeh_report_resume() before
36calling the driver's resume callback. However, when the EEH driver calls
37the driver's slot_reset callback() from eeh_report_reset(), it
38incorrectly indicates the error state is still pci_channel_io_frozen.
39
40Waiting until eeh_report_resume() to restore dev->error_state to
41pci_channel_io_normal is too late for Emulex and QLogic FC drivers and
42any other drivers which are designed to use common code paths in these
43two cases: i) those called after the driver's slot_reset callback() and
44ii) those called after the PCI slot is frozen but before the driver's
45slot_reset callback is called. Case i) all driver paths executed to
46reinitialize the hardware after a reset and case ii) all code paths
47executed by driver kernel threads that run asynchronous to the main
48driver thread, such as interrupt handlers and worker threads to process
49driver work queues.
50
51Emulex and QLogic FC drivers are designed with common code paths which
52require that pci_channel_offline(dev) reflect the true state of the
53hardware. The state transitions that the hardware takes from Normal
54Operations to Slot Frozen to Reset to Normal Operations are documented
55in the Power Architectureâ„¢ Platform Requirements+ (PAPR+) in Table 75.
56PE State Control.
57
58PAPR defines the following 3 states:
59
600 -- Not reset, Not EEH stopped, MMIO load/store allowed, DMA allowed
61 (Normal Operations)
621 -- Reset, Not EEH stopped, MMIO load/store disabled, DMA disabled
632 -- Not reset, EEH stopped, MMIO load/store disabled, DMA disabled
64 (Slot Frozen)
65
66An EEH error places the slot in state 2 (Frozen) and the adapter driver
67is notified that an EEH error was detected. If the adapter driver
68returns PCI_ERS_RESULT_NEED_RESET, the EEH driver calls
69eeh_reset_device() to place the slot into state 1 (Reset) and
70eeh_reset_device completes by placing the slot into State 0 (Normal
71Operations). Upon return from eeh_reset_device(), the EEH driver calls
72eeh_report_reset, which then calls the adapter's slot_reset callback. At
73the time the adapter's slot_reset callback is called, the true state of
74the hardware is Normal Operations and should be accurately reflected by
75setting dev->error_state to pci_channel_io_normal.
76
77The current implementation of EEH driver does not do so and requires
78this change to correct this deficiency.
79
80Signed-off-by: Mike Mason <mmlnx@us.ibm.com>
81Acked-by: Linas Vepstas <linasvepstas@gmail.com>
82Signed-off-by: Paul Mackerras <paulus@samba.org>
83Acked-by: Jeff Mahoney <jeffm@suse.com>
84---
85 arch/powerpc/platforms/pseries/eeh_driver.c | 2 ++
86 1 file changed, 2 insertions(+)
87
88--- a/arch/powerpc/platforms/pseries/eeh_driver.c
89+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
90@@ -152,6 +152,8 @@ static void eeh_report_reset(struct pci_
91 if (!driver)
92 return;
93
94+ dev->error_state = pci_channel_io_normal;
95+
96 if ((PCI_DN(dn)->eeh_mode) & EEH_MODE_IRQ_DISABLED) {
97 PCI_DN(dn)->eeh_mode &= ~EEH_MODE_IRQ_DISABLED;
98 enable_irq(dev->irq);