All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
Cc: krzysztof.kozlowski@linaro.org, bhelgaas@google.com,
	devicetree@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, robh+dt@kernel.org,
	lorenzo.pieralisi@arm.com, linux-arm-kernel@lists.infradead.org,
	bharat.kumar.gogada@amd.com, michals@amd.com,
	nagaradhesh.yeleswarapu@amd.com
Subject: Re: [PATCH v4 3/3] PCI: xilinx-xdma: Add Xilinx XDMA Root Port driver
Date: Wed, 31 May 2023 12:12:12 -0500	[thread overview]
Message-ID: <ZHd/7AaLaGyr1jNA@bhelgaas> (raw)
In-Reply-To: <20230531083825.985584-4-thippeswamy.havalige@amd.com>

On Wed, May 31, 2023 at 02:08:25PM +0530, Thippeswamy Havalige wrote:
> Add support for Xilinx XDMA Soft IP core as Root Port.
> 
> The Zynq UltraScale+ MPSoCs devices support XDMA soft IP module in
> programmable logic.
> 
> The integrated XDMA soft IP block has integrated bridge function that
> can act as PCIe Root Port.
> 
> Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
> Signed-off-by: Bharat Kumar Gogada <bharat.kumar.gogada@amd.com>

> |Reported-by: kernel test robot <lkp@intel.com>
> |Reported-by: Dan Carpenter <error27@gmail.com>
> |Closes: https://lore.kernel.org/r/202305261250.2cs1phTS-lkp@intel.com/

Not relevant.  These are basically review comments.

> +	  Add support for the Xilinx PL DMA PCIe host bridge,
> +	  The controller is an soft IP which can act as Root Port.
> +	  If you know your system provides xilinx PCIe host controller
> +	  bridge DMA as soft IP say Y; if you are not sure, say N.

s/is an soft/is soft/
s/xilinx/Xilinx/

> +#define XILINX_PCIE_DMA_REG_IMR			0x0000013c
> +#define XILINX_PCIE_DMA_REG_MSIBASE1		0x0000014c
> +#define XILINX_PCIE_DMA_REG_MSI_HI_MASK		0x0000017c
> ...
> +#define XILINX_PCIE_DMA_IMR_ALL_MASK	0x0FF30FE9
> +#define XILINX_PCIE_DMA_IDR_ALL_MASK	0xFFFFFFFF

Pick upper-case hex or lower-case hex and use it consistently.

> +static inline bool xilinx_pl_dma_pcie_linkup(struct pl_dma_pcie *port)

Name this *_pcie_link_up() (not *_pcie_linkup()) to match other drivers.

> +static bool xilinx_pl_dma_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)
> +{
> +	struct pl_dma_pcie *port = bus->sysdata;
> +
> +	/* Check if link is up when trying to access downstream ports */
> +	if (!pci_is_root_bus(bus)) {
> +		if (!xilinx_pl_dma_pcie_linkup(port))
> +			return false;
> +	} else if (devfn > 0)
> +		/* Only one device down on each root port */
> +		return false;
> +
> +	return true;
> +}
> +
> +static void __iomem *xilinx_pl_dma_pcie_map_bus(struct pci_bus *bus,
> +						unsigned int devfn, int where)
> +{
> +	struct pl_dma_pcie *port = bus->sysdata;
> +
> +	if (!xilinx_pl_dma_pcie_valid_device(bus, devfn))
> +		return NULL;

Checking whether the link is up is racy because the link may be up, so
xilinx_pl_dma_pcie_valid_device() returns true, then the link may go
down before the read below.

What happens then?  If it's an error that you can recover from, it
would better to skip the link up check and just handle the error.

> +	return port->reg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);
> +}

> +	/*set the Bridge enable bit */

  /* Set ... */ (add space before "Set" and capitalize it)

Bjorn

WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <helgaas@kernel.org>
To: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
Cc: krzysztof.kozlowski@linaro.org, bhelgaas@google.com,
	devicetree@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, robh+dt@kernel.org,
	lorenzo.pieralisi@arm.com, linux-arm-kernel@lists.infradead.org,
	bharat.kumar.gogada@amd.com, michals@amd.com,
	nagaradhesh.yeleswarapu@amd.com
Subject: Re: [PATCH v4 3/3] PCI: xilinx-xdma: Add Xilinx XDMA Root Port driver
Date: Wed, 31 May 2023 12:12:12 -0500	[thread overview]
Message-ID: <ZHd/7AaLaGyr1jNA@bhelgaas> (raw)
In-Reply-To: <20230531083825.985584-4-thippeswamy.havalige@amd.com>

On Wed, May 31, 2023 at 02:08:25PM +0530, Thippeswamy Havalige wrote:
> Add support for Xilinx XDMA Soft IP core as Root Port.
> 
> The Zynq UltraScale+ MPSoCs devices support XDMA soft IP module in
> programmable logic.
> 
> The integrated XDMA soft IP block has integrated bridge function that
> can act as PCIe Root Port.
> 
> Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
> Signed-off-by: Bharat Kumar Gogada <bharat.kumar.gogada@amd.com>

> |Reported-by: kernel test robot <lkp@intel.com>
> |Reported-by: Dan Carpenter <error27@gmail.com>
> |Closes: https://lore.kernel.org/r/202305261250.2cs1phTS-lkp@intel.com/

Not relevant.  These are basically review comments.

> +	  Add support for the Xilinx PL DMA PCIe host bridge,
> +	  The controller is an soft IP which can act as Root Port.
> +	  If you know your system provides xilinx PCIe host controller
> +	  bridge DMA as soft IP say Y; if you are not sure, say N.

s/is an soft/is soft/
s/xilinx/Xilinx/

> +#define XILINX_PCIE_DMA_REG_IMR			0x0000013c
> +#define XILINX_PCIE_DMA_REG_MSIBASE1		0x0000014c
> +#define XILINX_PCIE_DMA_REG_MSI_HI_MASK		0x0000017c
> ...
> +#define XILINX_PCIE_DMA_IMR_ALL_MASK	0x0FF30FE9
> +#define XILINX_PCIE_DMA_IDR_ALL_MASK	0xFFFFFFFF

Pick upper-case hex or lower-case hex and use it consistently.

> +static inline bool xilinx_pl_dma_pcie_linkup(struct pl_dma_pcie *port)

Name this *_pcie_link_up() (not *_pcie_linkup()) to match other drivers.

> +static bool xilinx_pl_dma_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)
> +{
> +	struct pl_dma_pcie *port = bus->sysdata;
> +
> +	/* Check if link is up when trying to access downstream ports */
> +	if (!pci_is_root_bus(bus)) {
> +		if (!xilinx_pl_dma_pcie_linkup(port))
> +			return false;
> +	} else if (devfn > 0)
> +		/* Only one device down on each root port */
> +		return false;
> +
> +	return true;
> +}
> +
> +static void __iomem *xilinx_pl_dma_pcie_map_bus(struct pci_bus *bus,
> +						unsigned int devfn, int where)
> +{
> +	struct pl_dma_pcie *port = bus->sysdata;
> +
> +	if (!xilinx_pl_dma_pcie_valid_device(bus, devfn))
> +		return NULL;

Checking whether the link is up is racy because the link may be up, so
xilinx_pl_dma_pcie_valid_device() returns true, then the link may go
down before the read below.

What happens then?  If it's an error that you can recover from, it
would better to skip the link up check and just handle the error.

> +	return port->reg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);
> +}

> +	/*set the Bridge enable bit */

  /* Set ... */ (add space before "Set" and capitalize it)

Bjorn

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

  reply	other threads:[~2023-05-31 17:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  8:38 [PATCH v4 0/3] Add support for Xilinx XDMA Soft IP as Root Port Thippeswamy Havalige
2023-05-31  8:38 ` Thippeswamy Havalige
2023-05-31  8:38 ` [PATCH v4 1/3] Move and rename error interrupt bits to a common header Thippeswamy Havalige
2023-05-31  8:38   ` Thippeswamy Havalige
2023-05-31  8:38 ` [PATCH v4 2/3] dt-bindings: PCI: xilinx-xdma: Add YAML schemas for Xilinx XDMA PCIe Root Port Bridge Thippeswamy Havalige
2023-05-31  8:38   ` Thippeswamy Havalige
2023-06-05  7:39   ` Krzysztof Kozlowski
2023-06-05  7:39     ` Krzysztof Kozlowski
2023-06-05  8:55     ` Havalige, Thippeswamy
2023-06-05  8:55       ` Havalige, Thippeswamy
2023-05-31  8:38 ` [PATCH v4 3/3] PCI: xilinx-xdma: Add Xilinx XDMA Root Port driver Thippeswamy Havalige
2023-05-31  8:38   ` Thippeswamy Havalige
2023-05-31 17:12   ` Bjorn Helgaas [this message]
2023-05-31 17:12     ` Bjorn Helgaas
2023-06-12  6:56     ` Havalige, Thippeswamy

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=ZHd/7AaLaGyr1jNA@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bharat.kumar.gogada@amd.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=michals@amd.com \
    --cc=nagaradhesh.yeleswarapu@amd.com \
    --cc=robh+dt@kernel.org \
    --cc=thippeswamy.havalige@amd.com \
    /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.