* [PATCH] virito-pci-modern: Remove useless DMA-32 fallback configuration
@ 2022-03-18 0:58 cgel.zte
2022-03-18 2:21 ` Jason Wang
2022-03-28 20:45 ` Michael S. Tsirkin
0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-03-18 0:58 UTC (permalink / raw)
To: mst; +Cc: jasowang, virtualization, linux-kernel, Minghao Chi, Zeal Robot
From: Minghao Chi <chi.minghao@zte.com.cn>
As stated in [1], dma_set_mask() with a 64-bit mask will never fail if
dev->dma_mask is non-NULL.
So, if it fails, the 32 bits case will also fail for the same reason.
Simplify code and remove some dead code accordingly.
[1]: https://lkml.org/lkml/2021/6/7/398
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
drivers/virtio/virtio_pci_modern_dev.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c
index e8b3ff2b9fbc..dff0b15a239d 100644
--- a/drivers/virtio/virtio_pci_modern_dev.c
+++ b/drivers/virtio/virtio_pci_modern_dev.c
@@ -255,9 +255,6 @@ int vp_modern_probe(struct virtio_pci_modern_device *mdev)
}
err = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64));
- if (err)
- err = dma_set_mask_and_coherent(&pci_dev->dev,
- DMA_BIT_MASK(32));
if (err)
dev_warn(&pci_dev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] virito-pci-modern: Remove useless DMA-32 fallback configuration
2022-03-18 0:58 [PATCH] virito-pci-modern: Remove useless DMA-32 fallback configuration cgel.zte
@ 2022-03-18 2:21 ` Jason Wang
2022-03-28 20:45 ` Michael S. Tsirkin
1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2022-03-18 2:21 UTC (permalink / raw)
To: cgel.zte; +Cc: mst, virtualization, linux-kernel, Minghao Chi, Zeal Robot
On Fri, Mar 18, 2022 at 8:59 AM <cgel.zte@gmail.com> wrote:
>
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> As stated in [1], dma_set_mask() with a 64-bit mask will never fail if
> dev->dma_mask is non-NULL.
> So, if it fails, the 32 bits case will also fail for the same reason.
>
> Simplify code and remove some dead code accordingly.
>
> [1]: https://lkml.org/lkml/2021/6/7/398
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
> drivers/virtio/virtio_pci_modern_dev.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c
> index e8b3ff2b9fbc..dff0b15a239d 100644
> --- a/drivers/virtio/virtio_pci_modern_dev.c
> +++ b/drivers/virtio/virtio_pci_modern_dev.c
> @@ -255,9 +255,6 @@ int vp_modern_probe(struct virtio_pci_modern_device *mdev)
> }
>
> err = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64));
> - if (err)
> - err = dma_set_mask_and_coherent(&pci_dev->dev,
> - DMA_BIT_MASK(32));
So we had:
if (!dev->dma_mask || !dma_supported(dev, mask))
return -EIO;
in dma_set_mask(), any reason dma_supported() can't be false here?
Thanks
> if (err)
> dev_warn(&pci_dev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n");
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] virito-pci-modern: Remove useless DMA-32 fallback configuration
2022-03-18 0:58 [PATCH] virito-pci-modern: Remove useless DMA-32 fallback configuration cgel.zte
2022-03-18 2:21 ` Jason Wang
@ 2022-03-28 20:45 ` Michael S. Tsirkin
1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2022-03-28 20:45 UTC (permalink / raw)
To: cgel.zte; +Cc: jasowang, virtualization, linux-kernel, Minghao Chi, Zeal Robot
Typo in subj, and pls make subject match actual file name (_ not -).
On Fri, Mar 18, 2022 at 12:58:58AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> As stated in [1], dma_set_mask() with a 64-bit mask will never fail if
> dev->dma_mask is non-NULL.
> So, if it fails, the 32 bits case will also fail for the same reason.
>
> Simplify code and remove some dead code accordingly.
>
> [1]: https://lkml.org/lkml/2021/6/7/398
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
> drivers/virtio/virtio_pci_modern_dev.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c
> index e8b3ff2b9fbc..dff0b15a239d 100644
> --- a/drivers/virtio/virtio_pci_modern_dev.c
> +++ b/drivers/virtio/virtio_pci_modern_dev.c
> @@ -255,9 +255,6 @@ int vp_modern_probe(struct virtio_pci_modern_device *mdev)
> }
>
> err = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64));
> - if (err)
> - err = dma_set_mask_and_coherent(&pci_dev->dev,
> - DMA_BIT_MASK(32));
> if (err)
> dev_warn(&pci_dev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n");
>
> --
> 2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-28 20:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18 0:58 [PATCH] virito-pci-modern: Remove useless DMA-32 fallback configuration cgel.zte
2022-03-18 2:21 ` Jason Wang
2022-03-28 20:45 ` Michael S. Tsirkin
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).