From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH] microcode: Check whether the microcode is correct. Date: Wed, 7 Aug 2013 20:50:33 -0400 Message-ID: <20130808005033.GL2810@phenom.dumpdata.com> References: <1374165371-24716-1-git-send-email-konrad.wilk@oracle.com> <1374206363-19001-1-git-send-email-konrad.wilk@oracle.com> <1374206363-19001-2-git-send-email-konrad.wilk@oracle.com> <5202730302000078000E9F7D@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1V7ERB-0000hp-TV for xen-devel@lists.xenproject.org; Thu, 08 Aug 2013 00:50:46 +0000 Content-Disposition: inline In-Reply-To: <5202730302000078000E9F7D@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Konrad Rzeszutek Wilk , david.vrabel@citrix.com, xen-devel List-Id: xen-devel@lists.xenproject.org On Wed, Aug 07, 2013 at 03:17:07PM +0100, Jan Beulich wrote: > >>> On 19.07.13 at 05:59, Konrad Rzeszutek Wilk 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(µcode_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 > >