diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2011-12-02 11:16:55 -0500 |
---|---|---|
committer | Borislav Petkov <bp@amd64.org> | 2011-12-14 06:46:50 -0500 |
commit | 96b0ee4588036b6fa7cf38c17a9e40531241e895 (patch) | |
tree | 477c7a343310f21f6e2bb950ee1ee53c775bd809 /arch/x86/kernel/microcode_amd.c | |
parent | f72c1a576565a4927d650218e183ab5053ab8c3a (diff) |
x86, microcode, AMD: Add a reusable buffer
Add a simple 4K page which gets allocated on driver init and freed on
driver exit instead of vmalloc'ing small buffers for each ucode patch.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'arch/x86/kernel/microcode_amd.c')
-rw-r--r-- | arch/x86/kernel/microcode_amd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index e8a68c2a4364..9129c6981c5b 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c | |||
@@ -71,6 +71,9 @@ struct microcode_amd { | |||
71 | 71 | ||
72 | static struct equiv_cpu_entry *equiv_cpu_table; | 72 | static struct equiv_cpu_entry *equiv_cpu_table; |
73 | 73 | ||
74 | /* page-sized ucode patch buffer */ | ||
75 | void *patch; | ||
76 | |||
74 | static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) | 77 | static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) |
75 | { | 78 | { |
76 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 79 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
@@ -351,9 +354,14 @@ static struct microcode_ops microcode_amd_ops = { | |||
351 | 354 | ||
352 | struct microcode_ops * __init init_amd_microcode(void) | 355 | struct microcode_ops * __init init_amd_microcode(void) |
353 | { | 356 | { |
357 | patch = (void *)get_zeroed_page(GFP_KERNEL); | ||
358 | if (!patch) | ||
359 | return NULL; | ||
360 | |||
354 | return µcode_amd_ops; | 361 | return µcode_amd_ops; |
355 | } | 362 | } |
356 | 363 | ||
357 | void __exit exit_amd_microcode(void) | 364 | void __exit exit_amd_microcode(void) |
358 | { | 365 | { |
366 | free_page((unsigned long)patch); | ||
359 | } | 367 | } |