RE: [PATCH] KVM: Add CPUID support for VIA CPU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 04/21/2011 01:06 PM, BrillyWu@xxxxxxxxxxxxxx wrote:
> > So,the conclusion is:
> >
> > Only VIA C7 CPUs have dependency on EFLAGS[30], but they do
> not support VT-X technology, so kvm can not run on it and the issue 
> about EFLAGS[30] will not occur.
> > VIA Nano CPUs support VT-X technology and can run kvm, but
> they have no dependency on EFLAGS[30] (EFLAGS[30] is kept cleared), so  
> the issue about EFLAGS[30] will not appear, too.
> >
> 
> Thanks for the clarification.  The patch however does not apply.  
> Please regenerate it against kvm.git master branch, see 
> http://www.linux-kvm.org/page/Code.
> 

OK. I have regenerate it as follows. Please check it, thank you!

Signed-off-by: BrillyWu<brillywu@xxxxxxxxxxxxxx>
Signed-off-by: KaryJin<karyjin@xxxxxxxxxxxxxx>
---
 arch/x86/kvm/x86.c |   40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

--- a/arch/x86/kvm/x86.c	2011-04-25 09:28:32.912132000 +0800
+++ b/arch/x86/kvm/x86.c	2011-04-25 09:28:28.232132000 +0800
@@ -2336,6 +2336,12 @@ static void do_cpuid_ent(struct kvm_cpui
 		F(3DNOWPREFETCH) | 0 /* OSVW */ | 0 /* IBS */ | F(XOP) |
 		0 /* SKINIT, WDT, LWP */ | F(FMA4) | F(TBM);
 
+	/* cpuid 0xC0000001.edx */
+	const u32 kvm_supported_word5_x86_features =
+		F(XSTORE) | F(XSTORE_EN) | F(XCRYPT) | F(XCRYPT_EN) |
+		F(ACE2) | F(ACE2_EN) | F(PHE) | F(PHE_EN) |
+		F(PMM) | F(PMM_EN);
+
 	/* all calls to cpuid_count() should be made on the same cpu */
 	get_cpu();
 	do_cpuid_1_ent(entry, function, index); @@ -2445,6 +2451,20 @@ static void do_cpuid_ent(struct kvm_cpui
 		entry->ecx &= kvm_supported_word6_x86_features;
 		cpuid_mask(&entry->ecx, 6);
 		break;
+	/*Add support for Centaur's CPUID instruction*/
+	case 0xC0000000:
+		/*Just support up to 0xC0000004 now*/
+		entry->eax = min(entry->eax, 0xC0000004);
+		break;
+	case 0xC0000001:
+		entry->edx &= kvm_supported_word5_x86_features;
+		cpuid_mask(&entry->edx, 5);
+		break;
+	case 0xC0000002:
+	case 0xC0000003:
+	case 0xC0000004:
+		/*Now nothing to do, reserved for the future*/
+		break;
 	}
 
 	kvm_x86_ops->set_supported_cpuid(function, entry); @@ -2491,6 +2511,26 @@ static int kvm_dev_ioctl_get_supported_c
 	if (nent >= cpuid->nent)
 		goto out_free;
 
+	/* Add support for Centaur's CPUID instruction. */
+	if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR) {
+		do_cpuid_ent(&cpuid_entries[nent], 0xC0000000, 0,
+				&nent, cpuid->nent);
+
+		r = -E2BIG;
+		if (nent >= cpuid->nent)
+			goto out_free;
+
+		limit = cpuid_entries[nent - 1].eax;
+		for (func = 0xC0000001;
+			func <= limit && nent < cpuid->nent; ++func)
+			do_cpuid_ent(&cpuid_entries[nent], func, 0,
+					&nent, cpuid->nent);
+
+		r = -E2BIG;
+		if (nent >= cpuid->nent)
+			goto out_free;
+	}
+
 	do_cpuid_ent(&cpuid_entries[nent], KVM_CPUID_SIGNATURE, 0, &nent,
 		     cpuid->nent);
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux