Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca1de5de authored by Brian W Hart's avatar Brian W Hart Committed by Benjamin Herrenschmidt
Browse files

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: default avatarBrian W Hart <hartb@linux.vnet.ibm.com>
Acked-by: default avatarGavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 20acebdf
Loading
Loading
Loading
Loading
+2 −13
Original line number Original line Diff line number Diff line
@@ -36,7 +36,6 @@
#include "powernv.h"
#include "powernv.h"
#include "pci.h"
#include "pci.h"


static char *hub_diag = NULL;
static int ioda_eeh_nb_init = 0;
static int ioda_eeh_nb_init = 0;


static int ioda_eeh_event(struct notifier_block *nb,
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;
		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
#ifdef CONFIG_DEBUG_FS
	if (phb->dbgfs) {
	if (phb->dbgfs) {
		debugfs_create_file("err_injct_outbound", 0600,
		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)
static void ioda_eeh_hub_diag(struct pci_controller *hose)
{
{
	struct pnv_phb *phb = hose->private_data;
	struct pnv_phb *phb = hose->private_data;
	struct OpalIoP7IOCErrorData *data;
	struct OpalIoP7IOCErrorData *data = &phb->diag.hub_diag;
	long rc;
	long rc;


	data = (struct OpalIoP7IOCErrorData *)ioda_eeh_hub_diag;
	rc = opal_pci_get_hub_diag_data(phb->hub_id, data, sizeof(*data));
	rc = opal_pci_get_hub_diag_data(phb->hub_id, data, PAGE_SIZE);
	if (rc != OPAL_SUCCESS) {
	if (rc != OPAL_SUCCESS) {
		pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n",
		pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n",
			   __func__, phb->hub_id, rc);
			   __func__, phb->hub_id, rc);
+3 −1
Original line number Original line Diff line number Diff line
@@ -172,11 +172,13 @@ struct pnv_phb {
		} ioda;
		} ioda;
	};
	};


	/* PHB status structure */
	/* PHB and hub status structure */
	union {
	union {
		unsigned char			blob[PNV_PCI_DIAG_BUF_SIZE];
		unsigned char			blob[PNV_PCI_DIAG_BUF_SIZE];
		struct OpalIoP7IOCPhbErrorData	p7ioc;
		struct OpalIoP7IOCPhbErrorData	p7ioc;
		struct OpalIoP7IOCErrorData 	hub_diag;
	} diag;
	} diag;

};
};


extern struct pci_ops pnv_pci_ops;
extern struct pci_ops pnv_pci_ops;