Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1364511lqa; Mon, 29 Apr 2024 06:43:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+txnPq0JuUqf1Mhh72gp6L4I3wIJSq2TibbBunQ2FLix6Kjbv5+xBDQ3bUC4Hu6EJ0cDizBNeH9V4a8mo6AYvI8gezfhpD3eTUMxuZw== X-Google-Smtp-Source: AGHT+IGdEohIY9PHdxdn2L7PqQ0Azm7XZrv8PB9r2LU+584xUvN9/GLLIteqbZoVuuA6fWaKRSEy X-Received: by 2002:a05:6300:640b:b0:1a7:7306:3677 with SMTP id jr11-20020a056300640b00b001a773063677mr6158733pzc.25.1714398182988; Mon, 29 Apr 2024 06:43:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714398182; cv=pass; d=google.com; s=arc-20160816; b=m5XRievtdXL5VCLD+payMLC/gNWV90zmBtgVz2HoOkFVWM1fWZN5PQFSX8iUN/tE6q RHeuLdKUWiXebh5S9Zs9MrKzRYPASdAJkMx4tWnsue1O1Eq+JldcRgCJz8E08KF6Fvzl NVZniTaLQNu5MvEbMetqeN57vN4h14w/53cD5oB50HYhOndMbcucHm7MiS+SJm1MauSQ J2Aipdk30c2gW1cpZraXUUv13ben2k97OVqGUcPEpRw2Y97tuWlAmnFCOB4hyuEFUtt4 eDuGPYSXRQ5U63gy1r2dXhHYZp2Kt5gwwyMphhNPlxRkG9zPOflqLVi4uRuQLCnH632l dqSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pF5fwzrWofzHeRqjfHcuUa6czVPYaKvsLOZtUlu8jHI=; fh=i1uFnDmLOTnJDQ1XDeOGmrgpRz2O/Dtw3Qgsf2FYudI=; b=T1R00m59a31EdO4QGFYvggSTwRRwJf9BH8IYtODna7lDpC/NAaCOW8dOGGq2FxGiNo HL/4iz13djr0pEk/MG0X4Fj234PuYeh2S084QgeEXgBilAtiziSGQU49MP1VYP9RllNM OTcfTmdjHlB/jCYo0ynBrhdBQtSRFOHUkZV0WR2vSl8Kw/PtmhroLsV6fQC+RVxd2/q3 4As1p85EkkjI4m71P3h2bvFgGwYrsMvXe9NFoGmXaIpNZjobsRcCc2QyVwfwOdE4hBwA dJw951WcMW7d9NFKzyxCDV/bBsqH6ELFJ0kMSUXvKA1A8IPuYsZwSOXn1g9lsfnIfDkO uEWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=L7Sx456c; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-162343-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162343-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k139-20020a628491000000b006ea7e52efe8si16965061pfd.384.2024.04.29.06.43.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 06:43:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162343-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=L7Sx456c; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-162343-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162343-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0611CB2FE23 for ; Mon, 29 Apr 2024 13:13:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F15D74BF5; Mon, 29 Apr 2024 13:13:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="L7Sx456c" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C78A573173; Mon, 29 Apr 2024 13:12:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714396380; cv=none; b=ZV9tafPf3rUKvtnaFbpCBInfvcX7RNUpZQPw90e2dqOxFTKYLeVflCu6JACg4/2aNVJpVlrA2Cs4u8K5XB9Q2tz5J+K9rJ3c0ggwSQ3G3sHV7ZOHNXO5spmXrjQdX54JGqaD9l/+V2eCSQ1btCliag19D3a2vQqofnFTCS+KJTQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714396380; c=relaxed/simple; bh=Gjv6GQm6tKIEB1wure+MOiP8JZurMkwVMIydiu6f3hg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pqpyKydvtQ1SAIM/jk1wW0YllNkpUnxCPV9yHTRhT5SFed7iAz/NSXs2ep9ZgSWEm1jD1QLp6fkrycEhir8x9nujyoeV3EBCACgKUxG/BZwC51aOHsmvRJBVcvqcNWJGK0KAiD3sgeP92HUhU7utk206E6HQK9srmLvsWqUT/XQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=L7Sx456c; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 8808640E016B; Mon, 29 Apr 2024 13:12:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9DIf3t46BTH8; Mon, 29 Apr 2024 13:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1714396372; bh=pF5fwzrWofzHeRqjfHcuUa6czVPYaKvsLOZtUlu8jHI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=L7Sx456cMy8w6aCr4DVOS/3/IbTz82l3iPLfW7pBsMhtwvxb+NNWWDU+2k5YyOhXv JKlN9cVN0ysUTBl/ARoiomeoNHgY1mXf0XVU61BoXjGBnK1UrAUlvWwwFtIHHwjk9Z rXAAQqO8Gu2zFUv+NPlRW1a3FjiH9f8b/WbmetQpM0A0Ubsup/MEEd0P+5eIhXQCgP YjXwgfGlytPQIPbWh/q5op+yq9HvRmBgIdezxgBcyNARlYkl3Z142LownRJ9ipLw2f oONAZ9Zhb9LkmGWVprR23CI2W820WN8bUKanCuuP2E850vYjlW/PhfoKM+kmiiLOGz dkbghADD9J+6VBRrjQDYGfq1wBK7lhemfuAu4JR7f+8ZCdEI1ev61IqqQzoZbkKJ7f sIl0BtVxBeH4sl5RtbeCPt4n0SglxSIKwmAivQwP317ugDMn9MObrExdbWo1x7bhFb MbTrf+8nZQWVG2fVmmva7twF9srz7/3qMjVU+BqktOxJY4KhdtUgm7arMtkkaTWQwB r0L2+w8gtw5aIiFRItyQzlCljOUXEykEaNLW4DWQWnlBtJ/2cogeSS5YrneDpiwbMV BNgj2TtH2s7oGENT58lLBCjCn8AqrKlpYWYMOSiNNdnbeWKz0MKr5r7ApCoa5Zxsg+ R/mbMbNdPR3ZmfKAI41yO9Fc= Received: from zn.tnic (pd953020b.dip0.t-ipconnect.de [217.83.2.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id B60EE40E00C7; Mon, 29 Apr 2024 13:12:45 +0000 (UTC) Date: Mon, 29 Apr 2024 15:12:40 +0200 From: Borislav Petkov To: Yazen Ghannam Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, tony.luck@intel.com, x86@kernel.org, Avadhut.Naik@amd.com, John.Allen@amd.com Subject: Re: [PATCH v2 08/16] x86/mce/amd: Clean up enable_deferred_error_interrupt() Message-ID: <20240429131240.GOZi-cyLh2OhRrNTWM@fat_crate.local> References: <20240404151359.47970-1-yazen.ghannam@amd.com> <20240404151359.47970-9-yazen.ghannam@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240404151359.47970-9-yazen.ghannam@amd.com> On Thu, Apr 04, 2024 at 10:13:51AM -0500, Yazen Ghannam wrote: > -/* Deferred error settings */ > +/* MCA Interrupt Configuration register, one per CPU */ SMCA? > #define MSR_CU_DEF_ERR 0xC0000410 > -#define MASK_DEF_LVTOFF 0x000000F0 > -#define MASK_DEF_INT_TYPE 0x00000006 > -#define DEF_INT_TYPE_APIC 0x2 > +#define MSR_MCA_INTR_CFG 0xC0000410 You do see those other MSRs' prefixes, right? MSR_AMD64_SMCA_... Is this one not part of the SMCA arch? > +#define INTR_CFG_DFR_LVT_OFFSET GENMASK_ULL(7, 4) > +#define INTR_CFG_LEGACY_DFR_INTR_TYPE GENMASK_ULL(2, 1) > #define INTR_TYPE_APIC 0x1 Ditto for its bit(s) names. > +static u64 get_mca_intr_cfg(void) > +{ > + u64 mca_intr_cfg; > + > + if (!mce_flags.succor) > + return 0; > + > + if (rdmsrl_safe(MSR_MCA_INTR_CFG, &mca_intr_cfg)) > + return 0; > + > + return mca_intr_cfg; > +} This is an overkill. If we add a function for every MSR we're reading... Do this differently: prepare the value you're writing back into the INTR_CFG MSR once, save it into mca_intr_cfg and then write it on each core at the end of enable_deferred_error_interrupt(). And make u64 mca_intr_cfg static global to amd.c so that you can refer to it from outside of the functions and then you don't have to pass it around as a function param. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette