Skip to content

Commit

Permalink
x86, microcode, AMD: Add a vendor-specific exit function
Browse files Browse the repository at this point in the history
This will be used to do cleanup work before the driver exits.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
  • Loading branch information
Borislav Petkov authored and Borislav Petkov committed Dec 14, 2011
1 parent dc47ce9 commit f72c1a5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/x86/include/asm/microcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static inline struct microcode_ops * __init init_intel_microcode(void)

#ifdef CONFIG_MICROCODE_AMD
extern struct microcode_ops * __init init_amd_microcode(void);
extern void __exit exit_amd_microcode(void);

static inline void get_ucode_data(void *to, const u8 *from, size_t n)
{
Expand All @@ -59,6 +60,7 @@ static inline struct microcode_ops * __init init_amd_microcode(void)
{
return NULL;
}
static inline void __exit exit_amd_microcode(void) {}
#endif

#endif /* _ASM_X86_MICROCODE_H */
4 changes: 4 additions & 0 deletions arch/x86/kernel/microcode_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,3 +353,7 @@ struct microcode_ops * __init init_amd_microcode(void)
{
return &microcode_amd_ops;
}

void __exit exit_amd_microcode(void)
{
}
5 changes: 5 additions & 0 deletions arch/x86/kernel/microcode_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ module_init(microcode_init);

static void __exit microcode_exit(void)
{
struct cpuinfo_x86 *c = &cpu_data(0);

microcode_dev_exit();

unregister_hotcpu_notifier(&mc_cpu_notifier);
Expand All @@ -580,6 +582,9 @@ static void __exit microcode_exit(void)

microcode_ops = NULL;

if (c->x86_vendor == X86_VENDOR_AMD)
exit_amd_microcode();

pr_info("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n");
}
module_exit(microcode_exit);

0 comments on commit f72c1a5

Please sign in to comment.