On 7/18/25 4:36 PM, Stefano Garzarella wrote: > On Fri, Jul 18, 2025 at 10:52:33AM +0200, Paolo Abeni wrote: >> @@ -1871,6 +1900,20 @@ uint64_t vhost_get_features(struct vhost_dev *hdev, >> const int *feature_bits, >> return features; >> } >> >> +void vhost_get_features_ex(struct vhost_dev *hdev, >> + const int *feature_bits, >> + uint64_t *features) >> +{ >> + const int *bit = feature_bits; >> + >> + while (*bit != VHOST_INVALID_FEATURE_BIT) { >> + if (!virtio_has_feature_ex(hdev->features_ex, *bit)) { >> + virtio_clear_feature_ex(features, *bit); >> + } >> + bit++; >> + } >> +} >> + > > Can we do something similar of what we do in hw/virtio/virtio.c where > the old virtio_set_features() use the new virtio_set_features_ex()? > >> void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits, >> uint64_t features) >> { >> @@ -1884,6 +1927,18 @@ void vhost_ack_features(struct vhost_dev *hdev, const >> int *feature_bits, >> } >> } >> >> +void vhost_ack_features_ex(struct vhost_dev *hdev, const int *feature_bits, >> + const uint64_t *features) >> +{ >> + const int *bit = feature_bits; >> + while (*bit != VHOST_INVALID_FEATURE_BIT) { >> + if (virtio_has_feature_ex(features, *bit)) { >> + virtio_add_feature_ex(hdev->acked_features_ex, *bit); >> + } >> + bit++; >> + } >> +} >> + > > Ditto. > > Not a strong opinion, but just to reduce code duplication.
The incremental diffstat with such cleanup looks good, so I'll include that in the next revision, thanks! Paolo