Messages in this thread | | | Date | Mon, 29 Sep 2008 22:56:34 +0200 | From | Karel Zak <> | Subject | Re: Use CPUID to communicate with the hypervisor. |
| |
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@redhat.com>
| |