Remove usage of the deprecated "pci-dma-compat.h" API
Subsystems (15)
cover Remove usage of the deprecated "pci-dma-compat.h" API
This serie axes all the remaining usages of the deprecated "pci-dma-compat.h" API.
All these patches have already been posted.
They have been generated with a coccinelle script.
The tricky parts are patches that use dma_alloc_coherent() because the correct GFP flag has to be used in place of the previous embedded GFP_ATOMIC.
Patches 1-3 are already Reviewed. References to the corresponding mail is given below the ---
Patch 1-2,4-10 are just generated from the coccinelle script. Only too long lines have been hand modified. dma_alloc_coherent() modification are NOT part of these patches.
Patch 3 also includes some 'dma_set_mask_and_coherent()' instead of 'pci_set_dma_mask()/pci_set_consistent_dma_mask()'.
I've left this additional modification because it was reviewed with it.
Patch 10-15 are the tricky parts. Explanation of which GFP flag is the right one is given in each patch. It has been divided in several patches to ease review.
Patch 15 is the only one I'm slighly unsure with. The old code was using a GFP_USER flag in the function. I'm not familiar with it.
I *guess* that GFP_KERNEL is fine, but maybe it should also be GFP_USER or left as GFP_ATOMIC so that nothing is changed.
Patch 16 is the last step that remove "pci-dma-compat.h" and its only usage.
All patches, exept 1-2,6 that are architecture specific, have been compile tested.
After all that, a few rst files, 1 or 2 strings in error messages and some error branching labels should still need some attention.
This is some minor issues.
Only the cover letter is sent to every one. Each patch is sent to the corresponding maintainer(s) + Andrew Morton, Christoph Hellwig and Arnd Bergmann.
Best regards.
Christophe JAILLET (16):
alpha: Remove usage of the deprecated "pci-dma-compat.h" API
floppy: Remove usage of the deprecated "pci-dma-compat.h" API
fpga: dfl: pci: Remove usage of the deprecated "pci-dma-compat.h" API
media: Remove usage of the deprecated "pci-dma-compat.h" API agp/intel: Remove usage of the deprecated "pci-dma-compat.h" API
sparc: Remove usage of the deprecated "pci-dma-compat.h" API
dmaengine: pch_dma: Remove usage of the deprecated "pci-dma-compat.h"
API
rapidio/tsi721: Remove usage of the deprecated "pci-dma-compat.h" API
media: v4l2-pci-skeleton: Remove usage of the deprecated
"pci-dma-compat.h" API
scsi: message: fusion: Remove usage of the deprecated
"pci-dma-compat.h" API
scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()'
scsi: mptbase: Use dma_alloc_coherent()
scsi: mptsas: Use dma_alloc_coherent() in
mptsas_exp_repmanufacture_info()
scsi: mptsas: Use dma_alloc_coherent()
scsi: mptctl: Use dma_alloc_coherent()
PCI: Remove usage of the deprecated "pci-dma-compat.h" API
arch/alpha/include/asm/floppy.h | 7 +- arch/alpha/kernel/pci_iommu.c | 12 +-- arch/powerpc/include/asm/floppy.h | 8 +- arch/sparc/kernel/ioport.c | 2 +- drivers/char/agp/intel-gtt.c | 26 ++--- drivers/dma/pch_dma.c | 2 +- drivers/fpga/dfl-pci.c | 14 +-- drivers/media/pci/cx18/cx18-queue.h | 6 +- drivers/media/pci/ivtv/ivtv-queue.h | 25 +++-- drivers/media/pci/ivtv/ivtv-udma.h | 8 +- drivers/message/fusion/mptbase.c | 149 ++++++++++++++++------------ drivers/message/fusion/mptctl.c | 82 +++++++++------ drivers/message/fusion/mptlan.c | 90 +++++++++-------- drivers/message/fusion/mptsas.c | 94 +++++++++--------- drivers/rapidio/devices/tsi721.c | 8 +- include/linux/pci-dma-compat.h | 129 ------------------------ include/linux/pci.h | 3 - samples/v4l/v4l2-pci-skeleton.c | 2 +- 18 files changed, 289 insertions(+), 378 deletions(-) delete mode 100644 include/linux/pci-dma-compat.h
Signature · 1 line
2.32.0
PATCH 1/16 alpha: Remove usage of the deprecated "pci-dma-compat.h" API
In [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
---
Reviewed in: https://lore.kernel.org/kernel-janitors/CAK8P3a2XwFveAd8nSCexZG3_UZga2PQ+EXHxQLGaWkLjCwrBxQ@mail.gmail.com/
--- arch/alpha/include/asm/floppy.h | 7 ++++--- arch/alpha/kernel/pci_iommu.c | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-)
arch/alpha/include/asm/floppy.h +4 -3
@@ -43,17 +43,18 @@ alpha_fd_dma_setup(char *addr, unsigned long size, int mode, int io)static int prev_dir;int dir; - dir = (mode !=DMA_MODE_READ ) ?PCI_DMA_FROMDEVICE :PCI_DMA_TODEVICE ; + dir = (mode !=DMA_MODE_READ ) ?DMA_FROM_DEVICE :DMA_TO_DEVICE ;if (bus_addr && (addr != prev_addr || size != prev_size || dir != prev_dir)) {/* different from last time -- unmap prev */ -pci_unmap_single (isa_bridge, bus_addr, prev_size, prev_dir); +dma_unmap_single (&isa_bridge->dev, bus_addr, prev_size, + prev_dir); bus_addr =0 ; }if (!bus_addr)/* need to map it */ - bus_addr =pci_map_single (isa_bridge, addr, size, dir); + bus_addr =dma_map_single (&isa_bridge->dev, addr, size, dir);/* remember this one as prev */ prev_addr = addr;
arch/alpha/kernel/pci_iommu.c +6 -6
@@ -333,7 +333,7 @@ static dma_addr_t alpha_pci_map_page(struct device *dev, struct page *page,struct pci_dev *pdev =alpha_gendev_to_pci (dev);int dac_allowed; -BUG_ON (dir ==PCI_DMA_NONE ); +BUG_ON (dir ==DMA_NONE ); dac_allowed = pdev ?pci_dac_dma_supported (pdev, pdev->dma_mask) :0 ; return pci_map_single_1(pdev, (char *)page_address(page) + offset,
@@ -356,7 +356,7 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr,struct pci_iommu_arena *arena;long dma_ofs, npages; -BUG_ON (dir ==PCI_DMA_NONE ); +BUG_ON (dir ==DMA_NONE );if (dma_addr >= __direct_map_base && dma_addr < __direct_map_base + __direct_map_size) {
@@ -460,7 +460,7 @@ static void alpha_pci_free_coherent(struct device *dev, size_t size, unsigned long attrs) {struct pci_dev *pdev =alpha_gendev_to_pci (dev); -pci_unmap_single (pdev, dma_addr, size,PCI_DMA_BIDIRECTIONAL ); +dma_unmap_single (&pdev->dev, dma_addr, size,DMA_BIDIRECTIONAL );free_pages ((unsigned long )cpu_addr,get_order (size)); DBGA2("pci_free_consistent: [%llx,%zx] from %ps\n",
@@ -639,7 +639,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,dma_addr_t max_dma;int dac_allowed; -BUG_ON (dir ==PCI_DMA_NONE ); +BUG_ON (dir ==DMA_NONE ); dac_allowed = dev ?pci_dac_dma_supported (pdev, pdev->dma_mask) :0 ;
@@ -702,7 +702,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,/* Some allocation failed while mapping the scatterlist entries. Unmap them now. */ if (out > start) -pci_unmap_sg (pdev, start, out - start, dir); +dma_unmap_sg (&pdev->dev, start, out - start, dir);return -ENOMEM ; }
@@ -722,7 +722,7 @@ static void alpha_pci_unmap_sg(struct device *dev, struct scatterlist *sg,dma_addr_t max_dma;dma_addr_t fbeg, fend; -BUG_ON (dir ==PCI_DMA_NONE ); +BUG_ON (dir ==DMA_NONE );if (! alpha_mv.mv_pci_tbi)return ;
Signature · 1 line
2.32.0
Re: [PATCH 01/16] alpha: Remove usage of the deprecated "pci-dma-compat.h" API
Looks good,
PATCH 2/16 floppy: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
---
Reviewed in: https://lore.kernel.org/kernel-janitors/[email protected]/
--- arch/powerpc/include/asm/floppy.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/floppy.h +5 -3
@@ -134,17 +134,19 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)int dir; doing_vdma =0 ; - dir = (mode ==DMA_MODE_READ ) ?PCI_DMA_FROMDEVICE :PCI_DMA_TODEVICE ; + dir = (mode ==DMA_MODE_READ ) ?DMA_FROM_DEVICE :DMA_TO_DEVICE ;if (bus_addr && (addr != prev_addr || size != prev_size || dir != prev_dir)) {/* different from last time -- unmap prev */ -pci_unmap_single (isa_bridge_pcidev, bus_addr, prev_size, prev_dir); +dma_unmap_single (&isa_bridge_pcidev->dev, bus_addr, prev_size, + prev_dir); bus_addr =0 ; }if (!bus_addr)/* need to map it */ - bus_addr =pci_map_single (isa_bridge_pcidev, addr, size, dir); + bus_addr =dma_map_single (&isa_bridge_pcidev->dev, addr, size, + dir);/* remember this one as prev */ prev_addr = addr;
Signature · 1 line
2.32.0
Re: [PATCH 02/16] floppy: Remove usage of the deprecated "pci-dma-compat.h" API
Looks good,
PATCH 3/16 fpga: dfl: pci: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
It has been hand modified to use 'dma_set_mask_and_coherent()' instead of 'pci_set_dma_mask()/pci_set_consistent_dma_mask()' when applicable. This is less verbose.
The explicit 'ret = -EIO;' has been removed because 'dma_set_mask_and_coherent()' returns 0 or -EIO, so its return code can be used directly.
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
---
Reviewed in: https://lore.kernel.org/kernel-janitors/20210823025635.GA620145@yilunxu-OptiPlex-7050/
--- drivers/fpga/dfl-pci.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/fpga/dfl-pci.c +5 -10
@@ -15,6 +15,7 @@*/ #include <linux/pci.h> +#include <linux/dma-mapping.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/module.h>
@@ -354,16 +355,10 @@ int cci_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *pcidevid)pci_set_master (pcidev); -if (!pci_set_dma_mask (pcidev,DMA_BIT_MASK (64 ))) { - ret =pci_set_consistent_dma_mask (pcidev,DMA_BIT_MASK (64 )); -if (ret) - goto disable_error_report_exit; - }else if (!pci_set_dma_mask (pcidev,DMA_BIT_MASK (32 ))) { - ret =pci_set_consistent_dma_mask (pcidev,DMA_BIT_MASK (32 )); -if (ret) - goto disable_error_report_exit; - }else { - ret = -EIO ; + ret =dma_set_mask_and_coherent (&pcidev->dev,DMA_BIT_MASK (64 )); +if (ret) + ret =dma_set_mask_and_coherent (&pcidev->dev,DMA_BIT_MASK (32 )); +if (ret) {dev_err (&pcidev->dev,"No suitable DMA support available.\n" ); goto disable_error_report_exit; }
Signature · 1 line
2.32.0
Re: [PATCH 03/16] fpga: dfl: pci: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 20 lines · Christophe JAILLET
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
It has been hand modified to use '
dma_set_mask_and_coherent()' instead of 'pci_set_dma_mask()/pci_set_consistent_dma_mask()' when applicable. This is less verbose.The explicit 'ret =
-EIO;' has been removed because 'dma_set_mask_and_coherent()' returns 0 or-EIO, so its return code can be used directly.
Quoted 6 lines
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>Reviewed-by Xu Yilun <[email protected]>
This is a correct conversion of the driver, but I'd prefer to keep this separate from the pci-dma-compat series.
drivers/fpga/dfl-pci.c int cci_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *pcidevid) · line 363
Quoted 6 lines
drivers/fpga/dfl-pci.c +4
-0+ ret =dma_set_mask_and_coherent (&pcidev->dev,DMA_BIT_MASK (64 )); +if (ret) + ret =dma_set_mask_and_coherent (&pcidev->dev,DMA_BIT_MASK (32 )); +if (ret) {dev_err (&pcidev->dev,"No suitable DMA support available.\n" ); goto disable_error_report_exit;
The code looks a bit suspicous, both the old and the new version. If the device ends up on a bus that can only do 32-bit DMA, shouldn't it remember this and make sure it only does GFP_DMA32 allocations for buffers that are passed to the device?
Arnd
Arnd Bergmann
Reviewed-byRe: [PATCH 03/16] fpga: dfl: pci: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 11 lines · Arnd Bergmann
Quoted 8 lines
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>Reviewed-by Xu Yilun <[email protected]>This is a correct conversion of the driver, but I'd prefer to keep this separate from the pci-dma-compat series.
Nevermind, I just misread the patch, and it is required after all to get rid of pci_set_dma_mask()
Re: [PATCH 03/16] fpga: dfl: pci: Remove usage of the deprecated "pci-dma-compat.h" API
Le 07/01/2022 à 01:58, Arnd Bergmann a écrit :
Quoted 10 lines · Arnd Bergmann
Quoted 9 lines
Quoted 8 lines
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>Reviewed-by Xu Yilun <[email protected]>
Quoted 8 lines
Quoted 2 lines
This is a correct conversion of the driver, but I'd prefer to keep this separate from the pci-dma-compat series.
Nevermind, I just misread the patch, and it is required after all to get rid of
pci_set_dma_mask()Reviewed-by Arnd Bergmann <[email protected]>
Hi,
I also have another WIP which removes these DMA(32) fallbacks. It will be clean-up later-on.
CJ
Re: [PATCH 03/16] fpga: dfl: pci: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETLooks good,
PATCH 4/16 media: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
--- drivers/media/pci/cx18/cx18-queue.h | 6 +++--- drivers/media/pci/ivtv/ivtv-queue.h | 25 ++++++++++++++----------- drivers/media/pci/ivtv/ivtv-udma.h | 8 ++++---- 3 files changed, 21 insertions(+), 18 deletions(-)
drivers/media/pci/cx18/cx18-queue.h +3 -3
@@ -15,15 +15,15 @@static inline void cx18_buf_sync_for_cpu (struct cx18_stream *s,struct cx18_buffer *buf) { -pci_dma_sync_single_for_cpu (s->cx->pci_dev, buf->dma_handle, +dma_sync_single_for_cpu (&s->cx->pci_dev->dev, buf->dma_handle, s->buf_size, s->dma); }static inline void cx18_buf_sync_for_device (struct cx18_stream *s,struct cx18_buffer *buf) { -pci_dma_sync_single_for_device (s->cx->pci_dev, buf->dma_handle, - s->buf_size, s->dma); +dma_sync_single_for_device (&s->cx->pci_dev->dev, buf->dma_handle, + s->buf_size, s->dma); }void _cx18_mdl_sync_for_device (struct cx18_stream *s,struct cx18_mdl *mdl);
drivers/media/pci/ivtv/ivtv-queue.h +14 -11
@@ -17,20 +17,20 @@static inline int ivtv_might_use_pio (struct ivtv_stream *s) { -return s->dma ==PCI_DMA_NONE || (SLICED_VBI_PIO && s->type ==IVTV_ENC_STREAM_TYPE_VBI ); +return s->dma ==DMA_NONE || (SLICED_VBI_PIO && s->type ==IVTV_ENC_STREAM_TYPE_VBI ); }static inline int ivtv_use_pio (struct ivtv_stream *s) {struct ivtv *itv = s->itv; -return s->dma ==PCI_DMA_NONE || +return s->dma ==DMA_NONE || (SLICED_VBI_PIO && s->type ==IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set); }static inline int ivtv_might_use_dma (struct ivtv_stream *s) { -return s->dma !=PCI_DMA_NONE ; +return s->dma !=DMA_NONE ; }static inline int ivtv_use_dma (struct ivtv_stream *s)
@@ -41,15 +41,16 @@ static inline int ivtv_use_dma(struct ivtv_stream *s)static inline void ivtv_buf_sync_for_cpu (struct ivtv_stream *s,struct ivtv_buffer *buf) {if (ivtv_use_dma (s)) -pci_dma_sync_single_for_cpu (s->itv->pdev, buf->dma_handle, - s->buf_size +256 , s->dma); +dma_sync_single_for_cpu (&s->itv->pdev->dev, buf->dma_handle, + s->buf_size +256 , s->dma); }static inline void ivtv_buf_sync_for_device (struct ivtv_stream *s,struct ivtv_buffer *buf) {if (ivtv_use_dma (s)) -pci_dma_sync_single_for_device (s->itv->pdev, buf->dma_handle, - s->buf_size +256 , s->dma); +dma_sync_single_for_device (&s->itv->pdev->dev, + buf->dma_handle, s->buf_size +256 , + s->dma); }int ivtv_buf_copy_from_user (struct ivtv_stream *s,struct ivtv_buffer *buf,const char __user *src,int copybytes);
@@ -70,15 +71,17 @@ void ivtv_stream_free(struct ivtv_stream *s);static inline void ivtv_stream_sync_for_cpu (struct ivtv_stream *s) {if (ivtv_use_dma (s)) -pci_dma_sync_single_for_cpu (s->itv->pdev, s->sg_handle, -sizeof (struct ivtv_sg_element ),PCI_DMA_TODEVICE ); +dma_sync_single_for_cpu (&s->itv->pdev->dev, s->sg_handle, +sizeof (struct ivtv_sg_element ), +DMA_TO_DEVICE ); }static inline void ivtv_stream_sync_for_device (struct ivtv_stream *s) {if (ivtv_use_dma (s)) -pci_dma_sync_single_for_device (s->itv->pdev, s->sg_handle, -sizeof (struct ivtv_sg_element ),PCI_DMA_TODEVICE ); +dma_sync_single_for_device (&s->itv->pdev->dev, s->sg_handle, +sizeof (struct ivtv_sg_element ), +DMA_TO_DEVICE ); }#endif
drivers/media/pci/ivtv/ivtv-udma.h +4 -4
@@ -23,14 +23,14 @@ void ivtv_udma_start(struct ivtv *itv);static inline void ivtv_udma_sync_for_device (struct ivtv *itv) { -pci_dma_sync_single_for_device (itv->pdev, itv->udma.SG_handle, -sizeof (itv->udma.SGarray),PCI_DMA_TODEVICE ); +dma_sync_single_for_device (&itv->pdev->dev, itv->udma.SG_handle, +sizeof (itv->udma.SGarray),DMA_TO_DEVICE ); }static inline void ivtv_udma_sync_for_cpu (struct ivtv *itv) { -pci_dma_sync_single_for_cpu (itv->pdev, itv->udma.SG_handle, -sizeof (itv->udma.SGarray),PCI_DMA_TODEVICE ); +dma_sync_single_for_cpu (&itv->pdev->dev, itv->udma.SG_handle, +sizeof (itv->udma.SGarray),DMA_TO_DEVICE ); }#endif
Signature · 1 line
2.32.0
Re: [PATCH 04/16] media: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 7 lines · Christophe JAILLET
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
Quoted 8 lines
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>
Mauro, could you pick this up directly? It has no dependencies on the rest of the series.
Re: [PATCH 04/16] media: Remove usage of the deprecated "pci-dma-compat.h" API
Em Thu, 6 Jan 2022 19:51:47 -0500
Arnd Bergmann <[email protected]> escreveu:
Quoted 16 lines
Quoted 14 lines · Christophe JAILLET
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
Quoted 6 lines
Quoted 1 line
Signed-off-by Christophe JAILLET <[email protected]>Reviewed-by Arnd Bergmann <[email protected]>Mauro, could you pick this up directly? It has no dependencies on the rest of the series.
Sure, but I already closed the media merge window. If you prefer to apply it directly via your tree, that would be OK for me as well. If so, just let me know. On such case:
Regards,
Mauro
Re: [PATCH 04/16] media: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 23 lines · Mauro Carvalho Chehab
Em Thu, 6 Jan 2022 19:51:47 -0500
Arnd Bergmann <[email protected]> escreveu:Quoted 20 lines
Quoted 7 lines · Christophe JAILLET
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
Quoted 8 lines
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>Reviewed-by Arnd Bergmann <[email protected]>
Quoted 8 lines
Quoted 2 lines
Mauro, could you pick this up directly? It has no dependencies on the rest of the series.
Sure, but I already closed the media merge window. If you prefer to apply it directly via your tree, that would be OK for me as well. If so, just let me know. On such case:
I picked it up for inclusion in the media subsystem for 5.18.
Regards,
Hans
Quoted 3 lines
Regards,
Mauro
Re: [PATCH 04/16] media: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETLooks good,
PATCH 5/16 agp/intel: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
--- drivers/char/agp/intel-gtt.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/char/agp/intel-gtt.c +13 -13
@@ -111,8 +111,8 @@ static int intel_gtt_map_memory(struct page **pages,for_each_sg (st->sgl, sg, num_entries, i)sg_set_page (sg, pages[i],PAGE_SIZE ,0 ); -if (!pci_map_sg (intel_private.pcidev, - st->sgl, st->nents,PCI_DMA_BIDIRECTIONAL )) +if (!dma_map_sg (&intel_private.pcidev->dev, st->sgl, st->nents, +DMA_BIDIRECTIONAL )) goto err;return 0 ;
@@ -127,8 +127,8 @@ static void intel_gtt_unmap_memory(struct scatterlist *sg_list, int num_sg)struct sg_table st;DBG ("try unmapping %lu pages\n" , (unsigned long )mem->page_count); -pci_unmap_sg (intel_private.pcidev, sg_list, - num_sg,PCI_DMA_BIDIRECTIONAL ); +dma_unmap_sg (&intel_private.pcidev->dev, sg_list, num_sg, +DMA_BIDIRECTIONAL ); st.sgl = sg_list; st.orig_nents = st.nents = num_sg;
@@ -303,9 +303,9 @@ static int intel_gtt_setup_scratch_page(void)set_pages_uc (page,1 );if (intel_private.needs_dmar) { - dma_addr =pci_map_page (intel_private.pcidev, page,0 , -PAGE_SIZE ,PCI_DMA_BIDIRECTIONAL ); -if (pci_dma_mapping_error (intel_private.pcidev, dma_addr)) { + dma_addr =dma_map_page (&intel_private.pcidev->dev, page,0 , +PAGE_SIZE ,DMA_BIDIRECTIONAL ); +if (dma_mapping_error (&intel_private.pcidev->dev, dma_addr)) {__free_page (page);return -EINVAL ; }
@@ -552,9 +552,9 @@ static void intel_gtt_teardown_scratch_page(void) {set_pages_wb (intel_private.scratch_page,1 );if (intel_private.needs_dmar) -pci_unmap_page (intel_private.pcidev, - intel_private.scratch_page_dma, -PAGE_SIZE ,PCI_DMA_BIDIRECTIONAL ); +dma_unmap_page (&intel_private.pcidev->dev, + intel_private.scratch_page_dma,PAGE_SIZE , +DMA_BIDIRECTIONAL );__free_page (intel_private.scratch_page); }
@@ -1412,13 +1412,13 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,if (bridge) { mask = intel_private.driver->dma_mask_size; -if (pci_set_dma_mask (intel_private.pcidev,DMA_BIT_MASK (mask))) +if (dma_set_mask (&intel_private.pcidev->dev,DMA_BIT_MASK (mask)))dev_err (&intel_private.pcidev->dev,"set gfx device dma mask %d-bit failed!\n" , mask);else -pci_set_consistent_dma_mask (intel_private.pcidev, -DMA_BIT_MASK (mask)); +dma_set_coherent_mask (&intel_private.pcidev->dev, +DMA_BIT_MASK (mask)); }if (intel_gtt_init () !=0 ) {
Signature · 1 line
2.32.0
Re: [PATCH 05/16] agp/intel: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 7 lines · Christophe JAILLET
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
Quoted 8 lines
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>
I suppose this should just go through the drm-misc tree, the patch has no dependencies on anything else.
Re: [PATCH 05/16] agp/intel: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETLooks good,
PATCH 6/16 sparc: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
--- arch/sparc/kernel/ioport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/kernel/ioport.c +1 -1
@@ -309,7 +309,7 @@ arch_initcall(sparc_register_ioport);void arch_sync_dma_for_cpu (phys_addr_t paddr,size_t size,enum dma_data_direction dir) { -if (dir !=PCI_DMA_TODEVICE && +if (dir !=DMA_TO_DEVICE && sparc_cpu_model == sparc_leon && !sparc_leon3_snooping_enabled ())leon_flush_dcache_all ();
Signature · 1 line
2.32.0
Re: [PATCH 06/16] sparc: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 7 lines · Christophe JAILLET
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
Quoted 8 lines
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>
Re: [PATCH 06/16] sparc: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETFrom: Christophe JAILLET <[email protected]>
Date: Thu, 6 Jan 2022 22:51:38 +0100
Quoted 6 lines
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
Quoted 8 lines
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>
Re: [PATCH 06/16] sparc: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETLooks good,
PATCH 7/16 dmaengine: pch_dma: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
--- drivers/dma/pch_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/pch_dma.c +1 -1
@@ -835,7 +835,7 @@ static int pch_dma_probe(struct pci_dev *pdev, goto err_disable_pdev; } - err =pci_set_dma_mask (pdev,DMA_BIT_MASK (32 )); + err =dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 ));if (err) {dev_err (&pdev->dev,"Cannot set proper DMA config\n" ); goto err_free_res;
Signature · 1 line
2.32.0
Re: [PATCH 07/16] dmaengine: pch_dma: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 7 lines · Christophe JAILLET
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
Quoted 8 lines
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>
Vinod, can you apply this one to the dmaengine tree? It has no other dependencies.
Vinod Koul
maintainerRe: [PATCH 07/16] dmaengine: pch_dma: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 16 lines · Arnd Bergmann
Quoted 14 lines · Christophe JAILLET
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
Quoted 6 lines
Quoted 1 line
Signed-off-by Christophe JAILLET <[email protected]>Reviewed-by Arnd Bergmann <[email protected]>Vinod, can you apply this one to the dmaengine tree? It has no other dependencies.
Sure, applied now.
Thanks
Signature · 1 line
~Vinod
Re: [PATCH 07/16] dmaengine: pch_dma: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETLooks good,
PATCH 8/16 rapidio/tsi721: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
--- drivers/rapidio/devices/tsi721.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/rapidio/devices/tsi721.c +4 -4
@@ -2836,17 +2836,17 @@ static int tsi721_probe(struct pci_dev *pdev, }/* Configure DMA attributes. */ -if (pci_set_dma_mask (pdev,DMA_BIT_MASK (64 ))) { - err =pci_set_dma_mask (pdev,DMA_BIT_MASK (32 )); +if (dma_set_mask (&pdev->dev,DMA_BIT_MASK (64 ))) { + err =dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 ));if (err) {tsi_err (&pdev->dev,"Unable to set DMA mask" ); goto err_unmap_bars; } -if (pci_set_consistent_dma_mask (pdev,DMA_BIT_MASK (32 ))) +if (dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 )))tsi_info (&pdev->dev,"Unable to set consistent DMA mask" ); }else { - err =pci_set_consistent_dma_mask (pdev,DMA_BIT_MASK (64 )); + err =dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (64 ));if (err)tsi_info (&pdev->dev,"Unable to set consistent DMA mask" ); }
Signature · 1 line
2.32.0
Re: [PATCH 08/16] rapidio/tsi721: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 7 lines · Christophe JAILLET
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
Quoted 8 lines
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>
Re: [PATCH 08/16] rapidio/tsi721: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETLooks good,
PATCH 9/16 media: v4l2-pci-skeleton: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
--- samples/v4l/v4l2-pci-skeleton.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
samples/v4l/v4l2-pci-skeleton.c +1 -1
@@ -766,7 +766,7 @@ static int skeleton_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ret =pci_enable_device (pdev);if (ret)return ret; - ret =pci_set_dma_mask (pdev,DMA_BIT_MASK (32 )); + ret =dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 ));if (ret) {dev_err (&pdev->dev,"no suitable DMA available.\n" ); goto disable_pci;
Signature · 1 line
2.32.0
Re: [PATCH 09/16] media: v4l2-pci-skeleton: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 7 lines · Christophe JAILLET
In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.Some reasons why this API should be removed have been given by Julia Lawall in [2].
Quoted 8 lines
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/Signed-off-by Christophe JAILLET <[email protected]>
Re: [PATCH 09/16] media: v4l2-pci-skeleton: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETLooks good,
PATCH 10/16 scsi: message: fusion: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
A coccinelle script has been used to perform the needed transformation. It can be found in [3].
In this patch, all functions but pci_alloc_consistent() are handled. pci_alloc_consistent() needs more attention and explanation.
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/[email protected]/
--- drivers/message/fusion/mptbase.c | 94 +++++++++++++++++--------------- drivers/message/fusion/mptctl.c | 51 ++++++++++------- drivers/message/fusion/mptlan.c | 90 ++++++++++++++++-------------- drivers/message/fusion/mptsas.c | 51 ++++++++--------- 4 files changed, 154 insertions(+), 132 deletions(-)
drivers/message/fusion/mptbase.c +50 -44
@@ -316,8 +316,8 @@ mpt_is_discovery_complete(MPT_ADAPTER *ioc) rc =1 ; out_free_consistent: -pci_free_consistent (ioc->pcidev, hdr.ExtPageLength *4 , - buffer, dma_handle); +dma_free_coherent (&ioc->pcidev->dev, hdr.ExtPageLength *4 , buffer, + dma_handle); out:return rc; }
@@ -1661,16 +1661,14 @@ mpt_mapresources(MPT_ADAPTER *ioc)const uint64_t required_mask =dma_get_required_mask (&pdev->dev);if (required_mask >DMA_BIT_MASK (32 ) - && !pci_set_dma_mask (pdev,DMA_BIT_MASK (64 )) - && !pci_set_consistent_dma_mask (pdev, -DMA_BIT_MASK (64 ))) { + && !dma_set_mask (&pdev->dev,DMA_BIT_MASK (64 )) + && !dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (64 ))) { ioc->dma_mask =DMA_BIT_MASK (64 );dinitprintk (ioc,printk (MYIOC_s_INFO_FMT": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n" , ioc->name)); - }else if (!pci_set_dma_mask (pdev,DMA_BIT_MASK (32 )) - && !pci_set_consistent_dma_mask (pdev, -DMA_BIT_MASK (32 ))) { + }else if (!dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 )) + && !dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 ))) { ioc->dma_mask =DMA_BIT_MASK (32 ); dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n",
@@ -1681,9 +1679,8 @@ mpt_mapresources(MPT_ADAPTER *ioc) goto out_pci_release_region; } }else { -if (!pci_set_dma_mask (pdev,DMA_BIT_MASK (32 )) - && !pci_set_consistent_dma_mask (pdev, -DMA_BIT_MASK (32 ))) { +if (!dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 )) + && !dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 ))) { ioc->dma_mask =DMA_BIT_MASK (32 ); dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n",
@@ -2769,9 +2766,9 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)if (ioc->spi_data.pIocPg4 !=NULL ) { sz = ioc->spi_data.IocPg4Sz; -pci_free_consistent (ioc->pcidev, sz, - ioc->spi_data.pIocPg4, - ioc->spi_data.IocPg4_dma); +dma_free_coherent (&ioc->pcidev->dev, sz, + ioc->spi_data.pIocPg4, + ioc->spi_data.IocPg4_dma); ioc->spi_data.pIocPg4 =NULL ; ioc->alloc_total -= sz; }
@@ -3548,7 +3545,8 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc) sz = ioc->facts.FWImageSize;dinitprintk (ioc,printk (MYIOC_s_DEBUG_FMT"free_fw_memory: FW Image @ %p[%p], sz=%d[%x] bytes\n" , ioc->name, ioc->cached_fw, (void *)(ulong )ioc->cached_fw_dma, sz, sz)); -pci_free_consistent (ioc->pcidev, sz, ioc->cached_fw, ioc->cached_fw_dma); +dma_free_coherent (&ioc->pcidev->dev, sz, ioc->cached_fw, + ioc->cached_fw_dma); ioc->alloc_total -= sz; ioc->cached_fw =NULL ; }
@@ -4447,9 +4445,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc)*/ if (ioc->pcidev->device ==MPI_MANUFACTPAGE_DEVID_SAS1078 && ioc->dma_mask >DMA_BIT_MASK (35 )) { -if (!pci_set_dma_mask (ioc->pcidev,DMA_BIT_MASK (32 )) - && !pci_set_consistent_dma_mask (ioc->pcidev, -DMA_BIT_MASK (32 ))) { +if (!dma_set_mask (&ioc->pcidev->dev,DMA_BIT_MASK (32 )) + && !dma_set_coherent_mask (&ioc->pcidev->dev,DMA_BIT_MASK (32 ))) { dma_mask =DMA_BIT_MASK (35 ); d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT "setting 35 bit addressing for "
@@ -4457,10 +4454,10 @@ PrimeIocFifos(MPT_ADAPTER *ioc) ioc->name)); }else {/*Reseting DMA mask to 64 bit*/ -pci_set_dma_mask (ioc->pcidev, -DMA_BIT_MASK (64 )); -pci_set_consistent_dma_mask (ioc->pcidev, -DMA_BIT_MASK (64 )); +dma_set_mask (&ioc->pcidev->dev, +DMA_BIT_MASK (64 )); +dma_set_coherent_mask (&ioc->pcidev->dev, +DMA_BIT_MASK (64 ));printk (MYIOC_s_ERR_FMT "failed setting 35 bit addressing for "
@@ -4595,8 +4592,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc) alloc_dma += ioc->reply_sz; } -if (dma_mask ==DMA_BIT_MASK (35 ) && !pci_set_dma_mask (ioc->pcidev, - ioc->dma_mask) && !pci_set_consistent_dma_mask (ioc->pcidev, +if (dma_mask ==DMA_BIT_MASK (35 ) && !dma_set_mask (&ioc->pcidev->dev, + ioc->dma_mask) && !dma_set_coherent_mask (&ioc->pcidev->dev, ioc->dma_mask))d36memprintk (ioc,printk (MYIOC_s_DEBUG_FMT"restoring 64 bit addressing\n" , ioc->name));
@@ -4620,8 +4617,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc) ioc->sense_buf_pool =NULL ; } -if (dma_mask ==DMA_BIT_MASK (35 ) && !pci_set_dma_mask (ioc->pcidev, -DMA_BIT_MASK (64 )) && !pci_set_consistent_dma_mask (ioc->pcidev, +if (dma_mask ==DMA_BIT_MASK (35 ) && !dma_set_mask (&ioc->pcidev->dev, +DMA_BIT_MASK (64 )) && !dma_set_coherent_mask (&ioc->pcidev->dev,DMA_BIT_MASK (64 )))d36memprintk (ioc,printk (MYIOC_s_DEBUG_FMT"restoring 64 bit addressing\n" , ioc->name));
@@ -4982,7 +4979,8 @@ GetLanConfigPages(MPT_ADAPTER *ioc) } -pci_free_consistent (ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma); +dma_free_coherent (&ioc->pcidev->dev, data_sz, + (u8 *)ppage0_alloc, page0_dma);/* FIXME! * Normalize endianness of structure data,
@@ -5026,7 +5024,8 @@ GetLanConfigPages(MPT_ADAPTER *ioc)memcpy (&ioc->lan_cnfg_page1, ppage1_alloc, copy_sz); } -pci_free_consistent (ioc->pcidev, data_sz, (u8 *) ppage1_alloc, page1_dma); +dma_free_coherent (&ioc->pcidev->dev, data_sz, + (u8 *)ppage1_alloc, page1_dma);/* FIXME! * Normalize endianness of structure data,
@@ -5325,7 +5324,8 @@ GetIoUnitPage2(MPT_ADAPTER *ioc)if ((rc =mpt_config (ioc, &cfg)) ==0 ) ioc->biosVersion =le32_to_cpu (ppage_alloc->BiosVersion); -pci_free_consistent (ioc->pcidev, data_sz, (u8 *) ppage_alloc, page_dma); +dma_free_coherent (&ioc->pcidev->dev, data_sz, + (u8 *)ppage_alloc, page_dma); }return rc;
@@ -5456,7 +5456,9 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) } }if (pbuf) { -pci_free_consistent (ioc->pcidev, header.PageLength *4 , pbuf, buf_dma); +dma_free_coherent (&ioc->pcidev->dev, + header.PageLength *4 , pbuf, + buf_dma); } } }
@@ -5543,7 +5545,9 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) } } -pci_free_consistent (ioc->pcidev, header.PageLength *4 , pbuf, buf_dma); +dma_free_coherent (&ioc->pcidev->dev, + header.PageLength *4 , pbuf, + buf_dma); } }
@@ -5707,8 +5711,8 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *ioc, u8 channel, u8 id) out:if (buffer) -pci_free_consistent (ioc->pcidev, hdr.PageLength *4 , buffer, - dma_handle); +dma_free_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + buffer, dma_handle); }/**
@@ -5776,8 +5780,8 @@ mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, out:if (buffer) -pci_free_consistent (ioc->pcidev, hdr.PageLength *4 , buffer, - dma_handle); +dma_free_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + buffer, dma_handle);return rc; }
@@ -5840,8 +5844,8 @@ mpt_raid_phys_disk_get_num_paths(MPT_ADAPTER *ioc, u8 phys_disk_num) out:if (buffer) -pci_free_consistent (ioc->pcidev, hdr.PageLength *4 , buffer, - dma_handle); +dma_free_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + buffer, dma_handle);return rc; }
@@ -5929,8 +5933,8 @@ mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num, out:if (buffer) -pci_free_consistent (ioc->pcidev, hdr.PageLength *4 , buffer, - dma_handle); +dma_free_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + buffer, dma_handle);return rc; }
@@ -6011,7 +6015,7 @@ mpt_findImVolumes(MPT_ADAPTER *ioc) pIoc2->RaidVolume[i].VolumeID); out: -pci_free_consistent (ioc->pcidev, iocpage2sz, pIoc2, ioc2_dma); +dma_free_coherent (&ioc->pcidev->dev, iocpage2sz, pIoc2, ioc2_dma);return rc; }
@@ -6070,7 +6074,7 @@ mpt_read_ioc_pg_3(MPT_ADAPTER *ioc) } } -pci_free_consistent (ioc->pcidev, iocpage3sz, pIoc3, ioc3_dma); +dma_free_coherent (&ioc->pcidev->dev, iocpage3sz, pIoc3, ioc3_dma);return 0 ; }
@@ -6122,7 +6126,8 @@ mpt_read_ioc_pg_4(MPT_ADAPTER *ioc) ioc->spi_data.IocPg4_dma = ioc4_dma; ioc->spi_data.IocPg4Sz = iocpage4sz; }else { -pci_free_consistent (ioc->pcidev, iocpage4sz, pIoc4, ioc4_dma); +dma_free_coherent (&ioc->pcidev->dev, iocpage4sz, pIoc4, + ioc4_dma); ioc->spi_data.pIocPg4 =NULL ; ioc->alloc_total -= iocpage4sz; }
@@ -6210,7 +6215,7 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc) } } -pci_free_consistent (ioc->pcidev, iocpage1sz, pIoc1, ioc1_dma); +dma_free_coherent (&ioc->pcidev->dev, iocpage1sz, pIoc1, ioc1_dma);return ; }
@@ -6255,7 +6260,8 @@ mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc) out:if (pbuf) -pci_free_consistent (ioc->pcidev, hdr.PageLength *4 , pbuf, buf_dma); +dma_free_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , pbuf, + buf_dma); }/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
drivers/message/fusion/mptctl.c +30 -21
126 lines not on this page · raw message
drivers/message/fusion/mptlan.c +48 -42
178 lines not on this page · raw message
drivers/message/fusion/mptsas.c +26 -25
137 lines not on this page · raw message
Signature · 1 line
2.32.0
Re: [PATCH 10/16] scsi: message: fusion: Remove usage of the deprecated "pci-dma-compat.h" API
Looks good,
PATCH 11/16 scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()'
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
mpt_alloc_fw_memory() should still use GFP_ATOMIC, because it can be called from mpt_do_upload() which might sleep.
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
---
Instead of using GFP_ATOMIC, we could pass the 'sleepFlag' from mpt_do_upload() and check all other callers to pass the expected flag.
--- drivers/message/fusion/mptbase.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/message/fusion/mptbase.c +2 -1
@@ -3512,7 +3512,8 @@ mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size) rc =0 ; goto out; } - ioc->cached_fw =pci_alloc_consistent (ioc->pcidev, size, &ioc->cached_fw_dma); + ioc->cached_fw =dma_alloc_coherent (&ioc->pcidev->dev, size, + &ioc->cached_fw_dma,GFP_ATOMIC );if (!ioc->cached_fw) {printk (MYIOC_s_ERR_FMT"Unable to allocate memory for the cached firmware image!\n" , ioc->name);
Signature · 1 line
2.32.0
Re: [PATCH 11/16] scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()'
Looks good,
PATCH 12/16 scsi: mptbase: Use dma_alloc_coherent()
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
In all these places where some memory is allocated GFP_KERNEL can be used because they already call mpt_config() which has an explicit might_sleep().
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
--- drivers/message/fusion/mptbase.c | 52 ++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 20 deletions(-)
drivers/message/fusion/mptbase.c +32 -20
@@ -300,8 +300,8 @@ mpt_is_discovery_complete(MPT_ADAPTER *ioc)if (!hdr.ExtPageLength) goto out; - buffer =pci_alloc_consistent (ioc->pcidev, hdr.ExtPageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.ExtPageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) goto out;
@@ -4966,7 +4966,8 @@ GetLanConfigPages(MPT_ADAPTER *ioc)if (hdr.PageLength >0 ) { data_sz = hdr.PageLength *4 ; - ppage0_alloc =pci_alloc_consistent (ioc->pcidev, data_sz, &page0_dma); + ppage0_alloc =dma_alloc_coherent (&ioc->pcidev->dev, data_sz, + &page0_dma,GFP_KERNEL ); rc = -ENOMEM ;if (ppage0_alloc) {memset ((u8 *)ppage0_alloc,0 , data_sz);
@@ -5013,7 +5014,8 @@ GetLanConfigPages(MPT_ADAPTER *ioc) data_sz = hdr.PageLength *4 ; rc = -ENOMEM ; - ppage1_alloc =pci_alloc_consistent (ioc->pcidev, data_sz, &page1_dma); + ppage1_alloc =dma_alloc_coherent (&ioc->pcidev->dev, data_sz, + &page1_dma,GFP_KERNEL );if (ppage1_alloc) {memset ((u8 *)ppage1_alloc,0 , data_sz); cfg.physAddr = page1_dma;
@@ -5315,7 +5317,8 @@ GetIoUnitPage2(MPT_ADAPTER *ioc)/* Read the config page */ data_sz = hdr.PageLength *4 ; rc = -ENOMEM ; - ppage_alloc =pci_alloc_consistent (ioc->pcidev, data_sz, &page_dma); + ppage_alloc =dma_alloc_coherent (&ioc->pcidev->dev, data_sz, + &page_dma,GFP_KERNEL );if (ppage_alloc) {memset ((u8 *)ppage_alloc,0 , data_sz); cfg.physAddr = page_dma;
@@ -5401,7 +5404,9 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)return -EFAULT ;if (header.PageLength >0 ) { - pbuf =pci_alloc_consistent (ioc->pcidev, header.PageLength *4 , &buf_dma); + pbuf =dma_alloc_coherent (&ioc->pcidev->dev, + header.PageLength *4 , &buf_dma, +GFP_KERNEL );if (pbuf) { cfg.action =MPI_CONFIG_ACTION_PAGE_READ_CURRENT ; cfg.physAddr = buf_dma;
@@ -5481,7 +5486,9 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)if (header.PageLength >0 ) {/* Allocate memory and read SCSI Port Page 2 */ - pbuf =pci_alloc_consistent (ioc->pcidev, header.PageLength *4 , &buf_dma); + pbuf =dma_alloc_coherent (&ioc->pcidev->dev, + header.PageLength *4 , &buf_dma, +GFP_KERNEL );if (pbuf) { cfg.action =MPI_CONFIG_ACTION_PAGE_READ_NVRAM ; cfg.physAddr = buf_dma;
@@ -5664,8 +5671,8 @@ mpt_inactive_raid_volumes(MPT_ADAPTER *ioc, u8 channel, u8 id)if (!hdr.PageLength) goto out; - buffer =pci_alloc_consistent (ioc->pcidev, hdr.PageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) goto out;
@@ -5757,8 +5764,8 @@ mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, goto out; } - buffer =pci_alloc_consistent (ioc->pcidev, hdr.PageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) { rc = -ENOMEM ;
@@ -5824,8 +5831,8 @@ mpt_raid_phys_disk_get_num_paths(MPT_ADAPTER *ioc, u8 phys_disk_num) goto out; } - buffer =pci_alloc_consistent (ioc->pcidev, hdr.PageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) { rc =0 ;
@@ -5896,8 +5903,8 @@ mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num, goto out; } - buffer =pci_alloc_consistent (ioc->pcidev, hdr.PageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) { rc = -ENOMEM ;
@@ -5991,7 +5998,8 @@ mpt_findImVolumes(MPT_ADAPTER *ioc)return -EFAULT ; iocpage2sz = header.PageLength *4 ; - pIoc2 =pci_alloc_consistent (ioc->pcidev, iocpage2sz, &ioc2_dma); + pIoc2 =dma_alloc_coherent (&ioc->pcidev->dev, iocpage2sz, &ioc2_dma, +GFP_KERNEL );if (!pIoc2)return -ENOMEM ;
@@ -6058,7 +6066,8 @@ mpt_read_ioc_pg_3(MPT_ADAPTER *ioc)/* Read Header good, alloc memory */ iocpage3sz = header.PageLength *4 ; - pIoc3 =pci_alloc_consistent (ioc->pcidev, iocpage3sz, &ioc3_dma); + pIoc3 =dma_alloc_coherent (&ioc->pcidev->dev, iocpage3sz, &ioc3_dma, +GFP_KERNEL );if (!pIoc3)return 0 ;
@@ -6109,7 +6118,8 @@ mpt_read_ioc_pg_4(MPT_ADAPTER *ioc)if ( (pIoc4 = ioc->spi_data.pIocPg4) ==NULL ) { iocpage4sz = (header.PageLength +4 ) *4 ;/* Allow 4 additional SEP's */ - pIoc4 =pci_alloc_consistent (ioc->pcidev, iocpage4sz, &ioc4_dma); + pIoc4 =dma_alloc_coherent (&ioc->pcidev->dev, iocpage4sz, + &ioc4_dma,GFP_KERNEL );if (!pIoc4)return ; ioc->alloc_total += iocpage4sz;
@@ -6165,7 +6175,8 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)/* Read Header good, alloc memory */ iocpage1sz = header.PageLength *4 ; - pIoc1 =pci_alloc_consistent (ioc->pcidev, iocpage1sz, &ioc1_dma); + pIoc1 =dma_alloc_coherent (&ioc->pcidev->dev, iocpage1sz, &ioc1_dma, +GFP_KERNEL );if (!pIoc1)return ;
@@ -6245,7 +6256,8 @@ mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc) goto out; cfg.action =MPI_CONFIG_ACTION_PAGE_READ_CURRENT ; - pbuf =pci_alloc_consistent (ioc->pcidev, hdr.PageLength *4 , &buf_dma); + pbuf =dma_alloc_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + &buf_dma,GFP_KERNEL );if (!pbuf) goto out;
Signature · 1 line
2.32.0
Re: [PATCH 12/16] scsi: mptbase: Use dma_alloc_coherent()
Looks good,
PATCH 13/16 scsi: mptsas: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info()
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
The only caller of mptsas_exp_repmanufacture_info() is mptsas_probe_one_phy(). This function already calls sas_end_device_alloc() or sas_expander_alloc(). They both already use GFP_KERNEL.
As no spin_lock is held at this point, it is safe to also use GFP_KERNEL here.
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
--- drivers/message/fusion/mptsas.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/message/fusion/mptsas.c +2 -1
@@ -2896,7 +2896,8 @@ mptsas_exp_repmanufacture_info(MPT_ADAPTER *ioc, sz =sizeof (struct rep_manu_request ) +sizeof (struct rep_manu_reply ); - data_out =pci_alloc_consistent (ioc->pcidev, sz, &data_out_dma); + data_out =dma_alloc_coherent (&ioc->pcidev->dev, sz, &data_out_dma, +GFP_KERNEL );if (!data_out) {printk (KERN_ERR "Memory allocation failure at %s:%d/%s()!\n" , __FILE__, __LINE__, __func__);
Signature · 1 line
2.32.0
Re: [PATCH 13/16] scsi: mptsas: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info()
Looks good,
PATCH 14/16 scsi: mptsas: Use dma_alloc_coherent()
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
In all these places where some memory is allocated GFP_KERNEL can be used because they already call mpt_config() which has an explicit might_sleep().
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
--- drivers/message/fusion/mptsas.c | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/message/fusion/mptsas.c +20 -20
@@ -702,8 +702,8 @@ mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc,if (!hdr.PageLength) goto out; - buffer =pci_alloc_consistent (ioc->pcidev, hdr.PageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) goto out;
@@ -1399,8 +1399,8 @@ mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure, goto out; } - buffer =pci_alloc_consistent (ioc->pcidev, hdr.ExtPageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.ExtPageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) { error = -ENOMEM ; goto out;
@@ -2058,8 +2058,8 @@ static int mptsas_get_linkerrors(struct sas_phy *phy)if (!hdr.ExtPageLength)return -ENXIO ; - buffer =pci_alloc_consistent (ioc->pcidev, hdr.ExtPageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.ExtPageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer)return -ENOMEM ;
@@ -2412,8 +2412,8 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info) goto out; } - buffer =pci_alloc_consistent (ioc->pcidev, hdr.ExtPageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.ExtPageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) { error = -ENOMEM ; goto out;
@@ -2487,8 +2487,8 @@ mptsas_sas_io_unit_pg1(MPT_ADAPTER *ioc) goto out; } - buffer =pci_alloc_consistent (ioc->pcidev, hdr.ExtPageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.ExtPageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) { error = -ENOMEM ; goto out;
@@ -2551,8 +2551,8 @@ mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, goto out; } - buffer =pci_alloc_consistent (ioc->pcidev, hdr.ExtPageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.ExtPageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) { error = -ENOMEM ; goto out;
@@ -2614,8 +2614,8 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info, goto out; } - buffer =pci_alloc_consistent (ioc->pcidev, hdr.ExtPageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.ExtPageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) { error = -ENOMEM ; goto out;
@@ -2697,8 +2697,8 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info, goto out; } - buffer =pci_alloc_consistent (ioc->pcidev, hdr.ExtPageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.ExtPageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) { error = -ENOMEM ; goto out;
@@ -2777,8 +2777,8 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, goto out; } - buffer =pci_alloc_consistent (ioc->pcidev, hdr.ExtPageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.ExtPageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) { error = -ENOMEM ; goto out;
@@ -4273,8 +4273,8 @@ mptsas_adding_inactive_raid_components(MPT_ADAPTER *ioc, u8 channel, u8 id)if (!hdr.PageLength) goto out; - buffer =pci_alloc_consistent (ioc->pcidev, hdr.PageLength *4 , - &dma_handle); + buffer =dma_alloc_coherent (&ioc->pcidev->dev, hdr.PageLength *4 , + &dma_handle,GFP_KERNEL );if (!buffer) goto out;
Signature · 1 line
2.32.0
Re: [PATCH 14/16] scsi: mptsas: Use dma_alloc_coherent()
Looks good,
PATCH 15/16 scsi: mptctl: Use dma_alloc_coherent()
In reply to Christophe JAILLETIn [1], Christoph Hellwig has proposed to remove the wrappers in include/linux/pci-dma-compat.h.
Some reasons why this API should be removed have been given by Julia Lawall in [2].
When memory is allocated in kbuf_alloc_2_sgl() GFP_KERNEL can be used because this function already uses the GFP_USER flag for some memory allocation and not spin_lock is taken in the between.
When memory is allocated in mptctl_do_mpt_command() GFP_KERNEL can be used because this function already uses copy_from_user() and this function can sleep.
When memory is allocated in mptctl_hp_hostinfo() GFP_KERNEL can be used because this function already uses mpt_config() and this function has an explicit might_sleep().
When memory is allocated in mptctl_hp_targetinfo() GFP_KERNEL can be used because this function already uses mpt_config() and this function has an explicit might_sleep().
[1]: https://lore.kernel.org/kernel-janitors/[email protected]/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
---
I'm a bit unsure about the use of GFP_KERNEL in kbuf_alloc_2_sgl().
In all conversion that I've done, GFP_USER was never used. I don't fully understand the difference between GFP_USER and GFP_KERNEL.
--- drivers/message/fusion/mptctl.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
drivers/message/fusion/mptctl.c +19 -12
@@ -1041,7 +1041,8 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,* copying the data in this array into the correct place in the * request and chain buffers. */ - sglbuf =pci_alloc_consistent (ioc->pcidev,MAX_SGL_BYTES , sglbuf_dma); + sglbuf =dma_alloc_coherent (&ioc->pcidev->dev,MAX_SGL_BYTES , + sglbuf_dma,GFP_KERNEL );if (sglbuf ==NULL ) goto free_and_fail;
@@ -1062,9 +1063,9 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,while (bytes_allocd < bytes) { this_alloc =min (alloc_sz, bytes-bytes_allocd); buflist[buflist_ent].len = this_alloc; - buflist[buflist_ent].kptr =pci_alloc_consistent (ioc->pcidev, - this_alloc, - &pa); + buflist[buflist_ent].kptr =dma_alloc_coherent (&ioc->pcidev->dev, + this_alloc, + &pa,GFP_KERNEL );if (buflist[buflist_ent].kptr ==NULL ) { alloc_sz = alloc_sz /2 ;if (alloc_sz ==0 ) {
@@ -2105,8 +2106,9 @@ mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __u } flagsLength |= karg.dataOutSize; bufOut.len = karg.dataOutSize; - bufOut.kptr =pci_alloc_consistent ( - ioc->pcidev, bufOut.len, &dma_addr_out); + bufOut.kptr =dma_alloc_coherent (&ioc->pcidev->dev, + bufOut.len, + &dma_addr_out,GFP_KERNEL );if (bufOut.kptr ==NULL ) { rc = -ENOMEM ;
@@ -2139,8 +2141,9 @@ mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __u flagsLength |= karg.dataInSize; bufIn.len = karg.dataInSize; - bufIn.kptr =pci_alloc_consistent (ioc->pcidev, - bufIn.len, &dma_addr_in); + bufIn.kptr =dma_alloc_coherent (&ioc->pcidev->dev, + bufIn.len, + &dma_addr_in,GFP_KERNEL );if (bufIn.kptr ==NULL ) { rc = -ENOMEM ;
@@ -2400,7 +2403,9 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)/* Issue the second config page request */ cfg.action =MPI_CONFIG_ACTION_PAGE_READ_CURRENT ; - pbuf =pci_alloc_consistent (ioc->pcidev, hdr.PageLength *4 , &buf_dma); + pbuf =dma_alloc_coherent (&ioc->pcidev->dev, + hdr.PageLength *4 , + &buf_dma,GFP_KERNEL );if (pbuf) { cfg.physAddr = buf_dma;if (mpt_config (ioc, &cfg) ==0 ) {
@@ -2477,7 +2482,7 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)else IstwiRWRequest->DeviceAddr =0xB0 ; - pbuf =pci_alloc_consistent (ioc->pcidev,4 , &buf_dma); + pbuf =dma_alloc_coherent (&ioc->pcidev->dev,4 , &buf_dma,GFP_KERNEL );if (!pbuf) goto out; ioc->add_sge((char *)&IstwiRWRequest->SGL,
@@ -2592,7 +2597,8 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg)/* Get the data transfer speeds */ data_sz = ioc->spi_data.sdp0length *4 ; - pg0_alloc =pci_alloc_consistent (ioc->pcidev, data_sz, &page_dma); + pg0_alloc =dma_alloc_coherent (&ioc->pcidev->dev, data_sz, &page_dma, +GFP_KERNEL );if (pg0_alloc) { hdr.PageVersion = ioc->spi_data.sdp0version; hdr.PageLength = data_sz;
@@ -2657,7 +2663,8 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg)/* Issue the second config page request */ cfg.action =MPI_CONFIG_ACTION_PAGE_READ_CURRENT ; data_sz = (int ) cfg.cfghdr.hdr->PageLength *4 ; - pg3_alloc =pci_alloc_consistent (ioc->pcidev, data_sz, &page_dma); + pg3_alloc =dma_alloc_coherent (&ioc->pcidev->dev, data_sz, + &page_dma,GFP_KERNEL );if (pg3_alloc) { cfg.physAddr = page_dma; cfg.pageAddr = (karg.hdr.channel <<8 ) | karg.hdr.id;
Signature · 1 line
2.32.0
Re: [PATCH 15/16] scsi: mptctl: Use dma_alloc_coherent()
Looks good,
PATCH 16/16 PCI: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETFinal step, remove pci-dma-compat.h
--- include/linux/pci-dma-compat.h | 129 --------------------------------- include/linux/pci.h | 3 - 2 files changed, 132 deletions(-) delete mode 100644 include/linux/pci-dma-compat.h
include/linux/pci-dma-compat.h deleted +0 -129
@@ -1,129 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* include this file if the platform implements the dma_ DMA Mapping API -* and wants to provide the pci_ DMA Mapping API in terms of it */ - -#ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H -#define _ASM_GENERIC_PCI_DMA_COMPAT_H - -#include <linux/dma-mapping.h> - -/* This defines the direction arg to the DMA mapping routines. */ -#define PCI_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL -#define PCI_DMA_TODEVICE DMA_TO_DEVICE -#define PCI_DMA_FROMDEVICE DMA_FROM_DEVICE -#define PCI_DMA_NONE DMA_NONE - -static inline void * -pci_alloc_consistent (struct pci_dev *hwdev,size_t size, -dma_addr_t *dma_handle) -{ -return dma_alloc_coherent (&hwdev->dev, size, dma_handle,GFP_ATOMIC ); -} - -static inline void * -pci_zalloc_consistent (struct pci_dev *hwdev,size_t size, -dma_addr_t *dma_handle) -{ -return dma_alloc_coherent (&hwdev->dev, size, dma_handle,GFP_ATOMIC ); -} - -static inline void -pci_free_consistent (struct pci_dev *hwdev,size_t size, -void *vaddr,dma_addr_t dma_handle) -{ -dma_free_coherent (&hwdev->dev, size, vaddr, dma_handle); -} - -static inline dma_addr_t -pci_map_single (struct pci_dev *hwdev,void *ptr,size_t size,int direction) -{ -return dma_map_single (&hwdev->dev, ptr, size, (enum dma_data_direction )direction); -} - -static inline void -pci_unmap_single (struct pci_dev *hwdev,dma_addr_t dma_addr, -size_t size,int direction) -{ -dma_unmap_single (&hwdev->dev, dma_addr, size, (enum dma_data_direction )direction); -} - -static inline dma_addr_t -pci_map_page (struct pci_dev *hwdev,struct page *page, -unsigned long offset,size_t size,int direction) -{ -return dma_map_page (&hwdev->dev, page, offset, size, (enum dma_data_direction )direction); -} - -static inline void -pci_unmap_page (struct pci_dev *hwdev,dma_addr_t dma_address, -size_t size,int direction) -{ -dma_unmap_page (&hwdev->dev, dma_address, size, (enum dma_data_direction )direction); -} - -static inline int -pci_map_sg (struct pci_dev *hwdev,struct scatterlist *sg, -int nents,int direction) -{ -return dma_map_sg (&hwdev->dev, sg, nents, (enum dma_data_direction )direction); -} - -static inline void -pci_unmap_sg (struct pci_dev *hwdev,struct scatterlist *sg, -int nents,int direction) -{ -dma_unmap_sg (&hwdev->dev, sg, nents, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_single_for_cpu (struct pci_dev *hwdev,dma_addr_t dma_handle, -size_t size,int direction) -{ -dma_sync_single_for_cpu (&hwdev->dev, dma_handle, size, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_single_for_device (struct pci_dev *hwdev,dma_addr_t dma_handle, -size_t size,int direction) -{ -dma_sync_single_for_device (&hwdev->dev, dma_handle, size, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_sg_for_cpu (struct pci_dev *hwdev,struct scatterlist *sg, -int nelems,int direction) -{ -dma_sync_sg_for_cpu (&hwdev->dev, sg, nelems, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_sg_for_device (struct pci_dev *hwdev,struct scatterlist *sg, -int nelems,int direction) -{ -dma_sync_sg_for_device (&hwdev->dev, sg, nelems, (enum dma_data_direction )direction); -} - -static inline int -pci_dma_mapping_error (struct pci_dev *pdev,dma_addr_t dma_addr) -{ -return dma_mapping_error (&pdev->dev, dma_addr); -} - -#ifdef CONFIG_PCI -static inline int pci_set_dma_mask (struct pci_dev *dev,u64 mask) -{ -return dma_set_mask (&dev->dev, mask); -} - -static inline int pci_set_consistent_dma_mask (struct pci_dev *dev,u64 mask) -{ -return dma_set_coherent_mask (&dev->dev, mask); -} -#else -static inline int pci_set_dma_mask (struct pci_dev *dev,u64 mask) -{return -EIO ; } -static inline int pci_set_consistent_dma_mask (struct pci_dev *dev,u64 mask) -{return -EIO ; } -#endif - -#endif
include/linux/pci.h +0 -3
@@ -2455,9 +2455,6 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)void pci_uevent_ers (struct pci_dev *pdev,enum pci_ers_result err_type);#endif -/* Provide the legacy pci_dma_* API */ -#include <linux/pci-dma-compat.h> - #define pci_printk(level, pdev, fmt, arg...) \ dev_printk(level, &(pdev)->dev, fmt, ##arg)
Signature · 1 line
2.32.0
Re: [PATCH 16/16] PCI: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 3 lines · Christophe JAILLET
Final step, remove
pci-dma-compat.hSigned-off-by Christophe JAILLET <[email protected]>
Obviously this has to be applied after all the others, so I assume somebody else will take this.
Quoted 158 lines
--- include/linux/pci-dma-compat.h | 129 --------------------------------- include/linux/pci.h | 3 - 2 files changed, 132 deletions(-) delete mode 100644 include/linux/pci-dma-compat.hinclude/linux/pci-dma-compat.h deleted +0
-129@@ -1,129 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* include this file if the platform implements the dma_ DMA Mapping API -* and wants to provide the pci_ DMA Mapping API in terms of it */ - -#ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H -#define _ASM_GENERIC_PCI_DMA_COMPAT_H - -#include <linux/dma-mapping.h> - -/* This defines the direction arg to the DMA mapping routines. */ -#define PCI_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL -#define PCI_DMA_TODEVICE DMA_TO_DEVICE -#define PCI_DMA_FROMDEVICE DMA_FROM_DEVICE -#define PCI_DMA_NONE DMA_NONE - -static inline void * -pci_alloc_consistent (struct pci_dev *hwdev,size_t size, -dma_addr_t *dma_handle) -{ -return dma_alloc_coherent (&hwdev->dev, size, dma_handle,GFP_ATOMIC ); -} - -static inline void * -pci_zalloc_consistent (struct pci_dev *hwdev,size_t size, -dma_addr_t *dma_handle) -{ -return dma_alloc_coherent (&hwdev->dev, size, dma_handle,GFP_ATOMIC ); -} - -static inline void -pci_free_consistent (struct pci_dev *hwdev,size_t size, -void *vaddr,dma_addr_t dma_handle) -{ -dma_free_coherent (&hwdev->dev, size, vaddr, dma_handle); -} - -static inline dma_addr_t -pci_map_single (struct pci_dev *hwdev,void *ptr,size_t size,int direction) -{ -return dma_map_single (&hwdev->dev, ptr, size, (enum dma_data_direction )direction); -} - -static inline void -pci_unmap_single (struct pci_dev *hwdev,dma_addr_t dma_addr, -size_t size,int direction) -{ -dma_unmap_single (&hwdev->dev, dma_addr, size, (enum dma_data_direction )direction); -} - -static inline dma_addr_t -pci_map_page (struct pci_dev *hwdev,struct page *page, -unsigned long offset,size_t size,int direction) -{ -return dma_map_page (&hwdev->dev, page, offset, size, (enum dma_data_direction )direction); -} - -static inline void -pci_unmap_page (struct pci_dev *hwdev,dma_addr_t dma_address, -size_t size,int direction) -{ -dma_unmap_page (&hwdev->dev, dma_address, size, (enum dma_data_direction )direction); -} - -static inline int -pci_map_sg (struct pci_dev *hwdev,struct scatterlist *sg, -int nents,int direction) -{ -return dma_map_sg (&hwdev->dev, sg, nents, (enum dma_data_direction )direction); -} - -static inline void -pci_unmap_sg (struct pci_dev *hwdev,struct scatterlist *sg, -int nents,int direction) -{ -dma_unmap_sg (&hwdev->dev, sg, nents, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_single_for_cpu (struct pci_dev *hwdev,dma_addr_t dma_handle, -size_t size,int direction) -{ -dma_sync_single_for_cpu (&hwdev->dev, dma_handle, size, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_single_for_device (struct pci_dev *hwdev,dma_addr_t dma_handle, -size_t size,int direction) -{ -dma_sync_single_for_device (&hwdev->dev, dma_handle, size, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_sg_for_cpu (struct pci_dev *hwdev,struct scatterlist *sg, -int nelems,int direction) -{ -dma_sync_sg_for_cpu (&hwdev->dev, sg, nelems, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_sg_for_device (struct pci_dev *hwdev,struct scatterlist *sg, -int nelems,int direction) -{ -dma_sync_sg_for_device (&hwdev->dev, sg, nelems, (enum dma_data_direction )direction); -} - -static inline int -pci_dma_mapping_error (struct pci_dev *pdev,dma_addr_t dma_addr) -{ -return dma_mapping_error (&pdev->dev, dma_addr); -} - -#ifdef CONFIG_PCI -static inline int pci_set_dma_mask (struct pci_dev *dev,u64 mask) -{ -return dma_set_mask (&dev->dev, mask); -} - -static inline int pci_set_consistent_dma_mask (struct pci_dev *dev,u64 mask) -{ -return dma_set_coherent_mask (&dev->dev, mask); -} -#else -static inline int pci_set_dma_mask (struct pci_dev *dev,u64 mask) -{return -EIO ; } -static inline int pci_set_consistent_dma_mask (struct pci_dev *dev,u64 mask) -{return -EIO ; } -#endif - -#endif include/linux/pci.h +0
-3@@ -2455,9 +2455,6 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)void pci_uevent_ers (struct pci_dev *pdev,enum pci_ers_result err_type);#endif -/* Provide the legacy pci_dma_* API */ -#include <linux/pci-dma-compat.h> - #define pci_printk(level, pdev, fmt, arg...) \ dev_printk(level, &(pdev)->dev, fmt, ##arg)Signature · 1 line
2.32.0
Re: [PATCH 16/16] PCI: Remove usage of the deprecated "pci-dma-compat.h" API
Le 06/01/2022 à 23:28, Bjorn Helgaas a écrit :
Quoted 159 lines · Christophe JAILLET
Quoted 3 lines
Final step, remove
pci-dma-compat.hSigned-off-by Christophe JAILLET <[email protected]>Acked-by Bjorn Helgaas <[email protected]>Obviously this has to be applied after all the others, so I assume somebody else will take this.
Quoted 149 lines
--- include/linux/pci-dma-compat.h | 129 --------------------------------- include/linux/pci.h | 3 - 2 files changed, 132 deletions(-)delete mode 100644
include/linux/pci-dma-compat.hinclude/linux/pci-dma-compat.h deleted +0
-129@@ -1,129 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* include this file if the platform implements the dma_ DMA Mapping API -* and wants to provide the pci_ DMA Mapping API in terms of it */ - -#ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H -#define _ASM_GENERIC_PCI_DMA_COMPAT_H - -#include <linux/dma-mapping.h> - -/* This defines the direction arg to the DMA mapping routines. */ -#define PCI_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL -#define PCI_DMA_TODEVICE DMA_TO_DEVICE -#define PCI_DMA_FROMDEVICE DMA_FROM_DEVICE -#define PCI_DMA_NONE DMA_NONE - -static inline void * -pci_alloc_consistent (struct pci_dev *hwdev,size_t size, -dma_addr_t *dma_handle) -{ -return dma_alloc_coherent (&hwdev->dev, size, dma_handle,GFP_ATOMIC ); -} - -static inline void * -pci_zalloc_consistent (struct pci_dev *hwdev,size_t size, -dma_addr_t *dma_handle) -{ -return dma_alloc_coherent (&hwdev->dev, size, dma_handle,GFP_ATOMIC ); -} - -static inline void -pci_free_consistent (struct pci_dev *hwdev,size_t size, -void *vaddr,dma_addr_t dma_handle) -{ -dma_free_coherent (&hwdev->dev, size, vaddr, dma_handle); -} - -static inline dma_addr_t -pci_map_single (struct pci_dev *hwdev,void *ptr,size_t size,int direction) -{ -return dma_map_single (&hwdev->dev, ptr, size, (enum dma_data_direction )direction); -} - -static inline void -pci_unmap_single (struct pci_dev *hwdev,dma_addr_t dma_addr, -size_t size,int direction) -{ -dma_unmap_single (&hwdev->dev, dma_addr, size, (enum dma_data_direction )direction); -} - -static inline dma_addr_t -pci_map_page (struct pci_dev *hwdev,struct page *page, -unsigned long offset,size_t size,int direction) -{ -return dma_map_page (&hwdev->dev, page, offset, size, (enum dma_data_direction )direction); -} - -static inline void -pci_unmap_page (struct pci_dev *hwdev,dma_addr_t dma_address, -size_t size,int direction) -{ -dma_unmap_page (&hwdev->dev, dma_address, size, (enum dma_data_direction )direction); -} - -static inline int -pci_map_sg (struct pci_dev *hwdev,struct scatterlist *sg, -int nents,int direction) -{ -return dma_map_sg (&hwdev->dev, sg, nents, (enum dma_data_direction )direction); -} - -static inline void -pci_unmap_sg (struct pci_dev *hwdev,struct scatterlist *sg, -int nents,int direction) -{ -dma_unmap_sg (&hwdev->dev, sg, nents, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_single_for_cpu (struct pci_dev *hwdev,dma_addr_t dma_handle, -size_t size,int direction) -{ -dma_sync_single_for_cpu (&hwdev->dev, dma_handle, size, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_single_for_device (struct pci_dev *hwdev,dma_addr_t dma_handle, -size_t size,int direction) -{ -dma_sync_single_for_device (&hwdev->dev, dma_handle, size, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_sg_for_cpu (struct pci_dev *hwdev,struct scatterlist *sg, -int nelems,int direction) -{ -dma_sync_sg_for_cpu (&hwdev->dev, sg, nelems, (enum dma_data_direction )direction); -} - -static inline void -pci_dma_sync_sg_for_device (struct pci_dev *hwdev,struct scatterlist *sg, -int nelems,int direction) -{ -dma_sync_sg_for_device (&hwdev->dev, sg, nelems, (enum dma_data_direction )direction); -} - -static inline int -pci_dma_mapping_error (struct pci_dev *pdev,dma_addr_t dma_addr) -{ -return dma_mapping_error (&pdev->dev, dma_addr); -} - -#ifdef CONFIG_PCI -static inline int pci_set_dma_mask (struct pci_dev *dev,u64 mask) -{ -return dma_set_mask (&dev->dev, mask); -} - -static inline int pci_set_consistent_dma_mask (struct pci_dev *dev,u64 mask) -{ -return dma_set_coherent_mask (&dev->dev, mask); -} -#else -static inline int pci_set_dma_mask (struct pci_dev *dev,u64 mask) -{return -EIO ; } -static inline int pci_set_consistent_dma_mask (struct pci_dev *dev,u64 mask) -{return -EIO ; } -#endif - -#endif include/linux/pci.h +0
-0@@ -2455,9 +2455,6 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)void pci_uevent_ers (struct pci_dev *pdev,enum pci_ers_result err_type);#endif
Quoted 3 lines
include/linux/pci.h static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev) · line 2460
Quoted 3 lines
include/linux/pci.h +0
-3-/* Provide the legacy pci_dma_* API */ -#include <linux/pci-dma-compat.h> -
After one more night, I should have mentionned that the way have removed "pci-dma-compat.h" may break OTHER drives because of indirect include.
The line above should maybe be replaced by:
#include <linux/dma-mapping.h>
which is hidden in "pci-dma-compat.h".
Will see if built-bots complain.
CJ
Quoted 7 lines
Quoted 6 lines
include/linux/pci.h +0
-0#define pci_printk(level, pdev, fmt, arg...) \ dev_printk(level, &(pdev)->dev, fmt, ##arg)Signature · 1 line
2.32.0
Re: [PATCH 16/16] PCI: Remove usage of the deprecated "pci-dma-compat.h" API
Le 07/01/2022 à 07:34, Christophe JAILLET a écrit :
Quoted 48 lines
Le 06/01/2022 à 23:28, Bjorn Helgaas a écrit :
Quoted 36 lines · Christophe JAILLET
Quoted 3 lines
Final step, remove
pci-dma-compat.hSigned-off-by Christophe JAILLET <[email protected]>Acked-by Bjorn Helgaas <[email protected]>Obviously this has to be applied after all the others, so I assume somebody else will take this.
Quoted 26 lines
---
include/linux/pci-dma-compat.h| 129 --------------------------------- include/linux/pci.h | 3 -2 files changed, 132 deletions(-)delete mode 100644
include/linux/pci-dma-compat.hinclude/linux/pci-dma-compat.h deleted +0
-2@@ -1,129 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* include this file if the platform implements the dma_ DMA Mapping API
- * and wants to provide thepci_DMA Mapping API in terms of it */include/linux/pci-dma-compat.h deleted +0
-6- -#ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H -#define _ASM_GENERIC_PCI_DMA_COMPAT_H - -#include <linux/dma-mapping.h> - >>> diff --git a/include/linux/pci.h b/include/linux/pci.hindex
d4308f847e58..ba8771eaf380100644
---a/include/linux/pci.hQuoted 8 lines
include/linux/pci-dma-compat.h static inline bool · line 2460
Quoted 8 lines
+++
b/include/linux/pci.hinclude/linux/pci-dma-compat.h deleted +0
-3@@ -2455,9 +2455,6 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev) void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type); #endif -/* Provide the legacy pci_dma_* API */ -#include <linux/pci-dma-compat.h> -After one more night, I should have mentionned that the way have removed "
pci-dma-compat.h" may break OTHER drives because of indirect include.
Quoted 5 lines
The line above should maybe be replaced by:
#include <linux/dma-mapping.h>
which is hidden in "pci-dma-compat.h".Will see if built-bots complain.
And so they did.
What is the best option?
1. Add #include <linux/dma-mapping.h>? or
2. Add this "missing" include in needed place?
I would say 2, but I would need help, because I don't have a built farm at home! :)
This breaks:
drivers/s390/net/ism_drv.c: In function 'register_sba':
drivers/s390/net/ism_drv.c:93:15: error: implicit declaration of
function 'dma_alloc_coherent' [-Werror=implicit-function-declaration]
93 | sba = dma_alloc_coherent(&ism->pdev->dev, PAGE_SIZE,
&dma_handle,
| ^~~~~~~~~~~~~~~~~~[...]
I got another built failure that I don't understand:
In file included from drivers/scsi/fdomain.c:87:
Quoted 1 line
Quoted 1 line
include/scsi/scsicam.h:16:31: warning: 'structblock_device' declared inside parameter list will not be visible outside of this definition or declaration
16 | int scsicam_bios_param(struct block_device *bdev, sector_t
capacity, int *ip);
| ^~~~~~~~~~~~
include/scsi/scsicam.h:17:27: warning: 'struct block_device'
declared inside parameter list will not be visible outside of this definition or declaration
17 | bool scsi_partsize(struct block_device *bdev, sector_t
capacity, int geom[3]);
| ^~~~~~~~~~~~
include/scsi/scsicam.h:18:40: warning: 'struct block_device'
declared inside parameter list will not be visible outside of this definition or declaration
18 | unsigned char *scsi_bios_ptable(struct block_device *bdev);
| ^~~~~~~~~~~~ drivers/scsi/fdomain.c: In function 'fdomain_biosparam':
Quoted 1 line
Quoted 1 line
drivers/scsi/fdomain.c:468:45: error: passing argument 1 of 'scsi_bios_ptable' from incompatible pointer type [-Werror=incompatible-pointer-types]
468 | unsigned char *p = scsi_bios_ptable(bdev);
| ^~~~
| |
| struct block_device *
In file included from drivers/scsi/fdomain.c:87:
include/scsi/scsicam.h:18:54: note: expected 'struct block_device *'
but argument is of type 'struct block_device *'
18 | unsigned char *scsi_bios_ptable(struct block_device *bdev);
| ~~~~~~~~~~~~~~~~~~~~~^~~~CJ
Re: [PATCH 16/16] PCI: Remove usage of the deprecated "pci-dma-compat.h" API
Quoted 6 lines · Marion & Christophe JAILLET
What is the best option?
1. Add #include <linux/dma-mapping.h>? or
2. Add this "missing" include in needed place?I would say 2, but I would need help, because I don't have a built farm at home! :)
In the long run 2 is where we want to end up. But I'd do 1 first to get the legacy API removal finished, and then do 2 later after a lot of test coverage from the build bot.
kernel test robot
build botRe: [PATCH 16/16] PCI: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETThank you for the patch! Perhaps something to improve:
Hi Christophe,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on media-tree/master]
[also build test WARNING on helgaas-pci/next soc/for-next linus/master v5.16-rc8 next-20220106] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Christophe-JAILLET/Remove-usage-of-the-deprecated-pci-dma-compat-h-API/20220107-055614 base: git://linuxtv.org/media_tree.git master config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20220107/202201071756.7k3Nd6AQ-lkp(a)intel.com/config) compiler: s390-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/24f5ae55a3ed7f1638a921db66d8e2f428f2e79d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Christophe-JAILLET/Remove-usage-of-the-deprecated-pci-dma-compat-h-API/20220107-055614 git checkout 24f5ae55a3ed7f1638a921db66d8e2f428f2e79d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=s390 SHELL=/bin/bash drivers/s390/net/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/s390/net/ism_drv.c: In function 'register_sba':
drivers/s390/net/ism_drv.c:93:15: error: implicit declaration of function 'dma_alloc_coherent' [-Werror=implicit-function-declaration]
93 | sba = dma_alloc_coherent(&ism->pdev->dev, PAGE_SIZE, &dma_handle,
| ^~~~~~~~~~~~~~~~~~
>> drivers/s390/net/ism_drv.c:93:13: warning: assignment to 'struct ism_sba *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
93 | sba = dma_alloc_coherent(&ism->pdev->dev, PAGE_SIZE, &dma_handle,
| ^
drivers/s390/net/ism_drv.c:104:17: error: implicit declaration of function 'dma_free_coherent' [-Werror=implicit-function-declaration]
104 | dma_free_coherent(&ism->pdev->dev, PAGE_SIZE, sba, dma_handle);
| ^~~~~~~~~~~~~~~~~
drivers/s390/net/ism_drv.c: In function 'register_ieq':
>> drivers/s390/net/ism_drv.c:120:13: warning: assignment to 'struct ism_eq *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
120 | ieq = dma_alloc_coherent(&ism->pdev->dev, PAGE_SIZE, &dma_handle,
| ^
drivers/s390/net/ism_drv.c: In function 'ism_alloc_dmb':
drivers/s390/net/ism_drv.c:229:40: error: implicit declaration of function 'dma_get_max_seg_size' [-Werror=implicit-function-declaration]
229 | if (PAGE_ALIGN(dmb->dmb_len) > dma_get_max_seg_size(&ism->pdev->dev))
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/s390/net/ism_drv.c:244:23: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
244 | dmb->cpu_addr = dma_alloc_coherent(&ism->pdev->dev, dmb->dmb_len,
| ^
drivers/s390/net/ism_drv.c: In function 'ism_probe':
drivers/s390/net/ism_drv.c:558:15: error: implicit declaration of function 'dma_set_mask'; did you mean 'xa_set_mark'? [-Werror=implicit-function-declaration]
558 | ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
| ^~~~~~~~~~~~
| xa_set_mark
drivers/s390/net/ism_drv.c:558:40: error: implicit declaration of function 'DMA_BIT_MASK'; did you mean 'BIT_MASK'? [-Werror=implicit-function-declaration]
558 | ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
| ^~~~~~~~~~~~
| BIT_MASK
drivers/s390/net/ism_drv.c:562:9: error: implicit declaration of function 'dma_set_seg_boundary' [-Werror=implicit-function-declaration]
562 | dma_set_seg_boundary(&pdev->dev, SZ_1M - 1);
| ^~~~~~~~~~~~~~~~~~~~
drivers/s390/net/ism_drv.c:563:9: error: implicit declaration of function 'dma_set_max_seg_size' [-Werror=implicit-function-declaration]
563 | dma_set_max_seg_size(&pdev->dev, SZ_1M);
| ^~~~~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +93 drivers/s390/net/ism_drv.c
684b89bc39ce4f Sebastian Ott 2018-06-28 86
684b89bc39ce4f Sebastian Ott 2018-06-28 87 static int register_sba(struct ism_dev *ism)
684b89bc39ce4f Sebastian Ott 2018-06-28 88 {
684b89bc39ce4f Sebastian Ott 2018-06-28 89 union ism_reg_sba cmd;
684b89bc39ce4f Sebastian Ott 2018-06-28 90 dma_addr_t dma_handle;
684b89bc39ce4f Sebastian Ott 2018-06-28 91 struct ism_sba *sba;
684b89bc39ce4f Sebastian Ott 2018-06-28 92
750afb08ca7131 Luis Chamberlain 2019-01-04 @93 sba = dma_alloc_coherent(&ism->pdev->dev, PAGE_SIZE, &dma_handle,
750afb08ca7131 Luis Chamberlain 2019-01-04 94 GFP_KERNEL);
684b89bc39ce4f Sebastian Ott 2018-06-28 95 if (!sba)
684b89bc39ce4f Sebastian Ott 2018-06-28 96 return -ENOMEM;
684b89bc39ce4f Sebastian Ott 2018-06-28 97
684b89bc39ce4f Sebastian Ott 2018-06-28 98 memset(&cmd, 0, sizeof(cmd));
684b89bc39ce4f Sebastian Ott 2018-06-28 99 cmd.request.hdr.cmd = ISM_REG_SBA;
684b89bc39ce4f Sebastian Ott 2018-06-28 100 cmd.request.hdr.len = sizeof(cmd.request);
684b89bc39ce4f Sebastian Ott 2018-06-28 101 cmd.request.sba = dma_handle;
684b89bc39ce4f Sebastian Ott 2018-06-28 102
684b89bc39ce4f Sebastian Ott 2018-06-28 103 if (ism_cmd(ism, &cmd)) {
684b89bc39ce4f Sebastian Ott 2018-06-28 104 dma_free_coherent(&ism->pdev->dev, PAGE_SIZE, sba, dma_handle);
684b89bc39ce4f Sebastian Ott 2018-06-28 105 return -EIO;
684b89bc39ce4f Sebastian Ott 2018-06-28 106 }
684b89bc39ce4f Sebastian Ott 2018-06-28 107
684b89bc39ce4f Sebastian Ott 2018-06-28 108 ism->sba = sba;
684b89bc39ce4f Sebastian Ott 2018-06-28 109 ism->sba_dma_addr = dma_handle;
684b89bc39ce4f Sebastian Ott 2018-06-28 110
684b89bc39ce4f Sebastian Ott 2018-06-28 111 return 0;
684b89bc39ce4f Sebastian Ott 2018-06-28 112 }
684b89bc39ce4f Sebastian Ott 2018-06-28 113
684b89bc39ce4f Sebastian Ott 2018-06-28 114 static int register_ieq(struct ism_dev *ism)
684b89bc39ce4f Sebastian Ott 2018-06-28 115 {
684b89bc39ce4f Sebastian Ott 2018-06-28 116 union ism_reg_ieq cmd;
684b89bc39ce4f Sebastian Ott 2018-06-28 117 dma_addr_t dma_handle;
684b89bc39ce4f Sebastian Ott 2018-06-28 118 struct ism_eq *ieq;
684b89bc39ce4f Sebastian Ott 2018-06-28 119
750afb08ca7131 Luis Chamberlain 2019-01-04 @120 ieq = dma_alloc_coherent(&ism->pdev->dev, PAGE_SIZE, &dma_handle,
750afb08ca7131 Luis Chamberlain 2019-01-04 121 GFP_KERNEL);
684b89bc39ce4f Sebastian Ott 2018-06-28 122 if (!ieq)
684b89bc39ce4f Sebastian Ott 2018-06-28 123 return -ENOMEM;
684b89bc39ce4f Sebastian Ott 2018-06-28 124
684b89bc39ce4f Sebastian Ott 2018-06-28 125 memset(&cmd, 0, sizeof(cmd));
684b89bc39ce4f Sebastian Ott 2018-06-28 126 cmd.request.hdr.cmd = ISM_REG_IEQ;
684b89bc39ce4f Sebastian Ott 2018-06-28 127 cmd.request.hdr.len = sizeof(cmd.request);
684b89bc39ce4f Sebastian Ott 2018-06-28 128 cmd.request.ieq = dma_handle;
684b89bc39ce4f Sebastian Ott 2018-06-28 129 cmd.request.len = sizeof(*ieq);
684b89bc39ce4f Sebastian Ott 2018-06-28 130
684b89bc39ce4f Sebastian Ott 2018-06-28 131 if (ism_cmd(ism, &cmd)) {
684b89bc39ce4f Sebastian Ott 2018-06-28 132 dma_free_coherent(&ism->pdev->dev, PAGE_SIZE, ieq, dma_handle);
684b89bc39ce4f Sebastian Ott 2018-06-28 133 return -EIO;
684b89bc39ce4f Sebastian Ott 2018-06-28 134 }
684b89bc39ce4f Sebastian Ott 2018-06-28 135
684b89bc39ce4f Sebastian Ott 2018-06-28 136 ism->ieq = ieq;
684b89bc39ce4f Sebastian Ott 2018-06-28 137 ism->ieq_idx = -1;
684b89bc39ce4f Sebastian Ott 2018-06-28 138 ism->ieq_dma_addr = dma_handle;
684b89bc39ce4f Sebastian Ott 2018-06-28 139
684b89bc39ce4f Sebastian Ott 2018-06-28 140 return 0;
684b89bc39ce4f Sebastian Ott 2018-06-28 141 }
684b89bc39ce4f Sebastian Ott 2018-06-28 142
684b89bc39ce4f Sebastian Ott 2018-06-28 143 static int unregister_sba(struct ism_dev *ism)
684b89bc39ce4f Sebastian Ott 2018-06-28 144 {
0ff06c44efeede Sebastian Ott 2019-02-14 145 int ret;
0ff06c44efeede Sebastian Ott 2019-02-14 146
684b89bc39ce4f Sebastian Ott 2018-06-28 147 if (!ism->sba)
684b89bc39ce4f Sebastian Ott 2018-06-28 148 return 0;
684b89bc39ce4f Sebastian Ott 2018-06-28 149
0ff06c44efeede Sebastian Ott 2019-02-14 150 ret = ism_cmd_simple(ism, ISM_UNREG_SBA);
0ff06c44efeede Sebastian Ott 2019-02-14 151 if (ret && ret != ISM_ERROR)
684b89bc39ce4f Sebastian Ott 2018-06-28 152 return -EIO;
684b89bc39ce4f Sebastian Ott 2018-06-28 153
684b89bc39ce4f Sebastian Ott 2018-06-28 154 dma_free_coherent(&ism->pdev->dev, PAGE_SIZE,
684b89bc39ce4f Sebastian Ott 2018-06-28 155 ism->sba, ism->sba_dma_addr);
684b89bc39ce4f Sebastian Ott 2018-06-28 156
684b89bc39ce4f Sebastian Ott 2018-06-28 157 ism->sba = NULL;
684b89bc39ce4f Sebastian Ott 2018-06-28 158 ism->sba_dma_addr = 0;
684b89bc39ce4f Sebastian Ott 2018-06-28 159
684b89bc39ce4f Sebastian Ott 2018-06-28 160 return 0;
684b89bc39ce4f Sebastian Ott 2018-06-28 161 }
684b89bc39ce4f Sebastian Ott 2018-06-28 162
684b89bc39ce4f Sebastian Ott 2018-06-28 163 static int unregister_ieq(struct ism_dev *ism)
684b89bc39ce4f Sebastian Ott 2018-06-28 164 {
0ff06c44efeede Sebastian Ott 2019-02-14 165 int ret;
0ff06c44efeede Sebastian Ott 2019-02-14 166
684b89bc39ce4f Sebastian Ott 2018-06-28 167 if (!ism->ieq)
684b89bc39ce4f Sebastian Ott 2018-06-28 168 return 0;
684b89bc39ce4f Sebastian Ott 2018-06-28 169
0ff06c44efeede Sebastian Ott 2019-02-14 170 ret = ism_cmd_simple(ism, ISM_UNREG_IEQ);
0ff06c44efeede Sebastian Ott 2019-02-14 171 if (ret && ret != ISM_ERROR)
684b89bc39ce4f Sebastian Ott 2018-06-28 172 return -EIO;
684b89bc39ce4f Sebastian Ott 2018-06-28 173
684b89bc39ce4f Sebastian Ott 2018-06-28 174 dma_free_coherent(&ism->pdev->dev, PAGE_SIZE,
684b89bc39ce4f Sebastian Ott 2018-06-28 175 ism->ieq, ism->ieq_dma_addr);
684b89bc39ce4f Sebastian Ott 2018-06-28 176
684b89bc39ce4f Sebastian Ott 2018-06-28 177 ism->ieq = NULL;
684b89bc39ce4f Sebastian Ott 2018-06-28 178 ism->ieq_dma_addr = 0;
684b89bc39ce4f Sebastian Ott 2018-06-28 179
684b89bc39ce4f Sebastian Ott 2018-06-28 180 return 0;
684b89bc39ce4f Sebastian Ott 2018-06-28 181 }
684b89bc39ce4f Sebastian Ott 2018-06-28 182
684b89bc39ce4f Sebastian Ott 2018-06-28 183 static int ism_read_local_gid(struct ism_dev *ism)
684b89bc39ce4f Sebastian Ott 2018-06-28 184 {
684b89bc39ce4f Sebastian Ott 2018-06-28 185 union ism_read_gid cmd;
684b89bc39ce4f Sebastian Ott 2018-06-28 186 int ret;
684b89bc39ce4f Sebastian Ott 2018-06-28 187
684b89bc39ce4f Sebastian Ott 2018-06-28 188 memset(&cmd, 0, sizeof(cmd));
684b89bc39ce4f Sebastian Ott 2018-06-28 189 cmd.request.hdr.cmd = ISM_READ_GID;
684b89bc39ce4f Sebastian Ott 2018-06-28 190 cmd.request.hdr.len = sizeof(cmd.request);
684b89bc39ce4f Sebastian Ott 2018-06-28 191
684b89bc39ce4f Sebastian Ott 2018-06-28 192 ret = ism_cmd(ism, &cmd);
684b89bc39ce4f Sebastian Ott 2018-06-28 193 if (ret)
684b89bc39ce4f Sebastian Ott 2018-06-28 194 goto out;
684b89bc39ce4f Sebastian Ott 2018-06-28 195
684b89bc39ce4f Sebastian Ott 2018-06-28 196 ism->smcd->local_gid = cmd.response.gid;
684b89bc39ce4f Sebastian Ott 2018-06-28 197 out:
684b89bc39ce4f Sebastian Ott 2018-06-28 198 return ret;
684b89bc39ce4f Sebastian Ott 2018-06-28 199 }
684b89bc39ce4f Sebastian Ott 2018-06-28 200
684b89bc39ce4f Sebastian Ott 2018-06-28 201 static int ism_query_rgid(struct smcd_dev *smcd, u64 rgid, u32 vid_valid,
684b89bc39ce4f Sebastian Ott 2018-06-28 202 u32 vid)
684b89bc39ce4f Sebastian Ott 2018-06-28 203 {
684b89bc39ce4f Sebastian Ott 2018-06-28 204 struct ism_dev *ism = smcd->priv;
684b89bc39ce4f Sebastian Ott 2018-06-28 205 union ism_query_rgid cmd;
684b89bc39ce4f Sebastian Ott 2018-06-28 206
684b89bc39ce4f Sebastian Ott 2018-06-28 207 memset(&cmd, 0, sizeof(cmd));
684b89bc39ce4f Sebastian Ott 2018-06-28 208 cmd.request.hdr.cmd = ISM_QUERY_RGID;
684b89bc39ce4f Sebastian Ott 2018-06-28 209 cmd.request.hdr.len = sizeof(cmd.request);
684b89bc39ce4f Sebastian Ott 2018-06-28 210
684b89bc39ce4f Sebastian Ott 2018-06-28 211 cmd.request.rgid = rgid;
684b89bc39ce4f Sebastian Ott 2018-06-28 212 cmd.request.vlan_valid = vid_valid;
684b89bc39ce4f Sebastian Ott 2018-06-28 213 cmd.request.vlan_id = vid;
684b89bc39ce4f Sebastian Ott 2018-06-28 214
684b89bc39ce4f Sebastian Ott 2018-06-28 215 return ism_cmd(ism, &cmd);
684b89bc39ce4f Sebastian Ott 2018-06-28 216 }
684b89bc39ce4f Sebastian Ott 2018-06-28 217
684b89bc39ce4f Sebastian Ott 2018-06-28 218 static void ism_free_dmb(struct ism_dev *ism, struct smcd_dmb *dmb)
684b89bc39ce4f Sebastian Ott 2018-06-28 219 {
684b89bc39ce4f Sebastian Ott 2018-06-28 220 clear_bit(dmb->sba_idx, ism->sba_bitmap);
684b89bc39ce4f Sebastian Ott 2018-06-28 221 dma_free_coherent(&ism->pdev->dev, dmb->dmb_len,
684b89bc39ce4f Sebastian Ott 2018-06-28 222 dmb->cpu_addr, dmb->dma_addr);
684b89bc39ce4f Sebastian Ott 2018-06-28 223 }
684b89bc39ce4f Sebastian Ott 2018-06-28 224
684b89bc39ce4f Sebastian Ott 2018-06-28 225 static int ism_alloc_dmb(struct ism_dev *ism, struct smcd_dmb *dmb)
684b89bc39ce4f Sebastian Ott 2018-06-28 226 {
684b89bc39ce4f Sebastian Ott 2018-06-28 227 unsigned long bit;
684b89bc39ce4f Sebastian Ott 2018-06-28 228
684b89bc39ce4f Sebastian Ott 2018-06-28 229 if (PAGE_ALIGN(dmb->dmb_len) > dma_get_max_seg_size(&ism->pdev->dev))
684b89bc39ce4f Sebastian Ott 2018-06-28 230 return -EINVAL;
684b89bc39ce4f Sebastian Ott 2018-06-28 231
684b89bc39ce4f Sebastian Ott 2018-06-28 232 if (!dmb->sba_idx) {
684b89bc39ce4f Sebastian Ott 2018-06-28 233 bit = find_next_zero_bit(ism->sba_bitmap, ISM_NR_DMBS,
684b89bc39ce4f Sebastian Ott 2018-06-28 234 ISM_DMB_BIT_OFFSET);
684b89bc39ce4f Sebastian Ott 2018-06-28 235 if (bit == ISM_NR_DMBS)
211e5b7a0007e6 Karsten Graul 2020-07-26 236 return -ENOSPC;
684b89bc39ce4f Sebastian Ott 2018-06-28 237
684b89bc39ce4f Sebastian Ott 2018-06-28 238 dmb->sba_idx = bit;
684b89bc39ce4f Sebastian Ott 2018-06-28 239 }
684b89bc39ce4f Sebastian Ott 2018-06-28 240 if (dmb->sba_idx < ISM_DMB_BIT_OFFSET ||
684b89bc39ce4f Sebastian Ott 2018-06-28 241 test_and_set_bit(dmb->sba_idx, ism->sba_bitmap))
684b89bc39ce4f Sebastian Ott 2018-06-28 242 return -EINVAL;
684b89bc39ce4f Sebastian Ott 2018-06-28 243
750afb08ca7131 Luis Chamberlain 2019-01-04 @244 dmb->cpu_addr = dma_alloc_coherent(&ism->pdev->dev, dmb->dmb_len,
750afb08ca7131 Luis Chamberlain 2019-01-04 245 &dmb->dma_addr,
750afb08ca7131 Luis Chamberlain 2019-01-04 246 GFP_KERNEL | __GFP_NOWARN | __GFP_NOMEMALLOC | __GFP_COMP | __GFP_NORETRY);
684b89bc39ce4f Sebastian Ott 2018-06-28 247 if (!dmb->cpu_addr)
684b89bc39ce4f Sebastian Ott 2018-06-28 248 clear_bit(dmb->sba_idx, ism->sba_bitmap);
684b89bc39ce4f Sebastian Ott 2018-06-28 249
684b89bc39ce4f Sebastian Ott 2018-06-28 250 return dmb->cpu_addr ? 0 : -ENOMEM;
684b89bc39ce4f Sebastian Ott 2018-06-28 251 }
684b89bc39ce4f Sebastian Ott 2018-06-28 252 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH 16/16] PCI: Remove usage of the deprecated "pci-dma-compat.h" API
In reply to Christophe JAILLETThank you for the patch! Yet something to improve:
Hi Christophe,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on media-tree/master]
[also build test ERROR on helgaas-pci/next soc/for-next linus/master v5.16-rc8 next-20220106] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Christophe-JAILLET/Remove-usage-of-the-deprecated-pci-dma-compat-h-API/20220107-055614 base: git://linuxtv.org/media_tree.git master config: arc-randconfig-r025-20220107 (https://download.01.org/0day-ci/archive/20220107/202201071737.L7WbVLeU-lkp(a)intel.com/config) compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/24f5ae55a3ed7f1638a921db66d8e2f428f2e79d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Christophe-JAILLET/Remove-usage-of-the-deprecated-pci-dma-compat-h-API/20220107-055614 git checkout 24f5ae55a3ed7f1638a921db66d8e2f428f2e79d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/scsi/
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
In file included from drivers/scsi/fdomain.c:87:
>> include/scsi/scsicam.h:16:31: warning: 'struct block_device' declared inside parameter list will not be visible outside of this definition or declaration
16 | int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *ip);
| ^~~~~~~~~~~~
include/scsi/scsicam.h:17:27: warning: 'struct block_device' declared inside parameter list will not be visible outside of this definition or declaration
17 | bool scsi_partsize(struct block_device *bdev, sector_t capacity, int geom[3]);
| ^~~~~~~~~~~~
include/scsi/scsicam.h:18:40: warning: 'struct block_device' declared inside parameter list will not be visible outside of this definition or declaration
18 | unsigned char *scsi_bios_ptable(struct block_device *bdev);
| ^~~~~~~~~~~~
drivers/scsi/fdomain.c: In function 'fdomain_biosparam':
>> drivers/scsi/fdomain.c:468:45: error: passing argument 1 of 'scsi_bios_ptable' from incompatible pointer type [-Werror=incompatible-pointer-types]
468 | unsigned char *p = scsi_bios_ptable(bdev);
| ^~~~
| |
| struct block_device *
In file included from drivers/scsi/fdomain.c:87:
include/scsi/scsicam.h:18:54: note: expected 'struct block_device *' but argument is of type 'struct block_device *'
18 | unsigned char *scsi_bios_ptable(struct block_device *bdev);
| ~~~~~~~~~~~~~~~~~~~~~^~~~cc1: some warnings being treated as errors
vim +/scsi_bios_ptable +468 drivers/scsi/fdomain.c
ebeb466531154d6 Ondrej Zary 2019-05-14 463
ebeb466531154d6 Ondrej Zary 2019-05-14 464 static int fdomain_biosparam(struct scsi_device *sdev,
ebeb466531154d6 Ondrej Zary 2019-05-14 465 struct block_device *bdev, sector_t capacity,
ebeb466531154d6 Ondrej Zary 2019-05-14 466 int geom[])
ebeb466531154d6 Ondrej Zary 2019-05-14 467 {
ebeb466531154d6 Ondrej Zary 2019-05-14 @468 unsigned char *p = scsi_bios_ptable(bdev);
ebeb466531154d6 Ondrej Zary 2019-05-14 469
ebeb466531154d6 Ondrej Zary 2019-05-14 470 if (p && p[65] == 0xaa && p[64] == 0x55 /* Partition table valid */
ebeb466531154d6 Ondrej Zary 2019-05-14 471 && p[4]) { /* Partition type */
ebeb466531154d6 Ondrej Zary 2019-05-14 472 geom[0] = p[5] + 1; /* heads */
ebeb466531154d6 Ondrej Zary 2019-05-14 473 geom[1] = p[6] & 0x3f; /* sectors */
ebeb466531154d6 Ondrej Zary 2019-05-14 474 } else {
ebeb466531154d6 Ondrej Zary 2019-05-14 475 if (capacity >= 0x7e0000) {
ebeb466531154d6 Ondrej Zary 2019-05-14 476 geom[0] = 255; /* heads */
ebeb466531154d6 Ondrej Zary 2019-05-14 477 geom[1] = 63; /* sectors */
ebeb466531154d6 Ondrej Zary 2019-05-14 478 } else if (capacity >= 0x200000) {
ebeb466531154d6 Ondrej Zary 2019-05-14 479 geom[0] = 128; /* heads */
ebeb466531154d6 Ondrej Zary 2019-05-14 480 geom[1] = 63; /* sectors */
ebeb466531154d6 Ondrej Zary 2019-05-14 481 } else {
ebeb466531154d6 Ondrej Zary 2019-05-14 482 geom[0] = 64; /* heads */
ebeb466531154d6 Ondrej Zary 2019-05-14 483 geom[1] = 32; /* sectors */
ebeb466531154d6 Ondrej Zary 2019-05-14 484 }
ebeb466531154d6 Ondrej Zary 2019-05-14 485 }
ebeb466531154d6 Ondrej Zary 2019-05-14 486 geom[2] = sector_div(capacity, geom[0] * geom[1]);
ebeb466531154d6 Ondrej Zary 2019-05-14 487 kfree(p);
ebeb466531154d6 Ondrej Zary 2019-05-14 488
ebeb466531154d6 Ondrej Zary 2019-05-14 489 return 0;
ebeb466531154d6 Ondrej Zary 2019-05-14 490 }
ebeb466531154d6 Ondrej Zary 2019-05-14 491 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Martin K. Petersen
AppliedChristophe,
Quoted 2 lines
This serie axes all the remaining usages of the deprecated "
pci-dma-compat.h" API.
Applied patches 10-15 to 5.17/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 10 lines · Christophe JAILLET
This serie axes all the remaining usages of the deprecated "
pci-dma-compat.h" API.All these patches have already been posted.
They have been generated with a coccinelle script.
The tricky parts are patches that usedma_alloc_coherent()because the correct GFP flag has to be used in place of the previous embeddedGFP_ATOMIC.[...]
Applied to 5.17/scsi-queue, thanks!
[10/16] scsi: message: fusion: Remove usage of the deprecated "pci-dma-compat.h" API
https://git.kernel.org/mkp/scsi/c/b114dda6f2f1 [11/16] scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()' https://git.kernel.org/mkp/scsi/c/2d50607260a6 [12/16] scsi: mptbase: Use dma_alloc_coherent() https://git.kernel.org/mkp/scsi/c/5c5e6b6f61e0 [13/16] scsi: mptsas: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info() https://git.kernel.org/mkp/scsi/c/7a960b3a5e37 [14/16] scsi: mptsas: Use dma_alloc_coherent() https://git.kernel.org/mkp/scsi/c/76a334d756c5 [15/16] scsi: mptctl: Use dma_alloc_coherent() https://git.kernel.org/mkp/scsi/c/706dc3b91989
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Moritz Fischer
maintainerQuoted 80 lines · Christophe JAILLET
This serie axes all the remaining usages of the deprecated "
pci-dma-compat.h" API.All these patches have already been posted.
They have been generated with a coccinelle script.
The tricky parts are patches that usedma_alloc_coherent()because the correct GFP flag has to be used in place of the previous embeddedGFP_ATOMIC.Patches 1-3 are already Reviewed. References to the corresponding mail is given below the ---
Patch 1-2,4-10 are just generated from the coccinelle script. Only too long lines have been hand modified.
dma_alloc_coherent()modification are NOT part of these patches.Patch 3 also includes some '
dma_set_mask_and_coherent()' instead of 'pci_set_dma_mask()/pci_set_consistent_dma_mask()'.
I've left this additional modification because it was reviewed with it.Patch 10-15 are the tricky parts. Explanation of which GFP flag is the right one is given in each patch. It has been divided in several patches to ease review.
Patch 15 is the only one I'm slighly unsure with. The old code was using a
GFP_USERflag in the function. I'm not familiar with it.
I *guess* thatGFP_KERNELis fine, but maybe it should also beGFP_USERor left asGFP_ATOMICso that nothing is changed.Patch 16 is the last step that remove "
pci-dma-compat.h" and its only usage.All patches, exept 1-2,6 that are architecture specific, have been compile tested.
After all that, a few rst files, 1 or 2 strings in error messages and some error branching labels should still need some attention.
This is some minor issues.Only the cover letter is sent to every one. Each patch is sent to the corresponding maintainer(s) + Andrew Morton, Christoph Hellwig and Arnd Bergmann.
Best regards.
Christophe JAILLET (16):
alpha: Remove usage of the deprecated "pci-dma-compat.h" API
floppy: Remove usage of the deprecated "pci-dma-compat.h" API
fpga: dfl: pci: Remove usage of the deprecated "pci-dma-compat.h" API
media: Remove usage of the deprecated "pci-dma-compat.h" API agp/intel: Remove usage of the deprecated "pci-dma-compat.h" API
sparc: Remove usage of the deprecated "pci-dma-compat.h" API
dmaengine:pch_dma: Remove usage of the deprecated "pci-dma-compat.h"
API
rapidio/tsi721: Remove usage of the deprecated "pci-dma-compat.h" API
media: v4l2-pci-skeleton: Remove usage of the deprecated
"pci-dma-compat.h" API
scsi: message: fusion: Remove usage of the deprecated
"pci-dma-compat.h" API
scsi: mptbase: Usedma_alloc_coherent()in 'mpt_alloc_fw_memory()'
scsi: mptbase: Usedma_alloc_coherent()
scsi: mptsas: Usedma_alloc_coherent()in
mptsas_exp_repmanufacture_info()
scsi: mptsas: Usedma_alloc_coherent()
scsi: mptctl: Usedma_alloc_coherent()
PCI: Remove usage of the deprecated "pci-dma-compat.h" APIarch/alpha/include/asm/floppy.h | 7 +- arch/alpha/kernel/pci_iommu.c | 12 +-- arch/powerpc/include/asm/floppy.h | 8 +- arch/sparc/kernel/ioport.c | 2 +- drivers/char/agp/intel-gtt.c | 26 ++--- drivers/dma/pch_dma.c | 2 +- drivers/fpga/dfl-pci.c | 14 +-- drivers/media/pci/cx18/cx18-queue.h | 6 +- drivers/media/pci/ivtv/ivtv-queue.h | 25 +++-- drivers/media/pci/ivtv/ivtv-udma.h | 8 +- drivers/message/fusion/mptbase.c | 149 ++++++++++++++++------------ drivers/message/fusion/mptctl.c | 82 +++++++++------
Quoted 12 lines
drivers/message/fusion/mptlan.c | 90 +++++++++-------- drivers/message/fusion/mptsas.c | 94 +++++++++--------- drivers/rapidio/devices/tsi721.c | 8 +- include/linux/pci-dma-compat.h | 129 ------------------------ include/linux/pci.h | 3 - samples/v4l/v4l2-pci-skeleton.c | 2 +- 18 files changed, 289 insertions(+), 378 deletions(-) delete mode 100644 include/linux/pci-dma-compat.hSignature · 1 line
2.32.0
Applied [03/16] to linux-fpga for-next.
Thanks,
Moritz
Hi Christophe,
do you know what the state is in current linux-next?
I think we'll just want to queue up anything left at this point in the dma-mapping or PCI tree and get it done.
Le 23/02/2022 à 08:46, Christoph Hellwig a écrit :
Quoted 7 lines
Hi Christophe,
do you know what the state is in current linux-next?
I think we'll just want to queue up anything left at this point in the dma-mapping or PCI tree and get it done.
Hi,
Patch 01, 04, 05, 06, 08, 09 have not reached -next yet. They all still apply cleanly.
04 has been picked it up for inclusion in the media subsystem for 5.18. The other ones all have 1 or more Reviewed-by:/Acked-by: tags.
Patch 16 must be resubmitted to add "#include <linux/dma-mapping.h>" in order not to break builds.
All the other patches have landed in -next.
CJ
Quoted 15 lines · Christophe JAILLET
Quoted 7 lines · Christoph Hellwig
Hi Christophe,
do you know what the state is in current linux-next?
I think we'll just want to queue up anything left at this point in the dma-mapping or PCI tree and get it done.
Hi,
Patch 01, 04, 05, 06, 08, 09 have not reached -next yet. They all still apply cleanly.
Quoted 8 lines
04 has been picked it up for inclusion in the media subsystem for 5.18. The other ones all have 1 or more Reviewed-by:/Acked-by: tags.
Patch 16 must be resubmitted to add "#include <
linux/dma-mapping.h>" in order not to break builds.All the other patches have landed in -next.
Ok, these all look trivial. I'd suggest you send the rebase version to Andrew Morton then, so he can pick them all up into linux-mm, on top of the linux-next contents.
Arnd
Quoted 8 lines · Christophe JAILLET
Patch 01, 04, 05, 06, 08, 09 have not reached -next yet. They all still apply cleanly.
04 has been picked it up for inclusion in the media subsystem for 5.18. The other ones all have 1 or more Reviewed-by:/Acked-by: tags.
Patch 16 must be resubmitted to add "#include <
linux/dma-mapping.h>" in order not to break builds.
So how about this: I'll pick up 1, 5,6,8 and 9 for the dma-mapping tree. After -rc1 when presumably all other patches have reached mainline your resubmit one with the added include and we finish this off?
Thanks a lot for all your work already!
Quoted 8 lines · Christoph Hellwig
Quoted 6 lines · Christophe JAILLET
Patch 01, 04, 05, 06, 08, 09 have not reached -next yet. They all still apply cleanly.
04 has been picked it up for inclusion in the media subsystem for 5.18. The other ones all have 1 or more Reviewed-by:/Acked-by: tags.
Quoted 7 lines
Quoted 2 lines
Patch 16 must be resubmitted to add "#include <
linux/dma-mapping.h>" in order not to break builds.So how about this: I'll pick up 1, 5,6,8 and 9 for the dma-mapping tree. After -rc1 when presumably all other patches have reached mainline your resubmit one with the added include and we finish this off?
Sounds good to me as well.
Arnd
Le 24/02/2022 à 08:07, Arnd Bergmann a écrit :
Quoted 10 lines · Christoph Hellwig
Quoted 9 lines · Christophe JAILLET
Quoted 8 lines
Patch 01, 04, 05, 06, 08, 09 have not reached -next yet. They all still apply cleanly.
04 has been picked it up for inclusion in the media subsystem for 5.18. The other ones all have 1 or more Reviewed-by:/Acked-by: tags.
Patch 16 must be resubmitted to add "#include <
linux/dma-mapping.h>" in order not to break builds.
Quoted 7 lines
Quoted 4 lines
So how about this: I'll pick up 1, 5,6,8 and 9 for the dma-mapping tree. After -rc1 when presumably all other patches have reached mainline your resubmit one with the added include and we finish this off?
Sounds good to me as well.
Arnd
This is fine for me.
When all patches have reached -next, I'll re-submit the fixed 16th patch.
Thanks for your assistance for ending this long story :)
CJ
Christoph Hellwig
AppliedI've applied patches 1,5,6,8 and 9 to the dma-mapping tree.