linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sam Bobroff <sbobroff@linux.ibm.com>
To: "Oliver O'Halloran" <oohall@gmail.com>
Cc: tyreld@linux.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 3/6] powerpc/eeh: Do early EEH init only when required
Date: Thu, 6 Feb 2020 16:22:35 +1100	[thread overview]
Message-ID: <20200206052234.GF15629@osmium> (raw)
In-Reply-To: <20200203083521.16549-4-oohall@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3515 bytes --]

On Mon, Feb 03, 2020 at 07:35:18PM +1100, Oliver O'Halloran wrote:
> The pci hotplug helper (pci_hp_add_devices()) calls
> eeh_add_device_tree_early() to scan the device-tree for new PCI devices and
> do the early EEH probe before the device is scanned. This early probe is a
> no-op in a lot of cases because:
> 
> a) The early init is only required to satisfy a PAPR requirement that EEH
>    be configured before we start doing config accesses. On PowerNV it is
>    a no-op.
> 
> b) It's a no-op for devices that have already had their eeh_dev
>    initialised.
> 
> There are four callers of pci_hp_add_devices():
> 
> 1. arch/powerpc/kernel/eeh_driver.c
> 	Here the hotplug helper is called when re-scanning pci_devs that
> 	were removed during an EEH recovery pass. The EEH stat for each
> 	removed device (the eeh_dev) is retained across a recovery pass
> 	so the early init is a no-op in this case.
> 
> 2. drivers/pci/hotplug/pnv_php.c
> 	This is also a no-op since the PowerNV hotplug driver is, suprisingly,
> 	PowerNV specific.
> 
> 3. drivers/pci/hotplug/rpaphp_core.c
> 4. drivers/pci/hotplug/rpaphp_pci.c
> 	In these two cases new devices have been hotplugged and FW has
> 	provided new DT nodes for each. These are the only two cases where
> 	the EEH we might have new PCI device nodes in the DT so these are
> 	the only two cases where the early EEH probe needs to be done.
> 
> We can move the calls to eeh_add_device_tree_early() to the locations where
> it's needed and remove it from the generic path. This is preparation for
> making the early EEH probe pseries specific.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Makes sense to me.
Reviewed-by: Sam Bobroff <sbobroff@linux.ibm.com>

> ---
>  arch/powerpc/kernel/pci-hotplug.c | 2 --
>  drivers/pci/hotplug/rpaphp_core.c | 2 ++
>  drivers/pci/hotplug/rpaphp_pci.c  | 4 +++-
>  3 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c
> index d6a67f8..bf83f76 100644
> --- a/arch/powerpc/kernel/pci-hotplug.c
> +++ b/arch/powerpc/kernel/pci-hotplug.c
> @@ -112,8 +112,6 @@ void pci_hp_add_devices(struct pci_bus *bus)
>  	struct pci_controller *phb;
>  	struct device_node *dn = pci_bus_to_OF_node(bus);
>  
> -	eeh_add_device_tree_early(PCI_DN(dn));
> -
>  	phb = pci_bus_to_host(bus);
>  
>  	mode = PCI_PROBE_NORMAL;
> diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
> index e408e40..9c1e43e 100644
> --- a/drivers/pci/hotplug/rpaphp_core.c
> +++ b/drivers/pci/hotplug/rpaphp_core.c
> @@ -494,6 +494,8 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
>  		return retval;
>  
>  	if (state == PRESENT) {
> +		eeh_add_device_tree_early(PCI_DN(slot->dn));
> +
>  		pci_lock_rescan_remove();
>  		pci_hp_add_devices(slot->bus);
>  		pci_unlock_rescan_remove();
> diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
> index beca61b..61ebbd8 100644
> --- a/drivers/pci/hotplug/rpaphp_pci.c
> +++ b/drivers/pci/hotplug/rpaphp_pci.c
> @@ -95,8 +95,10 @@ int rpaphp_enable_slot(struct slot *slot)
>  			return -EINVAL;
>  		}
>  
> -		if (list_empty(&bus->devices))
> +		if (list_empty(&bus->devices)) {
> +			eeh_add_device_tree_early(PCI_DN(slot->dn));
>  			pci_hp_add_devices(bus);
> +		}
>  
>  		if (!list_empty(&bus->devices)) {
>  			slot->state = CONFIGURED;
> -- 
> 2.9.5
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-02-06  5:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03  8:35 EEH init cleanup Oliver O'Halloran
2020-02-03  8:35 ` [PATCH 1/6] powerpc/eeh: Add sysfs files in late probe Oliver O'Halloran
2020-02-06  4:13   ` Sam Bobroff
2020-02-07  3:22     ` Oliver O'Halloran
2020-02-03  8:35 ` [PATCH 2/6] powerpc/eeh: Remove eeh_add_device_tree_late() Oliver O'Halloran
2020-02-06  4:23   ` Sam Bobroff
2020-02-03  8:35 ` [PATCH 3/6] powerpc/eeh: Do early EEH init only when required Oliver O'Halloran
2020-02-06  5:22   ` Sam Bobroff [this message]
2020-02-03  8:35 ` [PATCH 4/6] powerpc/eeh: Remove PHB check in probe Oliver O'Halloran
2020-02-06  5:30   ` Sam Bobroff
2020-02-03  8:35 ` [PATCH 5/6] powerpc/eeh: Make early EEH init pseries specific Oliver O'Halloran
2020-02-07  2:24   ` Sam Bobroff
2020-02-07  3:35     ` Oliver O'Halloran
2020-02-07  3:56       ` Oliver O'Halloran
2020-02-03  8:35 ` [PATCH 6/6] powerpc/eeh: Rework eeh_ops->probe() Oliver O'Halloran
2020-02-07  2:37   ` Sam Bobroff

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=20200206052234.GF15629@osmium \
    --to=sbobroff@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=oohall@gmail.com \
    --cc=tyreld@linux.ibm.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).