Received: by 10.192.165.148 with SMTP id m20csp3900171imm; Mon, 23 Apr 2018 14:39:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx48+9bXBwdIgwyMzWmKPN59uScAovn2tKEV0BZmwqsy/sJMSLrvHpflND8cQQzLQh7dziD6p X-Received: by 10.101.83.139 with SMTP id x11mr18612133pgq.15.1524519541005; Mon, 23 Apr 2018 14:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524519540; cv=none; d=google.com; s=arc-20160816; b=laruSOIpvdKCa56ZYhod3t/oFbRFOH/OXPFAvnvgnFPlprMXwiMbErSEnCitfZRYeI CTZZ9E88mm7m1Nhd9Hzvhq9YS+HYyAV2K4WYA7zlsPrL4PFA6Jzp+3Tv6K3ScYAIMkoP YrBCUb3Z+HJUCJVAhZ3MP7JbbgaW75NaC7lqmehNEZfr9CxvNLwT9fVKkr1ps6pGS1gn Ml9F4NGpYp142+0lRYKK6PoNec3ZFLghGsOBRTb2PIoj1QoCwr1ApX8+dLB9veoLeXcK mvSo1Ny0QcuvCvAQogdckkrDVUJKno0nfsWzZa7uAL/4NewmP064uWCTQNgVczXCtStn yQKg== 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=ObrpDiutGQpOBM41TwaPGctm5BcIMXwW+RVezm6/5nA=; b=oXFmQNf50FmCGmEyzhujK6Y4ELLjosajLJqsjoCAkiCf+GlmxnvqG+cpg3M3rqRGK6 unEcu1ynQNLXx0RSvwHYx4Z595VD/vc7tFhAOk5VovyM+cgrjC8k9eTLecIqRv7lB/aD DeyBPO/fbHvY/l4Xuy2TCtTSGxMjCfNPEskmxlD0JTB8hs5gUUTU+eRWOlUfYhyHY8Gx VTaoY1/4eIpan7qnwqdzcYc6cpJ0/uXwX7P44CgWVOjgJdxmU0mP9CXCuPu4V3QEudbH DGE++B9vBrVGcGsJDp7gRqejeHoa41jf78tmj1lf4PIpGA3hsD3TxVwAOWumLtP4BTSl OfkA== 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 e68si6896448pfl.132.2018.04.23.14.38.46; Mon, 23 Apr 2018 14:39:00 -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 S932514AbeDWVen (ORCPT + 99 others); Mon, 23 Apr 2018 17:34:43 -0400 Received: from vps-vb.mhejs.net ([37.28.154.113]:40960 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932393AbeDWVej (ORCPT ); Mon, 23 Apr 2018 17:34:39 -0400 Received: by vps-vb.mhejs.net with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1fAj6D-0004wR-Hc; Mon, 23 Apr 2018 23:34:13 +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 v5 5/6] x86/microcode/AMD: Add a reminder about PATCH_MAX_SIZE macro Date: Mon, 23 Apr 2018 23:34:10 +0200 Message-Id: <5fa090d07429c8b4ce2a8a141f8c861011a5409a.1524515406.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 b429d3f554b9..2df366cc71ce 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -605,6 +605,10 @@ static unsigned int verify_patch_size(u8 family, u32 patch_size, unsigned int si { u32 max_size; +/* + * 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