Commit f72c1a57 authored by Borislav Petkov's avatar Borislav Petkov Committed by Borislav Petkov

x86, microcode, AMD: Add a vendor-specific exit function

This will be used to do cleanup work before the driver exits.
Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
parent dc47ce90
...@@ -48,6 +48,7 @@ static inline struct microcode_ops * __init init_intel_microcode(void) ...@@ -48,6 +48,7 @@ static inline struct microcode_ops * __init init_intel_microcode(void)
#ifdef CONFIG_MICROCODE_AMD #ifdef CONFIG_MICROCODE_AMD
extern struct microcode_ops * __init init_amd_microcode(void); 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) static inline void get_ucode_data(void *to, const u8 *from, size_t n)
{ {
...@@ -59,6 +60,7 @@ static inline struct microcode_ops * __init init_amd_microcode(void) ...@@ -59,6 +60,7 @@ static inline struct microcode_ops * __init init_amd_microcode(void)
{ {
return NULL; return NULL;
} }
static inline void __exit exit_amd_microcode(void) {}
#endif #endif
#endif /* _ASM_X86_MICROCODE_H */ #endif /* _ASM_X86_MICROCODE_H */
...@@ -353,3 +353,7 @@ struct microcode_ops * __init init_amd_microcode(void) ...@@ -353,3 +353,7 @@ struct microcode_ops * __init init_amd_microcode(void)
{ {
return &microcode_amd_ops; return &microcode_amd_ops;
} }
void __exit exit_amd_microcode(void)
{
}
...@@ -563,6 +563,8 @@ module_init(microcode_init); ...@@ -563,6 +563,8 @@ module_init(microcode_init);
static void __exit microcode_exit(void) static void __exit microcode_exit(void)
{ {
struct cpuinfo_x86 *c = &cpu_data(0);
microcode_dev_exit(); microcode_dev_exit();
unregister_hotcpu_notifier(&mc_cpu_notifier); unregister_hotcpu_notifier(&mc_cpu_notifier);
...@@ -580,6 +582,9 @@ static void __exit microcode_exit(void) ...@@ -580,6 +582,9 @@ static void __exit microcode_exit(void)
microcode_ops = NULL; microcode_ops = NULL;
if (c->x86_vendor == X86_VENDOR_AMD)
exit_amd_microcode();
pr_info("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n"); pr_info("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n");
} }
module_exit(microcode_exit); module_exit(microcode_exit);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment