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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z0yLDBMAsh0yKWf2@wunner.de>
Date: Sun, 1 Dec 2024 17:13:00 +0100
From: Lukas Wunner <lukas@...ner.de>
To: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Cc: Bjorn Helgaas <helgaas@...nel.org>,
	Brian Norris <briannorris@...omium.org>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Krzysztof Wilczy??ski <kwilczynski@...nel.org>,
	Krishna chaitanya chundru <quic_krichai@...cinc.com>,
	Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
	linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
	Jon Hunter <jonathanh@...dia.com>,
	Saurabh Sengar <ssengar@...ux.microsoft.com>
Subject: Re: [PATCH 6.13] PCI/pwrctrl: Skip NULL of_node when unregistering

On Sun, Dec 01, 2024 at 01:51:08PM +0530, Manivannan Sadhasivam wrote:
> So we create pwrctl devices starting from PCI bridges. This is because,
> in order for the endpoints to be enumerated, the relevant pwrctl drivers
> need to be probed first (i.e., pci_bus_add_device() will be called for
> the endpoints only when they are detected on the bus, but that cannot
> happen until the relevant pwrctl driver is probed). That's why we have
> the loop in pci_pwrctrl_create_devices() to iterate over the children
> of PCI bridges defined in devicetree.

I think a better approach would be to create a pwrctrl device when
the corresponding PCI device is scanned.

In pci_scan_child_bus_extend(), you'll find this loop:

	/* Go find them, Rover! */
	for (devfn = 0; devfn < 256; devfn += 8)
		pci_scan_slot(bus, devfn);

... where pci_scan_slot() reads the Vendor ID to determine whether
a device is present at the devfn address and then goes on to
create the pci_dev.

I think what you want to do is, just before the Vendor ID is read,
create the pwrctrl device and enable power.  The OF node of the
pwrctrl device can be found by way of the devfn, right?  So you
can just search whether an OF node exists for a given devfn.

Moreover, for multifunction devices I think you may want to use
refcounting so that the pwrctrl device does not cut power unless
the refcount reaches zero.

Thanks,

Lukas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ