Back to home page

OSCL-LXR

 
 

    


0001 /******************************************************************************
0002  * arch-x86/cpuid.h
0003  *
0004  * CPUID interface to Xen.
0005  *
0006  * Permission is hereby granted, free of charge, to any person obtaining a copy
0007  * of this software and associated documentation files (the "Software"), to
0008  * deal in the Software without restriction, including without limitation the
0009  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
0010  * sell copies of the Software, and to permit persons to whom the Software is
0011  * furnished to do so, subject to the following conditions:
0012  *
0013  * The above copyright notice and this permission notice shall be included in
0014  * all copies or substantial portions of the Software.
0015  *
0016  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0017  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0018  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0019  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0020  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0021  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
0022  * DEALINGS IN THE SOFTWARE.
0023  *
0024  * Copyright (c) 2007 Citrix Systems, Inc.
0025  *
0026  * Authors:
0027  *    Keir Fraser <keir@xen.org>
0028  */
0029 
0030 #ifndef __XEN_PUBLIC_ARCH_X86_CPUID_H__
0031 #define __XEN_PUBLIC_ARCH_X86_CPUID_H__
0032 
0033 /*
0034  * For compatibility with other hypervisor interfaces, the Xen cpuid leaves
0035  * can be found at the first otherwise unused 0x100 aligned boundary starting
0036  * from 0x40000000.
0037  *
0038  * e.g If viridian extensions are enabled for an HVM domain, the Xen cpuid
0039  * leaves will start at 0x40000100
0040  */
0041 
0042 #define XEN_CPUID_FIRST_LEAF 0x40000000
0043 #define XEN_CPUID_LEAF(i)    (XEN_CPUID_FIRST_LEAF + (i))
0044 
0045 /*
0046  * Leaf 1 (0x40000x00)
0047  * EAX: Largest Xen-information leaf. All leaves up to an including @EAX
0048  *      are supported by the Xen host.
0049  * EBX-EDX: "XenVMMXenVMM" signature, allowing positive identification
0050  *      of a Xen host.
0051  */
0052 #define XEN_CPUID_SIGNATURE_EBX 0x566e6558 /* "XenV" */
0053 #define XEN_CPUID_SIGNATURE_ECX 0x65584d4d /* "MMXe" */
0054 #define XEN_CPUID_SIGNATURE_EDX 0x4d4d566e /* "nVMM" */
0055 
0056 /*
0057  * Leaf 2 (0x40000x01)
0058  * EAX[31:16]: Xen major version.
0059  * EAX[15: 0]: Xen minor version.
0060  * EBX-EDX: Reserved (currently all zeroes).
0061  */
0062 
0063 /*
0064  * Leaf 3 (0x40000x02)
0065  * EAX: Number of hypercall transfer pages. This register is always guaranteed
0066  *      to specify one hypercall page.
0067  * EBX: Base address of Xen-specific MSRs.
0068  * ECX: Features 1. Unused bits are set to zero.
0069  * EDX: Features 2. Unused bits are set to zero.
0070  */
0071 
0072 /* Does the host support MMU_PT_UPDATE_PRESERVE_AD for this guest? */
0073 #define _XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD 0
0074 #define XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD  (1u<<0)
0075 
0076 /*
0077  * Leaf 4 (0x40000x03)
0078  * Sub-leaf 0: EAX: bit 0: emulated tsc
0079  *                  bit 1: host tsc is known to be reliable
0080  *                  bit 2: RDTSCP instruction available
0081  *             EBX: tsc_mode: 0=default (emulate if necessary), 1=emulate,
0082  *                            2=no emulation, 3=no emulation + TSC_AUX support
0083  *             ECX: guest tsc frequency in kHz
0084  *             EDX: guest tsc incarnation (migration count)
0085  * Sub-leaf 1: EAX: tsc offset low part
0086  *             EBX: tsc offset high part
0087  *             ECX: multiplicator for tsc->ns conversion
0088  *             EDX: shift amount for tsc->ns conversion
0089  * Sub-leaf 2: EAX: host tsc frequency in kHz
0090  */
0091 
0092 /*
0093  * Leaf 5 (0x40000x04)
0094  * HVM-specific features
0095  * Sub-leaf 0: EAX: Features
0096  * Sub-leaf 0: EBX: vcpu id (iff EAX has XEN_HVM_CPUID_VCPU_ID_PRESENT flag)
0097  */
0098 #define XEN_HVM_CPUID_APIC_ACCESS_VIRT (1u << 0) /* Virtualized APIC registers */
0099 #define XEN_HVM_CPUID_X2APIC_VIRT      (1u << 1) /* Virtualized x2APIC accesses */
0100 /* Memory mapped from other domains has valid IOMMU entries */
0101 #define XEN_HVM_CPUID_IOMMU_MAPPINGS   (1u << 2)
0102 #define XEN_HVM_CPUID_VCPU_ID_PRESENT  (1u << 3) /* vcpu id is present in EBX */
0103 #define XEN_HVM_CPUID_DOMID_PRESENT    (1u << 4) /* domid is present in ECX */
0104 /*
0105  * Bits 55:49 from the IO-APIC RTE and bits 11:5 from the MSI address can be
0106  * used to store high bits for the Destination ID. This expands the Destination
0107  * ID field from 8 to 15 bits, allowing to target APIC IDs up 32768.
0108  */
0109 #define XEN_HVM_CPUID_EXT_DEST_ID      (1u << 5)
0110 /* Per-vCPU event channel upcalls */
0111 #define XEN_HVM_CPUID_UPCALL_VECTOR    (1u << 6)
0112 
0113 /*
0114  * Leaf 6 (0x40000x05)
0115  * PV-specific parameters
0116  * Sub-leaf 0: EAX: max available sub-leaf
0117  * Sub-leaf 0: EBX: bits 0-7: max machine address width
0118  */
0119 
0120 /* Max. address width in bits taking memory hotplug into account. */
0121 #define XEN_CPUID_MACHINE_ADDRESS_WIDTH_MASK (0xffu << 0)
0122 
0123 #define XEN_CPUID_MAX_NUM_LEAVES 5
0124 
0125 #endif /* __XEN_PUBLIC_ARCH_X86_CPUID_H__ */