: PCI Err: PPC64-specific recovery infrastructure
PATCH 10/13 : PCI Err: PPC64-specific recovery infrastructure
pci-err-10-ppc64.patch
Implements ppc64-specific parts of detecting PCI bus errors, (via calls to the firmware to ask the hardware pci bridges) and the related mechanisms for reseting the affects PCI slots (again, via firmware calls).
include/asm-ppc64/eeh.h renamed from include/asm-ppc64/eeh.h.linas-orig +63 -22
@@ -36,6 +36,11 @@ struct notifier_block;#define EEH_MODE_SUPPORTED (1<<0)#define EEH_MODE_NOCHECK (1<<1)#define EEH_MODE_ISOLATED (1<<2) +#define EEH_MODE_RECOVERING (1<<3) + +/* Max number of EEH freezes allowed before we consider the device +* to be permanently disabled. */ +#define EEH_MAX_ALLOWED_FREEZES 5void __init eeh_init (void ); unsigned long eeh_check_failure(const volatile void __iomem *token,
@@ -59,35 +64,71 @@ void eeh_add_device_late(struct pci_dev* eeh_remove_device - undo EEH setup for the indicated pci device * @dev: pci device to be removed * -* This routine should be when a device is removed from a running -* system (e.g. by hotplug or dlpar). +* This routine should be called when a device is removed from +* a running system (e.g. by hotplug or dlpar). It unregisters +* the PCI device from the EEH subsystem. I/O errors affecting +* this device will no longer be detected after this call; thus, +* i/o errors affecting this slot may leave this device unusable. */ void eeh_remove_device (struct pci_dev *); -#define EEH_DISABLE 0 -#define EEH_ENABLE 1 -#define EEH_RELEASE_LOADSTORE 2 -#define EEH_RELEASE_DMA 3 +/** +* eeh_slot_error_detail -- record and EEH error condition to the log +* @severity: 1 if temporary, 2 if permanent failure. +* +* Obtains the the EEH error details from the RTAS subsystem, +* and then logs these details with the RTAS error log system. +*/ +void eeh_slot_error_detail (struct device_node *dn,int severity);/** -* Notifier event flags. +* rtas_set_slot_reset -- unfreeze a frozen slot +* +* Clear the EEH-frozen condition on a slot. This routine +* does this by asserting the PCI #RST line for 1/8th of +* a second; this routine will sleep while the adapter is +* being reset. */ -#define EEH_NOTIFY_FREEZE 1 +void rtas_set_slot_reset (struct device_node *dn); -/** EEH event -- structure holding pci slot data that describes -* a change in the isolation status of a PCI slot. A pointer -* to this struct is passed as the data pointer in a notify callback. -*/ -struct eeh_event { -struct list_head list; -struct pci_dev *dev; -struct device_node *dn; -int reset_state; -}; - -/** Register to find out about EEH events. */ -int eeh_register_notifier (struct notifier_block *nb); -int eeh_unregister_notifier (struct notifier_block *nb); +/** rtas_pci_slot_reset raises/lowers the pci #RST line +* state: 1/0 to raise/lower the #RST +* +* Clear the EEH-frozen condition on a slot. This routine +* asserts the PCI #RST line if the 'state' argument is '1', +* and drops the #RST line if 'state is '0'. This routine is +* safe to call in an interrupt context. +* +*/ +void rtas_pci_slot_reset (struct device_node *dn,int state); +void eeh_pci_slot_reset (struct pci_dev *dev,int state); + +/** eeh_pci_slot_availability -- Indicates whether a PCI +* slot is ready to be used. After a PCI reset, it may take a while +* for the PCI fabric to fully reset the comminucations path to the +* given PCI card. This routine can be used to determine how long +* to wait before a PCI slot might become usable. +* +* This routine returns how long to wait (in milliseconds) before +* the slot is expected to be usable. A value of zero means the +* slot is immediately usable. A negavitve value means that the +* slot is permanently disabled. +*/ +int eeh_pci_slot_availability (struct pci_dev *dev); + +/** Restore device configuration info across device resets. +*/ +void eeh_restore_bars (struct device_node *); +void eeh_pci_restore_bars (struct pci_dev *dev); + +/** +* rtas_configure_bridge -- firmware initialization of pci bridge +* +* Ask the firmware to configure any PCI bridge devices +* located behind the indicated node. Required after a +* pci device reset. +*/ +void rtas_configure_bridge (struct device_node *dn);/** * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
include/asm-ppc64/prom.h renamed from include/asm-ppc64/prom.h.linas-orig +5 -0
@@ -119,6 +119,7 @@ struct property {*/ struct pci_controller ;struct iommu_table ; +struct eeh_recovery_ops ;struct device_node {char *name;
@@ -137,9 +138,13 @@ struct device_node {int devfn;/* for pci devices */ int eeh_mode;/* See eeh.h for possible EEH_MODEs */ int eeh_config_addr; +int eeh_check_count;/* number of times device driver ignored error */ +int eeh_freeze_count;/* number of times this device froze up. */ +int eeh_is_bridge;/* device is pci-to-pci bridge */ int pci_ext_config_space;/* for pci devices */ struct pci_controller *phb;/* for pci devices */ struct iommu_table *iommu_table;/* for phb's or bridges */ +u32 config_space[16 ];/* saved PCI config space */ struct property *properties;struct device_node *parent;
include/asm-ppc64/rtas.h renamed from include/asm-ppc64/rtas.h.linas-orig +2 -0
@@ -246,4 +246,6 @@ extern unsigned long rtas_rmo_buf;#define GLOBAL_INTERRUPT_QUEUE 9005 +extern int rtas_write_config (struct device_node *dn,int where,int size,u32 val); +#endif /* _PPC64_RTAS_H */
arch/ppc64/kernel/eeh.c renamed from arch/ppc64/kernel/eeh.c.linas-orig +390 -156
785 lines not on this page · raw message
arch/ppc64/kernel/rtas_pci.c renamed from arch/ppc64/kernel/rtas_pci.c.linas-orig +2 -2
@@ -58,7 +58,7 @@ static int config_access_valid(struct dereturn 0 ; } -static int rtas_read_config (struct device_node *dn,int where,int size,u32 *val) +int rtas_read_config (struct device_node *dn,int where,int size,u32 *val) {int returnval =-1 ;unsigned long buid, addr;
@@ -108,7 +108,7 @@ static int rtas_pci_read_config(struct preturn PCIBIOS_DEVICE_NOT_FOUND ; } -static int rtas_write_config (struct device_node *dn,int where,int size,u32 val) +int rtas_write_config (struct device_node *dn,int where,int size,u32 val) {unsigned long buid, addr;int ret;
Quoted 13 lines · Linas Vepstas
struct device_node { char *name;(quoted diff) +0
-0@@ -137,9 +138,13 @@ struct device_node { int devfn; /* for pci devices */ int eeh_mode; /* See eeh.h for possible
EEH_MODEs*/int eeh_config_addr;+ int
eeh_check_count; /* number of times device driver
ignored error */
+ inteeh_freeze_count; /* number of times this device froze
up. */
+ inteeh_is_bridge; /* device is pci-to-pci bridge */
Quoted 8 lines
int pci_ext_config_space; /* for pci devices */ struct pci_controller *phb; /* for pci devices */ struct iommu_table *iommu_table; /* for phb's orbridges */
+ u32 config_space[16]; /* saved PCI config space */struct property *properties; struct device_node *parent;
Please, do not add crap to struct device_node. It's already bloated enough and we intend to instead get rid of the stuff in there.
Do you actually need to save the config space at all ? Can't you just use "assigned-address" property to fill up the BARs again ? As for the other EEH things, well, we probably need to bite the bullet and do what we talked about doing for a while, that is split the PCI related junk out of struct device_node and into a separate structure. We could maybe at first (to ease the transition) keep a pointer to it in device_node, and we can create that structure early in pci_dn. That way, we only really need to add gunk to PCI devices and not to all nodes. Same for VIO actually.
Ben.
(resend, dropped cc's)
Hi Linas-
The new functions eeh_report_error, eeh_report_reset, eeh_report_resume, eeh_report_failure, eeh_reset_device, and handle_eeh_events do not belong in this driver, imho. Most of them have nothing to do with PCI hotplug (eeh_report_*). The ones that do are clients of the enable/disable functionality, and as such are not part of the actual hotplug implementation. In my mind, it makes sense to logically separate things when poissible. I'm currently making an effort to reduce bloat in this driver, and this would add to it.
The functions eeh_report_*, along with the handling routines, could just as easily exist in the kernel or in a 3rd module (drivers/pci/hotplug/rpaphp_pcierr.ko?). You've suggested the third module idea before, and I think it makes more sense than lumping this in w/ rpaphp. You could export [enable,disable]_slot from rpaphp, and have a module dependency, similar to rpadlpar_io.
Thanks-
John
Quoted 14 lines · Linas Vepstas
pci-err-10-ppc64.patch
Implements ppc64-specific parts of detecting PCI bus errors, (via calls to the firmware to ask the hardware pci bridges) and the related mechanisms for reseting the affects PCI slots (again, via firmware calls).
Signed-off-by Linas Vepstas <[email protected]>______________________________________________________________________
_______________________________________________
Linuxppc64-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc64-dev