linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: linux-pci@vger.kernel.org,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH 06/10] PCI/DPC: Use FIELD_GET()
Date: Mon, 16 Oct 2023 18:14:13 +0300 (EEST)	[thread overview]
Message-ID: <8ca2ad3-da7d-c82c-cbdf-b5363760444e@linux.intel.com> (raw)
In-Reply-To: <524d1789-6b57-aae-17b7-bf7ae49719dc@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 3901 bytes --]

On Mon, 16 Oct 2023, Ilpo Järvinen wrote:

> 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 <bhelgaas@google.com>
> > > > > 
> > > > > Use FIELD_GET() to remove dependences on the field position, i.e., the
> > > > > shift value.  No functional change intended.
> > > > > 
> > > > > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> > > > > ---
> > > > >  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 <linux/bitfield.h>
> > > > >  #include <linux/aer.h>
> > > > >  #include <linux/delay.h>
> > > > >  #include <linux/interrupt.h>
> > > > > @@ -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.

There's also #include order so it seems you should just drop the patch, I 
can handle this along my series.

-- 
 i.

  reply	other threads:[~2023-10-16 15:14 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10 20:44 [PATCH 00/10] PCI: Use FIELD_GET() and FIELD_PREP() Bjorn Helgaas
2023-10-10 20:44 ` [PATCH 01/10] PCI: Use FIELD_GET() Bjorn Helgaas
2023-10-11 10:50   ` Jonathan Cameron
2023-10-11 11:24   ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 02/10] PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk Bjorn Helgaas
2023-10-11 10:59   ` Jonathan Cameron
2023-10-11 11:31   ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 03/10] PCI/ASPM: Use FIELD_GET() Bjorn Helgaas
2023-10-10 21:07   ` Bjorn Helgaas
2023-10-10 20:44 ` [PATCH 04/10] PCI/ATS: Show PASID Capability register width in bitmasks Bjorn Helgaas
2023-10-11 11:00   ` Jonathan Cameron
2023-10-11 11:31   ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 05/10] PCI/ATS: Use FIELD_GET() Bjorn Helgaas
2023-10-11 11:02   ` Jonathan Cameron
2023-10-11 11:20   ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 06/10] PCI/DPC: " Bjorn Helgaas
2023-10-11 11:01   ` Ilpo Järvinen
2023-10-13 11:23     ` Ilpo Järvinen
2023-10-13 20:02     ` Bjorn Helgaas
2023-10-16 12:55       ` Ilpo Järvinen
2023-10-16 15:10         ` Ilpo Järvinen
2023-10-16 15:14           ` Ilpo Järvinen [this message]
2023-10-11 11:07   ` Jonathan Cameron
2023-10-11 11:13     ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 07/10] PCI/PME: " Bjorn Helgaas
2023-10-11 11:10   ` Jonathan Cameron
2023-10-11 11:38   ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 08/10] PCI/PTM: " Bjorn Helgaas
2023-10-11 11:11   ` Jonathan Cameron
2023-10-11 11:15   ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 09/10] PCI/VC: " Bjorn Helgaas
2023-10-11 11:13   ` Jonathan Cameron
2023-10-11 11:39   ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 10/10] PCI/portdrv: " Bjorn Helgaas
2023-10-11 11:14   ` Jonathan Cameron
2023-10-11 11:40   ` Ilpo Järvinen
2023-10-11 14:50 ` [PATCH 00/10] PCI: Use FIELD_GET() and FIELD_PREP() Kuppuswamy Sathyanarayanan
2023-10-18 21:00 ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ca2ad3-da7d-c82c-cbdf-b5363760444e@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).