[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3E5A0FA7E9CA944F9D5414FEC6C71220470F814C@ORSMSX105.amr.corp.intel.com>
Date: Sun, 16 Dec 2012 18:09:12 +0000
From: "Yu, Fenghua" <fenghua.yu@...el.com>
To: Borislav Petkov <bp@...en8.de>
CC: H Peter Anvin <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
"Mallick, Asit K" <asit.k.mallick@...el.com>,
Tigran Aivazian <tigran@...azian.fsnet.co.uk>,
Andreas Herrmann <andreas.herrmann3@....com>,
Borislav Petkov <borislav.petkov@....com>,
Yinghai Lu <yinghai@...nel.org>,
linux-kernel <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>
Subject: RE: [PATCH v3 04/10] x86/microcode_core_early.c: Define interfaces
for early loading ucode
> -----Original Message-----
> From: Borislav Petkov [mailto:bp@...en8.de]
> Sent: Sunday, December 16, 2012 9:57 AM
> To: Yu, Fenghua
> Cc: H Peter Anvin; Ingo Molnar; Thomas Gleixner; Mallick, Asit K;
> Tigran Aivazian; Andreas Herrmann; Borislav Petkov; Yinghai Lu; linux-
> kernel; x86
> Subject: Re: [PATCH v3 04/10] x86/microcode_core_early.c: Define
> interfaces for early loading ucode
>
> On Sun, Dec 16, 2012 at 02:43:23AM -0800, Fenghua Yu wrote:
> > +#define QCHAR(a, b, c, d) ((a) + ((b) << 8) + ((c) << 16) + ((d) <<
> 24))
> > +#define CPUID_INTEL1 QCHAR('G', 'e', 'n', 'u')
> > +#define CPUID_INTEL2 QCHAR('i', 'n', 'e', 'I')
> > +#define CPUID_INTEL3 QCHAR('n', 't', 'e', 'l')
> > +#define CPUID_AMD1 QCHAR('A', 'u', 't', 'h')
> > +#define CPUID_AMD2 QCHAR('e', 'n', 't', 'i')
> > +#define CPUID_AMD3 QCHAR('c', 'A', 'M', 'D')
> > +
> > +#define CPUID_IS(a, b, c) (!((ebx ^ (a))|(edx ^ (b))|(ecx ^ (c))))
>
> What, this macro is relying on external variable names and doesn't have
> them as its own macro arguments? Why? This is really fragile and very
> much prone to errors.
>
> What's wrong with doing:
>
> #define CPUID_IS(a, b, c, ebx, ecx, edx) (!(((ebx) ^ (a))|((edx) ^
> (b))|((ecx) ^ (c))))
>
> ?
Nothing wrong with taking the parameters. But CPUID_IS is only limited in this file. There is no other places to use it. I think either way is ok.
Thanks.
-Fenghua
Powered by blists - more mailing lists