diff options
author | Avi Kivity <avi@redhat.com> | 2010-07-14 02:45:21 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-01 23:40:50 -0400 |
commit | d153513ddef5698a292b53790008b2e7660cd08d (patch) | |
tree | f0d82716042e7c469f4e634710134fcd09a9cf36 /Documentation/kvm | |
parent | c0e0608cb902af1a1fd8d413ec0a07ee1e62c652 (diff) |
KVM: Document KVM_GET_SUPPORTED_CPUID2 ioctl
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'Documentation/kvm')
-rw-r--r-- | Documentation/kvm/api.txt | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt index 179cc51c15e6..5f5b64982b1a 100644 --- a/Documentation/kvm/api.txt +++ b/Documentation/kvm/api.txt | |||
@@ -968,6 +968,70 @@ struct kvm_xcrs { | |||
968 | 968 | ||
969 | This ioctl would set vcpu's xcr to the value userspace specified. | 969 | This ioctl would set vcpu's xcr to the value userspace specified. |
970 | 970 | ||
971 | 4.45 KVM_GET_SUPPORTED_CPUID | ||
972 | |||
973 | Capability: KVM_CAP_EXT_CPUID | ||
974 | Architectures: x86 | ||
975 | Type: system ioctl | ||
976 | Parameters: struct kvm_cpuid2 (in/out) | ||
977 | Returns: 0 on success, -1 on error | ||
978 | |||
979 | struct kvm_cpuid2 { | ||
980 | __u32 nent; | ||
981 | __u32 padding; | ||
982 | struct kvm_cpuid_entry2 entries[0]; | ||
983 | }; | ||
984 | |||
985 | #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX 1 | ||
986 | #define KVM_CPUID_FLAG_STATEFUL_FUNC 2 | ||
987 | #define KVM_CPUID_FLAG_STATE_READ_NEXT 4 | ||
988 | |||
989 | struct kvm_cpuid_entry2 { | ||
990 | __u32 function; | ||
991 | __u32 index; | ||
992 | __u32 flags; | ||
993 | __u32 eax; | ||
994 | __u32 ebx; | ||
995 | __u32 ecx; | ||
996 | __u32 edx; | ||
997 | __u32 padding[3]; | ||
998 | }; | ||
999 | |||
1000 | This ioctl returns x86 cpuid features which are supported by both the hardware | ||
1001 | and kvm. Userspace can use the information returned by this ioctl to | ||
1002 | construct cpuid information (for KVM_SET_CPUID2) that is consistent with | ||
1003 | hardware, kernel, and userspace capabilities, and with user requirements (for | ||
1004 | example, the user may wish to constrain cpuid to emulate older hardware, | ||
1005 | or for feature consistency across a cluster). | ||
1006 | |||
1007 | Userspace invokes KVM_GET_SUPPORTED_CPUID by passing a kvm_cpuid2 structure | ||
1008 | with the 'nent' field indicating the number of entries in the variable-size | ||
1009 | array 'entries'. If the number of entries is too low to describe the cpu | ||
1010 | capabilities, an error (E2BIG) is returned. If the number is too high, | ||
1011 | the 'nent' field is adjusted and an error (ENOMEM) is returned. If the | ||
1012 | number is just right, the 'nent' field is adjusted to the number of valid | ||
1013 | entries in the 'entries' array, which is then filled. | ||
1014 | |||
1015 | The entries returned are the host cpuid as returned by the cpuid instruction, | ||
1016 | with unknown or unsupported features masked out. The fields in each entry | ||
1017 | are defined as follows: | ||
1018 | |||
1019 | function: the eax value used to obtain the entry | ||
1020 | index: the ecx value used to obtain the entry (for entries that are | ||
1021 | affected by ecx) | ||
1022 | flags: an OR of zero or more of the following: | ||
1023 | KVM_CPUID_FLAG_SIGNIFCANT_INDEX: | ||
1024 | if the index field is valid | ||
1025 | KVM_CPUID_FLAG_STATEFUL_FUNC: | ||
1026 | if cpuid for this function returns different values for successive | ||
1027 | invocations; there will be several entries with the same function, | ||
1028 | all with this flag set | ||
1029 | KVM_CPUID_FLAG_STATE_READ_NEXT: | ||
1030 | for KVM_CPUID_FLAG_STATEFUL_FUNC entries, set if this entry is | ||
1031 | the first entry to be read by a cpu | ||
1032 | eax, ebx, ecx, edx: the values returned by the cpuid instruction for | ||
1033 | this function/index combination | ||
1034 | |||
971 | 5. The kvm_run structure | 1035 | 5. The kvm_run structure |
972 | 1036 | ||
973 | Application code obtains a pointer to the kvm_run structure by | 1037 | Application code obtains a pointer to the kvm_run structure by |