Messages in this thread | | | Date | Sat, 18 Aug 2012 19:44:42 -0300 | From | Henrique de Moraes Holschuh <> | Subject | Re: [PATCH 04/11] x86/microcode_core_early.c: Define interfaces for early load ucode |
| |
On Sat, 18 Aug 2012, Fenghua Yu wrote: > + char ucode_name[] = "kernel/x86/microcode/GenuineIntel/microcode.hex";
Why name it ".hex" when you're loading binary data? I suggest ".bin". It is confusing to have .hex there, since you're not dealing with the Intel HEX format, nor anything text-like.
> +void __init load_ucode_bsp(char *real_mode_data) > +{ > + u64 ramdisk_image, ramdisk_size, ramdisk_end; > + unsigned long initrd_start, initrd_end; > + struct boot_params *boot_params; > + > + boot_params = (struct boot_params *)real_mode_data; > + ramdisk_image = boot_params->hdr.ramdisk_image; > + ramdisk_size = boot_params->hdr.ramdisk_size; > + > +#ifdef CONFIG_X86_64 > + ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size); > + initrd_start = ramdisk_image + PAGE_OFFSET; > +#else > + ramdisk_end = ramdisk_image + ramdisk_size; > + initrd_start = ramdisk_image; > +#endif > + initrd_end = initrd_start + ramdisk_size; > + > + /* > + * It's early to get CPU vendor info at this point. > + * By searching initrd to find right name for vendor's microcode, > + * it's relative easier to get CPU vendor info. > + */ > + if (find_ucode_intel(initrd_start, initrd_end) == UCODE_OK) > + load_ucode_intel_bsp(real_mode_data); > +}
I'd say something down the load_ucode_intel_bsp() chain better check the CPU vendor to make sure the Intel driver won't attempt to load microcode on some other vendor's processor.
Or are cpu signatures a global namespace and x86 cpu vendors make sure (past, present and future) to never use the same cpu signature as someone else is going to use? Anyway, it would still might be a good thing to do the vendor check somewhere to avoid wasting time going over every microcode of the wrong vendor on generic boot images that have both AMD and Intel microcode.
-- "One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
| |