cpuid.c (073350da0aa2aead9df7927a1c1046ebf5cdd816) | cpuid.c (968635abd5f5986f3cb6f15602d365cf1b551c5d) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Kernel-based Virtual Machine driver for Linux 4 * cpuid support routines 5 * 6 * derived from arch/x86/kvm/x86.c 7 * 8 * Copyright 2011 Red Hat, Inc. and/or its affiliates. --- 854 unchanged lines hidden (view full) --- 863 entry->ebx = 0; 864 entry->ecx = 0; 865 entry->edx = 0; 866 } 867 break; 868 case 9: 869 break; 870 case 0xa: { /* Architectural Performance Monitoring */ | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Kernel-based Virtual Machine driver for Linux 4 * cpuid support routines 5 * 6 * derived from arch/x86/kvm/x86.c 7 * 8 * Copyright 2011 Red Hat, Inc. and/or its affiliates. --- 854 unchanged lines hidden (view full) --- 863 entry->ebx = 0; 864 entry->ecx = 0; 865 entry->edx = 0; 866 } 867 break; 868 case 9: 869 break; 870 case 0xa: { /* Architectural Performance Monitoring */ |
871 struct x86_pmu_capability cap; | |
872 union cpuid10_eax eax; 873 union cpuid10_edx edx; 874 875 if (!static_cpu_has(X86_FEATURE_ARCH_PERFMON)) { 876 entry->eax = entry->ebx = entry->ecx = entry->edx = 0; 877 break; 878 } 879 | 871 union cpuid10_eax eax; 872 union cpuid10_edx edx; 873 874 if (!static_cpu_has(X86_FEATURE_ARCH_PERFMON)) { 875 entry->eax = entry->ebx = entry->ecx = entry->edx = 0; 876 break; 877 } 878 |
880 perf_get_x86_pmu_capability(&cap); | 879 eax.split.version_id = kvm_pmu_cap.version; 880 eax.split.num_counters = kvm_pmu_cap.num_counters_gp; 881 eax.split.bit_width = kvm_pmu_cap.bit_width_gp; 882 eax.split.mask_length = kvm_pmu_cap.events_mask_len; 883 edx.split.num_counters_fixed = kvm_pmu_cap.num_counters_fixed; 884 edx.split.bit_width_fixed = kvm_pmu_cap.bit_width_fixed; |
881 | 885 |
882 /* 883 * The guest architecture pmu is only supported if the architecture 884 * pmu exists on the host and the module parameters allow it. 885 */ 886 if (!cap.version || !enable_pmu) 887 memset(&cap, 0, sizeof(cap)); 888 889 eax.split.version_id = min(cap.version, 2); 890 eax.split.num_counters = cap.num_counters_gp; 891 eax.split.bit_width = cap.bit_width_gp; 892 eax.split.mask_length = cap.events_mask_len; 893 894 edx.split.num_counters_fixed = 895 min(cap.num_counters_fixed, KVM_PMC_MAX_FIXED); 896 edx.split.bit_width_fixed = cap.bit_width_fixed; 897 if (cap.version) | 886 if (kvm_pmu_cap.version) |
898 edx.split.anythread_deprecated = 1; 899 edx.split.reserved1 = 0; 900 edx.split.reserved2 = 0; 901 902 entry->eax = eax.full; | 887 edx.split.anythread_deprecated = 1; 888 edx.split.reserved1 = 0; 889 edx.split.reserved2 = 0; 890 891 entry->eax = eax.full; |
903 entry->ebx = cap.events_mask; | 892 entry->ebx = kvm_pmu_cap.events_mask; |
904 entry->ecx = 0; 905 entry->edx = edx.full; 906 break; 907 } 908 /* 909 * Per Intel's SDM, the 0x1f is a superset of 0xb, 910 * thus they can be handled by common code. 911 */ --- 546 unchanged lines hidden --- | 893 entry->ecx = 0; 894 entry->edx = edx.full; 895 break; 896 } 897 /* 898 * Per Intel's SDM, the 0x1f is a superset of 0xb, 899 * thus they can be handled by common code. 900 */ --- 546 unchanged lines hidden --- |