lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ccc494e7-1d8b-36b9-c12b-1f418f525aa0@wanadoo.fr>
Date:   Tue, 2 Nov 2021 20:43:17 +0100
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     Qing Wang <wangqing@...o.com>,
        Sathya Prakash <sathya.prakash@...adcom.com>,
        Sreekanth Reddy <sreekanth.reddy@...adcom.com>,
        Suganath Prabu Subramani 
        <suganath-prabu.subramani@...adcom.com>,
        MPT-FusionLinux.pdl@...adcom.com, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Kernel Janitors <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH V2] message: fusion: switch from 'pci_' to 'dma_' API

Hi,

Le 28/09/2021 à 05:42, Qing Wang a écrit :
> The wrappers in include/linux/pci-dma-compat.h should go away.
> 
> The patch has been generated with the coccinelle script below.
> expression e1, e2;
> @@
> -    pci_set_dma_mask(e1, e2)
> +    dma_set_mask(&e1->dev, e2)
> 
> @@
> expression e1, e2;
> @@
> -    pci_set_consistent_dma_mask(e1, e2)
> +    dma_set_coherent_mask(&e1->dev, e2)
> 
> While at it, some 'dma_set_mask()/dma_set_coherent_mask()' have been
> updated to a much less verbose 'dma_set_mask_and_coherent()'.
> 
> Signed-off-by: Qing Wang <wangqing@...o.com>
> ---
>   drivers/message/fusion/mptbase.c | 31 +++++++++----------------------
>   1 file changed, 9 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
> index 7f7abc9..c255d8a
> --- a/drivers/message/fusion/mptbase.c
> +++ b/drivers/message/fusion/mptbase.c
> @@ -1666,16 +1666,12 @@ 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_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {

The logic is reversed here. We used to have a !, but it is now missing.

CJ

>   			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_and_coherent(&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",
> @@ -1686,9 +1682,7 @@ 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_and_coherent(&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",
> @@ -4452,9 +4446,7 @@ 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_and_coherent(&ioc->pcidev, DMA_BIT_MASK(32))) {
>   				dma_mask = DMA_BIT_MASK(35);
>   				d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT
>   				    "setting 35 bit addressing for "
> @@ -4462,10 +4454,7 @@ 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_and_coherent(&ioc->pcidev, DMA_BIT_MASK(64));
>   
>   				printk(MYIOC_s_ERR_FMT
>   				    "failed setting 35 bit addressing for "
> @@ -4600,9 +4589,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,
> -	    ioc->dma_mask))
> +	if (dma_mask == DMA_BIT_MASK(35) &&
> +	    !dma_set_mask_and_coherent(&ioc->pcidev, ioc->dma_mask))
>   		d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT
>   		    "restoring 64 bit addressing\n", ioc->name));
>   
> @@ -4625,9 +4613,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,
> -	    DMA_BIT_MASK(64)))
> +	if (dma_mask == DMA_BIT_MASK(35) &&
> +	    !dma_set_mask_and_coherent(&ioc->pcidev, DMA_BIT_MASK(64)))
>   		d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT
>   		    "restoring 64 bit addressing\n", ioc->name));
>   
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ