Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure
From: David Woodhouse
Date: Wed Jan 24 2018 - 07:15:13 EST
On Wed, 2018-01-24 at 09:47 +0100, Peter Zijlstra wrote:
>
> Typically tglx likes to use x86_match_cpu() for these things; see also
> commit: bd9240a18edfb ("x86/apic: Add TSC_DEADLINE quirk due to
> errata").
Ewww.
static u32 hsx_deadline_rev(void)
{
   Âswitch (boot_cpu_data.x86_mask) {
   Âcase 0x02: return 0x3a; /* EP */
   Âcase 0x04: return 0x0f; /* EX */
   Â}
   Âreturn ~0U;
}
...
static const struct x86_cpu_id deadline_match[] = {
   ÂDEADLINE_MODEL_MATCH_FUNC( INTEL_FAM6_HASWELL_X,ÂÂÂÂÂÂÂÂhsx_deadline_rev),
   ÂDEADLINE_MODEL_MATCH_REV ( INTEL_FAM6_BROADWELL_X,ÂÂÂÂÂÂ0x0b000020),
   ÂDEADLINE_MODEL_MATCH_FUNC( INTEL_FAM6_BROADWELL_XEON_D, bdx_deadline_rev),
   ÂDEADLINE_MODEL_MATCH_REV ( INTEL_FAM6_SKYLAKE_X,ÂÂÂÂÂÂÂÂ0x02000014),
...
ÂÂÂÂÂÂÂ/*
ÂÂÂÂÂÂÂÂ* Function pointers will have the MSB set due to address layout,
ÂÂÂÂÂÂÂÂ* immediate revisions will not.
ÂÂÂÂÂÂÂÂ*/
ÂÂÂÂÂÂÂif ((long)m->driver_data < 0)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂrev = ((u32 (*)(void))(m->driver_data))();
ÂÂÂÂÂÂÂelse
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂrev = (u32)m->driver_data;
EWWWW!
Shan't.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature