VirtualBox

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

Last change on this file since 94800 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

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