[PATCH v3 05/21] alpha: return error code from alpha_pci_map_sg()

2021-07-29 Thread Logan Gunthorpe
be allocated. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner --- arch/alpha/kernel/pci_iommu.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha

[PATCH v3 07/21] ARM/dma-mapping: don't set failed sg dma_address to DMA_MAPPING_ERROR

2021-07-29 Thread Logan Gunthorpe
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of the ->map_sg calling convention, so remove it. Link: https://lore.kernel.org/linux-mips/20210716063241.gc13...@lst.de/ Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe Cc: Russell King Cc: Thomas Bogend

[PATCH v3 06/21] ARM/dma-mapping: return error code from .map_sg() ops

2021-07-29 Thread Logan Gunthorpe
From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. In the case of a DMA_MAPPING_ERROR, -EIO is returned. Otherwise, -ENOMEM or -EINVAL is returned depending on the error from __map_sg_chunk(). Signed-off-by: Martin Oliveira Signed-off-by: Logan

[PATCH v3 10/21] powerpc/iommu: return error code from .map_sg() ops

2021-07-29 Thread Logan Gunthorpe
error with DMA_MAPPING_ERROR and an examination of the latter indicates that it may return arch-specific errors (for example, tce_buildmulti_pSeriesLP()). Hence, coalesce all of those errors into -EIO, per the documentation on dma_map_sgtable(). Signed-off-by: Martin Oliveira Signed-off-by:

[PATCH v3 08/21] ia64/sba_iommu: return error code from sba_map_sg_attrs()

2021-07-29 Thread Logan Gunthorpe
is out of mapping resources, hence a -ENOMEM is used in that case. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Michael Ellerman Cc: Niklas Schnelle Cc: Thomas Bogendoerfer --- arch/ia64/hp/common/sba_iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[PATCH v3 11/21] powerpc/iommu: don't set failed sg dma_address to DMA_MAPPING_ERROR

2021-07-29 Thread Logan Gunthorpe
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of the ->map_sg calling convention, so remove it. Link: https://lore.kernel.org/linux-mips/20210716063241.gc13...@lst.de/ Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe Cc: Michael Ellerman Cc: Benjamin Herrens

[PATCH v3 09/21] MIPS/jazzdma: return error code from jazz_dma_map_sg()

2021-07-29 Thread Logan Gunthorpe
on dma_map_sgtable(). Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Thomas Bogendoerfer --- arch/mips/jazz/jazzdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c index 461457b28982..eabddb89d221 100644 --- a/arch

[PATCH v3 13/21] s390/pci: don't set failed sg dma_address to DMA_MAPPING_ERROR

2021-07-29 Thread Logan Gunthorpe
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of the ->map_sg calling convention, so remove it. Link: https://lore.kernel.org/linux-mips/20210716063241.gc13...@lst.de/ Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe Cc: Niklas Schnelle Cc: Gerald Schaefer Cc:

[PATCH v3 12/21] s390/pci: return error code from s390_dma_map_sg()

2021-07-29 Thread Logan Gunthorpe
-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Acked-by: Niklas Schnelle Cc: Gerald Schaefer Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger --- arch/s390/pci/pci_dma.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/s390/pci/pci_dma.c b

[PATCH v3 14/21] sparc/iommu: return error codes from .map_sg() ops

2021-07-29 Thread Logan Gunthorpe
(). Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: "David S. Miller" Cc: Niklas Schnelle Cc: Michael Ellerman --- arch/sparc/kernel/iommu.c | 4 ++-- arch/sparc/kernel/pci_sun4v.c | 4 ++-- arch/sparc/mm/iommu.c | 2 +- 3 files changed, 5 insertions(+), 5

[PATCH v3 16/21] parisc: return error code from .map_sg() ops

2021-07-29 Thread Logan Gunthorpe
From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. Return -EINVAL if the ioc cannot be obtained. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: "James E.J. Bottomley" Cc: Helge Deller --- drivers/parisc/ccio-

[PATCH v3 15/21] sparc/iommu: don't set failed sg dma_address to DMA_MAPPING_ERROR

2021-07-29 Thread Logan Gunthorpe
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of the ->map_sg calling convention, so remove it. Link: https://lore.kernel.org/linux-mips/20210716063241.gc13...@lst.de/ Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe Cc: "David S. Miller" Cc: Nik

[PATCH v3 19/21] x86/amd_gart: don't set failed sg dma_address to DMA_MAPPING_ERROR

2021-07-29 Thread Logan Gunthorpe
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of the ->map_sg calling convention, so remove it. Link: https://lore.kernel.org/linux-mips/20210716063241.gc13...@lst.de/ Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Bo

[PATCH v3 18/21] x86/amd_gart: return error code from gart_map_sg()

2021-07-29 Thread Logan Gunthorpe
-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Niklas Schnelle Cc: Thomas Bogendoerfer Cc: Michael Ellerman --- arch/x86/kernel/amd_gart_64.c | 16 +--- 1 file changed, 9 insert

[PATCH v3 00/21] .map_sg() error cleanup

2021-07-29 Thread Logan Gunthorpe
Christoph) - Change dma_map_sgtable() to EXPORT_SYMBOL_GPL() (Per Christoph) - Add patches to remove the erroneous setting of sg->dma_address to DMA_MAP_ERROR in a few .map_sg(0 implementations. (Per Christoph). -- Logan Gunthorpe (10): dma-mapping: Allow map_sg() ops to return negat

[PATCH v3 01/21] dma-mapping: Allow map_sg() ops to return negative error codes

2021-07-29 Thread Logan Gunthorpe
until they are all converted. Signed-off-by: Logan Gunthorpe --- include/linux/dma-map-ops.h | 5 ++- include/linux/dma-mapping.h | 35 kernel/dma/mapping.c| 84 + 3 files changed, 86 insertions(+), 38 deletions(-) diff --git

[PATCH v3 02/21] dma-direct: Return appropriate error code from dma_direct_map_sg()

2021-07-29 Thread Logan Gunthorpe
Now that the map_sg() op expects error codes instead of return zero on error, convert dma_direct_map_sg() to return an error code. Per the documentation for dma_map_sgtable(), -EIO is returned due to an DMA_MAPPING_ERROR with unknown cause. Signed-off-by: Logan Gunthorpe --- kernel/dma/direct.c

[PATCH v3 04/21] dma-iommu: Return error code from iommu_dma_map_sg()

2021-07-29 Thread Logan Gunthorpe
-by: Logan Gunthorpe Cc: Joerg Roedel Cc: Will Deacon --- drivers/iommu/dma-iommu.c | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 98ba927aee1a..d9aaed080e68 100644 --- a/drivers/iommu/dma-iommu.c

[PATCH v3 21/21] dma-mapping: Disallow .map_sg operations from returning zero on error

2021-07-29 Thread Logan Gunthorpe
Now that all the .map_sg operations have been converted to returning proper error codes, drop the code to handle a zero return value, add a warning if a zero is returned. Signed-off-by: Logan Gunthorpe --- kernel/dma/mapping.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff

[PATCH v3 17/21] xen: swiotlb: return error code from xen_swiotlb_map_sg()

2021-07-29 Thread Logan Gunthorpe
for dma_map_sgtable(). Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Reviewed-by: Boris Ostrovsky Cc: Konrad Rzeszutek Wilk Cc: Juergen Gross Cc: Stefano Stabellini --- drivers/xen/swiotlb-xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen

[PATCH v3 03/21] iommu: Return full error code from iommu_map_sg[_atomic]()

2021-07-29 Thread Logan Gunthorpe
Convert to ssize_t return code so the return code from __iommu_map() can be returned all the way down through dma_iommu_map_sg(). Signed-off-by: Logan Gunthorpe Cc: Joerg Roedel Cc: Will Deacon --- drivers/iommu/iommu.c | 15 +++ include/linux/iommu.h | 22

[PATCH v3 20/21] dma-mapping: return error code from dma_dummy_map_sg()

2021-07-29 Thread Logan Gunthorpe
From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. The only errno to return is -EINVAL in the case when DMA is not supported. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe --- kernel/dma/dummy.c | 2 +- 1 file changed, 1 insertion

[PATCH v2 05/21] alpha: return error code from alpha_pci_map_sg()

2021-07-23 Thread Logan Gunthorpe
be allocated. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner --- arch/alpha/kernel/pci_iommu.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha

[PATCH v2 07/21] ARM/dma-mapping: don't set failed sg dma_address to DMA_MAPPING_ERROR

2021-07-23 Thread Logan Gunthorpe
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of the ->map_sg calling convention, so remove it. Link: https://lore.kernel.org/linux-mips/20210716063241.gc13...@lst.de/ Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe Cc: Russell King Cc: Thomas Bogend

[PATCH v2 06/21] ARM/dma-mapping: return error code from .map_sg() ops

2021-07-23 Thread Logan Gunthorpe
From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. In the case of a DMA_MAPPING_ERROR, -EIO is returned. Otherwise, -ENOMEM or -EINVAL is returned depending on the error from __map_sg_chunk(). Signed-off-by: Martin Oliveira Signed-off-by: Logan

[PATCH v2 08/21] ia64/sba_iommu: return error code from sba_map_sg_attrs()

2021-07-23 Thread Logan Gunthorpe
is out of mapping resources, hence a -ENOMEM is used in that case. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Michael Ellerman Cc: Niklas Schnelle Cc: Thomas Bogendoerfer --- arch/ia64/hp/common/sba_iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[PATCH v2 11/21] powerpc/iommu: don't set failed sg dma_address to DMA_MAPPING_ERROR

2021-07-23 Thread Logan Gunthorpe
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of the ->map_sg calling convention, so remove it. Link: https://lore.kernel.org/linux-mips/20210716063241.gc13...@lst.de/ Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe Cc: Michael Ellerman Cc: Benjamin Herrens

[PATCH v2 10/21] powerpc/iommu: return error code from .map_sg() ops

2021-07-23 Thread Logan Gunthorpe
error with DMA_MAPPING_ERROR and an examination of the latter indicates that it may return arch-specific errors (for example, tce_buildmulti_pSeriesLP()). Hence, coalesce all of those errors into -EIO, per the documentation on dma_map_sgtable(). Signed-off-by: Martin Oliveira Signed-off-by:

[PATCH v2 09/21] MIPS/jazzdma: return error code from jazz_dma_map_sg()

2021-07-23 Thread Logan Gunthorpe
on dma_map_sgtable(). Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Thomas Bogendoerfer --- arch/mips/jazz/jazzdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c index 461457b28982..eabddb89d221 100644 --- a/arch

[PATCH v2 03/21] iommu: Return full error code from iommu_map_sg[_atomic]()

2021-07-23 Thread Logan Gunthorpe
Convert to ssize_t return code so the return code from __iommu_map() can be returned all the way down through dma_iommu_map_sg(). Signed-off-by: Logan Gunthorpe Cc: Joerg Roedel Cc: Will Deacon --- drivers/iommu/iommu.c | 15 +++ include/linux/iommu.h | 22

[PATCH v2 04/21] dma-iommu: Return error code from iommu_dma_map_sg()

2021-07-23 Thread Logan Gunthorpe
-by: Logan Gunthorpe Cc: Joerg Roedel Cc: Will Deacon --- drivers/iommu/dma-iommu.c | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 98ba927aee1a..d9aaed080e68 100644 --- a/drivers/iommu/dma-iommu.c

[PATCH v2 12/21] s390/pci: return error code from s390_dma_map_sg()

2021-07-23 Thread Logan Gunthorpe
-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Acked-by: Niklas Schnelle Cc: Gerald Schaefer Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger --- arch/s390/pci/pci_dma.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/s390/pci/pci_dma.c b

[PATCH v2 13/21] s390/pci: don't set failed sg dma_address to DMA_MAPPING_ERROR

2021-07-23 Thread Logan Gunthorpe
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of the ->map_sg calling convention, so remove it. Link: https://lore.kernel.org/linux-mips/20210716063241.gc13...@lst.de/ Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe Cc: Niklas Schnelle Cc: Gerald Schaefer Cc:

[PATCH v2 15/21] sparc/iommu: don't set failed sg dma_address to DMA_MAPPING_ERROR

2021-07-23 Thread Logan Gunthorpe
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of the ->map_sg calling convention, so remove it. Link: https://lore.kernel.org/linux-mips/20210716063241.gc13...@lst.de/ Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe Cc: "David S. Miller" Cc: Nik

[PATCH v2 14/21] sparc/iommu: return error codes from .map_sg() ops

2021-07-23 Thread Logan Gunthorpe
(). Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: "David S. Miller" Cc: Niklas Schnelle Cc: Michael Ellerman --- arch/sparc/kernel/iommu.c | 4 ++-- arch/sparc/kernel/pci_sun4v.c | 4 ++-- arch/sparc/mm/iommu.c | 2 +- 3 files changed, 5 insertions(+), 5

[PATCH v2 16/21] parisc: return error code from .map_sg() ops

2021-07-23 Thread Logan Gunthorpe
From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. Return -EINVAL if the ioc cannot be obtained. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: "James E.J. Bottomley" Cc: Helge Deller --- drivers/parisc/ccio-

[PATCH v2 18/21] x86/amd_gart: return error code from gart_map_sg()

2021-07-23 Thread Logan Gunthorpe
-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Niklas Schnelle Cc: Thomas Bogendoerfer Cc: Michael Ellerman --- arch/x86/kernel/amd_gart_64.c | 16 +--- 1 file changed, 9 insert

[PATCH v2 19/21] x86/amd_gart: don't set failed sg dma_address to DMA_MAPPING_ERROR

2021-07-23 Thread Logan Gunthorpe
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of the ->map_sg calling convention, so remove it. Link: https://lore.kernel.org/linux-mips/20210716063241.gc13...@lst.de/ Suggested-by: Christoph Hellwig Signed-off-by: Logan Gunthorpe Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Bo

[PATCH v2 17/21] xen: swiotlb: return error code from xen_swiotlb_map_sg()

2021-07-23 Thread Logan Gunthorpe
for dma_map_sgtable(). Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Reviewed-by: Boris Ostrovsky Cc: Konrad Rzeszutek Wilk Cc: Juergen Gross Cc: Stefano Stabellini --- drivers/xen/swiotlb-xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen

[PATCH v2 01/21] dma-mapping: Allow map_sg() ops to return negative error codes

2021-07-23 Thread Logan Gunthorpe
until they are all converted. Signed-off-by: Logan Gunthorpe --- include/linux/dma-map-ops.h | 5 ++- include/linux/dma-mapping.h | 35 +++ kernel/dma/mapping.c| 85 + 3 files changed, 87 insertions(+), 38 deletions(-) diff --git a/include

[PATCH v2 21/21] dma-mapping: Disallow .map_sg operations from returning zero on error

2021-07-23 Thread Logan Gunthorpe
Now that all the .map_sg operations have been converted to returning proper error codes, drop the code to handle a zero return value, add a warning if a zero is returned and update the comment for the map_sg operation. Signed-off-by: Logan Gunthorpe --- kernel/dma/mapping.c | 7 --- 1 file

[PATCH v2 02/21] dma-direct: Return appropriate error code from dma_direct_map_sg()

2021-07-23 Thread Logan Gunthorpe
Now that the map_sg() op expects error codes instead of return zero on error, convert dma_direct_map_sg() to return an error code. Per the documentation for dma_map_sgtable(), -EIO is returned due to an DMA_MAPPING_ERROR with unknown cause. Signed-off-by: Logan Gunthorpe --- kernel/dma/direct.c

[PATCH v2 00/21] .map_sg() error cleanup

2021-07-23 Thread Logan Gunthorpe
ess to DMA_MAP_ERROR in a few .map_sg(0 implementations. (Per Christoph). -- Logan Gunthorpe (10): dma-mapping: Allow map_sg() ops to return negative error codes dma-direct: Return appropriate error code from dma_direct_map_sg() iommu: Return full error code from iommu_map_sg[_atomic]() dma-io

[PATCH v2 20/21] dma-mapping: return error code from dma_dummy_map_sg()

2021-07-23 Thread Logan Gunthorpe
From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. The only errno to return is -EINVAL in the case when DMA is not supported. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe --- kernel/dma/dummy.c | 2 +- 1 file changed, 1 insertion

Re: [PATCH v1 16/16] dma-mapping: Disallow .map_sg operations from returning zero on error

2021-07-16 Thread Logan Gunthorpe
On 2021-07-16 12:33 a.m., Christoph Hellwig wrote: > On Thu, Jul 15, 2021 at 10:45:44AM -0600, Logan Gunthorpe wrote: >> @@ -194,6 +194,8 @@ static int __dma_map_sg_attrs(struct device *dev, struct >> scatterlist *sg, >> else >> ents = ops->map

[PATCH v1 09/16] powerpc/iommu: return error code from .map_sg() ops

2021-07-15 Thread Logan Gunthorpe
error with DMA_MAPPING_ERROR and an examination of the latter indicates that it may return arch-specific errors (for example, tce_buildmulti_pSeriesLP()). Hence, coalesce all of those errors into -EINVAL; Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Michael Ellerman Cc: Be

[PATCH v1 06/16] ARM/dma-mapping: return error code from .map_sg() ops

2021-07-15 Thread Logan Gunthorpe
From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure, so propagate any errors that may happen all the way up. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Russell King Cc: Thomas Bogendoerfer --- arch/arm/mm/dma-mapping.c | 22

[PATCH v1 03/16] iommu: Return full error code from iommu_map_sg[_atomic]()

2021-07-15 Thread Logan Gunthorpe
Convert to ssize_t return code so the return code from __iommu_map() can be returned all the way down through dma_iommu_map_sg(). Signed-off-by: Logan Gunthorpe Cc: Joerg Roedel Cc: Will Deacon --- drivers/iommu/iommu.c | 15 +++ include/linux/iommu.h | 22

[PATCH v1 07/16] ia64/sba_iommu: return error code from sba_map_sg_attrs()

2021-07-15 Thread Logan Gunthorpe
resources, hence a -ENOMEM is used in that case. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Michael Ellerman Cc: Niklas Schnelle Cc: Thomas Bogendoerfer --- arch/ia64/hp/common/sba_iommu.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch

[PATCH v1 13/16] xen: swiotlb: return error code from xen_swiotlb_map_sg()

2021-07-15 Thread Logan Gunthorpe
-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini --- drivers/xen/swiotlb-xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index

[PATCH v1 00/16] .map_sg() error cleanup

2021-07-15 Thread Logan Gunthorpe
-block/20210513223203.5542-1-log...@deltatee.com/ -- Logan Gunthorpe (5): dma-mapping: Allow map_sg() ops to return negative error codes dma-direct: Return appropriate error code from dma_direct_map_sg() iommu: Return full error code from iommu_map_sg[_atomic]() dma-iommu: Return error code

[PATCH v1 14/16] x86/amd_gart: return error code from gart_map_sg()

2021-07-15 Thread Logan Gunthorpe
-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Niklas Schnelle Cc: Thomas Bogendoerfer Cc: Michael Ellerman --- arch/x86/kernel/amd_gart_64.c | 16 +--- 1 file changed, 9 insert

[PATCH v1 12/16] parisc: return error code from .map_sg() ops

2021-07-15 Thread Logan Gunthorpe
From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: "James E.J. Bottomley" Cc: Helge Deller --- drivers/parisc/ccio-dma.c | 2 +- drivers/parisc/sba_iommu.c | 2 +- 2 fil

[PATCH v1 02/16] dma-direct: Return appropriate error code from dma_direct_map_sg()

2021-07-15 Thread Logan Gunthorpe
Now that the map_sg() op expects error codes instead of return zero on error, convert dma_direct_map_sg() to return an error code. The only error to return presently is EINVAL if a page could not be mapped. Signed-off-by: Logan Gunthorpe --- kernel/dma/direct.c | 2 +- 1 file changed, 1

[PATCH v1 11/16] sparc/iommu: return error codes from .map_sg() ops

2021-07-15 Thread Logan Gunthorpe
(). Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: "David S. Miller" Cc: Niklas Schnelle Cc: Michael Ellerman --- arch/sparc/kernel/iommu.c | 4 ++-- arch/sparc/kernel/pci_sun4v.c | 4 ++-- arch/sparc/mm/iommu.c | 2 +- 3 files changed, 5 insertions(+), 5

[PATCH v1 01/16] dma-mapping: Allow map_sg() ops to return negative error codes

2021-07-15 Thread Logan Gunthorpe
multiple negative error codes. Legacy map_sg implementations can continue to return zero until they are all converted. Signed-off-by: Logan Gunthorpe --- include/linux/dma-map-ops.h | 8 +++- include/linux/dma-mapping.h | 35 -- kernel/dma/mapping.c| 73

[PATCH v1 05/16] alpha: return error code from alpha_pci_map_sg()

2021-07-15 Thread Logan Gunthorpe
can be allocated. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner --- arch/alpha/kernel/pci_iommu.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha

[PATCH v1 10/16] s390/pci: return error code from s390_dma_map_sg()

2021-07-15 Thread Logan Gunthorpe
From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. So propagate the error from __s390_dma_map_sg() up. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Niklas Schnelle Cc: Gerald Schaefer Cc: Heiko Carstens Cc: Vasily Gorbik Cc

Re: [PATCH v1 00/16] .map_sg() error cleanup

2021-07-15 Thread Logan Gunthorpe
On 2021-07-15 10:53 a.m., Russell King (Oracle) wrote: > On Thu, Jul 15, 2021 at 10:45:28AM -0600, Logan Gunthorpe wrote: >> Hi, >> >> This series is spun out and expanded from my work to add P2PDMA support >> to DMA map operations[1]. >> >> The P2PDMA

[PATCH v1 08/16] MIPS/jazzdma: return error code from jazz_dma_map_sg()

2021-07-15 Thread Logan Gunthorpe
Oliveira Signed-off-by: Logan Gunthorpe Cc: Thomas Bogendoerfer --- arch/mips/jazz/jazzdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c index 461457b28982..3b99743435db 100644 --- a/arch/mips/jazz/jazzdma.c +++ b/arch/mips

[PATCH v1 04/16] dma-iommu: Return error code from iommu_dma_map_sg()

2021-07-15 Thread Logan Gunthorpe
Pass through appropriate error codes from iommu_dma_map_sg() now that the error code will be passed through dma_map_sgtable(). Signed-off-by: Logan Gunthorpe Cc: Joerg Roedel Cc: Will Deacon --- drivers/iommu/dma-iommu.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions

[PATCH v1 16/16] dma-mapping: Disallow .map_sg operations from returning zero on error

2021-07-15 Thread Logan Gunthorpe
Now that all the .map_sg operations have been converted to returning proper error codes, drop the code to handle a zero return value, add a warning if a zero is returned and update the comment for the map_sg operation. Signed-off-by: Logan Gunthorpe --- include/linux/dma-map-ops.h | 8

[PATCH v1 15/16] dma-mapping: return error code from dma_dummy_map_sg()

2021-07-15 Thread Logan Gunthorpe
From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. The only errno to return is -ENODEV in the case when DMA is not supported. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe --- kernel/dma/dummy.c | 2 +- 1 file changed, 1 insertion

Re: [PATCH v2 01/14] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions

2021-05-17 Thread Logan Gunthorpe
hange intended. > > [1] Documentation/filesystems/sysfs.rst > > Related to: > commit ad025f8e46f3 ("PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in > "show" functions") > > Signed-off-by: Krzysztof Wilczyński > Reviewed-by: Logan Gunthorpe I re

Re: [PATCH 01/11] PCI: Use sysfs_emit() and sysfs_emit_at() in "show" functions

2021-05-10 Thread Logan Gunthorpe
hange intended. > > [1] Documentation/filesystems/sysfs.rst > > Related to: > commit ad025f8e46f3 ("PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in > "show" functions") > > Signed-off-by: Krzysztof Wilczyński Thanks, this is a great cleanu

Re: [patch V2 11/15] completion: Use simple wait queues

2020-03-18 Thread Logan Gunthorpe
On 2020-03-18 2:43 p.m., Thomas Gleixner wrote: > There is no semantical or functional change: > > - completions use the exclusive wait mode which is what swait provides > > - complete() wakes one exclusive waiter > > - complete_all() wakes all waiters while holding the lock which

Re: [patch V2 02/15] pci/switchtec: Replace completion wait queue usage for poll

2020-03-18 Thread Logan Gunthorpe
ian Andrzej Siewior > Acked-by: Peter Zijlstra (Intel) While I've been against open coding the completion in this driver for a while, I'm convinced by the EPOLLEXCLUSIVE argument for this change. I've reviewed and lightly tested the change with hardware: Reviewed-by: Logan Gunthorpe Thanks,

[PATCH v4 7/7] mm/memremap: Set caching mode for PCI P2PDMA memory to WC

2020-03-06 Thread Logan Gunthorpe
-by: Logan Gunthorpe Reviewed-by: Dan Williams --- mm/memremap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/memremap.c b/mm/memremap.c index 06742372a203..9033ae401448 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -190,7 +190,10 @@ void *memremap_pages(struct dev_pagemap *pgmap

[PATCH v4 2/7] mm/memory_hotplug: Rename mhp_restrictions to mhp_params

2020-03-06 Thread Logan Gunthorpe
The mhp_restrictions struct really doesn't specify anything resembling a restriction anymore so rename it to be mhp_params as it is a list of extended parameters. Signed-off-by: Logan Gunthorpe Reviewed-by: David Hildenbrand Reviewed-by: Dan Williams Acked-by: Michal Hocko --- arch/arm64/mm

[PATCH v4 6/7] mm/memory_hotplug: Add pgprot_t to mhp_params

2020-03-06 Thread Logan Gunthorpe
-by: Logan Gunthorpe Acked-by: David Hildenbrand Acked-by: Michal Hocko Acked-by: Dan Williams --- arch/arm64/mm/mmu.c| 3 ++- arch/ia64/mm/init.c| 3 +++ arch/powerpc/mm/mem.c | 3 ++- arch/s390/mm/init.c| 3 +++ arch/sh/mm/init.c | 3

[PATCH v4 4/7] x86/mm: Introduce __set_memory_prot()

2020-03-06 Thread Logan Gunthorpe
For use in the 32bit arch_add_memory() to set the pgprot type of the memory to add. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Signed-off-by: Logan Gunthorpe Review

[PATCH v4 5/7] powerpc/mm: Thread pgprot_t through create_section_mapping()

2020-03-06 Thread Logan Gunthorpe
In prepartion to support a pgprot_t argument for arch_add_memory(). Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Signed-off-by: Logan Gunthorpe --- arch/powerpc/include/asm/book3s/64/hash.h | 3 ++- arch/powerpc/include/asm/book3s/64/radix.h | 3 ++- arch/powerpc

[PATCH v4 3/7] x86/mm: Thread pgprot_t through init_memory_mapping()

2020-03-06 Thread Logan Gunthorpe
ot; Cc: x...@kernel.org Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Signed-off-by: Logan Gunthorpe Reviewed-by: Dan Williams Acked-by: Michal Hocko --- arch/x86/include/asm/page_types.h | 3 --- arch/x86/include/asm/pgtable.h| 3 +++ arch/x86/kernel/amd_gart_64.c | 3 ++- arch/x86

[PATCH v4 1/7] mm/memory_hotplug: Drop the flags field from struct mhp_restrictions

2020-03-06 Thread Logan Gunthorpe
This variable is not used anywhere and should therefore be removed from the structure. Signed-off-by: Logan Gunthorpe Reviewed-by: David Hildenbrand Reviewed-by: Dan Williams Acked-by: Michal Hocko --- include/linux/memory_hotplug.h | 2 -- 1 file changed, 2 deletions(-) diff --git

[PATCH v4 0/7] Allow setting caching mode in arch_add_memory() for P2PDMA

2020-03-06 Thread Logan Gunthorpe
and sh don't appear to have an easy way to change the page tables so, for now at least, we just return -EINVAL on such mappings and thus they will not support P2PDMA memory until the work for this is done. This should be fine as they don't yet support ZONE_DEVICE. -- Logan Gunthorpe (7): mm

Re: [PATCH v3 7/7] mm/memremap: Set caching mode for PCI P2PDMA memory to WC

2020-03-02 Thread Logan Gunthorpe
On 2020-02-29 3:47 p.m., Dan Williams wrote: > On Fri, Feb 21, 2020 at 10:25 AM Logan Gunthorpe wrote: >> >> PCI BAR IO memory should never be mapped as WB, however prior to this >> the PAT bits were set WB and it was typically overridden by MTRR >> registers set by

Re: [PATCH v3 6/7] mm/memory_hotplug: Add pgprot_t to mhp_params

2020-03-02 Thread Logan Gunthorpe
On 2020-02-29 3:44 p.m., Dan Williams wrote: > On Fri, Feb 21, 2020 at 10:25 AM Logan Gunthorpe wrote: >> >> devm_memremap_pages() is currently used by the PCI P2PDMA code to create >> struct page mappings for IO memory. At present, these mappings are created >> wit

Re: [PATCH v3 4/7] x86/mm: Introduce _set_memory_prot()

2020-03-02 Thread Logan Gunthorpe
On 2020-02-29 3:33 p.m., Dan Williams wrote: > On Fri, Feb 21, 2020 at 10:25 AM Logan Gunthorpe wrote: >> >> For use in the 32bit arch_add_memory() to set the pgprot type of the >> memory to add. >> >> Cc: Thomas Gleixner >> Cc: Ingo Molnar >>

Re: [PATCH v3 0/7] Allow setting caching mode in arch_add_memory() for P2PDMA

2020-02-27 Thread Logan Gunthorpe
On 2020-02-27 10:43 a.m., Jason Gunthorpe wrote: > Hm, AFAIK WC memory is not compatible with the spinlocks/mutexs/etc in > Linux, so while it is true the memory has no side effects, there would > be surprising concurrency risks if anything in the kernel tried to > write to it. > > Not

Re: [PATCH v3 0/7] Allow setting caching mode in arch_add_memory() for P2PDMA

2020-02-27 Thread Logan Gunthorpe
On 2020-02-27 10:17 a.m., Jason Gunthorpe wrote: >> Instead of this, this series proposes a change to arch_add_memory() >> to take the pgprot required by the mapping which allows us to >> explicitly set pagetable entries for P2PDMA memory to WC. > > Is there a particular reason why WC was

[PATCH v3 1/7] mm/memory_hotplug: Drop the flags field from struct mhp_restrictions

2020-02-21 Thread Logan Gunthorpe
This variable is not used anywhere and should therefore be removed from the structure. Signed-off-by: Logan Gunthorpe Reviewed-by: David Hildenbrand --- include/linux/memory_hotplug.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux

[PATCH v3 5/7] powerpc/mm: Thread pgprot_t through create_section_mapping()

2020-02-21 Thread Logan Gunthorpe
In prepartion to support a pgprot_t argument for arch_add_memory(). Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Signed-off-by: Logan Gunthorpe --- arch/powerpc/include/asm/book3s/64/hash.h | 3 ++- arch/powerpc/include/asm/book3s/64/radix.h | 3 ++- arch/powerpc

[PATCH v3 3/7] x86/mm: Thread pgprot_t through init_memory_mapping()

2020-02-21 Thread Logan Gunthorpe
ot; Cc: x...@kernel.org Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Signed-off-by: Logan Gunthorpe --- arch/x86/include/asm/page_types.h | 3 --- arch/x86/include/asm/pgtable.h| 3 +++ arch/x86/kernel/amd_gart_64.c | 3 ++- arch/x86/mm/init.c| 9 + arch/x86/

[PATCH v3 4/7] x86/mm: Introduce _set_memory_prot()

2020-02-21 Thread Logan Gunthorpe
For use in the 32bit arch_add_memory() to set the pgprot type of the memory to add. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Signed-off-by: Logan Gunthorpe --- arch/x

[PATCH v3 2/7] mm/memory_hotplug: Rename mhp_restrictions to mhp_params

2020-02-21 Thread Logan Gunthorpe
The mhp_restrictions struct really doesn't specify anything resembling a restriction anymore so rename it to be mhp_params as it is a list of extended parameters. Signed-off-by: Logan Gunthorpe --- arch/arm64/mm/mmu.c| 4 ++-- arch/ia64/mm/init.c| 4 ++-- arch/powerpc

[PATCH v3 6/7] mm/memory_hotplug: Add pgprot_t to mhp_params

2020-02-21 Thread Logan Gunthorpe
Signed-off-by: Logan Gunthorpe Acked-by: David Hildenbrand Acked-by: Michal Hocko --- arch/arm64/mm/mmu.c| 3 ++- arch/ia64/mm/init.c| 3 +++ arch/powerpc/mm/mem.c | 3 ++- arch/s390/mm/init.c| 3 +++ arch/sh/mm/init.c | 3 +++ arch/x86

[PATCH v3 0/7] Allow setting caching mode in arch_add_memory() for P2PDMA

2020-02-21 Thread Logan Gunthorpe
on such mappings and thus they will not support P2PDMA memory until the work for this is done. -- Logan Gunthorpe (7): mm/memory_hotplug: Drop the flags field from struct mhp_restrictions mm/memory_hotplug: Rename mhp_restrictions to mhp_params x86/mm: Thread pgprot_t through

[PATCH v3 7/7] mm/memremap: Set caching mode for PCI P2PDMA memory to WC

2020-02-21 Thread Logan Gunthorpe
: Christoph Hellwig Cc: Jason Gunthorpe Signed-off-by: Logan Gunthorpe --- mm/memremap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/memremap.c b/mm/memremap.c index 06742372a203..8d141c3e3364 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -190,7 +190,10 @@ void *memremap_pages(struct

Re: [PATCH v2 2/8] mm/memory_hotplug: Rename mhp_restrictions to mhp_modifiers

2020-01-08 Thread Logan Gunthorpe
On 2020-01-08 12:13 p.m., Dan Williams wrote: > On Wed, Jan 8, 2020 at 11:08 AM David Hildenbrand wrote: >> >> >> >>> Am 08.01.2020 um 20:00 schrieb Dan Williams : >>> >>> On Wed, Jan 8, 2020 at 9:17 AM Logan Gunthorpe wrote: >>>>

Re: [PATCH v2 6/8] s390/mm: Thread pgprot_t through vmem_add_mapping()

2020-01-08 Thread Logan Gunthorpe
On 2020-01-08 5:43 a.m., David Hildenbrand wrote: > On 07.01.20 21:59, Logan Gunthorpe wrote: >> In prepartion to support a pgprot_t argument for arch_add_memory(). >> >> Cc: Heiko Carstens >> Cc: Vasily Gorbik >> Cc: Christian Borntraeger >> Signed-o

Re: [PATCH v2 7/8] mm/memory_hotplug: Add pgprot_t to mhp_modifiers

2020-01-08 Thread Logan Gunthorpe
On 2020-01-08 5:42 a.m., Michal Hocko wrote: > On Tue 07-01-20 13:59:58, Logan Gunthorpe wrote: >> devm_memremap_pages() is currently used by the PCI P2PDMA code to create >> struct page mappings for IO memory. At present, these mappings are created >> with PAGE_KERNEL

Re: [PATCH v2 7/8] mm/memory_hotplug: Add pgprot_t to mhp_modifiers

2020-01-08 Thread Logan Gunthorpe
On 2020-01-08 5:39 a.m., David Hildenbrand wrote: > On 07.01.20 21:59, Logan Gunthorpe wrote: >> devm_memremap_pages() is currently used by the PCI P2PDMA code to create >> struct page mappings for IO memory. At present, these mappings are created >> with PAGE_KERNEL

Re: [PATCH v2 2/8] mm/memory_hotplug: Rename mhp_restrictions to mhp_modifiers

2020-01-08 Thread Logan Gunthorpe
On 2020-01-08 5:28 a.m., David Hildenbrand wrote: > On 07.01.20 21:59, Logan Gunthorpe wrote: >> The mhp_restrictions struct really doesn't specify anything resembling >> a restriction anymore so rename it to be mhp_modifiers. > > I wonder if something like "mhp_pa

[PATCH v2 0/8] Allow setting caching mode in arch_add_memory() for P2PDMA

2020-01-07 Thread Logan Gunthorpe
on such mappings and thus they will not support P2PDMA memory until the work for this is done. -- Logan Gunthorpe (8): mm/memory_hotplug: Drop the flags field from struct mhp_restrictions mm/memory_hotplug: Rename mhp_restrictions to mhp_modifiers x86/mm: Thread pgprot_t through

[PATCH v2 3/8] x86/mm: Thread pgprot_t through init_memory_mapping()

2020-01-07 Thread Logan Gunthorpe
ot; Cc: x...@kernel.org Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Signed-off-by: Logan Gunthorpe --- arch/x86/include/asm/page_types.h | 3 --- arch/x86/include/asm/pgtable.h| 3 +++ arch/x86/kernel/amd_gart_64.c | 3 ++- arch/x86/mm/init.c| 9 + arch/x86/

[PATCH v2 5/8] powerpc/mm: Thread pgprot_t through create_section_mapping()

2020-01-07 Thread Logan Gunthorpe
In prepartion to support a pgprot_t argument for arch_add_memory(). Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Signed-off-by: Logan Gunthorpe --- arch/powerpc/include/asm/book3s/64/hash.h | 3 ++- arch/powerpc/include/asm/book3s/64/radix.h | 3 ++- arch/powerpc

[PATCH v2 4/8] x86/mm: Introduce _set_memory_prot()

2020-01-07 Thread Logan Gunthorpe
For use in the 32bit arch_add_memory() to set the pgprot type of the memory to add. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Signed-off-by: Logan Gunthorpe --- arch/x

[PATCH v2 1/8] mm/memory_hotplug: Drop the flags field from struct mhp_restrictions

2020-01-07 Thread Logan Gunthorpe
This variable is not used anywhere and should therefore be removed from the structure. Signed-off-by: Logan Gunthorpe --- include/linux/memory_hotplug.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index ba0dca6aac6e

[PATCH v2 6/8] s390/mm: Thread pgprot_t through vmem_add_mapping()

2020-01-07 Thread Logan Gunthorpe
In prepartion to support a pgprot_t argument for arch_add_memory(). Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Signed-off-by: Logan Gunthorpe --- arch/s390/include/asm/pgtable.h | 3 ++- arch/s390/mm/extmem.c | 3 ++- arch/s390/mm/init.c | 2

[PATCH v2 2/8] mm/memory_hotplug: Rename mhp_restrictions to mhp_modifiers

2020-01-07 Thread Logan Gunthorpe
The mhp_restrictions struct really doesn't specify anything resembling a restriction anymore so rename it to be mhp_modifiers. Signed-off-by: Logan Gunthorpe --- arch/arm64/mm/mmu.c| 4 ++-- arch/ia64/mm/init.c| 4 ++-- arch/powerpc/mm/mem.c | 4 ++-- arch

  1   2   >