* [PATCH kernel] powerpc/powernv/sriov: Register IOMMU groups for VFs
@ 2019-02-18 5:58 Alexey Kardashevskiy
2019-02-18 6:43 ` Alexey Kardashevskiy
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2019-02-18 5:58 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Alexey Kardashevskiy, kvm-ppc, David Gibson
The compound IOMMU group rework moved iommu_register_group() together in
pnv_pci_ioda_setup_iommu_api() (which is a part of ppc_md.pcibios_fixup).
As the result, pnv_ioda_setup_bus_iommu_group() does not create groups
any more, it only adds devices to groups.
This works fine for boot time devices. However IOMMU groups for SRIOV's
VFs were added by pnv_ioda_setup_bus_iommu_group() so this got broken:
pnv_tce_iommu_bus_notifier() expects a group to be registered for VF
and it is not.
This adds missing group registration and adds a NULL pointer check into
the bus notifier so we won't stop in xmon if there is no group, although
it is not expected to happen now.
Fixes: 0bd971676e68 "powerpc/powernv/npu: Add compound IOMMU groups"
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Fixes https://bugzilla.linux.ibm.com/show_bug.cgi?id=175550
"Kernel Oops while creating SRIOV VF's."
---
arch/powerpc/platforms/powernv/pci-ioda.c | 2 ++
arch/powerpc/platforms/powernv/pci.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 7db3119..145373f 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1593,6 +1593,8 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs)
pnv_pci_ioda2_setup_dma_pe(phb, pe);
#ifdef CONFIG_IOMMU_API
+ iommu_register_group(&pe->table_group,
+ pe->phb->hose->global_number, pe->pe_number);
pnv_ioda_setup_bus_iommu_group(pe, &pe->table_group, NULL);
#endif
}
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 45fb70b..ef9448a 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -1147,6 +1147,8 @@ static int pnv_tce_iommu_bus_notifier(struct notifier_block *nb,
return 0;
pe = &phb->ioda.pe_array[pdn->pe_number];
+ if (!pe->table_group.group)
+ return 0;
iommu_add_device(&pe->table_group, dev);
return 0;
case BUS_NOTIFY_DEL_DEVICE:
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH kernel] powerpc/powernv/sriov: Register IOMMU groups for VFs
2019-02-18 5:58 [PATCH kernel] powerpc/powernv/sriov: Register IOMMU groups for VFs Alexey Kardashevskiy
@ 2019-02-18 6:43 ` Alexey Kardashevskiy
2019-02-19 0:47 ` David Gibson
2019-02-22 10:01 ` [kernel] " Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2019-02-18 6:43 UTC (permalink / raw)
To: linuxppc-dev; +Cc: kvm-ppc, David Gibson
On 18/02/2019 16:58, Alexey Kardashevskiy wrote:
> The compound IOMMU group rework moved iommu_register_group() together in
> pnv_pci_ioda_setup_iommu_api() (which is a part of ppc_md.pcibios_fixup).
> As the result, pnv_ioda_setup_bus_iommu_group() does not create groups
> any more, it only adds devices to groups.
>
> This works fine for boot time devices. However IOMMU groups for SRIOV's
> VFs were added by pnv_ioda_setup_bus_iommu_group() so this got broken:
> pnv_tce_iommu_bus_notifier() expects a group to be registered for VF
> and it is not.
>
> This adds missing group registration and adds a NULL pointer check into
> the bus notifier so we won't stop in xmon if there is no group, although
> it is not expected to happen now.
>
> Fixes: 0bd971676e68 "powerpc/powernv/npu: Add compound IOMMU groups"
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Forgot this:
Reported-by: Santwana Samantray<santwana.samantray@in.ibm.com>
> ---
>
> Fixes https://bugzilla.linux.ibm.com/show_bug.cgi?id=175550
> "Kernel Oops while creating SRIOV VF's."
>
>
> ---
> arch/powerpc/platforms/powernv/pci-ioda.c | 2 ++
> arch/powerpc/platforms/powernv/pci.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 7db3119..145373f 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -1593,6 +1593,8 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs)
>
> pnv_pci_ioda2_setup_dma_pe(phb, pe);
> #ifdef CONFIG_IOMMU_API
> + iommu_register_group(&pe->table_group,
> + pe->phb->hose->global_number, pe->pe_number);
> pnv_ioda_setup_bus_iommu_group(pe, &pe->table_group, NULL);
> #endif
> }
> diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
> index 45fb70b..ef9448a 100644
> --- a/arch/powerpc/platforms/powernv/pci.c
> +++ b/arch/powerpc/platforms/powernv/pci.c
> @@ -1147,6 +1147,8 @@ static int pnv_tce_iommu_bus_notifier(struct notifier_block *nb,
> return 0;
>
> pe = &phb->ioda.pe_array[pdn->pe_number];
> + if (!pe->table_group.group)
> + return 0;
> iommu_add_device(&pe->table_group, dev);
> return 0;
> case BUS_NOTIFY_DEL_DEVICE:
>
--
Alexey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH kernel] powerpc/powernv/sriov: Register IOMMU groups for VFs
2019-02-18 5:58 [PATCH kernel] powerpc/powernv/sriov: Register IOMMU groups for VFs Alexey Kardashevskiy
2019-02-18 6:43 ` Alexey Kardashevskiy
@ 2019-02-19 0:47 ` David Gibson
2019-02-22 10:01 ` [kernel] " Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2019-02-19 0:47 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: linuxppc-dev, kvm-ppc
[-- Attachment #1: Type: text/plain, Size: 2559 bytes --]
On Mon, Feb 18, 2019 at 04:58:01PM +1100, Alexey Kardashevskiy wrote:
> The compound IOMMU group rework moved iommu_register_group() together in
> pnv_pci_ioda_setup_iommu_api() (which is a part of ppc_md.pcibios_fixup).
> As the result, pnv_ioda_setup_bus_iommu_group() does not create groups
> any more, it only adds devices to groups.
>
> This works fine for boot time devices. However IOMMU groups for SRIOV's
> VFs were added by pnv_ioda_setup_bus_iommu_group() so this got broken:
> pnv_tce_iommu_bus_notifier() expects a group to be registered for VF
> and it is not.
>
> This adds missing group registration and adds a NULL pointer check into
> the bus notifier so we won't stop in xmon if there is no group, although
> it is not expected to happen now.
>
> Fixes: 0bd971676e68 "powerpc/powernv/npu: Add compound IOMMU groups"
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>
> Fixes https://bugzilla.linux.ibm.com/show_bug.cgi?id=175550
> "Kernel Oops while creating SRIOV VF's."
>
>
> ---
> arch/powerpc/platforms/powernv/pci-ioda.c | 2 ++
> arch/powerpc/platforms/powernv/pci.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 7db3119..145373f 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -1593,6 +1593,8 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs)
>
> pnv_pci_ioda2_setup_dma_pe(phb, pe);
> #ifdef CONFIG_IOMMU_API
> + iommu_register_group(&pe->table_group,
> + pe->phb->hose->global_number, pe->pe_number);
> pnv_ioda_setup_bus_iommu_group(pe, &pe->table_group, NULL);
> #endif
> }
> diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
> index 45fb70b..ef9448a 100644
> --- a/arch/powerpc/platforms/powernv/pci.c
> +++ b/arch/powerpc/platforms/powernv/pci.c
> @@ -1147,6 +1147,8 @@ static int pnv_tce_iommu_bus_notifier(struct notifier_block *nb,
> return 0;
>
> pe = &phb->ioda.pe_array[pdn->pe_number];
> + if (!pe->table_group.group)
> + return 0;
> iommu_add_device(&pe->table_group, dev);
> return 0;
> case BUS_NOTIFY_DEL_DEVICE:
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [kernel] powerpc/powernv/sriov: Register IOMMU groups for VFs
2019-02-18 5:58 [PATCH kernel] powerpc/powernv/sriov: Register IOMMU groups for VFs Alexey Kardashevskiy
2019-02-18 6:43 ` Alexey Kardashevskiy
2019-02-19 0:47 ` David Gibson
@ 2019-02-22 10:01 ` Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2019-02-22 10:01 UTC (permalink / raw)
To: Alexey Kardashevskiy, linuxppc-dev
Cc: Alexey Kardashevskiy, kvm-ppc, David Gibson
On Mon, 2019-02-18 at 05:58:01 UTC, Alexey Kardashevskiy wrote:
> The compound IOMMU group rework moved iommu_register_group() together in
> pnv_pci_ioda_setup_iommu_api() (which is a part of ppc_md.pcibios_fixup).
> As the result, pnv_ioda_setup_bus_iommu_group() does not create groups
> any more, it only adds devices to groups.
>
> This works fine for boot time devices. However IOMMU groups for SRIOV's
> VFs were added by pnv_ioda_setup_bus_iommu_group() so this got broken:
> pnv_tce_iommu_bus_notifier() expects a group to be registered for VF
> and it is not.
>
> This adds missing group registration and adds a NULL pointer check into
> the bus notifier so we won't stop in xmon if there is no group, although
> it is not expected to happen now.
>
> Fixes: 0bd971676e68 "powerpc/powernv/npu: Add compound IOMMU groups"
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Reported-by: Santwana Samantray<santwana.samantray@in.ibm.com>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/8f5b27347e88b171c755562f0090ce40
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-22 10:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-18 5:58 [PATCH kernel] powerpc/powernv/sriov: Register IOMMU groups for VFs Alexey Kardashevskiy
2019-02-18 6:43 ` Alexey Kardashevskiy
2019-02-19 0:47 ` David Gibson
2019-02-22 10:01 ` [kernel] " Michael Ellerman
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).