aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/microcode_intel.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-01-22 11:11:39 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-01-22 11:11:39 +0000
commit8383ddfff59a21989863a40351a93c1b6ce4218b (patch)
tree90090578e26d957e193f7b11fe23e2ab19b8b01b /xen/arch/x86/microcode_intel.c
parent4a10e13111a0417d4c9f2d4ee2ce65955ef745d5 (diff)
downloadxen-8383ddfff59a21989863a40351a93c1b6ce4218b.tar.gz
xen-8383ddfff59a21989863a40351a93c1b6ce4218b.tar.bz2
xen-8383ddfff59a21989863a40351a93c1b6ce4218b.zip
x86 ucode: optimizing microcode update
It's possible the data file has multiple matching ucode, we needn't to update multiple times, just keep searching the latest version, and update once. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Diffstat (limited to 'xen/arch/x86/microcode_intel.c')
-rw-r--r--xen/arch/x86/microcode_intel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/xen/arch/x86/microcode_intel.c b/xen/arch/x86/microcode_intel.c
index 8681a6945f..c93df509ad 100644
--- a/xen/arch/x86/microcode_intel.c
+++ b/xen/arch/x86/microcode_intel.c
@@ -325,6 +325,7 @@ static int cpu_request_microcode(int cpu, const void *buf, size_t size)
long offset = 0;
int error = 0;
void *mc;
+ unsigned int matching_count = 0;
/* We should bind the task to the CPU */
BUG_ON(cpu != raw_smp_processor_id());
@@ -343,7 +344,7 @@ static int cpu_request_microcode(int cpu, const void *buf, size_t size)
*/
if ( error == 1 )
{
- apply_microcode(cpu);
+ matching_count++;
error = 0;
}
xfree(mc);
@@ -353,6 +354,9 @@ static int cpu_request_microcode(int cpu, const void *buf, size_t size)
if ( offset < 0 )
error = offset;
+ if ( !error && matching_count )
+ apply_microcode(cpu);
+
return error;
}