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

Yan Li
2008-09-17T14:04:19Z

On Wed, Sep 17, 2008 at 12:52:38PM +0200, Ingo Molnar wrote:
> > This code is from mtrr_trim_uncached_memory(), and used by
> > setup_arch(), which is used far before PCI is ready.
> >
> > Therefore I think we can only use DMI here. Any idea?
>
> PCI quirks can be used almost arbitrarily early stage, see:
> arch/x86/kernel/early-quirks.c.
>
> Adding a VM identification callback to early-quirks.c would be fine. But
> if there's a reliable and specific enough DMI string that's fine as
> well. (but PCI is better, since it's a generally more stable enumeration
> interface)

The problem here is that mtrr_trim_uncached_memory() is called 108
lines before the invocation of early_quirks(), and 48 lines before
that of dmi_scan_machine(). That's quite early. The only thing ran
before that is the initialization of CPU, so we have nearly nothing to
use to check the fingerprint of the underlying machine.

I feel It's also unfit to touch the whole PCI or DMI thing before CPU
registers and memory are settled. A simple solution here is to only
issue a KERN_INFO when we detected mtrr is empty and later, when we
can be sure that the OS is not running as a VM, issue a warning. The
later part can be done in early_quirks().

--
Li, Yan