On 1/15/2016 12:34 PM, Yuanhan Liu wrote:
> -static void
> +static int
>  virtio_negotiate_features(struct virtio_hw *hw)
>  {
>       uint64_t host_features;
> @@ -949,6 +949,22 @@ virtio_negotiate_features(struct virtio_hw *hw)
>       hw->guest_features = vtpci_negotiate_features(hw, host_features);

Here if we are not modern device, we should remove VIRTIO_F_VERSION_1 in
guest features.

>       PMD_INIT_LOG(DEBUG, "features after negotiate = %"PRIx64,
>               hw->guest_features);
> +
> +     if (hw->modern) {
> +             if (!vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) {
> +                     PMD_INIT_LOG(ERR,
> +                             "VIRTIO_F_VERSION_1 features is not enabled.");
> +                     return -1;
> +             }
> +             vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_FEATURES_OK);
> +             if (!(vtpci_get_status(hw) & VIRTIO_CONFIG_STATUS_FEATURES_OK)) 
> {
> +                     PMD_INIT_LOG(ERR,
> +                             "failed to set FEATURES_OK status!");
> +                     return -1;
> +             }
> +     }
> +
> +     return 0;
>  }

Reply via email to