qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v6 02/11] Add vhost-user-input-pci


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH v6 02/11] Add vhost-user-input-pci
Date: Fri, 26 Apr 2019 09:11:52 +0200
User-agent: NeoMutt/20180716

> +static void vhost_input_get_config(VirtIODevice *vdev, uint8_t *config_data)
> +{
> +    VirtIOInput *vinput = VIRTIO_INPUT(vdev);
> +    VHostUserInput *vhi = VHOST_USER_INPUT(vdev);
> +    int ret;
> +
> +    memset(config_data, 0, vinput->cfg_size);
> +
> +    ret = vhost_dev_get_config(&vhi->vhost->dev, config_data, 
> vinput->cfg_size);
> +    if (ret) {
> +        error_report("vhost-user-input: get device config space failed");
> +        return;
> +    }
> +}
> +
> +static void vhost_input_set_config(VirtIODevice *vdev,
> +                                   const uint8_t *config_data)
> +{
> +    VHostUserInput *vhi = VHOST_USER_INPUT(vdev);
> +    int ret;
> +
> +    ret = vhost_dev_set_config(&vhi->vhost->dev, config_data,
> +                               0, sizeof(virtio_input_config),
> +                               VHOST_SET_CONFIG_TYPE_MASTER);
> +    if (ret) {
> +        error_report("vhost-user-input: set device config space failed");
> +        return;
> +    }
> +
> +    virtio_notify_config(vdev);
> +}

These two look rather generic, the only virtio-input specific thing is
the config space size.  Can we store the size somewhere, then move the
functions to common vhost-user code?

cheers,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]