 a8ac88585d
			
		
	
	
		a8ac88585d
		
	
	
	
	
		
			
			This will make qemu aware of the device used buffers, allowing it to write the guest memory with its contents if needed. Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * vhost shadow virtqueue
 | |
|  *
 | |
|  * SPDX-FileCopyrightText: Red Hat, Inc. 2021
 | |
|  * SPDX-FileContributor: Author: Eugenio Pérez <eperezma@redhat.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: GPL-2.0-or-later
 | |
|  */
 | |
| 
 | |
| #ifndef VHOST_SHADOW_VIRTQUEUE_H
 | |
| #define VHOST_SHADOW_VIRTQUEUE_H
 | |
| 
 | |
| #include "qemu/event_notifier.h"
 | |
| 
 | |
| /* Shadow virtqueue to relay notifications */
 | |
| typedef struct VhostShadowVirtqueue {
 | |
|     /* Shadow kick notifier, sent to vhost */
 | |
|     EventNotifier hdev_kick;
 | |
|     /* Shadow call notifier, sent to vhost */
 | |
|     EventNotifier hdev_call;
 | |
| 
 | |
|     /*
 | |
|      * Borrowed virtqueue's guest to host notifier. To borrow it in this event
 | |
|      * notifier allows to recover the VhostShadowVirtqueue from the event loop
 | |
|      * easily. If we use the VirtQueue's one, we don't have an easy way to
 | |
|      * retrieve VhostShadowVirtqueue.
 | |
|      *
 | |
|      * So shadow virtqueue must not clean it, or we would lose VirtQueue one.
 | |
|      */
 | |
|     EventNotifier svq_kick;
 | |
| 
 | |
|     /* Guest's call notifier, where the SVQ calls guest. */
 | |
|     EventNotifier svq_call;
 | |
| } VhostShadowVirtqueue;
 | |
| 
 | |
| void vhost_svq_set_svq_kick_fd(VhostShadowVirtqueue *svq, int svq_kick_fd);
 | |
| void vhost_svq_set_svq_call_fd(VhostShadowVirtqueue *svq, int call_fd);
 | |
| 
 | |
| void vhost_svq_stop(VhostShadowVirtqueue *svq);
 | |
| 
 | |
| VhostShadowVirtqueue *vhost_svq_new(void);
 | |
| 
 | |
| void vhost_svq_free(gpointer vq);
 | |
| G_DEFINE_AUTOPTR_CLEANUP_FUNC(VhostShadowVirtqueue, vhost_svq_free);
 | |
| 
 | |
| #endif
 |