[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v2 09/12] Add vhost-input-pci
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [RFC v2 09/12] Add vhost-input-pci |
Date: |
Fri, 8 Jun 2018 00:22:38 +0200 |
Hi
On Mon, Jun 4, 2018 at 10:58 AM, Gerd Hoffmann <address@hidden> wrote:
>> +#define TYPE_VHOST_USER_INPUT_PCI "vhost-user-input-pci"
>
> Patch $subject mismatch.
>
>> +struct VHostUserInput {
>> + VirtIOInput parent_obj;
>> +
>> + VhostUserBackend *vhost;
>> +};
>
> Nothing input specific here ...
Except VirtIOInput
>
>> +static void vhost_input_change_active(VirtIOInput *vinput)
>> +{
>> + VHostUserInput *vhi = VHOST_USER_INPUT(vinput);
>> +
>> + if (!vhi->vhost) {
>> + return;
>> + }
>> +
>> + if (vinput->active) {
>> + vhost_user_backend_start(vhi->vhost);
>> + } else {
>> + vhost_user_backend_stop(vhi->vhost);
>> + }
>> +}
>
> ... and here ...
Except it's a VirtIOInputClass callback
>
>> +static const VMStateDescription vmstate_vhost_input = {
>> + .name = "vhost-user-input",
>> + .unmigratable = 1,
>> +};
>
> ... and here ...
>
>> +static void vhost_input_is_busy(const Object *obj, const char *name,
>> + Object *val, Error **errp)
>> +{
>> + VHostUserInput *vhi = VHOST_USER_INPUT(obj);
>> +
>> + if (vhi->vhost) {
>> + error_setg(errp, "can't use already busy vhost-user");
>> + } else {
>> + qdev_prop_allow_set_link_before_realize(obj, name, val, errp);
>> + }
>> +}
>
> ... likewise ...
>
> So, maybe it makes sense to have a abstact base class for vhost-user
> devices? And possibly move the vhost-backend code to the base class
> then?
The device inherits from virtio-input type. So we could somehow not
expose -object vhost-user and instead have internal vhost-user object
& properties aliased & duplicated on each -device vhost-user*. I would
rather keep the -object solution, since it's somehow cleaner, more
flexible and simpler to document that way. Or do you have a better
idea?
--
Marc-André Lureau
[Qemu-devel] [RFC v2 10/12] vhost-user: add vhost_user_gpu_set_socket(), Marc-André Lureau, 2018/06/01
[Qemu-devel] [RFC v2 11/12] Add virtio-gpu vhost-user backend, Marc-André Lureau, 2018/06/01
[Qemu-devel] [RFC v2 12/12] contrib: add vhost-user-gpu, Marc-André Lureau, 2018/06/01
Re: [Qemu-devel] [RFC v2 00/12] vhost-user for input & GPU, no-reply, 2018/06/01