* [PATCH] virtio_ring: Fix querying of maximum DMA mapping size for virtio device
@ 2021-12-01 11:20 ` Will Deacon
0 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2021-12-01 11:20 UTC (permalink / raw)
To: virtualization
Cc: linux-kernel, Will Deacon, Marc Zyngier, Quentin Perret,
Michael S. Tsirkin, Jason Wang
virtio_max_dma_size() returns the maximum DMA mapping size of the virtio
device by querying dma_max_mapping_size() for the device when the DMA
API is in use for the vring. Unfortunately, the device passed is
initialised by register_virtio_device() and does not inherit the DMA
configuration from its parent, resulting in SWIOTLB errors when bouncing
is enabled and the default 256K mapping limit (IO_TLB_SEGSIZE) is not
respected:
| virtio-pci 0000:00:01.0: swiotlb buffer is full (sz: 294912 bytes), total 1024 (slots), used 725 (slots)
Follow the pattern used elsewhere in the virtio_ring code when calling
into the DMA layer and pass the parent device to dma_max_mapping_size()
instead.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Quentin Perret <qperret@google.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Will Deacon <will@kernel.org>
---
drivers/virtio/virtio_ring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 6d2614e34470..028b05d44546 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev)
size_t max_segment_size = SIZE_MAX;
if (vring_use_dma_api(vdev))
- max_segment_size = dma_max_mapping_size(&vdev->dev);
+ max_segment_size = dma_max_mapping_size(vdev->dev.parent);
return max_segment_size;
}
--
2.34.0.rc2.393.gf8c9666880-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] virtio_ring: Fix querying of maximum DMA mapping size for virtio device
@ 2021-12-01 11:20 ` Will Deacon
0 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2021-12-01 11:20 UTC (permalink / raw)
To: virtualization
Cc: Michael S. Tsirkin, Marc Zyngier, Quentin Perret, linux-kernel,
Will Deacon
virtio_max_dma_size() returns the maximum DMA mapping size of the virtio
device by querying dma_max_mapping_size() for the device when the DMA
API is in use for the vring. Unfortunately, the device passed is
initialised by register_virtio_device() and does not inherit the DMA
configuration from its parent, resulting in SWIOTLB errors when bouncing
is enabled and the default 256K mapping limit (IO_TLB_SEGSIZE) is not
respected:
| virtio-pci 0000:00:01.0: swiotlb buffer is full (sz: 294912 bytes), total 1024 (slots), used 725 (slots)
Follow the pattern used elsewhere in the virtio_ring code when calling
into the DMA layer and pass the parent device to dma_max_mapping_size()
instead.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Quentin Perret <qperret@google.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Will Deacon <will@kernel.org>
---
drivers/virtio/virtio_ring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 6d2614e34470..028b05d44546 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev)
size_t max_segment_size = SIZE_MAX;
if (vring_use_dma_api(vdev))
- max_segment_size = dma_max_mapping_size(&vdev->dev);
+ max_segment_size = dma_max_mapping_size(vdev->dev.parent);
return max_segment_size;
}
--
2.34.0.rc2.393.gf8c9666880-goog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] virtio_ring: Fix querying of maximum DMA mapping size for virtio device
2021-12-01 11:20 ` Will Deacon
@ 2021-12-02 3:12 ` Jason Wang
-1 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-12-02 3:12 UTC (permalink / raw)
To: Will Deacon
Cc: virtualization, linux-kernel, Marc Zyngier, Quentin Perret,
Michael S. Tsirkin
On Wed, Dec 1, 2021 at 7:20 PM Will Deacon <will@kernel.org> wrote:
>
> virtio_max_dma_size() returns the maximum DMA mapping size of the virtio
> device by querying dma_max_mapping_size() for the device when the DMA
> API is in use for the vring. Unfortunately, the device passed is
> initialised by register_virtio_device() and does not inherit the DMA
> configuration from its parent, resulting in SWIOTLB errors when bouncing
> is enabled and the default 256K mapping limit (IO_TLB_SEGSIZE) is not
> respected:
>
> | virtio-pci 0000:00:01.0: swiotlb buffer is full (sz: 294912 bytes), total 1024 (slots), used 725 (slots)
>
> Follow the pattern used elsewhere in the virtio_ring code when calling
> into the DMA layer and pass the parent device to dma_max_mapping_size()
> instead.
>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Quentin Perret <qperret@google.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Will Deacon <will@kernel.org>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/virtio/virtio_ring.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 6d2614e34470..028b05d44546 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev)
> size_t max_segment_size = SIZE_MAX;
>
> if (vring_use_dma_api(vdev))
> - max_segment_size = dma_max_mapping_size(&vdev->dev);
> + max_segment_size = dma_max_mapping_size(vdev->dev.parent);
>
> return max_segment_size;
> }
> --
> 2.34.0.rc2.393.gf8c9666880-goog
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] virtio_ring: Fix querying of maximum DMA mapping size for virtio device
@ 2021-12-02 3:12 ` Jason Wang
0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-12-02 3:12 UTC (permalink / raw)
To: Will Deacon
Cc: Marc Zyngier, Quentin Perret, Michael S. Tsirkin, linux-kernel,
virtualization
On Wed, Dec 1, 2021 at 7:20 PM Will Deacon <will@kernel.org> wrote:
>
> virtio_max_dma_size() returns the maximum DMA mapping size of the virtio
> device by querying dma_max_mapping_size() for the device when the DMA
> API is in use for the vring. Unfortunately, the device passed is
> initialised by register_virtio_device() and does not inherit the DMA
> configuration from its parent, resulting in SWIOTLB errors when bouncing
> is enabled and the default 256K mapping limit (IO_TLB_SEGSIZE) is not
> respected:
>
> | virtio-pci 0000:00:01.0: swiotlb buffer is full (sz: 294912 bytes), total 1024 (slots), used 725 (slots)
>
> Follow the pattern used elsewhere in the virtio_ring code when calling
> into the DMA layer and pass the parent device to dma_max_mapping_size()
> instead.
>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Quentin Perret <qperret@google.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Will Deacon <will@kernel.org>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/virtio/virtio_ring.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 6d2614e34470..028b05d44546 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev)
> size_t max_segment_size = SIZE_MAX;
>
> if (vring_use_dma_api(vdev))
> - max_segment_size = dma_max_mapping_size(&vdev->dev);
> + max_segment_size = dma_max_mapping_size(vdev->dev.parent);
>
> return max_segment_size;
> }
> --
> 2.34.0.rc2.393.gf8c9666880-goog
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] virtio_ring: Fix querying of maximum DMA mapping size for virtio device
2021-12-01 11:20 ` Will Deacon
(?)
(?)
@ 2021-12-03 15:50 ` Suzuki K Poulose
-1 siblings, 0 replies; 5+ messages in thread
From: Suzuki K Poulose @ 2021-12-03 15:50 UTC (permalink / raw)
To: Will Deacon, virtualization
Cc: linux-kernel, Marc Zyngier, Quentin Perret, Michael S. Tsirkin,
Jason Wang
On 01/12/2021 11:20, Will Deacon wrote:
> virtio_max_dma_size() returns the maximum DMA mapping size of the virtio
> device by querying dma_max_mapping_size() for the device when the DMA
> API is in use for the vring. Unfortunately, the device passed is
> initialised by register_virtio_device() and does not inherit the DMA
> configuration from its parent, resulting in SWIOTLB errors when bouncing
> is enabled and the default 256K mapping limit (IO_TLB_SEGSIZE) is not
> respected:
>
> | virtio-pci 0000:00:01.0: swiotlb buffer is full (sz: 294912 bytes), total 1024 (slots), used 725 (slots)
>
> Follow the pattern used elsewhere in the virtio_ring code when calling
> into the DMA layer and pass the parent device to dma_max_mapping_size()
> instead.
>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Quentin Perret <qperret@google.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Will Deacon <will@kernel.org>
We hit a similar problem and ended up in the same patch, a bit late [0].
FWIW:
Tested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
[0]
https://lkml.kernel.org/r/20211203121614.3380162-1-suzuki.poulose@arm.com
> ---
> drivers/virtio/virtio_ring.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 6d2614e34470..028b05d44546 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev)
> size_t max_segment_size = SIZE_MAX;
>
> if (vring_use_dma_api(vdev))
> - max_segment_size = dma_max_mapping_size(&vdev->dev);
> + max_segment_size = dma_max_mapping_size(vdev->dev.parent);
>
> return max_segment_size;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-03 15:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 11:20 [PATCH] virtio_ring: Fix querying of maximum DMA mapping size for virtio device Will Deacon
2021-12-01 11:20 ` Will Deacon
2021-12-02 3:12 ` Jason Wang
2021-12-02 3:12 ` Jason Wang
2021-12-03 15:50 ` Suzuki K Poulose
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.