All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Mark Rutland <mark.rutland@arm.com>, Andrew Lunn <andrew@lunn.ch>,
	Jason Cooper <jason@lakedaemon.net>,
	devicetree@vger.kernel.org,
	Antoine Tenart <antoine.tenart@bootlin.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Gregory Clement <gregory.clement@bootlin.com>,
	Haim Boot <hayim@marvell.com>, Will Deacon <will.deacon@arm.com>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Nadav Haklai <nadavh@marvell.com>,
	Rob Herring <robh+dt@kernel.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Hanna Hawa <hannah@marvell.com>,
	linux-arm-kernel@lists.infradead.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH v5 07/14] irqchip/irq-mvebu-sei: add new driver for Marvell SEI
Date: Fri, 28 Sep 2018 11:25:32 +0100	[thread overview]
Message-ID: <9a0de5ac-8cef-0950-e218-0368167ecff8@arm.com> (raw)
In-Reply-To: <20180924180133.2ea93762@xps13>

On 24/09/18 17:01, Miquel Raynal wrote:

Hi Miquel,

[...]

> The difference is that at this stage, the irq_data->chip pointer of the
> SEI controller _parent_ (ie. the GIC's chip pointer) is not valid. I
> digged a lot in this direction during your vacations to find out what I
> missed, and I ended up calling back irq_alloc_irqs_parent().
> 
> If you have an idea of how to handle this properly, I am all ears!

The most glaring problem is that you create a hierarchy that encompasses
the GIC, which is just wrong. The hierarchy cannot point to the GIC,
because it end-up as a multiplexer.

This code sequence in the probe function is the root of all evil:

	/* Get a reference to the parent domain */
	parent = of_irq_find_parent(node);
	if (!parent) {
		dev_err(sei->dev, "Failed to find parent IRQ node\n");
		ret = -ENODEV;
		goto dispose_irq;
	}

This is a GIC interrupt, which is the output line for the SEI block.

	parent_domain = irq_find_host(parent);
	if (!parent_domain) {
		dev_err(sei->dev, "Failed to find parent IRQ domain\n");
		ret = -ENODEV;
		goto dispose_irq;
	}

That's the GIC domain.

	/* Create the 'wired' domain */
	sei->ap_domain = irq_domain_create_hierarchy(parent_domain, 0,
						     sei->caps->ap_range.size,
						     of_node_to_fwnode(node),
						     &mvebu_sei_ap_domain_ops,
						     sei);
	if (!sei->ap_domain) {
		dev_err(sei->dev, "Failed to create AP IRQ domain\n");
		ret = -ENOMEM;
		goto dispose_irq;
	}

And here, you're saying "each and every AP SEI interrupt is directly
linked to a unique GIC interrupt". Nothing could be further from the
truth, since all SEI interrupts are funnelled through a *single*
GIC interrupt. So you cannot create it as a hierarchy parented at
the GIC.

	/* Create the 'MSI' domain */
	sei->cp_domain = irq_domain_create_hierarchy(parent_domain, 0,
						     sei->caps->cp_range.size,
						     of_node_to_fwnode(node),
						     &mvebu_sei_cp_domain_ops,
						     sei);


Same thing here.

The issue here is that you're using the GIC domain as the way to root
the two distinct SEI domains, while they should be rooted at an internal,
SEI-specific domain. I'd suggest a topology like this:

                  AP-SEI ---> S
                              E
    Plat-MSI ---> CP-SEI ---> I

CP-SEI and AP-SEI use SEI as a parent. SEI does not have a parent, but is
a chained irqchip.

I'm happy to help you reworking this piece of code if you tell me how to
plug a driver that can use it on an mcbin system.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

WARNING: multiple messages have this Message-ID (diff)
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 07/14] irqchip/irq-mvebu-sei: add new driver for Marvell SEI
Date: Fri, 28 Sep 2018 11:25:32 +0100	[thread overview]
Message-ID: <9a0de5ac-8cef-0950-e218-0368167ecff8@arm.com> (raw)
In-Reply-To: <20180924180133.2ea93762@xps13>

On 24/09/18 17:01, Miquel Raynal wrote:

Hi Miquel,

[...]

> The difference is that at this stage, the irq_data->chip pointer of the
> SEI controller _parent_ (ie. the GIC's chip pointer) is not valid. I
> digged a lot in this direction during your vacations to find out what I
> missed, and I ended up calling back irq_alloc_irqs_parent().
> 
> If you have an idea of how to handle this properly, I am all ears!

The most glaring problem is that you create a hierarchy that encompasses
the GIC, which is just wrong. The hierarchy cannot point to the GIC,
because it end-up as a multiplexer.

This code sequence in the probe function is the root of all evil:

	/* Get a reference to the parent domain */
	parent = of_irq_find_parent(node);
	if (!parent) {
		dev_err(sei->dev, "Failed to find parent IRQ node\n");
		ret = -ENODEV;
		goto dispose_irq;
	}

This is a GIC interrupt, which is the output line for the SEI block.

	parent_domain = irq_find_host(parent);
	if (!parent_domain) {
		dev_err(sei->dev, "Failed to find parent IRQ domain\n");
		ret = -ENODEV;
		goto dispose_irq;
	}

That's the GIC domain.

	/* Create the 'wired' domain */
	sei->ap_domain = irq_domain_create_hierarchy(parent_domain, 0,
						     sei->caps->ap_range.size,
						     of_node_to_fwnode(node),
						     &mvebu_sei_ap_domain_ops,
						     sei);
	if (!sei->ap_domain) {
		dev_err(sei->dev, "Failed to create AP IRQ domain\n");
		ret = -ENOMEM;
		goto dispose_irq;
	}

And here, you're saying "each and every AP SEI interrupt is directly
linked to a unique GIC interrupt". Nothing could be further from the
truth, since all SEI interrupts are funnelled through a *single*
GIC interrupt. So you cannot create it as a hierarchy parented at
the GIC.

	/* Create the 'MSI' domain */
	sei->cp_domain = irq_domain_create_hierarchy(parent_domain, 0,
						     sei->caps->cp_range.size,
						     of_node_to_fwnode(node),
						     &mvebu_sei_cp_domain_ops,
						     sei);


Same thing here.

The issue here is that you're using the GIC domain as the way to root
the two distinct SEI domains, while they should be rooted at an internal,
SEI-specific domain. I'd suggest a topology like this:

                  AP-SEI ---> S
                              E
    Plat-MSI ---> CP-SEI ---> I

CP-SEI and AP-SEI use SEI as a parent. SEI does not have a parent, but is
a chained irqchip.

I'm happy to help you reworking this piece of code if you tell me how to
plug a driver that can use it on an mcbin system.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2018-09-28 10:25 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30  7:35 [PATCH v5 00/14] Add System Error Interrupt support to Armada SoCs Miquel Raynal
2018-08-30  7:35 ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 01/14] genirq/msi: Allow creation of a tree-based irqdomain for platform-msi Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 02/14] dt-bindings/interrupt-controller: fix Marvell ICU length in the example Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 03/14] irqchip/irq-mvebu-icu: fix wrong private data retrieval Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 04/14] irqchip/irq-mvebu-icu: clarify the reset operation of configured interrupts Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 05/14] irqchip/irq-mvebu-icu: disociate ICU and NSR Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 06/14] irqchip/irq-mvebu-icu: support ICU subnodes Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 07/14] irqchip/irq-mvebu-sei: add new driver for Marvell SEI Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-09-20 20:40   ` Marc Zyngier
2018-09-20 20:40     ` Marc Zyngier
2018-09-24 16:01     ` Miquel Raynal
2018-09-24 16:01       ` Miquel Raynal
2018-09-28 10:25       ` Marc Zyngier [this message]
2018-09-28 10:25         ` Marc Zyngier
2018-09-28 16:38         ` Miquel Raynal
2018-09-28 16:38           ` Miquel Raynal
2018-09-30 14:39           ` Marc Zyngier
2018-09-30 14:39             ` Marc Zyngier
2018-10-01 13:49             ` Miquel Raynal
2018-10-01 13:49               ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 08/14] arm64: marvell: enable SEI driver Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 09/14] irqchip/irq-mvebu-icu: add support for System Error Interrupts (SEI) Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 10/14] dt-bindings/interrupt-controller: update Marvell ICU bindings Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-09-10 18:12   ` Rob Herring
2018-09-10 18:12     ` Rob Herring
2018-08-30  7:35 ` [PATCH v5 11/14] dt-bindings/interrupt-controller: add documentation for Marvell SEI controller Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-09-10 18:13   ` Rob Herring
2018-09-10 18:13     ` Rob Herring
2018-08-30  7:35 ` [PATCH v5 12/14] arm64: dts: marvell: add AP806 SEI subnode Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 13/14] arm64: dts: marvell: use new bindings for CP110 interrupts Miquel Raynal
2018-08-30  7:35   ` Miquel Raynal
2018-08-30  7:35 ` [PATCH v5 14/14] arm64: dts: marvell: add CP110 ICU SEI subnode Miquel Raynal
2018-08-30  7:35   ` 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=9a0de5ac-8cef-0950-e218-0368167ecff8@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=andrew@lunn.ch \
    --cc=antoine.tenart@bootlin.com \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=hannah@marvell.com \
    --cc=hayim@marvell.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=miquel.raynal@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 \
    --cc=will.deacon@arm.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.