aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGavin Shan <shangw@linux.vnet.ibm.com>2012-09-07 18:44:20 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-09-09 19:35:43 -0400
commitdbbceee12f2160ef1ac848316212f97bf5bc4c16 (patch)
treede1065ac45c189d1ffbe621e8cd3557a0a3d7c9e /arch
parent9b3c76f08122f5efdbe4992a64b8478cc92dd983 (diff)
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: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/eeh.h9
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c13
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c3
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c6
-rw-r--r--arch/powerpc/platforms/pseries/eeh_sysfs.c9
5 files changed, 8 insertions, 32 deletions
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index d25a693595f8..792d2d789751 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -77,20 +77,13 @@ struct eeh_pe {
77 * another tree except the currently existing tree of PCI 77 * another tree except the currently existing tree of PCI
78 * buses and PCI devices 78 * buses and PCI devices
79 */ 79 */
80#define EEH_MODE_SUPPORTED (1<<0) /* EEH supported on the device */ 80#define EEH_DEV_IRQ_DISABLED (1<<0) /* Interrupt disabled */
81#define EEH_MODE_NOCHECK (1<<1) /* EEH check should be skipped */
82#define EEH_MODE_ISOLATED (1<<2) /* The device has been isolated */
83#define EEH_MODE_RECOVERING (1<<3) /* Recovering the device */
84#define EEH_MODE_IRQ_DISABLED (1<<4) /* Interrupt disabled */
85 81
86struct eeh_dev { 82struct eeh_dev {
87 int mode; /* EEH mode */ 83 int mode; /* EEH mode */
88 int class_code; /* Class code of the device */ 84 int class_code; /* Class code of the device */
89 int config_addr; /* Config address */ 85 int config_addr; /* Config address */
90 int pe_config_addr; /* PE config address */ 86 int pe_config_addr; /* PE config address */
91 int check_count; /* Times of ignored error */
92 int freeze_count; /* Times of froze up */
93 int false_positives; /* Times of reported #ff's */
94 u32 config_space[16]; /* Saved PCI config space */ 87 u32 config_space[16]; /* Saved PCI config space */
95 struct eeh_pe *pe; /* Associated PE */ 88 struct eeh_pe *pe; /* Associated PE */
96 struct list_head list; /* Form link list in the PE */ 89 struct list_head list; /* Form link list in the PE */
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 56a022b03651..6d4323025793 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -537,7 +537,7 @@ static void eeh_reset_pe_once(struct eeh_pe *pe)
537 * pci slot reset line is dropped. Make sure we don't miss 537 * pci slot reset line is dropped. Make sure we don't miss
538 * these, and clear the flag now. 538 * these, and clear the flag now.
539 */ 539 */
540 eeh_pe_state_clear(pe, EEH_MODE_ISOLATED); 540 eeh_pe_state_clear(pe, EEH_PE_ISOLATED);
541 541
542 eeh_ops->reset(pe, EEH_RESET_DEACTIVATE); 542 eeh_ops->reset(pe, EEH_RESET_DEACTIVATE);
543 543
@@ -625,9 +625,6 @@ static void *eeh_early_enable(struct device_node *dn, void *data)
625 625
626 edev->class_code = 0; 626 edev->class_code = 0;
627 edev->mode = 0; 627 edev->mode = 0;
628 edev->check_count = 0;
629 edev->freeze_count = 0;
630 edev->false_positives = 0;
631 628
632 if (!of_device_is_available(dn)) 629 if (!of_device_is_available(dn))
633 return NULL; 630 return NULL;
@@ -637,10 +634,8 @@ static void *eeh_early_enable(struct device_node *dn, void *data)
637 return NULL; 634 return NULL;
638 635
639 /* There is nothing to check on PCI to ISA bridges */ 636 /* There is nothing to check on PCI to ISA bridges */
640 if (dn->type && !strcmp(dn->type, "isa")) { 637 if (dn->type && !strcmp(dn->type, "isa"))
641 edev->mode |= EEH_MODE_NOCHECK;
642 return NULL; 638 return NULL;
643 }
644 edev->class_code = *class_code; 639 edev->class_code = *class_code;
645 640
646 /* Ok... see if this device supports EEH. Some do, some don't, 641 /* 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 674
680 if (enable) { 675 if (enable) {
681 eeh_subsystem_enabled = 1; 676 eeh_subsystem_enabled = 1;
682 edev->mode |= EEH_MODE_SUPPORTED;
683 677
684 eeh_add_to_parent_pe(edev); 678 eeh_add_to_parent_pe(edev);
685 679
@@ -692,9 +686,8 @@ static void *eeh_early_enable(struct device_node *dn, void *data)
692 * EEH parent, in which case we mark it as supported. 686 * EEH parent, in which case we mark it as supported.
693 */ 687 */
694 if (dn->parent && of_node_to_eeh_dev(dn->parent) && 688 if (dn->parent && of_node_to_eeh_dev(dn->parent) &&
695 (of_node_to_eeh_dev(dn->parent)->mode & EEH_MODE_SUPPORTED)) { 689 of_node_to_eeh_dev(dn->parent)->pe) {
696 /* Parent supports EEH. */ 690 /* Parent supports EEH. */
697 edev->mode |= EEH_MODE_SUPPORTED;
698 edev->config_addr = of_node_to_eeh_dev(dn->parent)->config_addr; 691 edev->config_addr = of_node_to_eeh_dev(dn->parent)->config_addr;
699 edev->pe_config_addr = of_node_to_eeh_dev(dn->parent)->pe_config_addr; 692 edev->pe_config_addr = of_node_to_eeh_dev(dn->parent)->pe_config_addr;
700 693
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index f50b717286fb..a1910579d7aa 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -192,8 +192,7 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev)
192 } 192 }
193 193
194 /* Skip any devices for which EEH is not enabled. */ 194 /* Skip any devices for which EEH is not enabled. */
195 if (!(edev->mode & EEH_MODE_SUPPORTED) || 195 if (!edev->pe) {
196 edev->mode & EEH_MODE_NOCHECK) {
197#ifdef DEBUG 196#ifdef DEBUG
198 pr_info("PCI: skip building address cache for=%s - %s\n", 197 pr_info("PCI: skip building address cache for=%s - %s\n",
199 pci_name(dev), dn->full_name); 198 pci_name(dev), dn->full_name);
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 343c807e608a..8370ce7d5931 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -93,7 +93,7 @@ static void eeh_disable_irq(struct pci_dev *dev)
93 if (!irq_has_action(dev->irq)) 93 if (!irq_has_action(dev->irq))
94 return; 94 return;
95 95
96 edev->mode |= EEH_MODE_IRQ_DISABLED; 96 edev->mode |= EEH_DEV_IRQ_DISABLED;
97 disable_irq_nosync(dev->irq); 97 disable_irq_nosync(dev->irq);
98} 98}
99 99
@@ -108,8 +108,8 @@ static void eeh_enable_irq(struct pci_dev *dev)
108{ 108{
109 struct eeh_dev *edev = pci_dev_to_eeh_dev(dev); 109 struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
110 110
111 if ((edev->mode) & EEH_MODE_IRQ_DISABLED) { 111 if ((edev->mode) & EEH_DEV_IRQ_DISABLED) {
112 edev->mode &= ~EEH_MODE_IRQ_DISABLED; 112 edev->mode &= ~EEH_DEV_IRQ_DISABLED;
113 enable_irq(dev->irq); 113 enable_irq(dev->irq);
114 } 114 }
115} 115}
diff --git a/arch/powerpc/platforms/pseries/eeh_sysfs.c b/arch/powerpc/platforms/pseries/eeh_sysfs.c
index 243b3510d70f..d37708360f2e 100644
--- a/arch/powerpc/platforms/pseries/eeh_sysfs.c
+++ b/arch/powerpc/platforms/pseries/eeh_sysfs.c
@@ -53,9 +53,6 @@ static DEVICE_ATTR(_name, S_IRUGO, eeh_show_##_name, NULL);
53EEH_SHOW_ATTR(eeh_mode, mode, "0x%x"); 53EEH_SHOW_ATTR(eeh_mode, mode, "0x%x");
54EEH_SHOW_ATTR(eeh_config_addr, config_addr, "0x%x"); 54EEH_SHOW_ATTR(eeh_config_addr, config_addr, "0x%x");
55EEH_SHOW_ATTR(eeh_pe_config_addr, pe_config_addr, "0x%x"); 55EEH_SHOW_ATTR(eeh_pe_config_addr, pe_config_addr, "0x%x");
56EEH_SHOW_ATTR(eeh_check_count, check_count, "%d" );
57EEH_SHOW_ATTR(eeh_freeze_count, freeze_count, "%d" );
58EEH_SHOW_ATTR(eeh_false_positives, false_positives, "%d" );
59 56
60void eeh_sysfs_add_device(struct pci_dev *pdev) 57void eeh_sysfs_add_device(struct pci_dev *pdev)
61{ 58{
@@ -64,9 +61,6 @@ void eeh_sysfs_add_device(struct pci_dev *pdev)
64 rc += device_create_file(&pdev->dev, &dev_attr_eeh_mode); 61 rc += device_create_file(&pdev->dev, &dev_attr_eeh_mode);
65 rc += device_create_file(&pdev->dev, &dev_attr_eeh_config_addr); 62 rc += device_create_file(&pdev->dev, &dev_attr_eeh_config_addr);
66 rc += device_create_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); 63 rc += device_create_file(&pdev->dev, &dev_attr_eeh_pe_config_addr);
67 rc += device_create_file(&pdev->dev, &dev_attr_eeh_check_count);
68 rc += device_create_file(&pdev->dev, &dev_attr_eeh_false_positives);
69 rc += device_create_file(&pdev->dev, &dev_attr_eeh_freeze_count);
70 64
71 if (rc) 65 if (rc)
72 printk(KERN_WARNING "EEH: Unable to create sysfs entries\n"); 66 printk(KERN_WARNING "EEH: Unable to create sysfs entries\n");
@@ -77,8 +71,5 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev)
77 device_remove_file(&pdev->dev, &dev_attr_eeh_mode); 71 device_remove_file(&pdev->dev, &dev_attr_eeh_mode);
78 device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr); 72 device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr);
79 device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); 73 device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr);
80 device_remove_file(&pdev->dev, &dev_attr_eeh_check_count);
81 device_remove_file(&pdev->dev, &dev_attr_eeh_false_positives);
82 device_remove_file(&pdev->dev, &dev_attr_eeh_freeze_count);
83} 74}
84 75