aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/cpuid.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index e70be46f50fc..89b02bfaaca5 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -327,6 +327,35 @@ static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
327 } 327 }
328 case 9: 328 case 9:
329 break; 329 break;
330 case 0xa: { /* Architectural Performance Monitoring */
331 struct x86_pmu_capability cap;
332 union cpuid10_eax eax;
333 union cpuid10_edx edx;
334
335 perf_get_x86_pmu_capability(&cap);
336
337 /*
338 * Only support guest architectural pmu on a host
339 * with architectural pmu.
340 */
341 if (!cap.version)
342 memset(&cap, 0, sizeof(cap));
343
344 eax.split.version_id = min(cap.version, 2);
345 eax.split.num_counters = cap.num_counters_gp;
346 eax.split.bit_width = cap.bit_width_gp;
347 eax.split.mask_length = cap.events_mask_len;
348
349 edx.split.num_counters_fixed = cap.num_counters_fixed;
350 edx.split.bit_width_fixed = cap.bit_width_fixed;
351 edx.split.reserved = 0;
352
353 entry->eax = eax.full;
354 entry->ebx = cap.events_mask;
355 entry->ecx = 0;
356 entry->edx = edx.full;
357 break;
358 }
330 /* function 0xb has additional index. */ 359 /* function 0xb has additional index. */
331 case 0xb: { 360 case 0xb: {
332 int i, level_type; 361 int i, level_type;
@@ -427,7 +456,6 @@ static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
427 case 3: /* Processor serial number */ 456 case 3: /* Processor serial number */
428 case 5: /* MONITOR/MWAIT */ 457 case 5: /* MONITOR/MWAIT */
429 case 6: /* Thermal management */ 458 case 6: /* Thermal management */
430 case 0xA: /* Architectural Performance Monitoring */
431 case 0x80000007: /* Advanced power management */ 459 case 0x80000007: /* Advanced power management */
432 case 0xC0000002: 460 case 0xC0000002:
433 case 0xC0000003: 461 case 0xC0000003: