[libvirt] [PATCH] cpu: Add recently added cpu feature flags.

Peter Krempa pkrempa at redhat.com
Wed Oct 24 15:40:25 UTC 2012


On 10/24/12 17:10, Martin Kletzander wrote:
> On 10/24/2012 03:56 PM, Peter Krempa wrote:
>> Qemu has added some new feature flags. This patch adds them to libvirt.
>>
>> The new features are for the cpuid function 0x7 that takes an argument
>> in the ecx register. Currently only 0x0 is used as the argument so I was
>> lazy and I just clear the registers to 0 before calling cpuid. In future
>> when there maybe will be some other possible arguments, we will need to
>> improve the cpu detection code to take this into account.
>> ---
>> The qemu flag definiton can be found at:
>> http://git.qemu.org/?p=qemu.git;a=blob;f=target-i386/cpu.c;h=f3708e63b76541b12dd9eafb3b42f4b4b85b48a9;hb=HEAD#l40
>> ---
>>   src/cpu/cpu_map.xml | 12 ++++++++++++
>>   src/cpu/cpu_x86.c   |  8 +++++++-
>>   2 files changed, 19 insertions(+), 1 deletion(-)
>>

[...]

>> diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
>> index 7cd67b8..f54c3df 100644
>> --- a/src/cpu/cpu_x86.c
>> +++ b/src/cpu/cpu_x86.c
>> @@ -1539,7 +1539,10 @@ static inline void
>>   cpuidCall(struct cpuX86cpuid *cpuid)
>>   {
>>   # if __x86_64__
>> -    asm("cpuid"
>> +    asm("xor %%ebx, %%ebx;" /* clear the other registers as some cpuid */
>> +        "xor %%ecx, %%ecx;" /* functions may use them as additional */
>> +        "xor %%edx, %%edx;" /* arguments */
>> +        "cpuid"
>
> Even though it doesn't change anything, this is the only line not having
> a semicolon at the end (and we have it in the "else" part), so if you
> want, you can make it a bit shinier and put it here as well ;)

I added the semicolon and pushed the patch :)

Thanks

Peter




More information about the libvir-list mailing list