1 /***************************************************************************** 2 * 3 * include/xen/viridian.h 4 * 5 * Copyright (c) 2008 Citrix Corp. 6 * 7 */ 8 9 #ifndef __ASM_X86_HVM_VIRIDIAN_H__ 10 #define __ASM_X86_HVM_VIRIDIAN_H__ 11 12 union viridian_vp_assist 13 { uint64_t raw; 14 struct 15 { 16 uint64_t enabled:1; 17 uint64_t reserved_preserved:11; 18 uint64_t pfn:48; 19 } fields; 20 }; 21 22 struct viridian_vcpu 23 { 24 struct { 25 union viridian_vp_assist msr; 26 void *va; 27 int vector; 28 } vp_assist; 29 uint64_t crash_param[5]; 30 }; 31 32 union viridian_guest_os_id 33 { 34 uint64_t raw; 35 struct 36 { 37 uint64_t build_number:16; 38 uint64_t service_pack:8; 39 uint64_t minor:8; 40 uint64_t major:8; 41 uint64_t os:8; 42 uint64_t vendor:16; 43 } fields; 44 }; 45 46 union viridian_hypercall_gpa 47 { uint64_t raw; 48 struct 49 { 50 uint64_t enabled:1; 51 uint64_t reserved_preserved:11; 52 uint64_t pfn:48; 53 } fields; 54 }; 55 56 struct viridian_time_ref_count 57 { 58 unsigned long flags; 59 60 #define _TRC_accessed 0 61 #define TRC_accessed (1 << _TRC_accessed) 62 #define _TRC_running 1 63 #define TRC_running (1 << _TRC_running) 64 65 uint64_t val; 66 int64_t off; 67 }; 68 69 union viridian_reference_tsc 70 { 71 uint64_t raw; 72 struct 73 { 74 uint64_t enabled:1; 75 uint64_t reserved_preserved:11; 76 uint64_t pfn:48; 77 } fields; 78 }; 79 80 /* 81 * Type defintion as in Microsoft Hypervisor Top-Level Functional 82 * Specification v4.0a, section 15.4.2. 83 */ 84 typedef struct _HV_REFERENCE_TSC_PAGE 85 { 86 uint32_t TscSequence; 87 uint32_t Reserved1; 88 uint64_t TscScale; 89 int64_t TscOffset; 90 uint64_t Reserved2[509]; 91 } HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE; 92 93 struct viridian_domain 94 { 95 union viridian_guest_os_id guest_os_id; 96 union viridian_hypercall_gpa hypercall_gpa; 97 struct viridian_time_ref_count time_ref_count; 98 union viridian_reference_tsc reference_tsc; 99 }; 100 101 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf, 102 uint32_t subleaf, struct cpuid_leaf *res); 103 104 int 105 wrmsr_viridian_regs( 106 uint32_t idx, 107 uint64_t val); 108 109 int 110 rdmsr_viridian_regs( 111 uint32_t idx, 112 uint64_t *val); 113 114 int 115 viridian_hypercall(struct cpu_user_regs *regs); 116 117 void viridian_time_ref_count_freeze(struct domain *d); 118 void viridian_time_ref_count_thaw(struct domain *d); 119 120 void viridian_vcpu_deinit(struct vcpu *v); 121 void viridian_domain_deinit(struct domain *d); 122 123 void viridian_start_apic_assist(struct vcpu *v, int vector); 124 int viridian_complete_apic_assist(struct vcpu *v); 125 void viridian_abort_apic_assist(struct vcpu *v); 126 127 #endif /* __ASM_X86_HVM_VIRIDIAN_H__ */ 128 129 /* 130 * Local variables: 131 * mode: C 132 * c-file-style: "BSD" 133 * c-basic-offset: 4 134 * tab-width: 4 135 * indent-tabs-mode: nil 136 * End: 137 */ 138