~ubuntu-branches/ubuntu/saucy/qemu/saucy-proposed

« back to all changes in this revision

Viewing changes to hw/dataplane/vring.h

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-05-28 08:18:30 UTC
  • mfrom: (1.8.2) (10.1.37 sid)
  • Revision ID: package-import@ubuntu.com-20130528081830-87xl2z9fq516a814
Tags: 1.5.0+dfsg-2ubuntu1
* Merge 1.5.0+dfs-2 from debian unstable.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - Dropped patches:
    * 0001-fix-wrong-output-with-info-chardev-for-tcp-socket.patch
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * gridcentric patch - updated
    * linaro arm patches from qemu-linaro rebasing branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2012 Red Hat, Inc. and/or its affiliates
2
 
 * Copyright IBM, Corp. 2012
3
 
 *
4
 
 * Based on Linux 2.6.39 vhost code:
5
 
 * Copyright (C) 2009 Red Hat, Inc.
6
 
 * Copyright (C) 2006 Rusty Russell IBM Corporation
7
 
 *
8
 
 * Author: Michael S. Tsirkin <mst@redhat.com>
9
 
 *         Stefan Hajnoczi <stefanha@redhat.com>
10
 
 *
11
 
 * Inspiration, some code, and most witty comments come from
12
 
 * Documentation/virtual/lguest/lguest.c, by Rusty Russell
13
 
 *
14
 
 * This work is licensed under the terms of the GNU GPL, version 2.
15
 
 */
16
 
 
17
 
#ifndef VRING_H
18
 
#define VRING_H
19
 
 
20
 
#include <linux/virtio_ring.h>
21
 
#include "qemu-common.h"
22
 
#include "hw/dataplane/hostmem.h"
23
 
#include "hw/virtio.h"
24
 
 
25
 
typedef struct {
26
 
    HostMem hostmem;                /* guest memory mapper */
27
 
    struct vring vr;                /* virtqueue vring mapped to host memory */
28
 
    uint16_t last_avail_idx;        /* last processed avail ring index */
29
 
    uint16_t last_used_idx;         /* last processed used ring index */
30
 
    uint16_t signalled_used;        /* EVENT_IDX state */
31
 
    bool signalled_used_valid;
32
 
    bool broken;                    /* was there a fatal error? */
33
 
} Vring;
34
 
 
35
 
static inline unsigned int vring_get_num(Vring *vring)
36
 
{
37
 
    return vring->vr.num;
38
 
}
39
 
 
40
 
/* Are there more descriptors available? */
41
 
static inline bool vring_more_avail(Vring *vring)
42
 
{
43
 
    return vring->vr.avail->idx != vring->last_avail_idx;
44
 
}
45
 
 
46
 
/* Fail future vring_pop() and vring_push() calls until reset */
47
 
static inline void vring_set_broken(Vring *vring)
48
 
{
49
 
    vring->broken = true;
50
 
}
51
 
 
52
 
bool vring_setup(Vring *vring, VirtIODevice *vdev, int n);
53
 
void vring_teardown(Vring *vring);
54
 
void vring_disable_notification(VirtIODevice *vdev, Vring *vring);
55
 
bool vring_enable_notification(VirtIODevice *vdev, Vring *vring);
56
 
bool vring_should_notify(VirtIODevice *vdev, Vring *vring);
57
 
int vring_pop(VirtIODevice *vdev, Vring *vring,
58
 
              struct iovec iov[], struct iovec *iov_end,
59
 
              unsigned int *out_num, unsigned int *in_num);
60
 
void vring_push(Vring *vring, unsigned int head, int len);
61
 
 
62
 
#endif /* VRING_H */