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
Michael S. Tsirkin
2020-Jun-24 23:21 UTC
[PATCH v2 1/2] virtio: VIRTIO_F_IOMMU_PLATFORM -> VIRTIO_F_ACCESS_PLATFORM
Rename the bit to match latest virtio spec. Add a compat macro to avoid breaking existing userspace. Signed-off-by: Michael S. Tsirkin <mst at redhat.com> --- arch/um/drivers/virtio_uml.c | 2 +- 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 | 2 +- include/linux/virtio_config.h | 2 +- include/uapi/linux/virtio_config.h | 10 +++++++--- tools/virtio/linux/virtio_config.h | 2 +- 10 files changed, 18 insertions(+), 14 deletions(-) diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c index 351aee52aca6..a6c4bb6c2c01 100644 --- a/arch/um/drivers/virtio_uml.c +++ b/arch/um/drivers/virtio_uml.c @@ -385,7 +385,7 @@ static irqreturn_t vu_req_interrupt(int irq, void *data) } break; case VHOST_USER_SLAVE_IOTLB_MSG: - /* not supported - VIRTIO_F_IOMMU_PLATFORM */ + /* not supported - VIRTIO_F_ACCESS_PLATFORM */ case VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG: /* not supported - VHOST_USER_PROTOCOL_F_HOST_NOTIFIER */ default: diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h index f4554412e607..24af422b5a3e 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.h +++ b/drivers/vdpa/ifcvf/ifcvf_base.h @@ -29,7 +29,7 @@ (1ULL << VIRTIO_F_VERSION_1) | \ (1ULL << VIRTIO_NET_F_STATUS) | \ (1ULL << VIRTIO_F_ORDER_PLATFORM) | \ - (1ULL << VIRTIO_F_IOMMU_PLATFORM) | \ + (1ULL << VIRTIO_F_ACCESS_PLATFORM) | \ (1ULL << VIRTIO_NET_F_MRG_RXBUF)) /* Only one queue pair for now. */ diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index c7334cc65bb2..a9bc5e0fb353 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -55,7 +55,7 @@ struct vdpasim_virtqueue { static u64 vdpasim_features = (1ULL << VIRTIO_F_ANY_LAYOUT) | (1ULL << VIRTIO_F_VERSION_1) | - (1ULL << VIRTIO_F_IOMMU_PLATFORM); + (1ULL << VIRTIO_F_ACCESS_PLATFORM); /* State of each vdpasim device */ struct vdpasim { @@ -450,7 +450,7 @@ static int vdpasim_set_features(struct vdpa_device *vdpa, u64 features) struct vdpasim *vdpasim = vdpa_to_sim(vdpa); /* DMA mapping must be done by driver */ - if (!(features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) + if (!(features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) return -EINVAL; vdpasim->features = features & vdpasim_features; diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index e992decfec53..8e0921d3805d 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -73,7 +73,7 @@ enum { VHOST_NET_FEATURES = VHOST_FEATURES | (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) | (1ULL << VIRTIO_NET_F_MRG_RXBUF) | - (1ULL << VIRTIO_F_IOMMU_PLATFORM) + (1ULL << VIRTIO_F_ACCESS_PLATFORM) }; enum { @@ -1653,7 +1653,7 @@ static int vhost_net_set_features(struct vhost_net *n, u64 features) !vhost_log_access_ok(&n->dev)) goto out_unlock; - if ((features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) { + if ((features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) { if (vhost_init_device_iotlb(&n->dev, true)) goto out_unlock; } diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index a54b60d6623f..18869a35d408 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -31,7 +31,7 @@ enum { (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | (1ULL << VIRTIO_F_ANY_LAYOUT) | (1ULL << VIRTIO_F_VERSION_1) | - (1ULL << VIRTIO_F_IOMMU_PLATFORM) | + (1ULL << VIRTIO_F_ACCESS_PLATFORM) | (1ULL << VIRTIO_F_RING_PACKED) | (1ULL << VIRTIO_F_ORDER_PLATFORM) | (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 1f157d2f4952..fc7301406540 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -1120,7 +1120,7 @@ static int virtballoon_validate(struct virtio_device *vdev) else if (!virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON)) __virtio_clear_bit(vdev, VIRTIO_BALLOON_F_REPORTING); - __virtio_clear_bit(vdev, VIRTIO_F_IOMMU_PLATFORM); + __virtio_clear_bit(vdev, VIRTIO_F_ACCESS_PLATFORM); return 0; } diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 58b96baa8d48..a1a5c2a91426 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -2225,7 +2225,7 @@ void vring_transport_features(struct virtio_device *vdev) break; case VIRTIO_F_VERSION_1: break; - case VIRTIO_F_IOMMU_PLATFORM: + case VIRTIO_F_ACCESS_PLATFORM: break; case VIRTIO_F_RING_PACKED: break; diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index bb4cc4910750..f2cc2a0df174 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h @@ -171,7 +171,7 @@ static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev) * Note the reverse polarity of the quirk feature (compared to most * other features), this is for compatibility with legacy systems. */ - return !virtio_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); + return !virtio_has_feature(vdev, VIRTIO_F_ACCESS_PLATFORM); } static inline diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h index ff8e7dc9d4dd..b5eda06f0d57 100644 --- a/include/uapi/linux/virtio_config.h +++ b/include/uapi/linux/virtio_config.h @@ -67,13 +67,17 @@ #define VIRTIO_F_VERSION_1 32 /* - * If clear - device has the IOMMU bypass quirk feature. - * If set - use platform tools to detect the IOMMU. + * If clear - device has the platform DMA (e.g. IOMMU) bypass quirk feature. + * If set - use platform DMA tools to access the memory. * * Note the reverse polarity (compared to most other features), * this is for compatibility with legacy systems. */ -#define VIRTIO_F_IOMMU_PLATFORM 33 +#define VIRTIO_F_ACCESS_PLATFORM 33 +#ifndef __KERNEL__ +/* Legacy name for VIRTIO_F_ACCESS_PLATFORM (for compatibility with old userspace) */ +#define VIRTIO_F_IOMMU_PLATFORM VIRTIO_F_ACCESS_PLATFORM +#endif /* __KERNEL__ */ /* This feature indicates support for the packed virtqueue layout. */ #define VIRTIO_F_RING_PACKED 34 diff --git a/tools/virtio/linux/virtio_config.h b/tools/virtio/linux/virtio_config.h index dbf14c1e2188..f99ae42668e0 100644 --- a/tools/virtio/linux/virtio_config.h +++ b/tools/virtio/linux/virtio_config.h @@ -51,7 +51,7 @@ static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev) * Note the reverse polarity of the quirk feature (compared to most * other features), this is for compatibility with legacy systems. */ - return !virtio_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); + return !virtio_has_feature(vdev, VIRTIO_F_ACCESS_PLATFORM); } static inline bool virtio_is_little_endian(struct virtio_device *vdev) -- MST
Michael S. Tsirkin
2020-Jun-24 23:21 UTC
[PATCH v2 2/2] virtio: virtio_has_iommu_quirk -> virtio_has_dma_quirk
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 at 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
David Hildenbrand
2020-Jun-25 06:50 UTC
[PATCH v2 1/2] virtio: VIRTIO_F_IOMMU_PLATFORM -> VIRTIO_F_ACCESS_PLATFORM
On 25.06.20 01:21, Michael S. Tsirkin wrote:> Rename the bit to match latest virtio spec. > Add a compat macro to avoid breaking existing userspace. > > Signed-off-by: Michael S. Tsirkin <mst at redhat.com> > --- > arch/um/drivers/virtio_uml.c | 2 +- > 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 | 2 +- > include/linux/virtio_config.h | 2 +- > include/uapi/linux/virtio_config.h | 10 +++++++--- > tools/virtio/linux/virtio_config.h | 2 +- > 10 files changed, 18 insertions(+), 14 deletions(-) > > diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c > index 351aee52aca6..a6c4bb6c2c01 100644 > --- a/arch/um/drivers/virtio_uml.c > +++ b/arch/um/drivers/virtio_uml.c > @@ -385,7 +385,7 @@ static irqreturn_t vu_req_interrupt(int irq, void *data) > } > break; > case VHOST_USER_SLAVE_IOTLB_MSG: > - /* not supported - VIRTIO_F_IOMMU_PLATFORM */ > + /* not supported - VIRTIO_F_ACCESS_PLATFORM */ > case VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG: > /* not supported - VHOST_USER_PROTOCOL_F_HOST_NOTIFIER */ > default: > diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h > index f4554412e607..24af422b5a3e 100644 > --- a/drivers/vdpa/ifcvf/ifcvf_base.h > +++ b/drivers/vdpa/ifcvf/ifcvf_base.h > @@ -29,7 +29,7 @@ > (1ULL << VIRTIO_F_VERSION_1) | \ > (1ULL << VIRTIO_NET_F_STATUS) | \ > (1ULL << VIRTIO_F_ORDER_PLATFORM) | \ > - (1ULL << VIRTIO_F_IOMMU_PLATFORM) | \ > + (1ULL << VIRTIO_F_ACCESS_PLATFORM) | \ > (1ULL << VIRTIO_NET_F_MRG_RXBUF)) > > /* Only one queue pair for now. */ > diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c > index c7334cc65bb2..a9bc5e0fb353 100644 > --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c > +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c > @@ -55,7 +55,7 @@ struct vdpasim_virtqueue { > > static u64 vdpasim_features = (1ULL << VIRTIO_F_ANY_LAYOUT) | > (1ULL << VIRTIO_F_VERSION_1) | > - (1ULL << VIRTIO_F_IOMMU_PLATFORM); > + (1ULL << VIRTIO_F_ACCESS_PLATFORM); > > /* State of each vdpasim device */ > struct vdpasim { > @@ -450,7 +450,7 @@ static int vdpasim_set_features(struct vdpa_device *vdpa, u64 features) > struct vdpasim *vdpasim = vdpa_to_sim(vdpa); > > /* DMA mapping must be done by driver */ > - if (!(features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) > + if (!(features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) > return -EINVAL; > > vdpasim->features = features & vdpasim_features; > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > index e992decfec53..8e0921d3805d 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -73,7 +73,7 @@ enum { > VHOST_NET_FEATURES = VHOST_FEATURES | > (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) | > (1ULL << VIRTIO_NET_F_MRG_RXBUF) | > - (1ULL << VIRTIO_F_IOMMU_PLATFORM) > + (1ULL << VIRTIO_F_ACCESS_PLATFORM) > }; > > enum { > @@ -1653,7 +1653,7 @@ static int vhost_net_set_features(struct vhost_net *n, u64 features) > !vhost_log_access_ok(&n->dev)) > goto out_unlock; > > - if ((features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) { > + if ((features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) { > if (vhost_init_device_iotlb(&n->dev, true)) > goto out_unlock; > } > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c > index a54b60d6623f..18869a35d408 100644 > --- a/drivers/vhost/vdpa.c > +++ b/drivers/vhost/vdpa.c > @@ -31,7 +31,7 @@ enum { > (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | > (1ULL << VIRTIO_F_ANY_LAYOUT) | > (1ULL << VIRTIO_F_VERSION_1) | > - (1ULL << VIRTIO_F_IOMMU_PLATFORM) | > + (1ULL << VIRTIO_F_ACCESS_PLATFORM) | > (1ULL << VIRTIO_F_RING_PACKED) | > (1ULL << VIRTIO_F_ORDER_PLATFORM) | > (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c > index 1f157d2f4952..fc7301406540 100644 > --- a/drivers/virtio/virtio_balloon.c > +++ b/drivers/virtio/virtio_balloon.c > @@ -1120,7 +1120,7 @@ static int virtballoon_validate(struct virtio_device *vdev) > else if (!virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON)) > __virtio_clear_bit(vdev, VIRTIO_BALLOON_F_REPORTING); > > - __virtio_clear_bit(vdev, VIRTIO_F_IOMMU_PLATFORM); > + __virtio_clear_bit(vdev, VIRTIO_F_ACCESS_PLATFORM); > return 0; > } > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index 58b96baa8d48..a1a5c2a91426 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -2225,7 +2225,7 @@ void vring_transport_features(struct virtio_device *vdev) > break; > case VIRTIO_F_VERSION_1: > break; > - case VIRTIO_F_IOMMU_PLATFORM: > + case VIRTIO_F_ACCESS_PLATFORM: > break; > case VIRTIO_F_RING_PACKED: > break; > diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h > index bb4cc4910750..f2cc2a0df174 100644 > --- a/include/linux/virtio_config.h > +++ b/include/linux/virtio_config.h > @@ -171,7 +171,7 @@ static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev) > * Note the reverse polarity of the quirk feature (compared to most > * other features), this is for compatibility with legacy systems. > */ > - return !virtio_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); > + return !virtio_has_feature(vdev, VIRTIO_F_ACCESS_PLATFORM); > } > > static inline > diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h > index ff8e7dc9d4dd..b5eda06f0d57 100644 > --- a/include/uapi/linux/virtio_config.h > +++ b/include/uapi/linux/virtio_config.h > @@ -67,13 +67,17 @@ > #define VIRTIO_F_VERSION_1 32 > > /* > - * If clear - device has the IOMMU bypass quirk feature. > - * If set - use platform tools to detect the IOMMU. > + * If clear - device has the platform DMA (e.g. IOMMU) bypass quirk feature. > + * If set - use platform DMA tools to access the memory. > * > * Note the reverse polarity (compared to most other features), > * this is for compatibility with legacy systems. > */ > -#define VIRTIO_F_IOMMU_PLATFORM 33 > +#define VIRTIO_F_ACCESS_PLATFORM 33 > +#ifndef __KERNEL__ > +/* Legacy name for VIRTIO_F_ACCESS_PLATFORM (for compatibility with old userspace) */ > +#define VIRTIO_F_IOMMU_PLATFORM VIRTIO_F_ACCESS_PLATFORM > +#endif /* __KERNEL__ */ > > /* This feature indicates support for the packed virtqueue layout. */ > #define VIRTIO_F_RING_PACKED 34 > diff --git a/tools/virtio/linux/virtio_config.h b/tools/virtio/linux/virtio_config.h > index dbf14c1e2188..f99ae42668e0 100644 > --- a/tools/virtio/linux/virtio_config.h > +++ b/tools/virtio/linux/virtio_config.h > @@ -51,7 +51,7 @@ static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev) > * Note the reverse polarity of the quirk feature (compared to most > * other features), this is for compatibility with legacy systems. > */ > - return !virtio_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); > + return !virtio_has_feature(vdev, VIRTIO_F_ACCESS_PLATFORM); > } > > static inline bool virtio_is_little_endian(struct virtio_device *vdev) >Reviewed-by: David Hildenbrand <david at redhat.com> -- Thanks, David / dhildenb
Jason Wang
2020-Jun-28 06:21 UTC
[PATCH v2 2/2] virtio: virtio_has_iommu_quirk -> virtio_has_dma_quirk
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 at 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 mostAcked-by: Jason Wang <jasowang at redhat.com>
Seemingly Similar Threads
- [PATCH] virtio: VIRTIO_F_IOMMU_PLATFORM -> VIRTIO_F_ACCESS_PLATFORM
- [PATCH v2 0/2] virtio: modernize DMA quirks
- [GIT PULL] virtio: features, fixes
- [PATCH v3 22/38] vdpa_sim: fix endian-ness of config space
- [PATCH v2 22/24] vdpa_sim: fix endian-ness of config space