Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp6016121imm; Sat, 19 May 2018 15:11:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoBJKoESugq/DUlAHBOgpClAKolX1pHGLTuT7XSag6ztFhZ32K16Pn2qZNreO4isyN/jyzj X-Received: by 2002:a63:6284:: with SMTP id w126-v6mr1551690pgb.429.1526767885618; Sat, 19 May 2018 15:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526767885; cv=none; d=google.com; s=arc-20160816; b=R1QHWZobkVSDBU1Cb/01nIVkib/Ufd7N1Y2iseVSA75Xwj1/DW30R5J6GYIOQkQOKN /wjrFCE2EaS1rYQHO+kZjGbt4PnGkvZ63O67FclqpfYjnKvbBZ1HUYp27W8xXlGgkjCB 5aRMvDXN/mU2x1rL5gDijDZo8kWBJiFtW/fmtB6WUPn6XDbbnzOc3bp3toZlg/d6IiXV 36XVUvBN9Ar2tUgoexBLaz0mEIhcF+Wdjy5/w5K1VI05ixAqy0xxP3FwRSmRF1W+7NcB 27cbHDxMRNWb99LX7AOJAIYVzZ+cvMv9PtQu48gF0fvXeK5cGSNJtnConxs6VRFLMB0o tJ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=nEhEW97Ki/RLgL6ofQqEIY+NLcPUZ29clDl0qWsVxiM=; b=ceGJTNjLfhTqa29yagBjOfuLEjnbP/tV8dFVSbsl8NlzQt7itZmsHQnSSZZ1bSjJ5K qMEbHKGvm7kyIeiaTq2X/HJWn/XTJpZByJdwAS/garTaetBfy1EFM3fIP/iNhxKYUlgN wFdtZ2KRgEH8AAEHNQW33Jg7LgPoZ2UINJr61ijeMIe972DLoP4ekfKRyYRZIL+7qdKE B6cF+q6dZ1f5uy+KbsDCBGqWLSS/GeZDy2R4qI3+3B+L36kpa1RMmVDYtCttUE95mDYD /9TF2aRTYu4FdObioA/xruKw3cwW9zLAsF1x/LjEpWqfbnqUfs1JcnwQs3RvSTyDs7sc v19Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23-v6si8207123pgv.360.2018.05.19.15.11.11; Sat, 19 May 2018 15:11:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752679AbeESWI0 (ORCPT + 99 others); Sat, 19 May 2018 18:08:26 -0400 Received: from vps-vb.mhejs.net ([37.28.154.113]:49438 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752584AbeESWHs (ORCPT ); Sat, 19 May 2018 18:07:48 -0400 Received: by vps-vb.mhejs.net with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1fKA0a-0001P8-Gt; Sun, 20 May 2018 00:07:24 +0200 From: "Maciej S. Szmigiero" To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 7/8] x86/microcode/AMD: Add a reminder about PATCH_MAX_SIZE macro Date: Sun, 20 May 2018 00:07:21 +0200 Message-Id: <2d8846f7146df1aaf40397025ad4bc94c792b8ff.1526767245.git.mail@maciej.szmigiero.name> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The PATCH_MAX_SIZE macro should contain the maximum of all family patch sizes. Since these sizes are defined in an other place than this macro, let's add a reminder to them so people will remember to verify PATCH_MAX_SIZE correctness when modifying a family patch size or adding a new family. Signed-off-by: Maciej S. Szmigiero --- arch/x86/include/asm/microcode_amd.h | 1 + arch/x86/kernel/cpu/microcode/amd.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h index 209492849566..8ea477fbc65f 100644 --- a/arch/x86/include/asm/microcode_amd.h +++ b/arch/x86/include/asm/microcode_amd.h @@ -41,6 +41,7 @@ struct microcode_amd { unsigned int mpb[0]; }; +/* Maximum patch size of all supported families */ #define PATCH_MAX_SIZE PAGE_SIZE #ifdef CONFIG_MICROCODE_AMD diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 764dac82c03f..cc38182c76d2 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -199,6 +199,10 @@ static bool verify_patch(u8 family, const u8 *buf, size_t buf_size, bool early) patch_size = hdr[1]; +/* + * If you modify these values or add a new one also check whether + * PATCH_MAX_SIZE in include/asm/microcode_amd.h needs updating, too. + */ #define F1XH_MPB_MAX_SIZE 2048 #define F14H_MPB_MAX_SIZE 1824 #define F15H_MPB_MAX_SIZE 4096