VirtualBox

source: vbox/trunk/src/VBox/VMM/include/GICInternal.h@ 99492

最後變更 在這個檔案從99492是 99492,由 vboxsync 提交於 2 年 前

VMM/GIC: Register the MMIO region handlers for the distributor and redisitributor frames, this is already enough for the UEFI firmware to not assert and continue with initialization, bugref:10404

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.5 KB
 
1/* $Id: GICInternal.h 99492 2023-04-20 19:21:44Z vboxsync $ */
2/** @file
3 * GIC - Generic Interrupt Controller Architecture (GICv3).
4 */
5
6/*
7 * Copyright (C) 2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.alldomusa.eu.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef VMM_INCLUDED_SRC_include_GICInternal_h
29#define VMM_INCLUDED_SRC_include_GICInternal_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <VBox/gic.h>
35#include <VBox/vmm/pdmdev.h>
36
37
38/** @defgroup grp_gic_int Internal
39 * @ingroup grp_gic
40 * @internal
41 * @{
42 */
43
44#define VMCPU_TO_GICCPU(a_pVCpu) (&(a_pVCpu)->gic.s)
45#define VM_TO_GIC(a_pVM) (&(a_pVM)->gic.s)
46#define VM_TO_GICDEV(a_pVM) CTX_SUFF(VM_TO_GIC(a_pVM)->pGicDev)
47#ifdef IN_RING3
48# define VMCPU_TO_DEVINS(a_pVCpu) ((a_pVCpu)->pVMR3->gic.s.pDevInsR3)
49#elif defined(IN_RING0)
50# error "Not implemented!"
51#endif
52
53/**
54 * GIC PDM instance data (per-VM).
55 */
56typedef struct GICDEV
57{
58 /** The distributor MMIO handle. */
59 IOMMMIOHANDLE hMmioDist;
60 /** The redistributor MMIO handle. */
61 IOMMMIOHANDLE hMmioReDist;
62} GICDEV;
63/** Pointer to a GIC device. */
64typedef GICDEV *PGICDEV;
65/** Pointer to a const GIC device. */
66typedef GICDEV const *PCGICDEV;
67
68
69/**
70 * GIC VM Instance data.
71 */
72typedef struct GIC
73{
74 /** The ring-3 device instance. */
75 PPDMDEVINSR3 pDevInsR3;
76} GIC;
77/** Pointer to GIC VM instance data. */
78typedef GIC *PGIC;
79/** Pointer to const GIC VM instance data. */
80typedef GIC const *PCGIC;
81AssertCompileSizeAlignment(GIC, 8);
82
83/**
84 * GIC VMCPU Instance data.
85 */
86typedef struct GICCPU
87{
88 /** @name Log Max counters
89 * @{ */
90 uint32_t cLogMaxAccessError;
91 uint32_t cLogMaxSetApicBaseAddr;
92 uint32_t cLogMaxGetApicBaseAddr;
93 uint32_t uAlignment4;
94 /** @} */
95
96 /** @name APIC statistics.
97 * @{ */
98#ifdef VBOX_WITH_STATISTICS
99 /** Number of MMIO reads in R3. */
100 STAMCOUNTER StatMmioReadR3;
101 /** Number of MMIO writes in R3. */
102 STAMCOUNTER StatMmioWriteR3;
103 /** Number of MSR reads in R3. */
104 STAMCOUNTER StatSysRegReadR3;
105 /** Number of MSR writes in R3. */
106 STAMCOUNTER StatSysRegWriteR3;
107
108# if 0 /* No R0 for now. */
109 /** Number of MMIO reads in RZ. */
110 STAMCOUNTER StatMmioReadRZ;
111 /** Number of MMIO writes in RZ. */
112 STAMCOUNTER StatMmioWriteRZ;
113 /** Number of MSR reads in RZ. */
114 STAMCOUNTER StatSysRegReadRZ;
115 /** Number of MSR writes in RZ. */
116 STAMCOUNTER StatSysRegWriteRZ;
117# endif
118#endif
119 /** @} */
120} GICCPU;
121/** Pointer to GIC VMCPU instance data. */
122typedef GICCPU *PGICCPU;
123/** Pointer to a const GIC VMCPU instance data. */
124typedef GICCPU const *PCGICCPU;
125
126DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gicDistMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb);
127DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gicDistMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb);
128
129DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gicReDistMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb);
130DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gicReDistMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb);
131
132DECLHIDDEN(void) gicResetCpu(PVMCPUCC pVCpu);
133
134DECLCALLBACK(int) gicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg);
135DECLCALLBACK(int) gicR3Destruct(PPDMDEVINS pDevIns);
136DECLCALLBACK(void) gicR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta);
137DECLCALLBACK(void) gicR3Reset(PPDMDEVINS pDevIns);
138
139/** @} */
140
141#endif /* !VMM_INCLUDED_SRC_include_GICInternal_h */
142
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette