linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Oliver O'Halloran <oohall@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: alistair@popple.id.au, s.miroshnichenko@yadro.com
Subject: Re: [Very RFC 09/46] powerpc/eeh: Pass eeh_dev to eeh_ops->{read|write}_config()
Date: Fri, 22 Nov 2019 15:52:42 +1100	[thread overview]
Message-ID: <313d8523-d03c-36db-f536-006b0e1b4896@ozlabs.ru> (raw)
In-Reply-To: <20191120012859.23300-10-oohall@gmail.com>



On 20/11/2019 12:28, Oliver O'Halloran wrote:
> Switch the eeh_ops->{read|write}_config methods to take an eeh_dev structure
> rather than a pci_dn structure to specify the target device. This removes a
> lot of the uses of pci_dn in both the EEH core and in the platform EEH
> support.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>



Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>


09/46, 10/46 and 11/46 can be actually merged into one patch. Oh, well,
may half of 11/46 without s/pdn->phb/edev->controller/.



> ---
>  arch/powerpc/include/asm/eeh.h               |  4 +-
>  arch/powerpc/kernel/eeh.c                    | 22 +++++-----
>  arch/powerpc/kernel/eeh_pe.c                 | 44 ++++++++++----------
>  arch/powerpc/platforms/powernv/eeh-powernv.c | 43 ++++++++++---------
>  arch/powerpc/platforms/pseries/eeh_pseries.c | 16 ++++---
>  5 files changed, 67 insertions(+), 62 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
> index e11deb284631..62c4ee44ad2c 100644
> --- a/arch/powerpc/include/asm/eeh.h
> +++ b/arch/powerpc/include/asm/eeh.h
> @@ -224,8 +224,8 @@ struct eeh_ops {
>  	int (*configure_bridge)(struct eeh_pe *pe);
>  	int (*err_inject)(struct eeh_pe *pe, int type, int func,
>  			  unsigned long addr, unsigned long mask);
> -	int (*read_config)(struct pci_dn *pdn, int where, int size, u32 *val);
> -	int (*write_config)(struct pci_dn *pdn, int where, int size, u32 val);
> +	int (*read_config)(struct eeh_dev *edev, int where, int size, u32 *val);
> +	int (*write_config)(struct eeh_dev *edev, int where, int size, u32 val);
>  	int (*next_error)(struct eeh_pe **pe);
>  	int (*restore_config)(struct pci_dn *pdn);
>  	int (*notify_resume)(struct pci_dn *pdn);
> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
> index a3b93db972fc..7258fa04176d 100644
> --- a/arch/powerpc/kernel/eeh.c
> +++ b/arch/powerpc/kernel/eeh.c
> @@ -185,21 +185,21 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len)
>  		pdn->phb->global_number, pdn->busno,
>  		PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
>  
> -	eeh_ops->read_config(pdn, PCI_VENDOR_ID, 4, &cfg);
> +	eeh_ops->read_config(edev, PCI_VENDOR_ID, 4, &cfg);
>  	n += scnprintf(buf+n, len-n, "dev/vend:%08x\n", cfg);
>  	pr_warn("EEH: PCI device/vendor: %08x\n", cfg);
>  
> -	eeh_ops->read_config(pdn, PCI_COMMAND, 4, &cfg);
> +	eeh_ops->read_config(edev, PCI_COMMAND, 4, &cfg);
>  	n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg);
>  	pr_warn("EEH: PCI cmd/status register: %08x\n", cfg);
>  
>  	/* Gather bridge-specific registers */
>  	if (edev->mode & EEH_DEV_BRIDGE) {
> -		eeh_ops->read_config(pdn, PCI_SEC_STATUS, 2, &cfg);
> +		eeh_ops->read_config(edev, PCI_SEC_STATUS, 2, &cfg);
>  		n += scnprintf(buf+n, len-n, "sec stat:%x\n", cfg);
>  		pr_warn("EEH: Bridge secondary status: %04x\n", cfg);
>  
> -		eeh_ops->read_config(pdn, PCI_BRIDGE_CONTROL, 2, &cfg);
> +		eeh_ops->read_config(edev, PCI_BRIDGE_CONTROL, 2, &cfg);
>  		n += scnprintf(buf+n, len-n, "brdg ctl:%x\n", cfg);
>  		pr_warn("EEH: Bridge control: %04x\n", cfg);
>  	}
> @@ -207,11 +207,11 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len)
>  	/* Dump out the PCI-X command and status regs */
>  	cap = edev->pcix_cap;
>  	if (cap) {
> -		eeh_ops->read_config(pdn, cap, 4, &cfg);
> +		eeh_ops->read_config(edev, cap, 4, &cfg);
>  		n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg);
>  		pr_warn("EEH: PCI-X cmd: %08x\n", cfg);
>  
> -		eeh_ops->read_config(pdn, cap+4, 4, &cfg);
> +		eeh_ops->read_config(edev, cap+4, 4, &cfg);
>  		n += scnprintf(buf+n, len-n, "pcix-stat:%x\n", cfg);
>  		pr_warn("EEH: PCI-X status: %08x\n", cfg);
>  	}
> @@ -223,7 +223,7 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len)
>  		pr_warn("EEH: PCI-E capabilities and status follow:\n");
>  
>  		for (i=0; i<=8; i++) {
> -			eeh_ops->read_config(pdn, cap+4*i, 4, &cfg);
> +			eeh_ops->read_config(edev, cap+4*i, 4, &cfg);
>  			n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
>  
>  			if ((i % 4) == 0) {
> @@ -250,7 +250,7 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len)
>  		pr_warn("EEH: PCI-E AER capability register set follows:\n");
>  
>  		for (i=0; i<=13; i++) {
> -			eeh_ops->read_config(pdn, cap+4*i, 4, &cfg);
> +			eeh_ops->read_config(edev, cap+4*i, 4, &cfg);
>  			n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
>  
>  			if ((i % 4) == 0) {
> @@ -918,15 +918,13 @@ int eeh_pe_reset_full(struct eeh_pe *pe, bool include_passed)
>   */
>  void eeh_save_bars(struct eeh_dev *edev)
>  {
> -	struct pci_dn *pdn;
>  	int i;
>  
> -	pdn = eeh_dev_to_pdn(edev);
> -	if (!pdn)
> +	if (!edev)
>  		return;
>  
>  	for (i = 0; i < 16; i++)
> -		eeh_ops->read_config(pdn, i * 4, 4, &edev->config_space[i]);
> +		eeh_ops->read_config(edev, i * 4, 4, &edev->config_space[i]);
>  
>  	/*
>  	 * For PCI bridges including root port, we need enable bus
> diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
> index 177852e39a25..e11e0830f125 100644
> --- a/arch/powerpc/kernel/eeh_pe.c
> +++ b/arch/powerpc/kernel/eeh_pe.c
> @@ -714,32 +714,32 @@ static void eeh_bridge_check_link(struct eeh_dev *edev)
>  
>  	/* Check slot status */
>  	cap = edev->pcie_cap;
> -	eeh_ops->read_config(pdn, cap + PCI_EXP_SLTSTA, 2, &val);
> +	eeh_ops->read_config(edev, cap + PCI_EXP_SLTSTA, 2, &val);
>  	if (!(val & PCI_EXP_SLTSTA_PDS)) {
>  		eeh_edev_dbg(edev, "No card in the slot (0x%04x) !\n", val);
>  		return;
>  	}
>  
>  	/* Check power status if we have the capability */
> -	eeh_ops->read_config(pdn, cap + PCI_EXP_SLTCAP, 2, &val);
> +	eeh_ops->read_config(edev, cap + PCI_EXP_SLTCAP, 2, &val);
>  	if (val & PCI_EXP_SLTCAP_PCP) {
> -		eeh_ops->read_config(pdn, cap + PCI_EXP_SLTCTL, 2, &val);
> +		eeh_ops->read_config(edev, cap + PCI_EXP_SLTCTL, 2, &val);
>  		if (val & PCI_EXP_SLTCTL_PCC) {
>  			eeh_edev_dbg(edev, "In power-off state, power it on ...\n");
>  			val &= ~(PCI_EXP_SLTCTL_PCC | PCI_EXP_SLTCTL_PIC);
>  			val |= (0x0100 & PCI_EXP_SLTCTL_PIC);
> -			eeh_ops->write_config(pdn, cap + PCI_EXP_SLTCTL, 2, val);
> +			eeh_ops->write_config(edev, cap + PCI_EXP_SLTCTL, 2, val);
>  			msleep(2 * 1000);
>  		}
>  	}
>  
>  	/* Enable link */
> -	eeh_ops->read_config(pdn, cap + PCI_EXP_LNKCTL, 2, &val);
> +	eeh_ops->read_config(edev, cap + PCI_EXP_LNKCTL, 2, &val);
>  	val &= ~PCI_EXP_LNKCTL_LD;
> -	eeh_ops->write_config(pdn, cap + PCI_EXP_LNKCTL, 2, val);
> +	eeh_ops->write_config(edev, cap + PCI_EXP_LNKCTL, 2, val);
>  
>  	/* Check link */
> -	eeh_ops->read_config(pdn, cap + PCI_EXP_LNKCAP, 4, &val);
> +	eeh_ops->read_config(edev, cap + PCI_EXP_LNKCAP, 4, &val);
>  	if (!(val & PCI_EXP_LNKCAP_DLLLARC)) {
>  		eeh_edev_dbg(edev, "No link reporting capability (0x%08x) \n", val);
>  		msleep(1000);
> @@ -752,7 +752,7 @@ static void eeh_bridge_check_link(struct eeh_dev *edev)
>  		msleep(20);
>  		timeout += 20;
>  
> -		eeh_ops->read_config(pdn, cap + PCI_EXP_LNKSTA, 2, &val);
> +		eeh_ops->read_config(edev, cap + PCI_EXP_LNKSTA, 2, &val);
>  		if (val & PCI_EXP_LNKSTA_DLLLA)
>  			break;
>  	}
> @@ -769,7 +769,6 @@ static void eeh_bridge_check_link(struct eeh_dev *edev)
>  
>  static void eeh_restore_bridge_bars(struct eeh_dev *edev)
>  {
> -	struct pci_dn *pdn = eeh_dev_to_pdn(edev);
>  	int i;
>  
>  	/*
> @@ -777,20 +776,20 @@ static void eeh_restore_bridge_bars(struct eeh_dev *edev)
>  	 * Bus numbers and windows: 0x18 - 0x30
>  	 */
>  	for (i = 4; i < 13; i++)
> -		eeh_ops->write_config(pdn, i*4, 4, edev->config_space[i]);
> +		eeh_ops->write_config(edev, i*4, 4, edev->config_space[i]);
>  	/* Rom: 0x38 */
> -	eeh_ops->write_config(pdn, 14*4, 4, edev->config_space[14]);
> +	eeh_ops->write_config(edev, 14*4, 4, edev->config_space[14]);
>  
>  	/* Cache line & Latency timer: 0xC 0xD */
> -	eeh_ops->write_config(pdn, PCI_CACHE_LINE_SIZE, 1,
> +	eeh_ops->write_config(edev, PCI_CACHE_LINE_SIZE, 1,
>                  SAVED_BYTE(PCI_CACHE_LINE_SIZE));
> -        eeh_ops->write_config(pdn, PCI_LATENCY_TIMER, 1,
> +        eeh_ops->write_config(edev, PCI_LATENCY_TIMER, 1,
>                  SAVED_BYTE(PCI_LATENCY_TIMER));
>  	/* Max latency, min grant, interrupt ping and line: 0x3C */
> -	eeh_ops->write_config(pdn, 15*4, 4, edev->config_space[15]);
> +	eeh_ops->write_config(edev, 15*4, 4, edev->config_space[15]);
>  
>  	/* PCI Command: 0x4 */
> -	eeh_ops->write_config(pdn, PCI_COMMAND, 4, edev->config_space[1] |
> +	eeh_ops->write_config(edev, PCI_COMMAND, 4, edev->config_space[1] |
>  			      PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
>  
>  	/* Check the PCIe link is ready */
> @@ -799,28 +798,27 @@ static void eeh_restore_bridge_bars(struct eeh_dev *edev)
>  
>  static void eeh_restore_device_bars(struct eeh_dev *edev)
>  {
> -	struct pci_dn *pdn = eeh_dev_to_pdn(edev);
>  	int i;
>  	u32 cmd;
>  
>  	for (i = 4; i < 10; i++)
> -		eeh_ops->write_config(pdn, i*4, 4, edev->config_space[i]);
> +		eeh_ops->write_config(edev, i*4, 4, edev->config_space[i]);
>  	/* 12 == Expansion ROM Address */
> -	eeh_ops->write_config(pdn, 12*4, 4, edev->config_space[12]);
> +	eeh_ops->write_config(edev, 12*4, 4, edev->config_space[12]);
>  
> -	eeh_ops->write_config(pdn, PCI_CACHE_LINE_SIZE, 1,
> +	eeh_ops->write_config(edev, PCI_CACHE_LINE_SIZE, 1,
>  		SAVED_BYTE(PCI_CACHE_LINE_SIZE));
> -	eeh_ops->write_config(pdn, PCI_LATENCY_TIMER, 1,
> +	eeh_ops->write_config(edev, PCI_LATENCY_TIMER, 1,
>  		SAVED_BYTE(PCI_LATENCY_TIMER));
>  
>  	/* max latency, min grant, interrupt pin and line */
> -	eeh_ops->write_config(pdn, 15*4, 4, edev->config_space[15]);
> +	eeh_ops->write_config(edev, 15*4, 4, edev->config_space[15]);
>  
>  	/*
>  	 * Restore PERR & SERR bits, some devices require it,
>  	 * don't touch the other command bits
>  	 */
> -	eeh_ops->read_config(pdn, PCI_COMMAND, 4, &cmd);
> +	eeh_ops->read_config(edev, PCI_COMMAND, 4, &cmd);
>  	if (edev->config_space[1] & PCI_COMMAND_PARITY)
>  		cmd |= PCI_COMMAND_PARITY;
>  	else
> @@ -829,7 +827,7 @@ static void eeh_restore_device_bars(struct eeh_dev *edev)
>  		cmd |= PCI_COMMAND_SERR;
>  	else
>  		cmd &= ~PCI_COMMAND_SERR;
> -	eeh_ops->write_config(pdn, PCI_COMMAND, 4, cmd);
> +	eeh_ops->write_config(edev, PCI_COMMAND, 4, cmd);
>  }
>  
>  /**
> diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
> index b2ac4130fda7..54d8ec77aef2 100644
> --- a/arch/powerpc/platforms/powernv/eeh-powernv.c
> +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
> @@ -858,32 +858,32 @@ static int __pnv_eeh_bridge_reset(struct pci_dev *dev, int option)
>  	case EEH_RESET_HOT:
>  		/* Don't report linkDown event */
>  		if (aer) {
> -			eeh_ops->read_config(pdn, aer + PCI_ERR_UNCOR_MASK,
> +			eeh_ops->read_config(edev, aer + PCI_ERR_UNCOR_MASK,
>  					     4, &ctrl);
>  			ctrl |= PCI_ERR_UNC_SURPDN;
> -			eeh_ops->write_config(pdn, aer + PCI_ERR_UNCOR_MASK,
> +			eeh_ops->write_config(edev, aer + PCI_ERR_UNCOR_MASK,
>  					      4, ctrl);
>  		}
>  
> -		eeh_ops->read_config(pdn, PCI_BRIDGE_CONTROL, 2, &ctrl);
> +		eeh_ops->read_config(edev, PCI_BRIDGE_CONTROL, 2, &ctrl);
>  		ctrl |= PCI_BRIDGE_CTL_BUS_RESET;
> -		eeh_ops->write_config(pdn, PCI_BRIDGE_CONTROL, 2, ctrl);
> +		eeh_ops->write_config(edev, PCI_BRIDGE_CONTROL, 2, ctrl);
>  
>  		msleep(EEH_PE_RST_HOLD_TIME);
>  		break;
>  	case EEH_RESET_DEACTIVATE:
> -		eeh_ops->read_config(pdn, PCI_BRIDGE_CONTROL, 2, &ctrl);
> +		eeh_ops->read_config(edev, PCI_BRIDGE_CONTROL, 2, &ctrl);
>  		ctrl &= ~PCI_BRIDGE_CTL_BUS_RESET;
> -		eeh_ops->write_config(pdn, PCI_BRIDGE_CONTROL, 2, ctrl);
> +		eeh_ops->write_config(edev, PCI_BRIDGE_CONTROL, 2, ctrl);
>  
>  		msleep(EEH_PE_RST_SETTLE_TIME);
>  
>  		/* Continue reporting linkDown event */
>  		if (aer) {
> -			eeh_ops->read_config(pdn, aer + PCI_ERR_UNCOR_MASK,
> +			eeh_ops->read_config(edev, aer + PCI_ERR_UNCOR_MASK,
>  					     4, &ctrl);
>  			ctrl &= ~PCI_ERR_UNC_SURPDN;
> -			eeh_ops->write_config(pdn, aer + PCI_ERR_UNCOR_MASK,
> +			eeh_ops->write_config(edev, aer + PCI_ERR_UNCOR_MASK,
>  					      4, ctrl);
>  		}
>  
> @@ -952,11 +952,12 @@ void pnv_pci_reset_secondary_bus(struct pci_dev *dev)
>  static void pnv_eeh_wait_for_pending(struct pci_dn *pdn, const char *type,
>  				     int pos, u16 mask)
>  {
> +	struct eeh_dev *edev = pdn->edev;
>  	int i, status = 0;
>  
>  	/* Wait for Transaction Pending bit to be cleared */
>  	for (i = 0; i < 4; i++) {
> -		eeh_ops->read_config(pdn, pos, 2, &status);
> +		eeh_ops->read_config(edev, pos, 2, &status);
>  		if (!(status & mask))
>  			return;
>  
> @@ -977,7 +978,7 @@ static int pnv_eeh_do_flr(struct pci_dn *pdn, int option)
>  	if (WARN_ON(!edev->pcie_cap))
>  		return -ENOTTY;
>  
> -	eeh_ops->read_config(pdn, edev->pcie_cap + PCI_EXP_DEVCAP, 4, &reg);
> +	eeh_ops->read_config(edev, edev->pcie_cap + PCI_EXP_DEVCAP, 4, &reg);
>  	if (!(reg & PCI_EXP_DEVCAP_FLR))
>  		return -ENOTTY;
>  
> @@ -987,18 +988,18 @@ static int pnv_eeh_do_flr(struct pci_dn *pdn, int option)
>  		pnv_eeh_wait_for_pending(pdn, "",
>  					 edev->pcie_cap + PCI_EXP_DEVSTA,
>  					 PCI_EXP_DEVSTA_TRPND);
> -		eeh_ops->read_config(pdn, edev->pcie_cap + PCI_EXP_DEVCTL,
> +		eeh_ops->read_config(edev, edev->pcie_cap + PCI_EXP_DEVCTL,
>  				     4, &reg);
>  		reg |= PCI_EXP_DEVCTL_BCR_FLR;
> -		eeh_ops->write_config(pdn, edev->pcie_cap + PCI_EXP_DEVCTL,
> +		eeh_ops->write_config(edev, edev->pcie_cap + PCI_EXP_DEVCTL,
>  				      4, reg);
>  		msleep(EEH_PE_RST_HOLD_TIME);
>  		break;
>  	case EEH_RESET_DEACTIVATE:
> -		eeh_ops->read_config(pdn, edev->pcie_cap + PCI_EXP_DEVCTL,
> +		eeh_ops->read_config(edev, edev->pcie_cap + PCI_EXP_DEVCTL,
>  				     4, &reg);
>  		reg &= ~PCI_EXP_DEVCTL_BCR_FLR;
> -		eeh_ops->write_config(pdn, edev->pcie_cap + PCI_EXP_DEVCTL,
> +		eeh_ops->write_config(edev, edev->pcie_cap + PCI_EXP_DEVCTL,
>  				      4, reg);
>  		msleep(EEH_PE_RST_SETTLE_TIME);
>  		break;
> @@ -1015,7 +1016,7 @@ static int pnv_eeh_do_af_flr(struct pci_dn *pdn, int option)
>  	if (WARN_ON(!edev->af_cap))
>  		return -ENOTTY;
>  
> -	eeh_ops->read_config(pdn, edev->af_cap + PCI_AF_CAP, 1, &cap);
> +	eeh_ops->read_config(edev, edev->af_cap + PCI_AF_CAP, 1, &cap);
>  	if (!(cap & PCI_AF_CAP_TP) || !(cap & PCI_AF_CAP_FLR))
>  		return -ENOTTY;
>  
> @@ -1030,12 +1031,12 @@ static int pnv_eeh_do_af_flr(struct pci_dn *pdn, int option)
>  		pnv_eeh_wait_for_pending(pdn, "AF",
>  					 edev->af_cap + PCI_AF_CTRL,
>  					 PCI_AF_STATUS_TP << 8);
> -		eeh_ops->write_config(pdn, edev->af_cap + PCI_AF_CTRL,
> +		eeh_ops->write_config(edev, edev->af_cap + PCI_AF_CTRL,
>  				      1, PCI_AF_CTRL_FLR);
>  		msleep(EEH_PE_RST_HOLD_TIME);
>  		break;
>  	case EEH_RESET_DEACTIVATE:
> -		eeh_ops->write_config(pdn, edev->af_cap + PCI_AF_CTRL, 1, 0);
> +		eeh_ops->write_config(edev, edev->af_cap + PCI_AF_CTRL, 1, 0);
>  		msleep(EEH_PE_RST_SETTLE_TIME);
>  		break;
>  	}
> @@ -1269,9 +1270,11 @@ static inline bool pnv_eeh_cfg_blocked(struct pci_dn *pdn)
>  	return false;
>  }
>  
> -static int pnv_eeh_read_config(struct pci_dn *pdn,
> +static int pnv_eeh_read_config(struct eeh_dev *edev,
>  			       int where, int size, u32 *val)
>  {
> +	struct pci_dn *pdn = eeh_dev_to_pdn(edev);
> +
>  	if (!pdn)
>  		return PCIBIOS_DEVICE_NOT_FOUND;
>  
> @@ -1283,9 +1286,11 @@ static int pnv_eeh_read_config(struct pci_dn *pdn,
>  	return pnv_pci_cfg_read(pdn, where, size, val);
>  }
>  
> -static int pnv_eeh_write_config(struct pci_dn *pdn,
> +static int pnv_eeh_write_config(struct eeh_dev *edev,
>  				int where, int size, u32 val)
>  {
> +	struct pci_dn *pdn = eeh_dev_to_pdn(edev);
> +
>  	if (!pdn)
>  		return PCIBIOS_DEVICE_NOT_FOUND;
>  
> diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
> index fa704d7052ec..6f911a048339 100644
> --- a/arch/powerpc/platforms/pseries/eeh_pseries.c
> +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
> @@ -631,29 +631,33 @@ static int pseries_eeh_configure_bridge(struct eeh_pe *pe)
>  
>  /**
>   * pseries_eeh_read_config - Read PCI config space
> - * @pdn: PCI device node
> - * @where: PCI address
> + * @edev: EEH device handle
> + * @where: PCI config space offset
>   * @size: size to read
>   * @val: return value
>   *
>   * Read config space from the speicifed device
>   */
> -static int pseries_eeh_read_config(struct pci_dn *pdn, int where, int size, u32 *val)
> +static int pseries_eeh_read_config(struct eeh_dev *edev, int where, int size, u32 *val)
>  {
> +	struct pci_dn *pdn = eeh_dev_to_pdn(edev);
> +
>  	return rtas_read_config(pdn, where, size, val);
>  }
>  
>  /**
>   * pseries_eeh_write_config - Write PCI config space
> - * @pdn: PCI device node
> - * @where: PCI address
> + * @edev: EEH device handle
> + * @where: PCI config space offset
>   * @size: size to write
>   * @val: value to be written
>   *
>   * Write config space to the specified device
>   */
> -static int pseries_eeh_write_config(struct pci_dn *pdn, int where, int size, u32 val)
> +static int pseries_eeh_write_config(struct eeh_dev *edev, int where, int size, u32 val)
>  {
> +	struct pci_dn *pdn = eeh_dev_to_pdn(edev);
> +
>  	return rtas_write_config(pdn, where, size, val);
>  }
>  
> 

-- 
Alexey

  reply	other threads:[~2019-11-22  4:54 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20  1:28 PCIPOCALYPSE Oliver O'Halloran
2019-11-20  1:28 ` [Very RFC 01/46] powerpc/eeh: Don't attempt to restore VF config space after reset Oliver O'Halloran
2019-11-21  3:38   ` Alexey Kardashevskiy
2019-11-21  4:34     ` Oliver O'Halloran
2019-11-20  1:28 ` [Very RFC 02/46] powernv/pci: Add helper to find ioda_pe from BDFN Oliver O'Halloran
2019-11-20  1:28 ` [Very RFC 03/46] powernv/pci: Remove dma_dev_setup() for NPU PHBs Oliver O'Halloran
2019-11-21  3:57   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 04/46] powernv/pci: Move dma_{dev|bus}_setup into pci-ioda.c Oliver O'Halloran
2019-11-21  4:02   ` Alexey Kardashevskiy
2019-11-21  4:33     ` Oliver O'Halloran
2019-11-21  7:46   ` Christoph Hellwig
2019-11-20  1:28 ` [Very RFC 05/46] powernv/pci: Remove the pnv_phb dma_dev_setup callback Oliver O'Halloran
2019-11-21  4:03   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 06/46] powerpc/iov: Move VF pdev fixup into pcibios_fixup_iov() Oliver O'Halloran
2019-11-21  4:34   ` Alexey Kardashevskiy
2019-11-25  4:41     ` Oliver O'Halloran
2019-11-21  7:48   ` Christoph Hellwig
2019-11-25  4:39     ` Oliver O'Halloran
2019-11-20  1:28 ` [Very RFC 07/46] powernv/pci: Rework IODA PE device accounting Oliver O'Halloran
2019-11-21  5:48   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 08/46] powerpc/eeh: Calculate VF index rather than looking it up in pci_dn Oliver O'Halloran
2019-11-22  4:43   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 09/46] powerpc/eeh: Pass eeh_dev to eeh_ops->{read|write}_config() Oliver O'Halloran
2019-11-22  4:52   ` Alexey Kardashevskiy [this message]
2019-11-20  1:28 ` [Very RFC 10/46] powerpc/eeh: Pass eeh_dev to eeh_ops->restore_config() Oliver O'Halloran
2019-11-20  1:28 ` [Very RFC 11/46] powerpc/eeh: Convert various printfs to use edev, not pci_dn Oliver O'Halloran
2019-11-22  4:55   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 12/46] powerpc/eeh: Split eeh_probe into probe_pdn and probe_pdev Oliver O'Halloran
2019-11-22  5:45   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 13/46] powerpc/eeh: Rework how pdev_probe() is used Oliver O'Halloran
2019-11-20  1:28 ` [Very RFC 14/46] powernv/eeh: Remove un-necessary call to eeh_add_device_early() Oliver O'Halloran
2019-11-22  6:01   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 15/46] powernv/eeh: Use pnv_eeh_*_config() for internal config ops Oliver O'Halloran
2019-11-22  6:15   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 16/46] powernv/eeh: Use eeh_edev_warn() rather than open-coding a BDFN print Oliver O'Halloran
2019-11-22  6:17   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 17/46] powernv/eeh: add pnv_eeh_find_edev() Oliver O'Halloran
2019-11-25  0:30   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 18/46] powernv/pci: Add pci_bus_to_pnvhb() helper Oliver O'Halloran
2019-11-25  0:42   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 19/46] powernv/eeh: Use standard PCI capability lookup functions Oliver O'Halloran
2019-11-25  1:02   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 20/46] powernv/eeh: Look up device info from pci_dev Oliver O'Halloran
2019-11-25  1:26   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 21/46] powernv/eeh: Rework finding an existing edev in probe_pdev() Oliver O'Halloran
2019-11-25  3:20   ` Alexey Kardashevskiy
2019-11-25  4:17     ` Oliver O'Halloran
2019-11-20  1:28 ` [Very RFC 22/46] powernv/eeh: Allocate eeh_dev's when needed Oliver O'Halloran
2019-11-25  3:27   ` Alexey Kardashevskiy
2019-11-25  4:26     ` Oliver O'Halloran
2019-11-27  1:50       ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 23/46] powerpc/eeh: Moving finding the parent PE into the platform Oliver O'Halloran
2019-11-25  5:00   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 24/46] powernv/pci: Make the pre-cfg EEH freeze check use eeh_dev rather than pci_dn Oliver O'Halloran
2019-11-27  0:21   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 25/46] powernv/pci: Remove pdn from pnv_pci_config_check_eeh() Oliver O'Halloran
2019-11-27  1:05   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 26/46] powernv/pci: Remove pdn from pnv_pci_cfg_{read|write} Oliver O'Halloran
2019-11-27  2:16   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 27/46] powernv/pci: Clear reserved PE freezes Oliver O'Halloran
2019-11-27  3:00   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 28/46] powernv/iov: Move SR-IOV PF state out of pci_dn Oliver O'Halloran
2019-11-27  4:09   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 29/46] powernv/pci: Remove open-coded PE lookup in PELT-V setup Oliver O'Halloran
2019-11-27  4:26   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 30/46] powernv/pci: Remove open-coded PE lookup in PELT-V teardown Oliver O'Halloran
2019-11-27  4:50   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 31/46] powernv/pci: Remove open-coded PE lookup in pnv_pci_ioda_dma_dev_setup() Oliver O'Halloran
2019-11-21  7:52   ` Christoph Hellwig
2019-11-27  4:53   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 32/46] powernv/pci: Remove open-coded PE lookup in iommu_bypass_supported() Oliver O'Halloran
2019-11-27  5:09   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 33/46] powernv/pci: Remove open-coded PE lookup in iommu notifier Oliver O'Halloran
2019-11-27  5:09   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 34/46] powernv/pci: Remove open-coded PE lookup in pnv_pci_enable_device_hook() Oliver O'Halloran
2019-11-27  5:14   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 35/46] powernv/pci: Remove open-coded PE lookup in pnv_pci_release_device Oliver O'Halloran
2019-11-27  5:24   ` Alexey Kardashevskiy
2019-11-27  9:51     ` Oliver O'Halloran
2019-11-20  1:28 ` [Very RFC 36/46] powernv/npu: Remove open-coded PE lookup for GPU device Oliver O'Halloran
2019-11-27  5:45   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 37/46] powernv/pci: Use the PHB's rmap for pnv_ioda_to_pe() Oliver O'Halloran
2019-11-21  3:50   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 38/46] powerpc/pci-hotplug: Scan the whole bus when using PCI_PROBE_NORMAL Oliver O'Halloran
2019-11-27  6:27   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 39/46] powernv/npu: Avoid pci_dn when mapping device_node to a pci_dev Oliver O'Halloran
2019-11-27  6:58   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 40/46] powernv/npu: Don't drop refcount when looking up GPU pci_devs Oliver O'Halloran
2019-11-27  7:09   ` Alexey Kardashevskiy
2019-11-27  8:24     ` Greg Kurz
2019-11-27  9:10       ` Frederic Barrat
2019-11-27  9:33         ` Greg Kurz
2019-11-27  9:40           ` Oliver O'Halloran
2019-11-27 12:00             ` Greg Kurz
2019-11-27  9:47           ` Frederic Barrat
2019-11-27 12:03             ` Greg Kurz
2019-11-20  1:28 ` [Very RFC 41/46] powernv/eeh: Remove pdn setup for SR-IOV VFs Oliver O'Halloran
2019-11-27  7:14   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 42/46] powernv/pci: Don't clear pdn->pe_number in pnv_pci_release_device Oliver O'Halloran
2019-11-27  7:30   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 43/46] powernv/pci: Do not set pdn->pe_number for NPU/CAPI devices Oliver O'Halloran
2019-11-27 22:49   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 44/46] powerpc/pci: Don't set pdn->pe_number when applying the weird P8 NVLink PE hack Oliver O'Halloran
2019-11-27 22:54   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 45/46] powernv/pci: Remove requirement for a pdn in config accessors Oliver O'Halloran
2019-11-27 23:00   ` Alexey Kardashevskiy
2019-11-20  1:28 ` [Very RFC 46/46] HACK: prevent pdn's from being created Oliver O'Halloran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=313d8523-d03c-36db-f536-006b0e1b4896@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=alistair@popple.id.au \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=oohall@gmail.com \
    --cc=s.miroshnichenko@yadro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).