Lines Matching full:cpuid

4  * cpuid support routines
24 #include <asm/cpuid.h>
25 #include "cpuid.h"
95 * Magic value used by KVM when querying userspace-provided CPUID entries and
99 * to avoid false positives when processing guest CPUID input.
110 * KVM has a semi-arbitrary rule that querying the guest's CPUID model in cpuid_entry2_find()
111 * with IRQs disabled is disallowed. The CPUID model can legitimately in cpuid_entry2_find()
117 * of the hotpath, e.g. by caching information during CPUID updates. in cpuid_entry2_find()
138 * lookup (as opposed to emulating CPUID) for a function that's in cpuid_entry2_find()
190 /* Check whether the supplied CPUID data is equal to what is already set for the vCPU. */
216 struct kvm_hypervisor_cpuid cpuid = {}; in kvm_get_hypervisor_cpuid() local
231 cpuid.base = base; in kvm_get_hypervisor_cpuid()
232 cpuid.limit = entry->eax; in kvm_get_hypervisor_cpuid()
238 return cpuid; in kvm_get_hypervisor_cpuid()
264 * save the feature bitmap to avoid cpuid lookup for every PV in kvm_update_pv_runtime()
272 * Calculate guest's supported XCR0 taking into account guest CPUID data and
363 * If TDP is disabled, honor *only* guest CPUID as KVM has full control in kvm_vcpu_after_set_cpuid()
439 * KVM does not correctly handle changing guest CPUID after KVM_RUN, as in kvm_set_cpuid()
447 * whether the supplied CPUID data is equal to what's already set. in kvm_set_cpuid()
473 vcpu->arch.xen.cpuid = kvm_get_hypervisor_cpuid(vcpu, XEN_SIGNATURE); in kvm_set_cpuid()
481 struct kvm_cpuid *cpuid, in kvm_vcpu_ioctl_set_cpuid() argument
488 if (cpuid->nent > KVM_MAX_CPUID_ENTRIES) in kvm_vcpu_ioctl_set_cpuid()
491 if (cpuid->nent) { in kvm_vcpu_ioctl_set_cpuid()
492 e = vmemdup_user(entries, array_size(sizeof(*e), cpuid->nent)); in kvm_vcpu_ioctl_set_cpuid()
496 e2 = kvmalloc_array(cpuid->nent, sizeof(*e2), GFP_KERNEL_ACCOUNT); in kvm_vcpu_ioctl_set_cpuid()
502 for (i = 0; i < cpuid->nent; i++) { in kvm_vcpu_ioctl_set_cpuid()
515 r = kvm_set_cpuid(vcpu, e2, cpuid->nent); in kvm_vcpu_ioctl_set_cpuid()
526 struct kvm_cpuid2 *cpuid, in kvm_vcpu_ioctl_set_cpuid2() argument
532 if (cpuid->nent > KVM_MAX_CPUID_ENTRIES) in kvm_vcpu_ioctl_set_cpuid2()
535 if (cpuid->nent) { in kvm_vcpu_ioctl_set_cpuid2()
536 e2 = vmemdup_user(entries, array_size(sizeof(*e2), cpuid->nent)); in kvm_vcpu_ioctl_set_cpuid2()
541 r = kvm_set_cpuid(vcpu, e2, cpuid->nent); in kvm_vcpu_ioctl_set_cpuid2()
549 struct kvm_cpuid2 *cpuid, in kvm_vcpu_ioctl_get_cpuid2() argument
552 if (cpuid->nent < vcpu->arch.cpuid_nent) in kvm_vcpu_ioctl_get_cpuid2()
559 cpuid->nent = vcpu->arch.cpuid_nent; in kvm_vcpu_ioctl_get_cpuid2()
563 /* Mask kvm_cpu_caps for @leaf with the raw CPUID capabilities of this CPU. */
566 const struct cpuid_reg cpuid = x86_feature_cpuid(leaf * 32); in __kvm_cpu_cap_mask() local
571 cpuid_count(cpuid.function, cpuid.index, in __kvm_cpu_cap_mask()
574 kvm_cpu_caps[leaf] &= *__cpuid_entry_get_reg(&entry, cpuid.reg); in __kvm_cpu_cap_mask()
620 * advertised to guests via CPUID! in kvm_set_cpu_caps()
795 * KVM's supported CPUID if the feature is reported as supported by the in kvm_set_cpu_caps()
800 * the mask with the raw host CPUID, and reporting support in AMD's in kvm_set_cpu_caps()
950 * CPUID(function=2, index=0) may return different results each in __do_cpuid_func()
952 * number of times software should do CPUID(2, 0). in __do_cpuid_func()
958 * APM states that CPUID(2) is reserved. in __do_cpuid_func()
961 * a stateful CPUID.0x2 is encountered. in __do_cpuid_func()
1200 * NullSegClearsBase is not reported in CPUID on Zen2; help in __do_cpuid_func()
1201 * userspace by providing the CPUID leaf ourselves. in __do_cpuid_func()
1203 * However, only do it if the host has CPUID leaf 0x8000001d. in __do_cpuid_func()
1205 * CPUID leaf if KVM reports that it supports 0x8000001d or in __do_cpuid_func()
1326 /*Add support for Centaur's CPUID instruction*/ in __do_cpuid_func()
1414 int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid, in kvm_dev_ioctl_get_cpuid() argument
1427 if (cpuid->nent < 1) in kvm_dev_ioctl_get_cpuid()
1429 if (cpuid->nent > KVM_MAX_CPUID_ENTRIES) in kvm_dev_ioctl_get_cpuid()
1430 cpuid->nent = KVM_MAX_CPUID_ENTRIES; in kvm_dev_ioctl_get_cpuid()
1432 if (sanity_check_entries(entries, cpuid->nent, type)) in kvm_dev_ioctl_get_cpuid()
1435 array.entries = kvcalloc(cpuid->nent, sizeof(struct kvm_cpuid_entry2), GFP_KERNEL); in kvm_dev_ioctl_get_cpuid()
1439 array.maxnent = cpuid->nent; in kvm_dev_ioctl_get_cpuid()
1446 cpuid->nent = array.nent; in kvm_dev_ioctl_get_cpuid()
1474 * Intel CPUID semantics treats any query for an out-of-range leaf as if the
1475 * highest basic leaf (i.e. CPUID.0H:EAX) were requested. AMD CPUID semantics
1485 * class exists if a guest CPUID entry for its <base> leaf exists. For a given
1486 * class, CPUID.<base>.EAX contains the max supported leaf for the class.
1496 * CPUID sub-classes are:
1528 * entry for CPUID.0xb.index (see below), then the output value for EDX in get_out_of_range_cpuid_entry()
1529 * needs to be pulled from CPUID.0xb.1. in get_out_of_range_cpuid_entry()
1535 * the effective CPUID entry is the max basic leaf. Note, the index of in get_out_of_range_cpuid_entry()