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 05/10] PCI/ATS: Use FIELD_GET()
Date: Wed, 11 Oct 2023 14:20:12 +0300 (EEST) [thread overview]
Message-ID: <85b2c818-1c43-e633-8179-ec694214ce77@linux.intel.com> (raw)
In-Reply-To: <20231010204436.1000644-6-helgaas@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2171 bytes --]
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/ats.c | 7 ++-----
> include/uapi/linux/pci_regs.h | 1 +
> 2 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
> index f9cc2e10b676..c570892b2090 100644
> --- a/drivers/pci/ats.c
> +++ b/drivers/pci/ats.c
> @@ -9,6 +9,7 @@
> * Copyright (C) 2011 Advanced Micro Devices,
> */
>
> +#include <linux/bitfield.h>
> #include <linux/export.h>
> #include <linux/pci-ats.h>
> #include <linux/pci.h>
> @@ -480,8 +481,6 @@ int pci_pasid_features(struct pci_dev *pdev)
> }
> EXPORT_SYMBOL_GPL(pci_pasid_features);
>
> -#define PASID_NUMBER_SHIFT 8
> -#define PASID_NUMBER_MASK (0x1f << PASID_NUMBER_SHIFT)
> /**
> * pci_max_pasids - Get maximum number of PASIDs supported by device
> * @pdev: PCI device structure
> @@ -503,9 +502,7 @@ int pci_max_pasids(struct pci_dev *pdev)
>
> pci_read_config_word(pdev, pasid + PCI_PASID_CAP, &supported);
>
> - supported = (supported & PASID_NUMBER_MASK) >> PASID_NUMBER_SHIFT;
> -
> - return (1 << supported);
> + return (1 << FIELD_GET(PCI_PASID_CAP_WIDTH, supported));
> }
> EXPORT_SYMBOL_GPL(pci_max_pasids);
> #endif /* CONFIG_PCI_PASID */
> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> index 6af1f8d53e97..833e5fb40ea5 100644
> --- a/include/uapi/linux/pci_regs.h
> +++ b/include/uapi/linux/pci_regs.h
> @@ -932,6 +932,7 @@
> #define PCI_PASID_CAP 0x04 /* PASID feature register */
> #define PCI_PASID_CAP_EXEC 0x0002 /* Exec permissions Supported */
> #define PCI_PASID_CAP_PRIV 0x0004 /* Privilege Mode Supported */
> +#define PCI_PASID_CAP_WIDTH 0x1f00
> #define PCI_PASID_CTRL 0x06 /* PASID control register */
> #define PCI_PASID_CTRL_ENABLE 0x0001 /* Enable bit */
> #define PCI_PASID_CTRL_EXEC 0x0002 /* Exec permissions Enable */
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
next prev parent reply other threads:[~2023-10-11 11:28 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 [this message]
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
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=85b2c818-1c43-e633-8179-ec694214ce77@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.