Commit dbbceee1 authored by Gavin Shan's avatar Gavin Shan Committed by Benjamin Herrenschmidt

powerpc/eeh: Move stats to PE

The patch removes the eeh related statistics for eeh device since
they have been maintained by the corresponding eeh PE. Also, the
flags used to trace the state of eeh device and PE have been reworked
for a little bit.
Signed-off-by: default avatarGavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 9b3c76f0
...@@ -77,20 +77,13 @@ struct eeh_pe { ...@@ -77,20 +77,13 @@ struct eeh_pe {
* another tree except the currently existing tree of PCI * another tree except the currently existing tree of PCI
* buses and PCI devices * buses and PCI devices
*/ */
#define EEH_MODE_SUPPORTED (1<<0) /* EEH supported on the device */ #define EEH_DEV_IRQ_DISABLED (1<<0) /* Interrupt disabled */
#define EEH_MODE_NOCHECK (1<<1) /* EEH check should be skipped */
#define EEH_MODE_ISOLATED (1<<2) /* The device has been isolated */
#define EEH_MODE_RECOVERING (1<<3) /* Recovering the device */
#define EEH_MODE_IRQ_DISABLED (1<<4) /* Interrupt disabled */
struct eeh_dev { struct eeh_dev {
int mode; /* EEH mode */ int mode; /* EEH mode */
int class_code; /* Class code of the device */ int class_code; /* Class code of the device */
int config_addr; /* Config address */ int config_addr; /* Config address */
int pe_config_addr; /* PE config address */ int pe_config_addr; /* PE config address */
int check_count; /* Times of ignored error */
int freeze_count; /* Times of froze up */
int false_positives; /* Times of reported #ff's */
u32 config_space[16]; /* Saved PCI config space */ u32 config_space[16]; /* Saved PCI config space */
struct eeh_pe *pe; /* Associated PE */ struct eeh_pe *pe; /* Associated PE */
struct list_head list; /* Form link list in the PE */ struct list_head list; /* Form link list in the PE */
......
...@@ -537,7 +537,7 @@ static void eeh_reset_pe_once(struct eeh_pe *pe) ...@@ -537,7 +537,7 @@ static void eeh_reset_pe_once(struct eeh_pe *pe)
* pci slot reset line is dropped. Make sure we don't miss * pci slot reset line is dropped. Make sure we don't miss
* these, and clear the flag now. * these, and clear the flag now.
*/ */
eeh_pe_state_clear(pe, EEH_MODE_ISOLATED); eeh_pe_state_clear(pe, EEH_PE_ISOLATED);
eeh_ops->reset(pe, EEH_RESET_DEACTIVATE); eeh_ops->reset(pe, EEH_RESET_DEACTIVATE);
...@@ -625,9 +625,6 @@ static void *eeh_early_enable(struct device_node *dn, void *data) ...@@ -625,9 +625,6 @@ static void *eeh_early_enable(struct device_node *dn, void *data)
edev->class_code = 0; edev->class_code = 0;
edev->mode = 0; edev->mode = 0;
edev->check_count = 0;
edev->freeze_count = 0;
edev->false_positives = 0;
if (!of_device_is_available(dn)) if (!of_device_is_available(dn))
return NULL; return NULL;
...@@ -637,10 +634,8 @@ static void *eeh_early_enable(struct device_node *dn, void *data) ...@@ -637,10 +634,8 @@ static void *eeh_early_enable(struct device_node *dn, void *data)
return NULL; return NULL;
/* There is nothing to check on PCI to ISA bridges */ /* There is nothing to check on PCI to ISA bridges */
if (dn->type && !strcmp(dn->type, "isa")) { if (dn->type && !strcmp(dn->type, "isa"))
edev->mode |= EEH_MODE_NOCHECK;
return NULL; return NULL;
}
edev->class_code = *class_code; edev->class_code = *class_code;
/* Ok... see if this device supports EEH. Some do, some don't, /* Ok... see if this device supports EEH. Some do, some don't,
...@@ -679,7 +674,6 @@ static void *eeh_early_enable(struct device_node *dn, void *data) ...@@ -679,7 +674,6 @@ static void *eeh_early_enable(struct device_node *dn, void *data)
if (enable) { if (enable) {
eeh_subsystem_enabled = 1; eeh_subsystem_enabled = 1;
edev->mode |= EEH_MODE_SUPPORTED;
eeh_add_to_parent_pe(edev); eeh_add_to_parent_pe(edev);
...@@ -692,9 +686,8 @@ static void *eeh_early_enable(struct device_node *dn, void *data) ...@@ -692,9 +686,8 @@ static void *eeh_early_enable(struct device_node *dn, void *data)
* EEH parent, in which case we mark it as supported. * EEH parent, in which case we mark it as supported.
*/ */
if (dn->parent && of_node_to_eeh_dev(dn->parent) && if (dn->parent && of_node_to_eeh_dev(dn->parent) &&
(of_node_to_eeh_dev(dn->parent)->mode & EEH_MODE_SUPPORTED)) { of_node_to_eeh_dev(dn->parent)->pe) {
/* Parent supports EEH. */ /* Parent supports EEH. */
edev->mode |= EEH_MODE_SUPPORTED;
edev->config_addr = of_node_to_eeh_dev(dn->parent)->config_addr; edev->config_addr = of_node_to_eeh_dev(dn->parent)->config_addr;
edev->pe_config_addr = of_node_to_eeh_dev(dn->parent)->pe_config_addr; edev->pe_config_addr = of_node_to_eeh_dev(dn->parent)->pe_config_addr;
......
...@@ -192,8 +192,7 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev) ...@@ -192,8 +192,7 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev)
} }
/* Skip any devices for which EEH is not enabled. */ /* Skip any devices for which EEH is not enabled. */
if (!(edev->mode & EEH_MODE_SUPPORTED) || if (!edev->pe) {
edev->mode & EEH_MODE_NOCHECK) {
#ifdef DEBUG #ifdef DEBUG
pr_info("PCI: skip building address cache for=%s - %s\n", pr_info("PCI: skip building address cache for=%s - %s\n",
pci_name(dev), dn->full_name); pci_name(dev), dn->full_name);
......
...@@ -93,7 +93,7 @@ static void eeh_disable_irq(struct pci_dev *dev) ...@@ -93,7 +93,7 @@ static void eeh_disable_irq(struct pci_dev *dev)
if (!irq_has_action(dev->irq)) if (!irq_has_action(dev->irq))
return; return;
edev->mode |= EEH_MODE_IRQ_DISABLED; edev->mode |= EEH_DEV_IRQ_DISABLED;
disable_irq_nosync(dev->irq); disable_irq_nosync(dev->irq);
} }
...@@ -108,8 +108,8 @@ static void eeh_enable_irq(struct pci_dev *dev) ...@@ -108,8 +108,8 @@ static void eeh_enable_irq(struct pci_dev *dev)
{ {
struct eeh_dev *edev = pci_dev_to_eeh_dev(dev); struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
if ((edev->mode) & EEH_MODE_IRQ_DISABLED) { if ((edev->mode) & EEH_DEV_IRQ_DISABLED) {
edev->mode &= ~EEH_MODE_IRQ_DISABLED; edev->mode &= ~EEH_DEV_IRQ_DISABLED;
enable_irq(dev->irq); enable_irq(dev->irq);
} }
} }
......
...@@ -53,9 +53,6 @@ static DEVICE_ATTR(_name, S_IRUGO, eeh_show_##_name, NULL); ...@@ -53,9 +53,6 @@ static DEVICE_ATTR(_name, S_IRUGO, eeh_show_##_name, NULL);
EEH_SHOW_ATTR(eeh_mode, mode, "0x%x"); EEH_SHOW_ATTR(eeh_mode, mode, "0x%x");
EEH_SHOW_ATTR(eeh_config_addr, config_addr, "0x%x"); EEH_SHOW_ATTR(eeh_config_addr, config_addr, "0x%x");
EEH_SHOW_ATTR(eeh_pe_config_addr, pe_config_addr, "0x%x"); EEH_SHOW_ATTR(eeh_pe_config_addr, pe_config_addr, "0x%x");
EEH_SHOW_ATTR(eeh_check_count, check_count, "%d" );
EEH_SHOW_ATTR(eeh_freeze_count, freeze_count, "%d" );
EEH_SHOW_ATTR(eeh_false_positives, false_positives, "%d" );
void eeh_sysfs_add_device(struct pci_dev *pdev) void eeh_sysfs_add_device(struct pci_dev *pdev)
{ {
...@@ -64,9 +61,6 @@ void eeh_sysfs_add_device(struct pci_dev *pdev) ...@@ -64,9 +61,6 @@ void eeh_sysfs_add_device(struct pci_dev *pdev)
rc += device_create_file(&pdev->dev, &dev_attr_eeh_mode); rc += device_create_file(&pdev->dev, &dev_attr_eeh_mode);
rc += device_create_file(&pdev->dev, &dev_attr_eeh_config_addr); rc += device_create_file(&pdev->dev, &dev_attr_eeh_config_addr);
rc += device_create_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); rc += device_create_file(&pdev->dev, &dev_attr_eeh_pe_config_addr);
rc += device_create_file(&pdev->dev, &dev_attr_eeh_check_count);
rc += device_create_file(&pdev->dev, &dev_attr_eeh_false_positives);
rc += device_create_file(&pdev->dev, &dev_attr_eeh_freeze_count);
if (rc) if (rc)
printk(KERN_WARNING "EEH: Unable to create sysfs entries\n"); printk(KERN_WARNING "EEH: Unable to create sysfs entries\n");
...@@ -77,8 +71,5 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev) ...@@ -77,8 +71,5 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev)
device_remove_file(&pdev->dev, &dev_attr_eeh_mode); device_remove_file(&pdev->dev, &dev_attr_eeh_mode);
device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr); device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr);
device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr);
device_remove_file(&pdev->dev, &dev_attr_eeh_check_count);
device_remove_file(&pdev->dev, &dev_attr_eeh_false_positives);
device_remove_file(&pdev->dev, &dev_attr_eeh_freeze_count);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment