From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>, Andrew Lunn <andrew@lunn.ch>,
Baruch Siach <baruch@tkos.co.il>,
Jason Cooper <jason@lakedaemon.net>,
devicetree@vger.kernel.org, Marc Zyngier <marc.zyngier@arm.com>,
Gregory Clement <gregory.clement@bootlin.com>,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
Nadav Haklai <nadavh@marvell.com>,
linux-ide@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
Antoine Tenart <antoine.tenart@bootlin.com>,
Jens Axboe <axboe@kernel.dk>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Thomas Gleixner <tglx@linutronix.de>,
linux-arm-kernel@lists.infradead.org,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH v2 02/10] ata: ahci: Support per-port interrupts
Date: Thu, 7 Mar 2019 08:58:48 +0100 [thread overview]
Message-ID: <20190307085848.777e62ff@xps13> (raw)
In-Reply-To: <cd3e733d-110f-7fa0-a637-6d4bd4475142@redhat.com>
Hi Hans,
Hans de Goede <hdegoede@redhat.com> wrote on Wed, 6 Mar 2019 16:01:16
+0100:
> > /**
> > * ahci_platform_enable_clks - Enable platform clocks
> > * @hpriv: host private area to store config values
> > @@ -385,6 +394,7 @@ static int ahci_platform_get_regulator(struct ahci_host_priv *hpriv, u32 port,
> > * or for non devicetree enabled platforms a single clock
> > * 4) resets, if flags has AHCI_PLATFORM_GET_RESETS (optional)
> > * 5) phys (optional)
> > + * 6) interrupt(s)
> > *
> > * RETURNS:
> > * The allocated ahci_host_priv on success, otherwise an ERR_PTR value
> > @@ -396,7 +406,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
> > struct ahci_host_priv *hpriv;
> > struct clk *clk;
> > struct device_node *child;
> > - int i, enabled_ports = 0, rc = -ENOMEM, child_nodes;
> > + int i, enabled_ports = 0, rc = -ENOMEM, child_nodes, ctrl_irq;
> > u32 mask_port_map = 0;
> > > if (!devres_open_group(dev, NULL, GFP_KERNEL))
> > @@ -489,10 +499,30 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
> > goto err_out;
> > }
> > > + hpriv->irqs = devm_kzalloc(dev, sizeof(*hpriv->irqs) * hpriv->nports,
> > + GFP_KERNEL);
> > + if (!hpriv->irqs) {
> > + rc = -ENOMEM;
> > + goto err_out;
> > + }
> > +
> > + ctrl_irq = platform_get_irq(pdev, 0);
> > + if (ctrl_irq < 0) {
> > + if (ctrl_irq == -EPROBE_DEFER) {
> > + rc = ctrl_irq;
> > + goto err_out;
> > + }
> > + ctrl_irq = 0;
> > + }
> > +
> > + if (ctrl_irq > 0)
> > + hpriv->irqs[0] = ctrl_irq;
> > +
> > if (child_nodes) {
> > for_each_child_of_node(dev->of_node, child) {
> > u32 port;
> > struct platform_device *port_dev __maybe_unused;
> > + int port_irq;
> > > if (!of_device_is_available(child))
> > continue;
> > @@ -521,6 +551,18 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
> > }
> > #endif
> > > + if (!ctrl_irq) {
> > + port_irq = of_irq_get(child, 0);
> > + if (!port_irq)
> > + port_irq = -EINVAL;
> > + if (port_irq < 0) {
> > + rc = port_irq;
> > + goto err_out;
> > + }
> > +
> > + hpriv->irqs[port] = port_irq;
> > + }
> > +
> > rc = ahci_platform_get_phy(hpriv, port, dev, child);
> > if (rc)
> > goto err_out;
> > @@ -548,6 +590,18 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
> > if (rc == -EPROBE_DEFER)
> > goto err_out;
> > }
> > +
> > + if (!ctrl_irq && !enabled_ports) {
> > + dev_err(&pdev->dev, "No IRQ defined\n");
> > + rc = -ENODEV;
> > + goto err_out;
> > + }
> > +
> > + if (enabled_ports > 1) {
> > + hpriv->flags |= AHCI_HFLAG_MULTI_MSI;
> > + hpriv->get_irq_vector = ahci_get_per_port_irq_vector;
> > + }
> > +
>
> I believe that the "if (enabled_ports > 1)" here needs to be:
>
> if (!ctrl_irq && enabled_ports > 1) {
>
> Otherwise existing boards which use a single irq defined at the
> main of_node level for the device and have defined more then 1
> child-node in their DTB will now get AHCI_HFLAG_MULTI_MSI set,
> but they will only have hpriv->irqs[0] set to the ctrl_irq
> leading to returning of 0 as irq from ahci_get_per_port_irq_vector
> for the other ports, which is wrong.
>
> Otherwise this patch looks good to me, so with this fixed
> (assuming you agree) you may add my:
>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>
> to the next version of this patch.
You are completely right, this is a mistake, I will fix it in v3. I
will just wait for the review of the other ahci_mvebu patches.
Thanks,
Miquèl
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-03-07 7:58 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 10:21 [PATCH v2 00/10] Enable per-port SATA interrupts and drop an hack in the IRQ subsystem Miquel Raynal
2019-03-06 10:21 ` [PATCH v2 01/10] ata: libahci: Ensure the host interrupt status bits are cleared Miquel Raynal
2019-03-06 10:21 ` Miquel Raynal
2019-03-07 16:25 ` Marc Zyngier
2019-03-07 16:25 ` Marc Zyngier
2019-03-07 17:19 ` Miquel Raynal
2019-03-06 10:21 ` [PATCH v2 02/10] ata: ahci: Support per-port interrupts Miquel Raynal
2019-03-06 10:21 ` Miquel Raynal
2019-03-06 15:01 ` Hans de Goede
2019-03-06 15:01 ` Hans de Goede
2019-03-07 7:58 ` Miquel Raynal [this message]
2019-03-06 10:21 ` [PATCH v2 03/10] dt-bindings: ata: Update ahci bindings with possible " Miquel Raynal
2019-03-06 10:21 ` Miquel Raynal
2019-03-12 19:05 ` Rob Herring
2019-03-12 19:05 ` Rob Herring
2019-03-06 10:21 ` [PATCH v2 04/10] ata: ahci: mvebu: Rename a platform data flag Miquel Raynal
2019-03-06 10:21 ` Miquel Raynal
2019-03-06 10:21 ` [PATCH v2 05/10] ata: ahci: mvebu: Add a parameter to a platform data callback Miquel Raynal
2019-03-06 10:21 ` Miquel Raynal
2019-03-06 10:21 ` [PATCH v2 06/10] dt-bindings: ata: Update ahci_mvebu bindings Miquel Raynal
2019-03-06 10:21 ` Miquel Raynal
2019-03-12 19:06 ` Rob Herring
2019-03-12 19:06 ` Rob Herring
2019-03-06 10:21 ` [PATCH v2 07/10] ata: ahci: mvebu: Support A8k compatible Miquel Raynal
2019-03-06 10:21 ` Miquel Raynal
2019-03-06 10:21 ` [PATCH v2 08/10] ata: ahci: mvebu: Add support for A8k legacy bindings Miquel Raynal
2019-03-06 10:21 ` Miquel Raynal
2019-03-07 16:31 ` Marc Zyngier
2019-03-07 16:31 ` Marc Zyngier
2019-03-06 10:21 ` [PATCH v2 09/10] irqchip/irq-mvebu-icu: Remove the double SATA ports interrupt hack Miquel Raynal
2019-03-06 10:21 ` Miquel Raynal
2019-03-06 10:21 ` [PATCH v2 10/10] arm64: dts: marvell: armada-cp110: Switch to per-port SATA interrupts Miquel Raynal
2019-03-06 10:21 ` Miquel Raynal
2019-03-06 10:30 ` Baruch Siach
2019-03-06 10:30 ` Baruch Siach
2019-03-06 10:34 ` Miquel Raynal
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=20190307085848.777e62ff@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=andrew@lunn.ch \
--cc=antoine.tenart@bootlin.com \
--cc=axboe@kernel.dk \
--cc=baruch@tkos.co.il \
--cc=devicetree@vger.kernel.org \
--cc=gregory.clement@bootlin.com \
--cc=hdegoede@redhat.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ide@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=maxime.chevallier@bootlin.com \
--cc=nadavh@marvell.com \
--cc=robh+dt@kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
--cc=tglx@linutronix.de \
--cc=thomas.petazzoni@bootlin.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.