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: <20250303104256.48329d89@bootlin.com>
Date: Mon, 3 Mar 2025 10:42:56 +0100
From: Herve Codina <herve.codina@...tlin.com>
To: Bjorn Helgaas <helgaas@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
 <rafael@...nel.org>, Danilo Krummrich <dakr@...nel.org>, Rob Herring
 <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>, Bjorn Helgaas
 <bhelgaas@...gle.com>, Lizhi Hou <lizhi.hou@....com>,
 linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
 linux-pci@...r.kernel.org, Allan Nielsen <allan.nielsen@...rochip.com>,
 Horatiu Vultur <horatiu.vultur@...rochip.com>, Steen Hegelund
 <steen.hegelund@...rochip.com>, Thomas Petazzoni
 <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v8 2/5] PCI: of: Use device_{add,remove}_of_node() to
 attach of_node to existing device

On Fri, 28 Feb 2025 14:58:55 -0600
Bjorn Helgaas <helgaas@...nel.org> wrote:

> On Mon, Feb 24, 2025 at 03:13:52PM +0100, Herve Codina wrote:
> > The commit 407d1a51921e ("PCI: Create device tree node for bridge")
> > creates of_node for PCI devices. The newly created of_node is attached
> > to an existing device. This is done setting directly pdev->dev.of_node
> > in the code.
> > 
> > Even if pdev->dev.of_node cannot be previously set, this doesn't handle
> > the fwnode field of the struct device. Indeed, this field needs to be
> > set if it hasn't already been set.
> > 
> > device_{add,remove}_of_node() have been introduced to handle this case.  
> 
> I guess another way to say this is:
> 
>   - If dev->of_node has already been set, it is an error and we want
>     to do nothing.  The error is impossible in this case because
>     of_pci_make_dev_node() returns early if dev->of_node has been set.
> 
>   - Otherwise, we want to set dev->of_node (just as we previously
>     did), and
> 
>   - if dev->fwnode has not been set, we want to set that too.
> 
> So the whole point of this is to set dev->fwnode, which we didn't do
> before.  But has np->fwnode been set to anything?  Maybe it's buried
> somewhere inside of_changeset_create_node(), but I didn't see it.

np->fwnode can be set by ACPI. We are at the frontier between ACPI and
device-tree.

The ofnode is created and filled from an already existing device. This
device can be created from information provided by the ACPI world.
In that case, np->fwnode is set to and ACPI fwnode.

Best regards,
Hervé


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ