Rename the bit to match latest virtio spec. Add a compat macro to avoid breaking existing userspace.
Unified · Split
| @@ -385,7 +385,7 @@ static irqreturn_t vu_req_interrupt(int irq, void *data) · 384 unmodified lines | ||
| 385 | 385 | } |
| 386 | 386 | break; |
| 387 | 387 | case VHOST_USER_SLAVE_IOTLB_MSG: |
| 388 | − /* not supported - VIRTIO_F_IOMMU_PLATFORM */ | |
| 388 | + /* not supported - VIRTIO_F_ACCESS_PLATFORM */ | |
| 389 | 389 | case VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG: |
| 390 | 390 | /* not supported - VHOST_USER_PROTOCOL_F_HOST_NOTIFIER */ |
| 391 | 391 | default: |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | (1ULL << VIRTIO_F_VERSION_1) | \ |
| 30 | 30 | (1ULL << VIRTIO_NET_F_STATUS) | \ |
| 31 | 31 | (1ULL << VIRTIO_F_ORDER_PLATFORM) | \ |
| 32 | − (1ULL << VIRTIO_F_IOMMU_PLATFORM) | \ | |
| 32 | + (1ULL << VIRTIO_F_ACCESS_PLATFORM) | \ | |
| 33 | 33 | (1ULL << VIRTIO_NET_F_MRG_RXBUF)) |
| 34 | 34 | |
| 35 | 35 | /* Only one queue pair for now. */ |
| @@ -55,7 +55,7 @@ struct vdpasim_virtqueue { · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | static u64 vdpasim_features = (1ULL << VIRTIO_F_ANY_LAYOUT) | |
| 57 | 57 | (1ULL << VIRTIO_F_VERSION_1) | |
| 58 | − (1ULL << VIRTIO_F_IOMMU_PLATFORM); | |
| 58 | + (1ULL << VIRTIO_F_ACCESS_PLATFORM); | |
| 59 | 59 | |
| 60 | 60 | /* State of each vdpasim device */ |
| 61 | 61 | struct vdpasim { |
| @@ -450,7 +450,7 @@ static int vdpasim_set_features(struct vdpa_device *vdpa, u64 features) · 388 unmodified lines | ||
| 450 | 450 | struct vdpasim *vdpasim = vdpa_to_sim(vdpa); |
| 451 | 451 | |
| 452 | 452 | /* DMA mapping must be done by driver */ |
| 453 | − if (!(features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) | |
| 453 | + if (!(features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) | |
| 454 | 454 | return -EINVAL; |
| 455 | 455 | |
| 456 | 456 | vdpasim->features = features & vdpasim_features; |
| @@ -73,7 +73,7 @@ enum { · 72 unmodified lines | ||
| 73 | 73 | VHOST_NET_FEATURES = VHOST_FEATURES | |
| 74 | 74 | (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) | |
| 75 | 75 | (1ULL << VIRTIO_NET_F_MRG_RXBUF) | |
| 76 | − (1ULL << VIRTIO_F_IOMMU_PLATFORM) | |
| 76 | + (1ULL << VIRTIO_F_ACCESS_PLATFORM) | |
| 77 | 77 | }; |
| 78 | 78 | |
| 79 | 79 | enum { |
| @@ -1653,7 +1653,7 @@ static int vhost_net_set_features(struct vhost_net *n, u64 features) · 1573 unmodified lines | ||
| 1653 | 1653 | !vhost_log_access_ok(&n->dev)) |
| 1654 | 1654 | goto out_unlock; |
| 1655 | 1655 | |
| 1656 | − if ((features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) { | |
| 1656 | + if ((features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) { | |
| 1657 | 1657 | if (vhost_init_device_iotlb(&n->dev, true)) |
| 1658 | 1658 | goto out_unlock; |
| 1659 | 1659 | } |
| @@ -31,7 +31,7 @@ enum { · 30 unmodified lines | ||
| 31 | 31 | (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | |
| 32 | 32 | (1ULL << VIRTIO_F_ANY_LAYOUT) | |
| 33 | 33 | (1ULL << VIRTIO_F_VERSION_1) | |
| 34 | − (1ULL << VIRTIO_F_IOMMU_PLATFORM) | | |
| 34 | + (1ULL << VIRTIO_F_ACCESS_PLATFORM) | | |
| 35 | 35 | (1ULL << VIRTIO_F_RING_PACKED) | |
| 36 | 36 | (1ULL << VIRTIO_F_ORDER_PLATFORM) | |
| 37 | 37 | (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | |
| @@ -1129,7 +1129,7 @@ static int virtballoon_validate(struct virtio_device *vdev) · 1128 unmodified lines | ||
| 1129 | 1129 | else if (!virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON)) |
| 1130 | 1130 | __virtio_clear_bit(vdev, VIRTIO_BALLOON_F_REPORTING); |
| 1131 | 1131 | |
| 1132 | − __virtio_clear_bit(vdev, VIRTIO_F_IOMMU_PLATFORM); | |
| 1132 | + __virtio_clear_bit(vdev, VIRTIO_F_ACCESS_PLATFORM); | |
| 1133 | 1133 | return 0; |
| 1134 | 1134 | } |
| 1135 | 1135 | |
| @@ -2225,7 +2225,7 @@ void vring_transport_features(struct virtio_device *vdev) · 2224 unmodified lines | ||
| 2225 | 2225 | break; |
| 2226 | 2226 | case VIRTIO_F_VERSION_1: |
| 2227 | 2227 | break; |
| 2228 | − case VIRTIO_F_IOMMU_PLATFORM: | |
| 2228 | + case VIRTIO_F_ACCESS_PLATFORM: | |
| 2229 | 2229 | break; |
| 2230 | 2230 | case VIRTIO_F_RING_PACKED: |
| 2231 | 2231 | break; |
| @@ -171,7 +171,7 @@ static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev) · 170 unmodified lines | ||
| 171 | 171 | * Note the reverse polarity of the quirk feature (compared to most |
| 172 | 172 | * other features), this is for compatibility with legacy systems. |
| 173 | 173 | */ |
| 174 | − return !virtio_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); | |
| 174 | + return !virtio_has_feature(vdev, VIRTIO_F_ACCESS_PLATFORM); | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | static inline |
| @@ -67,13 +67,17 @@ · 66 unmodified lines | ||
| 67 | 67 | #define VIRTIO_F_VERSION_1 32 |
| 68 | 68 | |
| 69 | 69 | /* |
| 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. | |
| 72 | 72 | * |
| 73 | 73 | * Note the reverse polarity (compared to most other features), |
| 74 | 74 | * this is for compatibility with legacy systems. |
| 75 | 75 | */ |
| 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__ */ | |
| 77 | 81 | |
| 78 | 82 | /* This feature indicates support for the packed virtqueue layout. */ |
| 79 | 83 | #define VIRTIO_F_RING_PACKED 34 |
| @@ -51,7 +51,7 @@ static inline bool virtio_has_iommu_quirk(const struct virtio_device *vdev) · 50 unmodified lines | ||
| 51 | 51 | * Note the reverse polarity of the quirk feature (compared to most |
| 52 | 52 | * other features), this is for compatibility with legacy systems. |
| 53 | 53 | */ |
| 54 | − return !virtio_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); | |
| 54 | + return !virtio_has_feature(vdev, VIRTIO_F_ACCESS_PLATFORM); | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | static inline bool virtio_is_little_endian(struct virtio_device *vdev) |