mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
hw: move headers to include/
Many of these should be cleaned up with proper qdev-/QOM-ification. Right now there are many catch-all headers in include/hw/ARCH depending on cpu.h, and this makes it necessary to compile these files per-target. However, fixing this does not belong in these patches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
bb585a784e
commit
0d09e41a51
511 changed files with 829 additions and 830 deletions
62
include/hw/virtio/dataplane/vring.h
Normal file
62
include/hw/virtio/dataplane/vring.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
/* Copyright 2012 Red Hat, Inc. and/or its affiliates
|
||||
* Copyright IBM, Corp. 2012
|
||||
*
|
||||
* Based on Linux 2.6.39 vhost code:
|
||||
* Copyright (C) 2009 Red Hat, Inc.
|
||||
* Copyright (C) 2006 Rusty Russell IBM Corporation
|
||||
*
|
||||
* Author: Michael S. Tsirkin <mst@redhat.com>
|
||||
* Stefan Hajnoczi <stefanha@redhat.com>
|
||||
*
|
||||
* Inspiration, some code, and most witty comments come from
|
||||
* Documentation/virtual/lguest/lguest.c, by Rusty Russell
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2.
|
||||
*/
|
||||
|
||||
#ifndef VRING_H
|
||||
#define VRING_H
|
||||
|
||||
#include <linux/virtio_ring.h>
|
||||
#include "qemu-common.h"
|
||||
#include "hostmem.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
|
||||
typedef struct {
|
||||
HostMem hostmem; /* guest memory mapper */
|
||||
struct vring vr; /* virtqueue vring mapped to host memory */
|
||||
uint16_t last_avail_idx; /* last processed avail ring index */
|
||||
uint16_t last_used_idx; /* last processed used ring index */
|
||||
uint16_t signalled_used; /* EVENT_IDX state */
|
||||
bool signalled_used_valid;
|
||||
bool broken; /* was there a fatal error? */
|
||||
} Vring;
|
||||
|
||||
static inline unsigned int vring_get_num(Vring *vring)
|
||||
{
|
||||
return vring->vr.num;
|
||||
}
|
||||
|
||||
/* Are there more descriptors available? */
|
||||
static inline bool vring_more_avail(Vring *vring)
|
||||
{
|
||||
return vring->vr.avail->idx != vring->last_avail_idx;
|
||||
}
|
||||
|
||||
/* Fail future vring_pop() and vring_push() calls until reset */
|
||||
static inline void vring_set_broken(Vring *vring)
|
||||
{
|
||||
vring->broken = true;
|
||||
}
|
||||
|
||||
bool vring_setup(Vring *vring, VirtIODevice *vdev, int n);
|
||||
void vring_teardown(Vring *vring);
|
||||
void vring_disable_notification(VirtIODevice *vdev, Vring *vring);
|
||||
bool vring_enable_notification(VirtIODevice *vdev, Vring *vring);
|
||||
bool vring_should_notify(VirtIODevice *vdev, Vring *vring);
|
||||
int vring_pop(VirtIODevice *vdev, Vring *vring,
|
||||
struct iovec iov[], struct iovec *iov_end,
|
||||
unsigned int *out_num, unsigned int *in_num);
|
||||
void vring_push(Vring *vring, unsigned int head, int len);
|
||||
|
||||
#endif /* VRING_H */
|
Loading…
Add table
Add a link
Reference in a new issue