File tree 3 files changed +21
-7
lines changed
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);
140
140
extern void load_ucode_ap (void );
141
141
void reload_early_microcode (void );
142
142
extern bool get_builtin_firmware (struct cpio_data * cd , const char * name );
143
+ extern bool initrd_gone ;
143
144
#else
144
145
static inline int __init microcode_init (void ) { return 0 ; };
145
146
static 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)
384
384
reget :
385
385
if (!get_builtin_microcode (& cp , family )) {
386
386
#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 );
389
390
#endif
390
391
if (!(cp .data && cp .size )) {
391
392
/*
Original file line number Diff line number Diff line change 46
46
static struct microcode_ops * microcode_ops ;
47
47
static bool dis_ucode_ldr = true;
48
48
49
+ bool initrd_gone ;
50
+
49
51
LIST_HEAD (microcode_cache );
50
52
51
53
/*
@@ -190,21 +192,24 @@ void load_ucode_ap(void)
190
192
static int __init save_microcode_in_initrd (void )
191
193
{
192
194
struct cpuinfo_x86 * c = & boot_cpu_data ;
195
+ int ret = - EINVAL ;
193
196
194
197
switch (c -> x86_vendor ) {
195
198
case X86_VENDOR_INTEL :
196
199
if (c -> x86 >= 6 )
197
- return save_microcode_in_initrd_intel ();
200
+ ret = save_microcode_in_initrd_intel ();
198
201
break ;
199
202
case X86_VENDOR_AMD :
200
203
if (c -> x86 >= 0x10 )
201
- return save_microcode_in_initrd_amd (c -> x86 );
204
+ ret = save_microcode_in_initrd_amd (c -> x86 );
202
205
break ;
203
206
default :
204
207
break ;
205
208
}
206
209
207
- return - EINVAL ;
210
+ initrd_gone = true;
211
+
212
+ return ret ;
208
213
}
209
214
210
215
struct 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)
247
252
* has the virtual address of the beginning of the initrd. It also
248
253
* possibly relocates the ramdisk. In either case, initrd_start contains
249
254
* the updated address so use that instead.
255
+ *
256
+ * initrd_gone is for the hotplug case where we've thrown out initrd
257
+ * already.
250
258
*/
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
+ }
253
265
254
266
return find_cpio_data (path , (void * )start , size , NULL );
255
267
#else /* !CONFIG_BLK_DEV_INITRD */
You can’t perform that action at this time.
0 commit comments