Skip to content

Commit 3409eb4

Browse files
Gavin Shanmpe
authored andcommitted
powerpc/pseries: Drop config requests in EEH accessors
The pSeires EEH config accessors rely on rtas_{read, write}_config() and the condition to check if the PE's config space is blocked should be moved to those 2 functions so that config requests from kernel, userland, EEH core can be dropped to avoid recursive EEH error if necessary. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent d2cfbcd commit 3409eb4

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

‎arch/powerpc/kernel/rtas_pci.c‎

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val)
6666
return PCIBIOS_DEVICE_NOT_FOUND;
6767
if (!config_access_valid(pdn, where))
6868
return PCIBIOS_BAD_REGISTER_NUMBER;
69+
#ifdef CONFIG_EEH
70+
if (pdn->edev && pdn->edev->pe &&
71+
(pdn->edev->pe->state & EEH_PE_CFG_BLOCKED))
72+
return PCIBIOS_SET_FAILED;
73+
#endif
6974

7075
addr = rtas_config_addr(pdn->busno, pdn->devfn, where);
7176
buid = pdn->phb->buid;
@@ -90,9 +95,6 @@ static int rtas_pci_read_config(struct pci_bus *bus,
9095
struct device_node *busdn, *dn;
9196
struct pci_dn *pdn;
9297
bool found = false;
93-
#ifdef CONFIG_EEH
94-
struct eeh_dev *edev;
95-
#endif
9698
int ret;
9799

98100
/* Search only direct children of the bus */
@@ -109,11 +111,6 @@ static int rtas_pci_read_config(struct pci_bus *bus,
109111

110112
if (!found)
111113
return PCIBIOS_DEVICE_NOT_FOUND;
112-
#ifdef CONFIG_EEH
113-
edev = of_node_to_eeh_dev(dn);
114-
if (edev && edev->pe && edev->pe->state & EEH_PE_CFG_BLOCKED)
115-
return PCIBIOS_DEVICE_NOT_FOUND;
116-
#endif
117114

118115
ret = rtas_read_config(pdn, where, size, val);
119116
if (*val == EEH_IO_ERROR_VALUE(size) &&
@@ -132,6 +129,11 @@ int rtas_write_config(struct pci_dn *pdn, int where, int size, u32 val)
132129
return PCIBIOS_DEVICE_NOT_FOUND;
133130
if (!config_access_valid(pdn, where))
134131
return PCIBIOS_BAD_REGISTER_NUMBER;
132+
#ifdef CONFIG_EEH
133+
if (pdn->edev && pdn->edev->pe &&
134+
(pdn->edev->pe->state & EEH_PE_CFG_BLOCKED))
135+
return PCIBIOS_SET_FAILED;
136+
#endif
135137

136138
addr = rtas_config_addr(pdn->busno, pdn->devfn, where);
137139
buid = pdn->phb->buid;
@@ -155,10 +157,6 @@ static int rtas_pci_write_config(struct pci_bus *bus,
155157
struct device_node *busdn, *dn;
156158
struct pci_dn *pdn;
157159
bool found = false;
158-
#ifdef CONFIG_EEH
159-
struct eeh_dev *edev;
160-
#endif
161-
int ret;
162160

163161
/* Search only direct children of the bus */
164162
busdn = pci_bus_to_OF_node(bus);
@@ -173,14 +171,8 @@ static int rtas_pci_write_config(struct pci_bus *bus,
173171

174172
if (!found)
175173
return PCIBIOS_DEVICE_NOT_FOUND;
176-
#ifdef CONFIG_EEH
177-
edev = of_node_to_eeh_dev(dn);
178-
if (edev && edev->pe && (edev->pe->state & EEH_PE_CFG_BLOCKED))
179-
return PCIBIOS_DEVICE_NOT_FOUND;
180-
#endif
181-
ret = rtas_write_config(pdn, where, size, val);
182174

183-
return ret;
175+
return rtas_write_config(pdn, where, size, val);
184176
}
185177

186178
static struct pci_ops rtas_pci_ops = {

0 commit comments

Comments
 (0)