linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: Marc Zyngier <maz@kernel.org>
Cc: linux-mips@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Rob Herring <robh+dt@kernel.org>, Huacai Chen <chenhc@lemote.com>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 5/6] irqchip: Add Loongson PCH MSI controller
Date: Fri, 24 Apr 2020 09:33:51 +0800	[thread overview]
Message-ID: <20200424093351.370c92e8@flygoat-x1e> (raw)
In-Reply-To: <20200423154135.38b0ec25@why>

On Thu, 23 Apr 2020 15:41:35 +0100
Marc Zyngier <maz@kernel.org> wrote:

> On Wed, 22 Apr 2020 22:24:25 +0800
> Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
> 
> > This controller appears on Loongson-7A family of PCH to transform
> > interrupts from PCI MSI into HyperTransport vectorized interrrupts
> > and send them to procrssor's HT vector controller.
> > 
> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > ---
[...]
> > +	ret = irq_domain_alloc_irqs_parent(domain, virq, 1,
> > &fwspec);
> > +	if (ret)
> > +		return ret;
> > +
> > +	irq_domain_set_info(domain, virq, hwirq,
> > +			    &middle_irq_chip, NULL,
> > +			    handle_simple_irq, NULL, NULL);  
> 
> No, this should at least be handle_edge_irq. More importantly, you
> should use the flow set by the underlying irqchip, and not provide
> your own.

Hi Marc,
Thanks for your review.

The underlying irqchip (HTVEC) follows a simple_irq flow as it only
has mask/unmask callback, and it doesn't have tyoe configuration. so I
followed simple_irq flow.

How can I use the flow set by the underlying irqchip? Just use
irq_domain_set_hwirq_and_chip here and set_handler in HTVEC driver?


> 
> > +	irq_set_probe(virq);  
> 
> Probe? what does it mean for MSIs? I also don't see how you tell the
> underlying irqchip that the MSI is edge triggered.
> 
> > +
> > +	return 0;
> > +}
> > +
> > +static int pch_msi_middle_domain_alloc(struct irq_domain *domain,
> > +					   unsigned int virq,
> > +					   unsigned int nr_irqs,
> > void *args) +{
> > +	struct pch_msi_data *priv = domain->host_data;
> > +	int hwirq, err, i;
> > +
> > +	hwirq = pch_msi_allocate_hwirq(priv, nr_irqs);
> > +	if (hwirq < 0)
> > +		return hwirq;
> > +
> > +	for (i = 0; i < nr_irqs; i++) {
> > +		err = pch_msi_parent_domain_alloc(domain, virq +
> > i, hwirq + i);
> > +		if (err)
> > +			goto err_hwirq;
> > +
> > +		irq_domain_set_hwirq_and_chip(domain, virq + i,
> > hwirq + i,
> > +					      &middle_irq_chip,
> > priv);
> > +	}
> > +
> > +	return 0;
> > +err_hwirq:
> > +	while (--i >= 0)
> > +		irq_domain_free_irqs_parent(domain, virq, i);
> > +
> > +	pch_msi_free_hwirq(priv, hwirq, nr_irqs);
> > +	return err;
> > +}
> > +
> > +static void pch_msi_middle_domain_free(struct irq_domain *domain,
> > +					   unsigned int virq,
> > +					   unsigned int nr_irqs)
> > +{
> > +	struct irq_data *d = irq_domain_get_irq_data(domain, virq);
> > +	struct pch_msi_data *priv = irq_data_get_irq_chip_data(d);
> > +
> > +	irq_domain_free_irqs_parent(domain, virq, nr_irqs);
> > +	pch_msi_free_hwirq(priv, d->hwirq, nr_irqs);
> > +}
> > +
> > +static const struct irq_domain_ops pch_msi_middle_domain_ops = {
> > +	.alloc	= pch_msi_middle_domain_alloc,
> > +	.free	= pch_msi_middle_domain_free,
> > +};
> > +
> > +static int pch_msi_init_domains(struct pch_msi_data *priv,
> > +				struct device_node *node,
> > +				struct device_node *parent)
> > +{
> > +	struct irq_domain *middle_domain, *msi_domain,
> > *parent_domain; +
> > +	parent_domain = irq_find_host(parent);
> > +	if (!parent_domain) {
> > +		pr_err("Failed to find the parent domain\n");
> > +		return -ENXIO;
> > +	}
> > +
> > +	middle_domain = irq_domain_add_tree(NULL,
> > +
> > &pch_msi_middle_domain_ops,
> > +					    priv);  
> 
> You don't really need a tree, unless your interrupt space is huge and
> very sparse. Given that the DT example says 64, I would go with a
> linear domain if that number is realistic.
> 
It can up to 192 in latest generation of chip, is it still suitable?

In the latest generation, we have a enhanced version of HTVEC which has
another delivery system that will be able to configure affinity. That's
why I placed set_affinity call back here and in PCH PIC driver.

Thanks. 

[...]
> > +}
> > +
> > +IRQCHIP_DECLARE(pch_msi, "loongson,pch-msi-1.0", pch_msi_init);  
> 
> Thanks,
> 
> 	M.

--
Jiaxun Yang

  reply	other threads:[~2020-04-24  1:34 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 14:24 [PATCH 0/6] Loongson PCH IRQ Support Jiaxun Yang
2020-04-22 14:24 ` [PATCH 1/6] irqchip: Add Loongson HyperTransport Vector support Jiaxun Yang
2020-04-23 13:31   ` Marc Zyngier
2020-04-22 14:24 ` [PATCH 2/6] dt-bindings: interrupt-controller: Add Loongson HTVEC Jiaxun Yang
2020-04-22 14:24 ` [PATCH 3/6] irqchip: Add Loongson PCH PIC controller Jiaxun Yang
2020-04-23  5:56   ` Huacai Chen
2020-04-23 14:23   ` Marc Zyngier
2020-04-22 14:24 ` [PATCH 4/6] dt-bindings: interrupt-controller: Add Loongson PCH PIC Jiaxun Yang
2020-04-23  5:54   ` Huacai Chen
2020-04-22 14:24 ` [PATCH 5/6] irqchip: Add Loongson PCH MSI controller Jiaxun Yang
2020-04-23  5:57   ` Huacai Chen
2020-04-23 14:41   ` Marc Zyngier
2020-04-24  1:33     ` Jiaxun Yang [this message]
2020-04-24  8:28       ` Marc Zyngier
2020-04-22 14:24 ` [PATCH 6/6] dt-bindings: interrupt-controller: Add Loongson PCH MSI Jiaxun Yang
2020-04-23  5:55   ` Huacai Chen
2020-04-23 12:43     ` Marc Zyngier
2020-04-24  1:27       ` Huacai Chen
2020-04-23  5:50 ` [PATCH 0/6] Loongson PCH IRQ Support Huacai Chen
2020-04-28  6:32 ` [PATCH v2 1/6] irqchip: Add Loongson HyperTransport Vector support Jiaxun Yang
2020-04-28  6:32   ` [PATCH v2 2/6] dt-bindings: interrupt-controller: Add Loongson HTVEC Jiaxun Yang
2020-04-28  6:32   ` [PATCH v2 3/6] irqchip: Add Loongson PCH PIC controller Jiaxun Yang
2020-05-13 12:09     ` Thomas Gleixner
2020-04-28  6:32   ` [PATCH v2 4/6] dt-bindings: interrupt-controller: Add Loongson PCH PIC Jiaxun Yang
2020-04-28  6:32   ` [PATCH v2 5/6] irqchip: Add Loongson PCH MSI controller Jiaxun Yang
2020-04-28 13:07     ` Marc Zyngier
2020-05-13 12:13     ` Thomas Gleixner
2020-05-13 12:15       ` Thomas Gleixner
2020-05-20 11:51         ` Jiaxun Yang
2020-04-28  6:32   ` [PATCH v2 6/6] dt-bindings: interrupt-controller: Add Loongson PCH MSI Jiaxun Yang
2020-04-28 16:59   ` [PATCH v2 1/6] irqchip: Add Loongson HyperTransport Vector support Marc Zyngier
2020-05-01  9:21 ` [PATCH v3 " Jiaxun Yang
2020-05-01  9:21   ` [PATCH v3 2/6] dt-bindings: interrupt-controller: Add Loongson HTVEC Jiaxun Yang
2020-05-12 16:42     ` Rob Herring
2020-05-01  9:21   ` [PATCH v3 3/6] irqchip: Add Loongson PCH PIC controller Jiaxun Yang
2020-05-01  9:21   ` [PATCH v3 4/6] dt-bindings: interrupt-controller: Add Loongson PCH PIC Jiaxun Yang
2020-05-01  9:21   ` [PATCH v3 5/6] irqchip: Add Loongson PCH MSI controller Jiaxun Yang
2020-05-01  9:21   ` [PATCH v3 6/6] dt-bindings: interrupt-controller: Add Loongson PCH MSI Jiaxun Yang
2020-05-12 20:57     ` Rob Herring
2020-05-12  7:45   ` [PATCH v3 1/6] irqchip: Add Loongson HyperTransport Vector support Jiaxun Yang
2020-05-13 12:06   ` Thomas Gleixner

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=20200424093351.370c92e8@flygoat-x1e \
    --to=jiaxun.yang@flygoat.com \
    --cc=chenhc@lemote.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).