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