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: <20211008162121.6628-2-hdegoede@redhat.com>
Date:   Fri,  8 Oct 2021 18:21:10 +0200
From:   Hans de Goede <hdegoede@...hat.com>
To:     "Rafael J . Wysocki" <rjw@...ysocki.net>,
        Mark Gross <markgross@...nel.org>,
        Andy Shevchenko <andy@...radead.org>,
        Daniel Scally <djrscally@...il.com>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>
Cc:     Hans de Goede <hdegoede@...hat.com>, Len Brown <lenb@...nel.org>,
        linux-acpi@...r.kernel.org, platform-driver-x86@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Kate Hsuan <hpa@...hat.com>, linux-media@...r.kernel.org,
        linux-clk@...r.kernel.org
Subject: [PATCH 01/12] ACPI: Add has_unmet_acpi_deps() helper function

The clk and regulator frameworks expect clk/regulator consumer-devices
to have info about the consumed clks/regulators described in the device's
fw_node.

To work around cases where this info is not present in the firmware tables,
which is often the case on x86/ACPI devices, both frameworks allow the
provider-driver to attach info about consumers to the clks/regulators
when registering these.

This causes problems with the probe ordering wrt drivers for consumers
of these clks/regulators. Since the lookups are only registered when the
provider-driver binds, trying to get these clks/regulators before then
results in a -ENOENT error for clks and a dummy regulator for regulators.

ACPI-devices may have dependencies at the ACPI level (_DEP method), these
are tracked by the ACPI core, but ACPI devices will be instantiated during
boot even if they have unmet ACPI-dependencies because the _DEPs may never
get fully resolved (under Linux).

These ACPI-dependencies may be useful to solve the probe ordeing, for
example on laptops which use MIPI camera sensors connected to an Intel IPU3
for there cameras, a TI TPS68470 PMIC may be used to provide a clk +
regulators for the sensors. This TPS68470 PMIC is described using an
ACPI-device with a HID of INT3472 and the sensors have a _DEP pointing to
the INT3472 device which describes their PMIC.

The sensor drivers can use the ACPI core dependency tracking to delay
binding (return -EPROBE_DEFER) until the Linux INT3472 driver has bound
and registered the clks + regulator including lookup info, thus solving
the probe ordering issue.

Add a has_unmet_acpi_deps() which drivers can use to check if all
dependencies requested enumerated by the _DEP method have been met.

Note this relies on all drivers for devices listed in _DEP (for a
device which driver uses has_unmet_acpi_deps()) to call
acpi_dev_clear_dependencies() at the end of their probe() function.

Signed-off-by: Hans de Goede <hdegoede@...hat.com>
---
 include/linux/acpi.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 974d497a897d..7ff35d483d04 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -86,6 +86,13 @@ static inline bool has_acpi_companion(struct device *dev)
 	return is_acpi_device_node(dev->fwnode);
 }
 
+static inline bool has_unmet_acpi_deps(struct device *dev)
+{
+	struct acpi_device *adev = ACPI_COMPANION(dev);
+
+	return adev ? adev->dep_unmet : false;
+}
+
 static inline void acpi_preset_companion(struct device *dev,
 					 struct acpi_device *parent, u64 addr)
 {
@@ -802,6 +809,11 @@ static inline bool has_acpi_companion(struct device *dev)
 	return false;
 }
 
+static inline bool has_unmet_acpi_deps(struct device *dev)
+{
+	return false;
+}
+
 static inline void acpi_preset_companion(struct device *dev,
 					 struct acpi_device *parent, u64 addr)
 {
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ