All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Krzysztof Wilczyński" <kw@linux.com>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-pci@vger.kernel.org, Shawn Lin <shawn.lin@rock-chips.com>,
	Michal Simek <michal.simek@xilinx.com>,
	linux-rockchip@lists.infradead.org,
	Zhou Wang <wangzhou1@hisilicon.com>,
	Robert Richter <rrichter@marvell.com>,
	Jonathan Chocron <jonnyc@amazon.com>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] PCI: Unify ECAM constants in native PCI Express drivers
Date: Sat, 5 Sep 2020 22:44:16 +0200	[thread overview]
Message-ID: <20200905204416.GA83847@rocinante> (raw)
In-Reply-To: <20200828100843.0000474e@Huawei.com>

Hello Jonathan,

Thank you for the review!  Also, apologies for late reply.

On 20-08-28 10:08:43, Jonathan Cameron wrote:
[...]
> 
> Might potentially be worth tidying up the masks as well?
> Or potentially drop them given I suspect that there are no cases
> in which the mask is actually doing anything...

Just to confirm - you have the following constants in mind?

drivers/pci/controller/pcie-rockchip.h:

#define PCIE_ECAM_BUS(x)	(((x) & 0xff) << 20)
#define PCIE_ECAM_DEV(x)	(((x) & 0x1f) << 15)
#define PCIE_ECAM_FUNC(x)	(((x) & 0x7) << 12)

drivers/pci/controller/dwc/pcie-al.c:

#define PCIE_ECAM_DEVFN(x)	(((x) & 0xff) << 12)

I can move PCIE_ECAM_BUS, PCIE_ECAM_DEV and PCIE_ECAM_FUNC (as
PCIE_ECAM_FUN) to the linux/pci-ecam.h file, as these seem useful, but
without the masks, and then update other files to use these.  We could
then leverage these, for example:

 	pci_base_addr = (void __iomem *)((uintptr_t)pp->va_cfg0_base +
-					 (busnr_ecam << 20) +
-					 PCIE_ECAM_DEVFN(devfn));
+					 PCIE_ECAM_BUS(busnr_ecam) +
+					 PCIE_ECAM_FUN(devfn));

What do you think?  Bjorn, would that be acceptable?

Krzysztof

WARNING: multiple messages have this Message-ID (diff)
From: "Krzysztof Wilczyński" <kw@linux.com>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-pci@vger.kernel.org, Shawn Lin <shawn.lin@rock-chips.com>,
	Michal Simek <michal.simek@xilinx.com>,
	linux-rockchip@lists.infradead.org,
	Zhou Wang <wangzhou1@hisilicon.com>,
	Robert Richter <rrichter@marvell.com>,
	Jonathan Chocron <jonnyc@amazon.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] PCI: Unify ECAM constants in native PCI Express drivers
Date: Sat, 5 Sep 2020 22:44:16 +0200	[thread overview]
Message-ID: <20200905204416.GA83847@rocinante> (raw)
In-Reply-To: <20200828100843.0000474e@Huawei.com>

Hello Jonathan,

Thank you for the review!  Also, apologies for late reply.

On 20-08-28 10:08:43, Jonathan Cameron wrote:
[...]
> 
> Might potentially be worth tidying up the masks as well?
> Or potentially drop them given I suspect that there are no cases
> in which the mask is actually doing anything...

Just to confirm - you have the following constants in mind?

drivers/pci/controller/pcie-rockchip.h:

#define PCIE_ECAM_BUS(x)	(((x) & 0xff) << 20)
#define PCIE_ECAM_DEV(x)	(((x) & 0x1f) << 15)
#define PCIE_ECAM_FUNC(x)	(((x) & 0x7) << 12)

drivers/pci/controller/dwc/pcie-al.c:

#define PCIE_ECAM_DEVFN(x)	(((x) & 0xff) << 12)

I can move PCIE_ECAM_BUS, PCIE_ECAM_DEV and PCIE_ECAM_FUNC (as
PCIE_ECAM_FUN) to the linux/pci-ecam.h file, as these seem useful, but
without the masks, and then update other files to use these.  We could
then leverage these, for example:

 	pci_base_addr = (void __iomem *)((uintptr_t)pp->va_cfg0_base +
-					 (busnr_ecam << 20) +
-					 PCIE_ECAM_DEVFN(devfn));
+					 PCIE_ECAM_BUS(busnr_ecam) +
+					 PCIE_ECAM_FUN(devfn));

What do you think?  Bjorn, would that be acceptable?

Krzysztof

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

WARNING: multiple messages have this Message-ID (diff)
From: "Krzysztof Wilczyński" <kw@linux.com>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-pci@vger.kernel.org, Shawn Lin <shawn.lin@rock-chips.com>,
	Michal Simek <michal.simek@xilinx.com>,
	linux-rockchip@lists.infradead.org,
	Zhou Wang <wangzhou1@hisilicon.com>,
	Robert Richter <rrichter@marvell.com>,
	Jonathan Chocron <jonnyc@amazon.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] PCI: Unify ECAM constants in native PCI Express drivers
Date: Sat, 5 Sep 2020 22:44:16 +0200	[thread overview]
Message-ID: <20200905204416.GA83847@rocinante> (raw)
In-Reply-To: <20200828100843.0000474e@Huawei.com>

Hello Jonathan,

Thank you for the review!  Also, apologies for late reply.

On 20-08-28 10:08:43, Jonathan Cameron wrote:
[...]
> 
> Might potentially be worth tidying up the masks as well?
> Or potentially drop them given I suspect that there are no cases
> in which the mask is actually doing anything...

Just to confirm - you have the following constants in mind?

drivers/pci/controller/pcie-rockchip.h:

#define PCIE_ECAM_BUS(x)	(((x) & 0xff) << 20)
#define PCIE_ECAM_DEV(x)	(((x) & 0x1f) << 15)
#define PCIE_ECAM_FUNC(x)	(((x) & 0x7) << 12)

drivers/pci/controller/dwc/pcie-al.c:

#define PCIE_ECAM_DEVFN(x)	(((x) & 0xff) << 12)

I can move PCIE_ECAM_BUS, PCIE_ECAM_DEV and PCIE_ECAM_FUNC (as
PCIE_ECAM_FUN) to the linux/pci-ecam.h file, as these seem useful, but
without the masks, and then update other files to use these.  We could
then leverage these, for example:

 	pci_base_addr = (void __iomem *)((uintptr_t)pp->va_cfg0_base +
-					 (busnr_ecam << 20) +
-					 PCIE_ECAM_DEVFN(devfn));
+					 PCIE_ECAM_BUS(busnr_ecam) +
+					 PCIE_ECAM_FUN(devfn));

What do you think?  Bjorn, would that be acceptable?

Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-05 20:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 22:49 [PATCH] PCI: Unify ECAM constants in native PCI Express drivers Krzysztof Wilczyński
2020-08-27 22:49 ` Krzysztof Wilczyński
2020-08-27 22:49 ` Krzysztof Wilczyński
2020-08-28  9:08 ` Jonathan Cameron
2020-08-28  9:08   ` Jonathan Cameron
2020-08-28  9:08   ` Jonathan Cameron
2020-09-05 20:44   ` Krzysztof Wilczyński [this message]
2020-09-05 20:44     ` Krzysztof Wilczyński
2020-09-05 20:44     ` Krzysztof Wilczyński
2020-09-22 23:27     ` Bjorn Helgaas
2020-09-22 23:27       ` Bjorn Helgaas
2020-09-22 23:27       ` Bjorn Helgaas
2020-09-23 17:23       ` Rob Herring
2020-09-23 17:23         ` Rob Herring
2020-09-23 17:23         ` Rob Herring
2020-09-24 20:57         ` Krzysztof Wilczyński
2020-09-24 20:57           ` Krzysztof Wilczyński
2020-09-24 20:57           ` Krzysztof Wilczyński

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=20200905204416.GA83847@rocinante \
    --to=kw@linux.com \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=bhelgaas@google.com \
    --cc=heiko@sntech.de \
    --cc=jonnyc@amazon.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=michal.simek@xilinx.com \
    --cc=rrichter@marvell.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=will@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.