mirror of
				https://github.com/qemu/qemu.git
				synced 2025-10-31 20:44:16 +00:00 
			
		
		
		
	 f92a2d61cd
			
		
	
	
		f92a2d61cd
		
	
	
	
	
		
			
			To use the generic device the user will need to provide the config region size via the command line. We also add a notifier so the guest can be pinged if the remote daemon updates the config. With these changes: -device vhost-user-device-pci,virtio-id=41,num_vqs=2,config_size=8 is equivalent to: -device vhost-user-gpio-pci Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230710153522.3469097-11-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * Vhost-user generic virtio device
 | |
|  *
 | |
|  * Copyright (c) 2023 Linaro Ltd
 | |
|  *
 | |
|  * SPDX-License-Identifier: GPL-2.0-or-later
 | |
|  */
 | |
| 
 | |
| #ifndef QEMU_VHOST_USER_DEVICE_H
 | |
| #define QEMU_VHOST_USER_DEVICE_H
 | |
| 
 | |
| #include "hw/virtio/vhost.h"
 | |
| #include "hw/virtio/vhost-user.h"
 | |
| 
 | |
| #define TYPE_VHOST_USER_BASE "vhost-user-base"
 | |
| 
 | |
| OBJECT_DECLARE_TYPE(VHostUserBase, VHostUserBaseClass, VHOST_USER_BASE)
 | |
| 
 | |
| struct VHostUserBase {
 | |
|     VirtIODevice parent;
 | |
|     /* Properties */
 | |
|     CharBackend chardev;
 | |
|     uint16_t virtio_id;
 | |
|     uint32_t num_vqs;
 | |
|     uint32_t config_size;
 | |
|     /* State tracking */
 | |
|     VhostUserState vhost_user;
 | |
|     struct vhost_virtqueue *vhost_vq;
 | |
|     struct vhost_dev vhost_dev;
 | |
|     GPtrArray *vqs;
 | |
|     bool connected;
 | |
| };
 | |
| 
 | |
|     /* needed so we can use the base realize after specialisation
 | |
|        tweaks */
 | |
| struct VHostUserBaseClass {
 | |
|     /*< private >*/
 | |
|     VirtioDeviceClass parent_class;
 | |
|     /*< public >*/
 | |
|     DeviceRealize parent_realize;
 | |
| };
 | |
| 
 | |
| /* shared for the benefit of the derived pci class */
 | |
| #define TYPE_VHOST_USER_DEVICE "vhost-user-device"
 | |
| 
 | |
| #endif /* QEMU_VHOST_USER_DEVICE_H */
 |