1 | /* $Id: GITSAll.cpp 108732 2025-03-25 08:42:33Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * GITS - Generic Interrupt Controller Interrupt Translation Service (ITS) - All Contexts.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2025 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.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 |
|
---|
29 | /*********************************************************************************************************************************
|
---|
30 | * Header Files *
|
---|
31 | *********************************************************************************************************************************/
|
---|
32 | #define LOG_GROUP LOG_GROUP_DEV_GIC
|
---|
33 | #include "GITSInternal.h"
|
---|
34 |
|
---|
35 | #include <VBox/log.h>
|
---|
36 | #include <iprt/errcore.h> /* VINF_SUCCESS */
|
---|
37 | #include <iprt/string.h> /* RT_ZERO */
|
---|
38 |
|
---|
39 |
|
---|
40 | /*********************************************************************************************************************************
|
---|
41 | * Defined Constants And Macros *
|
---|
42 | *********************************************************************************************************************************/
|
---|
43 | /** The current GITS saved state version. */
|
---|
44 | #define GITS_SAVED_STATE_VERSION 1
|
---|
45 |
|
---|
46 |
|
---|
47 | /*********************************************************************************************************************************
|
---|
48 | * Structures and Typedefs *
|
---|
49 | *********************************************************************************************************************************/
|
---|
50 |
|
---|
51 |
|
---|
52 | /*********************************************************************************************************************************
|
---|
53 | * Global Variables *
|
---|
54 | *********************************************************************************************************************************/
|
---|
55 |
|
---|
56 |
|
---|
57 | #ifndef VBOX_DEVICE_STRUCT_TESTCASE
|
---|
58 |
|
---|
59 | #ifdef LOG_ENABLED
|
---|
60 | DECL_HIDDEN_CALLBACK(const char *) gitsGetCtrlRegDescription(uint16_t offReg)
|
---|
61 | {
|
---|
62 | if ((uint32_t)offReg - GITS_CTRL_REG_BASER_OFF_FIRST < GITS_CTRL_REG_BASER_RANGE_SIZE)
|
---|
63 | return "GITS_BASER<n>";
|
---|
64 | switch (offReg)
|
---|
65 | {
|
---|
66 | case GITS_CTRL_REG_CTLR_OFF: return "GITS_CTLR";
|
---|
67 | case GITS_CTRL_REG_IIDR_OFF: return "GITS_IIDR";
|
---|
68 | case GITS_CTRL_REG_TYPER_OFF: return "GITS_TYPER";
|
---|
69 | case GITS_CTRL_REG_MPAMIDR_OFF: return "GITS_MPAMIDR";
|
---|
70 | case GITS_CTRL_REG_PARTIDR_OFF: return "GITS_PARTIDR";
|
---|
71 | case GITS_CTRL_REG_MPIDR_OFF: return "GITS_MPIDR";
|
---|
72 | case GITS_CTRL_REG_STATUSR_OFF: return "GITS_STATUSR";
|
---|
73 | case GITS_CTRL_REG_UMSIR_OFF: return "GITS_UMSIR";
|
---|
74 | case GITS_CTRL_REG_CBASER_OFF: return "GITS_CBASER";
|
---|
75 | case GITS_CTRL_REG_CWRITER_OFF: return "GITS_CWRITER";
|
---|
76 | case GITS_CTRL_REG_CREADR_OFF: return "GITS_CREADR";
|
---|
77 | default:
|
---|
78 | return "<UNKNOWN>";
|
---|
79 | }
|
---|
80 | }
|
---|
81 |
|
---|
82 | DECL_HIDDEN_CALLBACK(const char *) gitsGetTranslationRegDescription(uint16_t offReg)
|
---|
83 | {
|
---|
84 | switch (offReg)
|
---|
85 | {
|
---|
86 | case GITS_TRANSLATION_REG_TRANSLATER: return "GITS_TRANSLATERR";
|
---|
87 | default:
|
---|
88 | return "<UNKNOWN>";
|
---|
89 | }
|
---|
90 | }
|
---|
91 |
|
---|
92 | #endif
|
---|
93 |
|
---|
94 |
|
---|
95 | DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gitsMmioReadCtrl(PCGITSDEV pGitsDev, uint16_t offReg, uint32_t *puValue)
|
---|
96 | {
|
---|
97 | Log4Func(("offReg=%#RX16\n", offReg));
|
---|
98 |
|
---|
99 | VBOXSTRICTRC rcStrict = VINF_SUCCESS;
|
---|
100 | switch (offReg)
|
---|
101 | {
|
---|
102 | case GITS_CTRL_REG_CTLR_OFF:
|
---|
103 | *puValue = pGitsDev->fUnmappedMsiReporting;
|
---|
104 | break;
|
---|
105 | default:
|
---|
106 | AssertReleaseFailed();
|
---|
107 | }
|
---|
108 |
|
---|
109 | return rcStrict;
|
---|
110 | }
|
---|
111 |
|
---|
112 |
|
---|
113 | DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gitsMmioReadTranslate(PCGITSDEV pGitsDev, uint16_t offReg, uint32_t *puValue)
|
---|
114 | {
|
---|
115 | RT_NOREF(pGitsDev, offReg, puValue);
|
---|
116 | return VERR_NOT_IMPLEMENTED;
|
---|
117 | }
|
---|
118 |
|
---|
119 |
|
---|
120 | DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gitsMmioWriteCtrl(PGITSDEV pGitsDev, uint16_t offReg, uint32_t uValue)
|
---|
121 | {
|
---|
122 | RT_NOREF(pGitsDev, offReg, uValue);
|
---|
123 | return VERR_NOT_IMPLEMENTED;
|
---|
124 | }
|
---|
125 |
|
---|
126 |
|
---|
127 | DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gitsMmioWriteTranslate(PGITSDEV pGitsDev, uint16_t offReg, uint32_t uValue)
|
---|
128 | {
|
---|
129 | RT_NOREF(pGitsDev, offReg, uValue);
|
---|
130 | return VERR_NOT_IMPLEMENTED;
|
---|
131 | }
|
---|
132 |
|
---|
133 |
|
---|
134 | DECL_HIDDEN_CALLBACK(void) gitsInit(PGITSDEV pGitsDev)
|
---|
135 | {
|
---|
136 | Log4Func(("\n"));
|
---|
137 | pGitsDev->fEnabled = false;
|
---|
138 | pGitsDev->fUnmappedMsiReporting = false;
|
---|
139 | pGitsDev->fQuiescent = true;
|
---|
140 | RT_ZERO(pGitsDev->aBases);
|
---|
141 | }
|
---|
142 |
|
---|
143 |
|
---|
144 | #ifdef IN_RING3
|
---|
145 | DECL_HIDDEN_CALLBACK(void) gitsR3DbgInfo(PCGITSDEV pGitsDev, PCDBGFINFOHLP pHlp, const char *pszArgs)
|
---|
146 | {
|
---|
147 | RT_NOREF(pGitsDev, pHlp, pszArgs);
|
---|
148 | /** @todo Debug info dump. */
|
---|
149 | }
|
---|
150 | #endif /* IN_RING3 */
|
---|
151 |
|
---|
152 |
|
---|
153 | /**
|
---|
154 | * @interface_method_impl{PDMGICBACKEND,pfnSendMsi}
|
---|
155 | */
|
---|
156 | DECL_HIDDEN_CALLBACK(int) gitsSendMsi(PVMCC pVM, PCIBDF uBusDevFn, PCMSIMSG pMsi, uint32_t uEventId, uint32_t uTagSrc)
|
---|
157 | {
|
---|
158 | RT_NOREF(pVM, uBusDevFn, pMsi, uEventId, uTagSrc);
|
---|
159 | return VERR_NOT_IMPLEMENTED;
|
---|
160 | }
|
---|
161 |
|
---|
162 |
|
---|
163 | #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
|
---|
164 |
|
---|