linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
@ 2022-01-06 21:45 Christophe JAILLET
  2022-01-06 21:54 ` [PATCH 10/16] scsi: message: fusion: " Christophe JAILLET
                   ` (10 more replies)
  0 siblings, 11 replies; 23+ messages in thread
From: Christophe JAILLET @ 2022-01-06 21:45 UTC (permalink / raw)
  To: arnd, hch, akpm, rth, ink, mattst88, mpe, benh, paulus, davem,
	airlied, vkoul, hao.wu, trix, mdf, yilun.xu, awalls, mchehab,
	sathya.prakash, sreekanth.reddy, suganath-prabu.subramani,
	mporter, alex.bou9, bhelgaas
  Cc: linux-alpha, linuxppc-dev, sparclinux, dmaengine, linux-fpga,
	linux-media, MPT-FusionLinux.pdl, linux-scsi, linux-pci,
	linux-kernel, kernel-janitors, 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 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

-- 
2.32.0


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 10/16] scsi: message: fusion: Remove usage of the deprecated "pci-dma-compat.h" API
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
@ 2022-01-06 21:54 ` Christophe JAILLET
  2022-01-10  8:47   ` Christoph Hellwig
  2022-01-06 21:54 ` [PATCH 11/16] scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()' Christophe JAILLET
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Christophe JAILLET @ 2022-01-06 21:54 UTC (permalink / raw)
  To: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani
  Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel, kernel-janitors,
	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].


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/20200421081257.GA131897@infradead.org/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/20200716192821.321233-1-christophe.jaillet@wanadoo.fr/

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 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(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 24a4532053e4..5a3b7b56e85a 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -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);
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index ae433c150b37..0f447179e3f5 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -1046,9 +1046,9 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
 		goto free_and_fail;
 
 	if (sgdir & 0x04000000)
-		dir = PCI_DMA_TODEVICE;
+		dir = DMA_TO_DEVICE;
 	else
-		dir = PCI_DMA_FROMDEVICE;
+		dir = DMA_FROM_DEVICE;
 
 	/* At start:
 	 *	sgl = sglbuf = point to beginning of sg buffer
@@ -1080,8 +1080,9 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
 
 			bytes_allocd += this_alloc;
 			sgl->FlagsLength = (0x10000000|sgdir|this_alloc);
-			dma_addr = pci_map_single(ioc->pcidev,
-				buflist[buflist_ent].kptr, this_alloc, dir);
+			dma_addr = dma_map_single(&ioc->pcidev->dev,
+						  buflist[buflist_ent].kptr,
+						  this_alloc, dir);
 			sgl->Address = dma_addr;
 
 			fragcnt++;
@@ -1140,9 +1141,11 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
 			kptr = buflist[i].kptr;
 			len = buflist[i].len;
 
-			pci_free_consistent(ioc->pcidev, len, kptr, dma_addr);
+			dma_free_coherent(&ioc->pcidev->dev, len, kptr,
+					  dma_addr);
 		}
-		pci_free_consistent(ioc->pcidev, MAX_SGL_BYTES, sglbuf, *sglbuf_dma);
+		dma_free_coherent(&ioc->pcidev->dev, MAX_SGL_BYTES, sglbuf,
+				  *sglbuf_dma);
 	}
 	kfree(buflist);
 	return NULL;
@@ -1162,9 +1165,9 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
 	int		 n = 0;
 
 	if (sg->FlagsLength & 0x04000000)
-		dir = PCI_DMA_TODEVICE;
+		dir = DMA_TO_DEVICE;
 	else
-		dir = PCI_DMA_FROMDEVICE;
+		dir = DMA_FROM_DEVICE;
 
 	nib = (sg->FlagsLength & 0xF0000000) >> 28;
 	while (! (nib & 0x4)) { /* eob */
@@ -1179,8 +1182,10 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
 			dma_addr = sg->Address;
 			kptr = bl->kptr;
 			len = bl->len;
-			pci_unmap_single(ioc->pcidev, dma_addr, len, dir);
-			pci_free_consistent(ioc->pcidev, len, kptr, dma_addr);
+			dma_unmap_single(&ioc->pcidev->dev, dma_addr, len,
+					 dir);
+			dma_free_coherent(&ioc->pcidev->dev, len, kptr,
+					  dma_addr);
 			n++;
 		}
 		sg++;
@@ -1197,12 +1202,12 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
 		dma_addr = sg->Address;
 		kptr = bl->kptr;
 		len = bl->len;
-		pci_unmap_single(ioc->pcidev, dma_addr, len, dir);
-		pci_free_consistent(ioc->pcidev, len, kptr, dma_addr);
+		dma_unmap_single(&ioc->pcidev->dev, dma_addr, len, dir);
+		dma_free_coherent(&ioc->pcidev->dev, len, kptr, dma_addr);
 		n++;
 	}
 
-	pci_free_consistent(ioc->pcidev, MAX_SGL_BYTES, sgl, sgl_dma);
+	dma_free_coherent(&ioc->pcidev->dev, MAX_SGL_BYTES, sgl, sgl_dma);
 	kfree(buflist);
 	dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: Free'd 1 SGL buf + %d kbufs!\n",
 	    ioc->name, n));
@@ -2283,13 +2288,13 @@ mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __u
 	/* Free the allocated memory.
 	 */
 	if (bufOut.kptr != NULL) {
-		pci_free_consistent(ioc->pcidev,
-			bufOut.len, (void *) bufOut.kptr, dma_addr_out);
+		dma_free_coherent(&ioc->pcidev->dev, bufOut.len,
+				  (void *)bufOut.kptr, dma_addr_out);
 	}
 
 	if (bufIn.kptr != NULL) {
-		pci_free_consistent(ioc->pcidev,
-			bufIn.len, (void *) bufIn.kptr, dma_addr_in);
+		dma_free_coherent(&ioc->pcidev->dev, bufIn.len,
+				  (void *)bufIn.kptr, dma_addr_in);
 	}
 
 	/* mf is null if command issued successfully
@@ -2405,7 +2410,9 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
 							pdata->BoardTracerNumber, 24);
 					}
 				}
-				pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, buf_dma);
+				dma_free_coherent(&ioc->pcidev->dev,
+						  hdr.PageLength * 4, pbuf,
+						  buf_dma);
 				pbuf = NULL;
 			}
 		}
@@ -2519,7 +2526,7 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
 	SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context, 0);
 
 	if (pbuf)
-		pci_free_consistent(ioc->pcidev, 4, pbuf, buf_dma);
+		dma_free_coherent(&ioc->pcidev->dev, 4, pbuf, buf_dma);
 
 	/* Copy the data from kernel memory to user memory
 	 */
@@ -2623,7 +2630,8 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg)
 				karg.negotiated_speed = HP_DEV_SPEED_ASYNC;
 		}
 
-		pci_free_consistent(ioc->pcidev, data_sz, (u8 *) pg0_alloc, page_dma);
+		dma_free_coherent(&ioc->pcidev->dev, data_sz, (u8 *)pg0_alloc,
+				  page_dma);
 	}
 
 	/* Set defaults
@@ -2658,7 +2666,8 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg)
 				karg.phase_errors = (u32) le16_to_cpu(pg3_alloc->PhaseErrorCount);
 				karg.parity_errors = (u32) le16_to_cpu(pg3_alloc->ParityErrorCount);
 			}
-			pci_free_consistent(ioc->pcidev, data_sz, (u8 *) pg3_alloc, page_dma);
+			dma_free_coherent(&ioc->pcidev->dev, data_sz,
+					  (u8 *)pg3_alloc, page_dma);
 		}
 	}
 	hd = shost_priv(ioc->sh);
diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c
index 117fa4ebf6d7..ddf9b7a2f7c9 100644
--- a/drivers/message/fusion/mptlan.c
+++ b/drivers/message/fusion/mptlan.c
@@ -516,9 +516,9 @@ mpt_lan_close(struct net_device *dev)
 		if (priv->RcvCtl[i].skb != NULL) {
 /**/			dlprintk((KERN_INFO MYNAM "/lan_close: bucket %05x "
 /**/				  "is still out\n", i));
-			pci_unmap_single(mpt_dev->pcidev, priv->RcvCtl[i].dma,
-					 priv->RcvCtl[i].len,
-					 PCI_DMA_FROMDEVICE);
+			dma_unmap_single(&mpt_dev->pcidev->dev,
+					 priv->RcvCtl[i].dma,
+					 priv->RcvCtl[i].len, DMA_FROM_DEVICE);
 			dev_kfree_skb(priv->RcvCtl[i].skb);
 		}
 	}
@@ -528,9 +528,9 @@ mpt_lan_close(struct net_device *dev)
 
 	for (i = 0; i < priv->tx_max_out; i++) {
 		if (priv->SendCtl[i].skb != NULL) {
-			pci_unmap_single(mpt_dev->pcidev, priv->SendCtl[i].dma,
-					 priv->SendCtl[i].len,
-					 PCI_DMA_TODEVICE);
+			dma_unmap_single(&mpt_dev->pcidev->dev,
+					 priv->SendCtl[i].dma,
+					 priv->SendCtl[i].len, DMA_TO_DEVICE);
 			dev_kfree_skb(priv->SendCtl[i].skb);
 		}
 	}
@@ -582,8 +582,8 @@ mpt_lan_send_turbo(struct net_device *dev, u32 tmsg)
 			__func__, sent));
 
 	priv->SendCtl[ctx].skb = NULL;
-	pci_unmap_single(mpt_dev->pcidev, priv->SendCtl[ctx].dma,
-			 priv->SendCtl[ctx].len, PCI_DMA_TODEVICE);
+	dma_unmap_single(&mpt_dev->pcidev->dev, priv->SendCtl[ctx].dma,
+			 priv->SendCtl[ctx].len, DMA_TO_DEVICE);
 	dev_kfree_skb_irq(sent);
 
 	spin_lock_irqsave(&priv->txfidx_lock, flags);
@@ -648,8 +648,9 @@ mpt_lan_send_reply(struct net_device *dev, LANSendReply_t *pSendRep)
 				__func__, sent));
 
 		priv->SendCtl[ctx].skb = NULL;
-		pci_unmap_single(mpt_dev->pcidev, priv->SendCtl[ctx].dma,
-				 priv->SendCtl[ctx].len, PCI_DMA_TODEVICE);
+		dma_unmap_single(&mpt_dev->pcidev->dev,
+				 priv->SendCtl[ctx].dma,
+				 priv->SendCtl[ctx].len, DMA_TO_DEVICE);
 		dev_kfree_skb_irq(sent);
 
 		priv->mpt_txfidx[++priv->mpt_txfidx_tail] = ctx;
@@ -720,8 +721,8 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev)
 	skb_reset_mac_header(skb);
 	skb_pull(skb, 12);
 
-        dma = pci_map_single(mpt_dev->pcidev, skb->data, skb->len,
-			     PCI_DMA_TODEVICE);
+	dma = dma_map_single(&mpt_dev->pcidev->dev, skb->data, skb->len,
+			     DMA_TO_DEVICE);
 
 	priv->SendCtl[ctx].skb = skb;
 	priv->SendCtl[ctx].dma = dma;
@@ -868,13 +869,17 @@ mpt_lan_receive_post_turbo(struct net_device *dev, u32 tmsg)
 			return -ENOMEM;
 		}
 
-		pci_dma_sync_single_for_cpu(mpt_dev->pcidev, priv->RcvCtl[ctx].dma,
-					    priv->RcvCtl[ctx].len, PCI_DMA_FROMDEVICE);
+		dma_sync_single_for_cpu(&mpt_dev->pcidev->dev,
+					priv->RcvCtl[ctx].dma,
+					priv->RcvCtl[ctx].len,
+					DMA_FROM_DEVICE);
 
 		skb_copy_from_linear_data(old_skb, skb_put(skb, len), len);
 
-		pci_dma_sync_single_for_device(mpt_dev->pcidev, priv->RcvCtl[ctx].dma,
-					       priv->RcvCtl[ctx].len, PCI_DMA_FROMDEVICE);
+		dma_sync_single_for_device(&mpt_dev->pcidev->dev,
+					   priv->RcvCtl[ctx].dma,
+					   priv->RcvCtl[ctx].len,
+					   DMA_FROM_DEVICE);
 		goto out;
 	}
 
@@ -882,8 +887,8 @@ mpt_lan_receive_post_turbo(struct net_device *dev, u32 tmsg)
 
 	priv->RcvCtl[ctx].skb = NULL;
 
-	pci_unmap_single(mpt_dev->pcidev, priv->RcvCtl[ctx].dma,
-			 priv->RcvCtl[ctx].len, PCI_DMA_FROMDEVICE);
+	dma_unmap_single(&mpt_dev->pcidev->dev, priv->RcvCtl[ctx].dma,
+			 priv->RcvCtl[ctx].len, DMA_FROM_DEVICE);
 
 out:
 	spin_lock_irqsave(&priv->rxfidx_lock, flags);
@@ -927,8 +932,8 @@ mpt_lan_receive_post_free(struct net_device *dev,
 //		dlprintk((KERN_INFO MYNAM "@rpr[2] TC + 3\n"));
 
 		priv->RcvCtl[ctx].skb = NULL;
-		pci_unmap_single(mpt_dev->pcidev, priv->RcvCtl[ctx].dma,
-				 priv->RcvCtl[ctx].len, PCI_DMA_FROMDEVICE);
+		dma_unmap_single(&mpt_dev->pcidev->dev, priv->RcvCtl[ctx].dma,
+				 priv->RcvCtl[ctx].len, DMA_FROM_DEVICE);
 		dev_kfree_skb_any(skb);
 
 		priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx;
@@ -1028,16 +1033,16 @@ mpt_lan_receive_post_reply(struct net_device *dev,
 //					IOC_AND_NETDEV_NAMES_s_s(dev),
 //					i, l));
 
-			pci_dma_sync_single_for_cpu(mpt_dev->pcidev,
-						    priv->RcvCtl[ctx].dma,
-						    priv->RcvCtl[ctx].len,
-						    PCI_DMA_FROMDEVICE);
+			dma_sync_single_for_cpu(&mpt_dev->pcidev->dev,
+						priv->RcvCtl[ctx].dma,
+						priv->RcvCtl[ctx].len,
+						DMA_FROM_DEVICE);
 			skb_copy_from_linear_data(old_skb, skb_put(skb, l), l);
 
-			pci_dma_sync_single_for_device(mpt_dev->pcidev,
-						       priv->RcvCtl[ctx].dma,
-						       priv->RcvCtl[ctx].len,
-						       PCI_DMA_FROMDEVICE);
+			dma_sync_single_for_device(&mpt_dev->pcidev->dev,
+						   priv->RcvCtl[ctx].dma,
+						   priv->RcvCtl[ctx].len,
+						   DMA_FROM_DEVICE);
 
 			priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx;
 			szrem -= l;
@@ -1056,17 +1061,17 @@ mpt_lan_receive_post_reply(struct net_device *dev,
 			return -ENOMEM;
 		}
 
-		pci_dma_sync_single_for_cpu(mpt_dev->pcidev,
-					    priv->RcvCtl[ctx].dma,
-					    priv->RcvCtl[ctx].len,
-					    PCI_DMA_FROMDEVICE);
+		dma_sync_single_for_cpu(&mpt_dev->pcidev->dev,
+					priv->RcvCtl[ctx].dma,
+					priv->RcvCtl[ctx].len,
+					DMA_FROM_DEVICE);
 
 		skb_copy_from_linear_data(old_skb, skb_put(skb, len), len);
 
-		pci_dma_sync_single_for_device(mpt_dev->pcidev,
-					       priv->RcvCtl[ctx].dma,
-					       priv->RcvCtl[ctx].len,
-					       PCI_DMA_FROMDEVICE);
+		dma_sync_single_for_device(&mpt_dev->pcidev->dev,
+					   priv->RcvCtl[ctx].dma,
+					   priv->RcvCtl[ctx].len,
+					   DMA_FROM_DEVICE);
 
 		spin_lock_irqsave(&priv->rxfidx_lock, flags);
 		priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx;
@@ -1077,8 +1082,8 @@ mpt_lan_receive_post_reply(struct net_device *dev,
 
 		priv->RcvCtl[ctx].skb = NULL;
 
-		pci_unmap_single(mpt_dev->pcidev, priv->RcvCtl[ctx].dma,
-				 priv->RcvCtl[ctx].len, PCI_DMA_FROMDEVICE);
+		dma_unmap_single(&mpt_dev->pcidev->dev, priv->RcvCtl[ctx].dma,
+				 priv->RcvCtl[ctx].len, DMA_FROM_DEVICE);
 		priv->RcvCtl[ctx].dma = 0;
 
 		priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx;
@@ -1199,10 +1204,10 @@ mpt_lan_post_receive_buckets(struct mpt_lan_priv *priv)
 
 			skb = priv->RcvCtl[ctx].skb;
 			if (skb && (priv->RcvCtl[ctx].len != len)) {
-				pci_unmap_single(mpt_dev->pcidev,
+				dma_unmap_single(&mpt_dev->pcidev->dev,
 						 priv->RcvCtl[ctx].dma,
 						 priv->RcvCtl[ctx].len,
-						 PCI_DMA_FROMDEVICE);
+						 DMA_FROM_DEVICE);
 				dev_kfree_skb(priv->RcvCtl[ctx].skb);
 				skb = priv->RcvCtl[ctx].skb = NULL;
 			}
@@ -1218,8 +1223,9 @@ mpt_lan_post_receive_buckets(struct mpt_lan_priv *priv)
 					break;
 				}
 
-				dma = pci_map_single(mpt_dev->pcidev, skb->data,
-						     len, PCI_DMA_FROMDEVICE);
+				dma = dma_map_single(&mpt_dev->pcidev->dev,
+						     skb->data, len,
+						     DMA_FROM_DEVICE);
 
 				priv->RcvCtl[ctx].skb = skb;
 				priv->RcvCtl[ctx].dma = dma;
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 091b45024d34..0363b2a2264d 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -769,8 +769,8 @@ mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc,
 
  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);
 }
 
 /**
@@ -1426,8 +1426,8 @@ mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
 	enclosure->sep_channel = buffer->SEPBus;
 
  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 error;
 }
@@ -2081,8 +2081,8 @@ static int mptsas_get_linkerrors(struct sas_phy *phy)
 		le32_to_cpu(buffer->PhyResetProblemCount);
 
  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);
 	return error;
 }
 
@@ -2301,7 +2301,7 @@ static void mptsas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
 		       << MPI_SGE_FLAGS_SHIFT;
 
 	if (!dma_map_sg(&ioc->pcidev->dev, job->request_payload.sg_list,
-			1, PCI_DMA_BIDIRECTIONAL))
+			1, DMA_BIDIRECTIONAL))
 		goto put_mf;
 
 	flagsLength |= (sg_dma_len(job->request_payload.sg_list) - 4);
@@ -2318,7 +2318,7 @@ static void mptsas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
 	flagsLength = flagsLength << MPI_SGE_FLAGS_SHIFT;
 
 	if (!dma_map_sg(&ioc->pcidev->dev, job->reply_payload.sg_list,
-			1, PCI_DMA_BIDIRECTIONAL))
+			1, DMA_BIDIRECTIONAL))
 		goto unmap_out;
 	flagsLength |= sg_dma_len(job->reply_payload.sg_list) + 4;
 	ioc->add_sge(psge, flagsLength,
@@ -2356,10 +2356,10 @@ static void mptsas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
 
 unmap_in:
 	dma_unmap_sg(&ioc->pcidev->dev, job->reply_payload.sg_list, 1,
-			PCI_DMA_BIDIRECTIONAL);
+			DMA_BIDIRECTIONAL);
 unmap_out:
 	dma_unmap_sg(&ioc->pcidev->dev, job->request_payload.sg_list, 1,
-			PCI_DMA_BIDIRECTIONAL);
+			DMA_BIDIRECTIONAL);
 put_mf:
 	if (mf)
 		mpt_free_msg_frame(ioc, mf);
@@ -2452,8 +2452,8 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
 	}
 
  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 error;
 }
@@ -2509,8 +2509,8 @@ mptsas_sas_io_unit_pg1(MPT_ADAPTER *ioc)
 	    device_missing_delay & MPI_SAS_IOUNIT1_REPORT_MISSING_TIMEOUT_MASK;
 
  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 error;
 }
@@ -2573,8 +2573,8 @@ mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
 	phy_info->attached.handle = le16_to_cpu(buffer->AttachedDevHandle);
 
  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 error;
 }
@@ -2654,8 +2654,8 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
 	device_info->flags = le16_to_cpu(buffer->Flags);
 
  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 error;
 }
@@ -2737,8 +2737,8 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
 	}
 
  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 error;
 }
@@ -2810,8 +2810,8 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
 	phy_info->attached.handle = le16_to_cpu(buffer->AttachedDevHandle);
 
  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 error;
 }
@@ -2987,7 +2987,8 @@ mptsas_exp_repmanufacture_info(MPT_ADAPTER *ioc,
 	}
 out_free:
 	if (data_out_dma)
-		pci_free_consistent(ioc->pcidev, sz, data_out, data_out_dma);
+		dma_free_coherent(&ioc->pcidev->dev, sz, data_out,
+				  data_out_dma);
 put_mf:
 	if (mf)
 		mpt_free_msg_frame(ioc, mf);
@@ -4318,8 +4319,8 @@ mptsas_adding_inactive_raid_components(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);
 }
 /*
  * Work queue thread to handle SAS hotplug events
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 11/16] scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()'
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
  2022-01-06 21:54 ` [PATCH 10/16] scsi: message: fusion: " Christophe JAILLET
@ 2022-01-06 21:54 ` Christophe JAILLET
  2022-01-10  8:47   ` Christoph Hellwig
  2022-01-06 21:54 ` [PATCH 12/16] scsi: mptbase: Use dma_alloc_coherent() Christophe JAILLET
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Christophe JAILLET @ 2022-01-06 21:54 UTC (permalink / raw)
  To: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani
  Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel, kernel-janitors,
	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].


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/20200421081257.GA131897@infradead.org/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
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(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 5a3b7b56e85a..c4702ef87897 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -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);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 12/16] scsi: mptbase: Use dma_alloc_coherent()
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
  2022-01-06 21:54 ` [PATCH 10/16] scsi: message: fusion: " Christophe JAILLET
  2022-01-06 21:54 ` [PATCH 11/16] scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()' Christophe JAILLET
@ 2022-01-06 21:54 ` Christophe JAILLET
  2022-01-10  8:47   ` Christoph Hellwig
  2022-01-06 21:54 ` [PATCH 13/16] scsi: mptsas: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info() Christophe JAILLET
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Christophe JAILLET @ 2022-01-06 21:54 UTC (permalink / raw)
  To: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani
  Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel, kernel-janitors,
	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].


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/20200421081257.GA131897@infradead.org/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/message/fusion/mptbase.c | 52 ++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 20 deletions(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index c4702ef87897..e90adfa57950 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -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;
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 13/16] scsi: mptsas: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info()
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
                   ` (2 preceding siblings ...)
  2022-01-06 21:54 ` [PATCH 12/16] scsi: mptbase: Use dma_alloc_coherent() Christophe JAILLET
@ 2022-01-06 21:54 ` Christophe JAILLET
  2022-01-10  8:48   ` Christoph Hellwig
  2022-01-06 21:54 ` [PATCH 14/16] scsi: mptsas: Use dma_alloc_coherent() Christophe JAILLET
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Christophe JAILLET @ 2022-01-06 21:54 UTC (permalink / raw)
  To: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani
  Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel, kernel-janitors,
	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].


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/20200421081257.GA131897@infradead.org/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/message/fusion/mptsas.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 0363b2a2264d..9b40be04710c 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -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__);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 14/16] scsi: mptsas: Use dma_alloc_coherent()
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
                   ` (3 preceding siblings ...)
  2022-01-06 21:54 ` [PATCH 13/16] scsi: mptsas: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info() Christophe JAILLET
@ 2022-01-06 21:54 ` Christophe JAILLET
  2022-01-10  8:48   ` Christoph Hellwig
  2022-01-06 21:54 ` [PATCH 15/16] scsi: mptctl: " Christophe JAILLET
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Christophe JAILLET @ 2022-01-06 21:54 UTC (permalink / raw)
  To: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani
  Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel, kernel-janitors,
	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].


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/20200421081257.GA131897@infradead.org/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/message/fusion/mptsas.c | 40 ++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 9b40be04710c..4acd8f9a48e1 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -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;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 15/16] scsi: mptctl: Use dma_alloc_coherent()
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
                   ` (4 preceding siblings ...)
  2022-01-06 21:54 ` [PATCH 14/16] scsi: mptsas: Use dma_alloc_coherent() Christophe JAILLET
@ 2022-01-06 21:54 ` Christophe JAILLET
  2022-01-10  8:48   ` Christoph Hellwig
  2022-01-10 15:35 ` [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Martin K. Petersen
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Christophe JAILLET @ 2022-01-06 21:54 UTC (permalink / raw)
  To: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani
  Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel, kernel-janitors,
	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].


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/20200421081257.GA131897@infradead.org/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
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(-)

diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 0f447179e3f5..03c8fb1795c2 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -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;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 10/16] scsi: message: fusion: Remove usage of the deprecated "pci-dma-compat.h" API
  2022-01-06 21:54 ` [PATCH 10/16] scsi: message: fusion: " Christophe JAILLET
@ 2022-01-10  8:47   ` Christoph Hellwig
  0 siblings, 0 replies; 23+ messages in thread
From: Christoph Hellwig @ 2022-01-10  8:47 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani, MPT-FusionLinux.pdl, linux-scsi,
	linux-kernel, kernel-janitors

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 11/16] scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()'
  2022-01-06 21:54 ` [PATCH 11/16] scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()' Christophe JAILLET
@ 2022-01-10  8:47   ` Christoph Hellwig
  0 siblings, 0 replies; 23+ messages in thread
From: Christoph Hellwig @ 2022-01-10  8:47 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani, MPT-FusionLinux.pdl, linux-scsi,
	linux-kernel, kernel-janitors

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 12/16] scsi: mptbase: Use dma_alloc_coherent()
  2022-01-06 21:54 ` [PATCH 12/16] scsi: mptbase: Use dma_alloc_coherent() Christophe JAILLET
@ 2022-01-10  8:47   ` Christoph Hellwig
  0 siblings, 0 replies; 23+ messages in thread
From: Christoph Hellwig @ 2022-01-10  8:47 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani, MPT-FusionLinux.pdl, linux-scsi,
	linux-kernel, kernel-janitors

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 13/16] scsi: mptsas: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info()
  2022-01-06 21:54 ` [PATCH 13/16] scsi: mptsas: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info() Christophe JAILLET
@ 2022-01-10  8:48   ` Christoph Hellwig
  0 siblings, 0 replies; 23+ messages in thread
From: Christoph Hellwig @ 2022-01-10  8:48 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani, MPT-FusionLinux.pdl, linux-scsi,
	linux-kernel, kernel-janitors

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 14/16] scsi: mptsas: Use dma_alloc_coherent()
  2022-01-06 21:54 ` [PATCH 14/16] scsi: mptsas: Use dma_alloc_coherent() Christophe JAILLET
@ 2022-01-10  8:48   ` Christoph Hellwig
  0 siblings, 0 replies; 23+ messages in thread
From: Christoph Hellwig @ 2022-01-10  8:48 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani, MPT-FusionLinux.pdl, linux-scsi,
	linux-kernel, kernel-janitors

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 15/16] scsi: mptctl: Use dma_alloc_coherent()
  2022-01-06 21:54 ` [PATCH 15/16] scsi: mptctl: " Christophe JAILLET
@ 2022-01-10  8:48   ` Christoph Hellwig
  0 siblings, 0 replies; 23+ messages in thread
From: Christoph Hellwig @ 2022-01-10  8:48 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: arnd, hch, akpm, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani, MPT-FusionLinux.pdl, linux-scsi,
	linux-kernel, kernel-janitors

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
                   ` (5 preceding siblings ...)
  2022-01-06 21:54 ` [PATCH 15/16] scsi: mptctl: " Christophe JAILLET
@ 2022-01-10 15:35 ` Martin K. Petersen
  2022-01-19  4:06 ` Martin K. Petersen
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 23+ messages in thread
From: Martin K. Petersen @ 2022-01-10 15:35 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: arnd, hch, akpm, rth, ink, mattst88, mpe, benh, paulus, davem,
	airlied, vkoul, hao.wu, trix, mdf, yilun.xu, awalls, mchehab,
	sathya.prakash, sreekanth.reddy, suganath-prabu.subramani,
	mporter, alex.bou9, bhelgaas, linux-alpha, linuxppc-dev,
	sparclinux, dmaengine, linux-fpga, linux-media,
	MPT-FusionLinux.pdl, linux-scsi, linux-pci, linux-kernel,
	kernel-janitors


Christophe,

> 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!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
                   ` (6 preceding siblings ...)
  2022-01-10 15:35 ` [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Martin K. Petersen
@ 2022-01-19  4:06 ` Martin K. Petersen
  2022-01-25 19:28 ` Moritz Fischer
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 23+ messages in thread
From: Martin K. Petersen @ 2022-01-19  4:06 UTC (permalink / raw)
  To: sreekanth.reddy, mchehab, mdf, mpe, mporter, hch, bhelgaas,
	airlied, Christophe JAILLET, benh, ink, davem, akpm, hao.wu,
	vkoul, sathya.prakash, paulus, trix, arnd, yilun.xu,
	suganath-prabu.subramani, alex.bou9, awalls, rth, mattst88
  Cc: Martin K . Petersen, linux-kernel, linuxppc-dev, linux-alpha,
	linux-fpga, MPT-FusionLinux.pdl, linux-media, sparclinux,
	linux-pci, linux-scsi, dmaengine, kernel-janitors

On Thu, 6 Jan 2022 22:45:13 +0100, Christophe JAILLET wrote:

> 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.
> 
> [...]

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

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
                   ` (7 preceding siblings ...)
  2022-01-19  4:06 ` Martin K. Petersen
@ 2022-01-25 19:28 ` Moritz Fischer
  2022-02-23  7:46 ` Christoph Hellwig
  2022-02-25 16:20 ` Christoph Hellwig
  10 siblings, 0 replies; 23+ messages in thread
From: Moritz Fischer @ 2022-01-25 19:28 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: arnd, hch, akpm, rth, ink, mattst88, mpe, benh, paulus, davem,
	airlied, vkoul, hao.wu, trix, mdf, yilun.xu, awalls, mchehab,
	sathya.prakash, sreekanth.reddy, suganath-prabu.subramani,
	mporter, alex.bou9, bhelgaas, linux-alpha, linuxppc-dev,
	sparclinux, dmaengine, linux-fpga, linux-media,
	MPT-FusionLinux.pdl, linux-scsi, linux-pci, linux-kernel,
	kernel-janitors

On Thu, Jan 06, 2022 at 10:45:13PM +0100, Christophe JAILLET wrote:
> 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
> 
> -- 
> 2.32.0
> 
Applied [03/16] to linux-fpga for-next.

Thanks,
Moritz

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
                   ` (8 preceding siblings ...)
  2022-01-25 19:28 ` Moritz Fischer
@ 2022-02-23  7:46 ` Christoph Hellwig
  2022-02-23 20:26   ` Christophe JAILLET
  2022-02-25 16:20 ` Christoph Hellwig
  10 siblings, 1 reply; 23+ messages in thread
From: Christoph Hellwig @ 2022-02-23  7:46 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: arnd, hch, akpm, rth, ink, mattst88, mpe, benh, paulus, davem,
	airlied, vkoul, hao.wu, trix, mdf, yilun.xu, awalls, mchehab,
	sathya.prakash, sreekanth.reddy, suganath-prabu.subramani,
	mporter, alex.bou9, bhelgaas, linux-alpha, linuxppc-dev,
	sparclinux, dmaengine, linux-fpga, linux-media,
	MPT-FusionLinux.pdl, linux-scsi, linux-pci, linux-kernel,
	kernel-janitors

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.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
  2022-02-23  7:46 ` Christoph Hellwig
@ 2022-02-23 20:26   ` Christophe JAILLET
  2022-02-23 20:42     ` Arnd Bergmann
  2022-02-24  6:25     ` Christoph Hellwig
  0 siblings, 2 replies; 23+ messages in thread
From: Christophe JAILLET @ 2022-02-23 20:26 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: arnd, akpm, ink, mattst88, mpe, benh, paulus, davem, airlied,
	vkoul, hao.wu, trix, mdf, yilun.xu, awalls, mchehab,
	sathya.prakash, sreekanth.reddy, suganath-prabu.subramani,
	mporter, alex.bou9, bhelgaas, linux-alpha, linuxppc-dev,
	sparclinux, dmaengine, linux-fpga, linux-media,
	MPT-FusionLinux.pdl, linux-scsi, linux-pci

Le 23/02/2022 à 08:46, Christoph Hellwig a écrit :
> 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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
  2022-02-23 20:26   ` Christophe JAILLET
@ 2022-02-23 20:42     ` Arnd Bergmann
  2022-02-24  6:25     ` Christoph Hellwig
  1 sibling, 0 replies; 23+ messages in thread
From: Arnd Bergmann @ 2022-02-23 20:42 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Christoph Hellwig, Arnd Bergmann, Andrew Morton, Ivan Kokshaysky,
	Matt Turner, Michael Ellerman, Benjamin Herrenschmidt,
	Paul Mackerras, David Miller, David Airlie, Vinod Koul, hao.wu,
	Tom Rix, Moritz Fischer, Xu Yilun, awalls, Mauro Carvalho Chehab,
	Sathya Prakash, sreekanth.reddy, Suganath Prabu Subramani,
	Matt Porter, Alex Bounine, Bjorn Helgaas, alpha, linuxppc-dev,
	sparclinux, dmaengine, linux-fpga, Linux Media Mailing List,
	MPT-FusionLinux.pdl, linux-scsi, linux-pci

On Wed, Feb 23, 2022 at 9:26 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> Le 23/02/2022 à 08:46, Christoph Hellwig a écrit :
> > 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.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
  2022-02-23 20:26   ` Christophe JAILLET
  2022-02-23 20:42     ` Arnd Bergmann
@ 2022-02-24  6:25     ` Christoph Hellwig
  2022-02-24  7:07       ` Arnd Bergmann
  1 sibling, 1 reply; 23+ messages in thread
From: Christoph Hellwig @ 2022-02-24  6:25 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Christoph Hellwig, arnd, akpm, ink, mattst88, mpe, benh, paulus,
	davem, airlied, vkoul, hao.wu, trix, mdf, yilun.xu, awalls,
	mchehab, sathya.prakash, sreekanth.reddy,
	suganath-prabu.subramani, mporter, alex.bou9, bhelgaas,
	linux-alpha, linuxppc-dev, sparclinux, dmaengine, linux-fpga,
	linux-media, MPT-FusionLinux.pdl, linux-scsi, linux-pci

On Wed, Feb 23, 2022 at 09:26:56PM +0100, Christophe JAILLET wrote:
> 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!

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
  2022-02-24  6:25     ` Christoph Hellwig
@ 2022-02-24  7:07       ` Arnd Bergmann
  2022-02-24 18:15         ` Christophe JAILLET
  0 siblings, 1 reply; 23+ messages in thread
From: Arnd Bergmann @ 2022-02-24  7:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Christophe JAILLET, Arnd Bergmann, Andrew Morton,
	Ivan Kokshaysky, Matt Turner, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, David Miller,
	David Airlie, Vinod Koul, hao.wu, Tom Rix, Moritz Fischer,
	Xu Yilun, awalls, Mauro Carvalho Chehab, Sathya Prakash,
	sreekanth.reddy, Suganath Prabu Subramani, Matt Porter,
	Alex Bounine, Bjorn Helgaas, alpha, linuxppc-dev, sparclinux,
	dmaengine, linux-fpga, Linux Media Mailing List,
	MPT-FusionLinux.pdl, linux-scsi, linux-pci

On Thu, Feb 24, 2022 at 7:25 AM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Wed, Feb 23, 2022 at 09:26:56PM +0100, Christophe JAILLET wrote:
> > 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?

Sounds good to me as well.

       Arnd

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
  2022-02-24  7:07       ` Arnd Bergmann
@ 2022-02-24 18:15         ` Christophe JAILLET
  0 siblings, 0 replies; 23+ messages in thread
From: Christophe JAILLET @ 2022-02-24 18:15 UTC (permalink / raw)
  To: Arnd Bergmann, Christoph Hellwig
  Cc: Andrew Morton, Ivan Kokshaysky, Matt Turner, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, David Miller,
	David Airlie, Vinod Koul, hao.wu, Tom Rix, Moritz Fischer,
	Xu Yilun, awalls, Mauro Carvalho Chehab, Sathya Prakash,
	sreekanth.reddy, Suganath Prabu Subramani, Matt Porter,
	Alex Bounine, Bjorn Helgaas, alpha, linuxppc-dev, sparclinux,
	dmaengine, linux-fpga, Linux Media Mailing List,
	MPT-FusionLinux.pdl, linux-scsi, linux-pci, linux-kernel,
	Kernel Janitors


Le 24/02/2022 à 08:07, Arnd Bergmann a écrit :
> On Thu, Feb 24, 2022 at 7:25 AM Christoph Hellwig <hch@infradead.org> wrote:
>> On Wed, Feb 23, 2022 at 09:26:56PM +0100, Christophe JAILLET wrote:
>>> 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?
> 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


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API
  2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
                   ` (9 preceding siblings ...)
  2022-02-23  7:46 ` Christoph Hellwig
@ 2022-02-25 16:20 ` Christoph Hellwig
  10 siblings, 0 replies; 23+ messages in thread
From: Christoph Hellwig @ 2022-02-25 16:20 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: arnd, hch, akpm, rth, ink, mattst88, mpe, benh, paulus, davem,
	airlied, vkoul, hao.wu, trix, mdf, yilun.xu, awalls, mchehab,
	sathya.prakash, sreekanth.reddy, suganath-prabu.subramani,
	mporter, alex.bou9, bhelgaas, linux-alpha, linuxppc-dev,
	sparclinux, dmaengine, linux-fpga, linux-media,
	MPT-FusionLinux.pdl, linux-scsi, linux-pci, linux-kernel,
	kernel-janitors

I've applied patches 1,5,6,8 and 9 to the dma-mapping tree.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-02-25 16:21 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
2022-01-06 21:54 ` [PATCH 10/16] scsi: message: fusion: " Christophe JAILLET
2022-01-10  8:47   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 11/16] scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()' Christophe JAILLET
2022-01-10  8:47   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 12/16] scsi: mptbase: Use dma_alloc_coherent() Christophe JAILLET
2022-01-10  8:47   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 13/16] scsi: mptsas: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info() Christophe JAILLET
2022-01-10  8:48   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 14/16] scsi: mptsas: Use dma_alloc_coherent() Christophe JAILLET
2022-01-10  8:48   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 15/16] scsi: mptctl: " Christophe JAILLET
2022-01-10  8:48   ` Christoph Hellwig
2022-01-10 15:35 ` [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Martin K. Petersen
2022-01-19  4:06 ` Martin K. Petersen
2022-01-25 19:28 ` Moritz Fischer
2022-02-23  7:46 ` Christoph Hellwig
2022-02-23 20:26   ` Christophe JAILLET
2022-02-23 20:42     ` Arnd Bergmann
2022-02-24  6:25     ` Christoph Hellwig
2022-02-24  7:07       ` Arnd Bergmann
2022-02-24 18:15         ` Christophe JAILLET
2022-02-25 16:20 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).