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: <c05a6791-96a7-2b10-d353-eb7b316aefc8@linux.intel.com>
Date:   Thu, 19 Jan 2023 11:12:04 -0600
From:   Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To:     Charles Keepax <ckeepax@...nsource.cirrus.com>, vkoul@...nel.org
Cc:     yung-chuan.liao@...ux.intel.com, sanyog.r.kale@...el.com,
        alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
        patches@...nsource.cirrus.com
Subject: Re: [PATCH 2/2] soundwire: bus: Allow SoundWire peripherals to
 register IRQ handlers

No objection on this addition, just a couple of comments to improve it:

>  EXPORT_SYMBOL(sdw_bus_master_add);
> @@ -158,6 +183,8 @@ static int sdw_delete_slave(struct device *dev, void *data)
>  	mutex_lock(&bus->bus_lock);
>  
>  	if (slave->dev_num) { /* clear dev_num if assigned */
> +		irq_dispose_mapping(irq_find_mapping(bus->domain, slave->dev_num));
> +

could this be done conditionally. e.g.

if (slave->prop.irq)
    irq_dispose_mapping(irq_find_mapping(bus->domain, slave->dev_num));

...

>  		clear_bit(slave->dev_num, bus->assigned);
>  		if (bus->dev_num_ida_min)
>  			ida_free(&sdw_peripheral_ida, slave->dev_num);
> @@ -178,6 +205,9 @@ static int sdw_delete_slave(struct device *dev, void *data)
>  void sdw_bus_master_delete(struct sdw_bus *bus)
>  {
>  	device_for_each_child(bus->dev, NULL, sdw_delete_slave);
> +
> +	irq_domain_remove(bus->domain);
> +
>  	sdw_master_device_del(bus);
>  
>  	sdw_bus_debugfs_exit(bus);
> @@ -717,6 +747,12 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
>  			slave->dev_num = dev_num;
>  			slave->dev_num_sticky = dev_num;
>  			new_device = true;
> +
> +			slave->irq = irq_create_mapping(bus->domain, dev_num);
> +			if (!slave->irq) {
> +				dev_err(bus->dev, "Failed to map IRQ\n");
> +				return -EINVAL;
> +			}

...and here....

if (slave->prop.irq) {
	slave->irq = irq_create_mapping(bus->domain, dev_num);
	if (!slave->irq) {
		dev_err(bus->dev, "Failed to map IRQ\n");
		return -EINVAL;
	}
}

>  		} else {
>  			slave->dev_num = slave->dev_num_sticky;
>  		}
> @@ -1682,6 +1718,9 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
>  				struct device *dev = &slave->dev;
>  				struct sdw_driver *drv = drv_to_sdw_driver(dev->driver);
>  
> +				if (slave->prop.irq && slave->irq)
> +					handle_nested_irq(slave->irq);

.... that would be consistent with this conditional use.


> @@ -369,6 +371,7 @@ struct sdw_dpn_prop {
>   * @clock_reg_supported: the Peripheral implements the clock base and scale
>   * registers introduced with the SoundWire 1.2 specification. SDCA devices
>   * do not need to set this boolean property as the registers are required.
> + * @irq: call actual IRQ handler on slave, as well as callback
>   */
>  struct sdw_slave_prop {
>  	u32 mipi_revision;
> @@ -393,6 +396,7 @@ struct sdw_slave_prop {
>  	u8 scp_int1_mask;
>  	u32 quirks;
>  	bool clock_reg_supported;
> +	bool irq;

this can be confused with the 'wake_capable' property.

maybe 'out_of_band_irq' ?

There should be an explanation and something checking that both are not
used concurrently.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ