@@ -2610,6 +2610,76 @@ When debug events exit the main run loop with the reason
2610
2610
KVM_EXIT_DEBUG with the kvm_debug_exit_arch part of the kvm_run
2611
2611
structure containing architecture specific debug information.
2612
2612
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
+
2613
2683
5. The kvm_run structure
2614
2684
------------------------
2615
2685
@@ -2912,76 +2982,6 @@ values in kvm_run even if the corresponding bit in kvm_dirty_regs is not set.
2912
2982
};
2913
2983
2914
2984
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
-
2985
2985
2986
2986
6. Capabilities that can be enabled on vCPUs
2987
2987
--------------------------------------------
0 commit comments