Re: [PATCH 0/4] scsi: fixup dma_set_mask_and_coherent() calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18/02/2019 07:21, Hannes Reinecke wrote:
On 2/15/19 10:16 AM, John Garry wrote:
On 15/02/2019 08:08, Christoph Hellwig wrote:
On Fri, Feb 15, 2019 at 08:43:55AM +0100, Christoph Hellwig wrote:
On Fri, Feb 15, 2019 at 07:55:39AM +0100, Hannes Reinecke wrote:
Yeah, there is a few more.  And the sad part is as of a few kernel
release ago we shouldn't even need the fallback 32-bit dma mask
anymore - we've cleaned up all the mess that required it.

Care to elaborate?
Can you point me to the respective commits facilitating that?

It mostly has been that way for a long time, but we still had a few
oddball architectures checking for an exact 32-bit match in their
arch specific direct mapping routines.  With the move to the generic
dma-direct implementation all those got fixed.

I thought that many SCSI drivers were changed over to stop using the
PCI DMA APIs at the end of last year, like this:

commit c22b332d811b90448e090c7fb487448afb039fcc
Author: Christoph Hellwig <hch@xxxxxx>
Date:   Wed Oct 10 18:34:51 2018 +0200

     scsi: csiostor: switch to generic DMA API

     Switch from the legacy PCI DMA API to the generic DMA API.

     Signed-off-by: Christoph Hellwig <hch@xxxxxx>
     Reviewed-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
     Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>

diff --git a/drivers/scsi/csiostor/csio_init.c
b/drivers/scsi/csiostor/csio_init.c
index ed2dae657964..aa04e4a7aed5 100644
--- a/drivers/scsi/csiostor/csio_init.c
+++ b/drivers/scsi/csiostor/csio_init.c
@@ -210,11 +210,8 @@ csio_pci_init(struct pci_dev *pdev, int *bars)
         pci_set_master(pdev);
         pci_try_set_mwi(pdev);

-       if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
-               pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
-       } 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(64)) ||
+           dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
                 dev_err(&pdev->dev, "No suitable DMA available.\n");
                 goto err_release_regions;
         }

... which is precisely the error we're encountering.
If the first call to dma_set_mask_and_coherent() succeeds it will return
'0', and the next call to dma_set_mask_and_coherent() will be executed.


Sure, I know this. What's more, if the first fails, then we bail out and won't even try the second.

Thanks,
John


Cheers,

Hannes





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux