Skip to content

Commit 321bd21

Browse files
committed
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@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com>
1 parent bcf8768 commit 321bd21

10 files changed

Lines changed: 18 additions & 14 deletions

File tree

‎arch/um/drivers/virtio_uml.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static irqreturn_t vu_req_interrupt(int irq, void *data)
385385
}
386386
break;
387387
case VHOST_USER_SLAVE_IOTLB_MSG:
388-
/* not supported - VIRTIO_F_IOMMU_PLATFORM */
388+
/* not supported - VIRTIO_F_ACCESS_PLATFORM */
389389
case VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG:
390390
/* not supported - VHOST_USER_PROTOCOL_F_HOST_NOTIFIER */
391391
default:

‎drivers/vdpa/ifcvf/ifcvf_base.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
(1ULL << VIRTIO_F_VERSION_1) | \
3030
(1ULL << VIRTIO_NET_F_STATUS) | \
3131
(1ULL << VIRTIO_F_ORDER_PLATFORM) | \
32-
(1ULL << VIRTIO_F_IOMMU_PLATFORM) | \
32+
(1ULL << VIRTIO_F_ACCESS_PLATFORM) | \
3333
(1ULL << VIRTIO_NET_F_MRG_RXBUF))
3434

3535
/* Only one queue pair for now. */

‎drivers/vdpa/vdpa_sim/vdpa_sim.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct vdpasim_virtqueue {
5555

5656
static u64 vdpasim_features = (1ULL << VIRTIO_F_ANY_LAYOUT) |
5757
(1ULL << VIRTIO_F_VERSION_1) |
58-
(1ULL << VIRTIO_F_IOMMU_PLATFORM);
58+
(1ULL << VIRTIO_F_ACCESS_PLATFORM);
5959

6060
/* State of each vdpasim device */
6161
struct vdpasim {
@@ -450,7 +450,7 @@ static int vdpasim_set_features(struct vdpa_device *vdpa, u64 features)
450450
struct vdpasim *vdpasim = vdpa_to_sim(vdpa);
451451

452452
/* DMA mapping must be done by driver */
453-
if (!(features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)))
453+
if (!(features & (1ULL << VIRTIO_F_ACCESS_PLATFORM)))
454454
return -EINVAL;
455455

456456
vdpasim->features = features & vdpasim_features;

‎drivers/vhost/net.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ enum {
7373
VHOST_NET_FEATURES = VHOST_FEATURES |
7474
(1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
7575
(1ULL << VIRTIO_NET_F_MRG_RXBUF) |
76-
(1ULL << VIRTIO_F_IOMMU_PLATFORM)
76+
(1ULL << VIRTIO_F_ACCESS_PLATFORM)
7777
};
7878

7979
enum {
@@ -1653,7 +1653,7 @@ static int vhost_net_set_features(struct vhost_net *n, u64 features)
16531653
!vhost_log_access_ok(&n->dev))
16541654
goto out_unlock;
16551655

1656-
if ((features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) {
1656+
if ((features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) {
16571657
if (vhost_init_device_iotlb(&n->dev, true))
16581658
goto out_unlock;
16591659
}

‎drivers/vhost/vdpa.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ enum {
3131
(1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) |
3232
(1ULL << VIRTIO_F_ANY_LAYOUT) |
3333
(1ULL << VIRTIO_F_VERSION_1) |
34-
(1ULL << VIRTIO_F_IOMMU_PLATFORM) |
34+
(1ULL << VIRTIO_F_ACCESS_PLATFORM) |
3535
(1ULL << VIRTIO_F_RING_PACKED) |
3636
(1ULL << VIRTIO_F_ORDER_PLATFORM) |
3737
(1ULL << VIRTIO_RING_F_INDIRECT_DESC) |

‎drivers/virtio/virtio_balloon.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ static int virtballoon_validate(struct virtio_device *vdev)
11291129
else if (!virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON))
11301130
__virtio_clear_bit(vdev, VIRTIO_BALLOON_F_REPORTING);
11311131

1132-
__virtio_clear_bit(vdev, VIRTIO_F_IOMMU_PLATFORM);
1132+
__virtio_clear_bit(vdev, VIRTIO_F_ACCESS_PLATFORM);
11331133
return 0;
11341134
}
11351135

‎drivers/virtio/virtio_ring.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2225,7 +2225,7 @@ void vring_transport_features(struct virtio_device *vdev)
22252225
break;
22262226
case VIRTIO_F_VERSION_1:
22272227
break;
2228-
case VIRTIO_F_IOMMU_PLATFORM:
2228+
case VIRTIO_F_ACCESS_PLATFORM:
22292229
break;
22302230
case VIRTIO_F_RING_PACKED:
22312231
break;

‎include/linux/virtio_config.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev)
171171
* Note the reverse polarity of the quirk feature (compared to most
172172
* other features), this is for compatibility with legacy systems.
173173
*/
174-
return !virtio_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM);
174+
return !virtio_has_feature(vdev, VIRTIO_F_ACCESS_PLATFORM);
175175
}
176176

177177
static inline

‎include/uapi/linux/virtio_config.h‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,17 @@
6767
#define VIRTIO_F_VERSION_1 32
6868

6969
/*
70-
* If clear - device has the IOMMU bypass quirk feature.
71-
* If set - use platform tools to detect the IOMMU.
70+
* If clear - device has the platform DMA (e.g. IOMMU) bypass quirk feature.
71+
* If set - use platform DMA tools to access the memory.
7272
*
7373
* Note the reverse polarity (compared to most other features),
7474
* this is for compatibility with legacy systems.
7575
*/
76-
#define VIRTIO_F_IOMMU_PLATFORM 33
76+
#define VIRTIO_F_ACCESS_PLATFORM 33
77+
#ifndef __KERNEL__
78+
/* Legacy name for VIRTIO_F_ACCESS_PLATFORM (for compatibility with old userspace) */
79+
#define VIRTIO_F_IOMMU_PLATFORM VIRTIO_F_ACCESS_PLATFORM
80+
#endif /* __KERNEL__ */
7781

7882
/* This feature indicates support for the packed virtqueue layout. */
7983
#define VIRTIO_F_RING_PACKED 34

‎tools/virtio/linux/virtio_config.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev)
5151
* Note the reverse polarity of the quirk feature (compared to most
5252
* other features), this is for compatibility with legacy systems.
5353
*/
54-
return !virtio_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM);
54+
return !virtio_has_feature(vdev, VIRTIO_F_ACCESS_PLATFORM);
5555
}
5656

5757
static inline bool virtio_is_little_endian(struct virtio_device *vdev)

0 commit comments

Comments
 (0)