dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] virtio: modernize DMA quirks
@ 2020-06-24 23:21 Michael S. Tsirkin
  2020-06-24 23:21 ` [PATCH v2 2/2] virtio: virtio_has_iommu_quirk -> virtio_has_dma_quirk Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2020-06-24 23:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: dri-devel, virtualization

Use generic names for the quirks to make it clear it is not just about
the IOMMU, it's about DMA access in general.

changes from v1:
	added patch 2

Michael S. Tsirkin (2):
  virtio: VIRTIO_F_IOMMU_PLATFORM -> VIRTIO_F_ACCESS_PLATFORM
  virtio: virtio_has_iommu_quirk -> virtio_has_dma_quirk

 arch/um/drivers/virtio_uml.c            |  2 +-
 drivers/gpu/drm/virtio/virtgpu_object.c |  2 +-
 drivers/gpu/drm/virtio/virtgpu_vq.c     |  4 ++--
 drivers/vdpa/ifcvf/ifcvf_base.h         |  2 +-
 drivers/vdpa/vdpa_sim/vdpa_sim.c        |  4 ++--
 drivers/vhost/net.c                     |  4 ++--
 drivers/vhost/vdpa.c                    |  2 +-
 drivers/virtio/virtio_balloon.c         |  2 +-
 drivers/virtio/virtio_ring.c            |  4 ++--
 include/linux/virtio_config.h           |  6 +++---
 include/uapi/linux/virtio_config.h      | 10 +++++++---
 tools/virtio/linux/virtio_config.h      |  6 +++---
 12 files changed, 26 insertions(+), 22 deletions(-)

-- 
MST

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v2 2/2] virtio: virtio_has_iommu_quirk -> virtio_has_dma_quirk
  2020-06-24 23:21 [PATCH v2 0/2] virtio: modernize DMA quirks Michael S. Tsirkin
@ 2020-06-24 23:21 ` Michael S. Tsirkin
  2020-06-28  6:21   ` Jason Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2020-06-24 23:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: David Airlie, Jason Wang, dri-devel, virtualization, Gerd Hoffmann

Now that the corresponding feature bit has been renamed,
rename the quirk too - it's about special ways to
do DMA, not necessarily about the IOMMU.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/gpu/drm/virtio/virtgpu_object.c | 2 +-
 drivers/gpu/drm/virtio/virtgpu_vq.c     | 4 ++--
 drivers/virtio/virtio_ring.c            | 2 +-
 include/linux/virtio_config.h           | 4 ++--
 tools/virtio/linux/virtio_config.h      | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c
index 6ccbd01cd888..e8799ab0c753 100644
--- a/drivers/gpu/drm/virtio/virtgpu_object.c
+++ b/drivers/gpu/drm/virtio/virtgpu_object.c
@@ -141,7 +141,7 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev,
 					struct virtio_gpu_mem_entry **ents,
 					unsigned int *nents)
 {
-	bool use_dma_api = !virtio_has_iommu_quirk(vgdev->vdev);
+	bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev);
 	struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo);
 	struct scatterlist *sg;
 	int si, ret;
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
index 9e663a5d9952..53af60d484a4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -599,7 +599,7 @@ void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev,
 	struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(objs->objs[0]);
 	struct virtio_gpu_transfer_to_host_2d *cmd_p;
 	struct virtio_gpu_vbuffer *vbuf;
-	bool use_dma_api = !virtio_has_iommu_quirk(vgdev->vdev);
+	bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev);
 	struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo);
 
 	if (use_dma_api)
@@ -1015,7 +1015,7 @@ void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev,
 	struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(objs->objs[0]);
 	struct virtio_gpu_transfer_host_3d *cmd_p;
 	struct virtio_gpu_vbuffer *vbuf;
-	bool use_dma_api = !virtio_has_iommu_quirk(vgdev->vdev);
+	bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev);
 	struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo);
 
 	if (use_dma_api)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index a1a5c2a91426..34253cb69cb8 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -240,7 +240,7 @@ static inline bool virtqueue_use_indirect(struct virtqueue *_vq,
 
 static bool vring_use_dma_api(struct virtio_device *vdev)
 {
-	if (!virtio_has_iommu_quirk(vdev))
+	if (!virtio_has_dma_quirk(vdev))
 		return true;
 
 	/* Otherwise, we are left to guess. */
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index f2cc2a0df174..3b4eae5ac5e3 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -162,10 +162,10 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
 }
 
 /**
- * virtio_has_iommu_quirk - determine whether this device has the iommu quirk
+ * virtio_has_dma_quirk - determine whether this device has the DMA quirk
  * @vdev: the device
  */
-static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev)
+static inline bool virtio_has_dma_quirk(const struct virtio_device *vdev)
 {
 	/*
 	 * Note the reverse polarity of the quirk feature (compared to most
diff --git a/tools/virtio/linux/virtio_config.h b/tools/virtio/linux/virtio_config.h
index f99ae42668e0..f2640e505c4e 100644
--- a/tools/virtio/linux/virtio_config.h
+++ b/tools/virtio/linux/virtio_config.h
@@ -42,10 +42,10 @@ static inline void __virtio_clear_bit(struct virtio_device *vdev,
 	(__virtio_test_bit((dev), feature))
 
 /**
- * virtio_has_iommu_quirk - determine whether this device has the iommu quirk
+ * virtio_has_dma_quirk - determine whether this device has the DMA quirk
  * @vdev: the device
  */
-static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev)
+static inline bool virtio_has_dma_quirk(const struct virtio_device *vdev)
 {
 	/*
 	 * Note the reverse polarity of the quirk feature (compared to most
-- 
MST

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2 2/2] virtio: virtio_has_iommu_quirk -> virtio_has_dma_quirk
  2020-06-24 23:21 ` [PATCH v2 2/2] virtio: virtio_has_iommu_quirk -> virtio_has_dma_quirk Michael S. Tsirkin
@ 2020-06-28  6:21   ` Jason Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Wang @ 2020-06-28  6:21 UTC (permalink / raw)
  To: Michael S. Tsirkin, linux-kernel
  Cc: David Airlie, dri-devel, Gerd Hoffmann, virtualization


On 2020/6/25 上午7:21, Michael S. Tsirkin wrote:
> Now that the corresponding feature bit has been renamed,
> rename the quirk too - it's about special ways to
> do DMA, not necessarily about the IOMMU.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   drivers/gpu/drm/virtio/virtgpu_object.c | 2 +-
>   drivers/gpu/drm/virtio/virtgpu_vq.c     | 4 ++--
>   drivers/virtio/virtio_ring.c            | 2 +-
>   include/linux/virtio_config.h           | 4 ++--
>   tools/virtio/linux/virtio_config.h      | 4 ++--
>   5 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c
> index 6ccbd01cd888..e8799ab0c753 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_object.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_object.c
> @@ -141,7 +141,7 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev,
>   					struct virtio_gpu_mem_entry **ents,
>   					unsigned int *nents)
>   {
> -	bool use_dma_api = !virtio_has_iommu_quirk(vgdev->vdev);
> +	bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev);
>   	struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo);
>   	struct scatterlist *sg;
>   	int si, ret;
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
> index 9e663a5d9952..53af60d484a4 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> @@ -599,7 +599,7 @@ void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev,
>   	struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(objs->objs[0]);
>   	struct virtio_gpu_transfer_to_host_2d *cmd_p;
>   	struct virtio_gpu_vbuffer *vbuf;
> -	bool use_dma_api = !virtio_has_iommu_quirk(vgdev->vdev);
> +	bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev);
>   	struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo);
>   
>   	if (use_dma_api)
> @@ -1015,7 +1015,7 @@ void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev,
>   	struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(objs->objs[0]);
>   	struct virtio_gpu_transfer_host_3d *cmd_p;
>   	struct virtio_gpu_vbuffer *vbuf;
> -	bool use_dma_api = !virtio_has_iommu_quirk(vgdev->vdev);
> +	bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev);
>   	struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo);
>   
>   	if (use_dma_api)
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index a1a5c2a91426..34253cb69cb8 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -240,7 +240,7 @@ static inline bool virtqueue_use_indirect(struct virtqueue *_vq,
>   
>   static bool vring_use_dma_api(struct virtio_device *vdev)
>   {
> -	if (!virtio_has_iommu_quirk(vdev))
> +	if (!virtio_has_dma_quirk(vdev))
>   		return true;
>   
>   	/* Otherwise, we are left to guess. */
> diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
> index f2cc2a0df174..3b4eae5ac5e3 100644
> --- a/include/linux/virtio_config.h
> +++ b/include/linux/virtio_config.h
> @@ -162,10 +162,10 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
>   }
>   
>   /**
> - * virtio_has_iommu_quirk - determine whether this device has the iommu quirk
> + * virtio_has_dma_quirk - determine whether this device has the DMA quirk
>    * @vdev: the device
>    */
> -static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev)
> +static inline bool virtio_has_dma_quirk(const struct virtio_device *vdev)
>   {
>   	/*
>   	 * Note the reverse polarity of the quirk feature (compared to most
> diff --git a/tools/virtio/linux/virtio_config.h b/tools/virtio/linux/virtio_config.h
> index f99ae42668e0..f2640e505c4e 100644
> --- a/tools/virtio/linux/virtio_config.h
> +++ b/tools/virtio/linux/virtio_config.h
> @@ -42,10 +42,10 @@ static inline void __virtio_clear_bit(struct virtio_device *vdev,
>   	(__virtio_test_bit((dev), feature))
>   
>   /**
> - * virtio_has_iommu_quirk - determine whether this device has the iommu quirk
> + * virtio_has_dma_quirk - determine whether this device has the DMA quirk
>    * @vdev: the device
>    */
> -static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev)
> +static inline bool virtio_has_dma_quirk(const struct virtio_device *vdev)
>   {
>   	/*
>   	 * Note the reverse polarity of the quirk feature (compared to most


Acked-by: Jason Wang <jasowang@redhat.com>


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-06-28  6:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 23:21 [PATCH v2 0/2] virtio: modernize DMA quirks Michael S. Tsirkin
2020-06-24 23:21 ` [PATCH v2 2/2] virtio: virtio_has_iommu_quirk -> virtio_has_dma_quirk Michael S. Tsirkin
2020-06-28  6:21   ` Jason Wang

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).