[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] microcode: Check whether the microcode is correct.



On Wed, Aug 07, 2013 at 03:17:07PM +0100, Jan Beulich wrote:
> >>> On 19.07.13 at 05:59, Konrad Rzeszutek Wilk <konrad@xxxxxxxxxx> 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
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.