1 | /* $Id: PMUInternal.h 106476 2024-10-18 12:57:36Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * PMU - Performance Monitoring Unit.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2024 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 | #ifndef VMM_INCLUDED_SRC_include_PMUInternal_h
|
---|
29 | #define VMM_INCLUDED_SRC_include_PMUInternal_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <VBox/vmm/pdmdev.h>
|
---|
35 |
|
---|
36 |
|
---|
37 | /** @defgroup grp_pmu_int Internal
|
---|
38 | * @ingroup grp_pmu
|
---|
39 | * @internal
|
---|
40 | * @{
|
---|
41 | */
|
---|
42 |
|
---|
43 |
|
---|
44 | #ifdef IN_RING3
|
---|
45 | # define VMCPU_TO_PMU_DEVINS(a_pVCpu) ((a_pVCpu)->pVMR3->pmu.s.pDevInsR3)
|
---|
46 | #elif defined(IN_RING0)
|
---|
47 | # error "Not implemented!"
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * PMU PDM instance data (per-VM).
|
---|
52 | */
|
---|
53 | typedef struct PMUDEV
|
---|
54 | {
|
---|
55 | /** @todo */
|
---|
56 | uint8_t bDummy;
|
---|
57 |
|
---|
58 | } PMUDEV;
|
---|
59 | /** Pointer to a PMU device. */
|
---|
60 | typedef PMUDEV *PPMUDEV;
|
---|
61 | /** Pointer to a const PMU device. */
|
---|
62 | typedef PMUDEV const *PCPMUDEV;
|
---|
63 |
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * PMU VM Instance data.
|
---|
67 | */
|
---|
68 | typedef struct PMU
|
---|
69 | {
|
---|
70 | /** The ring-3 device instance. */
|
---|
71 | PPDMDEVINSR3 pDevInsR3;
|
---|
72 | /** Flag whether the in-kernel (KVM/Hyper-V) PMU of the NEM backend is used. */
|
---|
73 | bool fNemPmu;
|
---|
74 | } PMU;
|
---|
75 | /** Pointer to PMU VM instance data. */
|
---|
76 | typedef PMU *PPMU;
|
---|
77 | /** Pointer to const PMU VM instance data. */
|
---|
78 | typedef PMU const *PCPMU;
|
---|
79 | AssertCompileSizeAlignment(PMU, 8);
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * PMU VMCPU Instance data.
|
---|
83 | */
|
---|
84 | typedef struct PMUCPU
|
---|
85 | {
|
---|
86 | /** @name PMU statistics.
|
---|
87 | * @{ */
|
---|
88 | #ifdef VBOX_WITH_STATISTICS
|
---|
89 | /** Number of MSR reads in R3. */
|
---|
90 | STAMCOUNTER StatSysRegReadR3;
|
---|
91 | /** Number of MSR writes in R3. */
|
---|
92 | STAMCOUNTER StatSysRegWriteR3;
|
---|
93 | #endif
|
---|
94 | /** @} */
|
---|
95 | } PMUCPU;
|
---|
96 | /** Pointer to PMU VMCPU instance data. */
|
---|
97 | typedef PMUCPU *PPMUCPU;
|
---|
98 | /** Pointer to a const PMU VMCPU instance data. */
|
---|
99 | typedef PMUCPU const *PCPMUCPU;
|
---|
100 |
|
---|
101 | DECLCALLBACK(int) pmuR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg);
|
---|
102 | DECLCALLBACK(int) pmuR3Destruct(PPDMDEVINS pDevIns);
|
---|
103 | DECLCALLBACK(void) pmuR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta);
|
---|
104 | DECLCALLBACK(void) pmuR3Reset(PPDMDEVINS pDevIns);
|
---|
105 |
|
---|
106 | /** @} */
|
---|
107 |
|
---|
108 | #endif /* !VMM_INCLUDED_SRC_include_PMUInternal_h */
|
---|
109 |
|
---|