[PATCH v6 75/90] KVM: x86: Use parsed CPUID(0x80000007)

Ahmed S. Darwish posted 90 patches 6 days, 16 hours ago
[PATCH v6 75/90] KVM: x86: Use parsed CPUID(0x80000007)
Posted by Ahmed S. Darwish 6 days, 16 hours ago
For KVM cpuid, use parsed CPUID(0x80000007) instead of poking at x86_power.

The latter is backed by a direct CPUID query and will be removed later.

Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
---
 arch/x86/kvm/cpuid.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index ca769e390e62..efc155e1da10 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -1763,13 +1763,18 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
 		/* Drop reserved bits, pass host L2 cache and TLB info. */
 		entry->edx &= ~GENMASK(17, 16);
 		break;
-	case 0x80000007: /* Advanced power management */
+	case 0x80000007: { /* Advanced power management */
+		const struct cpuid_regs *el7 = cpuid_leaf_raw(&boot_cpu_data, 0x80000007);
+
 		cpuid_entry_override(entry, CPUID_8000_0007_EDX);
 
-		/* mask against host */
-		entry->edx &= boot_cpu_data.x86_power;
+		/* Mask against host */
+		if (el7)
+			entry->edx &= el7->edx;
+
 		entry->eax = entry->ebx = entry->ecx = 0;
 		break;
+	}
 	case 0x80000008: {
 		/*
 		 * GuestPhysAddrSize (EAX[23:16]) is intended for software
-- 
2.53.0