All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>,
	david.vrabel@citrix.com,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] microcode: Check whether the microcode is correct.
Date: Wed, 7 Aug 2013 20:50:33 -0400	[thread overview]
Message-ID: <20130808005033.GL2810@phenom.dumpdata.com> (raw)
In-Reply-To: <5202730302000078000E9F7D@nat28.tlf.novell.com>

On Wed, Aug 07, 2013 at 03:17:07PM +0100, Jan Beulich wrote:
> >>> On 19.07.13 at 05:59, Konrad Rzeszutek Wilk <konrad@kernel.org> wrote:
> > --- a/xen/arch/x86/microcode.c
> > +++ b/xen/arch/x86/microcode.c
> > @@ -433,24 +433,40 @@ static int __init microcode_presmp_init(void)
> >      {
> >          if ( ucode_mod.mod_end || ucode_blob.size )
> >          {
> > -            void *data;
> > -            size_t len;
> > -
> > -            if ( ucode_blob.size )
> > -            {
> > -                len = ucode_blob.size;
> > -                data = ucode_blob.data;
> > -            }
> > -            else
> > -            {
> > -                len = ucode_mod.mod_end;
> > -                data = ucode_mod_map(&ucode_mod);
> > -            }
> > -            if ( data )
> > -                microcode_update_cpu(data, len);
> > -
> > -            if ( !ucode_blob.size )
> > -                ucode_mod_map(NULL);
> > +            int rc;
> > +            do {
> > +                void *data = NULL;
> > +                size_t len;
> > +
> > +                rc = 0;
> > +                if ( ucode_blob.size )
> > +                {
> > +                    len = ucode_blob.size;
> > +                    data = ucode_blob.data;
> > +                }
> > +                else if ( ucode_mod.mod_end )
> > +                {
> > +                    len = ucode_mod.mod_end;
> > +                    data = ucode_mod_map(&ucode_mod);
> > +                }
> > +                if ( data )
> > +                    rc = microcode_update_cpu(data, len);
> 
> else rc = -ENOMEM (yielding the initialization above pointless).
> 
> > +
> > +                if ( !ucode_blob.size && ucode_mod.mod_end )
> > +                    ucode_mod_map(NULL);
> > +
> > +                if ( rc == -EINVAL )
> 
> if ( rc )
> 
> > +                {
> > +                    if ( ucode_blob.size ) /* That was tried first */
> > +                    {
> > +                        ucode_blob.size = 0;
> > +                        xfree(ucode_blob.data);
> > +                        continue;
> > +                    }
> > +                    if ( ucode_mod.mod_end )
> > +                        ucode_mod.mod_end = 0;
> > +                }
> > +            } while ( rc );
> >          }
> >  
> >          register_cpu_notifier(&microcode_percpu_nfb);
> 
> This may need re-doing anyway I we can agree that allowing both
> location specifications at the same time is bogus and should hence
> be dropped.

Right. Lets continue the discussion on that "both location
specifications" on the first patch and I can redo this based on
the result of that discussion.
> 
> Jan
> 
> 

      reply	other threads:[~2013-08-08  0:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18 16:36 Scan initramfs for microcode cpio archive. (v2) Konrad Rzeszutek Wilk
2013-07-18 16:36 ` [PATCH v2] microcode: Scan the initramfs payload for microcode blob Konrad Rzeszutek Wilk
2013-08-07 14:09   ` Jan Beulich
2013-08-08  0:50     ` Konrad Rzeszutek Wilk
2013-08-08  7:07       ` Jan Beulich
2013-07-19  3:59 ` Scan initramfs for microcode cpio archive. (v2) Konrad Rzeszutek Wilk
2013-07-19  3:59   ` [PATCH] microcode: Check whether the microcode is correct Konrad Rzeszutek Wilk
2013-08-07 14:17     ` Jan Beulich
2013-08-08  0:50       ` Konrad Rzeszutek Wilk [this message]

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=20130808005033.GL2810@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=david.vrabel@citrix.com \
    --cc=konrad@kernel.org \
    --cc=xen-devel@lists.xenproject.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.