Skip to content

Commit

Permalink
x86, microcode, AMD: Add a reusable buffer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Borislav Petkov authored and Borislav Petkov committed Dec 14, 2011
1 parent f72c1a5 commit 96b0ee4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/x86/kernel/microcode_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ struct microcode_amd {

static struct equiv_cpu_entry *equiv_cpu_table;

/* page-sized ucode patch buffer */
void *patch;

static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
{
struct cpuinfo_x86 *c = &cpu_data(cpu);
Expand Down Expand Up @@ -351,9 +354,14 @@ static struct microcode_ops microcode_amd_ops = {

struct microcode_ops * __init init_amd_microcode(void)
{
patch = (void *)get_zeroed_page(GFP_KERNEL);
if (!patch)
return NULL;

return &microcode_amd_ops;
}

void __exit exit_amd_microcode(void)
{
free_page((unsigned long)patch);
}

0 comments on commit 96b0ee4

Please sign in to comment.