From: Alexander Fomichev <hidden> Date: 2019-01-28 20:47:08
get_dma_ops() falls into arch-dependant get_arch_dma_ops(), which
historically returns NULL on PowerPC. Therefore dma_set_mask() fails.
This affects Switchtec (and probably other) NTB devices, that they fail
to initialize.
The proposed patch should fix the issue.
---
arch/powerpc/include/asm/dma-mapping.h | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
@@ -70,14 +70,11 @@ extern struct dma_map_ops dma_iommu_ops;#endifexternconststructdma_map_opsdma_nommu_ops;+externconststructdma_map_ops*get_pci_dma_ops(void);+staticinlineconststructdma_map_ops*get_arch_dma_ops(structbus_type*bus){-/* We don't handle the NULL dev case for ISA for now. We could-*doitviaanoutoflinecallbutitisnotneededfornow.The-*onlyISADMAdevicewesupportisthefloppyandwehaveahack-*inthefloppydriverdirectlytogetadeviceforus.-*/-returnNULL;+returnget_pci_dma_ops();}/*
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2019-01-30 13:00:25
Alexander Fomichev [off-list ref] writes:
get_dma_ops() falls into arch-dependant get_arch_dma_ops(), which
historically returns NULL on PowerPC. Therefore dma_set_mask() fails.
This affects Switchtec (and probably other) NTB devices, that they fail
to initialize.
What's an NTB device?
drivers/ntb I assume?
So it's a PCI device of some sort, but presumably the device you're
calling dma_set_mask() on is an NTB device not a PCI device?
But then it works if you tell it to use the PCI DMA ops?
At the very least the code should be checking for the NTB bus type and
only returning the PCI ops in that specific case, not for all devices.
cheers
From: Christoph Hellwig <hch@lst.de> Date: 2019-02-04 08:19:27
On Wed, Jan 30, 2019 at 11:58:40PM +1100, Michael Ellerman wrote:
Alexander Fomichev [off-list ref] writes:
quoted
get_dma_ops() falls into arch-dependant get_arch_dma_ops(), which
historically returns NULL on PowerPC. Therefore dma_set_mask() fails.
This affects Switchtec (and probably other) NTB devices, that they fail
to initialize.
What's an NTB device?
drivers/ntb I assume?
So it's a PCI device of some sort, but presumably the device you're
calling dma_set_mask() on is an NTB device not a PCI device?
But then it works if you tell it to use the PCI DMA ops?
At the very least the code should be checking for the NTB bus type and
only returning the PCI ops in that specific case, not for all devices.
Can you provide the context? E.g. the patch and the rest of the commit
log. This all looks rather odd to me.
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2019-02-05 11:22:54
Christoph Hellwig [off-list ref] writes:
On Wed, Jan 30, 2019 at 11:58:40PM +1100, Michael Ellerman wrote:
quoted
Alexander Fomichev [off-list ref] writes:
quoted
get_dma_ops() falls into arch-dependant get_arch_dma_ops(), which
historically returns NULL on PowerPC. Therefore dma_set_mask() fails.
This affects Switchtec (and probably other) NTB devices, that they fail
to initialize.
What's an NTB device?
drivers/ntb I assume?
So it's a PCI device of some sort, but presumably the device you're
calling dma_set_mask() on is an NTB device not a PCI device?
But then it works if you tell it to use the PCI DMA ops?
At the very least the code should be checking for the NTB bus type and
only returning the PCI ops in that specific case, not for all devices.
Can you provide the context? E.g. the patch and the rest of the commit
log. This all looks rather odd to me.
Sorry, here it is.
Or on lore: https://lore.kernel.org/linuxppc-dev/20190128133203.mon4a3nkrzijn43g@alfbook-pro.local/
Subject: [RFC PATCH] powerpc: fix get_arch_dma_ops() for NTB devices
get_dma_ops() falls into arch-dependant get_arch_dma_ops(), which
historically returns NULL on PowerPC. Therefore dma_set_mask() fails.
This affects Switchtec (and probably other) NTB devices, that they fail
to initialize.
The proposed patch should fix the issue.
---
arch/powerpc/include/asm/dma-mapping.h | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
@@ -70,14 +70,11 @@ extern struct dma_map_ops dma_iommu_ops;#endifexternconststructdma_map_opsdma_nommu_ops;+externconststructdma_map_ops*get_pci_dma_ops(void);+staticinlineconststructdma_map_ops*get_arch_dma_ops(structbus_type*bus){-/* We don't handle the NULL dev case for ISA for now. We could-*doitviaanoutoflinecallbutitisnotneededfornow.The-*onlyISADMAdevicewesupportisthefloppyandwehaveahack-*inthefloppydriverdirectlytogetadeviceforus.-*/-returnNULL;+returnget_pci_dma_ops();}/*
From: Christoph Hellwig <hch@lst.de> Date: 2019-02-05 16:14:51
On Tue, Feb 05, 2019 at 10:20:32PM +1100, Michael Ellerman wrote:
get_dma_ops() falls into arch-dependant get_arch_dma_ops(), which
historically returns NULL on PowerPC. Therefore dma_set_mask() fails.
This affects Switchtec (and probably other) NTB devices, that they fail
to initialize.
The proposed patch should fix the issue.
I'm not a fan of this. powerpc, just like arm64 for example has
required that we set a specific per-device dma ops, which keeps
the assignments clear. Where do the NTB devices come from?
Might be worth adding the NTB maintainers to the CC list and maybe
linux-iommu.