From: Keir Fraser Subject: Re: [PATCH] x86/microcode: Allow "ucode=" argument to be negative Date: Mon, 12 Dec 2011 17:45:50 +0000 Message-ID: References: <4EE62B6C0200007800066FBA@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4EE62B6C0200007800066FBA@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 12/12/2011 15:27, "Jan Beulich" wrote: > ... to indicate counting from the end of the modules list. > > Suggested by Tim Deegan. > > Signed-off-by: Jan Beulich Acked-by: Keir Fraser > --- 2011-11-23.orig/xen/arch/x86/microcode.c 2011-11-30 16:52:28.000000000 > +0100 > +++ 2011-11-23/xen/arch/x86/microcode.c 2011-12-06 08:41:13.000000000 +0100 > @@ -41,7 +41,7 @@ > > static module_t __initdata ucode_mod; > static void *(*__initdata ucode_mod_map)(const module_t *); > -static unsigned int __initdata ucode_mod_idx; > +static signed int __initdata ucode_mod_idx; > static bool_t __initdata ucode_mod_forced; > static cpumask_t __initdata init_mask; > > @@ -54,7 +54,7 @@ void __init microcode_set_module(unsigne > static void __init parse_ucode(char *s) > { > if ( !ucode_mod_forced ) > - ucode_mod_idx = simple_strtoul(s, NULL, 0); > + ucode_mod_idx = simple_strtol(s, NULL, 0); > } > custom_param("ucode", parse_ucode); > > @@ -65,7 +65,9 @@ void __init microcode_grab_module( > { > module_t *mod = (module_t *)__va(mbi->mods_addr); > > - if ( !ucode_mod_idx || ucode_mod_idx >= mbi->mods_count || > + if ( ucode_mod_idx < 0 ) > + ucode_mod_idx += mbi->mods_count; > + if ( ucode_mod_idx <= 0 || ucode_mod_idx >= mbi->mods_count || > !__test_and_clear_bit(ucode_mod_idx, module_map) ) > return; > ucode_mod = mod[ucode_mod_idx]; > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel