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: <20250627213241.GA168190-robh@kernel.org>
Date: Fri, 27 Jun 2025 16:32:41 -0500
From: Rob Herring <robh@...nel.org>
To: Lorenzo Pieralisi <lpieralisi@...nel.org>
Cc: Marc Zyngier <maz@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will@...nel.org>, Arnd Bergmann <arnd@...db.de>,
	Sascha Bischoff <sascha.bischoff@....com>,
	Jonathan Cameron <Jonathan.Cameron@...wei.com>,
	Timothy Hayes <timothy.hayes@....com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	"Liam R. Howlett" <Liam.Howlett@...cle.com>,
	Peter Maydell <peter.maydell@...aro.org>,
	Mark Rutland <mark.rutland@....com>,
	Jiri Slaby <jirislaby@...nel.org>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	devicetree@...r.kernel.org, linux-pci@...r.kernel.org
Subject: Re: [PATCH v6 24/31] of/irq: Add of_msi_xlate() helper function

On Thu, Jun 26, 2025 at 12:26:15PM +0200, Lorenzo Pieralisi wrote:
> Add an of_msi_xlate() helper that maps a device ID and returns
> the device node of the MSI controller the device ID is mapped to.
> 
> Required by core functions that need an MSI controller device node
> pointer at the same time as a mapped device ID, of_msi_map_id() is not
> sufficient for that purpose.
> 
> Signed-off-by: Lorenzo Pieralisi <lpieralisi@...nel.org>
> Cc: Rob Herring <robh@...nel.org>
> Cc: Marc Zyngier <maz@...nel.org>
> ---
>  drivers/of/irq.c       | 22 +++++++++++++++++-----
>  include/linux/of_irq.h |  5 +++++
>  2 files changed, 22 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> index f8ad79b9b1c9..74aaea61de13 100644
> --- a/drivers/of/irq.c
> +++ b/drivers/of/irq.c
> @@ -670,8 +670,20 @@ void __init of_irq_init(const struct of_device_id *matches)
>  	}
>  }
>  
> -static u32 __of_msi_map_id(struct device *dev, struct device_node **np,
> -			    u32 id_in)
> +/**
> + * of_msi_xlate - map a MSI ID and find relevant MSI controller node
> + * @dev: device for which the mapping is to be done.
> + * @msi_np: Pointer to store the MSI controller node
> + * @id_in: Device ID.
> + *
> + * Walk up the device hierarchy looking for devices with a "msi-map"
> + * property. If found, apply the mapping to @id_in. @msi_np pointed
> + * value must be NULL on entry, if an MSI controller is found @msi_np is
> + * initialized to the MSI controller node with a reference held.
> + *
> + * Returns: The mapped MSI id.
> + */
> +u32 of_msi_xlate(struct device *dev, struct device_node **msi_np, u32 id_in)
>  {
>  	struct device *parent_dev;
>  	u32 id_out = id_in;
> @@ -682,7 +694,7 @@ static u32 __of_msi_map_id(struct device *dev, struct device_node **np,
>  	 */
>  	for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent)
>  		if (!of_map_id(parent_dev->of_node, id_in, "msi-map",
> -				"msi-map-mask", np, &id_out))
> +				"msi-map-mask", msi_np, &id_out))
>  			break;
>  	return id_out;
>  }
> @@ -700,7 +712,7 @@ static u32 __of_msi_map_id(struct device *dev, struct device_node **np,
>   */
>  u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in)

Can we replace the 2 callers of of_msi_map_id() with of_msi_xlate()? 
The series is already big enough, so that can be a follow-up or do it 
for 6.17 if the series isn't going to make it.

Rob

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ