Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2566740rdg; Mon, 16 Oct 2023 08:11:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4IVYwgLS5aLB5g55QQeR8fFahbpkMRdjUDpE2c3lOBhrPS3r2sKtpSORKi/SFQa5hQb4c X-Received: by 2002:a05:6358:924:b0:14c:ff8a:6501 with SMTP id r36-20020a056358092400b0014cff8a6501mr45206444rwi.0.1697469105379; Mon, 16 Oct 2023 08:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697469105; cv=none; d=google.com; s=arc-20160816; b=P4+vm9QOzIj9Km7WNsElWVrTvNRYOiDnTiF2+if2nlPCj2CM7iv1vPWpJgN6lWLQ+g 9fRAwshqQmlO5rwJ3uU7CN1dSy2UZ3rfyHd74NX/MqL60tagGJcoFNrfhH0ck+2UwHZE Y3aDYnYG2l4HgucZOYoMyb6aHGfhzvkG0VBc+GIoGUkSp8v/P310MoZc+tvjnHTG/bwR iST76YWB4egAQIG/e9Uz1seDs7v9NbaImpt3MX/XsP95TlPpURP1BW7aNDHlXBCb2bTm q4mbwzndBvsJBpDF1yFnJ1S9pICyaK8QuBkCh0HWJOrYoRO9Ml3ZvCt58ZKKYrpNob6f pnRA== 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=0HSqwtzP/+WQaUFenbRCHU2YchOeyfz+hFejfv5vy9Q=; fh=3Y7Ht7EWw/18yRcMHQle9GJUsayF3jozSVIhvuxV6QI=; b=isI5QKw9pijcqioBKlnt7ERdRbAVn90BbPeQEDNKOi/dKM1WAo25T2xmRPlyHC7bqX v8BTzW3Xe6bgD8C9JmHcfH+Vyd5+gM6vQy33xJ8nX4HTcqWb1ToYOqo1QSCV3hfh/Kgb WGufQYV+UssokkTZ8p69R3MS42aWwCURTIiuk95KFXNesKTLJ1H7ifOx73/c/bGGiHV7 5E61McDjSVCnATf4TZEwMfLP8XDnF1VvTM2rE7EKPtKWafJZ8DkEwV2oz7SlA/hvcN34 kZ9hOvgBvsY+CQekhpx4eXjpyE8XE3kfq2DKcMl//O4UdP3wXT/4OeaICsIfdqSO+TbG 29UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Lz7DSCZ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id y12-20020aa79aec000000b006b69f056508si336pfp.149.2023.10.16.08.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 08:11:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Lz7DSCZ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 486DC804BC04; Mon, 16 Oct 2023 08:11:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233630AbjJPPLU (ORCPT + 99 others); Mon, 16 Oct 2023 11:11:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233109AbjJPPLR (ORCPT ); Mon, 16 Oct 2023 11:11:17 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0058B4; Mon, 16 Oct 2023 08:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697469075; x=1729005075; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=uxO8dRQXoxiQRzj4bSvfq5YWcf3cm6PAVAbnFH5KNhU=; b=Lz7DSCZ6Qq83VBiBTUoHt0u39JVrJALiGMraS+hrn2Xs4NXbTyhYjKrl W45kJOAf3/YUo4kgVYBQI+8FFMi3mHRFlCgmlUTB6B08DzMGPYfeag0CO KqNJBPcE+zI6Gx+xS+MjoEQ7s8i2ZmHyopFushKlygxICRRqNrkWVtaNj nxfgzzdei73AfAQOaZvvna8yZ/saIahjNjzzEo3CaVG//lwyitMoY9vMK erd7cHxV1vGD+AR5t/DpJYdiQIFD6kFjG+znLekaDoSVM1KZ/owlL0Tlb PRBXIySWrbQDs7M+oNu2QSxeNzSpcbJQBPnTSpqQBT6SPW0c/EynOlPw5 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10863"; a="365809070" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="365809070" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 08:10:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10863"; a="785112698" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="785112698" Received: from rhaeussl-mobl.ger.corp.intel.com (HELO bhoerz-mobl1.ger.corp.intel.com) ([10.252.59.103]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 08:10:41 -0700 Date: Mon, 16 Oct 2023 18:10:39 +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: <3df6c8ea-888e-faa-5bae-e26b1f446ab3@linux.intel.com> Message-ID: <524d1789-6b57-aae-17b7-bf7ae49719dc@linux.intel.com> References: <20231013200249.GA1123559@bhelgaas> <3df6c8ea-888e-faa-5bae-e26b1f446ab3@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-245311799-1697469043=:1986" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 08:11:42 -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-245311799-1697469043=:1986 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Mon, 16 Oct 2023, Ilpo Järvinen wrote: > 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. Err, actually, there's still the naming of the define, should _FEP be used for First Error Pointer for consistency? You should make that small change into your patch if you think _FEP is better because of consistency. -- i. --8323329-245311799-1697469043=:1986--