public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: "Bastien Curutchet (Schneider Electric)" <bastien.curutchet@bootlin.com>
Cc: "Woojung Huh" <woojung.huh@microchip.com>,
	UNGLinuxDriver@microchip.com, "Andrew Lunn" <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Richard Cochran" <richardcochran@gmail.com>,
	"Simon Horman" <horms@kernel.org>,
	"Pascal Eberhard" <pascal.eberhard@se.com>,
	"Miquèl Raynal" <miquel.raynal@bootlin.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v6 2/9] net: dsa: microchip: Decorrelate IRQ domain from port
Date: Thu, 5 Mar 2026 12:07:11 +0200	[thread overview]
Message-ID: <20260305100711.byyyubdk7vycq6uh@skbuf> (raw)
In-Reply-To: <20260304-ksz8463-ptp-v6-2-3f4c47954c71@bootlin.com>

On Wed, Mar 04, 2026 at 11:18:53AM +0100, Bastien Curutchet (Schneider Electric) wrote:
> KSZ8463 has one register holding interrupt bits from both port 1 and 2.
> So it has to use one IRQ domain for both of its ports. This conflicts
> with the current initialization procedure that ties one IRQ domain to
> each port.
> 
> Decorrelate IRQ domain from port so a port can use an IRQ domain not
> directly related to itself.
> 
> Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
> ---
>  drivers/net/dsa/microchip/ksz_ptp.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchip/ksz_ptp.c
> index 4a2cc57a628f97bd51fcb11057bc4effda9205dd..64afe92a3479ec87b5afc66e489b92787a0fc715 100644
> --- a/drivers/net/dsa/microchip/ksz_ptp.c
> +++ b/drivers/net/dsa/microchip/ksz_ptp.c
> @@ -1099,18 +1099,18 @@ static void ksz_ptp_msg_irq_free(struct ksz_port *port, u8 n)
>  	irq_dispose_mapping(ptpmsg_irq->num);
>  }
>  
> -static int ksz_ptp_msg_irq_setup(struct ksz_port *port, u8 n)
> +static int ksz_ptp_msg_irq_setup(struct irq_domain *domain,
> +				 struct ksz_port *port, u8 n)
>  {
>  	u16 ts_reg[] = {REG_PTP_PORT_PDRESP_TS, REG_PTP_PORT_XDELAY_TS,
>  			REG_PTP_PORT_SYNC_TS};
>  	static const char * const name[] = {"pdresp-msg", "xdreq-msg",
>  					    "sync-msg"};
>  	const struct ksz_dev_ops *ops = port->ksz_dev->dev_ops;
> -	struct ksz_irq *ptpirq = &port->ptpirq;
>  	struct ksz_ptp_irq *ptpmsg_irq;
>  
>  	ptpmsg_irq = &port->ptpmsg_irq[n];
> -	ptpmsg_irq->num = irq_create_mapping(ptpirq->domain, n);
> +	ptpmsg_irq->num = irq_create_mapping(domain, n);

Looking at this function, I think there's a pre-existing bug.
If request_threaded_irq() later fails, irq_dispose_mapping() needs to be
called, because ksz_ptp_msg_irq_free() only frees the IRQ domains that
were already successfully set up.

>  	if (!ptpmsg_irq->num)
>  		return -EINVAL;
>  
> @@ -1162,7 +1162,7 @@ int ksz_ptp_irq_setup(struct dsa_switch *ds, u8 p)
>  		goto out;
>  
>  	for (irq = 0; irq < ptpirq->nirqs; irq++) {
> -		ret = ksz_ptp_msg_irq_setup(port, irq);
> +		ret = ksz_ptp_msg_irq_setup(ptpirq->domain, port, irq);
>  		if (ret)
>  			goto out_ptp_msg;
>  	}
> 
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-03-05 10:07 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 10:18 [PATCH net-next v6 0/9] net: dsa: microchip: Add PTP support for the KSZ8463 Bastien Curutchet (Schneider Electric)
2026-03-04 10:18 ` [PATCH net-next v6 1/9] net: dsa: microchip: Add support for KSZ8463 global irq Bastien Curutchet (Schneider Electric)
2026-03-05  9:56   ` Vladimir Oltean
2026-03-05 12:39     ` Bastien Curutchet
2026-03-05 12:51       ` Vladimir Oltean
2026-03-05 14:45         ` Bastien Curutchet
2026-03-06  1:10           ` Tristram.Ha
2026-03-06  9:03             ` Bastien Curutchet
2026-03-09 12:54             ` Bastien Curutchet
2026-03-09 20:54               ` Vladimir Oltean
2026-03-11 10:02                 ` Bastien Curutchet
2026-03-11 11:53                   ` Vladimir Oltean
2026-03-11 12:53                     ` Bastien Curutchet
2026-03-11 13:56                       ` Vladimir Oltean
2026-03-11 16:58                         ` Bastien Curutchet
2026-03-11 18:24                           ` Andrew Lunn
2026-03-11 21:24                           ` Vladimir Oltean
2026-03-12 18:28                             ` Bastien Curutchet
2026-03-13  2:05                               ` Tristram.Ha
2026-03-13  2:17                                 ` Tristram.Ha
2026-03-12  0:14                           ` Tristram.Ha
2026-03-12 13:45                             ` Vladimir Oltean
2026-03-13 15:38                               ` Vladimir Oltean
2026-03-13 17:29                                 ` Tristram.Ha
2026-03-18  9:26                                   ` Bastien Curutchet
2026-03-18 14:02                                     ` Vladimir Oltean
2026-03-04 10:18 ` [PATCH net-next v6 2/9] net: dsa: microchip: Decorrelate IRQ domain from port Bastien Curutchet (Schneider Electric)
2026-03-05 10:07   ` Vladimir Oltean [this message]
2026-03-06  9:18     ` Bastien Curutchet
2026-03-04 10:18 ` [PATCH net-next v6 3/9] net: dsa: microchip: Decorrelate msg_irq index from IRQ bit offset Bastien Curutchet (Schneider Electric)
2026-03-04 10:18 ` [PATCH net-next v6 4/9] net: dsa: microchip: Add support for KSZ8463's PTP interrupts Bastien Curutchet (Schneider Electric)
2026-03-05 10:19   ` Vladimir Oltean
2026-03-06  9:29     ` Bastien Curutchet
2026-03-04 10:18 ` [PATCH net-next v6 5/9] net: dsa: tag_ksz: Share code for KSZ8795 and KSZ9893 xmit operations Bastien Curutchet (Schneider Electric)
2026-03-04 10:18 ` [PATCH net-next v6 6/9] net: dsa: microchip: Add KSZ8463 tail tag handling Bastien Curutchet (Schneider Electric)
2026-03-04 10:18 ` [PATCH net-next v6 7/9] net: dsa: microchip: Explicitly enable detection of L2 PTP frames Bastien Curutchet (Schneider Electric)
2026-03-04 10:18 ` [PATCH net-next v6 8/9] net: dsa: microchip: Adapt port offset for KSZ8463's PTP register Bastien Curutchet (Schneider Electric)
2026-03-04 10:19 ` [PATCH net-next v6 9/9] net: dsa: microchip: Add two-step PTP support for KSZ8463 Bastien Curutchet (Schneider Electric)

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=20260305100711.byyyubdk7vycq6uh@skbuf \
    --to=olteanv@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=bastien.curutchet@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pascal.eberhard@se.com \
    --cc=richardcochran@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=woojung.huh@microchip.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