1 | /* $Id: DevIommuAmd.cpp 83545 2020-04-04 06:34:01Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IOMMU - Input/Output Memory Management Unit - AMD implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*********************************************************************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *********************************************************************************************************************************/
|
---|
22 | #define LOG_GROUP LOG_GROUP_DEV_IOMMU
|
---|
23 | #include <VBox/vmm/pdmdev.h>
|
---|
24 | #include <VBox/AssertGuest.h>
|
---|
25 |
|
---|
26 | #include "VBoxDD.h"
|
---|
27 | #include <iprt/x86.h>
|
---|
28 |
|
---|
29 |
|
---|
30 | /*********************************************************************************************************************************
|
---|
31 | * Defined Constants And Macros *
|
---|
32 | *********************************************************************************************************************************/
|
---|
33 | /** @name PCI configuration register offsets.
|
---|
34 | @{ */
|
---|
35 | #define IOMMU_PCI_OFF_CAP_HDR 0x00
|
---|
36 | #define IOMMU_PCI_OFF_BASE_ADDR_REG_LO 0x04
|
---|
37 | #define IOMMU_PCI_OFF_BASE_ADDR_REG_HI 0x08
|
---|
38 | #define IOMMU_PCI_OFF_RANGE_REG 0x0c
|
---|
39 | #define IOMMU_PCI_OFF_MISCINFO_REG_0 0x10
|
---|
40 | #define IOMMU_PCI_OFF_MISCINFO_REG_1 0x14
|
---|
41 | /** @} */
|
---|
42 |
|
---|
43 | /** @name MMIO register offsets.
|
---|
44 | * @{ */
|
---|
45 | #define IOMMU_MMIO_OFF_DEV_TAB_BAR 0x00
|
---|
46 | #define IOMMU_MMIO_OFF_CMD_BUF_BAR 0x08
|
---|
47 | #define IOMMU_MMIO_OFF_EVT_LOG_BAR 0x10
|
---|
48 | #define IOMMU_MMIO_OFF_CTRL 0x18
|
---|
49 | #define IOMMU_MMIO_OFF_EXCL_BAR 0x20
|
---|
50 | #define IOMMU_MMIO_OFF_EXCL_RANGE_LIMIT 0x28
|
---|
51 | #define IOMMU_MMIO_OFF_EXT_FEAT 0x30
|
---|
52 |
|
---|
53 | #define IOMMU_MMIO_OFF_PPR_LOG_BAR 0x38
|
---|
54 | #define IOMMU_MMIO_OFF_HW_EVT_HI 0x40
|
---|
55 | #define IOMMU_MMIO_OFF_HW_EVT_LO 0x48
|
---|
56 | #define IOMMU_MMIO_OFF_HW_EVT_STATUS 0x50
|
---|
57 |
|
---|
58 | #define IOMMU_MMIO_OFF_SMI_FLT_FIRST 0x60
|
---|
59 | #define IOMMU_MMIO_OFF_SMI_FLT_LAST 0xd8
|
---|
60 |
|
---|
61 | #define IOMMU_MMIO_OFF_GALOG_BAR 0xe0
|
---|
62 | #define IOMMU_MMIO_OFF_GALOG_TAIL_ADDR 0xe8
|
---|
63 |
|
---|
64 | #define IOMMU_MMIO_OFF_PPR_LOG_B_BAR 0xf0
|
---|
65 | #define IOMMU_MMIO_OFF_PPR_EVT_B_BAR 0xf8
|
---|
66 |
|
---|
67 | #define IOMMU_MMIO_OFF_DEV_TAB_SEG_FIRST 0x100
|
---|
68 | #define IOMMU_MMIO_OFF_DEV_TAB_SEG_LAST 0x130
|
---|
69 |
|
---|
70 | #define IOMMU_MMIO_OFF_DEV_SPECIFIC_FEAT 0x138
|
---|
71 | #define IOMMU_MMIO_OFF_DEV_SPECIFIC_CTRL 0x140
|
---|
72 | #define IOMMU_MMIO_OFF_DEV_SPECIFIC_STATUS 0x148
|
---|
73 |
|
---|
74 | #define IOMMU_MMIO_OFF_MSI_VECTOR_0 0x150
|
---|
75 | #define IOMMU_MMIO_OFF_MSI_VECTOR_1 0x154
|
---|
76 | #define IOMMU_MMIO_OFF_MSI_CAP_HDR 0x158
|
---|
77 | #define IOMMU_MMIO_OFF_MSI_ADDR_LO 0x15c
|
---|
78 | #define IOMMU_MMIO_OFF_MSI_ADDR_HI 0x160
|
---|
79 | #define IOMMU_MMIO_OFF_MSI_DATA 0x164
|
---|
80 | #define IOMMU_MMIO_OFF_MSI_MAPPING_CAP_HDR 0x168
|
---|
81 |
|
---|
82 | #define IOMMU_MMIO_OFF_PERF_OPT_CTRL 0x16c
|
---|
83 |
|
---|
84 | #define IOMMU_MMIO_OFF_XT_GEN_INTR_CTRL 0x170
|
---|
85 | #define IOMMU_MMIO_OFF_XT_PPR_INTR_CTRL 0x178
|
---|
86 | #define IOMMU_MMIO_OFF_XT_GALOG_INT_CTRL 0x180
|
---|
87 |
|
---|
88 | #define IOMMU_MMIO_OFF_MARC_APER_BAR_0 0x200
|
---|
89 | #define IOMMU_MMIO_OFF_MARC_APER_RELOC_0 0x208
|
---|
90 | #define IOMMU_MMIO_OFF_MARC_APER_LEN_0 0x210
|
---|
91 | #define IOMMU_MMIO_OFF_MARC_APER_BAR_1 0x218
|
---|
92 | #define IOMMU_MMIO_OFF_MARC_APER_RELOC_1 0x220
|
---|
93 | #define IOMMU_MMIO_OFF_MARC_APER_LEN_1 0x228
|
---|
94 | #define IOMMU_MMIO_OFF_MARC_APER_BAR_2 0x230
|
---|
95 | #define IOMMU_MMIO_OFF_MARC_APER_RELOC_2 0x238
|
---|
96 | #define IOMMU_MMIO_OFF_MARC_APER_LEN_2 0x240
|
---|
97 | #define IOMMU_MMIO_OFF_MARC_APER_BAR_3 0x248
|
---|
98 | #define IOMMU_MMIO_OFF_MARC_APER_RELOC_3 0x250
|
---|
99 | #define IOMMU_MMIO_OFF_MARC_APER_LEN_3 0x258
|
---|
100 |
|
---|
101 | #define IOMMU_MMIO_OFF_RSVD_REG 0x1ff8
|
---|
102 |
|
---|
103 | #define IOMMU_MMIO_CMD_BUF_HEAD_PTR 0x2000
|
---|
104 | #define IOMMU_MMIO_CMD_BUF_TAIL_PTR 0x2008
|
---|
105 | #define IOMMU_MMIO_EVT_LOG_HEAD_PTR 0x2010
|
---|
106 | #define IOMMU_MMIO_EVT_LOG_TAIL_PTR 0x2018
|
---|
107 |
|
---|
108 | #define IOMMU_MMIO_OFF_STATUS 0x2020
|
---|
109 |
|
---|
110 | #define IOMMU_MMIO_OFF_PPR_LOG_HEAD_PTR 0x2030
|
---|
111 | #define IOMMU_MMIO_OFF_PPR_LOG_TAIL_PTR 0x2038
|
---|
112 |
|
---|
113 | #define IOMMU_MMIO_OFF_GALOG_HEAD_PTR 0x2040
|
---|
114 | #define IOMMU_MMIO_OFF_GALOG_TAIL_PTR 0x2048
|
---|
115 |
|
---|
116 | #define IOMMU_MMIO_OFF_PPR_LOG_B_HEAD_PTR 0x2050
|
---|
117 | #define IOMMU_MMIO_OFF_PPR_LOG_B_TAIL_PTR 0x2058
|
---|
118 |
|
---|
119 | #define IOMMU_MMIO_OFF_EVT_LOG_B_HEAD_PTR 0x2070
|
---|
120 | #define IOMMU_MMIO_OFF_EVT_LOG_B_TAIL_PTR 0x2078
|
---|
121 |
|
---|
122 | #define IOMMU_MMIO_OFF_PPR_LOG_AUTO_RESP 0x2080
|
---|
123 | #define IOMMU_MMIO_OFF_PPR_LOG_OVERFLOW_EARLY 0x2088
|
---|
124 | #define IOMMU_MMIO_OFF_PPR_LOG_B_OVERFLOW_EARLY 0x2090
|
---|
125 | /** @} */
|
---|
126 |
|
---|
127 | /**
|
---|
128 | * @name Commands.
|
---|
129 | * In accordance with the AMD spec.
|
---|
130 | * @{
|
---|
131 | */
|
---|
132 | #define IOMMU_CMD_COMPLETION_WAIT 0x01
|
---|
133 | #define IOMMU_CMD_INV_DEV_TAB_ENTRY 0x02
|
---|
134 | #define IOMMU_CMD_INV_IOMMU_PAGES 0x03
|
---|
135 | #define IOMMU_CMD_INV_IOTLB_PAGES 0x04
|
---|
136 | #define IOMMU_CMD_INV_INTR_TABLE 0x05
|
---|
137 | #define IOMMU_CMD_PREFETCH_IOMMU_PAGES 0x06
|
---|
138 | #define IOMMU_CMD_COMPLETE_PPR_REQ 0x07
|
---|
139 | #define IOMMU_CMD_INV_IOMMU_ALL 0x08
|
---|
140 | /** @} */
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * @name Event codes.
|
---|
144 | * In accordance with the AMD spec.
|
---|
145 | * @{
|
---|
146 | */
|
---|
147 | #define IOMMU_EVT_ILLEGAL_DEV_TAB_ENTRY 0x01
|
---|
148 | #define IOMMU_EVT_IO_PAGE_FAULT 0x02
|
---|
149 | #define IOMMU_EVT_DEV_TAB_HARDWARE_ERROR 0x03
|
---|
150 | #define IOMMU_EVT_PAGE_TAB_HARDWARE_ERROR 0x04
|
---|
151 | #define IOMMU_EVT_ILLEGAL_COMMAND_ERROR 0x05
|
---|
152 | #define IOMMU_EVT_COMMAND_HARDWARE_ERROR 0x06
|
---|
153 | #define IOMMU_EVT_IOTLB_INV_TIMEOUT 0x07
|
---|
154 | #define IOMMU_EVT_INVALID_DEVICE_REQUEST 0x08
|
---|
155 | #define IOMMU_EVT_INVALID_PPR_REQUEST 0x09
|
---|
156 | #define IOMMU_EVT_EVENT_COUNTER_ZERO 0x10
|
---|
157 | #define IOMMU_EVT_GUEST_EVENT_FAULT 0x11
|
---|
158 | /** @} */
|
---|
159 |
|
---|
160 | /**
|
---|
161 | * @name IOMMU Capability Header.
|
---|
162 | * In accordance with the AMD spec.
|
---|
163 | * @{
|
---|
164 | */
|
---|
165 | /** CapId: Capability ID. */
|
---|
166 | #define IOMMU_BF_CAPHDR_CAP_ID_SHIFT 0
|
---|
167 | #define IOMMU_BF_CAPHDR_CAP_ID_MASK UINT32_C(0x000000ff)
|
---|
168 | /** CapPtr: Capability Pointer. */
|
---|
169 | #define IOMMU_BF_CAPHDR_CAP_PTR_SHIFT 8
|
---|
170 | #define IOMMU_BF_CAPHDR_CAP_PTR_MASK UINT32_C(0x0000ff00)
|
---|
171 | /** CapType: Capability Type. */
|
---|
172 | #define IOMMU_BF_CAPHDR_CAP_TYPE_SHIFT 16
|
---|
173 | #define IOMMU_BF_CAPHDR_CAP_TYPE_MASK UINT32_C(0x00070000)
|
---|
174 | /** CapRev: Capability Revision. */
|
---|
175 | #define IOMMU_BF_CAPHDR_CAP_REV_SHIFT 19
|
---|
176 | #define IOMMU_BF_CAPHDR_CAP_REV_MASK UINT32_C(0x00f80000)
|
---|
177 | /** IoTlbSup: IO TLB Support. */
|
---|
178 | #define IOMMU_BF_CAPHDR_IOTLB_SUP_SHIFT 24
|
---|
179 | #define IOMMU_BF_CAPHDR_IOTLB_SUP_MASK UINT32_C(0x01000000)
|
---|
180 | /** HtTunnel: HyperTransport Tunnel translation support. */
|
---|
181 | #define IOMMU_BF_CAPHDR_HT_TUNNEL_SHIFT 25
|
---|
182 | #define IOMMU_BF_CAPHDR_HT_TUNNEL_MASK UINT32_C(0x02000000)
|
---|
183 | /** NpCache: Not Present table entries Cached. */
|
---|
184 | #define IOMMU_BF_CAPHDR_NP_CACHE_SHIFT 26
|
---|
185 | #define IOMMU_BF_CAPHDR_NP_CACHE_MASK UINT32_C(0x04000000)
|
---|
186 | /** EFRSup: Extended Feature Register (EFR) Supported. */
|
---|
187 | #define IOMMU_BF_CAPHDR_EFR_SUP_SHIFT 27
|
---|
188 | #define IOMMU_BF_CAPHDR_EFR_SUP_MASK UINT32_C(0x08000000)
|
---|
189 | /** CapExt: Miscellaneous Information Register Supported . */
|
---|
190 | #define IOMMU_BF_CAPHDR_CAP_EXT_SHIFT 28
|
---|
191 | #define IOMMU_BF_CAPHDR_CAP_EXT_MASK UINT32_C(0x10000000)
|
---|
192 | /** Bits 31:29 reserved. */
|
---|
193 | #define IOMMU_BF_CAPHDR_RSVD_29_31_SHIFT 29
|
---|
194 | #define IOMMU_BF_CAPHDR_RSVD_29_31_MASK UINT32_C(0xe0000000)
|
---|
195 | RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_CAPHDR_, UINT32_C(0), UINT32_MAX,
|
---|
196 | (CAP_ID, CAP_PTR, CAP_TYPE, CAP_REV, IOTLB_SUP, HT_TUNNEL, NP_CACHE, EFR_SUP, CAP_EXT, RSVD_29_31));
|
---|
197 | /** @} */
|
---|
198 |
|
---|
199 | /**
|
---|
200 | * @name IOMMU Base Address Low Register.
|
---|
201 | * In accordance with the AMD spec.
|
---|
202 | * @{
|
---|
203 | */
|
---|
204 | /** Enable: Enables access to the address specified in the Base Address Register. */
|
---|
205 | #define IOMMU_BF_BASEADDR_LO_ENABLE_SHIFT 0
|
---|
206 | #define IOMMU_BF_BASEADDR_LO_ENABLE_MASK UINT32_C(0x00000001)
|
---|
207 | /** Bits 13:1 reserved. */
|
---|
208 | #define IOMMU_BF_BASEADDR_LO_RSVD_1_13_SHIFT 1
|
---|
209 | #define IOMMU_BF_BASEADDR_LO_RSVD_1_13_MASK UINT32_C(0x00003ffe)
|
---|
210 | /** Base Address[31:14]: Low Base address of IOMMU MMIO control registers. */
|
---|
211 | #define IOMMU_BF_BASEADDR_LO_ADDR_SHIFT 14
|
---|
212 | #define IOMMU_BF_BASEADDR_LO_ADDR_MASK UINT32_C(0xffffc000)
|
---|
213 | RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_BASEADDR_LO_, UINT32_C(0), UINT32_MAX,
|
---|
214 | (ENABLE, RSVD_1_13, ADDR));
|
---|
215 | /** @} */
|
---|
216 |
|
---|
217 | /**
|
---|
218 | * @name IOMMU Range Register.
|
---|
219 | * In accordance with the AMD spec.
|
---|
220 | * @{
|
---|
221 | */
|
---|
222 | /** UnitID: HyperTransport Unit ID. */
|
---|
223 | #define IOMMU_BF_RANGE_UNIT_ID_SHIFT 0
|
---|
224 | #define IOMMU_BF_RANGE_UNIT_ID_MASK UINT32_C(0x0000001f)
|
---|
225 | /** Bits 6:5 reserved. */
|
---|
226 | #define IOMMU_BF_RANGE_RSVD_5_6_SHIFT 5
|
---|
227 | #define IOMMU_BF_RANGE_RSVD_5_6_MASK UINT32_C(0x00000060)
|
---|
228 | /** RngValid: Range valid. */
|
---|
229 | #define IOMMU_BF_RANGE_VALID_SHIFT 7
|
---|
230 | #define IOMMU_BF_RANGE_VALID_MASK UINT32_C(0x00000080)
|
---|
231 | /** BusNumber: Device range bus number. */
|
---|
232 | #define IOMMU_BF_RANGE_BUS_NUMBER_SHIFT 8
|
---|
233 | #define IOMMU_BF_RANGE_BUS_NUMBER_MASK UINT32_C(0x0000ff00)
|
---|
234 | /** First Device. */
|
---|
235 | #define IOMMU_BF_RANGE_FIRST_DEVICE_SHIFT 16
|
---|
236 | #define IOMMU_BF_RANGE_FIRST_DEVICE_MASK UINT32_C(0x00ff0000)
|
---|
237 | /** Last Device. */
|
---|
238 | #define IOMMU_BF_RANGE_LAST_DEVICE_SHIFT 24
|
---|
239 | #define IOMMU_BF_RANGE_LAST_DEVICE_MASK UINT32_C(0xff000000)
|
---|
240 | RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_RANGE_, UINT32_C(0), UINT32_MAX,
|
---|
241 | (UNIT_ID, RSVD_5_6, VALID, BUS_NUMBER, FIRST_DEVICE, LAST_DEVICE));
|
---|
242 | /** @} */
|
---|
243 |
|
---|
244 | /**
|
---|
245 | * @name IOMMU Miscellaneous Information Register 0.
|
---|
246 | * In accordance with the AMD spec.
|
---|
247 | * @{
|
---|
248 | */
|
---|
249 | /** MsiNum: MSI message number. */
|
---|
250 | #define IOMMU_BF_MISCINFO_0_MSI_NUM_SHIFT 0
|
---|
251 | #define IOMMU_BF_MISCINFO_0_MSI_NUM_MASK UINT32_C(0x0000001f)
|
---|
252 | /** GvaSize: Guest Virtual Address Size. */
|
---|
253 | #define IOMMU_BF_MISCINFO_0_GVA_SIZE_SHIFT 5
|
---|
254 | #define IOMMU_BF_MISCINFO_0_GVA_SIZE_MASK UINT32_C(0x000000e0)
|
---|
255 | /** PaSize: Physical Address Size. */
|
---|
256 | #define IOMMU_BF_MISCINFO_0_PA_SIZE_SHIFT 8
|
---|
257 | #define IOMMU_BF_MISCINFO_0_PA_SIZE_MASK UINT32_C(0x00007f00)
|
---|
258 | /** VaSize: Virtual Address Size. */
|
---|
259 | #define IOMMU_BF_MISCINFO_0_VA_SIZE_SHIFT 15
|
---|
260 | #define IOMMU_BF_MISCINFO_0_VA_SIZE_MASK UINT32_C(0x003f8000)
|
---|
261 | /** HtAtsResv: HyperTransport ATS Response Address range Reserved. */
|
---|
262 | #define IOMMU_BF_MISCINFO_0_HT_ATS_RESV_SHIFT 22
|
---|
263 | #define IOMMU_BF_MISCINFO_0_HT_ATS_RESV_MASK UINT32_C(0x00400000)
|
---|
264 | /** Bits 26:23 reserved. */
|
---|
265 | #define IOMMU_BF_MISCINFO_0_RSVD_23_26_SHIFT 23
|
---|
266 | #define IOMMU_BF_MISCINFO_0_RSVD_23_26_MASK UINT32_C(0x07800000)
|
---|
267 | /** MsiNumPPR: Peripheral Page Request MSI message number. */
|
---|
268 | #define IOMMU_BF_MISCINFO_0_MSI_NUM_PPR_SHIFT 27
|
---|
269 | #define IOMMU_BF_MISCINFO_0_MSI_NUM_PPR_MASK UINT32_C(0xf8000000)
|
---|
270 | RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_MISCINFO_0_, UINT32_C(0), UINT32_MAX,
|
---|
271 | (MSI_NUM, GVA_SIZE, PA_SIZE, VA_SIZE, HT_ATS_RESV, RSVD_23_26, MSI_NUM_PPR));
|
---|
272 | /** @} */
|
---|
273 |
|
---|
274 | /**
|
---|
275 | * @name IOMMU Miscellaneous Information Register 1.
|
---|
276 | * In accordance with the AMD spec.
|
---|
277 | * @{
|
---|
278 | */
|
---|
279 | /** MsiNumGA: MSI message number for guest virtual-APIC log. */
|
---|
280 | #define IOMMU_BF_MISCINFO_1_MSI_NUM_GA_SHIFT 0
|
---|
281 | #define IOMMU_BF_MISCINFO_1_MSI_NUM_GA_MASK UINT32_C(0x0000001f)
|
---|
282 | /** Bits 31:5 reserved. */
|
---|
283 | #define IOMMU_BF_MISCINFO_1_RSVD_5_31_SHIFT 5
|
---|
284 | #define IOMMU_BF_MISCINFO_1_RSVD_5_31_MASK UINT32_C(0xffffffe0)
|
---|
285 | RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_MISCINFO_1_, UINT32_C(0), UINT32_MAX,
|
---|
286 | (MSI_NUM_GA, RSVD_5_31));
|
---|
287 | /** @} */
|
---|
288 |
|
---|
289 | /**
|
---|
290 | * @name MSI Capability Header Register.
|
---|
291 | * In accordance with the AMD spec.
|
---|
292 | * @{
|
---|
293 | */
|
---|
294 | /** MsiCapId: Capability ID. */
|
---|
295 | #define IOMMU_BF_MSI_CAPHDR_CAP_ID_SHIFT 0
|
---|
296 | #define IOMMU_BF_MSI_CAPHDR_CAP_ID_MASK UINT32_C(0x000000ff)
|
---|
297 | /** MsiCapPtr: Pointer (PCI config offset) to the next capability. */
|
---|
298 | #define IOMMU_BF_MSI_CAPHDR_CAP_PTR_SHIFT 8
|
---|
299 | #define IOMMU_BF_MSI_CAPHDR_CAP_PTR_MASK UINT32_C(0x0000ff00)
|
---|
300 | /** MsiEn: Message Signal Interrupt enable. */
|
---|
301 | #define IOMMU_BF_MSI_CAPHDR_EN_SHIFT 16
|
---|
302 | #define IOMMU_BF_MSI_CAPHDR_EN_MASK UINT32_C(0x00010000)
|
---|
303 | /** MsiMultMessCap: MSI Multi-Message Capability. */
|
---|
304 | #define IOMMU_BF_MSI_CAPHDR_MULTMESS_CAP_SHIFT 17
|
---|
305 | #define IOMMU_BF_MSI_CAPHDR_MULTMESS_CAP_MASK UINT32_C(0x000e0000)
|
---|
306 | /** MsiMultMessEn: MSI Mult-Message Enable. */
|
---|
307 | #define IOMMU_BF_MSI_CAPHDR_MULTMESS_EN_SHIFT 20
|
---|
308 | #define IOMMU_BF_MSI_CAPHDR_MULTMESS_EN_MASK UINT32_C(0x00700000)
|
---|
309 | /** Msi64BitEn: MSI 64-bit Enabled. */
|
---|
310 | #define IOMMU_BF_MSI_CAPHDR_64BIT_EN_SHIFT 23
|
---|
311 | #define IOMMU_BF_MSI_CAPHDR_64BIT_EN_MASK UINT32_C(0x00800000)
|
---|
312 | /** Bits 31:24 reserved. */
|
---|
313 | #define IOMMU_BF_MSI_CAPHDR_RSVD_24_31_SHIFT 24
|
---|
314 | #define IOMMU_BF_MSI_CAPHDR_RSVD_24_31_MASK UINT32_C(0xff000000)
|
---|
315 | RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_MSI_CAPHDR_, UINT32_C(0), UINT32_MAX,
|
---|
316 | (CAP_ID, CAP_PTR, EN, MULTMESS_CAP, MULTMESS_EN, 64BIT_EN, RSVD_24_31));
|
---|
317 | /** @} */
|
---|
318 |
|
---|
319 | /**
|
---|
320 | * @name MSI Mapping Capability Header Register.
|
---|
321 | * In accordance with the AMD spec.
|
---|
322 | * @{
|
---|
323 | */
|
---|
324 | /** MsiMapCapId: Capability ID. */
|
---|
325 | #define IOMMU_BF_MSI_MAP_CAPHDR_CAP_ID_SHIFT 0
|
---|
326 | #define IOMMU_BF_MSI_MAP_CAPHDR_CAP_ID_MASK UINT32_C(0x000000ff)
|
---|
327 | /** MsiMapCapPtr: Pointer (PCI config offset) to the next capability. */
|
---|
328 | #define IOMMU_BF_MSI_MAP_CAPHDR_CAP_PTR_SHIFT 8
|
---|
329 | #define IOMMU_BF_MSI_MAP_CAPHDR_CAP_PTR_MASK UINT32_C(0x0000ff00)
|
---|
330 | /** MsiMapEn: MSI mapping capability enable. */
|
---|
331 | #define IOMMU_BF_MSI_MAP_CAPHDR_EN_SHIFT 16
|
---|
332 | #define IOMMU_BF_MSI_MAP_CAPHDR_EN_MASK UINT32_C(0x00010000)
|
---|
333 | /** MsiMapFixd: MSI interrupt mapping range is not programmable. */
|
---|
334 | #define IOMMU_BF_MSI_MAP_CAPHDR_FIXED_SHIFT 17
|
---|
335 | #define IOMMU_BF_MSI_MAP_CAPHDR_FIXED_MASK UINT32_C(0x00020000)
|
---|
336 | /** Bits 18:28 reserved. */
|
---|
337 | #define IOMMU_BF_MSI_MAP_CAPHDR_RSVD_18_28_SHIFT 18
|
---|
338 | #define IOMMU_BF_MSI_MAP_CAPHDR_RSVD_18_28_MASK UINT32_C(0x07fc0000)
|
---|
339 | /** MsiMapCapType: MSI mapping capability. */
|
---|
340 | #define IOMMU_BF_MSI_MAP_CAPHDR_CAP_TYPE_SHIFT 27
|
---|
341 | #define IOMMU_BF_MSI_MAP_CAPHDR_CAP_TYPE_MASK UINT32_C(0xf8000000)
|
---|
342 | RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_MSI_MAP_CAPHDR_, UINT32_C(0), UINT32_MAX,
|
---|
343 | (CAP_ID, CAP_PTR, EN, FIXED, RSVD_18_28, CAP_TYPE));
|
---|
344 | /** @} */
|
---|
345 |
|
---|
346 | /** @name Miscellaneous IOMMU defines.
|
---|
347 | * @{ */
|
---|
348 | #define IOMMU_LOG_PFX "AMD_IOMMU" /**< Log prefix string. */
|
---|
349 | #define IOMMU_SAVED_STATE_VERSION 1 /**< The current saved state version. */
|
---|
350 | #define IOMMU_PCI_VENDOR_ID 0x1022 /**< AMD's vendor ID. */
|
---|
351 | #define IOMMU_PCI_DEVICE_ID 0xc0de /**< VirtualBox IOMMU device ID. */
|
---|
352 | #define IOMMU_PCI_REVISION_ID 0x01 /**< VirtualBox IOMMU device revision ID. */
|
---|
353 | #define IOMMU_MMIO_REGION_SIZE _16K /**< Size of the MMIO region in bytes. */
|
---|
354 | /** @} */
|
---|
355 |
|
---|
356 | /**
|
---|
357 | * Acquires the IOMMU lock or returns.
|
---|
358 | */
|
---|
359 | #define IOMMU_LOCK_RET(a_pDevIns, a_pThis, a_rcBusy) \
|
---|
360 | do { \
|
---|
361 | int rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \
|
---|
362 | if (RT_LIKELY(rcLock == VINF_SUCCESS)) \
|
---|
363 | { /* likely */ } \
|
---|
364 | else \
|
---|
365 | return rcLock; \
|
---|
366 | } while (0)
|
---|
367 |
|
---|
368 | /**
|
---|
369 | * Releases the IOMMU lock.
|
---|
370 | */
|
---|
371 | #define IOMMU_UNLOCK(a_pDevIns, a_pThis) \
|
---|
372 | do { PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); } while (0)
|
---|
373 |
|
---|
374 |
|
---|
375 | /*********************************************************************************************************************************
|
---|
376 | * Structures and Typedefs *
|
---|
377 | *********************************************************************************************************************************/
|
---|
378 | /**
|
---|
379 | * The Device ID.
|
---|
380 | * In accordance with the AMD spec.
|
---|
381 | */
|
---|
382 | typedef union
|
---|
383 | {
|
---|
384 | struct
|
---|
385 | {
|
---|
386 | uint16_t uFunction : 3; /**< Bits 2:0 - Function. */
|
---|
387 | uint16_t uDevice : 5; /**< Bits 7:3 - Device. */
|
---|
388 | uint16_t uBus : 8; /**< Bits 15:8 - Bus. */
|
---|
389 | } n;
|
---|
390 | /** The unsigned integer view. */
|
---|
391 | uint16_t u;
|
---|
392 | } DEVICE_ID_T;
|
---|
393 | AssertCompileSize(DEVICE_ID_T, 2);
|
---|
394 |
|
---|
395 | /**
|
---|
396 | * Device Table Entry (DTE).
|
---|
397 | * In accordance with the AMD spec.
|
---|
398 | */
|
---|
399 | typedef union
|
---|
400 | {
|
---|
401 | struct
|
---|
402 | {
|
---|
403 | uint32_t u1Valid : 1; /**< Bit 0 - V: Valid. */
|
---|
404 | uint32_t u1TranslationValid : 1; /**< Bit 1 - TV: Translation information Valid. */
|
---|
405 | uint32_t u5Rsvd0 : 5; /**< Bits 6:2 - Reserved. */
|
---|
406 | uint32_t u2Had : 2; /**< Bits 8:7 - HAD: Host Access Dirty. */
|
---|
407 | uint32_t u3Mode : 3; /**< Bits 11:9 - Mode: Paging mode. */
|
---|
408 | uint32_t u20PageTableRootPtrLo : 20; /**< Bits 31:12 - Page Table Root Pointer (Lo). */
|
---|
409 | uint32_t u20PageTableRootPtrHi : 20; /**< Bits 51:32 - Page Table Root Pointer (Hi). */
|
---|
410 | uint32_t u1Ppr : 1; /**< Bit 52 - PPR: Peripheral Page Request. */
|
---|
411 | uint32_t u1GstPprRespPasid : 1; /**< Bit 53 - GRPR: Guest PPR Response with PASID. */
|
---|
412 | uint32_t u1GstIoValid : 1; /**< Bit 54 - GIoV: Guest I/O Protection Valid. */
|
---|
413 | uint32_t u1GstTranslateValid : 1; /**< Bit 55 - GV: Guest translation Valid. */
|
---|
414 | uint32_t u2GstCr3RootTblTranslated : 2; /**< Bits 57:56 - GLX: Guest Levels Translated. */
|
---|
415 | uint32_t u3GstCr3TableRootPtrLo : 2; /**< Bits 60:58 - GCR3 TRP: Guest CR3 Table Root Pointer (Lo). */
|
---|
416 | uint32_t u1IoRead : 1; /**< Bit 61 - IR: I/O Read permission. */
|
---|
417 | uint32_t u1IoWrite : 1; /**< Bit 62 - IW: I/O Write permission. */
|
---|
418 | uint32_t u1Rsvd0 : 1; /**< Bit 63 - Reserved. */
|
---|
419 | uint32_t u16DomainId : 1; /**< Bits 79:64 - Domain ID. */
|
---|
420 | uint32_t u16GstCr3TableRootPtrMed : 16; /**< Bits 95:80 - GCR3 TRP: Guest CR3 Table Root Pointer (Mid). */
|
---|
421 | uint32_t u1IoTlbEnable : 1; /**< Bit 96 - IOTLB Enable. */
|
---|
422 | uint32_t u1SuppressPfEvents : 1; /**< Bit 97 - SE: Supress Page-fault events. */
|
---|
423 | uint32_t u1SuppressAllPfEvents : 1; /**< Bit 98 - SA: Supress All Page-fault events. */
|
---|
424 | uint32_t u2IoCtl : 1; /**< Bits 100:99 - IoCtl: Port I/O Control. */
|
---|
425 | uint32_t u1Cache : 1; /**< Bit 101 - Cache: IOTLB Cache Hint. */
|
---|
426 | uint32_t u1SnoopDisable : 1; /**< Bit 102 - SD: Snoop Disable. */
|
---|
427 | uint32_t u1AllowExclusion : 1; /**< Bit 103 - EX: Allow Exclusion. */
|
---|
428 | uint32_t u2SysMgt : 2; /**< Bits 105:104 - SysMgt: System Management message enable. */
|
---|
429 | uint32_t u1Rsvd1 : 1; /**< Bit 106 - Reserved. */
|
---|
430 | uint32_t u21GstCr3TableRootPtrHi : 21; /**< Bits 127:107 - GCR3 TRP: Guest CR3 Table Root Pointer (Hi). */
|
---|
431 | uint32_t u1IntrMapValid : 1; /**< Bit 128 - IV: Interrupt map Valid. */
|
---|
432 | uint32_t u4IntrTableLength : 4; /**< Bits 132:129 - IntTabLen: Interrupt Table Length. */
|
---|
433 | uint32_t u1IgnoreUnmappedIntrs : 1; /**< Bits 133 - IG: Ignore unmapped interrupts. */
|
---|
434 | uint32_t u26IntrTableRootPtr : 26; /**< Bits 159:134 - Interrupt Root Table Pointer (Lo). */
|
---|
435 | uint32_t u20IntrTableRootPtr : 20; /**< Bits 179:160 - Interrupt Root Table Pointer (Hi). */
|
---|
436 | uint32_t u4Rsvd0 : 4; /**< Bits 183:180 - Reserved. */
|
---|
437 | uint32_t u1InitPassthru : 1; /**< Bits 184 - INIT Pass-through. */
|
---|
438 | uint32_t u1ExtIntPassthru : 1; /**< Bits 185 - External Interrupt Pass-through. */
|
---|
439 | uint32_t u1NmiPassthru : 1; /**< Bits 186 - NMI Pass-through. */
|
---|
440 | uint32_t u1Rsvd2 : 1; /**< Bits 187 - Reserved. */
|
---|
441 | uint32_t u2IntrCtrl : 2; /**< Bits 189:188 - IntCtl: Interrupt Control. */
|
---|
442 | uint32_t u1Lint0Passthru : 1; /**< Bit 190 - Lint0Pass: LINT0 (Legacy PIC NMI) Pass-thru. */
|
---|
443 | uint32_t u1Lint1Passthru : 1; /**< Bit 191 - Lint1Pass: LINT1 (Legacy PIC NMI) Pass-thru. */
|
---|
444 | uint32_t u32Rsvd0; /**< Bits 223:192 - Reserved. */
|
---|
445 | uint32_t u22Rsvd0 : 22; /**< Bits 245:224 - Reserved. */
|
---|
446 | uint32_t u1AttrOverride : 1; /**< Bit 246 - AttrV: Attribute Override. */
|
---|
447 | uint32_t u1Mode0FC: 1; /**< Bit 247 - Mode0FC. */
|
---|
448 | uint32_t u8SnoopAttr: 1; /**< Bits 255:248 - Snoop Attribute. */
|
---|
449 | } n;
|
---|
450 | /** The 32-bit unsigned integer view. */
|
---|
451 | uint32_t au32[8];
|
---|
452 | } DEV_TAB_ENTRY_T;
|
---|
453 | AssertCompileSize(DEV_TAB_ENTRY_T, 32);
|
---|
454 |
|
---|
455 | /**
|
---|
456 | * I/O Page Table Entry.
|
---|
457 | * In accordance with the AMD spec.
|
---|
458 | */
|
---|
459 | typedef union
|
---|
460 | {
|
---|
461 | struct
|
---|
462 | {
|
---|
463 | RT_GCC_EXTENSION uint64_t u1Present : 1; /**< Bit 0 - PR: Present. */
|
---|
464 | RT_GCC_EXTENSION uint64_t u4Ign0 : 4; /**< Bits 4:1 - Ignored. */
|
---|
465 | RT_GCC_EXTENSION uint64_t u1Accessed : 1; /**< Bit 5 - A: Accessed. */
|
---|
466 | RT_GCC_EXTENSION uint64_t u1Dirty : 1; /**< Bit 6 - D: Dirty. */
|
---|
467 | RT_GCC_EXTENSION uint64_t u2Ign0 : 2; /**< Bits 8:7 - Ignored. */
|
---|
468 | RT_GCC_EXTENSION uint64_t u3NextLevel : 3; /**< Bits 11:9 - Next Level: Next page translation level. */
|
---|
469 | RT_GCC_EXTENSION uint64_t u40PageAddr : 40; /**< Bits 51:12 - Page address. */
|
---|
470 | RT_GCC_EXTENSION uint64_t u7Rsvd0 : 7; /**< Bits 58:52 - Reserved. */
|
---|
471 | RT_GCC_EXTENSION uint64_t u1UntranslatedAccess : 1; /**< Bit 59 - U: Untranslated Access Only. */
|
---|
472 | RT_GCC_EXTENSION uint64_t u1ForceCoherent : 1; /**< Bit 60 - FC: Force Coherent. */
|
---|
473 | RT_GCC_EXTENSION uint64_t u1IoRead : 1; /**< Bit 61 - IR: I/O Read permission. */
|
---|
474 | RT_GCC_EXTENSION uint64_t u1IoWrite : 1; /**< Bit 62 - IW: I/O Wead permission. */
|
---|
475 | RT_GCC_EXTENSION uint64_t u1Ign0 : 1; /**< Bit 63 - Ignored. */
|
---|
476 | } n;
|
---|
477 | /** The 64-bit unsigned integer view. */
|
---|
478 | uint64_t u;
|
---|
479 | } IOPTE_T;
|
---|
480 | AssertCompileSize(IOPTE_T, 8);
|
---|
481 |
|
---|
482 | /**
|
---|
483 | * I/O Page Directory Entry.
|
---|
484 | * In accordance with the AMD spec.
|
---|
485 | */
|
---|
486 | typedef union
|
---|
487 | {
|
---|
488 | struct
|
---|
489 | {
|
---|
490 | RT_GCC_EXTENSION uint64_t u1Present : 1; /**< Bit 0 - PR: Present. */
|
---|
491 | RT_GCC_EXTENSION uint64_t u4Ign0 : 4; /**< Bits 4:1 - Ignored. */
|
---|
492 | RT_GCC_EXTENSION uint64_t u1Accessed : 1; /**< Bit 5 - A: Accessed. */
|
---|
493 | RT_GCC_EXTENSION uint64_t u3Ign0 : 3; /**< Bits 8:6 - Ignored. */
|
---|
494 | RT_GCC_EXTENSION uint64_t u3NextLevel : 3; /**< Bits 11:9 - Next Level: Next page translation level. */
|
---|
495 | RT_GCC_EXTENSION uint64_t u40PageAddr : 40; /**< Bits 51:12 - Page address (Next Table Address). */
|
---|
496 | RT_GCC_EXTENSION uint64_t u9Rsvd0 : 9; /**< Bits 60:52 - Reserved. */
|
---|
497 | RT_GCC_EXTENSION uint64_t u1IoRead : 1; /**< Bit 61 - IR: I/O Read permission. */
|
---|
498 | RT_GCC_EXTENSION uint64_t u1IoWrite : 1; /**< Bit 62 - IW: I/O Wead permission. */
|
---|
499 | RT_GCC_EXTENSION uint64_t u1Ign0 : 1; /**< Bit 63 - Ignored. */
|
---|
500 | } n;
|
---|
501 | /** The 64-bit unsigned integer view. */
|
---|
502 | uint64_t u;
|
---|
503 | } IOPDE_T;
|
---|
504 | AssertCompileSize(IOPDE_T, 8);
|
---|
505 |
|
---|
506 | /**
|
---|
507 | * Interrupt Remapping Table Entry.
|
---|
508 | * In accordance with the AMD spec.
|
---|
509 | */
|
---|
510 | typedef union
|
---|
511 | {
|
---|
512 | struct
|
---|
513 | {
|
---|
514 | uint32_t u1RemapEnable : 1; /**< Bit 0 - RemapEn: Remap Enable. */
|
---|
515 | uint32_t u1SuppressPf : 1; /**< Bit 1 - SupIOPF: Supress I/O Page Fault. */
|
---|
516 | uint32_t u3IntrType : 1; /**< Bits 4:2 - IntType: Interrupt Type. */
|
---|
517 | uint32_t u1ReqEoi : 1; /**< Bit 5 - RqEoi: Request EOI. */
|
---|
518 | uint32_t u1DstMode : 1; /**< Bit 6 - DM: Destination Mode. */
|
---|
519 | uint32_t u1GuestMode : 1; /**< Bit 7 - GuestMode. */
|
---|
520 | uint32_t u8Dst : 8; /**< Bits 15:8 - Destination. */
|
---|
521 | uint32_t u8Vector : 8; /**< Bits 23:16 - Vector. */
|
---|
522 | uint32_t u8Rsvd0 : 8; /**< Bits 31:24 - Reserved. */
|
---|
523 | } n;
|
---|
524 | /** The 32-bit unsigned integer view. */
|
---|
525 | uint32_t u;
|
---|
526 | } IRTE_T;
|
---|
527 | AssertCompileSize(IRTE_T, 4);
|
---|
528 |
|
---|
529 | /**
|
---|
530 | * Command: Generic Command Buffer Entry.
|
---|
531 | * In accordance with the AMD spec.
|
---|
532 | */
|
---|
533 | typedef union
|
---|
534 | {
|
---|
535 | struct
|
---|
536 | {
|
---|
537 | uint32_t u32Operand1Lo; /**< Bits 31:0 - Operand 1 (Lo). */
|
---|
538 | uint32_t u32Operand1Hi : 28; /**< Bits 59:32 - Operand 1 (Hi). */
|
---|
539 | uint32_t u4Opcode : 4; /**< Bits 63:60 - Op Code. */
|
---|
540 | uint64_t u64Operand2; /**< Bits 127:64 - Operand 2. */
|
---|
541 | } n;
|
---|
542 | /** The 64-bit unsigned integer view. */
|
---|
543 | uint64_t au64[2];
|
---|
544 | } CMD_GENERIC_T;
|
---|
545 | AssertCompileSize(CMD_GENERIC_T, 16);
|
---|
546 |
|
---|
547 | /**
|
---|
548 | * Command: COMPLETION_WAIT.
|
---|
549 | * In accordance with the AMD spec.
|
---|
550 | */
|
---|
551 | typedef union
|
---|
552 | {
|
---|
553 | struct
|
---|
554 | {
|
---|
555 | uint32_t u1Store : 1; /**< Bit 0 - S: Completion Store. */
|
---|
556 | uint32_t u1Interrupt : 1; /**< Bit 1 - I: Completion Interrupt. */
|
---|
557 | uint32_t u1Flush : 1; /**< Bit 2 - F: Flush Queue. */
|
---|
558 | uint32_t u29StoreAddrLo : 29; /**< Bits 31:3 - Store Address (Lo). */
|
---|
559 | uint32_t u20StoreAddrHi : 20; /**< Bits 51:32 - Store Address (Hi). */
|
---|
560 | uint32_t u8Rsvd0 : 8; /**< Bits 59:52 - Reserved. */
|
---|
561 | uint32_t u4OpCode : 4; /**< Bits 63:60 - OpCode (Command). */
|
---|
562 | uint64_t u64StoreData; /**< Bits 127:64 - Store Data. */
|
---|
563 | } n;
|
---|
564 | /** The 64-bit unsigned integer view. */
|
---|
565 | uint32_t au64[2];
|
---|
566 | } CMD_COMPLETION_WAIT_T;
|
---|
567 | AssertCompileSize(CMD_COMPLETION_WAIT_T, 16);
|
---|
568 |
|
---|
569 | /**
|
---|
570 | * Command: INVALIDATE_DEVTAB_ENTRY.
|
---|
571 | * In accordance with the AMD spec.
|
---|
572 | */
|
---|
573 | typedef union
|
---|
574 | {
|
---|
575 | struct
|
---|
576 | {
|
---|
577 | uint16_t u16DeviceId; /**< Bits 15:0 - DeviceID. */
|
---|
578 | uint16_t u16Rsvd0; /**< Bits 31:16 - Reserved. */
|
---|
579 | uint32_t u28Rsvd0 : 28; /**< Bits 59:32 - Reserved. */
|
---|
580 | uint32_t u4OpCode : 4; /**< Bits 63:60 - Op Code (Command). */
|
---|
581 | uint64_t u64Rsvd0; /**< Bits 127:64 - Reserved. */
|
---|
582 | } n;
|
---|
583 | /** The 64-bit unsigned integer view. */
|
---|
584 | uint64_t au64[2];
|
---|
585 | } CMD_INV_DEV_TAB_ENTRY_T;
|
---|
586 | AssertCompileSize(CMD_INV_DEV_TAB_ENTRY_T, 16);
|
---|
587 |
|
---|
588 | /**
|
---|
589 | * Command: INVALIDATE_IOMMU_PAGES.
|
---|
590 | * In accordance with the AMD spec.
|
---|
591 | */
|
---|
592 | typedef union
|
---|
593 | {
|
---|
594 | struct
|
---|
595 | {
|
---|
596 | uint32_t u20Pasid : 20; /**< Bits 19:0 - PASID: Process Address-Space ID. */
|
---|
597 | uint32_t u12Rsvd0 : 12; /**< Bits 31:20 - Reserved. */
|
---|
598 | uint32_t u16DomainId : 16; /**< Bits 47:32 - Domain ID. */
|
---|
599 | uint32_t u12Rsvd1 : 12; /**< Bits 59:48 - Reserved. */
|
---|
600 | uint32_t u4OpCode : 4; /**< Bits 63:60 - Op Code (Command). */
|
---|
601 | uint32_t u1Size : 1; /**< Bit 64 - S: Size. */
|
---|
602 | uint32_t u1PageDirEntries : 1; /**< Bit 65 - PDE: Page Directory Entries. */
|
---|
603 | uint32_t u1GuestOrNested : 1; /**< Bit 66 - GN: Guest (GPA) or Nested (GVA). */
|
---|
604 | uint32_t u9Rsvd0 : 9; /**< Bits 75:67 - Reserved. */
|
---|
605 | uint32_t u20AddrLo : 20; /**< Bits 95:76 - Address (Lo). */
|
---|
606 | uint32_t u32AddrHi; /**< Bits 127:96 - Address (Hi). */
|
---|
607 | } n;
|
---|
608 | /** The 64-bit unsigned integer view. */
|
---|
609 | uint64_t au64[2];
|
---|
610 | } CMD_INV_IOMMU_PAGES_T;
|
---|
611 | AssertCompileSize(CMD_INV_IOMMU_PAGES_T, 16);
|
---|
612 |
|
---|
613 | /**
|
---|
614 | * Command: INVALIDATE_IOTLB_PAGES.
|
---|
615 | * In accordance with the AMD spec.
|
---|
616 | */
|
---|
617 | typedef union
|
---|
618 | {
|
---|
619 | struct
|
---|
620 | {
|
---|
621 | uint16_t u16DeviceId; /**< Bits 15:0 - Device ID. */
|
---|
622 | uint8_t u8PasidLo; /**< Bits 23:16 - PASID: Process Address-Space ID (Lo). */
|
---|
623 | uint8_t u8MaxPend; /**< Bits 31:24 - Maxpend: Maximum simultaneous in-flight transactions. */
|
---|
624 | uint32_t u16QueueId : 16; /**< Bits 47:32 - Queue ID. */
|
---|
625 | uint32_t u12PasidHi : 12; /**< Bits 59:48 - PASID: Process Address-Space ID (Hi). */
|
---|
626 | uint32_t u4OpCode : 4; /**< Bits 63:60 - Op Code (Command). */
|
---|
627 | uint32_t u1Size : 1; /**< Bit 64 - S: Size. */
|
---|
628 | uint32_t u1Rsvd0: 1; /**< Bit 65 - Reserved. */
|
---|
629 | uint32_t u1GuestOrNested : 1; /**< Bit 66 - GN: Guest (GPA) or Nested (GVA). */
|
---|
630 | uint32_t u1Rsvd1 : 1; /**< Bit 67 - Reserved. */
|
---|
631 | uint32_t u2Type : 2; /**< Bit 69:68 - Type. */
|
---|
632 | uint32_t u6Rsvd0 : 6; /**< Bits 75:70 - Reserved. */
|
---|
633 | uint32_t u20AddrLo : 20; /**< Bits 95:76 - Address (Lo). */
|
---|
634 | uint32_t u32AddrHi; /**< Bits 127:96 - Address (Hi). */
|
---|
635 | } n;
|
---|
636 | /** The 64-bit unsigned integer view. */
|
---|
637 | uint64_t au64[2];
|
---|
638 | } CMD_INV_IOTLB_PAGES_T;
|
---|
639 | AssertCompileSize(CMD_INV_IOTLB_PAGES_T, 16);
|
---|
640 |
|
---|
641 | /**
|
---|
642 | * Command: INVALIDATE_INTR_TABLE.
|
---|
643 | * In accordance with the AMD spec.
|
---|
644 | */
|
---|
645 | typedef union
|
---|
646 | {
|
---|
647 | struct
|
---|
648 | {
|
---|
649 | uint16_t u16DeviceId; /**< Bits 15:0 - Device ID. */
|
---|
650 | uint16_t u16Rsvd0; /**< Bits 31:16 - Reserved. */
|
---|
651 | uint32_t u32Rsvd0 : 28; /**< Bits 59:32 - Reserved. */
|
---|
652 | uint32_t u4OpCode : 4; /**< Bits 63:60 - Op Code (Command). */
|
---|
653 | uint64_t u64Rsvd0; /**< Bits 127:64 - Reserved. */
|
---|
654 | } u;
|
---|
655 | /** The 64-bit unsigned integer view. */
|
---|
656 | uint64_t au64[2];
|
---|
657 | } CMD_INV_INTR_TABLE_T;
|
---|
658 | AssertCompileSize(CMD_INV_INTR_TABLE_T, 16);
|
---|
659 |
|
---|
660 | /**
|
---|
661 | * Command: COMPLETE_PPR_REQ.
|
---|
662 | * In accordance with the AMD spec.
|
---|
663 | */
|
---|
664 | typedef union
|
---|
665 | {
|
---|
666 | struct
|
---|
667 | {
|
---|
668 | uint16_t u16DeviceId; /**< Bits 15:0 - Device ID. */
|
---|
669 | uint16_t u16Rsvd0; /**< Bits 31:16 - Reserved. */
|
---|
670 | uint32_t u20Pasid : 20; /**< Bits 51:32 - PASID: Process Address-Space ID. */
|
---|
671 | uint32_t u8Rsvd0 : 8; /**< Bits 59:52 - Reserved. */
|
---|
672 | uint32_t u4OpCode : 4; /**< Bits 63:60 - Op Code (Command). */
|
---|
673 | uint32_t u2Rsvd0 : 2; /**< Bits 65:64 - Reserved. */
|
---|
674 | uint32_t u1GuestOrNested : 1; /**< Bit 66 - GN: Guest (GPA) or Nested (GVA). */
|
---|
675 | uint32_t u29Rsvd0 : 29; /**< Bits 95:67 - Reserved. */
|
---|
676 | uint32_t u16CompletionTag : 16; /**< Bits 111:96 - Completion Tag. */
|
---|
677 | uint32_t u16Rsvd1 : 16; /**< Bits 127:112 - Reserved. */
|
---|
678 | } n;
|
---|
679 | /** The 64-bit unsigned integer view. */
|
---|
680 | uint64_t au64[2];
|
---|
681 | } CMD_COMPLETE_PPR_REQ_T;
|
---|
682 | AssertCompileSize(CMD_COMPLETE_PPR_REQ_T, 16);
|
---|
683 |
|
---|
684 | /**
|
---|
685 | * Command: INV_IOMMU_ALL.
|
---|
686 | * In accordance with the AMD spec.
|
---|
687 | */
|
---|
688 | typedef union
|
---|
689 | {
|
---|
690 | struct
|
---|
691 | {
|
---|
692 | uint32_t u32Rsvd0; /**< Bits 31:0 - Reserved. */
|
---|
693 | uint32_t u28Rsvd0 : 28; /**< Bits 59:32 - Reserved. */
|
---|
694 | uint32_t u4OpCode : 4; /**< Bits 63:60 - Op Code (Command). */
|
---|
695 | uint64_t u64Rsvd0; /**< Bits 127:64 - Reserved. */
|
---|
696 | } n;
|
---|
697 | /** The 64-bit unsigned integer view. */
|
---|
698 | uint64_t au64[2];
|
---|
699 | } CMD_IOMMU_ALL_T;
|
---|
700 | AssertCompileSize(CMD_IOMMU_ALL_T, 16);
|
---|
701 |
|
---|
702 | /**
|
---|
703 | * Event Log Entry: Generic.
|
---|
704 | * In accordance with the AMD spec.
|
---|
705 | */
|
---|
706 | typedef union
|
---|
707 | {
|
---|
708 | struct
|
---|
709 | {
|
---|
710 | uint32_t u32Operand1Lo; /**< Bits 31:0 - Operand 1 (Lo). */
|
---|
711 | uint32_t u32Operand1Hi : 28; /**< Bits 59:32 - Operand 1 (Hi). */
|
---|
712 | uint32_t u4EventCode : 4; /**< Bits 63:60 - Event code. */
|
---|
713 | uint32_t u32Operand2Lo; /**< Bits 95:64 - Operand 2 (Lo). */
|
---|
714 | uint32_t u32Operand2Hi; /**< Bits 127:96 - Operand 2 (Hi). */
|
---|
715 | } n;
|
---|
716 | /** The 32-bit unsigned integer view. */
|
---|
717 | uint32_t au32[4];
|
---|
718 | } EVT_GENERIC_T;
|
---|
719 | AssertCompileSize(EVT_GENERIC_T, 16);
|
---|
720 |
|
---|
721 | /**
|
---|
722 | * Event Log Entry: ILLEGAL_DEV_TAB_ENTRY.
|
---|
723 | * In accordance with the AMD spec.
|
---|
724 | */
|
---|
725 | typedef union
|
---|
726 | {
|
---|
727 | struct
|
---|
728 | {
|
---|
729 | uint16_t u16DeviceId; /**< Bits 15:0 - Device ID. */
|
---|
730 | uint16_t u4PasidHi : 4; /**< Bits 19:16 - PASID: Process Address-Space ID (Hi). */
|
---|
731 | uint16_t u12Rsvd0 : 12; /**< Bits 31:20 - Reserved. */
|
---|
732 | uint16_t u16PasidLo; /**< Bits 47:32 - PASID: Process Address-Space ID (Lo). */
|
---|
733 | uint16_t u1GuestOrNested : 1; /**< Bit 48 - GN: Guest (GPA) or Nested (GVA). */
|
---|
734 | uint16_t u2Rsvd0 : 2; /**< Bits 50:49 - Reserved. */
|
---|
735 | uint16_t u1Interrupt : 1; /**< Bit 51 - I: Interrupt. */
|
---|
736 | uint16_t u1Rsvd0 : 1; /**< Bit 52 - Reserved. */
|
---|
737 | uint16_t u1ReadWrite : 1; /**< Bit 53 - RW: Read/Write. */
|
---|
738 | uint16_t u1Rsvd1 : 1; /**< Bit 54 - Reserved. */
|
---|
739 | uint16_t u1RsvdZero : 1; /**< Bit 55 - RZ: Reserved bit not Zero or invalid level encoding. */
|
---|
740 | uint16_t u1Translation : 1; /**< Bit 56 - TN: Translation. */
|
---|
741 | uint16_t u3Rsvd0 : 3; /**< Bits 59:57 - Reserved. */
|
---|
742 | uint16_t u4EventCode : 4; /**< Bits 63:60 - Event code. */
|
---|
743 | uint32_t u2Rsvd1 : 2; /**< Bits 65:64 - Reserved. */
|
---|
744 | uint32_t u30AddrLo : 2; /**< Bits 95:66 - Address: Device Virtual Address (Lo). */
|
---|
745 | uint32_t u30AddrHi; /**< Bits 127:96 - Address: Device Virtual Address (Hi). */
|
---|
746 | } n;
|
---|
747 | /** The 32-bit unsigned integer view. */
|
---|
748 | uint32_t au32[4];
|
---|
749 | } EVT_ILLEGAL_DEV_TAB_ENTRY_T;
|
---|
750 | AssertCompileSize(EVT_ILLEGAL_DEV_TAB_ENTRY_T, 16);
|
---|
751 |
|
---|
752 | /**
|
---|
753 | * Event Log Entry: IO_PAGE_FAULT_EVENT.
|
---|
754 | * In accordance with the AMD spec.
|
---|
755 | */
|
---|
756 | typedef union
|
---|
757 | {
|
---|
758 | struct
|
---|
759 | {
|
---|
760 | uint16_t u16DeviceId; /**< Bits 15:0 - Device ID. */
|
---|
761 | uint16_t u4PasidHi : 4; /**< Bits 19:16 - PASID: Process Address-Space ID (Hi). */
|
---|
762 | uint16_t u16DomainOrPasidLo; /**< Bits 47:32 - D/P: Domain ID or Process Address-Space ID (Lo). */
|
---|
763 | uint16_t u1GuestOrNested : 1; /**< Bit 48 - GN: Guest (GPA) or Nested (GVA). */
|
---|
764 | uint16_t u1NoExecute : 1; /**< Bit 49 - NX: No Execute. */
|
---|
765 | uint16_t u1User : 1; /**< Bit 50 - US: User/Supervisor. */
|
---|
766 | uint16_t u1Interrupt : 1; /**< Bit 51 - I: Interrupt. */
|
---|
767 | uint16_t u1Present : 1; /**< Bit 52 - PR: Present. */
|
---|
768 | uint16_t u1ReadWrite : 1; /**< Bit 53 - RW: Read/Write. */
|
---|
769 | uint16_t u1Perm : 1; /**< Bit 54 - PE: Permission Indicator. */
|
---|
770 | uint16_t u1RsvdZero : 1; /**< Bit 55 - RZ: Reserved bit not Zero or invalid level encoding. */
|
---|
771 | uint16_t u1Translation : 1; /**< Bit 56 - TN: Translation. */
|
---|
772 | uint16_t u3Rsvd0 : 3; /**< Bit 59:57 - Reserved. */
|
---|
773 | uint16_t u4EventCode : 4; /**< Bits 63:60 - Event code. */
|
---|
774 | uint64_t u64Addr; /**< Bits 127:64 - Address: Device Virtual Address. */
|
---|
775 | } n;
|
---|
776 | /** The 32-bit unsigned integer view. */
|
---|
777 | uint32_t au32[4];
|
---|
778 | } EVT_IO_PAGE_FAULT_T;
|
---|
779 | AssertCompileSize(EVT_IO_PAGE_FAULT_T, 16);
|
---|
780 |
|
---|
781 | /**
|
---|
782 | * Event Log Entry: DEV_TAB_HARDWARE_ERROR.
|
---|
783 | * In accordance with the AMD spec.
|
---|
784 | */
|
---|
785 | typedef union
|
---|
786 | {
|
---|
787 | struct
|
---|
788 | {
|
---|
789 | uint16_t u16DeviceId; /**< Bits 15:0 - Device ID. */
|
---|
790 | uint16_t u16Rsvd0; /**< Bits 31:16 - Reserved. */
|
---|
791 | uint32_t u19Rsvd0 : 19; /**< Bits 50:32 - Reserved. */
|
---|
792 | uint32_t u1Intr : 1; /**< Bit 51 - I: Interrupt. */
|
---|
793 | uint32_t u1Rsvd0 : 1; /**< Bit 52 - Reserved. */
|
---|
794 | uint32_t u1ReadWrite : 1; /**< Bit 53 - RW: Read/Write. */
|
---|
795 | uint32_t u2Rsvd0 : 2; /**< Bits 55:54 - Reserved. */
|
---|
796 | uint32_t u1Translation : 1; /**< Bit 56 - TR: Translation. */
|
---|
797 | uint32_t u2Type : 2; /**< Bits 58:57 - Type: The type of hardware error. */
|
---|
798 | uint32_t u1Rsvd1 : 1; /**< Bit 59 - Reserved. */
|
---|
799 | uint32_t u4EventCode : 4; /**< Bits 63:60 - Event code. */
|
---|
800 | uint32_t u4Rsvd0 : 4; /**< Bits 67:64 - Reserved. */
|
---|
801 | uint32_t u28AddrLo : 28; /**< Bits 95:68 - Address: System Physical Address (Lo). */
|
---|
802 | uint32_t u32AddrHi; /**< Bits 127:96 - Address: System Physical Address (Hi). */
|
---|
803 | } n;
|
---|
804 | /** The 32-bit unsigned integer view. */
|
---|
805 | uint32_t au32[4];
|
---|
806 | } EVT_DEV_TAB_HARDWARE_ERROR;
|
---|
807 | AssertCompileSize(EVT_DEV_TAB_HARDWARE_ERROR, 16);
|
---|
808 |
|
---|
809 | /**
|
---|
810 | * Event Log Entry: EVT_PAGE_TAB_HARDWARE_ERROR.
|
---|
811 | * In accordance with the AMD spec.
|
---|
812 | */
|
---|
813 | typedef union
|
---|
814 | {
|
---|
815 | struct
|
---|
816 | {
|
---|
817 | uint16_t u16DeviceId; /**< Bits 15:0 - Device ID. */
|
---|
818 | uint16_t u16Rsvd0; /**< Bits 31:16 - Reserved. */
|
---|
819 | uint32_t u16DomainOrPasidLo : 16; /**< Bits 47:32 - D/P: Domain ID or Process Address-Space ID (Lo). */
|
---|
820 | uint32_t u1GuestOrNested : 1; /**< Bit 48 - GN: Guest (GPA) or Nested (GVA). */
|
---|
821 | uint32_t u2Rsvd0 : 2; /**< Bits 50:49 - Reserved. */
|
---|
822 | uint32_t u1Interrupt : 1; /**< Bit 51 - I: Interrupt. */
|
---|
823 | uint32_t u1Rsvd0 : 1; /**< Bit 52 - Reserved. */
|
---|
824 | uint32_t u1ReadWrite : 1; /**< Bit 53 - RW: Read/Write. */
|
---|
825 | uint32_t u2Rsvd1 : 2; /**< Bit 55:54 - Reserved. */
|
---|
826 | uint32_t u1Translation : 1; /**< Bit 56 - TR: Translation. */
|
---|
827 | uint32_t u2Type : 2; /**< Bits 58:57 - Type: The type of hardware error. */
|
---|
828 | uint32_t u1Rsvd1 : 1; /**< Bit 59 - Reserved. */
|
---|
829 | uint32_t u4EventCode : 4; /**< Bit 63:60 - Event code. */
|
---|
830 | /** @todo r=ramshankar: Figure 55: PAGE_TAB_HARDWARE_ERROR says Addr[31:3] but
|
---|
831 | * table 58 mentions Addr[31:4]. Looks like a typo in the figure. Use
|
---|
832 | * table as it makes more sense and matches address size in
|
---|
833 | * EVT_DEV_TAB_HARDWARE_ERROR. See AMD AMD IOMMU spec (3.05-PUB, Jan
|
---|
834 | * 2020). */
|
---|
835 | uint32_t u4Rsvd0 : 4; /**< Bits 67:64 - Reserved. */
|
---|
836 | uint32_t u28AddrLo : 28; /**< Bits 95:68 - Address: SPA of page table entry (Lo). */
|
---|
837 | uint32_t u32AddrHi; /**< Bits 127:96 - Address: SPA of page table entry (Hi). */
|
---|
838 | } n;
|
---|
839 | /** The 32-bit unsigned integer view. */
|
---|
840 | uint32_t au32[4];
|
---|
841 | } EVT_PAGE_TAB_HARDWARE_ERROR;
|
---|
842 | AssertCompileSize(EVT_PAGE_TAB_HARDWARE_ERROR, 16);
|
---|
843 |
|
---|
844 | /**
|
---|
845 | * Event Log Entry: ILLEGAL_COMMAND_ERROR.
|
---|
846 | * In accordance with the AMD spec.
|
---|
847 | */
|
---|
848 | typedef union
|
---|
849 | {
|
---|
850 | struct
|
---|
851 | {
|
---|
852 | uint32_t u32Rsvd0; /**< Bits 31:0 - Reserved. */
|
---|
853 | uint32_t u28Rsvd0 : 28; /**< Bits 47:32 - Reserved. */
|
---|
854 | uint32_t u4EventCode : 4; /**< Bits 63:60 - Event code. */
|
---|
855 | uint32_t u4Rsvd0 : 4; /**< Bits 67:64 - Reserved. */
|
---|
856 | uint32_t u28AddrLo : 28; /**< Bits 95:68 - Address: SPA of the invalid command (Lo). */
|
---|
857 | uint32_t u32AddrHi; /**< Bits 127:96 - Address: SPA of the invalid command (Hi). */
|
---|
858 | } n;
|
---|
859 | /** The 32-bit unsigned integer view. */
|
---|
860 | uint32_t au32[4];
|
---|
861 | } EVT_ILLEGAL_COMMAND_ENTRY;
|
---|
862 | AssertCompileSize(EVT_ILLEGAL_COMMAND_ENTRY, 16);
|
---|
863 |
|
---|
864 | /**
|
---|
865 | * Event Log Entry: COMMAND_HARDWARE_ERROR.
|
---|
866 | * In accordance with the AMD spec.
|
---|
867 | */
|
---|
868 | typedef union
|
---|
869 | {
|
---|
870 | struct
|
---|
871 | {
|
---|
872 | uint32_t u32Rsvd0; /**< Bits 31:0 - Reserved. */
|
---|
873 | uint32_t u4Rsvd0 : 4; /**< Bits 35:32 - Reserved. */
|
---|
874 | uint32_t u28AddrLo : 28; /**< Bits 63:36 - Address: SPA of the attempted access (Lo). */
|
---|
875 | uint32_t u32AddrHi; /**< Bits 95:64 - Address: SPA of the attempted access (Hi). */
|
---|
876 | } n;
|
---|
877 | /** The 32-bit unsigned integer view. */
|
---|
878 | uint32_t au32[3];
|
---|
879 | } EVT_COMMAND_HARDWARE_ERROR;
|
---|
880 | AssertCompileSize(EVT_COMMAND_HARDWARE_ERROR, 12);
|
---|
881 |
|
---|
882 | /**
|
---|
883 | * Event Log Entry: IOTLB_INV_TIMEOUT.
|
---|
884 | * In accordance with the AMD spec.
|
---|
885 | */
|
---|
886 | typedef union
|
---|
887 | {
|
---|
888 | struct
|
---|
889 | {
|
---|
890 | uint16_t u16DeviceId; /**< Bits 15:0 - Device ID. */
|
---|
891 | uint16_t u16Rsvd0; /**< Bits 31:16 - Reserved.*/
|
---|
892 | uint32_t u28Rsvd0 : 28; /**< Bits 59:32 - Reserved. */
|
---|
893 | uint32_t u4EventCode : 4; /**< Bits 63:60 - Event code. */
|
---|
894 | uint32_t u4Rsvd0 : 4; /**< Bits 67:64 - Reserved. */
|
---|
895 | uint32_t u28AddrLo : 28; /**< Bits 95:68 - Address: SPA of the invalidation command that timedout (Lo). */
|
---|
896 | uint32_t u32AddrHi; /**< Bits 127:96 - Address: SPA of the invalidation command that timedout (Hi). */
|
---|
897 | } n;
|
---|
898 | /** The 32-bit unsigned integer view. */
|
---|
899 | uint32_t au32[4];
|
---|
900 | } EVT_IOTLB_INV_TIMEOUT;
|
---|
901 | AssertCompileSize(EVT_IOTLB_INV_TIMEOUT, 16);
|
---|
902 |
|
---|
903 | /**
|
---|
904 | * Event Log Entry: INVALID_DEVICE_REQUEST.
|
---|
905 | * In accordance with the AMD spec.
|
---|
906 | */
|
---|
907 | typedef union
|
---|
908 | {
|
---|
909 | struct
|
---|
910 | {
|
---|
911 | uint32_t u16DeviceId : 16; /***< Bits 15:0 - Device ID. */
|
---|
912 | uint32_t u4PasidHi : 4; /***< Bits 19:16 - PASID: Process Address-Space ID (Hi). */
|
---|
913 | uint32_t u12Rsvd0 : 12; /***< Bits 31:20 - Reserved. */
|
---|
914 | uint32_t u16PasidLo : 16; /***< Bits 47:32 - PASID: Process Address-Space ID (Lo). */
|
---|
915 | uint32_t u1GuestOrNested : 1; /***< Bit 48 - GN: Guest (GPA) or Nested (GVA). */
|
---|
916 | uint32_t u1User : 1; /***< Bit 49 - US: User/Supervisor. */
|
---|
917 | uint32_t u6Rsvd0 : 6; /***< Bits 55:50 - Reserved. */
|
---|
918 | uint32_t u1Translation: 1; /***< Bit 56 - TR: Translation. */
|
---|
919 | uint32_t u3Type: 3; /***< Bits 59:57 - Type: The type of hardware error. */
|
---|
920 | uint32_t u4EventCode : 4; /***< Bits 63:60 - Event code. */
|
---|
921 | uint64_t u64Addr; /***< Bits 127:64 - Address: Translation or access address. */
|
---|
922 | } n;
|
---|
923 | /** The 32-bit unsigned integer view. */
|
---|
924 | uint32_t au32[4];
|
---|
925 | } EVT_INVALID_DEVICE_REQUEST;
|
---|
926 | AssertCompileSize(EVT_INVALID_DEVICE_REQUEST, 16);
|
---|
927 |
|
---|
928 | /**
|
---|
929 | * Event Log Entry: EVENT_COUNTER_ZERO.
|
---|
930 | * In accordance with the AMD spec.
|
---|
931 | */
|
---|
932 | typedef union
|
---|
933 | {
|
---|
934 | struct
|
---|
935 | {
|
---|
936 | uint32_t u32Rsvd0; /**< Bits 31:0 - Reserved. */
|
---|
937 | uint32_t u28Rsvd0 : 28; /**< Bits 59:32 - Reserved. */
|
---|
938 | uint32_t u4EventCode : 4; /**< Bits 63:60 - Event code. */
|
---|
939 | uint32_t u20CounterNoteHi : 20; /**< Bits 83:64 - CounterNote: Counter value for the event counter register (Hi). */
|
---|
940 | uint32_t u12Rsvd0 : 12; /**< Bits 95:84 - Reserved. */
|
---|
941 | uint32_t u32CounterNoteLo; /**< Bits 127:96 - CounterNote: Counter value for the event cuonter register (Lo). */
|
---|
942 | } n;
|
---|
943 | /** The 32-bit unsigned integer view. */
|
---|
944 | uint32_t au32[4];
|
---|
945 | } EVT_EVENT_COUNTER_ZERO;
|
---|
946 | AssertCompileSize(EVT_EVENT_COUNTER_ZERO, 16);
|
---|
947 |
|
---|
948 | /* Not needed as we can initialize from bitfields and set/get using PCI config PDM helpers. */
|
---|
949 | #if 0
|
---|
950 | /**
|
---|
951 | * IOMMU Capability Header (PCI).
|
---|
952 | * In accordance with the AMD spec.
|
---|
953 | */
|
---|
954 | typedef union
|
---|
955 | {
|
---|
956 | struct
|
---|
957 | {
|
---|
958 | uint32_t u8CapId : 8; /**< Bits 7:0 - CapId: Capability ID. */
|
---|
959 | uint32_t u8CapPtr : 8; /**< Bits 15:8 - CapPtr: Pointer (PCI config offset) to the next capability. */
|
---|
960 | uint32_t u3CapType : 3; /**< Bits 18:16 - CapType: Capability Type. */
|
---|
961 | uint32_t u5CapRev : 5; /**< Bits 23:19 - CapRev: Capability revision. */
|
---|
962 | uint32_t u1IoTlbSup : 1; /**< Bit 24 - IotlbSup: IOTLB Support. */
|
---|
963 | uint32_t u1HtTunnel : 1; /**< Bit 25 - HtTunnel: HyperTransport Tunnel translation support. */
|
---|
964 | uint32_t u1NpCache : 1; /**< Bit 26 - NpCache: Not Present table entries are cached. */
|
---|
965 | uint32_t u1EfrSup : 1; /**< Bit 27 - EFRSup: Extended Feature Register Support. */
|
---|
966 | uint32_t u1CapExt : 1; /**< Bit 28 - CapExt: Misc. Information Register 1 Support. */
|
---|
967 | uint32_t u4Rsvd0 : 4; /**< Bits 31:29 - Reserved. */
|
---|
968 | } n;
|
---|
969 | /** The 32-bit unsigned integer view. */
|
---|
970 | uint32_t u32;
|
---|
971 | } IOMMU_CAP_HDR_T;
|
---|
972 | AssertCompileSize(IOMMU_CAP_HDR_T, 4);
|
---|
973 | #endif
|
---|
974 |
|
---|
975 | /**
|
---|
976 | * Device Table Base Address Register (MMIO).
|
---|
977 | * In accordance with the AMD spec.
|
---|
978 | */
|
---|
979 | typedef union
|
---|
980 | {
|
---|
981 | struct
|
---|
982 | {
|
---|
983 | RT_GCC_EXTENSION uint64_t u9Size : 9; /**< Bits 8:0 - Size: Size of the device table. */
|
---|
984 | RT_GCC_EXTENSION uint64_t u3Rsvd0 : 3; /**< Bits 11:9 - Reserved. */
|
---|
985 | RT_GCC_EXTENSION uint64_t u40DevTabBase : 40; /**< Bits 51:12 - DevTabBase: Device table base address. */
|
---|
986 | RT_GCC_EXTENSION uint64_t u12Rsvd0 : 12; /**< Bits 63:52 - Reserved. */
|
---|
987 | } n;
|
---|
988 | /** The 64-bit unsigned integer view. */
|
---|
989 | uint64_t u64;
|
---|
990 | } DEV_TAB_BAR_T;
|
---|
991 | AssertCompileSize(DEV_TAB_BAR_T, 8);
|
---|
992 |
|
---|
993 | /**
|
---|
994 | * Command Buffer Base Address Register (MMIO).
|
---|
995 | * In accordance with the AMD spec.
|
---|
996 | */
|
---|
997 | typedef union
|
---|
998 | {
|
---|
999 | struct
|
---|
1000 | {
|
---|
1001 | RT_GCC_EXTENSION uint64_t u12Rsvd0 : 12; /**< Bits 11:0 - Reserved. */
|
---|
1002 | RT_GCC_EXTENSION uint64_t u40CmdBase : 40; /**< Bits 51:12 - ComBase: Command buffer base address. */
|
---|
1003 | RT_GCC_EXTENSION uint64_t u4Rsvd0 : 4; /**< Bits 55:52 - Reserved. */
|
---|
1004 | RT_GCC_EXTENSION uint64_t u4CmdLen : 4; /**< Bits 59:56 - ComLen: Command buffer length. */
|
---|
1005 | RT_GCC_EXTENSION uint64_t u4Rsvd1 : 4; /**< Bits 63:60 - Reserved. */
|
---|
1006 | } n;
|
---|
1007 | /** The 64-bit unsigned integer view. */
|
---|
1008 | uint64_t u64;
|
---|
1009 | } CMD_BUF_BAR_T;
|
---|
1010 | AssertCompileSize(CMD_BUF_BAR_T, 8);
|
---|
1011 |
|
---|
1012 | /**
|
---|
1013 | * Event Log Base Address Register (MMIO).
|
---|
1014 | * In accordance with the AMD spec.
|
---|
1015 | */
|
---|
1016 | typedef union
|
---|
1017 | {
|
---|
1018 | struct
|
---|
1019 | {
|
---|
1020 | RT_GCC_EXTENSION uint64_t u12Rsvd0 : 12; /**< Bits 11:0 - Reserved. */
|
---|
1021 | RT_GCC_EXTENSION uint64_t u40EvtBase : 40; /**< Bits 51:12 - EventBase: Event log base address. */
|
---|
1022 | RT_GCC_EXTENSION uint64_t u4Rsvd0 : 4; /**< Bits 55:52 - Reserved. */
|
---|
1023 | RT_GCC_EXTENSION uint64_t u4EvtLen : 4; /**< Bits 59:56 - EventLen: Event log length. */
|
---|
1024 | RT_GCC_EXTENSION uint64_t u4Rsvd1 : 4; /**< Bits 63:60 - Reserved. */
|
---|
1025 | } n;
|
---|
1026 | /** The 64-bit unsigned integer view. */
|
---|
1027 | uint64_t u64;
|
---|
1028 | } EVT_LOG_BAR_T;
|
---|
1029 | AssertCompileSize(EVT_LOG_BAR_T, 8);
|
---|
1030 |
|
---|
1031 | /**
|
---|
1032 | * IOMMU Control Register (MMIO).
|
---|
1033 | * In accordance with the AMD spec.
|
---|
1034 | */
|
---|
1035 | typedef union
|
---|
1036 | {
|
---|
1037 | struct
|
---|
1038 | {
|
---|
1039 | uint32_t u1IommuEn : 1; /**< Bit 0 - IommuEn: IOMMU Enable. */
|
---|
1040 | uint32_t u1HtTunEn : 1; /**< Bit 1 - HtTunEn: HyperTransport Tunnel Enable. */
|
---|
1041 | uint32_t u1EvtLogEn : 1; /**< Bit 2 - EventLogEn: Event Log Enable. */
|
---|
1042 | uint32_t u1EvtIntrEn : 1; /**< Bit 3 - EventIntEn: Event Log Interrupt Enable. */
|
---|
1043 | uint32_t u1CompWaitIntrEn : 1; /**< Bit 4 - ComWaitIntEn: Completion Wait Interrupt Enable. */
|
---|
1044 | uint32_t u3InvTimeOut : 3; /**< Bits 7:5 - InvTimeOut: Invalidation Timeout. */
|
---|
1045 | uint32_t u1PassPW : 1; /**< Bit 8 - PassPW: Pass Posted Write. */
|
---|
1046 | uint32_t u1ResPassPW : 1; /**< Bit 9 - ResPassPW: Response Pass Posted Write. */
|
---|
1047 | uint32_t u1Coherent : 1; /**< Bit 10 - Coherent: HT read request packet Coherent bit. */
|
---|
1048 | uint32_t u1Isoc : 1; /**< Bit 11 - Isoc: HT read request packet Isochronous bit. */
|
---|
1049 | uint32_t u1CmdBufEn : 1; /**< Bit 12 - CmdBufEn: Command Buffer Enable. */
|
---|
1050 | uint32_t u1PprLogEn : 1; /**< Bit 13 - PprLogEn: Peripheral Page Request (PPR) Log Enable. */
|
---|
1051 | uint32_t u1PprIntrEn : 1; /**< Bit 14 - PprIntrEn: Peripheral Page Request Interrupt Enable. */
|
---|
1052 | uint32_t u1PprEn : 1; /**< Bit 15 - PprEn: Peripheral Page Request processing Enable. */
|
---|
1053 | uint32_t u1GstTranslateEn : 1; /**< Bit 16 - GTEn: Guest Translate Enable. */
|
---|
1054 | uint32_t u1GstVirtApicEn : 1; /**< Bit 17 - GAEn: Guest Virtual-APIC Enable. */
|
---|
1055 | uint32_t u4Crw : 1; /**< Bits 21:18 - CRW: Intended for future use (not documented). */
|
---|
1056 | uint32_t u1SmiFilterEn : 1; /**< Bit 22 - SmiFEn: SMI Filter Enable. */
|
---|
1057 | uint32_t u1SelfWriteBackDis : 1; /**< Bit 23 - SlfWBDis: Self Write-Back Disable. */
|
---|
1058 | uint32_t u1SmiFilterLogEn : 1; /**< Bit 24 - SmiFLogEn: SMI Filter Log Enable. */
|
---|
1059 | uint32_t u3GstVirtApicModeEn : 3; /**< Bits 27:25 - GAMEn: Guest Virtual-APIC Mode Enable. */
|
---|
1060 | uint32_t u1GstLogEn : 1; /**< Bit 28 - GALogEn: Guest Virtual-APIC GA Log Enable. */
|
---|
1061 | uint32_t u1GstIntrEn : 1; /**< Bit 29 - GAIntEn: Guest Virtual-APIC Interrupt Enable. */
|
---|
1062 | uint32_t u2DualPprLogEn : 2; /**< Bits 31:30 - DualPprLogEn: Dual Peripheral Page Request Log Enable. */
|
---|
1063 | uint32_t u2DualEvtLogEn : 2; /**< Bits 33:32 - DualEventLogEn: Dual Event Log Enable. */
|
---|
1064 | uint32_t u3DevTabSegEn : 3; /**< Bits 36:34 - DevTblSegEn: Device Table Segment Enable. */
|
---|
1065 | uint32_t u2PrivAbortEn : 2; /**< Bits 38:37 - PrivAbrtEn: Privilege Abort Enable. */
|
---|
1066 | uint32_t u1PprAutoRespEn : 1; /**< Bit 39 - PprAutoRspEn: Peripheral Page Request Auto Response Enable. */
|
---|
1067 | uint32_t u1MarcEn : 1; /**< Bit 40 - MarcEn: Memory Address Routing and Control Enable. */
|
---|
1068 | uint32_t u1BlockStopMarkEn : 1; /**< Bit 41 - BlkStopMarkEn: Block StopMark messages Enable. */
|
---|
1069 | uint32_t u1PprAutoRespAlwaysOnEn : 1; /**< Bit 42 - PprAutoRspAon:: PPR Auto Response - Always On Enable. */
|
---|
1070 | uint32_t u1DomainIDPNE : 1; /**< Bit 43 - DomainIDPE: Reserved (not documented). */
|
---|
1071 | uint32_t u1Rsvd0 : 1; /**< Bit 44 - Reserved. */
|
---|
1072 | uint32_t u1EnhancedPpr : 1; /**< Bit 45 - EPHEn: Enhanced Peripheral Page Request Handling Enable. */
|
---|
1073 | uint32_t u2HstAccDirtyBitUpdate : 2; /**< Bits 47:46 - HADUpdate: Access and Dirty Bit updated in host page table. */
|
---|
1074 | uint32_t u1GstDirtyUpdateDis : 1; /**< Bit 48 - GDUpdateDis: Disable hardare update of Dirty bit in GPT. */
|
---|
1075 | uint32_t u1Rsvd1 : 1; /**< Bit 49 - Reserved. */
|
---|
1076 | uint32_t u1X2ApicEn : 1; /**< Bit 50 - XTEn: Enable X2APIC. */
|
---|
1077 | uint32_t u1X2ApicIntrGenEn : 1; /**< Bit 51 - IntCapXTEn: Enable IOMMU X2APIC Interrupt generation. */
|
---|
1078 | uint32_t u2Rsvd0 : 2; /**< Bits 53:52 - Reserved. */
|
---|
1079 | uint32_t u1GstAccessUpdateDis : 1; /**< Bit 54 - GAUpdateDis: Disable hardare update of Access bit in GPT. */
|
---|
1080 | uint32_t u8Rsvd0 : 8; /**< Bits 63:55 - Reserved. */
|
---|
1081 | } n;
|
---|
1082 | /** The 64-bit unsigned integer view. */
|
---|
1083 | uint64_t u64;
|
---|
1084 | } IOMMU_CTRL_T;
|
---|
1085 | AssertCompileSize(IOMMU_CTRL_T, 8);
|
---|
1086 |
|
---|
1087 | /**
|
---|
1088 | * IOMMU Exclusion Base Register (MMIO).
|
---|
1089 | * In accordance with the AMD spec.
|
---|
1090 | */
|
---|
1091 | typedef union
|
---|
1092 | {
|
---|
1093 | struct
|
---|
1094 | {
|
---|
1095 | RT_GCC_EXTENSION uint64_t u1ExclEnable : 1; /**< Bit 0 - ExEn: Exclusion Range Enable. */
|
---|
1096 | RT_GCC_EXTENSION uint64_t u1AllowAll : 1; /**< Bit 1 - Allow: Allow All Devices. */
|
---|
1097 | RT_GCC_EXTENSION uint64_t u10Rsvd0 : 10; /**< Bits 11:2 - Reserved. */
|
---|
1098 | RT_GCC_EXTENSION uint64_t u40ExclRangeBase : 40; /**< Bits 51:12 - Exclusion Range Base Address. */
|
---|
1099 | RT_GCC_EXTENSION uint64_t u12Rsvd0 : 12; /**< Bits 63:52 - Reserved. */
|
---|
1100 | } n;
|
---|
1101 | /** The 64-bit unsigned integer view. */
|
---|
1102 | uint64_t u64;
|
---|
1103 | } IOMMU_EXCL_RANGE_BAR_T;
|
---|
1104 | AssertCompileSize(IOMMU_EXCL_RANGE_BAR_T, 8);
|
---|
1105 |
|
---|
1106 | /**
|
---|
1107 | * IOMMU Exclusion Range Limit Register (MMIO).
|
---|
1108 | * In accordance with the AMD spec.
|
---|
1109 | */
|
---|
1110 | typedef union
|
---|
1111 | {
|
---|
1112 | struct
|
---|
1113 | {
|
---|
1114 | RT_GCC_EXTENSION uint64_t u12Rsvd0 : 12; /**< Bits 11:0 - Reserved. */
|
---|
1115 | RT_GCC_EXTENSION uint64_t u40ExclLimit : 40; /**< Bits 51:12 - Exclusion Range Limit. */
|
---|
1116 | RT_GCC_EXTENSION uint64_t u12Rsvd1 : 12; /**< Bits 63:52 - Reserved. */
|
---|
1117 | } n;
|
---|
1118 | /** The 64-bit unsigned integer view. */
|
---|
1119 | uint64_t u64;
|
---|
1120 | } IOMMU_EXCL_RANGE_LIMIT_T;
|
---|
1121 | AssertCompileSize(IOMMU_EXCL_RANGE_LIMIT_T, 8);
|
---|
1122 |
|
---|
1123 | /**
|
---|
1124 | * IOMMU Extended Feature Register (MMIO).
|
---|
1125 | * In accordance with the AMD spec.
|
---|
1126 | */
|
---|
1127 | typedef union
|
---|
1128 | {
|
---|
1129 | struct
|
---|
1130 | {
|
---|
1131 | uint32_t u1PrefetchSup : 1; /**< Bit 0 - PreFSup: Prefetch Support. */
|
---|
1132 | uint32_t u1PprSup : 1; /**< Bit 1 - PPRSup: Peripheral Page Request Support. */
|
---|
1133 | uint32_t u1X2ApicSup : 1; /**< Bit 2 - XTSup: x2Apic Support. */
|
---|
1134 | uint32_t u1NoExecuteSup : 1; /**< Bit 3 - NXSup: No-Execute and Privilege Level Support. */
|
---|
1135 | uint32_t u1GstTranslateSup : 1; /**< Bit 4 - GTSup: Guest Translations Support. */
|
---|
1136 | uint32_t u1Rsvd0 : 1; /**< Bit 5 - Reserved. */
|
---|
1137 | uint32_t u1InvAllSup : 1; /**< Bit 6 - IASup: Invalidate-All Support. */
|
---|
1138 | uint32_t u1GstVirtApicSup : 1; /**< Bit 7 - GASup: Guest Virtual-APIC Support. */
|
---|
1139 | uint32_t u1HwErrorSup : 1; /**< Bit 8 - HESup: Hardware Error registers Support. */
|
---|
1140 | uint32_t u1PerfCounterSup : 1; /**< Bit 8 - PCSup: Performance Counter Support. */
|
---|
1141 | uint32_t u2HostAddrTranslateSize : 2; /**< Bits 11:10 - HATS: Host Address Translation Size. */
|
---|
1142 | uint32_t u2GstAddrTranslateSize : 2; /**< Bits 13:12 - GATS: Guest Address Translation Size. */
|
---|
1143 | uint32_t u2GstCr3RootTblLevel : 2; /**< Bits 15:14 - GLXSup: Guest CR3 Root Table Level (Max) Size Support. */
|
---|
1144 | uint32_t u2SmiFilterSup : 2; /**< Bits 17:16 - SmiFSup: SMI Filter Register Support. */
|
---|
1145 | uint32_t u3SmiFilterCount : 3; /**< Bits 20:18 - SmiFRC: SMI Filter Register Count. */
|
---|
1146 | uint32_t u3GstVirtApicModeSup : 3; /**< Bits 23:21 - GAMSup: Guest Virtual-APIC Modes Supported. */
|
---|
1147 | uint32_t u2DualPprLogSup : 2; /**< Bits 25:24 - DualPprLogSup: Dual Peripheral Page Request Log Support. */
|
---|
1148 | uint32_t u2Rsvd0 : 2; /**< Bits 27:26 - Reserved. */
|
---|
1149 | uint32_t u2DualEvtLogSup : 2; /**< Bits 29:28 - DualEventLogSup: Dual Event Log Support. */
|
---|
1150 | uint32_t u2Rsvd1 : 2; /**< Bits 31:30 - Reserved. */
|
---|
1151 | uint32_t u5MaxPasidSup : 5; /**< Bits 36:32 - PASMax: Maximum PASID Supported. */
|
---|
1152 | uint32_t u1UserSupervisorSup : 1; /**< Bit 37 - USSup: User/Supervisor Page Protection Support. */
|
---|
1153 | uint32_t u2DevTabSegSup : 2; /**< Bits 39:38 - DevTlbSegSup: Segmented Device Table Support. */
|
---|
1154 | uint32_t u1PprLogOverflowWarn : 1; /**< Bit 40 - PprOvrflwEarlySup: PPR Log Overflow Early Warning Support. */
|
---|
1155 | uint32_t u1PprAutoRespSup : 1; /**< Bit 41 - PprAutoRspSup: PPR Automatic Response Support. */
|
---|
1156 | uint32_t u2MarcSup : 2; /**< Bit 43:42 - MarcSup: Memory Access Routing and Control Support. */
|
---|
1157 | uint32_t u1BlockStopMarkSup : 1; /**< Bit 44 - BlkStopMarkSup: Block StopMark messages Support. */
|
---|
1158 | uint32_t u1PerfOptSup : 1; /**< Bit 45 - PerfOptSup: IOMMU Performance Optimization Support. */
|
---|
1159 | uint32_t u1MsiCapMmioSup : 1; /**< Bit 46 - MsiCapMmioSup: MSI Capability Register MMIO Access Support. */
|
---|
1160 | uint32_t u1Rsvd1 : 1; /**< Bit 47 - Reserved. */
|
---|
1161 | uint32_t u1GstIoSup : 1; /**< Bit 48 - GIoSup: Guest I/O Protection Support. */
|
---|
1162 | uint32_t u1HostAccessSup : 1; /**< Bit 49 - HASup: Host Access Support. */
|
---|
1163 | uint32_t u1EnhancedPprSup : 1; /**< Bit 50 - EPHSup: Enhanced Peripheral Page Request Handling Support. */
|
---|
1164 | uint32_t u1AttrForwardSup : 1; /**< Bit 51 - AttrFWSup: Attribute Forward Support. */
|
---|
1165 | uint32_t u1HostDirtySup : 1; /**< Bit 52 - HDSup: Host Dirty Support. */
|
---|
1166 | uint32_t u1Rsvd2 : 1; /**< Bit 53 - Reserved. */
|
---|
1167 | uint32_t u1InvIoTlbTypeSup : 1; /**< Bit 54 - InvIotlbTypeSup: Invalidate IOTLB Type Support. */
|
---|
1168 | uint32_t u6Rsvd0 : 6; /**< Bit 60:55 - Reserved. */
|
---|
1169 | uint32_t u1GstUpdateDisSup : 1; /**< Bit 61 - GAUpdateDisSup: Disable hardware update on GPT Support. */
|
---|
1170 | uint32_t u1ForcePhysDstSup : 1; /**< Bit 62 - ForcePhyDestSup: Force Phys. Dst. Mode for Remapped Intr. */
|
---|
1171 | uint32_t u1Rsvd3 : 1; /**< Bit 63 - Reserved. */
|
---|
1172 | } n;
|
---|
1173 | /** The 64-bit unsigned integer view. */
|
---|
1174 | uint64_t u64;
|
---|
1175 | } IOMMU_EXT_FEAT_T;
|
---|
1176 | AssertCompileSize(IOMMU_EXT_FEAT_T, 8);
|
---|
1177 |
|
---|
1178 | /**
|
---|
1179 | * Peripheral Page Request Log Base Address Register (MMIO).
|
---|
1180 | * In accordance with the AMD spec.
|
---|
1181 | */
|
---|
1182 | typedef union
|
---|
1183 | {
|
---|
1184 | struct
|
---|
1185 | {
|
---|
1186 | RT_GCC_EXTENSION uint64_t u12Rsvd0 : 12; /**< Bit 11:0 - Reserved. */
|
---|
1187 | RT_GCC_EXTENSION uint64_t u40PprLogBase : 40; /**< Bits 51:12 - PPRLogBase: Peripheral Page Request Log Base Address. */
|
---|
1188 | RT_GCC_EXTENSION uint64_t u4Rsvd0 : 4; /**< Bits 55:52 - Reserved. */
|
---|
1189 | RT_GCC_EXTENSION uint64_t u4PprLogLen : 4; /**< Bits 59:56 - PPRLogLen: Peripheral Page Request Log Length. */
|
---|
1190 | RT_GCC_EXTENSION uint64_t u4Rsvd1 : 4; /**< Bits 63:60 - Reserved. */
|
---|
1191 | } n;
|
---|
1192 | /** The 64-bit unsigned integer view. */
|
---|
1193 | uint64_t u64;
|
---|
1194 | } PPR_LOG_BAR_T;
|
---|
1195 | AssertCompileSize(PPR_LOG_BAR_T, 8);
|
---|
1196 |
|
---|
1197 | /**
|
---|
1198 | * IOMMU Hardware Event Upper Register (MMIO).
|
---|
1199 | * In accordance with the AMD spec.
|
---|
1200 | */
|
---|
1201 | typedef union
|
---|
1202 | {
|
---|
1203 | struct
|
---|
1204 | {
|
---|
1205 | RT_GCC_EXTENSION uint64_t u60FirstOperand : 60; /**< Bits 59:0 - First event code dependent operand. */
|
---|
1206 | RT_GCC_EXTENSION uint64_t u4EvtCode : 4; /**< Bits 63:60 - Event Code. */
|
---|
1207 | } n;
|
---|
1208 | /** The 64-bit unsigned integer view. */
|
---|
1209 | uint64_t u64;
|
---|
1210 | } IOMMU_HW_EVT_HI_T;
|
---|
1211 | AssertCompileSize(IOMMU_HW_EVT_HI_T, 8);
|
---|
1212 |
|
---|
1213 | /**
|
---|
1214 | * IOMMU Hardware Event Lower Register (MMIO).
|
---|
1215 | * In accordance with the AMD spec.
|
---|
1216 | */
|
---|
1217 | typedef uint64_t IOMMU_HW_EVT_LO_T;
|
---|
1218 |
|
---|
1219 | /**
|
---|
1220 | * IOMMU Hardware Event Status (MMIO).
|
---|
1221 | * In accordance with the AMD spec.
|
---|
1222 | */
|
---|
1223 | typedef union
|
---|
1224 | {
|
---|
1225 | struct
|
---|
1226 | {
|
---|
1227 | uint32_t u1Valid : 1; /**< Bit 0 - HEV: Hardware Event Valid. */
|
---|
1228 | uint32_t u1Overflow : 1; /**< Bit 1 - HEO: Hardware Event Overflow. */
|
---|
1229 | uint32_t u30Rsvd0 : 30; /**< Bits 31:2 - Reserved. */
|
---|
1230 | uint32_t u32Rsvd0; /**< Bits 63:32 - Reserved. */
|
---|
1231 | } n;
|
---|
1232 | /** The 64-bit unsigned integer view. */
|
---|
1233 | uint64_t u64;
|
---|
1234 | } IOMMU_HW_EVT_STATUS_T;
|
---|
1235 | AssertCompileSize(IOMMU_HW_EVT_STATUS_T, 8);
|
---|
1236 |
|
---|
1237 | /**
|
---|
1238 | * Guest Virtual-APIC Log Base Address Register (MMIO).
|
---|
1239 | * In accordance with the AMD spec.
|
---|
1240 | */
|
---|
1241 | typedef union
|
---|
1242 | {
|
---|
1243 | struct
|
---|
1244 | {
|
---|
1245 | RT_GCC_EXTENSION uint64_t u12Rsvd0 : 12; /**< Bit 11:0 - Reserved. */
|
---|
1246 | RT_GCC_EXTENSION uint64_t u40GALogBase : 40; /**< Bits 51:12 - GALogBase: Guest Virtual-APIC Log Base Address. */
|
---|
1247 | RT_GCC_EXTENSION uint64_t u4Rsvd0 : 4; /**< Bits 55:52 - Reserved. */
|
---|
1248 | RT_GCC_EXTENSION uint64_t u4GALogLen : 4; /**< Bits 59:56 - GALogLen: Guest Virtual-APIC Log Length. */
|
---|
1249 | RT_GCC_EXTENSION uint64_t u4Rsvd1 : 4; /**< Bits 63:60 - Reserved. */
|
---|
1250 | } n;
|
---|
1251 | /** The 64-bit unsigned integer view. */
|
---|
1252 | uint64_t u64;
|
---|
1253 | } GALOG_BAR_T;
|
---|
1254 | AssertCompileSize(GALOG_BAR_T, 8);
|
---|
1255 |
|
---|
1256 | /**
|
---|
1257 | * Guest Virtual-APIC Log Tail Address Register (MMIO).
|
---|
1258 | * In accordance with the AMD spec.
|
---|
1259 | */
|
---|
1260 | typedef union
|
---|
1261 | {
|
---|
1262 | struct
|
---|
1263 | {
|
---|
1264 | RT_GCC_EXTENSION uint64_t u3Rsvd0 : 3; /**< Bits 2:0 - Reserved. */
|
---|
1265 | RT_GCC_EXTENSION uint64_t u40GALogTailAddr : 48; /**< Bits 51:3 - GATAddr: Guest Virtual-APIC Tail Log Address. */
|
---|
1266 | RT_GCC_EXTENSION uint64_t u11Rsvd1 : 11; /**< Bits 63:52 - Reserved. */
|
---|
1267 | } n;
|
---|
1268 | /** The 64-bit unsigned integer view. */
|
---|
1269 | uint64_t u64;
|
---|
1270 | } GALOG_TAIL_ADDR_T;
|
---|
1271 | AssertCompileSize(GALOG_TAIL_ADDR_T, 8);
|
---|
1272 |
|
---|
1273 | /**
|
---|
1274 | * PPR Log B Base Address Register (MMIO).
|
---|
1275 | * In accordance with the AMD spec.
|
---|
1276 | * Currently identical to PPR_LOG_BAR_T.
|
---|
1277 | */
|
---|
1278 | typedef PPR_LOG_BAR_T PPR_LOG_B_BAR_T;
|
---|
1279 |
|
---|
1280 | /**
|
---|
1281 | * Event Log B Base Address Register (MMIO).
|
---|
1282 | * In accordance with the AMD spec.
|
---|
1283 | * Currently identical to EVT_LOG_BAR_T.
|
---|
1284 | */
|
---|
1285 | typedef EVT_LOG_BAR_T EVT_LOG_B_BAR_T;
|
---|
1286 |
|
---|
1287 | /**
|
---|
1288 | * Device Table Segment Register (MMIO).
|
---|
1289 | * In accordance with the AMD spec.
|
---|
1290 | */
|
---|
1291 | typedef union
|
---|
1292 | {
|
---|
1293 | struct
|
---|
1294 | {
|
---|
1295 | RT_GCC_EXTENSION uint64_t u8Size : 8; /**< Bits 7:0 - Size: Size of the Device Table segment. */
|
---|
1296 | RT_GCC_EXTENSION uint64_t u4Rsvd0 : 4; /**< Bits 11:8 - Reserved. */
|
---|
1297 | RT_GCC_EXTENSION uint64_t u40DevTabBase : 40; /**< Bits 51:12 - DevTabBase: Device Table Segment Base Address. */
|
---|
1298 | RT_GCC_EXTENSION uint64_t u12Rsvd0 : 12; /**< Bits 63:52 - Reserved. */
|
---|
1299 | } n;
|
---|
1300 | /** The 64-bit unsigned integer view. */
|
---|
1301 | uint64_t u64;
|
---|
1302 | } DEV_TAB_SEG_BAR_T;
|
---|
1303 | AssertCompileSize(DEV_TAB_SEG_BAR_T, 8);
|
---|
1304 |
|
---|
1305 | /**
|
---|
1306 | * Device-specific Feature Extension (DSFX) Register (MMIO).
|
---|
1307 | * In accordance with the AMD spec.
|
---|
1308 | */
|
---|
1309 | typedef union
|
---|
1310 | {
|
---|
1311 | struct
|
---|
1312 | {
|
---|
1313 | uint32_t u24DevSpecFeat : 24; /**< Bits 23:0 - DevSpecificFeatSupp: Implementation specific features. */
|
---|
1314 | uint32_t u4RevMinor : 4; /**< Bits 27:24 - RevMinor: Minor revision identifier. */
|
---|
1315 | uint32_t u4RevMajor : 4; /**< Bits 31:28 - RevMajor: Major revision identifier. */
|
---|
1316 | uint32_t u32Rsvd0; /**< Bits 63:32 - Reserved.*/
|
---|
1317 | } n;
|
---|
1318 | /** The 64-bit unsigned integer view. */
|
---|
1319 | uint64_t u64;
|
---|
1320 | } DEV_SPECIFIC_FEAT_T;
|
---|
1321 | AssertCompileSize(DEV_SPECIFIC_FEAT_T, 8);
|
---|
1322 |
|
---|
1323 | /**
|
---|
1324 | * Device-specific Control Extension (DSCX) Register (MMIO).
|
---|
1325 | * In accordance with the AMD spec.
|
---|
1326 | */
|
---|
1327 | typedef union
|
---|
1328 | {
|
---|
1329 | struct
|
---|
1330 | {
|
---|
1331 | uint32_t u24DevSpecCtrl : 24; /**< Bits 23:0 - DevSpecificFeatCntrl: Implementation specific control. */
|
---|
1332 | uint32_t u4RevMinor : 4; /**< Bits 27:24 - RevMinor: Minor revision identifier. */
|
---|
1333 | uint32_t u4RevMajor : 4; /**< Bits 31:28 - RevMajor: Major revision identifier. */
|
---|
1334 | uint32_t u32Rsvd0; /**< Bits 63:32 - Reserved.*/
|
---|
1335 | } n;
|
---|
1336 | /** The 64-bit unsigned integer view. */
|
---|
1337 | uint64_t u64;
|
---|
1338 | } DEV_SPECIFIC_CTRL_T;
|
---|
1339 | AssertCompileSize(DEV_SPECIFIC_CTRL_T, 8);
|
---|
1340 |
|
---|
1341 | /**
|
---|
1342 | * Device-specific Status Extension (DSSX) Register (MMIO).
|
---|
1343 | * In accordance with the AMD spec.
|
---|
1344 | */
|
---|
1345 | typedef union
|
---|
1346 | {
|
---|
1347 | struct
|
---|
1348 | {
|
---|
1349 | uint32_t u24DevSpecStatus : 24; /**< Bits 23:0 - DevSpecificFeatStatus: Implementation specific status. */
|
---|
1350 | uint32_t u4RevMinor : 4; /**< Bits 27:24 - RevMinor: Minor revision identifier. */
|
---|
1351 | uint32_t u4RevMajor : 4; /**< Bits 31:28 - RevMajor: Major revision identifier. */
|
---|
1352 | uint32_t u32Rsvd0; /**< Bits 63:32 - Reserved.*/
|
---|
1353 | } n;
|
---|
1354 | /** The 64-bit unsigned integer view. */
|
---|
1355 | uint64_t u64;
|
---|
1356 | } DEV_SPECIFIC_STATUS_T;
|
---|
1357 | AssertCompileSize(DEV_SPECIFIC_STATUS_T, 8);
|
---|
1358 |
|
---|
1359 | /**
|
---|
1360 | * MSI Information Register 0 and 1 (PCI) / MSI Vector Register 0 and 1 (MMIO).
|
---|
1361 | * In accordance with the AMD spec.
|
---|
1362 | */
|
---|
1363 | typedef union
|
---|
1364 | {
|
---|
1365 | struct
|
---|
1366 | {
|
---|
1367 | uint32_t u5MsiNumEvtLog : 5; /**< Bits 4:0 - MsiNum: Event Log MSI message number. */
|
---|
1368 | uint32_t u3GstVirtAddrSize: 3; /**< Bits 7:5 - GVAsize: Guest Virtual Address Size. */
|
---|
1369 | uint32_t u7PhysAddrSize : 7; /**< Bits 14:8 - PAsize: Physical Address Size. */
|
---|
1370 | uint32_t u7VirtAddrSize : 7; /**< Bits 21:15 - VAsize: Virtual Address Size. */
|
---|
1371 | uint32_t u1HtAtsResv: 1; /**< Bit 22 - HtAtsResv: HyperTransport ATS Response Address range Reserved. */
|
---|
1372 | uint32_t u4Rsvd0 : 4; /**< Bits 26:23 - Reserved. */
|
---|
1373 | uint32_t u5MsiNumPpr : 5; /**< Bits 31:27 - MsiNumPPR: Peripheral Page Request MSI message number. */
|
---|
1374 | uint32_t u5MsiNumGa : 5; /**< Bits 36:32 - MsiNumGa: MSI message number for guest virtual-APIC log. */
|
---|
1375 | uint32_t u27Rsvd0: 27; /**< Bits 63:37 - Reserved. */
|
---|
1376 | } n;
|
---|
1377 | /** The 32-bit unsigned integer view. */
|
---|
1378 | uint32_t au32[2];
|
---|
1379 | /** The 64-bit unsigned integer view. */
|
---|
1380 | uint64_t u64;
|
---|
1381 | } MSI_MISC_INFO_T;
|
---|
1382 | AssertCompileSize(MSI_MISC_INFO_T, 8);
|
---|
1383 | /** MSI Vector Register 0 and 1 (MMIO). */
|
---|
1384 | typedef MSI_MISC_INFO_T MSI_VECTOR_T;
|
---|
1385 |
|
---|
1386 | /**
|
---|
1387 | * MSI Capability Header Register (PCI + MMIO).
|
---|
1388 | * In accordance with the AMD spec.
|
---|
1389 | */
|
---|
1390 | typedef union
|
---|
1391 | {
|
---|
1392 | struct
|
---|
1393 | {
|
---|
1394 | uint32_t u8MsiCapId : 8; /**< Bits 7:0 - MsiCapId: Capability ID. */
|
---|
1395 | uint32_t u8MsiCapPtr : 8; /**< Bits 15:8 - MsiCapPtr: Pointer (PCI config offset) to the next capability. */
|
---|
1396 | uint32_t u1MsiEnable : 1; /**< Bit 16 - MsiEn: Message Signal Interrupt Enable. */
|
---|
1397 | uint32_t u3MsiMultiMessCap : 3; /**< Bits 19:17 - MsiMultMessCap: MSI Multi-Message Capability. */
|
---|
1398 | uint32_t u3MsiMultiMessEn : 3; /**< Bits 22:20 - MsiMultMessEn: MSI Multi-Message Enable. */
|
---|
1399 | uint32_t u1Msi64BitEn : 1; /**< Bit 23 - Msi64BitEn: MSI 64-bit Enable. */
|
---|
1400 | uint32_t u8Rsvd0 : 8; /**< Bits 31:24 - Reserved. */
|
---|
1401 | } n;
|
---|
1402 | /** The 32-bit unsigned integer view. */
|
---|
1403 | uint32_t u32;
|
---|
1404 | } MSI_CAP_HDR_T;
|
---|
1405 | AssertCompileSize(MSI_CAP_HDR_T, 4);
|
---|
1406 |
|
---|
1407 | /**
|
---|
1408 | * MSI Address Register (PCI + MMIO).
|
---|
1409 | * In accordance with the AMD spec.
|
---|
1410 | */
|
---|
1411 | typedef union
|
---|
1412 | {
|
---|
1413 | struct
|
---|
1414 | {
|
---|
1415 | RT_GCC_EXTENSION uint64_t u2Rsvd : 2; /**< Bits 1:0 - Reserved. */
|
---|
1416 | RT_GCC_EXTENSION uint64_t u62MsiAddr : 62; /**< Bits 31:2 - MsiAddr: MSI Address. */
|
---|
1417 | } n;
|
---|
1418 | /** The 32-bit unsigned integer view. */
|
---|
1419 | uint32_t au32[2];
|
---|
1420 | /** The 64-bit unsigned integer view. */
|
---|
1421 | uint64_t u64;
|
---|
1422 | } MSI_ADDR_T;
|
---|
1423 | AssertCompileSize(MSI_ADDR_T, 8);
|
---|
1424 |
|
---|
1425 | /**
|
---|
1426 | * MSI Data Register (PCI + MMIO).
|
---|
1427 | * In accordance with the AMD spec.
|
---|
1428 | */
|
---|
1429 | typedef union
|
---|
1430 | {
|
---|
1431 | struct
|
---|
1432 | {
|
---|
1433 | uint16_t u16MsiData; /**< Bits 15:0 - MsiData: MSI Data. */
|
---|
1434 | uint16_t u16Rsvd0; /**< Bits 31:16 - Reserved. */
|
---|
1435 | } n;
|
---|
1436 | /** The 32-bit unsigned integer view. */
|
---|
1437 | uint32_t u32;
|
---|
1438 | } MSI_DATA_T;
|
---|
1439 | AssertCompileSize(MSI_DATA_T, 4);
|
---|
1440 |
|
---|
1441 | /**
|
---|
1442 | * MSI Mapping Capability Header Register (PCI + MMIO).
|
---|
1443 | * In accordance with the AMD spec.
|
---|
1444 | */
|
---|
1445 | typedef union
|
---|
1446 | {
|
---|
1447 | struct
|
---|
1448 | {
|
---|
1449 | uint32_t u8MsiMapCapId : 8; /**< Bits 7:0 - MsiMapCapId: MSI Map capability ID. */
|
---|
1450 | uint32_t u8Rsvd0 : 8; /**< Bits 15:8 - Reserved. */
|
---|
1451 | uint32_t u1MsiMapEn : 1; /**< Bit 16 - MsiMapEn: MSI Map enable. */
|
---|
1452 | uint32_t u1MsiMapFixed : 1; /**< Bit 17 - MsiMapFixd: MSI Map fixed. */
|
---|
1453 | uint32_t u9Rsvd0 : 9; /**< Bits 26:18 - Reserved. */
|
---|
1454 | uint32_t u5MapCapType : 5; /**< Bits 31:27 - MsiMapCapType: MSI Mapping capability type. */
|
---|
1455 | } n;
|
---|
1456 | /** The 32-bit unsigned integer view. */
|
---|
1457 | uint32_t u32;
|
---|
1458 | } MSI_MAP_CAP_HDR_T;
|
---|
1459 | AssertCompileSize(MSI_MAP_CAP_HDR_T, 4);
|
---|
1460 |
|
---|
1461 | /**
|
---|
1462 | * Performance Optimization Control Register (MMIO).
|
---|
1463 | * In accordance with the AMD spec.
|
---|
1464 | */
|
---|
1465 | typedef union
|
---|
1466 | {
|
---|
1467 | struct
|
---|
1468 | {
|
---|
1469 | uint32_t u13Rsvd0 : 13; /**< Bits 12:0 - Reserved. */
|
---|
1470 | uint32_t u1PerfOptEn : 1; /**< Bit 13 - PerfOptEn: Performance Optimization Enable. */
|
---|
1471 | uint32_t u17Rsvd0 : 18; /**< Bits 31:14 - Reserved. */
|
---|
1472 | } n;
|
---|
1473 | /** The 32-bit unsigned integer view. */
|
---|
1474 | uint32_t u32;
|
---|
1475 | } IOMMU_PERF_OPT_CTRL_T;
|
---|
1476 | AssertCompileSize(IOMMU_PERF_OPT_CTRL_T, 4);
|
---|
1477 |
|
---|
1478 | /**
|
---|
1479 | * XT (x2APIC) IOMMU General Interrupt Control Register (MMIO).
|
---|
1480 | * In accordance with the AMD spec.
|
---|
1481 | */
|
---|
1482 | typedef union
|
---|
1483 | {
|
---|
1484 | struct
|
---|
1485 | {
|
---|
1486 | uint32_t u2Rsvd0 : 2; /**< Bits 1:0 - Reserved.*/
|
---|
1487 | uint32_t u1X2ApicIntrDstMode : 1; /**< Bit 2 - Destination Mode for general interrupt.*/
|
---|
1488 | uint32_t u4Rsvd0 : 4; /**< Bits 7:3 - Reserved.*/
|
---|
1489 | uint32_t u24X2ApicIntrDstLo : 24; /**< Bits 31:8 - Destination for general interrupt (Lo).*/
|
---|
1490 | uint32_t u8X2ApicIntrVector : 8; /**< Bits 39:32 - Vector for general interrupt.*/
|
---|
1491 | uint32_t u1X2ApicIntrDeliveryMode : 1; /**< Bit 40 - Delivery Mode for general interrupt.*/
|
---|
1492 | uint32_t u15Rsvd0 : 15; /**< Bits 55:41 - Reserved.*/
|
---|
1493 | uint32_t u7X2ApicIntrDstHi : 7; /**< Bits 63:56 - Destination for general interrupt (Hi) .*/
|
---|
1494 | } n;
|
---|
1495 | /** The 64-bit unsigned integer view. */
|
---|
1496 | uint64_t u64;
|
---|
1497 | } IOMMU_XT_GEN_INTR_CTRL_T;
|
---|
1498 | AssertCompileSize(IOMMU_XT_GEN_INTR_CTRL_T, 8);
|
---|
1499 |
|
---|
1500 | /**
|
---|
1501 | * XT (x2APIC) IOMMU General Interrupt Control Register (MMIO).
|
---|
1502 | * In accordance with the AMD spec.
|
---|
1503 | */
|
---|
1504 | typedef union
|
---|
1505 | {
|
---|
1506 | struct
|
---|
1507 | {
|
---|
1508 | uint32_t u2Rsvd0 : 2; /**< Bits 1:0 - Reserved.*/
|
---|
1509 | uint32_t u1X2ApicIntrDstMode : 1; /**< Bit 2 - Destination Mode for the interrupt.*/
|
---|
1510 | uint32_t u4Rsvd0 : 4; /**< Bits 7:3 - Reserved.*/
|
---|
1511 | uint32_t u24X2ApicIntrDstLo : 24; /**< Bits 31:8 - Destination for the interrupt (Lo).*/
|
---|
1512 | uint32_t u8X2ApicIntrVector : 8; /**< Bits 39:32 - Vector for the interrupt.*/
|
---|
1513 | uint32_t u1X2ApicIntrDeliveryMode : 1; /**< Bit 40 - Delivery Mode for the interrupt.*/
|
---|
1514 | uint32_t u15Rsvd0 : 15; /**< Bits 55:41 - Reserved.*/
|
---|
1515 | uint32_t u7X2ApicIntrDstHi : 7; /**< Bits 63:56 - Destination for the interrupt (Hi) .*/
|
---|
1516 | } n;
|
---|
1517 | /** The 64-bit unsigned integer view. */
|
---|
1518 | uint64_t u64;
|
---|
1519 | } IOMMU_XT_INTR_CTRL_T;
|
---|
1520 | AssertCompileSize(IOMMU_XT_INTR_CTRL_T, 8);
|
---|
1521 |
|
---|
1522 | /**
|
---|
1523 | * XT (x2APIC) IOMMU PPR Interrupt Control Register (MMIO).
|
---|
1524 | * In accordance with the AMD spec.
|
---|
1525 | * Currently identical to IOMMU_XT_INTR_CTRL_T.
|
---|
1526 | */
|
---|
1527 | typedef IOMMU_XT_INTR_CTRL_T IOMMU_XT_PPR_INTR_CTRL_T;
|
---|
1528 |
|
---|
1529 | /**
|
---|
1530 | * XT (x2APIC) IOMMU GA (Guest Address) Log Control Register (MMIO).
|
---|
1531 | * In accordance with the AMD spec.
|
---|
1532 | * Currently identical to IOMMU_XT_INTR_CTRL_T.
|
---|
1533 | */
|
---|
1534 | typedef IOMMU_XT_INTR_CTRL_T IOMMU_XT_GALOG_INTR_CTRL_T;
|
---|
1535 |
|
---|
1536 | /**
|
---|
1537 | * Memory Access and Routing Control (MARC) Aperture Base Register (MMIO).
|
---|
1538 | * In accordance with the AMD spec.
|
---|
1539 | */
|
---|
1540 | typedef union
|
---|
1541 | {
|
---|
1542 | struct
|
---|
1543 | {
|
---|
1544 | RT_GCC_EXTENSION uint64_t u12Rsvd0 : 12; /**< Bits 11:0 - Reserved. */
|
---|
1545 | RT_GCC_EXTENSION uint64_t u40MarcBaseAddr : 40; /**< Bits 51:12 - MarcBaseAddr: MARC Aperture Base Address. */
|
---|
1546 | RT_GCC_EXTENSION uint64_t u12Rsvd1 : 12; /**< Bits 63:52 - Reserved. */
|
---|
1547 | } n;
|
---|
1548 | /** The 64-bit unsigned integer view. */
|
---|
1549 | uint64_t u64;
|
---|
1550 | } MARC_APER_BAR_T;
|
---|
1551 | AssertCompileSize(MARC_APER_BAR_T, 8);
|
---|
1552 |
|
---|
1553 | /**
|
---|
1554 | * Memory Access and Routing Control (MARC) Relocation Register (MMIO).
|
---|
1555 | * In accordance with the AMD spec.
|
---|
1556 | */
|
---|
1557 | typedef union
|
---|
1558 | {
|
---|
1559 | struct
|
---|
1560 | {
|
---|
1561 | RT_GCC_EXTENSION uint64_t u1RelocEn : 1; /**< Bit 0 - RelocEn: Relocation Enabled. */
|
---|
1562 | RT_GCC_EXTENSION uint64_t u1ReadOnly : 1; /**< Bit 1 - ReadOnly: Whether only read-only acceses allowed. */
|
---|
1563 | RT_GCC_EXTENSION uint64_t u10Rsvd0 : 10; /**< Bits 11:2 - Reserved. */
|
---|
1564 | RT_GCC_EXTENSION uint64_t u40MarcRelocAddr : 40; /**< Bits 51:12 - MarcRelocAddr: MARC Aperture Relocation Address. */
|
---|
1565 | RT_GCC_EXTENSION uint64_t u12Rsvd1 : 12; /**< Bits 63:52 - Reserved. */
|
---|
1566 | } n;
|
---|
1567 | /** The 64-bit unsigned integer view. */
|
---|
1568 | uint64_t u64;
|
---|
1569 | } MARC_APER_RELOC_T;
|
---|
1570 | AssertCompileSize(MARC_APER_RELOC_T, 8);
|
---|
1571 |
|
---|
1572 | /**
|
---|
1573 | * Memory Access and Routing Control (MARC) Length Register (MMIO).
|
---|
1574 | * In accordance with the AMD spec.
|
---|
1575 | */
|
---|
1576 | typedef union
|
---|
1577 | {
|
---|
1578 | struct
|
---|
1579 | {
|
---|
1580 | RT_GCC_EXTENSION uint64_t u12Rsvd0 : 12; /**< Bits 11:0 - Reserved. */
|
---|
1581 | RT_GCC_EXTENSION uint64_t u40MarcLength : 40; /**< Bits 51:12 - MarcLength: MARC Aperture Length. */
|
---|
1582 | RT_GCC_EXTENSION uint64_t u12Rsvd1 : 12; /**< Bits 63:52 - Reserved. */
|
---|
1583 | } n;
|
---|
1584 | /** The 64-bit unsigned integer view. */
|
---|
1585 | uint64_t u64;
|
---|
1586 | } MARC_APER_LEN_T;
|
---|
1587 |
|
---|
1588 | /**
|
---|
1589 | * Memory Access and Routing Control (MARC) Aperture Register.
|
---|
1590 | * This combines other registers to match the MMIO layout for convenient access.
|
---|
1591 | */
|
---|
1592 | typedef struct
|
---|
1593 | {
|
---|
1594 | MARC_APER_BAR_T Base;
|
---|
1595 | MARC_APER_RELOC_T Reloc;
|
---|
1596 | MARC_APER_LEN_T Length;
|
---|
1597 | } MARC_APER_T;
|
---|
1598 | AssertCompileSize(MARC_APER_T, 24);
|
---|
1599 |
|
---|
1600 | /**
|
---|
1601 | * IOMMU Reserved Register (MMIO).
|
---|
1602 | * In accordance with the AMD spec.
|
---|
1603 | * This register is reserved for hardware use (although RW?).
|
---|
1604 | */
|
---|
1605 | typedef uint64_t IOMMU_RSVD_REG_T;
|
---|
1606 |
|
---|
1607 | /**
|
---|
1608 | * Command Buffer Head Pointer Register (MMIO).
|
---|
1609 | * In accordance with the AMD spec.
|
---|
1610 | */
|
---|
1611 | typedef union
|
---|
1612 | {
|
---|
1613 | struct
|
---|
1614 | {
|
---|
1615 | uint32_t u4Rsvd0 : 4; /**< Bits 3:0 - Reserved. */
|
---|
1616 | uint32_t u15Ptr : 15; /**< Bits 18:4 - Buffer pointer. */
|
---|
1617 | uint32_t u13Rsvd0 : 13; /**< Bits 31:19 - Reserved. */
|
---|
1618 | uint32_t u32Rsvd0; /**< Bits 63:32 - Reserved. */
|
---|
1619 | } n;
|
---|
1620 | /** The 32-bit unsigned integer view. */
|
---|
1621 | uint32_t au32[2];
|
---|
1622 | /** The 64-bit unsigned integer view. */
|
---|
1623 | uint64_t u64;
|
---|
1624 | } CMD_BUF_HEAD_PTR_T;
|
---|
1625 | AssertCompileSize(CMD_BUF_HEAD_PTR_T, 8);
|
---|
1626 |
|
---|
1627 | /**
|
---|
1628 | * Command Buffer Tail Pointer Register (MMIO).
|
---|
1629 | * In accordance with the AMD spec.
|
---|
1630 | * Currently identical to CMD_BUF_HEAD_PTR_T.
|
---|
1631 | */
|
---|
1632 | typedef CMD_BUF_HEAD_PTR_T CMD_BUF_TAIL_PTR_T;
|
---|
1633 |
|
---|
1634 | /**
|
---|
1635 | * Event Log Head Pointer Register (MMIO).
|
---|
1636 | * In accordance with the AMD spec.
|
---|
1637 | * Currently identical to CMD_BUF_HEAD_PTR_T.
|
---|
1638 | */
|
---|
1639 | typedef CMD_BUF_HEAD_PTR_T EVT_LOG_HEAD_PTR_T;
|
---|
1640 |
|
---|
1641 | /**
|
---|
1642 | * Event Log Tail Pointer Register (MMIO).
|
---|
1643 | * In accordance with the AMD spec.
|
---|
1644 | * Currently identical to CMD_BUF_HEAD_PTR_T.
|
---|
1645 | */
|
---|
1646 | typedef CMD_BUF_HEAD_PTR_T EVT_LOG_TAIL_PTR_T;
|
---|
1647 |
|
---|
1648 | /**
|
---|
1649 | * IOMMU Status Register (MMIO).
|
---|
1650 | * In accordance with the AMD spec.
|
---|
1651 | */
|
---|
1652 | typedef union
|
---|
1653 | {
|
---|
1654 | struct
|
---|
1655 | {
|
---|
1656 | uint32_t u1EvtOverflow : 1; /**< Bit 0 - EventOverflow: Event log overflow. */
|
---|
1657 | uint32_t u1EvtLogIntr : 1; /**< Bit 1 - EventLogInt: Event log interrupt. */
|
---|
1658 | uint32_t u1CompWaitIntr : 1; /**< Bit 2 - ComWaitInt: Completion wait interrupt . */
|
---|
1659 | uint32_t u1EvtLogRunning : 1; /**< Bit 3 - EventLogRun: Event logging is running. */
|
---|
1660 | uint32_t u1CmdBufRunning : 1; /**< Bit 4 - CmdBufRun: Command buffer is running. */
|
---|
1661 | uint32_t u1PprOverflow : 1; /**< Bit 5 - PprOverflow: Peripheral Page Request Log (PPR) overflow. */
|
---|
1662 | uint32_t u1PprIntr : 1; /**< Bit 6 - PprInt: PPR interrupt. */
|
---|
1663 | uint32_t u1PprLogRunning : 1; /**< Bit 7 - PprLogRun: PPR logging is running. */
|
---|
1664 | uint32_t u1GstLogRunning : 1; /**< Bit 8 - GALogRun: Guest virtual-APIC logging is running. */
|
---|
1665 | uint32_t u1GstLogOverflow : 1; /**< Bit 9 - GALOverflow: Guest virtual-APIC log overflow. */
|
---|
1666 | uint32_t u1GstLogIntr : 1; /**< Bit 10 - GAInt: Guest virtual-APIC log interrupt. */
|
---|
1667 | uint32_t u1PprOverflowB : 1; /**< Bit 11 - PprOverflowB: PPR log B overflow. */
|
---|
1668 | uint32_t u1PprLogActive : 1; /**< Bit 12 - PprLogActive: PPR log A is active. */
|
---|
1669 | uint32_t u2Rsvd0 : 2; /**< Bits 14:13 - Reserved. */
|
---|
1670 | uint32_t u1EvtOverflowB : 1; /**< Bit 15 - EvtOverflowB: Event log B overflow. */
|
---|
1671 | uint32_t u1EvtLogActive : 1; /**< Bit 16 - EvtLogActive: Event log A active. */
|
---|
1672 | uint32_t u1PprOverflowEarlyB : 1; /**< Bit 17 - PprOverflowEarlyB: PPR log B overflow early warning. */
|
---|
1673 | uint32_t u1PprOverflowEarly : 1; /**< Bit 18 - PprOverflowEarly: PPR log overflow early warning. */
|
---|
1674 | uint32_t u13Rsvd0 : 13; /**< Bits 31:19 - Reserved. */
|
---|
1675 | uint32_t u32Rsvd0; /**< Bits 63:32 - Reserved . */
|
---|
1676 | } n;
|
---|
1677 | /** The 32-bit unsigned integer view. */
|
---|
1678 | uint32_t au32[2];
|
---|
1679 | /** The 64-bit unsigned integer view. */
|
---|
1680 | uint64_t u64;
|
---|
1681 | } IOMMU_STATUS_T;
|
---|
1682 | AssertCompileSize(IOMMU_STATUS_T, 8);
|
---|
1683 |
|
---|
1684 | /**
|
---|
1685 | * PPR Log Head Pointer Register (MMIO).
|
---|
1686 | * In accordance with the AMD spec.
|
---|
1687 | * Currently identical to CMD_BUF_HEAD_PTR_T.
|
---|
1688 | */
|
---|
1689 | typedef CMD_BUF_HEAD_PTR_T PPR_LOG_HEAD_PTR_T;
|
---|
1690 |
|
---|
1691 | /**
|
---|
1692 | * PPR Log Tail Pointer Register (MMIO).
|
---|
1693 | * In accordance with the AMD spec.
|
---|
1694 | * Currently identical to CMD_BUF_HEAD_PTR_T.
|
---|
1695 | */
|
---|
1696 | typedef CMD_BUF_HEAD_PTR_T PPR_LOG_TAIL_PTR_T;
|
---|
1697 |
|
---|
1698 | /**
|
---|
1699 | * Guest Virtual-APIC Log Head Pointer Register (MMIO).
|
---|
1700 | * In accordance with the AMD spec.
|
---|
1701 | */
|
---|
1702 | typedef union
|
---|
1703 | {
|
---|
1704 | struct
|
---|
1705 | {
|
---|
1706 | uint32_t u2Rsvd0 : 2; /**< Bits 2:0 - Reserved. */
|
---|
1707 | uint32_t u12GALogPtr : 12; /**< Bits 15:3 - Guest Virtual-APIC Log Head or Tail Pointer. */
|
---|
1708 | uint32_t u16Rsvd0 : 16; /**< Bits 31:16 - Reserved. */
|
---|
1709 | uint32_t u32Rsvd0; /**< Bits 63:32 - Reserved. */
|
---|
1710 | } n;
|
---|
1711 | /** The 32-bit unsigned integer view. */
|
---|
1712 | uint32_t au32[2];
|
---|
1713 | /** The 64-bit unsigned integer view. */
|
---|
1714 | uint64_t u64;
|
---|
1715 | } GALOG_HEAD_PTR_T;
|
---|
1716 | AssertCompileSize(GALOG_HEAD_PTR_T, 8);
|
---|
1717 |
|
---|
1718 | /**
|
---|
1719 | * Guest Virtual-APIC Log Tail Pointer Register (MMIO).
|
---|
1720 | * In accordance with the AMD spec.
|
---|
1721 | * Currently identical to GALOG_HEAD_PTR_T.
|
---|
1722 | */
|
---|
1723 | typedef GALOG_HEAD_PTR_T GALOG_TAIL_PTR_T;
|
---|
1724 |
|
---|
1725 | /**
|
---|
1726 | * PPR Log B Head Pointer Register (MMIO).
|
---|
1727 | * In accordance with the AMD spec.
|
---|
1728 | * Currently identical to CMD_BUF_HEAD_PTR_T.
|
---|
1729 | */
|
---|
1730 | typedef CMD_BUF_HEAD_PTR_T PPR_LOG_B_HEAD_PTR_T;
|
---|
1731 |
|
---|
1732 | /**
|
---|
1733 | * PPR Log B Tail Pointer Register (MMIO).
|
---|
1734 | * In accordance with the AMD spec.
|
---|
1735 | * Currently identical to CMD_BUF_HEAD_PTR_T.
|
---|
1736 | */
|
---|
1737 | typedef CMD_BUF_HEAD_PTR_T PPR_LOG_B_TAIL_PTR_T;
|
---|
1738 |
|
---|
1739 | /**
|
---|
1740 | * Event Log B Head Pointer Register (MMIO).
|
---|
1741 | * In accordance with the AMD spec.
|
---|
1742 | * Currently identical to CMD_BUF_HEAD_PTR_T.
|
---|
1743 | */
|
---|
1744 | typedef CMD_BUF_HEAD_PTR_T EVT_LOG_B_HEAD_PTR_T;
|
---|
1745 |
|
---|
1746 | /**
|
---|
1747 | * Event Log B Tail Pointer Register (MMIO).
|
---|
1748 | * In accordance with the AMD spec.
|
---|
1749 | * Currently identical to CMD_BUF_HEAD_PTR_T.
|
---|
1750 | */
|
---|
1751 | typedef CMD_BUF_HEAD_PTR_T EVT_LOG_B_TAIL_PTR_T;
|
---|
1752 |
|
---|
1753 | /**
|
---|
1754 | * PPR Log Auto Response Register (MMIO).
|
---|
1755 | * In accordance with the AMD spec.
|
---|
1756 | */
|
---|
1757 | typedef union
|
---|
1758 | {
|
---|
1759 | struct
|
---|
1760 | {
|
---|
1761 | uint32_t u4AutoRespCode : 4; /**< Bits 3:0 - PprAutoRespCode: PPR log Auto Response Code. */
|
---|
1762 | uint32_t u1AutoRespMaskGen : 1; /**< Bit 4 - PprAutoRespMaskGn: PPR log Auto Response Mask Gen. */
|
---|
1763 | uint32_t u27Rsvd0 : 27; /**< Bits 31:5 - Reserved. */
|
---|
1764 | uint32_t u32Rsvd0; /**< Bits 63:32 - Reserved.*/
|
---|
1765 | } n;
|
---|
1766 | /** The 32-bit unsigned integer view. */
|
---|
1767 | uint32_t au32[2];
|
---|
1768 | /** The 64-bit unsigned integer view. */
|
---|
1769 | uint64_t u64;
|
---|
1770 | } PPR_LOG_AUTO_RESP_T;
|
---|
1771 | AssertCompileSize(PPR_LOG_AUTO_RESP_T, 8);
|
---|
1772 |
|
---|
1773 | /**
|
---|
1774 | * PPR Log Overflow Early Indicator Register (MMIO).
|
---|
1775 | * In accordance with the AMD spec.
|
---|
1776 | */
|
---|
1777 | typedef union
|
---|
1778 | {
|
---|
1779 | struct
|
---|
1780 | {
|
---|
1781 | uint32_t u15Threshold : 15; /**< Bits 14:0 - PprOvrflwEarlyThreshold: Overflow early indicator threshold. */
|
---|
1782 | uint32_t u15Rsvd0 : 15; /**< Bits 29:15 - Reserved. */
|
---|
1783 | uint32_t u1IntrEn : 1; /**< Bit 30 - PprOvrflwEarlyIntEn: Overflow early indicator interrupt enable. */
|
---|
1784 | uint32_t u1Enable : 1; /**< Bit 31 - PprOvrflwEarlyEn: Overflow early indicator enable. */
|
---|
1785 | uint32_t u32Rsvd0; /**< Bits 63:32 - Reserved. */
|
---|
1786 | } n;
|
---|
1787 | /** The 32-bit unsigned integer view. */
|
---|
1788 | uint32_t au32[2];
|
---|
1789 | /** The 64-bit unsigned integer view. */
|
---|
1790 | uint64_t u64;
|
---|
1791 | } PPR_LOG_OVERFLOW_EARLY_T;
|
---|
1792 | AssertCompileSize(PPR_LOG_OVERFLOW_EARLY_T, 8);
|
---|
1793 |
|
---|
1794 | /**
|
---|
1795 | * PPR Log B Overflow Early Indicator Register (MMIO).
|
---|
1796 | * In accordance with the AMD spec.
|
---|
1797 | * Currently identical to PPR_LOG_OVERFLOW_EARLY_T.
|
---|
1798 | */
|
---|
1799 | typedef PPR_LOG_OVERFLOW_EARLY_T PPR_LOG_B_OVERFLOW_EARLY_T;
|
---|
1800 |
|
---|
1801 |
|
---|
1802 | /**
|
---|
1803 | * The shared IOMMU device state.
|
---|
1804 | */
|
---|
1805 | typedef struct IOMMU
|
---|
1806 | {
|
---|
1807 | /** Whether this IOMMU is at the top of the PCI tree hierarchy or not. */
|
---|
1808 | bool fRootComplex;
|
---|
1809 | /** Alignment padding. */
|
---|
1810 | bool afPadding[3];
|
---|
1811 | /** The MMIO handle. */
|
---|
1812 | IOMMMIOHANDLE hMmio;
|
---|
1813 |
|
---|
1814 | /** @name MMIO: Control and status registers.
|
---|
1815 | * @{ */
|
---|
1816 | DEV_TAB_BAR_T DevTabBaseAddr; /**< Device table base address register. */
|
---|
1817 | CMD_BUF_BAR_T CmdBufBaseAddr; /**< Command buffer base address register. */
|
---|
1818 | EVT_LOG_BAR_T EvtLogBaseAddr; /**< Event log base address register. */
|
---|
1819 | IOMMU_CTRL_T Ctrl; /**< IOMMU control register. */
|
---|
1820 | IOMMU_EXCL_RANGE_BAR_T ExclRangeBaseAddr; /**< IOMMU exclusion range base register. */
|
---|
1821 | IOMMU_EXCL_RANGE_LIMIT_T ExclRangeLimit; /**< IOMMU exclusion range limit. */
|
---|
1822 | IOMMU_EXT_FEAT_T ExtFeat; /**< IOMMU extended feature register. */
|
---|
1823 | /** @} */
|
---|
1824 |
|
---|
1825 | /** @name MMIO: PPR Log registers.
|
---|
1826 | * @{ */
|
---|
1827 | PPR_LOG_BAR_T PprLogBaseAddr; /**< PPR Log base address register. */
|
---|
1828 | IOMMU_HW_EVT_HI_T HwEvtHi; /**< IOMMU hardware event register (Hi). */
|
---|
1829 | IOMMU_HW_EVT_LO_T HwEvtLo; /**< IOMMU hardware event register (Lo). */
|
---|
1830 | IOMMU_HW_EVT_STATUS_T HwEvtStatus; /**< IOMMU hardware event status. */
|
---|
1831 | /** @} */
|
---|
1832 |
|
---|
1833 | /** @todo IOMMU: SMI filter. */
|
---|
1834 |
|
---|
1835 | /** @name MMIO: Guest Virtual-APIC Log registers.
|
---|
1836 | * @{ */
|
---|
1837 | GALOG_BAR_T GALogBaseAddr; /**< Guest Virtual-APIC Log base address register. */
|
---|
1838 | GALOG_TAIL_ADDR_T GALogTailAddr; /**< Guest Virtual-APIC Log Tail address register. */
|
---|
1839 | /** @} */
|
---|
1840 |
|
---|
1841 | /** @name MMIO: Alternate PPR and Event Log registers.
|
---|
1842 | * @{ */
|
---|
1843 | PPR_LOG_B_BAR_T PprLogBBaseAddr; /**< PPR Log B base address register. */
|
---|
1844 | EVT_LOG_B_BAR_T EvtLogBBaseAddr; /**< Event Log B base address register. */
|
---|
1845 | /** @} */
|
---|
1846 |
|
---|
1847 | /** @name MMIO: Device table segment registers.
|
---|
1848 | * @{ */
|
---|
1849 | DEV_TAB_SEG_BAR_T DevTabSeg[7]; /**< Device Table Segment base address register. */
|
---|
1850 | /** @} */
|
---|
1851 |
|
---|
1852 | /** @name MMIO: Device-specific feature registers.
|
---|
1853 | * @{ */
|
---|
1854 | DEV_SPECIFIC_FEAT_T DevSpecificFeat; /**< Device-specific feature extension register (DSFX). */
|
---|
1855 | DEV_SPECIFIC_CTRL_T DevSpecificCtrl; /**< Device-specific control extension register (DSCX). */
|
---|
1856 | DEV_SPECIFIC_STATUS_T DevSpecificStatus; /**< Device-specific status extension register (DSSX). */
|
---|
1857 | /** @} */
|
---|
1858 |
|
---|
1859 | /** @name MMIO: MSI Capability Block registers.
|
---|
1860 | * @{ */
|
---|
1861 | MSI_MISC_INFO_T MsiMiscInfo; /**< MSI Misc. info registers / MSI Vector registers. */
|
---|
1862 | MSI_CAP_HDR_T MsiCapHdr; /**< MSI Capability header register. */
|
---|
1863 | MSI_ADDR_T MsiAddr; /**< MSI Address register.*/
|
---|
1864 | MSI_DATA_T MsiData; /**< MSI Data register. */
|
---|
1865 | MSI_MAP_CAP_HDR_T MsiMapCapHdr; /**< MSI Mapping capability header register. */
|
---|
1866 | /** @} */
|
---|
1867 |
|
---|
1868 | /** @name MMIO: Performance Optimization Control registers.
|
---|
1869 | * @{ */
|
---|
1870 | IOMMU_PERF_OPT_CTRL_T PerfOptCtrl; /**< IOMMU Performance optimization control register. */
|
---|
1871 | /** @} */
|
---|
1872 |
|
---|
1873 | /** @name MMIO: x2APIC Control registers.
|
---|
1874 | * @{ */
|
---|
1875 | IOMMU_XT_GEN_INTR_CTRL_T XtGenIntrCtrl; /**< IOMMU X2APIC General interrupt control register. */
|
---|
1876 | IOMMU_XT_PPR_INTR_CTRL_T XtPprIntrCtrl; /**< IOMMU X2APIC PPR interrupt control register. */
|
---|
1877 | IOMMU_XT_GALOG_INTR_CTRL_T XtGALogIntrCtrl; /**< IOMMU X2APIC Guest Log interrupt control register. */
|
---|
1878 | /** @} */
|
---|
1879 |
|
---|
1880 | /** @name MMIO: MARC registers.
|
---|
1881 | * @{ */
|
---|
1882 | MARC_APER_T aMarcApers[4]; /**< MARC Aperture Registers. */
|
---|
1883 | /** @} */
|
---|
1884 |
|
---|
1885 | /** @name MMIO: Reserved register.
|
---|
1886 | * @{ */
|
---|
1887 | IOMMU_RSVD_REG_T RsvdReg; /**< IOMMU Reserved Register. */
|
---|
1888 | /** @} */
|
---|
1889 |
|
---|
1890 | /** @name MMIO: Command and Event Log pointer registers.
|
---|
1891 | * @{ */
|
---|
1892 | CMD_BUF_HEAD_PTR_T CmdBufHeadPtr; /**< Command buffer head pointer register. */
|
---|
1893 | CMD_BUF_TAIL_PTR_T CmdBufTailPtr; /**< Command buffer tail pointer register. */
|
---|
1894 | EVT_LOG_HEAD_PTR_T EvtLogHeadPtr; /**< Event log head pointer register. */
|
---|
1895 | EVT_LOG_TAIL_PTR_T EvtLogTailPtr; /**< Event log tail pointer register. */
|
---|
1896 | /** @} */
|
---|
1897 |
|
---|
1898 | /** @name MMIO: Command and Event Status register.
|
---|
1899 | * @{ */
|
---|
1900 | IOMMU_STATUS_T Status; /**< IOMMU status register. */
|
---|
1901 | /** @} */
|
---|
1902 |
|
---|
1903 | /** @name MMIO: PPR Log Head and Tail pointer registers.
|
---|
1904 | * @{ */
|
---|
1905 | PPR_LOG_HEAD_PTR_T PprLogHeadPtr; /**< IOMMU PPR log head pointer register. */
|
---|
1906 | PPR_LOG_TAIL_PTR_T PprLogTailPtr; /**< IOMMU PPR log tail pointer register. */
|
---|
1907 | /** @} */
|
---|
1908 |
|
---|
1909 | /** @name MMIO: Guest Virtual-APIC Log Head and Tail pointer registers.
|
---|
1910 | * @{ */
|
---|
1911 | GALOG_HEAD_PTR_T GALogHeadPtr; /**< Guest Virtual-APIC log head pointer register. */
|
---|
1912 | GALOG_TAIL_PTR_T GALogTailPtr; /**< Guest Virtual-APIC log tail pointer register. */
|
---|
1913 | /** @} */
|
---|
1914 |
|
---|
1915 | /** @name MMIO: PPR Log B Head and Tail pointer registers.
|
---|
1916 | * @{ */
|
---|
1917 | PPR_LOG_B_HEAD_PTR_T PprLogBHeadPtr; /**< PPR log B head pointer register. */
|
---|
1918 | PPR_LOG_B_TAIL_PTR_T PprLogBTailPtr; /**< PPR log B tail pointer register. */
|
---|
1919 | /** @} */
|
---|
1920 |
|
---|
1921 | /** @name MMIO: Event Log B Head and Tail pointer registers.
|
---|
1922 | * @{ */
|
---|
1923 | EVT_LOG_B_HEAD_PTR_T EvtLogBHeadPtr; /**< Event log B head pointer register. */
|
---|
1924 | EVT_LOG_B_TAIL_PTR_T EvtLogBTailPtr; /**< Event log B tail pointer register. */
|
---|
1925 | /** @} */
|
---|
1926 |
|
---|
1927 | /** @name MMIO: PPR Log Overflow protection registers.
|
---|
1928 | * @{ */
|
---|
1929 | PPR_LOG_AUTO_RESP_T PprLogAutoResp; /**< PPR Log Auto Response register. */
|
---|
1930 | PPR_LOG_OVERFLOW_EARLY_T PprLogOverflowEarly; /**< PPR Log Overflow Early Indicator register. */
|
---|
1931 | PPR_LOG_B_OVERFLOW_EARLY_T PprLogBOverflowEarly; /**< PPR Log B Overflow Early Indicator register. */
|
---|
1932 | /** @} */
|
---|
1933 |
|
---|
1934 | /** @todo IOMMU: IOMMU Event counter registers. */
|
---|
1935 |
|
---|
1936 | /** @todo IOMMU: Stat counters. */
|
---|
1937 | } IOMMU;
|
---|
1938 | /** Pointer to the IOMMU device state. */
|
---|
1939 | typedef struct IOMMU *PIOMMU;
|
---|
1940 | /** Pointer to the const IOMMU device state. */
|
---|
1941 | typedef const struct IOMMU *PCIOMMU;
|
---|
1942 |
|
---|
1943 | /**
|
---|
1944 | * The ring-3 IOMMU device state.
|
---|
1945 | */
|
---|
1946 | typedef struct IOMMUR3
|
---|
1947 | {
|
---|
1948 | /** The IOMMU helpers. */
|
---|
1949 | PCPDMIOMMUHLPR3 pIommuHlp;
|
---|
1950 | } IOMMUR3;
|
---|
1951 | /** Pointer to the ring-3 IOMMU device state. */
|
---|
1952 | typedef IOMMUR3 *PIOMMUR3;
|
---|
1953 |
|
---|
1954 | /**
|
---|
1955 | * The ring-0 IOMMU device state.
|
---|
1956 | */
|
---|
1957 | typedef struct IOMMUR0
|
---|
1958 | {
|
---|
1959 | /** The IOMMU helpers. */
|
---|
1960 | PCPDMIOMMUHLPR0 pIommuHlp;
|
---|
1961 | } IOMMUR0;
|
---|
1962 | /** Pointer to the ring-0 IOMMU device state. */
|
---|
1963 | typedef IOMMUR0 *PIOMMUR0;
|
---|
1964 |
|
---|
1965 | /**
|
---|
1966 | * The raw-mode IOMMU device state.
|
---|
1967 | */
|
---|
1968 | typedef struct IOMMURC
|
---|
1969 | {
|
---|
1970 | /** The IOMMU helpers. */
|
---|
1971 | PCPDMIOMMUHLPRC pIommuHlp;
|
---|
1972 | } IOMMURC;
|
---|
1973 | /** Pointer to the raw-mode IOMMU device state. */
|
---|
1974 | typedef IOMMURC *PIOMMURC;
|
---|
1975 |
|
---|
1976 | /** The IOMMU device state for the current context. */
|
---|
1977 | typedef CTX_SUFF(IOMMU) IOMMUCC;
|
---|
1978 | /** Pointer to the IOMMU device state for the current context. */
|
---|
1979 | typedef CTX_SUFF(PIOMMU) PIOMMUCC;
|
---|
1980 |
|
---|
1981 |
|
---|
1982 | #ifndef VBOX_DEVICE_STRUCT_TESTCASE
|
---|
1983 |
|
---|
1984 | static VBOXSTRICTRC iommuAmdReadRegister(PCIOMMU pThis, uint32_t off, uint64_t *puResult)
|
---|
1985 | {
|
---|
1986 | Assert(off < _16K);
|
---|
1987 | Assert(!(off & 7) || !(off & 3));
|
---|
1988 |
|
---|
1989 | /** @todo locking? */
|
---|
1990 | switch (off)
|
---|
1991 | {
|
---|
1992 | case IOMMU_MMIO_OFF_DEV_TAB_BAR: *puResult = pThis->DevTabBaseAddr.u64; break;
|
---|
1993 | case IOMMU_MMIO_OFF_CMD_BUF_BAR: *puResult = pThis->CmdBufBaseAddr.u64; break;
|
---|
1994 | case IOMMU_MMIO_OFF_EVT_LOG_BAR: *puResult = pThis->EvtLogBaseAddr.u64; break;
|
---|
1995 | case IOMMU_MMIO_OFF_CTRL: *puResult = pThis->Ctrl.u64; break;
|
---|
1996 | case IOMMU_MMIO_OFF_EXCL_BAR: *puResult = pThis->ExclRangeBaseAddr.u64; break;
|
---|
1997 | case IOMMU_MMIO_OFF_EXCL_RANGE_LIMIT: *puResult = pThis->ExclRangeLimit.u64; break;
|
---|
1998 | case IOMMU_MMIO_OFF_EXT_FEAT: *puResult = pThis->ExtFeat.u64; break;
|
---|
1999 |
|
---|
2000 | case IOMMU_MMIO_OFF_PPR_LOG_BAR: *puResult = pThis->PprLogBaseAddr.u64; break;
|
---|
2001 | case IOMMU_MMIO_OFF_HW_EVT_HI: *puResult = pThis->HwEvtHi.u64; break;
|
---|
2002 | case IOMMU_MMIO_OFF_HW_EVT_LO: *puResult = pThis->HwEvtLo; break;
|
---|
2003 | case IOMMU_MMIO_OFF_HW_EVT_STATUS: *puResult = pThis->HwEvtStatus.u64; break;
|
---|
2004 |
|
---|
2005 | case IOMMU_MMIO_OFF_GALOG_BAR: *puResult = pThis->GALogBaseAddr.u64; break;
|
---|
2006 | case IOMMU_MMIO_OFF_GALOG_TAIL_ADDR: *puResult = pThis->GALogTailAddr.u64; break;
|
---|
2007 |
|
---|
2008 | case IOMMU_MMIO_OFF_PPR_LOG_B_BAR: *puResult = pThis->PprLogBBaseAddr.u64; break;
|
---|
2009 | case IOMMU_MMIO_OFF_PPR_EVT_B_BAR: *puResult = pThis->EvtLogBBaseAddr.u64; break;
|
---|
2010 |
|
---|
2011 | case IOMMU_MMIO_OFF_DEV_TAB_SEG_FIRST:
|
---|
2012 | case IOMMU_MMIO_OFF_DEV_TAB_SEG_LAST:
|
---|
2013 | {
|
---|
2014 | uint8_t const idxDevTabSeg = (off - IOMMU_MMIO_OFF_DEV_TAB_SEG_FIRST) >> 3;
|
---|
2015 | Assert(idxDevTabSeg < RT_ELEMENTS(pThis->DevTabSeg));
|
---|
2016 | *puResult = pThis->DevTabSeg[idxDevTabSeg].u64;
|
---|
2017 | break;
|
---|
2018 | }
|
---|
2019 |
|
---|
2020 | case IOMMU_MMIO_OFF_DEV_SPECIFIC_FEAT: *puResult = pThis->DevSpecificFeat.u64; break;
|
---|
2021 | case IOMMU_MMIO_OFF_DEV_SPECIFIC_CTRL: *puResult = pThis->DevSpecificCtrl.u64; break;
|
---|
2022 | case IOMMU_MMIO_OFF_DEV_SPECIFIC_STATUS: *puResult = pThis->DevSpecificStatus.u64; break;
|
---|
2023 |
|
---|
2024 | case IOMMU_MMIO_OFF_MSI_VECTOR_0: *puResult = pThis->MsiMiscInfo.u64; break;
|
---|
2025 | case IOMMU_MMIO_OFF_MSI_VECTOR_1: *puResult = pThis->MsiMiscInfo.au32[1]; break;
|
---|
2026 | case IOMMU_MMIO_OFF_MSI_CAP_HDR: *puResult = RT_MAKE_U64(pThis->MsiCapHdr.u32, pThis->MsiAddr.au32[0]); break;
|
---|
2027 | case IOMMU_MMIO_OFF_MSI_ADDR_LO: *puResult = pThis->MsiAddr.au32[0]; break;
|
---|
2028 | case IOMMU_MMIO_OFF_MSI_ADDR_HI: *puResult = RT_MAKE_U64(pThis->MsiAddr.au32[1], pThis->MsiData.u32); break;
|
---|
2029 | case IOMMU_MMIO_OFF_MSI_DATA: *puResult = pThis->MsiData.u32; break;
|
---|
2030 | case IOMMU_MMIO_OFF_MSI_MAPPING_CAP_HDR: *puResult = RT_MAKE_U64(pThis->MsiMapCapHdr.u32, pThis->PerfOptCtrl.u32); break;
|
---|
2031 |
|
---|
2032 | case IOMMU_MMIO_OFF_PERF_OPT_CTRL: *puResult = pThis->PerfOptCtrl.u32; break;
|
---|
2033 |
|
---|
2034 | case IOMMU_MMIO_OFF_XT_GEN_INTR_CTRL: *puResult = pThis->XtGenIntrCtrl.u64; break;
|
---|
2035 | case IOMMU_MMIO_OFF_XT_PPR_INTR_CTRL: *puResult = pThis->XtPprIntrCtrl.u64; break;
|
---|
2036 | case IOMMU_MMIO_OFF_XT_GALOG_INT_CTRL: *puResult = pThis->XtGALogIntrCtrl.u64; break;
|
---|
2037 |
|
---|
2038 | case IOMMU_MMIO_OFF_MARC_APER_BAR_0: *puResult = pThis->aMarcApers[0].Base.u64; break;
|
---|
2039 | case IOMMU_MMIO_OFF_MARC_APER_RELOC_0: *puResult = pThis->aMarcApers[0].Reloc.u64; break;
|
---|
2040 | case IOMMU_MMIO_OFF_MARC_APER_LEN_0: *puResult = pThis->aMarcApers[0].Length.u64; break;
|
---|
2041 | case IOMMU_MMIO_OFF_MARC_APER_BAR_1: *puResult = pThis->aMarcApers[1].Base.u64; break;
|
---|
2042 | case IOMMU_MMIO_OFF_MARC_APER_RELOC_1: *puResult = pThis->aMarcApers[1].Reloc.u64; break;
|
---|
2043 | case IOMMU_MMIO_OFF_MARC_APER_LEN_1: *puResult = pThis->aMarcApers[1].Length.u64; break;
|
---|
2044 | case IOMMU_MMIO_OFF_MARC_APER_BAR_2: *puResult = pThis->aMarcApers[2].Base.u64; break;
|
---|
2045 | case IOMMU_MMIO_OFF_MARC_APER_RELOC_2: *puResult = pThis->aMarcApers[2].Reloc.u64; break;
|
---|
2046 | case IOMMU_MMIO_OFF_MARC_APER_LEN_2: *puResult = pThis->aMarcApers[2].Length.u64; break;
|
---|
2047 | case IOMMU_MMIO_OFF_MARC_APER_BAR_3: *puResult = pThis->aMarcApers[3].Base.u64; break;
|
---|
2048 | case IOMMU_MMIO_OFF_MARC_APER_RELOC_3: *puResult = pThis->aMarcApers[3].Reloc.u64; break;
|
---|
2049 | case IOMMU_MMIO_OFF_MARC_APER_LEN_3: *puResult = pThis->aMarcApers[3].Length.u64; break;
|
---|
2050 |
|
---|
2051 | case IOMMU_MMIO_OFF_RSVD_REG: *puResult = pThis->RsvdReg; break;
|
---|
2052 |
|
---|
2053 | case IOMMU_MMIO_CMD_BUF_HEAD_PTR: *puResult = pThis->CmdBufHeadPtr.u64; break;
|
---|
2054 | case IOMMU_MMIO_CMD_BUF_TAIL_PTR: *puResult = pThis->CmdBufTailPtr.u64; break;
|
---|
2055 | case IOMMU_MMIO_EVT_LOG_HEAD_PTR: *puResult = pThis->EvtLogHeadPtr.u64; break;
|
---|
2056 | case IOMMU_MMIO_EVT_LOG_TAIL_PTR: *puResult = pThis->EvtLogTailPtr.u64; break;
|
---|
2057 |
|
---|
2058 | case IOMMU_MMIO_OFF_STATUS: *puResult = pThis->Status.u64; break;
|
---|
2059 |
|
---|
2060 | case IOMMU_MMIO_OFF_PPR_LOG_HEAD_PTR: *puResult = pThis->PprLogHeadPtr.u64; break;
|
---|
2061 | case IOMMU_MMIO_OFF_PPR_LOG_TAIL_PTR: *puResult = pThis->PprLogTailPtr.u64; break;
|
---|
2062 |
|
---|
2063 | case IOMMU_MMIO_OFF_GALOG_HEAD_PTR: *puResult = pThis->GALogHeadPtr.u64; break;
|
---|
2064 | case IOMMU_MMIO_OFF_GALOG_TAIL_PTR: *puResult = pThis->GALogTailPtr.u64; break;
|
---|
2065 |
|
---|
2066 | case IOMMU_MMIO_OFF_PPR_LOG_B_HEAD_PTR: *puResult = pThis->PprLogBHeadPtr.u64; break;
|
---|
2067 | case IOMMU_MMIO_OFF_PPR_LOG_B_TAIL_PTR: *puResult = pThis->PprLogBTailPtr.u64; break;
|
---|
2068 |
|
---|
2069 | case IOMMU_MMIO_OFF_EVT_LOG_B_HEAD_PTR: *puResult = pThis->EvtLogBHeadPtr.u64; break;
|
---|
2070 | case IOMMU_MMIO_OFF_EVT_LOG_B_TAIL_PTR: *puResult = pThis->EvtLogBTailPtr.u64; break;
|
---|
2071 |
|
---|
2072 | case IOMMU_MMIO_OFF_PPR_LOG_AUTO_RESP: *puResult = pThis->PprLogAutoResp.u64; break;
|
---|
2073 | case IOMMU_MMIO_OFF_PPR_LOG_OVERFLOW_EARLY: *puResult = pThis->PprLogOverflowEarly.u64; break;
|
---|
2074 | case IOMMU_MMIO_OFF_PPR_LOG_B_OVERFLOW_EARLY: *puResult = pThis->PprLogBOverflowEarly.u64; break;
|
---|
2075 |
|
---|
2076 | /* Not implemented. */
|
---|
2077 | case IOMMU_MMIO_OFF_SMI_FLT_FIRST:
|
---|
2078 | case IOMMU_MMIO_OFF_SMI_FLT_LAST:
|
---|
2079 | {
|
---|
2080 | Log((IOMMU_LOG_PFX ": iommuAmdReadRegister: Reading unsupported register: SMI filter %u\n",
|
---|
2081 | (off - IOMMU_MMIO_OFF_SMI_FLT_FIRST) >> 3));
|
---|
2082 | *puResult = 0;
|
---|
2083 | break;
|
---|
2084 | }
|
---|
2085 |
|
---|
2086 | /* Unknown */
|
---|
2087 | default:
|
---|
2088 | {
|
---|
2089 | Log((IOMMU_LOG_PFX ": iommuAmdReadRegister: Trying to read unknown register at %u (%#x)\n", off, off));
|
---|
2090 | *puResult = 0;
|
---|
2091 | return VINF_IOM_MMIO_UNUSED_00;
|
---|
2092 | }
|
---|
2093 | }
|
---|
2094 | return VINF_SUCCESS;
|
---|
2095 | }
|
---|
2096 |
|
---|
2097 |
|
---|
2098 | /**
|
---|
2099 | * @callback_method_impl{FNIOMMMIONEWWRITE}
|
---|
2100 | */
|
---|
2101 | static DECLCALLBACK(VBOXSTRICTRC) iommuAmdMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb)
|
---|
2102 | {
|
---|
2103 | /** @todo IOMMU: MMIO write. */
|
---|
2104 | RT_NOREF5(pDevIns, pvUser, off, pv, cb);
|
---|
2105 | return VERR_NOT_IMPLEMENTED;
|
---|
2106 | }
|
---|
2107 |
|
---|
2108 |
|
---|
2109 | /**
|
---|
2110 | * @callback_method_impl{FNIOMMMIONEWREAD}
|
---|
2111 | */
|
---|
2112 | static DECLCALLBACK(VBOXSTRICTRC) iommuAmdMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb)
|
---|
2113 | {
|
---|
2114 | NOREF(pvUser);
|
---|
2115 | Assert(cb == 4 || cb == 8);
|
---|
2116 | Assert(cb == 4 || !(off & 7));
|
---|
2117 | Assert(cb == 8 || !(off & 3));
|
---|
2118 |
|
---|
2119 | uint64_t uResult = 0;
|
---|
2120 | PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU);
|
---|
2121 | VBOXSTRICTRC rcStrict = iommuAmdReadRegister(pThis, off, &uResult);
|
---|
2122 | if (cb == 8)
|
---|
2123 | *(uint64_t *)pv = uResult;
|
---|
2124 | else
|
---|
2125 | *(uint32_t *)pv = (uint32_t)uResult;
|
---|
2126 |
|
---|
2127 | return rcStrict;
|
---|
2128 | }
|
---|
2129 |
|
---|
2130 |
|
---|
2131 | # ifdef IN_RING3
|
---|
2132 | static void iommuAmdR3DecodeBufferLength(uint8_t uEncodedLen, uint32_t *pcEntries, uint32_t *pcbBuffer)
|
---|
2133 | {
|
---|
2134 | if (uEncodedLen >= 8)
|
---|
2135 | {
|
---|
2136 | *pcEntries = 2 << (uEncodedLen - 1);
|
---|
2137 | *pcbBuffer = *pcEntries << 4;
|
---|
2138 | }
|
---|
2139 | else
|
---|
2140 | {
|
---|
2141 | *pcEntries = 0;
|
---|
2142 | *pcbBuffer = 0;
|
---|
2143 | }
|
---|
2144 | }
|
---|
2145 |
|
---|
2146 |
|
---|
2147 | /**
|
---|
2148 | * @callback_method_impl{FNDBGFHANDLERDEV}
|
---|
2149 | */
|
---|
2150 | static DECLCALLBACK(void) iommuAmdR3DbgInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
|
---|
2151 | {
|
---|
2152 | PCIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU);
|
---|
2153 | Assert(pThis);
|
---|
2154 |
|
---|
2155 | LogFlow((IOMMU_LOG_PFX ": iommuAmdR3DbgInfo: pThis=%p pszArgs=%s\n", pThis, pszArgs));
|
---|
2156 | #if 0
|
---|
2157 | bool const fVerbose = !strncmp(pszArgs, RT_STR_TUPLE("verbose") ? true : false;
|
---|
2158 | #else
|
---|
2159 | NOREF(pszArgs);
|
---|
2160 | #endif
|
---|
2161 |
|
---|
2162 | pHlp->pfnPrintf(pHlp, "AMD-IOMMU:\n");
|
---|
2163 | /* Device Table Base Address. */
|
---|
2164 | {
|
---|
2165 | DEV_TAB_BAR_T const DevTabBar = pThis->DevTabBaseAddr;
|
---|
2166 | pHlp->pfnPrintf(pHlp, " Device Table BAR = %#RX64\n", DevTabBar.u64);
|
---|
2167 | pHlp->pfnPrintf(pHlp, " Size = %u (%u bytes)\n", DevTabBar.n.u9Size,
|
---|
2168 | (DevTabBar.n.u9Size + 1) * _4K);
|
---|
2169 | pHlp->pfnPrintf(pHlp, " Base address = %#RX64\n", DevTabBar.n.u40DevTabBase);
|
---|
2170 | }
|
---|
2171 | /* Command Buffer Base Address Register. */
|
---|
2172 | {
|
---|
2173 | CMD_BUF_BAR_T const CmdBufBar = pThis->CmdBufBaseAddr;
|
---|
2174 | uint32_t cEntries;
|
---|
2175 | uint32_t cbBuffer;
|
---|
2176 | uint8_t const uEncodedLen = CmdBufBar.n.u4CmdLen;
|
---|
2177 | iommuAmdR3DecodeBufferLength(uEncodedLen, &cEntries, &cbBuffer);
|
---|
2178 | pHlp->pfnPrintf(pHlp, " Command buffer BAR = %#RX64\n", CmdBufBar.u64);
|
---|
2179 | pHlp->pfnPrintf(pHlp, " Base address = %#RX64\n", CmdBufBar.n.u40CmdBase);
|
---|
2180 | pHlp->pfnPrintf(pHlp, " Length = %u (%u entries, %u bytes)\n", uEncodedLen, cEntries,
|
---|
2181 | cbBuffer);
|
---|
2182 | }
|
---|
2183 | /* Event Log Base Address Register. */
|
---|
2184 | {
|
---|
2185 | EVT_LOG_BAR_T const EvtLogBar = pThis->EvtLogBaseAddr;
|
---|
2186 | uint32_t cEntries;
|
---|
2187 | uint32_t cbBuffer;
|
---|
2188 | uint8_t const uEncodedLen = EvtLogBar.n.u4EvtLen;
|
---|
2189 | iommuAmdR3DecodeBufferLength(uEncodedLen, &cEntries, &cbBuffer);
|
---|
2190 | pHlp->pfnPrintf(pHlp, " Event log BAR = %#RX64\n", EvtLogBar.u64);
|
---|
2191 | pHlp->pfnPrintf(pHlp, " Base address = %#RX64\n", EvtLogBar.n.u40EvtBase);
|
---|
2192 | pHlp->pfnPrintf(pHlp, " Length = %u (%u entries, %u bytes)\n", uEncodedLen, cEntries,
|
---|
2193 | cbBuffer);
|
---|
2194 | }
|
---|
2195 | /* IOMMU Control Register. */
|
---|
2196 | {
|
---|
2197 | IOMMU_CTRL_T const Ctrl = pThis->Ctrl;
|
---|
2198 | pHlp->pfnPrintf(pHlp, " Control = %#RX64\n", Ctrl.u64);
|
---|
2199 | pHlp->pfnPrintf(pHlp, " IOMMU enable = %RTbool\n", Ctrl.n.u1IommuEn);
|
---|
2200 | pHlp->pfnPrintf(pHlp, " HT Tunnel translation enable = %RTbool\n", Ctrl.n.u1HtTunEn);
|
---|
2201 | pHlp->pfnPrintf(pHlp, " Event log enable = %RTbool\n", Ctrl.n.u1EvtLogEn);
|
---|
2202 | pHlp->pfnPrintf(pHlp, " Event log interrupt enable = %RTbool\n", Ctrl.n.u1EvtIntrEn);
|
---|
2203 | pHlp->pfnPrintf(pHlp, " Completion wait interrupt enable = %RTbool\n", Ctrl.n.u1EvtIntrEn);
|
---|
2204 | pHlp->pfnPrintf(pHlp, " Invalidation timeout = %u\n", Ctrl.n.u3InvTimeOut);
|
---|
2205 | pHlp->pfnPrintf(pHlp, " Pass posted write = %RTbool\n", Ctrl.n.u1PassPW);
|
---|
2206 | pHlp->pfnPrintf(pHlp, " Respose Pass posted write = %RTbool\n", Ctrl.n.u1ResPassPW);
|
---|
2207 | pHlp->pfnPrintf(pHlp, " Coherent = %RTbool\n", Ctrl.n.u1Coherent);
|
---|
2208 | pHlp->pfnPrintf(pHlp, " Isochronous = %RTbool\n", Ctrl.n.u1Isoc);
|
---|
2209 | pHlp->pfnPrintf(pHlp, " Command buffer enable = %RTbool\n", Ctrl.n.u1CmdBufEn);
|
---|
2210 | pHlp->pfnPrintf(pHlp, " PPR log enable = %RTbool\n", Ctrl.n.u1PprLogEn);
|
---|
2211 | pHlp->pfnPrintf(pHlp, " PPR interrupt enable = %RTbool\n", Ctrl.n.u1PprIntrEn);
|
---|
2212 | pHlp->pfnPrintf(pHlp, " PPR enable = %RTbool\n", Ctrl.n.u1PprEn);
|
---|
2213 | pHlp->pfnPrintf(pHlp, " Guest translation eanble = %RTbool\n", Ctrl.n.u1GstTranslateEn);
|
---|
2214 | pHlp->pfnPrintf(pHlp, " Guest virtual-APIC enable = %RTbool\n", Ctrl.n.u1GstVirtApicEn);
|
---|
2215 | pHlp->pfnPrintf(pHlp, " CRW = %#x\n", Ctrl.n.u4Crw);
|
---|
2216 | pHlp->pfnPrintf(pHlp, " SMI filter enable = %RTbool\n", Ctrl.n.u1SmiFilterEn);
|
---|
2217 | pHlp->pfnPrintf(pHlp, " Self-writeback disable = %RTbool\n", Ctrl.n.u1SelfWriteBackDis);
|
---|
2218 | pHlp->pfnPrintf(pHlp, " SMI filter log enable = %RTbool\n", Ctrl.n.u1SmiFilterLogEn);
|
---|
2219 | pHlp->pfnPrintf(pHlp, " Guest virtual-APIC mode enable = %#x\n", Ctrl.n.u3GstVirtApicModeEn);
|
---|
2220 | pHlp->pfnPrintf(pHlp, " Guest virtual-APIC GA log enable = %RTbool\n", Ctrl.n.u1GstLogEn);
|
---|
2221 | pHlp->pfnPrintf(pHlp, " Guest virtual-APIC interrupt enable = %RTbool\n", Ctrl.n.u1GstIntrEn);
|
---|
2222 | pHlp->pfnPrintf(pHlp, " Dual PPR log enable = %#x\n", Ctrl.n.u2DualPprLogEn);
|
---|
2223 | pHlp->pfnPrintf(pHlp, " Dual event log enable = %#x\n", Ctrl.n.u2DualEvtLogEn);
|
---|
2224 | pHlp->pfnPrintf(pHlp, " Device table segmentation enable = %#x\n", Ctrl.n.u3DevTabSegEn);
|
---|
2225 | pHlp->pfnPrintf(pHlp, " Privilege abort enable = %#x\n", Ctrl.n.u2PrivAbortEn);
|
---|
2226 | pHlp->pfnPrintf(pHlp, " PPR auto response enable = %RTbool\n", Ctrl.n.u1PprAutoRespEn);
|
---|
2227 | pHlp->pfnPrintf(pHlp, " MARC enable = %RTbool\n", Ctrl.n.u1MarcEn);
|
---|
2228 | pHlp->pfnPrintf(pHlp, " Block StopMark enable = %RTbool\n", Ctrl.n.u1BlockStopMarkEn);
|
---|
2229 | pHlp->pfnPrintf(pHlp, " PPR auto response always-on enable = %RTbool\n", Ctrl.n.u1PprAutoRespAlwaysOnEn);
|
---|
2230 | pHlp->pfnPrintf(pHlp, " Domain IDPNE = %RTbool\n", Ctrl.n.u1DomainIDPNE);
|
---|
2231 | pHlp->pfnPrintf(pHlp, " Enhanced PPR handling = %RTbool\n", Ctrl.n.u1EnhancedPpr);
|
---|
2232 | pHlp->pfnPrintf(pHlp, " Host page table access/dirty bit update = %#x\n", Ctrl.n.u2HstAccDirtyBitUpdate);
|
---|
2233 | pHlp->pfnPrintf(pHlp, " Guest page table dirty bit disable = %RTbool\n", Ctrl.n.u1GstDirtyUpdateDis);
|
---|
2234 | pHlp->pfnPrintf(pHlp, " x2APIC enable = %RTbool\n", Ctrl.n.u1X2ApicEn);
|
---|
2235 | pHlp->pfnPrintf(pHlp, " x2APIC interrupt enable = %RTbool\n", Ctrl.n.u1X2ApicIntrGenEn);
|
---|
2236 | pHlp->pfnPrintf(pHlp, " Guest page table access bit update = %RTbool\n", Ctrl.n.u1GstAccessUpdateDis);
|
---|
2237 | }
|
---|
2238 | /* Exclusion Base Address Register. */
|
---|
2239 | {
|
---|
2240 | IOMMU_EXCL_RANGE_BAR_T const ExclRangeBar = pThis->ExclRangeBaseAddr;
|
---|
2241 | pHlp->pfnPrintf(pHlp, " Exclusion BAR = %#RX64\n", ExclRangeBar.u64);
|
---|
2242 | pHlp->pfnPrintf(pHlp, " Exclusion enable = %RTbool\n", ExclRangeBar.n.u1ExclEnable);
|
---|
2243 | pHlp->pfnPrintf(pHlp, " Allow all devices = %RTbool\n", ExclRangeBar.n.u1AllowAll);
|
---|
2244 | pHlp->pfnPrintf(pHlp, " Base address = %#RX64\n", ExclRangeBar.n.u40ExclRangeBase);
|
---|
2245 | }
|
---|
2246 | /* Exclusion Range Limit Register. */
|
---|
2247 | {
|
---|
2248 | IOMMU_EXCL_RANGE_LIMIT_T const ExclRangeLimit = pThis->ExclRangeLimit;
|
---|
2249 | pHlp->pfnPrintf(pHlp, " Exclusion Range Limit = %#RX64\n", ExclRangeLimit.u64);
|
---|
2250 | pHlp->pfnPrintf(pHlp, " Range limit = %#RX64\n", ExclRangeLimit.n.u40ExclLimit);
|
---|
2251 | }
|
---|
2252 | /* Extended Feature Register. */
|
---|
2253 | {
|
---|
2254 | IOMMU_EXT_FEAT_T ExtFeat = pThis->ExtFeat;
|
---|
2255 | pHlp->pfnPrintf(pHlp, " Extended Feature Register = %#RX64\n", ExtFeat.u64);
|
---|
2256 | pHlp->pfnPrintf(pHlp, " Prefetch support = %RTbool\n", ExtFeat.n.u1PrefetchSup);
|
---|
2257 | pHlp->pfnPrintf(pHlp, " PPR support = %RTbool\n", ExtFeat.n.u1PprSup);
|
---|
2258 | pHlp->pfnPrintf(pHlp, " x2APIC support = %RTbool\n", ExtFeat.n.u1X2ApicSup);
|
---|
2259 | pHlp->pfnPrintf(pHlp, " NX and privilege level support = %RTbool\n", ExtFeat.n.u1NoExecuteSup);
|
---|
2260 | pHlp->pfnPrintf(pHlp, " Guest translation support = %RTbool\n", ExtFeat.n.u1GstTranslateSup);
|
---|
2261 | pHlp->pfnPrintf(pHlp, " Invalidate-All command support = %RTbool\n", ExtFeat.n.u1InvAllSup);
|
---|
2262 | pHlp->pfnPrintf(pHlp, " Guest virtual-APIC support = %RTbool\n", ExtFeat.n.u1GstVirtApicSup);
|
---|
2263 | pHlp->pfnPrintf(pHlp, " Hardware error register support = %RTbool\n", ExtFeat.n.u1HwErrorSup);
|
---|
2264 | pHlp->pfnPrintf(pHlp, " Performance counters support = %RTbool\n", ExtFeat.n.u1PerfCounterSup);
|
---|
2265 | pHlp->pfnPrintf(pHlp, " Host address translation size = %#x\n", ExtFeat.n.u2HostAddrTranslateSize);
|
---|
2266 | pHlp->pfnPrintf(pHlp, " Guest address translation size = %#x\n", ExtFeat.n.u2GstAddrTranslateSize);
|
---|
2267 | pHlp->pfnPrintf(pHlp, " Guest CR3 root table level support = %#x\n", ExtFeat.n.u2GstCr3RootTblLevel);
|
---|
2268 | pHlp->pfnPrintf(pHlp, " SMI filter register support = %#x\n", ExtFeat.n.u2SmiFilterSup);
|
---|
2269 | pHlp->pfnPrintf(pHlp, " SMI filter register count = %#x\n", ExtFeat.n.u3SmiFilterCount);
|
---|
2270 | pHlp->pfnPrintf(pHlp, " Guest virtual-APIC modes support = %#x\n", ExtFeat.n.u3GstVirtApicModeSup);
|
---|
2271 | pHlp->pfnPrintf(pHlp, " Dual PPR log support = %#x\n", ExtFeat.n.u2DualPprLogSup);
|
---|
2272 | pHlp->pfnPrintf(pHlp, " Dual event log support = %#x\n", ExtFeat.n.u2DualEvtLogSup);
|
---|
2273 | pHlp->pfnPrintf(pHlp, " Maximum PASID = %#x\n", ExtFeat.n.u5MaxPasidSup);
|
---|
2274 | pHlp->pfnPrintf(pHlp, " User/supervisor page protection support = %RTbool\n", ExtFeat.n.u1UserSupervisorSup);
|
---|
2275 | pHlp->pfnPrintf(pHlp, " Device table segments supported = %u\n", (ExtFeat.n.u2DevTabSegSup << 1));
|
---|
2276 | pHlp->pfnPrintf(pHlp, " PPR log overflow early warning support = %RTbool\n", ExtFeat.n.u1PprLogOverflowWarn);
|
---|
2277 | pHlp->pfnPrintf(pHlp, " PPR auto response support = %RTbool\n", ExtFeat.n.u1PprAutoRespSup);
|
---|
2278 | pHlp->pfnPrintf(pHlp, " MARC support = %#x\n", ExtFeat.n.u2MarcSup);
|
---|
2279 | pHlp->pfnPrintf(pHlp, " Block StopMark message support = %RTbool\n", ExtFeat.n.u1BlockStopMarkSup);
|
---|
2280 | pHlp->pfnPrintf(pHlp, " Performance optimization support = %RTbool\n", ExtFeat.n.u1PerfOptSup);
|
---|
2281 | pHlp->pfnPrintf(pHlp, " MSI capability MMIO access support = %RTbool\n", ExtFeat.n.u1MsiCapMmioSup);
|
---|
2282 | pHlp->pfnPrintf(pHlp, " Guest I/O protection support = %RTbool\n", ExtFeat.n.u1GstIoSup);
|
---|
2283 | pHlp->pfnPrintf(pHlp, " Host access support = %RTbool\n", ExtFeat.n.u1HostAccessSup);
|
---|
2284 | pHlp->pfnPrintf(pHlp, " Enhanced PPR handling support = %RTbool\n", ExtFeat.n.u1EnhancedPprSup);
|
---|
2285 | pHlp->pfnPrintf(pHlp, " Attribute forward supported = %RTbool\n", ExtFeat.n.u1AttrForwardSup);
|
---|
2286 | pHlp->pfnPrintf(pHlp, " Host dirty support = %RTbool\n", ExtFeat.n.u1HostDirtySup);
|
---|
2287 | pHlp->pfnPrintf(pHlp, " Invalidate IOTLB type support = %RTbool\n", ExtFeat.n.u1InvIoTlbTypeSup);
|
---|
2288 | pHlp->pfnPrintf(pHlp, " Guest page table access bit hw disable = %RTbool\n", ExtFeat.n.u1GstUpdateDisSup);
|
---|
2289 | pHlp->pfnPrintf(pHlp, " Force physical dest for remapped intr. = %RTbool\n", ExtFeat.n.u1ForcePhysDstSup);
|
---|
2290 | }
|
---|
2291 | /* PPR Log Base Address Register. */
|
---|
2292 | {
|
---|
2293 | PPR_LOG_BAR_T PprLogBar = pThis->PprLogBaseAddr;
|
---|
2294 | uint32_t cEntries;
|
---|
2295 | uint32_t cbBuffer;
|
---|
2296 | uint8_t const uEncodedLen = PprLogBar.n.u4PprLogLen;
|
---|
2297 | iommuAmdR3DecodeBufferLength(uEncodedLen, &cEntries, &cbBuffer);
|
---|
2298 | pHlp->pfnPrintf(pHlp, " PPR Log BAR = %#RX64\n", PprLogBar.u64);
|
---|
2299 | pHlp->pfnPrintf(pHlp, " Base address = %#RX64\n", PprLogBar.n.u40PprLogBase);
|
---|
2300 | pHlp->pfnPrintf(pHlp, " Length = %u (%u entries, %u bytes)\n", uEncodedLen, cEntries,
|
---|
2301 | cbBuffer);
|
---|
2302 | }
|
---|
2303 | /* Hardware Event (Hi) Register. */
|
---|
2304 | {
|
---|
2305 | IOMMU_HW_EVT_HI_T HwEvtHi = pThis->HwEvtHi;
|
---|
2306 | pHlp->pfnPrintf(pHlp, " Hardware Event (Hi) = %#RX64\n", HwEvtHi.u64);
|
---|
2307 | pHlp->pfnPrintf(pHlp, " First operand = %#RX64\n", HwEvtHi.n.u60FirstOperand);
|
---|
2308 | pHlp->pfnPrintf(pHlp, " Event code = %#RX8\n", HwEvtHi.n.u4EvtCode);
|
---|
2309 | }
|
---|
2310 | /* Hardware Event (Lo) Register. */
|
---|
2311 | pHlp->pfnPrintf(pHlp, " Hardware Event (Lo) = %#RX64\n", pThis->HwEvtLo);
|
---|
2312 | /* Hardware Event Status. */
|
---|
2313 | {
|
---|
2314 | IOMMU_HW_EVT_STATUS_T HwEvtStatus = pThis->HwEvtStatus;
|
---|
2315 | pHlp->pfnPrintf(pHlp, " Hardware Event Status = %#RX64\n", HwEvtStatus.u64);
|
---|
2316 | pHlp->pfnPrintf(pHlp, " Valid = %RTbool\n", HwEvtStatus.n.u1Valid);
|
---|
2317 | pHlp->pfnPrintf(pHlp, " Overflow = %RTbool\n", HwEvtStatus.n.u1Overflow);
|
---|
2318 | }
|
---|
2319 | /* Guest Virtual-APIC Log Base Address Register. */
|
---|
2320 | {
|
---|
2321 | GALOG_BAR_T const GALogBar = pThis->GALogBaseAddr;
|
---|
2322 | uint32_t cEntries;
|
---|
2323 | uint32_t cbBuffer;
|
---|
2324 | uint8_t const uEncodedLen = GALogBar.n.u4GALogLen;
|
---|
2325 | iommuAmdR3DecodeBufferLength(uEncodedLen, &cEntries, &cbBuffer);
|
---|
2326 | pHlp->pfnPrintf(pHlp, " Guest Log BAR = %#RX64\n", GALogBar.u64);
|
---|
2327 | pHlp->pfnPrintf(pHlp, " Base address = %RTbool\n", GALogBar.n.u40GALogBase);
|
---|
2328 | pHlp->pfnPrintf(pHlp, " Length = %u (%u entries, %u bytes)\n", uEncodedLen, cEntries,
|
---|
2329 | cbBuffer);
|
---|
2330 | }
|
---|
2331 | /* Guest Virtual-APIC Log Tail Address Register. */
|
---|
2332 | {
|
---|
2333 | GALOG_TAIL_ADDR_T GALogTail = pThis->GALogTailAddr;
|
---|
2334 | pHlp->pfnPrintf(pHlp, " Guest Log Tail Address = %#RX64\n", GALogTail.u64);
|
---|
2335 | pHlp->pfnPrintf(pHlp, " Tail address = %#RX64\n", GALogTail.n.u40GALogTailAddr);
|
---|
2336 | }
|
---|
2337 | /* PPR Log B Base Address Register. */
|
---|
2338 | {
|
---|
2339 | PPR_LOG_B_BAR_T PprLogBBar = pThis->PprLogBBaseAddr;
|
---|
2340 | uint32_t cEntries;
|
---|
2341 | uint32_t cbBuffer;
|
---|
2342 | uint8_t const uEncodedLen = PprLogBBar.n.u4PprLogLen;
|
---|
2343 | iommuAmdR3DecodeBufferLength(uEncodedLen, &cEntries, &cbBuffer);
|
---|
2344 | pHlp->pfnPrintf(pHlp, " PPR Log B BAR = %#RX64\n", PprLogBBar.u64);
|
---|
2345 | pHlp->pfnPrintf(pHlp, " Base address = %#RX64\n", PprLogBBar.n.u40PprLogBase);
|
---|
2346 | pHlp->pfnPrintf(pHlp, " Length = %u (%u entries, %u bytes)\n", uEncodedLen, cEntries,
|
---|
2347 | cbBuffer);
|
---|
2348 | }
|
---|
2349 | /* Event Log B Base Address Register. */
|
---|
2350 | {
|
---|
2351 | EVT_LOG_B_BAR_T EvtLogBBar = pThis->EvtLogBBaseAddr;
|
---|
2352 | uint32_t cEntries;
|
---|
2353 | uint32_t cbBuffer;
|
---|
2354 | uint8_t const uEncodedLen = EvtLogBBar.n.u4EvtLen;
|
---|
2355 | iommuAmdR3DecodeBufferLength(uEncodedLen, &cEntries, &cbBuffer);
|
---|
2356 | pHlp->pfnPrintf(pHlp, " Event Log B BAR = %#RX64\n", EvtLogBBar.u64);
|
---|
2357 | pHlp->pfnPrintf(pHlp, " Base address = %#RX64\n", EvtLogBBar.n.u40EvtBase);
|
---|
2358 | pHlp->pfnPrintf(pHlp, " Length = %u (%u entries, %u bytes)\n", uEncodedLen, cEntries,
|
---|
2359 | cbBuffer);
|
---|
2360 | }
|
---|
2361 | /* Device Table Segment Registers. */
|
---|
2362 | for (unsigned i = 0; i < RT_ELEMENTS(pThis->DevTabSeg); i++)
|
---|
2363 | {
|
---|
2364 | DEV_TAB_SEG_BAR_T const DevTabSeg = pThis->DevTabSeg[i];
|
---|
2365 | pHlp->pfnPrintf(pHlp, " Device Table Segment BAR [%u] = %#RX64\n", DevTabSeg.u64);
|
---|
2366 | pHlp->pfnPrintf(pHlp, " Base address = %#RX64\n", DevTabSeg.n.u40DevTabBase);
|
---|
2367 | pHlp->pfnPrintf(pHlp, " Size = %#x (%u bytes)\n", DevTabSeg.n.u8Size,
|
---|
2368 | (DevTabSeg.n.u8Size + 1) << X86_PAGE_4K_SHIFT);
|
---|
2369 | }
|
---|
2370 | /* Device-Specific Feature Extension Register. */
|
---|
2371 | {
|
---|
2372 | DEV_SPECIFIC_FEAT_T const DevSpecificFeat = pThis->DevSpecificFeat;
|
---|
2373 | pHlp->pfnPrintf(pHlp, " Device-specific Feature = %#RX64\n", DevSpecificFeat.u64);
|
---|
2374 | pHlp->pfnPrintf(pHlp, " Feature = %#RX32\n", DevSpecificFeat.n.u24DevSpecFeat);
|
---|
2375 | pHlp->pfnPrintf(pHlp, " Minor revision ID = %#x\n", DevSpecificFeat.n.u4RevMinor);
|
---|
2376 | pHlp->pfnPrintf(pHlp, " Major revision ID = %#x\n", DevSpecificFeat.n.u4RevMajor);
|
---|
2377 | }
|
---|
2378 | /* Device-Specific Control Extension Register. */
|
---|
2379 | {
|
---|
2380 | DEV_SPECIFIC_CTRL_T const DevSpecificCtrl = pThis->DevSpecificCtrl;
|
---|
2381 | pHlp->pfnPrintf(pHlp, " Device-specific Control = %#RX64\n", DevSpecificCtrl.u64);
|
---|
2382 | pHlp->pfnPrintf(pHlp, " Control = %#RX32\n", DevSpecificCtrl.n.u24DevSpecCtrl);
|
---|
2383 | pHlp->pfnPrintf(pHlp, " Minor revision ID = %#x\n", DevSpecificCtrl.n.u4RevMinor);
|
---|
2384 | pHlp->pfnPrintf(pHlp, " Major revision ID = %#x\n", DevSpecificCtrl.n.u4RevMajor);
|
---|
2385 | }
|
---|
2386 | /* Device-Specific Status Extension Register. */
|
---|
2387 | {
|
---|
2388 | DEV_SPECIFIC_STATUS_T const DevSpecificStatus = pThis->DevSpecificStatus;
|
---|
2389 | pHlp->pfnPrintf(pHlp, " Device-specific Control = %#RX64\n", DevSpecificStatus.u64);
|
---|
2390 | pHlp->pfnPrintf(pHlp, " Status = %#RX32\n", DevSpecificStatus.n.u24DevSpecStatus);
|
---|
2391 | pHlp->pfnPrintf(pHlp, " Minor revision ID = %#x\n", DevSpecificStatus.n.u4RevMinor);
|
---|
2392 | pHlp->pfnPrintf(pHlp, " Major revision ID = %#x\n", DevSpecificStatus.n.u4RevMajor);
|
---|
2393 | }
|
---|
2394 | /* MSI Miscellaneous Information Register (Lo and Hi). */
|
---|
2395 | {
|
---|
2396 | MSI_MISC_INFO_T const MsiMiscInfo = pThis->MsiMiscInfo;
|
---|
2397 | pHlp->pfnPrintf(pHlp, " MSI Misc. Info. Register = %#RX64\n", MsiMiscInfo.u64);
|
---|
2398 | pHlp->pfnPrintf(pHlp, " Event Log MSI number = %#x\n", MsiMiscInfo.n.u5MsiNumEvtLog);
|
---|
2399 | pHlp->pfnPrintf(pHlp, " Guest Virtual-Address Size = %#x\n", MsiMiscInfo.n.u3GstVirtAddrSize);
|
---|
2400 | pHlp->pfnPrintf(pHlp, " Physical Address Size = %#x\n", MsiMiscInfo.n.u7PhysAddrSize);
|
---|
2401 | pHlp->pfnPrintf(pHlp, " Virtual-Address Size = %#x\n", MsiMiscInfo.n.u7VirtAddrSize);
|
---|
2402 | pHlp->pfnPrintf(pHlp, " HT Transport ATS Range Reserved = %RTbool\n", MsiMiscInfo.n.u1HtAtsResv);
|
---|
2403 | pHlp->pfnPrintf(pHlp, " PPR MSI number = %#x\n", MsiMiscInfo.n.u5MsiNumPpr);
|
---|
2404 | pHlp->pfnPrintf(pHlp, " GA Log MSI number = %#x\n", MsiMiscInfo.n.u5MsiNumGa);
|
---|
2405 | }
|
---|
2406 | /* MSI Capability Header. */
|
---|
2407 | {
|
---|
2408 | MSI_CAP_HDR_T const MsiCapHdr = pThis->MsiCapHdr;
|
---|
2409 | pHlp->pfnPrintf(pHlp, " MSI Capability Header = %#RX32\n", MsiCapHdr.u32);
|
---|
2410 | pHlp->pfnPrintf(pHlp, " Capability ID = %#x\n", MsiCapHdr.n.u8MsiCapId);
|
---|
2411 | pHlp->pfnPrintf(pHlp, " Capability Ptr (PCI config offset) = %#x\n", MsiCapHdr.n.u8MsiCapPtr);
|
---|
2412 | pHlp->pfnPrintf(pHlp, " Enable = %RTbool\n", MsiCapHdr.n.u1MsiEnable);
|
---|
2413 | pHlp->pfnPrintf(pHlp, " Multi-message capability = %#x\n", MsiCapHdr.n.u3MsiMultiMessCap);
|
---|
2414 | pHlp->pfnPrintf(pHlp, " Multi-message enable = %#x\n", MsiCapHdr.n.u3MsiMultiMessEn);
|
---|
2415 | }
|
---|
2416 | /* MSI Address Register (Lo and Hi). */
|
---|
2417 | {
|
---|
2418 | MSI_ADDR_T const MsiAddr = pThis->MsiAddr;
|
---|
2419 | pHlp->pfnPrintf(pHlp, " MSI Address = %#RX64\n", MsiAddr.u64);
|
---|
2420 | pHlp->pfnPrintf(pHlp, " Address = %#RX64\n", MsiAddr.n.u62MsiAddr);
|
---|
2421 | }
|
---|
2422 | /* MSI Data. */
|
---|
2423 | {
|
---|
2424 | MSI_DATA_T const MsiData = pThis->MsiData;
|
---|
2425 | pHlp->pfnPrintf(pHlp, " MSI Data = %#RX32\n", MsiData.u32);
|
---|
2426 | pHlp->pfnPrintf(pHlp, " Data = %#x\n", MsiData.n.u16MsiData);
|
---|
2427 | }
|
---|
2428 | /* MSI Mapping Capability Header. */
|
---|
2429 | {
|
---|
2430 | MSI_MAP_CAP_HDR_T const MsiMapCapHdr = pThis->MsiMapCapHdr;
|
---|
2431 | pHlp->pfnPrintf(pHlp, " MSI Mapping Capability Header = %#RX32\n", MsiMapCapHdr.u32);
|
---|
2432 | pHlp->pfnPrintf(pHlp, " Capability ID = %#x\n", MsiMapCapHdr.n.u8MsiMapCapId);
|
---|
2433 | pHlp->pfnPrintf(pHlp, " Map enable = %RTbool\n", MsiMapCapHdr.n.u1MsiMapEn);
|
---|
2434 | pHlp->pfnPrintf(pHlp, " Map fixed = %RTbool\n", MsiMapCapHdr.n.u1MsiMapFixed);
|
---|
2435 | pHlp->pfnPrintf(pHlp, " Map capability type = %#x\n", MsiMapCapHdr.n.u5MapCapType);
|
---|
2436 | }
|
---|
2437 | /* Performance Optimization Control Register. */
|
---|
2438 | {
|
---|
2439 | IOMMU_PERF_OPT_CTRL_T const PerfOptCtrl = pThis->PerfOptCtrl;
|
---|
2440 | pHlp->pfnPrintf(pHlp, " Performance Optimization Control = %#RX32\n", PerfOptCtrl.u32);
|
---|
2441 | pHlp->pfnPrintf(pHlp, " Enable = %RTbool\n", PerfOptCtrl.n.u1PerfOptEn);
|
---|
2442 | }
|
---|
2443 | /* XT (x2APIC) General Interrupt Control Register. */
|
---|
2444 | {
|
---|
2445 | IOMMU_XT_GEN_INTR_CTRL_T const XtGenIntrCtrl = pThis->XtGenIntrCtrl;
|
---|
2446 | pHlp->pfnPrintf(pHlp, " XT General Interrupt Control = %#RX64\n", XtGenIntrCtrl.u64);
|
---|
2447 | pHlp->pfnPrintf(pHlp, " Interrupt destination mode = %s\n",
|
---|
2448 | !XtGenIntrCtrl.n.u1X2ApicIntrDstMode ? "physical" : "logical");
|
---|
2449 | pHlp->pfnPrintf(pHlp, " Interrupt destination = %#RX64\n",
|
---|
2450 | RT_MAKE_U64(XtGenIntrCtrl.n.u24X2ApicIntrDstLo, XtGenIntrCtrl.n.u7X2ApicIntrDstHi));
|
---|
2451 | pHlp->pfnPrintf(pHlp, " Interrupt vector = %#x\n", XtGenIntrCtrl.n.u8X2ApicIntrVector);
|
---|
2452 | pHlp->pfnPrintf(pHlp, " Interrupt delivery mode = %#x\n",
|
---|
2453 | !XtGenIntrCtrl.n.u8X2ApicIntrVector ? "fixed" : "arbitrated");
|
---|
2454 | }
|
---|
2455 | /* XT (x2APIC) PPR Interrupt Control Register. */
|
---|
2456 | {
|
---|
2457 | IOMMU_XT_PPR_INTR_CTRL_T const XtPprIntrCtrl = pThis->XtPprIntrCtrl;
|
---|
2458 | pHlp->pfnPrintf(pHlp, " XT PPR Interrupt Control = %#RX64\n", XtPprIntrCtrl.u64);
|
---|
2459 | pHlp->pfnPrintf(pHlp, " Interrupt destination mode = %s\n",
|
---|
2460 | !XtPprIntrCtrl.n.u1X2ApicIntrDstMode ? "physical" : "logical");
|
---|
2461 | pHlp->pfnPrintf(pHlp, " Interrupt destination = %#RX64\n",
|
---|
2462 | RT_MAKE_U64(XtPprIntrCtrl.n.u24X2ApicIntrDstLo, XtPprIntrCtrl.n.u7X2ApicIntrDstHi));
|
---|
2463 | pHlp->pfnPrintf(pHlp, " Interrupt vector = %#x\n", XtPprIntrCtrl.n.u8X2ApicIntrVector);
|
---|
2464 | pHlp->pfnPrintf(pHlp, " Interrupt delivery mode = %#x\n",
|
---|
2465 | !XtPprIntrCtrl.n.u8X2ApicIntrVector ? "fixed" : "arbitrated");
|
---|
2466 | }
|
---|
2467 | /* XT (X2APIC) GA Log Interrupt Control Register. */
|
---|
2468 | {
|
---|
2469 | IOMMU_XT_GALOG_INTR_CTRL_T const XtGALogIntrCtrl = pThis->XtGALogIntrCtrl;
|
---|
2470 | pHlp->pfnPrintf(pHlp, " XT PPR Interrupt Control = %#RX64\n", XtGALogIntrCtrl.u64);
|
---|
2471 | pHlp->pfnPrintf(pHlp, " Interrupt destination mode = %s\n",
|
---|
2472 | !XtGALogIntrCtrl.n.u1X2ApicIntrDstMode ? "physical" : "logical");
|
---|
2473 | pHlp->pfnPrintf(pHlp, " Interrupt destination = %#RX64\n",
|
---|
2474 | RT_MAKE_U64(XtGALogIntrCtrl.n.u24X2ApicIntrDstLo, XtGALogIntrCtrl.n.u7X2ApicIntrDstHi));
|
---|
2475 | pHlp->pfnPrintf(pHlp, " Interrupt vector = %#x\n", XtGALogIntrCtrl.n.u8X2ApicIntrVector);
|
---|
2476 | pHlp->pfnPrintf(pHlp, " Interrupt delivery mode = %#x\n",
|
---|
2477 | !XtGALogIntrCtrl.n.u8X2ApicIntrVector ? "fixed" : "arbitrated");
|
---|
2478 | }
|
---|
2479 | /* MARC Registers. */
|
---|
2480 | {
|
---|
2481 | for (unsigned i = 0; i < RT_ELEMENTS(pThis->aMarcApers); i++)
|
---|
2482 | {
|
---|
2483 | pHlp->pfnPrintf(pHlp, " MARC Aperature %u:\n", i);
|
---|
2484 | MARC_APER_BAR_T const MarcAperBar = pThis->aMarcApers[i].Base;
|
---|
2485 | pHlp->pfnPrintf(pHlp, " Base = %#RX64 (addr: %#RX64)\n", MarcAperBar.u64, MarcAperBar.n.u40MarcBaseAddr);
|
---|
2486 |
|
---|
2487 | MARC_APER_RELOC_T const MarcAperReloc = pThis->aMarcApers[i].Reloc;
|
---|
2488 | pHlp->pfnPrintf(pHlp, " Reloc = %#RX64 (addr: %#RX64, read-only: %RTbool, enable: %RTbool)\n",
|
---|
2489 | MarcAperReloc.u64, MarcAperReloc.n.u40MarcRelocAddr, MarcAperReloc.n.u1ReadOnly,
|
---|
2490 | MarcAperReloc.n.u1RelocEn);
|
---|
2491 |
|
---|
2492 | MARC_APER_LEN_T const MarcAperLen = pThis->aMarcApers[i].Length;
|
---|
2493 | pHlp->pfnPrintf(pHlp, " Length = %u pages\n", MarcAperLen.n.u40MarcLength);
|
---|
2494 | }
|
---|
2495 | }
|
---|
2496 | /* Reserved Register. */
|
---|
2497 | pHlp->pfnPrintf(pHlp, " Reserved Register = %#RX64\n", pThis->RsvdReg);
|
---|
2498 | /* Command Buffer Head Pointer Register. */
|
---|
2499 | {
|
---|
2500 | CMD_BUF_HEAD_PTR_T const CmdBufHeadPtr = pThis->CmdBufHeadPtr;
|
---|
2501 | pHlp->pfnPrintf(pHlp, " Command Buffer Head Pointer = %#RX64\n", CmdBufHeadPtr.u64);
|
---|
2502 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", CmdBufHeadPtr.n.u15Ptr);
|
---|
2503 | }
|
---|
2504 | /* Command Buffer Tail Pointer Register. */
|
---|
2505 | {
|
---|
2506 | CMD_BUF_HEAD_PTR_T const CmdBufTailPtr = pThis->CmdBufTailPtr;
|
---|
2507 | pHlp->pfnPrintf(pHlp, " Command Buffer Tail Pointer = %#RX64\n", CmdBufTailPtr.u64);
|
---|
2508 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", CmdBufTailPtr.n.u15Ptr);
|
---|
2509 | }
|
---|
2510 | /* Event Log Head Pointer Register. */
|
---|
2511 | {
|
---|
2512 | EVT_LOG_HEAD_PTR_T const EvtLogHeadPtr = pThis->EvtLogHeadPtr;
|
---|
2513 | pHlp->pfnPrintf(pHlp, " Event Log Head Pointer = %#RX64\n", EvtLogHeadPtr.u64);
|
---|
2514 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", EvtLogHeadPtr.n.u15Ptr);
|
---|
2515 | }
|
---|
2516 | /* Event Log Tail Pointer Register. */
|
---|
2517 | {
|
---|
2518 | EVT_LOG_TAIL_PTR_T const EvtLogTailPtr = pThis->EvtLogTailPtr;
|
---|
2519 | pHlp->pfnPrintf(pHlp, " Event Log Head Pointer = %#RX64\n", EvtLogTailPtr.u64);
|
---|
2520 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", EvtLogTailPtr.n.u15Ptr);
|
---|
2521 | }
|
---|
2522 | /* Status Register. */
|
---|
2523 | {
|
---|
2524 | IOMMU_STATUS_T const Status = pThis->Status;
|
---|
2525 | pHlp->pfnPrintf(pHlp, " Status Register = %#RX64\n", Status.u64);
|
---|
2526 | pHlp->pfnPrintf(pHlp, " Event log overflow = %RTbool\n", Status.n.u1EvtOverflow);
|
---|
2527 | pHlp->pfnPrintf(pHlp, " Event log interrupt = %RTbool\n", Status.n.u1EvtLogIntr);
|
---|
2528 | pHlp->pfnPrintf(pHlp, " Completion wait interrupt = %RTbool\n", Status.n.u1CompWaitIntr);
|
---|
2529 | pHlp->pfnPrintf(pHlp, " Event log running = %RTbool\n", Status.n.u1EvtLogRunning);
|
---|
2530 | pHlp->pfnPrintf(pHlp, " Command buffer running = %RTbool\n", Status.n.u1CmdBufRunning);
|
---|
2531 | pHlp->pfnPrintf(pHlp, " PPR overflow = %RTbool\n", Status.n.u1PprOverflow);
|
---|
2532 | pHlp->pfnPrintf(pHlp, " PPR interrupt = %RTbool\n", Status.n.u1PprIntr);
|
---|
2533 | pHlp->pfnPrintf(pHlp, " PPR log running = %RTbool\n", Status.n.u1PprLogRunning);
|
---|
2534 | pHlp->pfnPrintf(pHlp, " Guest log running = %RTbool\n", Status.n.u1GstLogRunning);
|
---|
2535 | pHlp->pfnPrintf(pHlp, " Guest log interrupt = %RTbool\n", Status.n.u1GstLogIntr);
|
---|
2536 | pHlp->pfnPrintf(pHlp, " PPR log B overflow = %RTbool\n", Status.n.u1PprOverflowB);
|
---|
2537 | pHlp->pfnPrintf(pHlp, " PPR log active = %RTbool\n", Status.n.u1PprLogActive);
|
---|
2538 | pHlp->pfnPrintf(pHlp, " Event log B overflow = %RTbool\n", Status.n.u1EvtOverflowB);
|
---|
2539 | pHlp->pfnPrintf(pHlp, " Event log active = %RTbool\n", Status.n.u1EvtLogActive);
|
---|
2540 | pHlp->pfnPrintf(pHlp, " PPR log B overflow early warning = %RTbool\n", Status.n.u1PprOverflowEarlyB);
|
---|
2541 | pHlp->pfnPrintf(pHlp, " PPR log overflow early warning = %RTbool\n", Status.n.u1PprOverflowEarly);
|
---|
2542 | }
|
---|
2543 | /* PPR Log Head Pointer. */
|
---|
2544 | {
|
---|
2545 | PPR_LOG_HEAD_PTR_T const PprLogHeadPtr = pThis->PprLogHeadPtr;
|
---|
2546 | pHlp->pfnPrintf(pHlp, " PPR Log Head Pointer = %#RX64\n", PprLogHeadPtr.u64);
|
---|
2547 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", PprLogHeadPtr.n.u15Ptr);
|
---|
2548 | }
|
---|
2549 | /* PPR Log Tail Pointer. */
|
---|
2550 | {
|
---|
2551 | PPR_LOG_TAIL_PTR_T const PprLogTailPtr = pThis->PprLogTailPtr;
|
---|
2552 | pHlp->pfnPrintf(pHlp, " PPR Log Tail Pointer = %#RX64\n", PprLogTailPtr.u64);
|
---|
2553 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", PprLogTailPtr.n.u15Ptr);
|
---|
2554 | }
|
---|
2555 | /* Guest Virtual-APIC Log Head Pointer. */
|
---|
2556 | {
|
---|
2557 | GALOG_HEAD_PTR_T const GALogHeadPtr = pThis->GALogHeadPtr;
|
---|
2558 | pHlp->pfnPrintf(pHlp, " Guest Virtual-APIC Log Head Pointer = %#RX64\n", GALogHeadPtr.u64);
|
---|
2559 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", GALogHeadPtr.n.u12GALogPtr);
|
---|
2560 | }
|
---|
2561 | /* Guest Virtual-APIC Log Tail Pointer. */
|
---|
2562 | {
|
---|
2563 | GALOG_HEAD_PTR_T const GALogTailPtr = pThis->GALogTailPtr;
|
---|
2564 | pHlp->pfnPrintf(pHlp, " Guest Virtual-APIC Log Tail Pointer = %#RX64\n", GALogTailPtr.u64);
|
---|
2565 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", GALogTailPtr.n.u12GALogPtr);
|
---|
2566 | }
|
---|
2567 | /* PPR Log B Head Pointer. */
|
---|
2568 | {
|
---|
2569 | PPR_LOG_B_HEAD_PTR_T const PprLogBHeadPtr = pThis->PprLogBHeadPtr;
|
---|
2570 | pHlp->pfnPrintf(pHlp, " PPR Log B Head Pointer = %#RX64\n", PprLogBHeadPtr.u64);
|
---|
2571 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", PprLogBHeadPtr.n.u15Ptr);
|
---|
2572 | }
|
---|
2573 | /* PPR Log B Tail Pointer. */
|
---|
2574 | {
|
---|
2575 | PPR_LOG_B_TAIL_PTR_T const PprLogBTailPtr = pThis->PprLogBTailPtr;
|
---|
2576 | pHlp->pfnPrintf(pHlp, " PPR Log B Tail Pointer = %#RX64\n", PprLogBTailPtr.u64);
|
---|
2577 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", PprLogBTailPtr.n.u15Ptr);
|
---|
2578 | }
|
---|
2579 | /* Event Log B Head Pointer. */
|
---|
2580 | {
|
---|
2581 | EVT_LOG_B_HEAD_PTR_T const EvtLogBHeadPtr = pThis->EvtLogBHeadPtr;
|
---|
2582 | pHlp->pfnPrintf(pHlp, " Event Log B Head Pointer = %#RX64\n", EvtLogBHeadPtr.u64);
|
---|
2583 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", EvtLogBHeadPtr.n.u15Ptr);
|
---|
2584 | }
|
---|
2585 | /* Event Log B Tail Pointer. */
|
---|
2586 | {
|
---|
2587 | EVT_LOG_B_TAIL_PTR_T const EvtLogBTailPtr = pThis->EvtLogBTailPtr;
|
---|
2588 | pHlp->pfnPrintf(pHlp, " Event Log B Tail Pointer = %#RX64\n", EvtLogBTailPtr.u64);
|
---|
2589 | pHlp->pfnPrintf(pHlp, " Pointer = %#x\n", EvtLogBTailPtr.n.u15Ptr);
|
---|
2590 | }
|
---|
2591 | /* PPR Log Auto Response Register. */
|
---|
2592 | {
|
---|
2593 | PPR_LOG_AUTO_RESP_T const PprLogAutoResp = pThis->PprLogAutoResp;
|
---|
2594 | pHlp->pfnPrintf(pHlp, " PPR Log Auto Response Register = %#RX64\n", PprLogAutoResp.u64);
|
---|
2595 | pHlp->pfnPrintf(pHlp, " Code = %#x\n", PprLogAutoResp.n.u4AutoRespCode);
|
---|
2596 | pHlp->pfnPrintf(pHlp, " Mask Gen. = %RTbool\n", PprLogAutoResp.n.u1AutoRespMaskGen);
|
---|
2597 | }
|
---|
2598 | /* PPR Log Overflow Early Warning Indicator Register. */
|
---|
2599 | {
|
---|
2600 | PPR_LOG_OVERFLOW_EARLY_T const PprLogOverflowEarly = pThis->PprLogOverflowEarly;
|
---|
2601 | pHlp->pfnPrintf(pHlp, " PPR Log overflow early warning = %#RX64\n", PprLogOverflowEarly.u64);
|
---|
2602 | pHlp->pfnPrintf(pHlp, " Threshold = %#x\n", PprLogOverflowEarly.n.u15Threshold);
|
---|
2603 | pHlp->pfnPrintf(pHlp, " Interrupt enable = %RTbool\n", PprLogOverflowEarly.n.u1IntrEn);
|
---|
2604 | pHlp->pfnPrintf(pHlp, " Enable = %RTbool\n", PprLogOverflowEarly.n.u1Enable);
|
---|
2605 | }
|
---|
2606 | /* PPR Log Overflow Early Warning Indicator Register. */
|
---|
2607 | {
|
---|
2608 | PPR_LOG_OVERFLOW_EARLY_T const PprLogBOverflowEarly = pThis->PprLogBOverflowEarly;
|
---|
2609 | pHlp->pfnPrintf(pHlp, " PPR Log B overflow early warning = %#RX64\n", PprLogBOverflowEarly.u64);
|
---|
2610 | pHlp->pfnPrintf(pHlp, " Threshold = %#x\n", PprLogBOverflowEarly.n.u15Threshold);
|
---|
2611 | pHlp->pfnPrintf(pHlp, " Interrupt enable = %RTbool\n", PprLogBOverflowEarly.n.u1IntrEn);
|
---|
2612 | pHlp->pfnPrintf(pHlp, " Enable = %RTbool\n", PprLogBOverflowEarly.n.u1Enable);
|
---|
2613 | }
|
---|
2614 | }
|
---|
2615 |
|
---|
2616 |
|
---|
2617 | /**
|
---|
2618 | * @callback_method_impl{FNSSMDEVSAVEEXEC}
|
---|
2619 | */
|
---|
2620 | static DECLCALLBACK(int) iommuAmdR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
|
---|
2621 | {
|
---|
2622 | /** @todo IOMMU: Save state. */
|
---|
2623 | RT_NOREF2(pDevIns, pSSM);
|
---|
2624 | return VERR_NOT_IMPLEMENTED;
|
---|
2625 | }
|
---|
2626 |
|
---|
2627 | /**
|
---|
2628 | * @callback_method_impl{FNSSMDEVLOADEXEC}
|
---|
2629 | */
|
---|
2630 | static DECLCALLBACK(int) iommuAmdR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
|
---|
2631 | {
|
---|
2632 | /** @todo IOMMU: Load state. */
|
---|
2633 | RT_NOREF4(pDevIns, pSSM, uVersion, uPass);
|
---|
2634 | return VERR_NOT_IMPLEMENTED;
|
---|
2635 | }
|
---|
2636 |
|
---|
2637 |
|
---|
2638 | /**
|
---|
2639 | * @interface_method_impl{PDMDEVREG,pfnReset}
|
---|
2640 | */
|
---|
2641 | static DECLCALLBACK(void) iommuAmdR3Reset(PPDMDEVINS pDevIns)
|
---|
2642 | {
|
---|
2643 | NOREF(pDevIns);
|
---|
2644 | }
|
---|
2645 |
|
---|
2646 |
|
---|
2647 | /**
|
---|
2648 | * @interface_method_impl{PDMDEVREG,pfnDestruct}
|
---|
2649 | */
|
---|
2650 | static DECLCALLBACK(int) iommuAmdR3Destruct(PPDMDEVINS pDevIns)
|
---|
2651 | {
|
---|
2652 | NOREF(pDevIns);
|
---|
2653 | return VINF_SUCCESS;
|
---|
2654 | }
|
---|
2655 |
|
---|
2656 |
|
---|
2657 | /**
|
---|
2658 | * @interface_method_impl{PDMDEVREG,pfnConstruct}
|
---|
2659 | */
|
---|
2660 | static DECLCALLBACK(int) iommuAmdR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
|
---|
2661 | {
|
---|
2662 | NOREF(iInstance);
|
---|
2663 |
|
---|
2664 | PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
|
---|
2665 | PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU);
|
---|
2666 | PIOMMUCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PIOMMUCC);
|
---|
2667 | PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3;
|
---|
2668 | int rc;
|
---|
2669 | LogFlowFunc(("\n"));
|
---|
2670 |
|
---|
2671 | NOREF(pThisCC); /** @todo IOMMU: populate CC data. */
|
---|
2672 |
|
---|
2673 | /*
|
---|
2674 | * Validate and read the configuration.
|
---|
2675 | */
|
---|
2676 | PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "Device|Function|MmioBase", "");
|
---|
2677 |
|
---|
2678 | uint64_t u64MmioBase;
|
---|
2679 | rc = pHlp->pfnCFGMQueryU64Def(pCfg, "MmioBase", &u64MmioBase, 0);
|
---|
2680 | if (RT_FAILURE(rc))
|
---|
2681 | return PDMDEV_SET_ERROR(pDevIns, rc, N_("IOMMU: Failed to query \"MmioBase\""));
|
---|
2682 | /* Must be 16KB aligned when we don't support IOMMU performance counters. */
|
---|
2683 | if (u64MmioBase & 0x3fff)
|
---|
2684 | return PDMDEV_SET_ERROR(pDevIns, rc, N_("IOMMU: \"MmioBase\" must be 16 KB aligned"));
|
---|
2685 | /** @todo IOMMU: Ensure u64MmioBase isn't 0. */
|
---|
2686 |
|
---|
2687 | uint8_t uPciDevice;
|
---|
2688 | rc = pHlp->pfnCFGMQueryU8Def(pCfg, "Device", &uPciDevice, 0);
|
---|
2689 | if (RT_FAILURE(rc))
|
---|
2690 | return PDMDEV_SET_ERROR(pDevIns, rc, N_("IOMMU: Failed to query \"Device\""));
|
---|
2691 |
|
---|
2692 | uint8_t uPciFunction;
|
---|
2693 | rc = pHlp->pfnCFGMQueryU8Def(pCfg, "Function", &uPciFunction, 2);
|
---|
2694 | if (RT_FAILURE(rc))
|
---|
2695 | return PDMDEV_SET_ERROR(pDevIns, rc, N_("IOMMU: Failed to query \"Function\""));
|
---|
2696 |
|
---|
2697 | /*
|
---|
2698 | * Initialize the PCI configuration space.
|
---|
2699 | */
|
---|
2700 | PPDMPCIDEV pPciDev = pDevIns->apPciDevs[0];
|
---|
2701 | PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev);
|
---|
2702 |
|
---|
2703 | uint8_t const offCapHdr = 0x40;
|
---|
2704 | uint8_t const offBaseAddrLo = offCapHdr + 0x4;
|
---|
2705 | uint8_t const offBaseAddrHi = offCapHdr + 0x8;
|
---|
2706 | uint8_t const offRange = offCapHdr + 0xc;
|
---|
2707 | uint8_t const offMiscInfo0 = offCapHdr + 0x10;
|
---|
2708 | uint8_t const offMiscInfo1 = offCapHdr + 0x14;
|
---|
2709 | uint8_t const offMsiCapHdr = offCapHdr + 0x24;
|
---|
2710 | uint8_t const offMsiAddrLo = offCapHdr + 0x28;
|
---|
2711 | uint8_t const offMsiAddrHi = offCapHdr + 0x2c;
|
---|
2712 | uint8_t const offMsiData = offCapHdr + 0x30;
|
---|
2713 | uint8_t const offMsiMapCapHdr = offCapHdr + 0x34;
|
---|
2714 |
|
---|
2715 | /* Header. */
|
---|
2716 | PDMPciDevSetVendorId(pPciDev, IOMMU_PCI_VENDOR_ID); /* RO - AMD */
|
---|
2717 | PDMPciDevSetDeviceId(pPciDev, IOMMU_PCI_DEVICE_ID); /* RO - VirtualBox IOMMU device */
|
---|
2718 | PDMPciDevSetCommand(pPciDev, 0); /* RW - Command */
|
---|
2719 | PDMPciDevSetStatus(pPciDev, 0x5); /* RW - Status - CapList supported */
|
---|
2720 | PDMPciDevSetRevisionId(pPciDev, IOMMU_PCI_REVISION_ID); /* RO - VirtualBox specific device implementation revision */
|
---|
2721 | PDMPciDevSetClassBase(pPciDev, 0x08); /* RO - System Base Peripheral */
|
---|
2722 | PDMPciDevSetClassSub(pPciDev, 0x06); /* RO - IOMMU */
|
---|
2723 | PDMPciDevSetClassProg(pPciDev, 0x00); /* RO - IOMMU Programming interface */
|
---|
2724 | PDMPciDevSetHeaderType(pPciDev, 0x00); /* RO - Single function, type 0. */
|
---|
2725 | PDMPciDevSetSubSystemId(pPciDev, IOMMU_PCI_DEVICE_ID); /* RO - AMD */
|
---|
2726 | PDMPciDevSetSubSystemVendorId(pPciDev, IOMMU_PCI_VENDOR_ID); /* RO - VirtualBox IOMMU device */
|
---|
2727 | PDMPciDevSetCapabilityList(pPciDev, offCapHdr); /* RO - Offset into capability registers. */
|
---|
2728 | PDMPciDevSetInterruptPin(pPciDev, 0x01); /* RO - INTA#. */
|
---|
2729 | PDMPciDevSetInterruptLine(pPciDev, 0x00); /* RW - For software compatibility; no effect on hardware. */
|
---|
2730 |
|
---|
2731 | /* Capability Header. */
|
---|
2732 | PDMPciDevSetDWord(pPciDev, offCapHdr,
|
---|
2733 | RT_BF_MAKE(IOMMU_BF_CAPHDR_CAP_ID, 0xf) /* RO - Secure Device capability block */
|
---|
2734 | | RT_BF_MAKE(IOMMU_BF_CAPHDR_CAP_PTR, offMsiCapHdr) /* RO - Offset to next capability block */
|
---|
2735 | | RT_BF_MAKE(IOMMU_BF_CAPHDR_CAP_TYPE, 0x3) /* RO - IOMMU capability block */
|
---|
2736 | | RT_BF_MAKE(IOMMU_BF_CAPHDR_CAP_REV, 0x1) /* RO - IOMMU interface revision */
|
---|
2737 | | RT_BF_MAKE(IOMMU_BF_CAPHDR_IOTLB_SUP, 0x0) /* RO - Remote IOTLB support */
|
---|
2738 | | RT_BF_MAKE(IOMMU_BF_CAPHDR_HT_TUNNEL, 0x0) /* RO - HyperTransport Tunnel support */
|
---|
2739 | | RT_BF_MAKE(IOMMU_BF_CAPHDR_NP_CACHE, 0x0) /* RO - Cache Not-present page table entries */
|
---|
2740 | | RT_BF_MAKE(IOMMU_BF_CAPHDR_EFR_SUP, 0x1) /* RO - Extended Feature Register support */
|
---|
2741 | | RT_BF_MAKE(IOMMU_BF_CAPHDR_CAP_EXT, 0x1)); /* RO - Misc. Information Register support */
|
---|
2742 |
|
---|
2743 | /* Base Address Low Register. */
|
---|
2744 | PDMPciDevSetDWord(pPciDev, offBaseAddrLo,
|
---|
2745 | RT_BF_MAKE(IOMMU_BF_BASEADDR_LO_ENABLE, 0x1) /* RW1S - Enable */
|
---|
2746 | | RT_BF_MAKE(IOMMU_BF_BASEADDR_LO_ADDR, (u64MmioBase >> 14))); /* RO - Base address (Lo) */
|
---|
2747 |
|
---|
2748 | /* Base Address High Register. */
|
---|
2749 | PDMPciDevSetDWord(pPciDev, offBaseAddrHi, RT_HI_U32(u64MmioBase)); /* RO - Base address (Hi) */
|
---|
2750 |
|
---|
2751 | /* IOMMU Range Register. */
|
---|
2752 | PDMPciDevSetDWord(pPciDev, offRange, 0x0); /* RO - Range register. */
|
---|
2753 |
|
---|
2754 | /* Misc. Information Register 0. */
|
---|
2755 | PDMPciDevSetDWord(pPciDev, offMiscInfo0,
|
---|
2756 | RT_BF_MAKE(IOMMU_BF_MISCINFO_0_MSI_NUM, 0x0) /* RO - MSI number */
|
---|
2757 | | RT_BF_MAKE(IOMMU_BF_MISCINFO_0_GVA_SIZE, 0x2) /* RO - Guest Virt. Addr size (2=48 bits) */
|
---|
2758 | | RT_BF_MAKE(IOMMU_BF_MISCINFO_0_PA_SIZE, 0x30) /* RO - Physical Addr size (48 bits) */
|
---|
2759 | | RT_BF_MAKE(IOMMU_BF_MISCINFO_0_VA_SIZE, 0x40) /* RO - Virt. Addr size (64 bits) */
|
---|
2760 | | RT_BF_MAKE(IOMMU_BF_MISCINFO_0_HT_ATS_RESV, 0x0) /* RW - HT ATS reserved */
|
---|
2761 | | RT_BF_MAKE(IOMMU_BF_MISCINFO_0_MSI_NUM_PPR, 0x0)); /* RW - PPR interrupt number */
|
---|
2762 |
|
---|
2763 | /* Misc. Information Register 1. */
|
---|
2764 | PDMPciDevSetDWord(pPciDev, offMiscInfo1, 0);
|
---|
2765 |
|
---|
2766 | /* MSI Capability Header register. */
|
---|
2767 | PDMPciDevSetDWord(pPciDev, offMsiCapHdr,
|
---|
2768 | RT_BF_MAKE(IOMMU_BF_MSI_CAPHDR_CAP_ID, 0x5) /* RO - Capability ID. */
|
---|
2769 | | RT_BF_MAKE(IOMMU_BF_MSI_CAPHDR_CAP_PTR, offMsiMapCapHdr) /* RO - Offset to mapping capability block */
|
---|
2770 | | RT_BF_MAKE(IOMMU_BF_MSI_CAPHDR_EN, 0x0) /* RW - MSI capability enable */
|
---|
2771 | | RT_BF_MAKE(IOMMU_BF_MSI_CAPHDR_MULTMESS_CAP, 0x0) /* RO - MSI multi-message capability */
|
---|
2772 | | RT_BF_MAKE(IOMMU_BF_MSI_CAPHDR_MULTMESS_EN, 0x0) /* RW - MSI multi-message enable */
|
---|
2773 | | RT_BF_MAKE(IOMMU_BF_MSI_CAPHDR_64BIT_EN, 0x1)); /* RO - MSI 64-bit enable */
|
---|
2774 |
|
---|
2775 | /* MSI Address Lo. */
|
---|
2776 | PDMPciDevSetDWord(pPciDev, offMsiAddrLo, 0); /* RW - MSI message address (Lo). */
|
---|
2777 |
|
---|
2778 | /* MSI Address Hi. */
|
---|
2779 | PDMPciDevSetDWord(pPciDev, offMsiAddrHi, 0); /* RW - MSI message address (Hi). */
|
---|
2780 |
|
---|
2781 | /* MSI Data. */
|
---|
2782 | PDMPciDevSetDWord(pPciDev, offMsiData, 0); /* RW - MSI data. */
|
---|
2783 |
|
---|
2784 | /* MSI Mapping Capability Header register. */
|
---|
2785 | PDMPciDevSetDWord(pPciDev, offMsiMapCapHdr,
|
---|
2786 | RT_BF_MAKE(IOMMU_BF_MSI_MAP_CAPHDR_CAP_ID, 0x8) /* RO - Capability ID */
|
---|
2787 | | RT_BF_MAKE(IOMMU_BF_MSI_MAP_CAPHDR_CAP_PTR, 0x0) /* RO - Offset to next capability (NULL) */
|
---|
2788 | | RT_BF_MAKE(IOMMU_BF_MSI_MAP_CAPHDR_EN, 0x1) /* RO - MSI mapping capability enable */
|
---|
2789 | | RT_BF_MAKE(IOMMU_BF_MSI_MAP_CAPHDR_FIXED, 0x1) /* RO - MSI mapping range is fixed */
|
---|
2790 | | RT_BF_MAKE(IOMMU_BF_MSI_MAP_CAPHDR_CAP_TYPE, 0x15)); /* RO - MSI mapping capability */
|
---|
2791 |
|
---|
2792 | /*
|
---|
2793 | * Register the PCI function with PDM.
|
---|
2794 | */
|
---|
2795 | rc = PDMDevHlpPCIRegisterEx(pDevIns, pPciDev, 0 /* fFlags */, uPciDevice, uPciFunction, "amd-iommu");
|
---|
2796 | AssertLogRelRCReturn(rc, rc);
|
---|
2797 |
|
---|
2798 | /*
|
---|
2799 | * Map MMIO registers.
|
---|
2800 | */
|
---|
2801 | rc = PDMDevHlpMmioCreateAndMap(pDevIns, u64MmioBase, IOMMU_MMIO_REGION_SIZE, iommuAmdMmioWrite, iommuAmdMmioRead,
|
---|
2802 | IOMMMIO_FLAGS_READ_DWORD_QWORD | IOMMMIO_FLAGS_WRITE_DWORD_QWORD_READ_MISSING,
|
---|
2803 | "IOMMU-AMD", &pThis->hMmio);
|
---|
2804 | AssertRCReturn(rc, rc);
|
---|
2805 |
|
---|
2806 | /*
|
---|
2807 | * Register saved state.
|
---|
2808 | */
|
---|
2809 | rc = PDMDevHlpSSMRegisterEx(pDevIns, IOMMU_SAVED_STATE_VERSION, sizeof(IOMMU), NULL,
|
---|
2810 | NULL, NULL, NULL,
|
---|
2811 | NULL, iommuAmdR3SaveExec, NULL,
|
---|
2812 | NULL, iommuAmdR3LoadExec, NULL);
|
---|
2813 | AssertRCReturn(rc, rc);
|
---|
2814 |
|
---|
2815 | /*
|
---|
2816 | * Register debugger info item.
|
---|
2817 | */
|
---|
2818 | rc = PDMDevHlpDBGFInfoRegister(pDevIns, "iommu", "Display IOMMU state.", iommuAmdR3DbgInfo);
|
---|
2819 | AssertRCReturn(rc, rc);
|
---|
2820 |
|
---|
2821 | return VINF_SUCCESS;
|
---|
2822 | }
|
---|
2823 |
|
---|
2824 | # else /* !IN_RING3 */
|
---|
2825 |
|
---|
2826 | /**
|
---|
2827 | * @callback_method_impl{PDMDEVREGR0,pfnConstruct}
|
---|
2828 | */
|
---|
2829 | static DECLCALLBACK(int) iommuAmdRZConstruct(PPDMDEVINS pDevIns)
|
---|
2830 | {
|
---|
2831 | PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
|
---|
2832 | return VINF_SUCCESS;
|
---|
2833 | }
|
---|
2834 |
|
---|
2835 | # endif /* !IN_RING3 */
|
---|
2836 |
|
---|
2837 | /**
|
---|
2838 | * The device registration structure.
|
---|
2839 | */
|
---|
2840 | const PDMDEVREG g_DeviceIommuAmd =
|
---|
2841 | {
|
---|
2842 | /* .u32Version = */ PDM_DEVREG_VERSION,
|
---|
2843 | /* .uReserved0 = */ 0,
|
---|
2844 | /* .szName = */ "iommu-amd",
|
---|
2845 | /* .fFlags = */ PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RZ | PDM_DEVREG_FLAGS_NEW_STYLE,
|
---|
2846 | /* .fClass = */ PDM_DEVREG_CLASS_BUS_ISA, /* Instantiate after PDM_DEVREG_CLASS_BUS_PCI */
|
---|
2847 | /* .cMaxInstances = */ ~0U,
|
---|
2848 | /* .uSharedVersion = */ 42,
|
---|
2849 | /* .cbInstanceShared = */ sizeof(IOMMU),
|
---|
2850 | /* .cbInstanceCC = */ sizeof(IOMMUCC),
|
---|
2851 | /* .cbInstanceRC = */ sizeof(IOMMURC),
|
---|
2852 | /* .cMaxPciDevices = */ 1,
|
---|
2853 | /* .cMaxMsixVectors = */ 0,
|
---|
2854 | /* .pszDescription = */ "IOMMU (AMD)",
|
---|
2855 | #if defined(IN_RING3)
|
---|
2856 | /* .pszRCMod = */ "VBoxDDRC.rc",
|
---|
2857 | /* .pszR0Mod = */ "VBoxDDR0.r0",
|
---|
2858 | /* .pfnConstruct = */ iommuAmdR3Construct,
|
---|
2859 | /* .pfnDestruct = */ iommuAmdR3Destruct,
|
---|
2860 | /* .pfnRelocate = */ NULL,
|
---|
2861 | /* .pfnMemSetup = */ NULL,
|
---|
2862 | /* .pfnPowerOn = */ NULL,
|
---|
2863 | /* .pfnReset = */ iommuAmdR3Reset,
|
---|
2864 | /* .pfnSuspend = */ NULL,
|
---|
2865 | /* .pfnResume = */ NULL,
|
---|
2866 | /* .pfnAttach = */ NULL,
|
---|
2867 | /* .pfnDetach = */ NULL,
|
---|
2868 | /* .pfnQueryInterface = */ NULL,
|
---|
2869 | /* .pfnInitComplete = */ NULL,
|
---|
2870 | /* .pfnPowerOff = */ NULL,
|
---|
2871 | /* .pfnSoftReset = */ NULL,
|
---|
2872 | /* .pfnReserved0 = */ NULL,
|
---|
2873 | /* .pfnReserved1 = */ NULL,
|
---|
2874 | /* .pfnReserved2 = */ NULL,
|
---|
2875 | /* .pfnReserved3 = */ NULL,
|
---|
2876 | /* .pfnReserved4 = */ NULL,
|
---|
2877 | /* .pfnReserved5 = */ NULL,
|
---|
2878 | /* .pfnReserved6 = */ NULL,
|
---|
2879 | /* .pfnReserved7 = */ NULL,
|
---|
2880 | #elif defined(IN_RING0)
|
---|
2881 | /* .pfnEarlyConstruct = */ NULL,
|
---|
2882 | /* .pfnConstruct = */ iommuAmdRZConstruct,
|
---|
2883 | /* .pfnDestruct = */ NULL,
|
---|
2884 | /* .pfnFinalDestruct = */ NULL,
|
---|
2885 | /* .pfnRequest = */ NULL,
|
---|
2886 | /* .pfnReserved0 = */ NULL,
|
---|
2887 | /* .pfnReserved1 = */ NULL,
|
---|
2888 | /* .pfnReserved2 = */ NULL,
|
---|
2889 | /* .pfnReserved3 = */ NULL,
|
---|
2890 | /* .pfnReserved4 = */ NULL,
|
---|
2891 | /* .pfnReserved5 = */ NULL,
|
---|
2892 | /* .pfnReserved6 = */ NULL,
|
---|
2893 | /* .pfnReserved7 = */ NULL,
|
---|
2894 | #elif defined(IN_RC)
|
---|
2895 | /* .pfnConstruct = */ iommuAmdRZConstruct,
|
---|
2896 | /* .pfnReserved0 = */ NULL,
|
---|
2897 | /* .pfnReserved1 = */ NULL,
|
---|
2898 | /* .pfnReserved2 = */ NULL,
|
---|
2899 | /* .pfnReserved3 = */ NULL,
|
---|
2900 | /* .pfnReserved4 = */ NULL,
|
---|
2901 | /* .pfnReserved5 = */ NULL,
|
---|
2902 | /* .pfnReserved6 = */ NULL,
|
---|
2903 | /* .pfnReserved7 = */ NULL,
|
---|
2904 | #else
|
---|
2905 | # error "Not in IN_RING3, IN_RING0 or IN_RC!"
|
---|
2906 | #endif
|
---|
2907 | /* .u32VersionEnd = */ PDM_DEVREG_VERSION
|
---|
2908 | };
|
---|
2909 |
|
---|
2910 | #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
|
---|
2911 |
|
---|