aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBrian W Hart <hartb@linux.vnet.ibm.com>2013-12-20 14:06:01 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-12-29 22:02:32 -0500
commitca1de5deb782e1636ed5b898e215a8840ae39230 (patch)
tree120e017d57b84e6dfc162ed927369e6bc38f6471 /arch
parent20acebdfaec3e15d8a27ab25bf4a2f91b2afa757 (diff)
powernv/eeh: Add buffer for P7IOC hub error data
Prevent ioda_eeh_hub_diag() from clobbering itself when called by supplying a per-PHB buffer for P7IOC hub diagnostic data. Take care to inform OPAL of the correct size for the buffer. [Small style change to the use of sizeof -- BenH] Signed-off-by: Brian W Hart <hartb@linux.vnet.ibm.com> Acked-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/platforms/powernv/eeh-ioda.c15
-rw-r--r--arch/powerpc/platforms/powernv/pci.h4
2 files changed, 5 insertions, 14 deletions
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 8184ef5ccb1a..d7ddcee7feb8 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -36,7 +36,6 @@
36#include "powernv.h" 36#include "powernv.h"
37#include "pci.h" 37#include "pci.h"
38 38
39static char *hub_diag = NULL;
40static int ioda_eeh_nb_init = 0; 39static int ioda_eeh_nb_init = 0;
41 40
42static int ioda_eeh_event(struct notifier_block *nb, 41static int ioda_eeh_event(struct notifier_block *nb,
@@ -140,15 +139,6 @@ static int ioda_eeh_post_init(struct pci_controller *hose)
140 ioda_eeh_nb_init = 1; 139 ioda_eeh_nb_init = 1;
141 } 140 }
142 141
143 /* We needn't HUB diag-data on PHB3 */
144 if (phb->type == PNV_PHB_IODA1 && !hub_diag) {
145 hub_diag = (char *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
146 if (!hub_diag) {
147 pr_err("%s: Out of memory !\n", __func__);
148 return -ENOMEM;
149 }
150 }
151
152#ifdef CONFIG_DEBUG_FS 142#ifdef CONFIG_DEBUG_FS
153 if (phb->dbgfs) { 143 if (phb->dbgfs) {
154 debugfs_create_file("err_injct_outbound", 0600, 144 debugfs_create_file("err_injct_outbound", 0600,
@@ -633,11 +623,10 @@ static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data)
633static void ioda_eeh_hub_diag(struct pci_controller *hose) 623static void ioda_eeh_hub_diag(struct pci_controller *hose)
634{ 624{
635 struct pnv_phb *phb = hose->private_data; 625 struct pnv_phb *phb = hose->private_data;
636 struct OpalIoP7IOCErrorData *data; 626 struct OpalIoP7IOCErrorData *data = &phb->diag.hub_diag;
637 long rc; 627 long rc;
638 628
639 data = (struct OpalIoP7IOCErrorData *)ioda_eeh_hub_diag; 629 rc = opal_pci_get_hub_diag_data(phb->hub_id, data, sizeof(*data));
640 rc = opal_pci_get_hub_diag_data(phb->hub_id, data, PAGE_SIZE);
641 if (rc != OPAL_SUCCESS) { 630 if (rc != OPAL_SUCCESS) {
642 pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n", 631 pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n",
643 __func__, phb->hub_id, rc); 632 __func__, phb->hub_id, rc);
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 911c24ef033e..1ed8d5f40f5a 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -172,11 +172,13 @@ struct pnv_phb {
172 } ioda; 172 } ioda;
173 }; 173 };
174 174
175 /* PHB status structure */ 175 /* PHB and hub status structure */
176 union { 176 union {
177 unsigned char blob[PNV_PCI_DIAG_BUF_SIZE]; 177 unsigned char blob[PNV_PCI_DIAG_BUF_SIZE];
178 struct OpalIoP7IOCPhbErrorData p7ioc; 178 struct OpalIoP7IOCPhbErrorData p7ioc;
179 struct OpalIoP7IOCErrorData hub_diag;
179 } diag; 180 } diag;
181
180}; 182};
181 183
182extern struct pci_ops pnv_pci_ops; 184extern struct pci_ops pnv_pci_ops;