Skip to content

Commit 209cf19

Browse files
stsquadbonzini
authored andcommitted
KVM: fix api documentation of KVM_GET_EMULATED_CPUID
It looks like when this was initially merged it got accidentally included in the following section. I've just moved it back in the correct section and re-numbered it as other ioctls have been added since. Signed-off-by: Alex Bennée <[email protected]> Acked-by: Borislav Petkov <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 4bd9d34 commit 209cf19

File tree

1 file changed

+70
-70
lines changed

1 file changed

+70
-70
lines changed

Documentation/virtual/kvm/api.txt

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2610,6 +2610,76 @@ When debug events exit the main run loop with the reason
26102610
KVM_EXIT_DEBUG with the kvm_debug_exit_arch part of the kvm_run
26112611
structure containing architecture specific debug information.
26122612

2613+
4.88 KVM_GET_EMULATED_CPUID
2614+
2615+
Capability: KVM_CAP_EXT_EMUL_CPUID
2616+
Architectures: x86
2617+
Type: system ioctl
2618+
Parameters: struct kvm_cpuid2 (in/out)
2619+
Returns: 0 on success, -1 on error
2620+
2621+
struct kvm_cpuid2 {
2622+
__u32 nent;
2623+
__u32 flags;
2624+
struct kvm_cpuid_entry2 entries[0];
2625+
};
2626+
2627+
The member 'flags' is used for passing flags from userspace.
2628+
2629+
#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0)
2630+
#define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1)
2631+
#define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2)
2632+
2633+
struct kvm_cpuid_entry2 {
2634+
__u32 function;
2635+
__u32 index;
2636+
__u32 flags;
2637+
__u32 eax;
2638+
__u32 ebx;
2639+
__u32 ecx;
2640+
__u32 edx;
2641+
__u32 padding[3];
2642+
};
2643+
2644+
This ioctl returns x86 cpuid features which are emulated by
2645+
kvm.Userspace can use the information returned by this ioctl to query
2646+
which features are emulated by kvm instead of being present natively.
2647+
2648+
Userspace invokes KVM_GET_EMULATED_CPUID by passing a kvm_cpuid2
2649+
structure with the 'nent' field indicating the number of entries in
2650+
the variable-size array 'entries'. If the number of entries is too low
2651+
to describe the cpu capabilities, an error (E2BIG) is returned. If the
2652+
number is too high, the 'nent' field is adjusted and an error (ENOMEM)
2653+
is returned. If the number is just right, the 'nent' field is adjusted
2654+
to the number of valid entries in the 'entries' array, which is then
2655+
filled.
2656+
2657+
The entries returned are the set CPUID bits of the respective features
2658+
which kvm emulates, as returned by the CPUID instruction, with unknown
2659+
or unsupported feature bits cleared.
2660+
2661+
Features like x2apic, for example, may not be present in the host cpu
2662+
but are exposed by kvm in KVM_GET_SUPPORTED_CPUID because they can be
2663+
emulated efficiently and thus not included here.
2664+
2665+
The fields in each entry are defined as follows:
2666+
2667+
function: the eax value used to obtain the entry
2668+
index: the ecx value used to obtain the entry (for entries that are
2669+
affected by ecx)
2670+
flags: an OR of zero or more of the following:
2671+
KVM_CPUID_FLAG_SIGNIFCANT_INDEX:
2672+
if the index field is valid
2673+
KVM_CPUID_FLAG_STATEFUL_FUNC:
2674+
if cpuid for this function returns different values for successive
2675+
invocations; there will be several entries with the same function,
2676+
all with this flag set
2677+
KVM_CPUID_FLAG_STATE_READ_NEXT:
2678+
for KVM_CPUID_FLAG_STATEFUL_FUNC entries, set if this entry is
2679+
the first entry to be read by a cpu
2680+
eax, ebx, ecx, edx: the values returned by the cpuid instruction for
2681+
this function/index combination
2682+
26132683
5. The kvm_run structure
26142684
------------------------
26152685

@@ -2912,76 +2982,6 @@ values in kvm_run even if the corresponding bit in kvm_dirty_regs is not set.
29122982
};
29132983

29142984

2915-
4.81 KVM_GET_EMULATED_CPUID
2916-
2917-
Capability: KVM_CAP_EXT_EMUL_CPUID
2918-
Architectures: x86
2919-
Type: system ioctl
2920-
Parameters: struct kvm_cpuid2 (in/out)
2921-
Returns: 0 on success, -1 on error
2922-
2923-
struct kvm_cpuid2 {
2924-
__u32 nent;
2925-
__u32 flags;
2926-
struct kvm_cpuid_entry2 entries[0];
2927-
};
2928-
2929-
The member 'flags' is used for passing flags from userspace.
2930-
2931-
#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0)
2932-
#define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1)
2933-
#define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2)
2934-
2935-
struct kvm_cpuid_entry2 {
2936-
__u32 function;
2937-
__u32 index;
2938-
__u32 flags;
2939-
__u32 eax;
2940-
__u32 ebx;
2941-
__u32 ecx;
2942-
__u32 edx;
2943-
__u32 padding[3];
2944-
};
2945-
2946-
This ioctl returns x86 cpuid features which are emulated by
2947-
kvm.Userspace can use the information returned by this ioctl to query
2948-
which features are emulated by kvm instead of being present natively.
2949-
2950-
Userspace invokes KVM_GET_EMULATED_CPUID by passing a kvm_cpuid2
2951-
structure with the 'nent' field indicating the number of entries in
2952-
the variable-size array 'entries'. If the number of entries is too low
2953-
to describe the cpu capabilities, an error (E2BIG) is returned. If the
2954-
number is too high, the 'nent' field is adjusted and an error (ENOMEM)
2955-
is returned. If the number is just right, the 'nent' field is adjusted
2956-
to the number of valid entries in the 'entries' array, which is then
2957-
filled.
2958-
2959-
The entries returned are the set CPUID bits of the respective features
2960-
which kvm emulates, as returned by the CPUID instruction, with unknown
2961-
or unsupported feature bits cleared.
2962-
2963-
Features like x2apic, for example, may not be present in the host cpu
2964-
but are exposed by kvm in KVM_GET_SUPPORTED_CPUID because they can be
2965-
emulated efficiently and thus not included here.
2966-
2967-
The fields in each entry are defined as follows:
2968-
2969-
function: the eax value used to obtain the entry
2970-
index: the ecx value used to obtain the entry (for entries that are
2971-
affected by ecx)
2972-
flags: an OR of zero or more of the following:
2973-
KVM_CPUID_FLAG_SIGNIFCANT_INDEX:
2974-
if the index field is valid
2975-
KVM_CPUID_FLAG_STATEFUL_FUNC:
2976-
if cpuid for this function returns different values for successive
2977-
invocations; there will be several entries with the same function,
2978-
all with this flag set
2979-
KVM_CPUID_FLAG_STATE_READ_NEXT:
2980-
for KVM_CPUID_FLAG_STATEFUL_FUNC entries, set if this entry is
2981-
the first entry to be read by a cpu
2982-
eax, ebx, ecx, edx: the values returned by the cpuid instruction for
2983-
this function/index combination
2984-
29852985

29862986
6. Capabilities that can be enabled on vCPUs
29872987
--------------------------------------------

0 commit comments

Comments
 (0)