Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1749726pxb; Mon, 20 Sep 2021 04:33:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpfQXHHnlBDb1QB06MwUa1DGnUcNxLfgY7m1OgCgBl7kHiA50XwsehephtTm6L/X+7yvl9 X-Received: by 2002:a6b:144c:: with SMTP id 73mr2670006iou.174.1632137606922; Mon, 20 Sep 2021 04:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632137606; cv=none; d=google.com; s=arc-20160816; b=d5COSXs34r3hJPwtEt3Acbe6mOhhtGORUvORJL3B0fvfvBhL/Ym6Dy0o/CWMZqLYN2 BxGWB/hRaiWGW8bwIPZJ4fe4xQSZo0Q2r/2JhIIzOKcwdmZ6q9Om2gJBHwAXbIVwod/Z PYetdTl7fPg1uADPE02CLbu/zn7oIL1CeE5bFjIvwkon0KllOf51/3xDJy4wMXHQEnFM EKJz6CTm1v0hsITu4SWWJLCN0ohVwWqggOnL5N5Fno5ZnCPAu5VWAjhUisL/pPH+sVtA tc14jBMGJmtlKe3Q9x0IaPtlHOlhQbltAGff9xpbeHnYttrBmcHlwx3wFXZZfZk7moDS dJaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=VbdrVi6S6ti5NBOl50z7vwbQ48gRB+cMQKzuDT80vqg=; b=t431MXApavhptIDCbMzLCUG7gR6meNMS+aMgKKpbx4dsYWVJJyqLlhEiVUzD8N3t3o R5TmMCRbe1ELmYu5QLA7EQW5lKY3gGVC4LIPji1c5J4yFwE2ZWjUYvkD++MZRIWyplCU KUFmic9mkgrlCp1JRdSXMwVoFmfesJqp+t8Hl4ZtvOJqVJsKQ0AeoDQlfehxe1ZNU+dc o04PoWr+2UqSpo0aJk0j8hsP+3szPMx5iC5IPOG4VJFi3HrVpnWTLqinUGTAaZcU0KMR CIG34GlOL6elsowej1ktMIM+qpbBNcOGX0XYBQkNnNODLRZbZvrrNVPnEh+V+7liGq5E j7QQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a24si7244976ioc.90.2021.09.20.04.33.07; Mon, 20 Sep 2021 04:33:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230315AbhITEtT (ORCPT + 99 others); Mon, 20 Sep 2021 00:49:19 -0400 Received: from mga09.intel.com ([134.134.136.24]:23744 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbhITEtT (ORCPT ); Mon, 20 Sep 2021 00:49:19 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10112"; a="223100333" X-IronPort-AV: E=Sophos;i="5.85,307,1624345200"; d="scan'208";a="223100333" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2021 21:47:52 -0700 X-IronPort-AV: E=Sophos;i="5.85,307,1624345200"; d="scan'208";a="532043668" Received: from agluck-desk2.sc.intel.com (HELO agluck-desk2.amr.corp.intel.com) ([10.3.52.146]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2021 21:47:52 -0700 Date: Sun, 19 Sep 2021 21:47:51 -0700 From: "Luck, Tony" To: Borislav Petkov Cc: Yazen Ghannam , X86 ML , LKML Subject: Re: [PATCH 3/4] x86/mce: Get rid of msr_ops Message-ID: References: <20210917105355.2368-1-bp@alien8.de> <20210917105355.2368-4-bp@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210917105355.2368-4-bp@alien8.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 17, 2021 at 12:53:54PM +0200, Borislav Petkov wrote: > + switch (reg) { > + case MCA_CTL: > + return mce_flags.smca ? MSR_AMD64_SMCA_MCx_CTL(bank) > + : MSR_IA32_MCx_CTL(bank); > > -static inline u32 smca_ctl_reg(int bank) > -{ > - return MSR_AMD64_SMCA_MCx_CTL(bank); > -} > + case MCA_STATUS: > + return mce_flags.smca ? MSR_AMD64_SMCA_MCx_STATUS(bank) > + : MSR_IA32_MCx_STATUS(bank); > > -static inline u32 smca_status_reg(int bank) > -{ > - return MSR_AMD64_SMCA_MCx_STATUS(bank); > -} > + case MCA_ADDR: > + return mce_flags.smca ? MSR_AMD64_SMCA_MCx_ADDR(bank) > + : MSR_IA32_MCx_ADDR(bank); > > -static inline u32 smca_addr_reg(int bank) > -{ > - return MSR_AMD64_SMCA_MCx_ADDR(bank); > -} > + case MCA_MISC: > + return mce_flags.smca ? MSR_AMD64_SMCA_MCx_MISC(bank) > + : MSR_IA32_MCx_MISC(bank); > + default: break; > + } I think this would be easier on the eyeballs with a couple of helper functions: if (mce_flags.smca) return smca_msr_number(bank, reg); else return msr_number(bank, reg); with the switch (reg) in each of those helper functions. -Tony