mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 2/2] x86, microcode: Add option to allow downgrading of microcode
Date: Fri, 24 Jan 2014 13:18:59 -0800	[thread overview]
Message-ID: <1390598339-18740-2-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1390598339-18740-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

For testing purposes it can be useful to downgrade microcode.
Normally the driver only allows upgrading.

Add a module_param (default off) that allows downgrading.

Note the module_param can currently not be set for early
ucode update, only for late.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/kernel/microcode_intel_lib.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/kernel/microcode_intel_lib.c b/arch/x86/kernel/microcode_intel_lib.c
index ce69320..18d5325 100644
--- a/arch/x86/kernel/microcode_intel_lib.c
+++ b/arch/x86/kernel/microcode_intel_lib.c
@@ -26,11 +26,16 @@
 #include <linux/uaccess.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 
 #include <asm/microcode_intel.h>
 #include <asm/processor.h>
 #include <asm/msr.h>
 
+static bool allow_downgrade;
+module_param(allow_downgrade, bool, 0644);
+MODULE_PARM_DESC(allow_downgrade, "Allow downgrading microcode");
+
 static inline int
 update_match_cpu(unsigned int csig, unsigned int cpf,
 		 unsigned int sig, unsigned int pf)
@@ -41,6 +46,8 @@ update_match_cpu(unsigned int csig, unsigned int cpf,
 int
 update_match_revision(struct microcode_header_intel *mc_header, int rev)
 {
+	if (allow_downgrade)
+		return 1;
 	return (mc_header->rev <= rev) ? 0 : 1;
 }
 
-- 
1.8.3.1


  reply	other threads:[~2014-01-24 21:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-24 21:18 [PATCH 1/2] x86, microcode: Do Intel microcode revision check signed v2 Andi Kleen
2014-01-24 21:18 ` Andi Kleen [this message]
2014-01-25 16:35   ` [PATCH 2/2] x86, microcode: Add option to allow downgrading of microcode Henrique de Moraes Holschuh
2014-01-25 18:14     ` Andi Kleen
2014-01-28 10:26       ` Henrique de Moraes Holschuh
  -- strict thread matches above, loose matches on Subject: below --
2013-12-12 23:57 [PATCH 1/2] x86, microcode: Do Intel microcode revision check signed v2 Andi Kleen
2013-12-12 23:57 ` [PATCH 2/2] x86, microcode: Add option to allow downgrading of microcode Andi Kleen
2013-12-06 21:04 [PATCH 1/2] x86, microcode: Do Intel microcode revision check signed Andi Kleen
2013-12-06 21:04 ` [PATCH 2/2] x86, microcode: Add option to allow downgrading of microcode Andi Kleen
2013-12-13 21:00   ` Henrique de Moraes Holschuh
2013-12-15  0:40     ` Henrique de Moraes Holschuh

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=1390598339-18740-2-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --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

Powered by JetHome