Received: by 10.213.65.68 with SMTP id h4csp45878imn; Thu, 15 Mar 2018 16:13:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELvQUDDw2KRf+C1KboS0aDR9qdcgsLb5fl0DvaBxWNAqzKhb3qrtKWTPikB0Cr/gqATZkMtC X-Received: by 2002:a17:902:7083:: with SMTP id z3-v6mr1160704plk.214.1521155615598; Thu, 15 Mar 2018 16:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521155615; cv=none; d=google.com; s=arc-20160816; b=KCN+MWstXZzwa9amvXrtH2rOmQIKnnSiMb3+N9e4jRQLMIZDbuCtPIlyopzDLqMQKq uKcN+BawWeIRr8rcwVo/QEs6xOmf9mHErxtNd2pUw/dmHo4eUyBU0AHv/VkNMEYmnq5U gsGEKzw6rY+kctFmaeM8YEnkcJkPAAxNO9l/X4OXc6xlyiLNahPSJUSFt6X67gVddFq2 Jeoa/LNTxgq6haRDw/vIZS+XfbC86CAaHQy7Szf4sRgkkO+hdO4O75zPkIHw/rzNl9wQ chLG0/IvjjpkaQg3YjdFcV/iP9+iUeWPtwnsj4PL0plartlLGUkimILmdG5MYePpdj27 kLTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from:arc-authentication-results; bh=ilRufdDiA9ErT3MXRc+ve7kIRtxQqMqk+qH9Fy2xKcE=; b=VW+L9ZDKjIAaWMaPODtuSolAsNGl8m9TcfdweavJ1kgAAPyYfkYAZqCA3FyHMMcnJQ dSjOUPokStBDKb84V/d9EaCb8ain05aJZ7dZPAozYmQGIXuUDOC6BC1MI/zm09t1BrgD YFdKlW/8nY+7bRywPOTVy3TNZc23Ej4dks/t+90r4qtfM34AGrKXQV48Q144L3L3eMfA dgC1jrpQrPGkXM/d0JoenNu5AztJsQNltNPHkFnO3i97weT+eITqnMMykRIU8wxZHxbE tiZ1xAJR7FFahuLsuQyWfJx+BJbF0XM61UGdiZlymW4GZUrl8qlrGFqnRuzxRs/h+lZL pxdw== 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 i2si3997320pgq.48.2018.03.15.16.13.22; Thu, 15 Mar 2018 16:13:35 -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 S933061AbeCOXIT (ORCPT + 99 others); Thu, 15 Mar 2018 19:08:19 -0400 Received: from vps-vb.mhejs.net ([37.28.154.113]:47740 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933048AbeCOXIP (ORCPT ); Thu, 15 Mar 2018 19:08:15 -0400 Received: by vps-vb.mhejs.net with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ewbyo-0008SR-5t; Fri, 16 Mar 2018 00:08:14 +0100 From: "Maciej S. Szmigiero" Subject: [PATCH v4 05/10] x86/microcode/AMD: Add a reminder about PATCH_MAX_SIZE macro To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org References: Message-ID: Date: Fri, 16 Mar 2018 00:08:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-8859-2 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 8e8df37f2f1b..eba9e3c8aa17 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -477,6 +477,10 @@ static unsigned int verify_patch_size(u8 family, u32 patch_size, { 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