1 1.1 cherry /****************************************************************************** 2 1.1 cherry * arch-x86/cpuid.h 3 1.1 cherry * 4 1.1 cherry * CPUID interface to Xen. 5 1.1 cherry * 6 1.1 cherry * Permission is hereby granted, free of charge, to any person obtaining a copy 7 1.1 cherry * of this software and associated documentation files (the "Software"), to 8 1.1 cherry * deal in the Software without restriction, including without limitation the 9 1.1 cherry * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 1.1 cherry * sell copies of the Software, and to permit persons to whom the Software is 11 1.1 cherry * furnished to do so, subject to the following conditions: 12 1.1 cherry * 13 1.1 cherry * The above copyright notice and this permission notice shall be included in 14 1.1 cherry * all copies or substantial portions of the Software. 15 1.1 cherry * 16 1.1 cherry * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 1.1 cherry * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 1.1 cherry * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 1.1 cherry * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 1.1 cherry * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 1.1 cherry * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 1.1 cherry * DEALINGS IN THE SOFTWARE. 23 1.1 cherry * 24 1.1 cherry * Copyright (c) 2007 Citrix Systems, Inc. 25 1.1 cherry * 26 1.1 cherry * Authors: 27 1.1 cherry * Keir Fraser <keir (at) xen.org> 28 1.1 cherry */ 29 1.1 cherry 30 1.1 cherry #ifndef __XEN_PUBLIC_ARCH_X86_CPUID_H__ 31 1.1 cherry #define __XEN_PUBLIC_ARCH_X86_CPUID_H__ 32 1.1 cherry 33 1.1 cherry /* 34 1.1 cherry * For compatibility with other hypervisor interfaces, the Xen cpuid leaves 35 1.1 cherry * can be found at the first otherwise unused 0x100 aligned boundary starting 36 1.1 cherry * from 0x40000000. 37 1.1 cherry * 38 1.1 cherry * e.g If viridian extensions are enabled for an HVM domain, the Xen cpuid 39 1.1 cherry * leaves will start at 0x40000100 40 1.1 cherry */ 41 1.1 cherry 42 1.1 cherry #define XEN_CPUID_FIRST_LEAF 0x40000000 43 1.1 cherry #define XEN_CPUID_LEAF(i) (XEN_CPUID_FIRST_LEAF + (i)) 44 1.1 cherry 45 1.1 cherry /* 46 1.1 cherry * Leaf 1 (0x40000x00) 47 1.1 cherry * EAX: Largest Xen-information leaf. All leaves up to an including @EAX 48 1.1 cherry * are supported by the Xen host. 49 1.1 cherry * EBX-EDX: "XenVMMXenVMM" signature, allowing positive identification 50 1.1 cherry * of a Xen host. 51 1.1 cherry */ 52 1.1 cherry #define XEN_CPUID_SIGNATURE_EBX 0x566e6558 /* "XenV" */ 53 1.1 cherry #define XEN_CPUID_SIGNATURE_ECX 0x65584d4d /* "MMXe" */ 54 1.1 cherry #define XEN_CPUID_SIGNATURE_EDX 0x4d4d566e /* "nVMM" */ 55 1.1 cherry 56 1.1 cherry /* 57 1.1 cherry * Leaf 2 (0x40000x01) 58 1.1 cherry * EAX[31:16]: Xen major version. 59 1.1 cherry * EAX[15: 0]: Xen minor version. 60 1.1 cherry * EBX-EDX: Reserved (currently all zeroes). 61 1.1 cherry */ 62 1.1 cherry 63 1.1 cherry /* 64 1.1 cherry * Leaf 3 (0x40000x02) 65 1.1 cherry * EAX: Number of hypercall transfer pages. This register is always guaranteed 66 1.1 cherry * to specify one hypercall page. 67 1.1 cherry * EBX: Base address of Xen-specific MSRs. 68 1.1 cherry * ECX: Features 1. Unused bits are set to zero. 69 1.1 cherry * EDX: Features 2. Unused bits are set to zero. 70 1.1 cherry */ 71 1.1 cherry 72 1.1 cherry /* Does the host support MMU_PT_UPDATE_PRESERVE_AD for this guest? */ 73 1.1 cherry #define _XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD 0 74 1.1 cherry #define XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD (1u<<0) 75 1.1 cherry 76 1.1 cherry /* 77 1.1 cherry * Leaf 4 (0x40000x03) 78 1.1 cherry * Sub-leaf 0: EAX: bit 0: emulated tsc 79 1.1 cherry * bit 1: host tsc is known to be reliable 80 1.1 cherry * bit 2: RDTSCP instruction available 81 1.1 cherry * EBX: tsc_mode: 0=default (emulate if necessary), 1=emulate, 82 1.1 cherry * 2=no emulation, 3=no emulation + TSC_AUX support 83 1.1 cherry * ECX: guest tsc frequency in kHz 84 1.1 cherry * EDX: guest tsc incarnation (migration count) 85 1.1 cherry * Sub-leaf 1: EAX: tsc offset low part 86 1.1 cherry * EBX: tsc offset high part 87 1.1 cherry * ECX: multiplicator for tsc->ns conversion 88 1.1 cherry * EDX: shift amount for tsc->ns conversion 89 1.1 cherry * Sub-leaf 2: EAX: host tsc frequency in kHz 90 1.1 cherry */ 91 1.1 cherry 92 1.1 cherry /* 93 1.1 cherry * Leaf 5 (0x40000x04) 94 1.1 cherry * HVM-specific features 95 1.1 cherry * Sub-leaf 0: EAX: Features 96 1.1 cherry * Sub-leaf 0: EBX: vcpu id (iff EAX has XEN_HVM_CPUID_VCPU_ID_PRESENT flag) 97 1.1 cherry * Sub-leaf 0: ECX: domain id (iff EAX has XEN_HVM_CPUID_DOMID_PRESENT flag) 98 1.1 cherry */ 99 1.1 cherry #define XEN_HVM_CPUID_APIC_ACCESS_VIRT (1u << 0) /* Virtualized APIC registers */ 100 1.1 cherry #define XEN_HVM_CPUID_X2APIC_VIRT (1u << 1) /* Virtualized x2APIC accesses */ 101 1.1 cherry /* Memory mapped from other domains has valid IOMMU entries */ 102 1.1 cherry #define XEN_HVM_CPUID_IOMMU_MAPPINGS (1u << 2) 103 1.1 cherry #define XEN_HVM_CPUID_VCPU_ID_PRESENT (1u << 3) /* vcpu id is present in EBX */ 104 1.1 cherry #define XEN_HVM_CPUID_DOMID_PRESENT (1u << 4) /* domid is present in ECX */ 105 1.1 cherry 106 1.1 cherry /* 107 1.1 cherry * Leaf 6 (0x40000x05) 108 1.1 cherry * PV-specific parameters 109 1.1 cherry * Sub-leaf 0: EAX: max available sub-leaf 110 1.1 cherry * Sub-leaf 0: EBX: bits 0-7: max machine address width 111 1.1 cherry */ 112 1.1 cherry 113 1.1 cherry /* Max. address width in bits taking memory hotplug into account. */ 114 1.1 cherry #define XEN_CPUID_MACHINE_ADDRESS_WIDTH_MASK (0xffu << 0) 115 1.1 cherry 116 1.1 cherry #define XEN_CPUID_MAX_NUM_LEAVES 5 117 1.1 cherry 118 1.1 cherry #endif /* __XEN_PUBLIC_ARCH_X86_CPUID_H__ */ 119