Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1242692rdb; Fri, 2 Feb 2024 21:00:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsoWzbmaZsi2iP76AC1nkISHqFF+uha3kw6kET0Yzch23I9kkI8VrFfD/h7ZisbLI74Hvq X-Received: by 2002:ac8:6e8a:0:b0:42a:9d03:1c1d with SMTP id c10-20020ac86e8a000000b0042a9d031c1dmr269436qtv.63.1706936424880; Fri, 02 Feb 2024 21:00:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706936424; cv=pass; d=google.com; s=arc-20160816; b=nycCgPjrJJnUDStUNJchIUhFnL7ApTZoUiedSr97URnuMYc/YExir2CiP0mPjYtwkd io0TIp5Ta2piROUN+6N7YYIKskA82U4WjQaBxqoClnqoeIdo46eX8y/IKZZ8caIFs8j7 Tt4bjih8xWPmi5MYJTx6hhpZYv5UU0I/09IItMoNTGF6Iq1ojZNKz8FtXbJJzIASOnse ppBE40gnTOMjkI599L1hRZDl1aSeEFdThX+6BYMtq1CsT1PbhaRfo2tC2bHwbTa1Jvmm zSgKl+MfkNgoSbHijwPUeuhBiRB1ir5zw0eCVBlwPyXVRQIMD99+oqMvy/pz8cTEvI8e nX9Q== 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=5O/S0PSvEhz/4NBJczMOKTqvs+ZEh1zOdxmtNC1hm0w=; fh=WhhMkHdbjc4vwvqQS7v3H/6R0n42/FqYYOtMVV9c3HI=; b=0o1YmjkeSAHYeSOJVFYHxpxE/k6t7iBZtDwN/YbCtgHMtnkXSsOkb4KoNhbnQvj7rz 2c73P66nZjYVpnuTph4vLphk0kSE9ZSvYMSgRPWu+dEN1h2ZzbTwMTh93Ho8KnSiA0F5 1nJKIAMBesX2OyiyNdMtnO6EtjtlUmUQV/hsaWcjp6zJCx+SafgEp4WyW0/w/+BCGESe Df1ccaIUzsU3APGuy5fQDKbiVLgOZ9nCyrJXdbGFzqIKCFhxOzB4UreezG8n9rM+TtMs 7xNK0QO0teI559kyWcEXfFF1FgFMZAPDRxipuMLljUyxSm2v5G8KIiQXXvlgMSm/e33G pEfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SbS81VZA; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-50926-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50926-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCWXx4f7mfwQN9iKFBn/Cd58IhS2xsubbJ3qSoR1TwHAY97KOa6F6mIxOysf+QDdCbd8grJ8iReV3862UieyOEjSqKw7245VNE82VPrpJg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w21-20020a05622a135500b0042ab6f11a5bsi3607172qtk.20.2024.02.02.21.00.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 21:00:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50926-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SbS81VZA; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-50926-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50926-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 22C2E1C234C4 for ; Sat, 3 Feb 2024 05:00:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9E1D10A13; Sat, 3 Feb 2024 05:00:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SbS81VZA" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 E100A10A05; Sat, 3 Feb 2024 05:00:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706936405; cv=none; b=P5ovPdUiYgtfwRWcJmZg6ZZcoNB/5q2u2BZtMyGpV6mInapeeGsCYnVA17jToVdcxmQgt+IBvweeWGeC2BbCiDyrbWHuvnL/nsPIl0jwZ/HeWGz11Jv2GxrsHQfXOmDacAw3g13jS3ywFnaOjhAi8bkgETEH7T9VEiJISm9HtXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706936405; c=relaxed/simple; bh=kf32GCMyGnr3JaXaP9xyzsdixQItASwsYvGjp9HHTXk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TB3y9Q0AUKKVb81CWMomeMCriqKxy4XpouzMXA2tLPBvt3z0yBskKZ6+SPIMfDpdAzeBGQuYFzbOVTCKjpljOnJBvKTZc8veuCMBa9JFVnTYrp0nndeXy7Cx/wc2PMNaFonVxY3aVHB1OnIcOKAfwIvLJ5RlUDn70t3dBL7zEc0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SbS81VZA; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706936403; x=1738472403; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=kf32GCMyGnr3JaXaP9xyzsdixQItASwsYvGjp9HHTXk=; b=SbS81VZAv5S+EOobk9KXTvNfPX/6dpAqB9C0l48s2CHCgT0WwbEaxH56 mkMlP96PqtoPb+Aiu0R5Zu0LxFa2gVw4l2gpk8AxZQdu9bM58A/H11+PD MbZw3xVTzOF7OyA3oXfaHY3NqkubvLu9VELFJdWxdXQ4oVCZbpGmtSIqJ 2np2EvhQlQIt0CEFkH0b9e0WMgyRUlfUP9gw0GA347QDessqWFGvUcoMk GqnHiOns927QYRkwBGlf0APC95leddZNASZ7ZsXhLfWVM02uCoqSSMUKB 5GGvaWF3Htm0RYxIhOH1MTmi6ECTGDNWsbZ3GBFfkn5i8b0eDrkpauOrA g==; X-IronPort-AV: E=McAfee;i="6600,9927,10971"; a="193956" X-IronPort-AV: E=Sophos;i="6.05,238,1701158400"; d="scan'208";a="193956" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2024 21:00:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,238,1701158400"; d="scan'208";a="4864772" Received: from yanqiu-mobl.ccr.corp.intel.com (HELO localhost) ([10.254.214.166]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2024 20:59:53 -0800 Date: Sat, 3 Feb 2024 12:59:44 +0800 From: "Wang, Qingshun" To: Dan Williams Cc: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, chao.p.peng@linux.intel.com, erwin.tsaur@intel.com, feiting.wanyan@intel.com, qingshun.wang@intel.com, "Rafael J. Wysocki" , Len Brown , James Morse , Tony Luck , Borislav Petkov , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Bjorn Helgaas , Bjorn Helgaas , Mahesh J Salgaonkar , Oliver O'Halloran , Miaohe Lin , Shiju Jose , Adam Preble , Li Yang , Lukas Wunner , Kuppuswamy Sathyanarayanan , Smita Koralahalli , Robert Richter , linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org, linux-edac@vger.kernel.org Subject: Re: [PATCH v2 3/4] PCI/AER: Fetch information for FTrace Message-ID: <7ajtd5skxgfkkwolsbxrd7y2yzfjsikffkg4shxvpumconc2rz@i7hk4gvirrx2> References: <20240125062802.50819-1-qingshun.wang@linux.intel.com> <20240125062802.50819-4-qingshun.wang@linux.intel.com> <65bd2e04aed44_2d43c29463@dwillia2-mobl3.amr.corp.intel.com.notmuch> 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=us-ascii Content-Disposition: inline In-Reply-To: <65bd2e04aed44_2d43c29463@dwillia2-mobl3.amr.corp.intel.com.notmuch> On Fri, Feb 02, 2024 at 10:01:40AM -0800, Dan Williams wrote: > Wang, Qingshun wrote: > > Fetch and store the data of 3 more registers: "Link Status", "Device > > Control 2", and "Advanced Error Capabilities and Control". This data is > > needed for external observation to better understand ANFE. > > > > Signed-off-by: "Wang, Qingshun" > > --- > > drivers/acpi/apei/ghes.c | 8 +++++++- > > drivers/cxl/core/pci.c | 11 ++++++++++- > > drivers/pci/pci.h | 4 ++++ > > drivers/pci/pcie/aer.c | 26 ++++++++++++++++++++------ > > include/linux/aer.h | 6 ++++-- > > 5 files changed, 45 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c > > index 6034039d5cff..047cc01be68c 100644 > > --- a/drivers/acpi/apei/ghes.c > > +++ b/drivers/acpi/apei/ghes.c > > @@ -594,7 +594,9 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata) > > if (pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID && > > pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) { > > struct pcie_capability_regs *pcie_caps; > > + u16 device_control_2 = 0; > > u16 device_status = 0; > > + u16 link_status = 0; > > unsigned int devfn; > > int aer_severity; > > u8 *aer_info; > > @@ -619,7 +621,9 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata) > > > > if (pcie_err->validation_bits & CPER_PCIE_VALID_CAPABILITY) { > > pcie_caps = (struct pcie_capability_regs *)pcie_err->capability; > > + device_control_2 = pcie_caps->device_control_2; > > device_status = pcie_caps->device_status; > > + link_status = pcie_caps->link_status; > > } > > > > aer_recover_queue(pcie_err->device_id.segment, > > @@ -627,7 +631,9 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata) > > devfn, aer_severity, > > (struct aer_capability_regs *) > > aer_info, > > - device_status); > > + device_status, > > + link_status, > > + device_control_2); > > } > > #endif > > } > > diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c > > index 9111a4415a63..3aa57fe8db42 100644 > > --- a/drivers/cxl/core/pci.c > > +++ b/drivers/cxl/core/pci.c > > @@ -903,7 +903,9 @@ static void cxl_handle_rdport_errors(struct cxl_dev_state *cxlds) > > struct aer_capability_regs aer_regs; > > struct cxl_dport *dport; > > struct cxl_port *port; > > + u16 device_control_2; > > u16 device_status; > > + u16 link_status; > > int severity; > > > > port = cxl_pci_find_port(pdev, &dport); > > @@ -918,10 +920,17 @@ static void cxl_handle_rdport_errors(struct cxl_dev_state *cxlds) > > if (!cxl_rch_get_aer_severity(&aer_regs, &severity)) > > return; > > > > + if (pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &device_control_2)) > > + return; > > + > > if (pcie_capability_read_word(pdev, PCI_EXP_DEVSTA, &device_status)) > > return; > > > > - pci_print_aer(pdev, severity, &aer_regs, device_status); > > + if (pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &link_status)) > > + return; > > + > > + pci_print_aer(pdev, severity, &aer_regs, device_status, > > + link_status, device_control_2); > > Rather than complicate the calling convention of pci_print_aer(), update > the internals of pci_print_aer() to get these extra registers, or > provide a new wrapper interface that satisfies the dependencies and > switch users over to that. Otherwise multiple touches of the same code > path in one patch set is indicative of the need for a higher level > helper. Thanks for the advice, it does make sense. Will reconsider the implementation. -- Best regards, Wang, Qingshun