2 * This work is licensed under the terms of the GNU GPL, version 2 or
3 * (at your option) any later version. See the COPYING file in the
7 #include "qemu/osdep.h"
8 #include "hw/virtio/virtio-input.h"
10 static Property vinput_properties
[] = {
11 DEFINE_PROP_CHR("chardev", VHostUserBase
, chardev
),
12 DEFINE_PROP_END_OF_LIST(),
15 static void vinput_realize(DeviceState
*dev
, Error
**errp
)
17 VHostUserBase
*vub
= VHOST_USER_BASE(dev
);
18 VHostUserBaseClass
*vubc
= VHOST_USER_BASE_GET_CLASS(dev
);
20 /* Fixed for input device */
21 vub
->virtio_id
= VIRTIO_ID_INPUT
;
24 vub
->config_size
= sizeof(virtio_input_config
);
26 vubc
->parent_realize(dev
, errp
);
29 static const VMStateDescription vmstate_vhost_input
= {
30 .name
= "vhost-user-input",
34 static void vhost_input_class_init(ObjectClass
*klass
, void *data
)
36 VHostUserBaseClass
*vubc
= VHOST_USER_BASE_CLASS(klass
);
37 DeviceClass
*dc
= DEVICE_CLASS(klass
);
39 dc
->vmsd
= &vmstate_vhost_input
;
40 device_class_set_props(dc
, vinput_properties
);
41 device_class_set_parent_realize(dc
, vinput_realize
,
42 &vubc
->parent_realize
);
43 set_bit(DEVICE_CATEGORY_INPUT
, dc
->categories
);
46 static const TypeInfo vhost_input_info
= {
47 .name
= TYPE_VHOST_USER_INPUT
,
48 .parent
= TYPE_VHOST_USER_BASE
,
49 .instance_size
= sizeof(VHostUserInput
),
50 .class_init
= vhost_input_class_init
,
53 static void vhost_input_register_types(void)
55 type_register_static(&vhost_input_info
);
58 type_init(vhost_input_register_types
)