Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8cc26e0b authored by Borislav Petkov's avatar Borislav Petkov Committed by Thomas Gleixner
Browse files

x86/microcode/AMD: Use find_microcode_in_initrd()



Use the generic helper instead of semi-open-coding the procedure.

Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170120202955.4091-11-bp@alien8.de


Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 3da9b417
Loading
Loading
Loading
Loading
+5 −11
Original line number Original line Diff line number Diff line
@@ -337,17 +337,15 @@ void load_ucode_amd_ap(unsigned int cpuid_1_eax)


	/* First AP hasn't cached it yet, go through the blob. */
	/* First AP hasn't cached it yet, go through the blob. */
	if (!cont.data) {
	if (!cont.data) {
		struct cpio_data cp = { NULL, 0, "" };
		struct cpio_data cp;


		if (cont.size == -1)
		if (cont.size == -1)
			return;
			return;


reget:
reget:
		if (!get_builtin_microcode(&cp, x86_family(cpuid_1_eax))) {
		if (!get_builtin_microcode(&cp, x86_family(cpuid_1_eax))) {
#ifdef CONFIG_BLK_DEV_INITRD
			cp = find_microcode_in_initrd(ucode_path, false);
			cp = find_cpio_data(ucode_path, (void *)initrd_start,

					    initrd_end - initrd_start, NULL);
#endif
			if (!(cp.data && cp.size)) {
			if (!(cp.data && cp.size)) {
				/*
				/*
				 * Mark it so that other APs do not scan again
				 * Mark it so that other APs do not scan again
@@ -401,13 +399,9 @@ int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax)


	if (!cont.data) {
	if (!cont.data) {
		if (IS_ENABLED(CONFIG_X86_32) && (cont.size != -1)) {
		if (IS_ENABLED(CONFIG_X86_32) && (cont.size != -1)) {
			struct cpio_data cp = { NULL, 0, "" };
			struct cpio_data cp;

#ifdef CONFIG_BLK_DEV_INITRD
			cp = find_cpio_data(ucode_path, (void *)initrd_start,
					    initrd_end - initrd_start, NULL);
#endif


			cp = find_microcode_in_initrd(ucode_path, false);
			if (!(cp.data && cp.size)) {
			if (!(cp.data && cp.size)) {
				cont.size = -1;
				cont.size = -1;
				return -EINVAL;
				return -EINVAL;