* [PATCH v2] powernv: eeh: add buffer for P7IOC hub error data
@ 2013-12-20 19:06 Brian W Hart
2013-12-23 1:33 ` Gavin Shan
0 siblings, 1 reply; 2+ messages in thread
From: Brian W Hart @ 2013-12-20 19:06 UTC (permalink / raw)
To: linuxppc-dev
V2: Replace driver-global 'hub_diag' with a per-PHB hub diag structure.
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.
Signed-off-by: Brian W Hart <hartb@linux.vnet.ibm.com>
---
arch/powerpc/platforms/powernv/eeh-ioda.c | 15 ++-------------
arch/powerpc/platforms/powernv/pci.h | 4 +++-
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 8184ef5..4790275 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -36,7 +36,6 @@
#include "powernv.h"
#include "pci.h"
-static char *hub_diag = NULL;
static int ioda_eeh_nb_init = 0;
static int ioda_eeh_event(struct notifier_block *nb,
@@ -140,15 +139,6 @@ static int ioda_eeh_post_init(struct pci_controller *hose)
ioda_eeh_nb_init = 1;
}
- /* We needn't HUB diag-data on PHB3 */
- if (phb->type == PNV_PHB_IODA1 && !hub_diag) {
- hub_diag = (char *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
- if (!hub_diag) {
- pr_err("%s: Out of memory !\n", __func__);
- return -ENOMEM;
- }
- }
-
#ifdef CONFIG_DEBUG_FS
if (phb->dbgfs) {
debugfs_create_file("err_injct_outbound", 0600,
@@ -633,11 +623,10 @@ static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data)
static void ioda_eeh_hub_diag(struct pci_controller *hose)
{
struct pnv_phb *phb = hose->private_data;
- struct OpalIoP7IOCErrorData *data;
+ struct OpalIoP7IOCErrorData *data = &phb->diag.hub_diag;
long rc;
- data = (struct OpalIoP7IOCErrorData *)ioda_eeh_hub_diag;
- rc = opal_pci_get_hub_diag_data(phb->hub_id, data, PAGE_SIZE);
+ rc = opal_pci_get_hub_diag_data(phb->hub_id, data, sizeof *data);
if (rc != OPAL_SUCCESS) {
pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n",
__func__, phb->hub_id, rc);
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 911c24e..1ed8d5f 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -172,11 +172,13 @@ struct pnv_phb {
} ioda;
};
- /* PHB status structure */
+ /* PHB and hub status structure */
union {
unsigned char blob[PNV_PCI_DIAG_BUF_SIZE];
struct OpalIoP7IOCPhbErrorData p7ioc;
+ struct OpalIoP7IOCErrorData hub_diag;
} diag;
+
};
extern struct pci_ops pnv_pci_ops;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] powernv: eeh: add buffer for P7IOC hub error data
2013-12-20 19:06 [PATCH v2] powernv: eeh: add buffer for P7IOC hub error data Brian W Hart
@ 2013-12-23 1:33 ` Gavin Shan
0 siblings, 0 replies; 2+ messages in thread
From: Gavin Shan @ 2013-12-23 1:33 UTC (permalink / raw)
To: linuxppc-dev
On Fri, Dec 20, 2013 at 01:06:01PM -0600, Brian W Hart wrote:
>V2: Replace driver-global 'hub_diag' with a per-PHB hub diag structure.
>
>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.
>
>Signed-off-by: Brian W Hart <hartb@linux.vnet.ibm.com>
Acked-by: Gavin Shan <shangw@linux.vnet.ibm.com>
We also need backport it to stable kernel 3.11+
>---
> arch/powerpc/platforms/powernv/eeh-ioda.c | 15 ++-------------
> arch/powerpc/platforms/powernv/pci.h | 4 +++-
> 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 8184ef5..4790275 100644
>--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
>+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
>@@ -36,7 +36,6 @@
> #include "powernv.h"
> #include "pci.h"
>
>-static char *hub_diag = NULL;
> static int ioda_eeh_nb_init = 0;
>
> static int ioda_eeh_event(struct notifier_block *nb,
>@@ -140,15 +139,6 @@ static int ioda_eeh_post_init(struct pci_controller *hose)
> ioda_eeh_nb_init = 1;
> }
>
>- /* We needn't HUB diag-data on PHB3 */
>- if (phb->type == PNV_PHB_IODA1 && !hub_diag) {
>- hub_diag = (char *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
>- if (!hub_diag) {
>- pr_err("%s: Out of memory !\n", __func__);
>- return -ENOMEM;
>- }
>- }
>-
> #ifdef CONFIG_DEBUG_FS
> if (phb->dbgfs) {
> debugfs_create_file("err_injct_outbound", 0600,
>@@ -633,11 +623,10 @@ static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data)
> static void ioda_eeh_hub_diag(struct pci_controller *hose)
> {
> struct pnv_phb *phb = hose->private_data;
>- struct OpalIoP7IOCErrorData *data;
>+ struct OpalIoP7IOCErrorData *data = &phb->diag.hub_diag;
> long rc;
>
>- data = (struct OpalIoP7IOCErrorData *)ioda_eeh_hub_diag;
>- rc = opal_pci_get_hub_diag_data(phb->hub_id, data, PAGE_SIZE);
>+ rc = opal_pci_get_hub_diag_data(phb->hub_id, data, sizeof *data);
> if (rc != OPAL_SUCCESS) {
> pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n",
> __func__, phb->hub_id, rc);
>diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
>index 911c24e..1ed8d5f 100644
>--- a/arch/powerpc/platforms/powernv/pci.h
>+++ b/arch/powerpc/platforms/powernv/pci.h
>@@ -172,11 +172,13 @@ struct pnv_phb {
> } ioda;
> };
>
>- /* PHB status structure */
>+ /* PHB and hub status structure */
> union {
> unsigned char blob[PNV_PCI_DIAG_BUF_SIZE];
> struct OpalIoP7IOCPhbErrorData p7ioc;
>+ struct OpalIoP7IOCErrorData hub_diag;
> } diag;
>+
> };
>
> extern struct pci_ops pnv_pci_ops;
Thanks,
Gavin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-23 1:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 19:06 [PATCH v2] powernv: eeh: add buffer for P7IOC hub error data Brian W Hart
2013-12-23 1:33 ` Gavin Shan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).