From: Thomas Gleixner <tglx@linutronix.de>
To: Chintan Vankar <c-vankar@ti.com>, Jason Reeder <jreeder@ti.com>,
vigneshr@ti.com, nm@ti.com, Chintan Vankar <c-vankar@ti.com>,
Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Andrew Lunn <andrew+netdev@lunn.ch>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, srk@ti.com,
s-vadapalli@ti.com, danishanwar@ti.com, m-malladi@ti.com
Subject: Re: [RFC PATCH 1/2] irqchip: ti-tsir: Add support for Timesync Interrupt Router
Date: Thu, 06 Feb 2025 22:28:58 +0100 [thread overview]
Message-ID: <87lduin4o5.ffs@tglx> (raw)
In-Reply-To: <20250205160119.136639-2-c-vankar@ti.com>
On Wed, Feb 05 2025 at 21:31, Chintan Vankar wrote:
> +++ b/drivers/irqchip/ti-timesync-intr.c
> @@ -0,0 +1,109 @@
> +// SPDX-License-Identifier: GPL
That's not a valid license identifier
> +static struct irq_chip ts_intr_irq_chip = {
> + .name = "TIMESYNC_INTRTR",
> +};
How is this interrupt chip supposed to work? All it implements is a
name.
> +static int ts_intr_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
> + unsigned int nr_irqs, void *arg)
> +{
> + unsigned int output_line, input_line, output_line_offset;
> + struct irq_fwspec *fwspec = (struct irq_fwspec *)arg;
> + int ret;
> +
> + irq_domain_set_hwirq_and_chip(domain, virq, output_line,
> + &ts_intr_irq_chip,
> + NULL);
You set the interrupt chip and data before validating that the input
argument is valid. That does not make any sense.
> + /* Check for two input parameters: output line and corresponding input line */
> + if (fwspec->param_count != 2)
> + return -EINVAL;
> +
> + output_line = fwspec->param[0];
> +
> + /* Timesync Interrupt Router's mux-controller register starts at offset 4 from base
> + * address and each output line are at offset in multiple of 4s in Timesync INTR's
> + * register space, calculate the register offset from provided output line.
> + */
Please use proper kernel comment style as documented:
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#comment-style
This is not networking code.
> + output_line_offset = 4 * output_line + 0x4;
Magic hardcoded numbers '4' and '0x4' without any explanation of the logic.
> + output_line_to_virq[output_line] = virq;
> + input_line = fwspec->param[1] & TIMESYNC_INTRTR_ENABLE;
> +
> + /* Map output line corresponding to input line */
> + writel(input_line, tsr_data.tsr_base + output_line_offset);
> +
> + /* When interrupt enable bit is set for Timesync Interrupt Router it maps the output
> + * line with the existing input line, hence enable interrupt line after we set bits for
> + * output line.
I have no idea what this comment is trying to tell me.
> + */
> + input_line |= TIMESYNC_INTRTR_INT_ENABLE;
> + writel(input_line, tsr_data.tsr_base + output_line_offset);
> +
> + return 0;
> +}
> +
> +static void ts_intr_irq_domain_free(struct irq_domain *domain, unsigned int virq,
> + unsigned int nr_irqs)
> +{
> + struct output_line_to_virq *node, *n;
> + unsigned int output_line_offset;
> + int i;
> +
> + for (i = 0; i < TIMESYNC_INTRTR_MAX_OUTPUT_LINES; i++) {
> + if (output_line_to_virq[i] == virq) {
> + /* Calculate the register offset value from provided output line */
Can you please implement a properly commented helper function which
explains how this offset calculation is supposed to work?
> + output_line_offset = 4 * i + 0x4;
> + writel(~TIMESYNC_INTRTR_INT_ENABLE, tsr_data.tsr_base + output_line_offset);
> + }
> + }
> +}
> +
> +static const struct irq_domain_ops ts_intr_irq_domain_ops = {
> + .alloc = ts_intr_irq_domain_alloc,
> + .free = ts_intr_irq_domain_free,
> +};
> +
> +static int tsr_init(struct device_node *node)
> +{
> + tsr_data.tsr_base = of_iomap(node, 0);
> + if (IS_ERR(tsr_data.tsr_base)) {
> + pr_err("Unable to get reg\n");
> + return PTR_ERR(tsr_data.tsr_base);
> + }
> +
> + tsr_data.domain = irq_domain_create_tree(&node->fwnode, &ts_intr_irq_domain_ops, &tsr_data);
So this instantiates a interrupt domain which is completely disconnected
from the rest of the world.
How is the output side of this supposed to handle an interrupt which is
routed to it?
Thanks,
tglx
next prev parent reply other threads:[~2025-02-06 21:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 16:01 [RFC PATCH 0/2] Add support for Timesync Interrupt Router Chintan Vankar
2025-02-05 16:01 ` [RFC PATCH 1/2] irqchip: ti-tsir: " Chintan Vankar
2025-02-06 17:39 ` Simon Horman
2025-02-06 21:28 ` Thomas Gleixner [this message]
2025-02-09 8:36 ` Vankar, Chintan
2025-02-10 20:03 ` Thomas Gleixner
2025-02-13 18:45 ` Vankar, Chintan
2025-02-13 22:43 ` Thomas Gleixner
2025-02-15 11:49 ` Chintan Vankar
2025-02-17 20:17 ` Thomas Gleixner
2025-02-19 19:35 ` Vankar, Chintan
2025-02-05 16:01 ` [RFC PATCH 2/2] net: ethernet: ti: am65-cpts: Add support to configure GenF signal for CPTS Chintan Vankar
2025-02-06 5:13 ` [RFC PATCH 0/2] Add support for Timesync Interrupt Router Vignesh Raghavendra
2025-02-06 6:18 ` Chintan Vankar
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=87lduin4o5.ffs@tglx \
--to=tglx@linutronix.de \
--cc=andrew+netdev@lunn.ch \
--cc=c-vankar@ti.com \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jreeder@ti.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m-malladi@ti.com \
--cc=netdev@vger.kernel.org \
--cc=nm@ti.com \
--cc=pabeni@redhat.com \
--cc=s-vadapalli@ti.com \
--cc=srk@ti.com \
--cc=vigneshr@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox