github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/include/policy_manager.h (about)

     1  /*
     2   * Copyright (c) 2013 Intel Corporation
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *     http://www.apache.org/licenses/LICENSE-2.0
     8   * Unless required by applicable law or agreed to in writing, software
     9   * distributed under the License is distributed on an "AS IS" BASIS,
    10   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11   * See the License for the specific language governing permissions and
    12   * limitations under the License.
    13   */
    14  
    15  #ifndef _POLICY_MANAGER_
    16  #define _POLICY_MANAGER_
    17  
    18  #include "vmm_defs.h"
    19  #include "vmm_objects.h"
    20  
    21  
    22  //  Define uVMM policy manager
    23  //  The Policy Manager is responsible for setting up all switches in different
    24  //  uVMM objects that influence the overall uVMM behavior. The uVMM global
    25  //  behavior should depend on required application behavior it is used for.
    26  
    27  // Return codes for the POLICY related functions.
    28  typedef enum _E_POL_RETVAL
    29  {
    30      POL_RETVAL_SUCCESS = 0,
    31      POL_RETVAL_FAIL = -256,
    32      POL_RETVAL_BAD_PARAM,
    33      POL_RETVAL_BAD_VALUE,
    34  }  POL_RETVAL;
    35  
    36  
    37  // Paging POLICY values.
    38  typedef enum _E_VMM_PAGING_POLICY
    39  {
    40      POL_PG_NO_PAGING,
    41      POL_PG_VTLB,
    42      POL_PG_EPT,
    43      POL_PG_PRIVATE,
    44      POL_PG_ILLEGAL
    45  }  VMM_PAGING_POLICY;
    46  
    47  
    48  // Paging POLICY values.
    49  typedef enum _E_VMM_CACHE_POLICY
    50  {
    51      POL_CACHE_DIS_NO_INTERVENING,
    52      POL_CACHE_DIS_VIRTUALIZATION,
    53      POL_CACHE_DIS_ILLEGAL,
    54  }  VMM_CACHE_POLICY;
    55  
    56  
    57  // POLICY types.
    58  typedef UINT64  VMM_POLICY;
    59  
    60  
    61  // Setup the policy
    62  // Called by BSP main() before any initializations to setup the uVMM policy.
    63  POL_RETVAL global_policy_setup(const VMM_POLICY  *policy);
    64  
    65  BOOLEAN global_policy_uses_vtlb(void);
    66  
    67  BOOLEAN global_policy_uses_ept(void);
    68  
    69  BOOLEAN global_policy_is_cache_dis_virtualized(void);
    70  
    71  POL_RETVAL get_global_policy(VMM_POLICY  *policy);
    72  
    73  
    74  // Functions to manipulate VMM_POLICY type variables.
    75  POL_RETVAL clear_policy(VMM_POLICY  *policy);
    76  
    77  POL_RETVAL copy_policy(VMM_POLICY  *dst_policy, const VMM_POLICY  *src_policy);
    78  
    79  
    80  // Functions for cache policy.
    81  POL_RETVAL clear_cache_policy(VMM_POLICY  *policy);
    82  POL_RETVAL set_cache_policy(VMM_POLICY  *policy, VMM_CACHE_POLICY  cache_policy);
    83  POL_RETVAL get_cache_policy(const VMM_POLICY  *policy, VMM_CACHE_POLICY  *cache_policy);
    84  
    85  
    86  // Functions for paging policy.
    87  POL_RETVAL clear_paging_policy(VMM_POLICY  *policy);
    88  POL_RETVAL set_paging_policy(VMM_POLICY  *policy, VMM_PAGING_POLICY  pg_policy);
    89  POL_RETVAL get_paging_policy(const VMM_POLICY  *policy, VMM_PAGING_POLICY  *pg_policy);
    90  
    91  #endif // _POLICY_MANAGER_
    92