All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Anastasio <shawn@anastas.io>
To: Lukas Wunner <lukas@wunner.de>
Cc: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	bhelgaas@google.com, mpe@ellerman.id.au, aik@ozlabs.ru,
	benh@kernel.crashing.org, sbobroff@linux.ibm.com,
	oohall@gmail.com
Subject: Re: [PATCH 0/2] Fix IOMMU setup for hotplugged devices on pseries
Date: Thu, 5 Sep 2019 13:42:10 -0500	[thread overview]
Message-ID: <b43dada8-7fc8-2ee1-46da-273c522426a4@anastas.io> (raw)
In-Reply-To: <20190905093841.mkpvzkcrafwpo5lj@wunner.de>

On 9/5/19 4:38 AM, Lukas Wunner wrote:
> On Wed, Sep 04, 2019 at 11:22:13PM -0500, Shawn Anastasio wrote:
>> If anybody has more insight or a better way to fix this, please let me know.
> 
> Have you considered moving the invocation of pcibios_setup_device()
> to pcibios_bus_add_device()?
> 
> The latter is called from pci_bus_add_device() in drivers/pci/bus.c.
> At this point device_add() has been called, so the device exists in
> sysfs.
> 
> Basically when adding a PCI device, the order is:
> 
> * pci_device_add() populates struct pci_dev, calls device_add(),
>    binding the device to a driver is prevented
> * after pci_device_add() has been called for all discovered devices,
>    resources are allocated
> * pci_bus_add_device() is called for each device,
>    calls pcibios_bus_add_device() and binds the device to a driver

Thank you, this is exactly what I was looking for! Just tested and
this seems to work perfectly. I'll go ahead and submit a v2 that
does this instead.

Thanks again,
Shawn

WARNING: multiple messages have this Message-ID (diff)
From: Shawn Anastasio <shawn@anastas.io>
To: Lukas Wunner <lukas@wunner.de>
Cc: aik@ozlabs.ru, linux-pci@vger.kernel.org, sbobroff@linux.ibm.com,
	oohall@gmail.com, bhelgaas@google.com,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 0/2] Fix IOMMU setup for hotplugged devices on pseries
Date: Thu, 5 Sep 2019 13:42:10 -0500	[thread overview]
Message-ID: <b43dada8-7fc8-2ee1-46da-273c522426a4@anastas.io> (raw)
In-Reply-To: <20190905093841.mkpvzkcrafwpo5lj@wunner.de>

On 9/5/19 4:38 AM, Lukas Wunner wrote:
> On Wed, Sep 04, 2019 at 11:22:13PM -0500, Shawn Anastasio wrote:
>> If anybody has more insight or a better way to fix this, please let me know.
> 
> Have you considered moving the invocation of pcibios_setup_device()
> to pcibios_bus_add_device()?
> 
> The latter is called from pci_bus_add_device() in drivers/pci/bus.c.
> At this point device_add() has been called, so the device exists in
> sysfs.
> 
> Basically when adding a PCI device, the order is:
> 
> * pci_device_add() populates struct pci_dev, calls device_add(),
>    binding the device to a driver is prevented
> * after pci_device_add() has been called for all discovered devices,
>    resources are allocated
> * pci_bus_add_device() is called for each device,
>    calls pcibios_bus_add_device() and binds the device to a driver

Thank you, this is exactly what I was looking for! Just tested and
this seems to work perfectly. I'll go ahead and submit a v2 that
does this instead.

Thanks again,
Shawn

  reply	other threads:[~2019-09-05 18:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05  4:22 [PATCH 0/2] Fix IOMMU setup for hotplugged devices on pseries Shawn Anastasio
2019-09-05  4:22 ` Shawn Anastasio
2019-09-05  4:22 ` [PATCH 1/2] PCI: Introduce pcibios_fixup_dev() Shawn Anastasio
2019-09-05  4:22   ` Shawn Anastasio
2019-09-05  4:22 ` [PATCH 2/2] powerpc/pci: Fix IOMMU setup for hotplugged devices on pseries Shawn Anastasio
2019-09-05  4:22   ` Shawn Anastasio
2019-09-05  9:08 ` [PATCH 0/2] " Alexey Kardashevskiy
2019-09-05  9:08   ` Alexey Kardashevskiy
2019-09-05 17:59   ` Shawn Anastasio
2019-09-05 17:59     ` Shawn Anastasio
2019-09-05  9:38 ` Lukas Wunner
2019-09-05 18:42   ` Shawn Anastasio [this message]
2019-09-05 18:42     ` Shawn Anastasio

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=b43dada8-7fc8-2ee1-46da-273c522426a4@anastas.io \
    --to=shawn@anastas.io \
    --cc=aik@ozlabs.ru \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lukas@wunner.de \
    --cc=mpe@ellerman.id.au \
    --cc=oohall@gmail.com \
    --cc=sbobroff@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.