Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2476257rdg; Mon, 16 Oct 2023 05:56:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyXic8E9eohmo5nFyhzMz89AJunYSTS8STGaqdPtDMgntrfpB1i2aSrP9gTMdw2IbJZ8cp X-Received: by 2002:a05:6a00:2386:b0:6bc:f819:fcf0 with SMTP id f6-20020a056a00238600b006bcf819fcf0mr6173446pfc.1.1697461008630; Mon, 16 Oct 2023 05:56:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697461008; cv=none; d=google.com; s=arc-20160816; b=CeYHXU26Hinj5ja+hGW+RAQBAPczq0IizFF4/5tyxR+pbiTieGwyq11IgjwlHt6urY sGHqEiNDJYCIIpOPxlE3qGhSUwx42/6SeUWCwHakdBaqK8yhyrXQT8qNbyNY9TzJFuXT kj83KTjqN+84hwdxwHLYX3fJQmpK59EgxYC/w/mqPXwixtL9/5+2cmlfzJZxjnG0Y+f1 q3jCYnPaK8Co7XP/zbQ2X/5Ae7RD6Tt7KzwYM0ZC5lewmTbM9Ku48Gp1Df7NZ11JX2xP kh5cORJj5Vdu3684EP+68LYW68wo2T+NNNYBOsX1J0RxQMXWKbxexmhy7AgzAqy6VWqw QUCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=Ba3RlEOw8TYI5p+lPsJeXHgK0nrBPB7dkR+l0mJVh2Q=; fh=3Y7Ht7EWw/18yRcMHQle9GJUsayF3jozSVIhvuxV6QI=; b=BsW3F5BeSirKRryYr6315i82MlWya1OMGwtA4p0pC9yFrE7/lqbSDdCGtkc9Dyg4M/ LJ3tpATpH97YoddVi0r/W6Kf17HN3MpQvLb71guv6L1o/Wr0txZGz8jN7uU7a+y71stL dY22USW9NIJf5h4Js9WPVFdciGUOAg2fYxrceDbH0Tu0q2zlgBoKMyxDz16Cf3OqUhbr stJo9Ct2E6CTsq+2fWAorEhOJJ5aEIk8PQm9YBFbqJHU8y2ry5VHTUO+S4xbbjjeORR0 Wn66rves/rW7Hmdp0IjVRiKruRsCM3+e7e9tsaOJR4fifDraYE93V9IwTas3OCu2iQK3 FzQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aargCBS+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id v2-20020a056a00148200b0068fb5ca50cdsi23876442pfu.126.2023.10.16.05.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 05:56:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aargCBS+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E366880941C9; Mon, 16 Oct 2023 05:56:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232097AbjJPM4M (ORCPT + 99 others); Mon, 16 Oct 2023 08:56:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233501AbjJPM4E (ORCPT ); Mon, 16 Oct 2023 08:56:04 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE43BAD; Mon, 16 Oct 2023 05:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697460962; x=1728996962; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=L+WApuyahikeC/ONjZM0yJBCNYeGV+unFwJga+bJWwk=; b=aargCBS+ovtYUVEd8iPLQT8acgziPO7elpg1a4QIXmMe4Raktip+3dJk 9AA0j0AZdXfPs0bBpj5XZLy8rJID7Wy9C66QV5tfbdrjXtu7++I/b6rBF b7R36+EtzZZNs8OcELAGbVUu+WBJMkQXhmFjPMulaskHRQ5yjAQZzI93E cFVALib9oeQNf9fl7F9JZv0dPvkUZmZ6ZtnQlNtv+RgbNWDQmf+wD1Z4y NiH70tF6ZrJfZziLt//CYcJIz1ak3g1A9hQ35XopLgsw3p1tBO5MnxKT3 7HnR3Ob/mROzQrpkxMxdE0bIOZhT05r8HvQWIa3IgJCFbIwNE27h4B1tt Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10863"; a="471742466" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="471742466" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 05:56:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="3524820" Received: from rhaeussl-mobl.ger.corp.intel.com (HELO bhoerz-mobl1.ger.corp.intel.com) ([10.252.59.103]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 05:54:55 -0700 Date: Mon, 16 Oct 2023 15:55:57 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Bjorn Helgaas cc: linux-pci@vger.kernel.org, Jonathan Cameron , =?ISO-8859-2?Q?Krzysztof_Wilczy=F1ski?= , Lorenzo Pieralisi , LKML , Bjorn Helgaas Subject: Re: [PATCH 06/10] PCI/DPC: Use FIELD_GET() In-Reply-To: <20231013200249.GA1123559@bhelgaas> Message-ID: <3df6c8ea-888e-faa-5bae-e26b1f446ab3@linux.intel.com> References: <20231013200249.GA1123559@bhelgaas> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1675609082-1697460962=:1986" X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 05:56:21 -0700 (PDT) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1675609082-1697460962=:1986 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Fri, 13 Oct 2023, Bjorn Helgaas wrote: > On Wed, Oct 11, 2023 at 02:01:13PM +0300, Ilpo Järvinen wrote: > > On Tue, 10 Oct 2023, Bjorn Helgaas wrote: > > > From: Bjorn Helgaas > > > > > > Use FIELD_GET() to remove dependences on the field position, i.e., the > > > shift value. No functional change intended. > > > > > > Signed-off-by: Bjorn Helgaas > > > --- > > > drivers/pci/pcie/dpc.c | 9 +++++---- > > > drivers/pci/quirks.c | 2 +- > > > include/uapi/linux/pci_regs.h | 1 + > > > 3 files changed, 7 insertions(+), 5 deletions(-) > > > > > > diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c > > > index 3ceed8e3de41..6e551f34ec63 100644 > > > --- a/drivers/pci/pcie/dpc.c > > > +++ b/drivers/pci/pcie/dpc.c > > > @@ -8,6 +8,7 @@ > > > > > > #define dev_fmt(fmt) "DPC: " fmt > > > > > > +#include > > > #include > > > #include > > > #include > > > @@ -202,7 +203,7 @@ static void dpc_process_rp_pio_error(struct pci_dev *pdev) > > > > > > /* Get First Error Pointer */ > > > pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &dpc_status); > > > - first_error = (dpc_status & 0x1f00) >> 8; > > > + first_error = FIELD_GET(PCI_EXP_DPC_STATUS_FIRST_ERR, dpc_status); > > > > > > for (i = 0; i < ARRAY_SIZE(rp_pio_error_string); i++) { > > > if ((status & ~mask) & (1 << i)) > > > @@ -270,8 +271,8 @@ void dpc_process_error(struct pci_dev *pdev) > > > pci_info(pdev, "containment event, status:%#06x source:%#06x\n", > > > status, source); > > > > > > - reason = (status & PCI_EXP_DPC_STATUS_TRIGGER_RSN) >> 1; > > > - ext_reason = (status & PCI_EXP_DPC_STATUS_TRIGGER_RSN_EXT) >> 5; > > > + reason = FIELD_GET(PCI_EXP_DPC_STATUS_TRIGGER_RSN, status); > > > + ext_reason = FIELD_GET(PCI_EXP_DPC_STATUS_TRIGGER_RSN_EXT, status); > > > pci_warn(pdev, "%s detected\n", > > > (reason == 0) ? "unmasked uncorrectable error" : > > > (reason == 1) ? "ERR_NONFATAL" : > > > > BTW, it seems we're doing overlapping work here with many of these > > patches. It takes some time to think these through one by one, I don't > > just autorun through them with coccinelle so I've not posted my changes > > yet. > > > > I went to a different direction here and named all the reasons too with > > defines and used & to get the reason in order to be able to compare with > > the named reasons. > > > > You also missed convering one 0xfff4 to use define (although I suspect it > > never was your goal to go beyond FIELD_GET() here). > > Pure FIELD_GET() and FIELD_PREP() was my goal. > > If you have patches you prefer, I'll drop mine. I did these about a > year ago and it seemed like the time to do something with them since > you did the PCI_EXP_LNKSTA_NLW ones and to try to prevent overlapping > work. Since we've started, I'd like to get as much of it done this > cycle as possible. Okay, I suggest you keep your FIELD_GET/PREP() patch since mine is getting more and more complicated. I can build a nice set of small changes about what remains to do in DPC on top of your patch. -- i. --8323329-1675609082-1697460962=:1986--