xref: /kvmtool/include/linux/virtio_mmio.h (revision a08bb43a0c37cb860d31c03e0dca81be8355551c)
1*a08bb43aSAndre Przywara /*
2*a08bb43aSAndre Przywara  * Virtio platform device driver
3*a08bb43aSAndre Przywara  *
4*a08bb43aSAndre Przywara  * Copyright 2011, ARM Ltd.
5*a08bb43aSAndre Przywara  *
6*a08bb43aSAndre Przywara  * Based on Virtio PCI driver by Anthony Liguori, copyright IBM Corp. 2007
7*a08bb43aSAndre Przywara  *
8*a08bb43aSAndre Przywara  * This header is BSD licensed so anyone can use the definitions to implement
9*a08bb43aSAndre Przywara  * compatible drivers/servers.
10*a08bb43aSAndre Przywara  *
11*a08bb43aSAndre Przywara  * Redistribution and use in source and binary forms, with or without
12*a08bb43aSAndre Przywara  * modification, are permitted provided that the following conditions
13*a08bb43aSAndre Przywara  * are met:
14*a08bb43aSAndre Przywara  * 1. Redistributions of source code must retain the above copyright
15*a08bb43aSAndre Przywara  *    notice, this list of conditions and the following disclaimer.
16*a08bb43aSAndre Przywara  * 2. Redistributions in binary form must reproduce the above copyright
17*a08bb43aSAndre Przywara  *    notice, this list of conditions and the following disclaimer in the
18*a08bb43aSAndre Przywara  *    documentation and/or other materials provided with the distribution.
19*a08bb43aSAndre Przywara  * 3. Neither the name of IBM nor the names of its contributors
20*a08bb43aSAndre Przywara  *    may be used to endorse or promote products derived from this software
21*a08bb43aSAndre Przywara  *    without specific prior written permission.
22*a08bb43aSAndre Przywara  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
23*a08bb43aSAndre Przywara  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*a08bb43aSAndre Przywara  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*a08bb43aSAndre Przywara  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
26*a08bb43aSAndre Przywara  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*a08bb43aSAndre Przywara  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*a08bb43aSAndre Przywara  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*a08bb43aSAndre Przywara  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*a08bb43aSAndre Przywara  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*a08bb43aSAndre Przywara  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*a08bb43aSAndre Przywara  * SUCH DAMAGE.
33*a08bb43aSAndre Przywara  */
34*a08bb43aSAndre Przywara 
35*a08bb43aSAndre Przywara #ifndef _LINUX_VIRTIO_MMIO_H
36*a08bb43aSAndre Przywara #define _LINUX_VIRTIO_MMIO_H
37*a08bb43aSAndre Przywara 
38*a08bb43aSAndre Przywara /*
39*a08bb43aSAndre Przywara  * Control registers
40*a08bb43aSAndre Przywara  */
41*a08bb43aSAndre Przywara 
42*a08bb43aSAndre Przywara /* Magic value ("virt" string) - Read Only */
43*a08bb43aSAndre Przywara #define VIRTIO_MMIO_MAGIC_VALUE		0x000
44*a08bb43aSAndre Przywara 
45*a08bb43aSAndre Przywara /* Virtio device version - Read Only */
46*a08bb43aSAndre Przywara #define VIRTIO_MMIO_VERSION		0x004
47*a08bb43aSAndre Przywara 
48*a08bb43aSAndre Przywara /* Virtio device ID - Read Only */
49*a08bb43aSAndre Przywara #define VIRTIO_MMIO_DEVICE_ID		0x008
50*a08bb43aSAndre Przywara 
51*a08bb43aSAndre Przywara /* Virtio vendor ID - Read Only */
52*a08bb43aSAndre Przywara #define VIRTIO_MMIO_VENDOR_ID		0x00c
53*a08bb43aSAndre Przywara 
54*a08bb43aSAndre Przywara /* Bitmask of the features supported by the host
55*a08bb43aSAndre Przywara  * (32 bits per set) - Read Only */
56*a08bb43aSAndre Przywara #define VIRTIO_MMIO_HOST_FEATURES	0x010
57*a08bb43aSAndre Przywara 
58*a08bb43aSAndre Przywara /* Host features set selector - Write Only */
59*a08bb43aSAndre Przywara #define VIRTIO_MMIO_HOST_FEATURES_SEL	0x014
60*a08bb43aSAndre Przywara 
61*a08bb43aSAndre Przywara /* Bitmask of features activated by the guest
62*a08bb43aSAndre Przywara  * (32 bits per set) - Write Only */
63*a08bb43aSAndre Przywara #define VIRTIO_MMIO_GUEST_FEATURES	0x020
64*a08bb43aSAndre Przywara 
65*a08bb43aSAndre Przywara /* Activated features set selector - Write Only */
66*a08bb43aSAndre Przywara #define VIRTIO_MMIO_GUEST_FEATURES_SEL	0x024
67*a08bb43aSAndre Przywara 
68*a08bb43aSAndre Przywara /* Guest's memory page size in bytes - Write Only */
69*a08bb43aSAndre Przywara #define VIRTIO_MMIO_GUEST_PAGE_SIZE	0x028
70*a08bb43aSAndre Przywara 
71*a08bb43aSAndre Przywara /* Queue selector - Write Only */
72*a08bb43aSAndre Przywara #define VIRTIO_MMIO_QUEUE_SEL		0x030
73*a08bb43aSAndre Przywara 
74*a08bb43aSAndre Przywara /* Maximum size of the currently selected queue - Read Only */
75*a08bb43aSAndre Przywara #define VIRTIO_MMIO_QUEUE_NUM_MAX	0x034
76*a08bb43aSAndre Przywara 
77*a08bb43aSAndre Przywara /* Queue size for the currently selected queue - Write Only */
78*a08bb43aSAndre Przywara #define VIRTIO_MMIO_QUEUE_NUM		0x038
79*a08bb43aSAndre Przywara 
80*a08bb43aSAndre Przywara /* Used Ring alignment for the currently selected queue - Write Only */
81*a08bb43aSAndre Przywara #define VIRTIO_MMIO_QUEUE_ALIGN		0x03c
82*a08bb43aSAndre Przywara 
83*a08bb43aSAndre Przywara /* Guest's PFN for the currently selected queue - Read Write */
84*a08bb43aSAndre Przywara #define VIRTIO_MMIO_QUEUE_PFN		0x040
85*a08bb43aSAndre Przywara 
86*a08bb43aSAndre Przywara /* Queue notifier - Write Only */
87*a08bb43aSAndre Przywara #define VIRTIO_MMIO_QUEUE_NOTIFY	0x050
88*a08bb43aSAndre Przywara 
89*a08bb43aSAndre Przywara /* Interrupt status - Read Only */
90*a08bb43aSAndre Przywara #define VIRTIO_MMIO_INTERRUPT_STATUS	0x060
91*a08bb43aSAndre Przywara 
92*a08bb43aSAndre Przywara /* Interrupt acknowledge - Write Only */
93*a08bb43aSAndre Przywara #define VIRTIO_MMIO_INTERRUPT_ACK	0x064
94*a08bb43aSAndre Przywara 
95*a08bb43aSAndre Przywara /* Device status register - Read Write */
96*a08bb43aSAndre Przywara #define VIRTIO_MMIO_STATUS		0x070
97*a08bb43aSAndre Przywara 
98*a08bb43aSAndre Przywara /* The config space is defined by each driver as
99*a08bb43aSAndre Przywara  * the per-driver configuration space - Read Write */
100*a08bb43aSAndre Przywara #define VIRTIO_MMIO_CONFIG		0x100
101*a08bb43aSAndre Przywara 
102*a08bb43aSAndre Przywara 
103*a08bb43aSAndre Przywara 
104*a08bb43aSAndre Przywara /*
105*a08bb43aSAndre Przywara  * Interrupt flags (re: interrupt status & acknowledge registers)
106*a08bb43aSAndre Przywara  */
107*a08bb43aSAndre Przywara 
108*a08bb43aSAndre Przywara #define VIRTIO_MMIO_INT_VRING		(1 << 0)
109*a08bb43aSAndre Przywara #define VIRTIO_MMIO_INT_CONFIG		(1 << 1)
110*a08bb43aSAndre Przywara 
111*a08bb43aSAndre Przywara #endif
112