From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Oliver O'Halloran <oohall@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: linux-pci@vger.kernel.org, shawn@anastas.io
Subject: Re: [PATCH 2/3] powerpc/pci: Fix pcibios_setup_device() ordering
Date: Tue, 1 Oct 2019 15:39:56 +1000 [thread overview]
Message-ID: <f657eeb4-a1d1-a68e-c656-9b1bc2f1fef3@ozlabs.ru> (raw)
In-Reply-To: <20190930020848.25767-3-oohall@gmail.com>
On 30/09/2019 12:08, Oliver O'Halloran wrote:
> From: Shawn Anastasio <shawn@anastas.io>
>
> Move PCI device setup from pcibios_add_device() and pcibios_fixup_bus() to
> pcibios_bus_add_device(). This ensures that platform-specific DMA and IOMMU
> setup occurs after the device has been registered in sysfs, which is a
> requirement for IOMMU group assignment to work
>
> This fixes IOMMU group assignment for hotplugged devices on pseries, where
> the existing behavior results in IOMMU assignment before registration.
>
> Thanks to Lukas Wunner <lukas@wunner.de> for the suggestion.
>
> Signed-off-by: Shawn Anastasio <shawn@anastas.io>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> arch/powerpc/kernel/pci-common.c | 25 +++++++++----------------
> 1 file changed, 9 insertions(+), 16 deletions(-)
>
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index 1c448cf..b89925ed 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -261,12 +261,6 @@ int pcibios_sriov_disable(struct pci_dev *pdev)
>
> #endif /* CONFIG_PCI_IOV */
>
> -void pcibios_bus_add_device(struct pci_dev *pdev)
> -{
> - if (ppc_md.pcibios_bus_add_device)
> - ppc_md.pcibios_bus_add_device(pdev);
> -}
> -
> static resource_size_t pcibios_io_size(const struct pci_controller *hose)
> {
> #ifdef CONFIG_PPC64
> @@ -987,15 +981,17 @@ static void pcibios_setup_device(struct pci_dev *dev)
> ppc_md.pci_irq_fixup(dev);
> }
>
> -int pcibios_add_device(struct pci_dev *dev)
> +void pcibios_bus_add_device(struct pci_dev *pdev)
> {
> - /*
> - * We can only call pcibios_setup_device() after bus setup is complete,
> - * since some of the platform specific DMA setup code depends on it.
> - */
> - if (dev->bus->is_added)
> - pcibios_setup_device(dev);
> + /* Perform platform-specific device setup */
> + pcibios_setup_device(pdev);
> +
> + if (ppc_md.pcibios_bus_add_device)
> + ppc_md.pcibios_bus_add_device(pdev);
> +}
>
> +int pcibios_add_device(struct pci_dev *dev)
> +{
> #ifdef CONFIG_PCI_IOV
> if (ppc_md.pcibios_fixup_sriov)
> ppc_md.pcibios_fixup_sriov(dev);
> @@ -1037,9 +1033,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
>
> /* Now fixup the bus bus */
> pcibios_setup_bus_self(bus);
> -
> - /* Now fixup devices on that bus */
> - pcibios_setup_bus_devices(bus);
> }
> EXPORT_SYMBOL(pcibios_fixup_bus);
>
>
--
Alexey
next prev parent reply other threads:[~2019-10-01 5:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-30 2:08 IOMMU group creation for pseries hotplug, and powernv VFs Oliver O'Halloran
2019-09-30 2:08 ` [PATCH 1/3] powernv/iov: Ensure the pdn for VFs always contains a valid PE number Oliver O'Halloran
2019-09-30 17:09 ` Bjorn Helgaas
2019-10-01 1:33 ` Oliver O'Halloran
2019-10-11 8:27 ` Michael Ellerman
2019-10-01 5:39 ` Alexey Kardashevskiy
2019-09-30 2:08 ` [PATCH 2/3] powerpc/pci: Fix pcibios_setup_device() ordering Oliver O'Halloran
2019-10-01 5:39 ` Alexey Kardashevskiy [this message]
2019-09-30 2:08 ` [PATCH 3/3] powerpc/pci: Remove pcibios_setup_bus_devices() Oliver O'Halloran
2019-10-01 5:40 ` Alexey Kardashevskiy
2019-10-01 7:39 ` IOMMU group creation for pseries hotplug, and powernv VFs 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=f657eeb4-a1d1-a68e-c656-9b1bc2f1fef3@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=oohall@gmail.com \
--cc=shawn@anastas.io \
/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).