File tree Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ extern void __init load_ucode_bsp(void);
140140extern void load_ucode_ap (void );
141141void reload_early_microcode (void );
142142extern bool get_builtin_firmware (struct cpio_data * cd , const char * name );
143+ extern bool initrd_gone ;
143144#else
144145static inline int __init microcode_init (void ) { return 0 ; };
145146static inline void __init load_ucode_bsp (void ) { }
Original file line number Diff line number Diff line change @@ -384,8 +384,9 @@ void load_ucode_amd_ap(unsigned int family)
384384reget :
385385 if (!get_builtin_microcode (& cp , family )) {
386386#ifdef CONFIG_BLK_DEV_INITRD
387- cp = find_cpio_data (ucode_path , (void * )initrd_start ,
388- initrd_end - initrd_start , NULL );
387+ if (!initrd_gone )
388+ cp = find_cpio_data (ucode_path , (void * )initrd_start ,
389+ initrd_end - initrd_start , NULL );
389390#endif
390391 if (!(cp .data && cp .size )) {
391392 /*
Original file line number Diff line number Diff line change 4646static struct microcode_ops * microcode_ops ;
4747static bool dis_ucode_ldr = true;
4848
49+ bool initrd_gone ;
50+
4951LIST_HEAD (microcode_cache );
5052
5153/*
@@ -190,21 +192,24 @@ void load_ucode_ap(void)
190192static int __init save_microcode_in_initrd (void )
191193{
192194 struct cpuinfo_x86 * c = & boot_cpu_data ;
195+ int ret = - EINVAL ;
193196
194197 switch (c -> x86_vendor ) {
195198 case X86_VENDOR_INTEL :
196199 if (c -> x86 >= 6 )
197- return save_microcode_in_initrd_intel ();
200+ ret = save_microcode_in_initrd_intel ();
198201 break ;
199202 case X86_VENDOR_AMD :
200203 if (c -> x86 >= 0x10 )
201- return save_microcode_in_initrd_amd (c -> x86 );
204+ ret = save_microcode_in_initrd_amd (c -> x86 );
202205 break ;
203206 default :
204207 break ;
205208 }
206209
207- return - EINVAL ;
210+ initrd_gone = true;
211+
212+ return ret ;
208213}
209214
210215struct cpio_data find_microcode_in_initrd (const char * path , bool use_pa )
@@ -247,9 +252,16 @@ struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa)
247252 * has the virtual address of the beginning of the initrd. It also
248253 * possibly relocates the ramdisk. In either case, initrd_start contains
249254 * the updated address so use that instead.
255+ *
256+ * initrd_gone is for the hotplug case where we've thrown out initrd
257+ * already.
250258 */
251- if (!use_pa && initrd_start )
252- start = initrd_start ;
259+ if (!use_pa ) {
260+ if (initrd_gone )
261+ return (struct cpio_data ){ NULL , 0 , "" };
262+ if (initrd_start )
263+ start = initrd_start ;
264+ }
253265
254266 return find_cpio_data (path , (void * )start , size , NULL );
255267#else /* !CONFIG_BLK_DEV_INITRD */
You can’t perform that action at this time.
0 commit comments