Re: Use CPUID to communicate with the hypervisor.

From: Karel Zak
Date: Mon Sep 29 2008 - 17:13:01 EST


On Fri, Sep 26, 2008 at 05:09:00PM -0700, H. Peter Anvin wrote:
> Alok Kataria wrote:
>> +{
>> + if (cpu_has_hypervisor) {
>> + unsigned int eax, ebx, ecx, edx;
>> + char hyper_vendor_id[13];
>> +
>> + cpuid(HYPERVISOR_INFO_LEAF, &eax, &ebx, &ecx, &edx);
>> + memcpy(hyper_vendor_id + 0, &ebx, 4);
>> + memcpy(hyper_vendor_id + 4, &ecx, 4);
>> + memcpy(hyper_vendor_id + 8, &edx, 4);
>> + hyper_vendor_id[12] = '\0';
>> + printk(KERN_INFO "Hypervisor vendor id %s\n", hyper_vendor_id);
>> + }
>> +}
>> +
>
> This should be broken out into a separate file in cpu/*, because we
> *will* need to detect hypervisors by other means.

Yes. It would be nice to have "Hypervisor vendor id" somewhere in
/sys or /proc. It seems that userspace is already hungry for that
information:

http://article.gmane.org/gmane.linux.utilities.util-linux-ng/1788

Karel

--
Karel Zak <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/