[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-cfffbfeb424bc274aba3b5ed4afd5891662481a8@git.kernel.org>
Date: Mon, 19 Nov 2018 02:14:38 -0800
From: tip-bot for Borislav Petkov <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hpa@...or.com, bp@...e.de, linux-kernel@...r.kernel.org,
tglx@...utronix.de, thomas.lendacky@....com, mingo@...nel.org
Subject: [tip:x86/microcode] x86/microcode/AMD: Clean up per-family patch
size checks
Commit-ID: cfffbfeb424bc274aba3b5ed4afd5891662481a8
Gitweb: https://git.kernel.org/tip/cfffbfeb424bc274aba3b5ed4afd5891662481a8
Author: Borislav Petkov <bp@...e.de>
AuthorDate: Sat, 28 Jul 2018 19:04:02 +0200
Committer: Borislav Petkov <bp@...e.de>
CommitDate: Mon, 19 Nov 2018 10:51:00 +0100
x86/microcode/AMD: Clean up per-family patch size checks
Starting with family 0x15, the patch size verification is not needed
anymore. Thus get rid of the need to update this checking function with
each new family.
Keep the check for older families.
Signed-off-by: Borislav Petkov <bp@...e.de>
Cc: Tom Lendacky <thomas.lendacky@....com>
Cc: x86@...nel.org
Link: https://lkml.kernel.org/r/20181107170218.7596-5-bp@alien8.de
---
arch/x86/kernel/cpu/microcode/amd.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index f8d60cb9bb9a..bf682deb84e8 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -183,27 +183,22 @@ static unsigned int verify_patch_size(u8 family, u32 patch_size, unsigned int si
{
u32 max_size;
+ if (family >= 0x15)
+ return min_t(u32, patch_size, size);
+
#define F1XH_MPB_MAX_SIZE 2048
#define F14H_MPB_MAX_SIZE 1824
-#define F15H_MPB_MAX_SIZE 4096
-#define F16H_MPB_MAX_SIZE 3458
-#define F17H_MPB_MAX_SIZE 3200
switch (family) {
+ case 0x10 ... 0x12:
+ max_size = F1XH_MPB_MAX_SIZE;
+ break;
case 0x14:
max_size = F14H_MPB_MAX_SIZE;
break;
- case 0x15:
- max_size = F15H_MPB_MAX_SIZE;
- break;
- case 0x16:
- max_size = F16H_MPB_MAX_SIZE;
- break;
- case 0x17:
- max_size = F17H_MPB_MAX_SIZE;
- break;
default:
- max_size = F1XH_MPB_MAX_SIZE;
+ WARN(1, "%s: WTF family: 0x%x\n", __func__, family);
+ return 0;
break;
}
Powered by blists - more mailing lists