Re: [PATCH 1/2] VMware guest detection for x86 and x86-64

From: H. Peter Anvin
Date: Wed Sep 24 2008 - 12:19:54 EST


Yan Li wrote:
Detects whether we are running as a VMware guest or not. Detection is
based upon DMI vendor string.

It provides a function:
int is_vmware_guest(void)
that can be used easily to detect if we are running as a VMware guest
or not.

I haven't used PCI vendor Id since that requires copying a trunk of
codes from early_quirks() and I think copying code is not good. And
reusing codes from early_quirks() needs intrivial change to present
codes structure. Comparatively, checking "VMware" string against DMI
manufacturer is a lot more simpler (one-line code). Also there's no
evidence indicating that VMware will change their vendor string in
near future. Therefore I choose to use simpler way.

Tested on x86 and x86-64 VMs and machines.

I'd like to make this a general VM platform detection subsystem. We have similar issues with Virtual PC, and again, DMI appears to be the sanest way to detect it -- at least to a primary screen.

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