xref: /openbmc/qemu/include/hw/arm/virt.h (revision 416296a9)
1 /*
2  *
3  * Copyright (c) 2015 Linaro Limited
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2 or later, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Emulate a virtual board which works by passing Linux all the information
18  * it needs about what devices are present via the device tree.
19  * There are some restrictions about what we can do here:
20  *  + we can only present devices whose Linux drivers will work based
21  *    purely on the device tree with no platform data at all
22  *  + we want to present a very stripped-down minimalist platform,
23  *    both because this reduces the security attack surface from the guest
24  *    and also because it reduces our exposure to being broken when
25  *    the kernel updates its device tree bindings and requires further
26  *    information in a device binding that we aren't providing.
27  * This is essentially the same approach kvmtool uses.
28  */
29 
30 #ifndef QEMU_ARM_VIRT_H
31 #define QEMU_ARM_VIRT_H
32 
33 #include "qemu-common.h"
34 #include "exec/hwaddr.h"
35 
36 #define NUM_GICV2M_SPIS       64
37 #define NUM_VIRTIO_TRANSPORTS 32
38 
39 #define ARCH_TIMER_VIRT_IRQ   11
40 #define ARCH_TIMER_S_EL1_IRQ  13
41 #define ARCH_TIMER_NS_EL1_IRQ 14
42 #define ARCH_TIMER_NS_EL2_IRQ 10
43 
44 #define VIRTUAL_PMU_IRQ 7
45 
46 #define PPI(irq) ((irq) + 16)
47 
48 enum {
49     VIRT_FLASH,
50     VIRT_MEM,
51     VIRT_CPUPERIPHS,
52     VIRT_GIC_DIST,
53     VIRT_GIC_CPU,
54     VIRT_GIC_V2M,
55     VIRT_GIC_ITS,
56     VIRT_GIC_REDIST,
57     VIRT_UART,
58     VIRT_MMIO,
59     VIRT_RTC,
60     VIRT_FW_CFG,
61     VIRT_PCIE,
62     VIRT_PCIE_MMIO,
63     VIRT_PCIE_PIO,
64     VIRT_PCIE_ECAM,
65     VIRT_PLATFORM_BUS,
66     VIRT_PCIE_MMIO_HIGH,
67     VIRT_GPIO,
68     VIRT_SECURE_UART,
69     VIRT_SECURE_MEM,
70 };
71 
72 typedef struct MemMapEntry {
73     hwaddr base;
74     hwaddr size;
75 } MemMapEntry;
76 
77 
78 #endif
79