lkml.org 
[lkml]   [2014]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 03/10] x86, mpx: add macro cpu_has_mpx
On 06/18/2014 07:35 AM, Dave Hansen wrote:
>
> It looks like static_cpu_has() is the right thing to use instead of
> boot_cpu_has(). But, this doesn't just obfuscate things.
>
> We actually _want_ the compiler to cull code out when the config option
> is off. Things like do_bounds() will see code savings with _some_ kind
> of #ifdef rather than using static_cpu_has().
>
> So, we can either use the well worn, consistent with other features in
> x86, cpu_has_$foo approach. Or, we can roll our own macros.
>

We could do something like:

#define MPX_ENABLED (IS_ENABLED(CONFIG_X86_MPX) &&
static_cpu_has(X86_FEATURE_MPX))

-hpa



\
 
 \ /
  Last update: 2014-06-19 08:41    [W:0.371 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site