~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to .pc/1.6.1.patch/include/hw/virtio/virtio-blk.h

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  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
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * 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.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Virtio Block Device
 
3
 *
 
4
 * Copyright IBM, Corp. 2007
 
5
 *
 
6
 * Authors:
 
7
 *  Anthony Liguori   <aliguori@us.ibm.com>
 
8
 *
 
9
 * This work is licensed under the terms of the GNU GPL, version 2.  See
 
10
 * the COPYING file in the top-level directory.
 
11
 *
 
12
 */
 
13
 
 
14
#ifndef _QEMU_VIRTIO_BLK_H
 
15
#define _QEMU_VIRTIO_BLK_H
 
16
 
 
17
#include "hw/virtio/virtio.h"
 
18
#include "hw/block/block.h"
 
19
 
 
20
#define TYPE_VIRTIO_BLK "virtio-blk-device"
 
21
#define VIRTIO_BLK(obj) \
 
22
        OBJECT_CHECK(VirtIOBlock, (obj), TYPE_VIRTIO_BLK)
 
23
 
 
24
/* from Linux's linux/virtio_blk.h */
 
25
 
 
26
/* The ID for virtio_block */
 
27
#define VIRTIO_ID_BLOCK 2
 
28
 
 
29
/* Feature bits */
 
30
#define VIRTIO_BLK_F_BARRIER    0       /* Does host support barriers? */
 
31
#define VIRTIO_BLK_F_SIZE_MAX   1       /* Indicates maximum segment size */
 
32
#define VIRTIO_BLK_F_SEG_MAX    2       /* Indicates maximum # of segments */
 
33
#define VIRTIO_BLK_F_GEOMETRY   4       /* Indicates support of legacy geometry */
 
34
#define VIRTIO_BLK_F_RO         5       /* Disk is read-only */
 
35
#define VIRTIO_BLK_F_BLK_SIZE   6       /* Block size of disk is available*/
 
36
#define VIRTIO_BLK_F_SCSI       7       /* Supports scsi command passthru */
 
37
/* #define VIRTIO_BLK_F_IDENTIFY   8       ATA IDENTIFY supported, DEPRECATED */
 
38
#define VIRTIO_BLK_F_WCE        9       /* write cache enabled */
 
39
#define VIRTIO_BLK_F_TOPOLOGY   10      /* Topology information is available */
 
40
#define VIRTIO_BLK_F_CONFIG_WCE 11      /* write cache configurable */
 
41
 
 
42
#define VIRTIO_BLK_ID_BYTES     20      /* ID string length */
 
43
 
 
44
struct virtio_blk_config
 
45
{
 
46
    uint64_t capacity;
 
47
    uint32_t size_max;
 
48
    uint32_t seg_max;
 
49
    uint16_t cylinders;
 
50
    uint8_t heads;
 
51
    uint8_t sectors;
 
52
    uint32_t blk_size;
 
53
    uint8_t physical_block_exp;
 
54
    uint8_t alignment_offset;
 
55
    uint16_t min_io_size;
 
56
    uint32_t opt_io_size;
 
57
    uint8_t wce;
 
58
} QEMU_PACKED;
 
59
 
 
60
/* These two define direction. */
 
61
#define VIRTIO_BLK_T_IN         0
 
62
#define VIRTIO_BLK_T_OUT        1
 
63
 
 
64
/* This bit says it's a scsi command, not an actual read or write. */
 
65
#define VIRTIO_BLK_T_SCSI_CMD   2
 
66
 
 
67
/* Flush the volatile write cache */
 
68
#define VIRTIO_BLK_T_FLUSH      4
 
69
 
 
70
/* return the device ID string */
 
71
#define VIRTIO_BLK_T_GET_ID     8
 
72
 
 
73
/* Barrier before this op. */
 
74
#define VIRTIO_BLK_T_BARRIER    0x80000000
 
75
 
 
76
/* This is the first element of the read scatter-gather list. */
 
77
struct virtio_blk_outhdr
 
78
{
 
79
    /* VIRTIO_BLK_T* */
 
80
    uint32_t type;
 
81
    /* io priority. */
 
82
    uint32_t ioprio;
 
83
    /* Sector (ie. 512 byte offset) */
 
84
    uint64_t sector;
 
85
};
 
86
 
 
87
#define VIRTIO_BLK_S_OK         0
 
88
#define VIRTIO_BLK_S_IOERR      1
 
89
#define VIRTIO_BLK_S_UNSUPP     2
 
90
 
 
91
/* This is the last element of the write scatter-gather list */
 
92
struct virtio_blk_inhdr
 
93
{
 
94
    unsigned char status;
 
95
};
 
96
 
 
97
/* SCSI pass-through header */
 
98
struct virtio_scsi_inhdr
 
99
{
 
100
    uint32_t errors;
 
101
    uint32_t data_len;
 
102
    uint32_t sense_len;
 
103
    uint32_t residual;
 
104
};
 
105
 
 
106
struct VirtIOBlkConf
 
107
{
 
108
    BlockConf conf;
 
109
    char *serial;
 
110
    uint32_t scsi;
 
111
    uint32_t config_wce;
 
112
    uint32_t data_plane;
 
113
};
 
114
 
 
115
struct VirtIOBlockDataPlane;
 
116
 
 
117
typedef struct VirtIOBlock {
 
118
    VirtIODevice parent_obj;
 
119
    BlockDriverState *bs;
 
120
    VirtQueue *vq;
 
121
    void *rq;
 
122
    QEMUBH *bh;
 
123
    BlockConf *conf;
 
124
    VirtIOBlkConf blk;
 
125
    unsigned short sector_mask;
 
126
    VMChangeStateEntry *change;
 
127
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
 
128
    Notifier migration_state_notifier;
 
129
    struct VirtIOBlockDataPlane *dataplane;
 
130
#endif
 
131
} VirtIOBlock;
 
132
 
 
133
#define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \
 
134
        DEFINE_VIRTIO_COMMON_FEATURES(_state, _field)
 
135
 
 
136
#ifdef __linux__
 
137
#define DEFINE_VIRTIO_BLK_PROPERTIES(_state, _field)                          \
 
138
        DEFINE_BLOCK_PROPERTIES(_state, _field.conf),                         \
 
139
        DEFINE_BLOCK_CHS_PROPERTIES(_state, _field.conf),                     \
 
140
        DEFINE_PROP_STRING("serial", _state, _field.serial),                  \
 
141
        DEFINE_PROP_BIT("config-wce", _state, _field.config_wce, 0, true),    \
 
142
        DEFINE_PROP_BIT("scsi", _state, _field.scsi, 0, true)
 
143
#else
 
144
#define DEFINE_VIRTIO_BLK_PROPERTIES(_state, _field)                          \
 
145
        DEFINE_BLOCK_PROPERTIES(_state, _field.conf),                         \
 
146
        DEFINE_BLOCK_CHS_PROPERTIES(_state, _field.conf),                     \
 
147
        DEFINE_PROP_STRING("serial", _state, _field.serial),                  \
 
148
        DEFINE_PROP_BIT("config-wce", _state, _field.config_wce, 0, true)
 
149
#endif /* __linux__ */
 
150
 
 
151
void virtio_blk_set_conf(DeviceState *dev, VirtIOBlkConf *blk);
 
152
 
 
153
#endif