VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR0/GIMR0.cpp@ 106129

Last change on this file since 106129 was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/* $Id: GIMR0.cpp 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * Guest Interface Manager (GIM) - Host Context Ring-0.
4 */
5
6/*
7 * Copyright (C) 2014-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
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#define LOG_GROUP LOG_GROUP_GIM
33#include <VBox/vmm/gim.h>
34#include "GIMInternal.h"
35#include "GIMHvInternal.h"
36#include <VBox/vmm/vmcc.h>
37
38#include <VBox/err.h>
39
40
41/**
42 * Does ring-0 per-VM GIM initialization.
43 *
44 * @returns VBox status code.
45 * @param pVM The cross context VM structure.
46 */
47VMMR0_INT_DECL(int) GIMR0InitVM(PVMCC pVM)
48{
49 if (!GIMIsEnabled(pVM))
50 return VINF_SUCCESS;
51
52 switch (pVM->gim.s.enmProviderId)
53 {
54 case GIMPROVIDERID_HYPERV:
55 return gimR0HvInitVM(pVM);
56
57 default:
58 break;
59 }
60 return VINF_SUCCESS;
61}
62
63
64/**
65 * Does ring-0 per-VM GIM termination.
66 *
67 * @returns VBox status code.
68 * @param pVM The cross context VM structure.
69 */
70VMMR0_INT_DECL(int) GIMR0TermVM(PVMCC pVM)
71{
72 if (!GIMIsEnabled(pVM))
73 return VINF_SUCCESS;
74
75 switch (pVM->gim.s.enmProviderId)
76 {
77 case GIMPROVIDERID_HYPERV:
78 return gimR0HvTermVM(pVM);
79
80 default:
81 break;
82 }
83 return VINF_SUCCESS;
84}
85
86
87/**
88 * Updates the paravirtualized TSC supported by the GIM provider.
89 *
90 * @returns VBox status code.
91 * @retval VINF_SUCCESS if the paravirt. TSC is setup and in use.
92 * @retval VERR_GIM_NOT_ENABLED if no GIM provider is configured for this VM.
93 * @retval VERR_GIM_PVTSC_NOT_AVAILABLE if the GIM provider does not support any
94 * paravirt. TSC.
95 * @retval VERR_GIM_PVTSC_NOT_IN_USE if the GIM provider supports paravirt. TSC
96 * but the guest isn't currently using it.
97 *
98 * @param pVM The cross context VM structure.
99 * @param u64Offset The computed TSC offset.
100 *
101 * @thread EMT(pVCpu)
102 */
103VMMR0_INT_DECL(int) GIMR0UpdateParavirtTsc(PVMCC pVM, uint64_t u64Offset)
104{
105 switch (pVM->gim.s.enmProviderId)
106 {
107 case GIMPROVIDERID_HYPERV:
108 return gimR0HvUpdateParavirtTsc(pVM, u64Offset);
109
110 case GIMPROVIDERID_KVM:
111 return VINF_SUCCESS;
112
113 case GIMPROVIDERID_NONE:
114 return VERR_GIM_NOT_ENABLED;
115
116 default:
117 break;
118 }
119 return VERR_GIM_PVTSC_NOT_AVAILABLE;
120}
121
Note: See TracBrowser for help on using the repository browser.

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