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

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

 



On 04/13/2011 06:26 AM, BrillyWu@xxxxxxxxxxxxxx wrote:
>> The CPUIDs for Centaur are added, and then  the features of PadLock 
>> hardware engine on VIA CPU, such as "ace", "ace_en" and so on, can be 
>> passed into the kvm guest.
>>

> Nice to see this.  Please post a link to the documentation describing 
> these features.

These features are defined in Linux Kernel (arch/x86/include/asm/cpufeature.h),
and the description for these features can be found at the following address:
http://www.via.com.tw/en/initiatives/padlock/hardware.jsp


>>
>> +	/* 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);
>> +

> Are all of these features save wrt save/restore? (do they all act on 
> state in standard registers?)  Do they need any control register bits 
> to be active or MSRs to configure?

These features depend on instructions for the PadLock hardware engine of VIA CPU.
The PadLock instructions just act on standard registers like general X86 instructions, and the features have been enabled when the CPU leave the factory, so there is no need to activate any control register bits or configure MSRs.

>> @@ -2484,6 +2504,17 @@ static int kvm_dev_ioctl_get_supported_c
>>
>>   	r = -E2BIG;
>>   	if (nent>= cpuid->nent)
>> +		goto out_free;
>> +
>> +	/* Add support for Centaur's CPUID instruction. */
>> +	do_cpuid_ent(&cpuid_entries[nent], 0xC0000000, 0,&nent,
>> cpuid->nent);

> nent overflow check missing here.  Also, should probably skip if not a Via.

If not a VIA, the "limit" will be "0", so the following cycle can not run. Moreover, it seems that there is no method to know whther the CPU is a VIA or not in this function.
The nent overflow check is put after the cycle like the "0x8000000" case, and when on a VIA, the returned "limit" is not large (generally it is 0xC0000004), is it neccesary to add a more check here?

> +	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,

--
error compiling committee.c: too many arguments to function

--
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