All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Borislav Petkov <bp@alien8.de>
Cc: Junichi Nomura <j-nomura@ce.jp.nec.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"hpa@zytor.com" <hpa@zytor.com>
Subject: Re: [PATCH 3/2] x86/microcode/intel: Add a helper which gives the microcode revision
Date: Wed, 28 Dec 2016 10:12:22 -0800	[thread overview]
Message-ID: <CALCETrVnUbiZZabLZkhQHadzJ_cdbdVoUW3RTcNnZz8CGnsjNg@mail.gmail.com> (raw)
In-Reply-To: <20161228125354.GA30537@nazgul.tnic>

On Wed, Dec 28, 2016 at 4:53 AM, Borislav Petkov <bp@alien8.de> wrote:
> On Wed, Dec 28, 2016 at 12:21:20PM +0100, Borislav Petkov wrote:
>> From: Borislav Petkov <bp@suse.de>
>>
>> Intel supplies the microcode revision value in MSR 0x8b
>> (IA32_BIOS_SIGN_ID) after CPUID(1) has been executed. Execute it each
>> time before reading that MSR.
>
> And then, we can go a step further and even do a separate helper which does the
> required steps to read out the microcode revision so that we don't forget them
> next time we change the code.
>
> Provided that works for xen, though, because I need to do the native
> variants but early_init_intel() can call the paravirt *msr() versions
> and I have no idea whether that's kosher on xen pv.
>
> Boris, any objections?
>
> ---
> From: Borislav Petkov <bp@suse.de>
> Date: Wed, 28 Dec 2016 13:44:56 +0100
> Subject: [PATCH] x86/microcode/intel: Add a helper which gives the microcode
>  revision
>
> Since on Intel we're required to do CPUID(1) first, before reading
> the microcode revision MSR, let's add a special helper which does the
> required steps so that we don't forget to do them next time, when we
> want to read the microcode revision.
>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
>  arch/x86/include/asm/microcode_intel.h | 15 ++++++++++++
>  arch/x86/kernel/cpu/intel.c            | 11 +++------
>  arch/x86/kernel/cpu/microcode/intel.c  | 43 ++++++++++------------------------
>  3 files changed, 31 insertions(+), 38 deletions(-)
>
> diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h
> index 195becc6f780..e793fc9a9b20 100644
> --- a/arch/x86/include/asm/microcode_intel.h
> +++ b/arch/x86/include/asm/microcode_intel.h
> @@ -52,6 +52,21 @@ struct extended_sigtable {
>
>  #define exttable_size(et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE)
>
> +static inline u32 intel_get_microcode_revision(void)
> +{
> +       u32 rev, dummy;
> +
> +       native_wrmsrl(MSR_IA32_UCODE_REV, 0);
> +
> +       /* As documented in the SDM: Do a CPUID 1 here */
> +       native_cpuid_eax(1);

As in the other email, could this just be native_cpuid()?

--Andy

  reply	other threads:[~2016-12-28 18:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28  4:39 [PATCH] x86: Fix Intel microcode revision detection Junichi Nomura
2016-12-28 11:18 ` Borislav Petkov
2016-12-28 11:20   ` [PATCH 1/2] x86/CPU: Add native CPUID variants returning a single datum Borislav Petkov
2016-12-28 18:11     ` Andy Lutomirski
2016-12-29  9:30       ` Borislav Petkov
2016-12-31  2:13         ` Andy Lutomirski
2016-12-31 11:09           ` Borislav Petkov
2017-01-03 18:35             ` Andy Lutomirski
2017-01-03 19:48               ` Borislav Petkov
2016-12-28 11:21   ` [PATCH 2/2] x86/microcode: Use native CPUID to tickle out microcode revision Borislav Petkov
2016-12-28 12:53     ` [PATCH 3/2] x86/microcode/intel: Add a helper which gives the " Borislav Petkov
2016-12-28 18:12       ` Andy Lutomirski [this message]
2016-12-29  9:36         ` Borislav Petkov
2016-12-28 19:26       ` Boris Ostrovsky
2016-12-29  9:38         ` Borislav Petkov
     [not found]   ` <0a84dd78-809f-c1ef-6adc-551a124170ad@ce.jp.nec.com>
2017-01-05  9:39     ` [PATCH] x86: Fix Intel microcode revision detection Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALCETrVnUbiZZabLZkhQHadzJ_cdbdVoUW3RTcNnZz8CGnsjNg@mail.gmail.com \
    --to=luto@amacapital.net \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.