linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: X86 ML <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 09/13] x86/microcode/AMD: Use find_microcode_in_initrd()
Date: Tue, 17 Jan 2017 18:37:30 +0100	[thread overview]
Message-ID: <20170117173734.14251-10-bp@alien8.de> (raw)
In-Reply-To: <20170117173734.14251-1-bp@alien8.de>

From: Borislav Petkov <bp@suse.de>

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

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/microcode/amd.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index e5cb7e73cb3b..340d636512c9 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -346,17 +346,15 @@ void load_ucode_amd_ap(unsigned int cpuid_1_eax)
 
 	/* First AP hasn't cached it yet, go through the blob. */
 	if (!cont.data) {
-		struct cpio_data cp = { NULL, 0, "" };
+		struct cpio_data cp;
 
 		if (cont.size == -1)
 			return;
 
 reget:
 		if (!get_builtin_microcode(&cp, x86_family(cpuid_1_eax))) {
-#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)) {
 				/*
 				 * Mark it so that other APs do not scan again
@@ -410,13 +408,9 @@ int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax)
 
 	if (!cont.data) {
 		if (IS_ENABLED(CONFIG_X86_32) && (cont.size != -1)) {
-			struct cpio_data cp = { NULL, 0, "" };
-
-#ifdef CONFIG_BLK_DEV_INITRD
-			cp = find_cpio_data(ucode_path, (void *)initrd_start,
-					    initrd_end - initrd_start, NULL);
-#endif
+			struct cpio_data cp;
 
+			cp = find_microcode_in_initrd(ucode_path, false);
 			if (!(cp.data && cp.size)) {
 				cont.size = -1;
 				return -EINVAL;
-- 
2.11.0

  parent reply	other threads:[~2017-01-17 17:38 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 17:37 [PATCH 00/13] x86/microcode: 4.11 queue Borislav Petkov
2017-01-17 17:37 ` [PATCH 01/13] x86/microcode/intel: Drop stashed AP patch pointer optimization Borislav Petkov
2017-01-17 19:59   ` Thomas Gleixner
2017-01-17 17:37 ` [PATCH 02/13] x86/microcode: Use own MSR accessors Borislav Petkov
2017-01-17 17:51   ` Thomas Gleixner
2017-01-17 18:11     ` Borislav Petkov
2017-01-17 19:12       ` Thomas Gleixner
2017-01-17 22:33         ` Borislav Petkov
2017-01-18  9:46           ` Thomas Gleixner
2017-01-17 17:37 ` [PATCH 03/13] x86/microcode/AMD: Clean up find_equiv_id() Borislav Petkov
2017-01-17 17:54   ` Thomas Gleixner
2017-01-17 18:49     ` Borislav Petkov
2017-01-17 19:02       ` Thomas Gleixner
2017-01-17 23:12         ` Borislav Petkov
2017-01-17 17:37 ` [PATCH 04/13] x86/microcode/AMD: Shorten function parameter's name Borislav Petkov
2017-01-17 19:59   ` Thomas Gleixner
2017-01-17 17:37 ` [PATCH 05/13] x86/microcode/AMD: Extend the container struct Borislav Petkov
2017-01-17 20:02   ` Thomas Gleixner
2017-01-17 17:37 ` [PATCH 06/13] x86/microcode/AMD: Rework container parsing Borislav Petkov
2017-01-17 20:29   ` Thomas Gleixner
2017-01-17 23:31     ` Borislav Petkov
2017-01-18 14:44       ` Borislav Petkov
2017-01-18 14:58         ` Borislav Petkov
2017-01-17 17:37 ` [PATCH 07/13] x86/microcode: Decrease CPUID use Borislav Petkov
2017-01-17 20:34   ` Thomas Gleixner
2017-01-17 17:37 ` [PATCH 08/13] x86/microcode/AMD: Get rid of global this_equiv_id Borislav Petkov
2017-01-17 20:36   ` Thomas Gleixner
2017-01-17 17:37 ` Borislav Petkov [this message]
2017-01-17 20:36   ` [PATCH 09/13] x86/microcode/AMD: Use find_microcode_in_initrd() Thomas Gleixner
2017-01-17 17:37 ` [PATCH 10/13] x86/microcode/AMD: Check patch level only on the BSP Borislav Petkov
2017-01-17 20:43   ` Thomas Gleixner
2017-01-17 17:37 ` [PATCH 11/13] x86/microcode/AMD: Unify load_ucode_amd_ap() Borislav Petkov
2017-01-17 20:58   ` Thomas Gleixner
2017-01-17 21:18     ` Thomas Gleixner
2017-01-17 17:37 ` [PATCH 12/13] x86/microcode/AMD: Simplify saving from initrd Borislav Petkov
2017-01-17 21:19   ` Thomas Gleixner
2017-01-17 17:37 ` [PATCH 13/13] x86/microcode/AMD: Remove AP scanning optimization Borislav Petkov
2017-01-17 21:24   ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170117173734.14251-10-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).