lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR12MB53815EAA1B092A309471CB1AAF719@BN9PR12MB5381.namprd12.prod.outlook.com>
Date:   Mon, 22 Aug 2022 11:53:20 +0000
From:   Vadim Pasternak <vadimp@...dia.com>
To:     Andrew Lunn <andrew@...n.ch>, Petr Machata <petrm@...dia.com>
CC:     "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Ido Schimmel <idosch@...dia.com>, mlxsw <mlxsw@...dia.com>,
        Jiri Pirko <jiri@...dia.com>
Subject: RE: [PATCH net-next 4/8] mlxsw: i2c: Add support for system interrupt
 handling



> -----Original Message-----
> From: Andrew Lunn <andrew@...n.ch>
> Sent: Monday, August 22, 2022 4:49 AM
> To: Petr Machata <petrm@...dia.com>
> Cc: David S. Miller <davem@...emloft.net>; Eric Dumazet
> <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>; Paolo Abeni
> <pabeni@...hat.com>; netdev@...r.kernel.org; Vadim Pasternak
> <vadimp@...dia.com>; Ido Schimmel <idosch@...dia.com>; mlxsw
> <mlxsw@...dia.com>; Jiri Pirko <jiri@...dia.com>
> Subject: Re: [PATCH net-next 4/8] mlxsw: i2c: Add support for system
> interrupt handling
> 
> > +static void mlxsw_i2c_work_handler(struct work_struct *work) {
> > +	struct mlxsw_i2c *mlxsw_i2c;
> > +
> > +	mlxsw_i2c = container_of(work, struct mlxsw_i2c, irq_work);
> > +	mlxsw_core_irq_event_handlers_call(mlxsw_i2c->core);
> > +}
> > +
> > +static irqreturn_t mlxsw_i2c_irq_handler(int irq, void *dev) {
> > +	struct mlxsw_i2c *mlxsw_i2c = dev;
> > +
> > +	mlxsw_core_schedule_work(&mlxsw_i2c->irq_work);
> > +
> > +	/* Interrupt handler shares IRQ line with 'main' interrupt handler.
> > +	 * Return here IRQ_NONE, while main handler will return
> IRQ_HANDLED.
> > +	 */
> > +	return IRQ_NONE;
> > +}
> > +
> > +static int mlxsw_i2c_irq_init(struct mlxsw_i2c *mlxsw_i2c, u8 addr) {
> > +	int err;
> > +
> > +	/* Initialize interrupt handler if system hotplug driver is reachable,
> > +	 * otherwise interrupt line is not enabled and interrupts will not be
> > +	 * raised to CPU. Also request_irq() call will be not valid.
> > +	 */
> > +	if (!IS_REACHABLE(CONFIG_MLXREG_HOTPLUG))
> > +		return 0;
> > +
> > +	/* Set default interrupt line. */
> > +	if (mlxsw_i2c->pdata && mlxsw_i2c->pdata->irq)
> > +		mlxsw_i2c->irq = mlxsw_i2c->pdata->irq;
> > +	else if (addr == MLXSW_FAST_I2C_SLAVE)
> > +		mlxsw_i2c->irq = MLXSW_I2C_DEFAULT_IRQ;
> > +
> > +	if (!mlxsw_i2c->irq)
> > +		return 0;
> > +
> > +	INIT_WORK(&mlxsw_i2c->irq_work, mlxsw_i2c_work_handler);
> > +	err = request_irq(mlxsw_i2c->irq, mlxsw_i2c_irq_handler,
> > +			  IRQF_TRIGGER_FALLING | IRQF_SHARED, "mlxsw-
> i2c",
> > +			  mlxsw_i2c);
> 
> I think you can make this simpler by using a request_threaded_irq()

Hi Andrew,

Thanks for your comment.

I'll validate whether it works fine for me.

But I'd prefer to make same changes also in mlxreg-hotplug driver, sharing IRQ
line with 'mlxsw-minimal' driver.

Would it be OK to send the changes later in follow-up patch?

Thanks,
Vadim.

> 
>   Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ