Skip to contentSkip to conversation

drivers: Boot Constraint core

PATCH In review Viresh Kumar 4 participants 20 messages Feb 23, 2018 – Apr 11, 2018

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

v7 cover drivers: Boot Constraint core

Hi Greg,

The V7 version incorporates the organizational changes suggested by Olof earlier. Everything else is same otherwise.

I have tested the Hisilicon patches (again) on hikey 9660 board, IMX stuff was earlier tested by Sascha (Pengutronix) on i.MX6 and Qualcomm stuff was earlier tested by Rajendra (Qualcomm) on Dragonboard 410C (This required some more patches related to display driver which Rajendra should be sending separately later on).

Problem statement:

Some devices are powered ON by the bootloader before the bootloader handovers control to Linux. It maybe important for some of those devices to keep working until the time a Linux device driver probes the device and reconfigure its resources.

A typical example of that can be the LCD controller, which is used by the bootloaders to show image(s) while the platform is booting into Linux. The LCD controller can be using some resources, like clk, regulators, etc, that are shared between several devices. These shared resources should be configured to satisfy need of all the users. If another device's (X) driver gets probed before the LCD controller driver in this case, then it may end up disabling or reconfiguring these resources to ranges satisfying the current users (only device X) and that can make the LCD screen unstable.

Another case can be a debug serial port enabled from the bootloader.

Of course we can have more complex cases where the same resource is getting used by two devices while the kernel boots and the order in which devices get probed wouldn't matter as the other device will surely break then.

There are also cases where the resources may not be shared, but the kernel will disable them forcefully as no users may have appeared until a certain point in kernel boot. This makes sure that the resources stay enabled. A wide variety of constraints can be satisfied using the new framework.

Proposed solution:

This series introduces the concept of "boot-constraint", which are set by platform specific drivers (for now at least) at early init (like subsys_initcall) and the kernel will keep satisfying them until the time driver for such a device is probed (successfully or unsuccessfully). Once the driver is probed, the driver core removes the constraints set for the device. This series implements clk, regulator and PM domain constraints currently.

Pushed here:
git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git boot-constraint

More documentation on it can be found here:
https://lwn.net/Articles/747250/

V6->V7:
- s/drivers\/boot_constraint/drivers\/bootconstraint/ (Olof)
- Moved platform drivers to drivers/soc/<platform>/boot_constraint.c
- Changed year in file copyrights: s/2017/2018

V5->V6:
- Fix a build error reported by build bot for !CONFIG_OF_ADDRESS. This was already sent on 15th December.
- Rebased over latest driver-core-next.

V4->V5:
- SPDX Licence format used.
- arm,primecell stuff removed from boot constraint core and added a helper in OF core (which already handles amba and platform devices).
- Removed a bunch of BUG_ON(), pr_fmt(), comments.
- Changed directory and other names from boot_constraints/boot_constraint.
- Removed serial.o file and moved the code to hikey and imx files.
- Don't return error from dummy helper.
- Added documentation and corresponding kernel doc comments in the code.
- Updated MAINTAINERS.

V3->V4:
- Added support for imx, hikey and Qcom usecases.
- Enhanced boot constraints core to make drivers code easy and handle complex cases.
- Two new patches for OF included to provide APIs to boot constraint core.
- Removed the kernel parameter patch for now.
- Don't check return values of debugfs routines.
- Moved the boot constraints core from drivers/base/ to drivers/.

V2->V3:
- Removed DT support as we aren't sure about how to define the bindings yet.
- Added CLK and PM domain constraint types.
- A new directory is added for boot constraints, which will also contain platform specific drivers in future.
- Deferred devices are still supported, just that it wouldn't be called from generic code anymore but platform specific code.
- Tested on Qcom 410c dragonboard with display flash screen (Rajendra).
- Usual renaming/commit-log-updates/etc changes done.

V1->V2:
- Add support for setting constraints for devices created from DT.
- Allow handling deferred devices earlier then late_init.
- Remove 'default y' line from kconfig.
- Drop '=" after boot_constraints_disable kernel param.
- Dropped the dummy testing patch now.

--
viresh

*** BLURB HERE ***

Viresh Kumar (13):
of: platform: Add of_find_any_device_by_node()
of: platform: Make of_platform_bus_create() global
drivers: Add boot constraints core
boot_constraint: Add support for supply constraints
boot_constraint: Add support for clk constraints
boot_constraint: Add support for PM constraints
boot_constraint: Add debugfs support
boot_constraint: Manage deferrable constraints
boot_constraint: Add support for Hisilicon platforms
boot_constraint: Add support for IMX platform
boot_constraint: Add Qualcomm display controller constraints
boot_constraint: Update MAINTAINERS
boot_constraint: Add documentation

 .../driver-api/boot-constraint/constraints.rst     |  98 +++++++
 Documentation/driver-api/boot-constraint/index.rst |   4 +
 Documentation/driver-api/index.rst                 |   1 +
 MAINTAINERS                                        |   9 +
 drivers/Kconfig                                    |   2 +
 drivers/Makefile                                   |   1 +
 drivers/base/dd.c                                  |  32 ++-
 drivers/bootconstraint/Kconfig                     |   9 +
 drivers/bootconstraint/Makefile                    |   3 +
 drivers/bootconstraint/clk.c                       |  70 +++++
 drivers/bootconstraint/core.c                      | 290 +++++++++++++++++++++
 drivers/bootconstraint/core.h                      |  47 ++++
 drivers/bootconstraint/deferrable_dev.c            | 241 +++++++++++++++++
 drivers/bootconstraint/pm.c                        |  28 ++
 drivers/bootconstraint/supply.c                    | 104 ++++++++
 drivers/clk/imx/clk-imx25.c                        |  12 -
 drivers/clk/imx/clk-imx27.c                        |  13 -
 drivers/clk/imx/clk-imx31.c                        |  12 -
 drivers/clk/imx/clk-imx35.c                        |  10 -
 drivers/clk/imx/clk-imx51-imx53.c                  |  16 --
 drivers/clk/imx/clk-imx6q.c                        |   8 -
 drivers/clk/imx/clk-imx6sl.c                       |   8 -
 drivers/clk/imx/clk-imx6sx.c                       |   8 -
 drivers/clk/imx/clk-imx7d.c                        |  14 -
 drivers/clk/imx/clk.c                              |  38 ---
 drivers/clk/imx/clk.h                              |   1 -
 drivers/of/platform.c                              |  63 ++++-
 drivers/soc/Kconfig                                |   1 +
 drivers/soc/Makefile                               |   1 +
 drivers/soc/hisilicon/Kconfig                      |  15 ++
 drivers/soc/hisilicon/Makefile                     |   3 +
 drivers/soc/hisilicon/boot_constraint.c            | 158 +++++++++++
 drivers/soc/imx/Kconfig                            |   8 +
 drivers/soc/imx/Makefile                           |   1 +
 drivers/soc/imx/boot_constraint.c                  | 126 +++++++++
 drivers/soc/qcom/Kconfig                           |   8 +
 drivers/soc/qcom/Makefile                          |   1 +
 drivers/soc/qcom/boot_constraint.c                 | 122 +++++++++
 include/linux/boot_constraint.h                    | 121 +++++++++
 include/linux/of_platform.h                        |  16 ++
 40 files changed, 1572 insertions(+), 151 deletions(-)
 create mode 100644 Documentation/driver-api/boot-constraint/constraints.rst
 create mode 100644 Documentation/driver-api/boot-constraint/index.rst
 create mode 100644 drivers/bootconstraint/Kconfig
 create mode 100644 drivers/bootconstraint/Makefile
 create mode 100644 drivers/bootconstraint/clk.c
 create mode 100644 drivers/bootconstraint/core.c
 create mode 100644 drivers/bootconstraint/core.h
 create mode 100644 drivers/bootconstraint/deferrable_dev.c
 create mode 100644 drivers/bootconstraint/pm.c
 create mode 100644 drivers/bootconstraint/supply.c
 create mode 100644 drivers/soc/hisilicon/Kconfig
 create mode 100644 drivers/soc/hisilicon/Makefile
 create mode 100644 drivers/soc/hisilicon/boot_constraint.c
 create mode 100644 drivers/soc/imx/boot_constraint.c
 create mode 100644 drivers/soc/qcom/boot_constraint.c
 create mode 100644 include/linux/boot_constraint.h
Signature · 1 line
2.15.0.194.g9af6a3dea062
#1 lore raw

PATCH v7 1/13 of: platform: Add of_find_any_device_by_node()

This creates a new helper that returns the struct device corresponding to a struct device_node. This currently works only for amba and platform devices, but can be easily extended to include other bus types.

This also creates an internal of_find_amba_device_by_node() helper, which isn't exported as of now.

---
 drivers/of/platform.c       | 55 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/of_platform.h |  5 +++++
 2 files changed, 60 insertions(+)
drivers/of/platform.c +55 -0
index c00d81dfac0b..72853f9043e6 100644
@@ -55,6 +55,61 @@ struct platform_device *of_find_device_by_node(struct device_node *np)
 }
 EXPORT_SYMBOL(of_find_device_by_node);
 
+#ifdef CONFIG_ARM_AMBA
+/**
+ * of_find_amba_device_by_node - Find the amba_device associated with a node
+ * @np: Pointer to device tree node
+ *
+ * Takes a reference to the embedded struct device which needs to be dropped
+ * after use.
+ *
+ * Returns amba_device pointer, or NULL if not found
+ */
+static struct amba_device *of_find_amba_device_by_node(struct device_node *np)
+{
+	struct device *dev;
+
+	dev = bus_find_device(&amba_bustype, NULL, np, of_dev_node_match);
+	return dev ? to_amba_device(dev) : NULL;
+}
+#else
+static inline struct amba_device *of_find_amba_device_by_node(struct device_node *np)
+{
+	return NULL;
+}
+#endif
+
+/**
+ * of_find_any_device_by_node - Find the struct device associated with a node
+ * @np: Pointer to device tree node
+ *
+ * Takes a reference to the embedded struct device which needs to be dropped
+ * after use.
+ *
+ * This currently supports only AMBA and platform devices.
+ *
+ * Returns struct device pointer, or NULL if not found
+ */
+struct device *of_find_any_device_by_node(struct device_node *np)
+{
+	struct device *dev = NULL;
+
+	if (of_device_is_compatible(np, "arm,primecell")) {
+		struct amba_device *adev = of_find_amba_device_by_node(np);
+
+		if (adev)
+			dev = &adev->dev;
+	} else {
+		struct platform_device *pdev = of_find_device_by_node(np);
+
+		if (pdev)
+			dev = &pdev->dev;
+	}
+
+	return dev;
+}
+EXPORT_SYMBOL(of_find_any_device_by_node);
+
 #ifdef CONFIG_OF_ADDRESS
 /*
  * The following routines scan a subtree and registers a device for
include/linux/of_platform.h +5 -0
index 84a966623e78..5fb20afaf895 100644
@@ -54,11 +54,16 @@ extern struct platform_device *of_device_alloc(struct device_node *np,
 					 struct device *parent);
 #ifdef CONFIG_OF
 extern struct platform_device *of_find_device_by_node(struct device_node *np);
+extern struct device *of_find_any_device_by_node(struct device_node *np);
 #else
 static inline struct platform_device *of_find_device_by_node(struct device_node *np)
 {
 	return NULL;
 }
+static inline struct device *of_find_any_device_by_node(struct device_node *np)
+{
+	return NULL;
+}
 #endif
 
 /* Platform devices and busses creation */
Signature · 1 line
2.15.0.194.g9af6a3dea062
#2 lore raw

PATCH v7 2/13 of: platform: Make of_platform_bus_create() global

In reply to Viresh Kumar

The boot constraints core needs to create platform or AMBA devices corresponding to a compatible string and not for rest of the nodes in DT. of_platform_bus_create() fits in the best to achieve that.

Allow it to be used outside of platform.c.

---
 drivers/of/platform.c       |  8 ++++----
 include/linux/of_platform.h | 11 +++++++++++
 2 files changed, 15 insertions(+), 4 deletions(-)
drivers/of/platform.c +4 -4
index 72853f9043e6..dfbb9f38cb37 100644
@@ -392,10 +392,10 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
  * Creates a platform_device for the provided device_node, and optionally
  * recursively create devices for all the child nodes.
  */
-static int of_platform_bus_create(struct device_node *bus,
-				  const struct of_device_id *matches,
-				  const struct of_dev_auxdata *lookup,
-				  struct device *parent, bool strict)
+int of_platform_bus_create(struct device_node *bus,
+			   const struct of_device_id *matches,
+			   const struct of_dev_auxdata *lookup,
+			   struct device *parent, bool strict)
 {
 	const struct of_dev_auxdata *auxdata;
 	struct device_node *child;
include/linux/of_platform.h +11 -0
index 5fb20afaf895..7a5313553c2a 100644
@@ -76,6 +76,10 @@ extern int of_platform_bus_probe(struct device_node *root,
 				 const struct of_device_id *matches,
 				 struct device *parent);
 #ifdef CONFIG_OF_ADDRESS
+extern int of_platform_bus_create(struct device_node *bus,
+				  const struct of_device_id *matches,
+				  const struct of_dev_auxdata *lookup,
+				  struct device *parent, bool strict);
 extern int of_platform_populate(struct device_node *root,
 				const struct of_device_id *matches,
 				const struct of_dev_auxdata *lookup,
@@ -89,6 +93,13 @@ extern int devm_of_platform_populate(struct device *dev);
 
 extern void devm_of_platform_depopulate(struct device *dev);
 #else
+static inline int of_platform_bus_create(struct device_node *bus,
+					 const struct of_device_id *matches,
+					 const struct of_dev_auxdata *lookup,
+					 struct device *parent, bool strict)
+{
+	return -ENODEV;
+}
 static inline int of_platform_populate(struct device_node *root,
 					const struct of_device_id *matches,
 					const struct of_dev_auxdata *lookup,
Signature · 1 line
2.15.0.194.g9af6a3dea062
#3 lore raw

PATCH v7 3/13 drivers: Add boot constraints core

In reply to Viresh Kumar

Some devices are powered ON by the bootloader before the bootloader handovers control to Linux. It maybe important for those devices to keep working until the time a Linux device driver probes the device and reconfigure its resources.

A typical example of that can be the LCD controller, which is used by the bootloaders to show image(s) while the platform is booting into Linux. The LCD controller can be using some resources, like clk, regulators, PM domain, etc, that are shared between several devices. These shared resources should be configured to satisfy need of all the users. If another device's (X) driver gets probed before the LCD controller driver in this case, then it may end up reconfiguring these resources to ranges satisfying the current users (only device X) and that can make the LCD screen unstable.

This patch introduces the concept of boot-constraints, which will be set by the bootloaders and the kernel will satisfy them until the time driver for such a device is probed (successfully or unsuccessfully).

The list of boot constraint types is empty for now, and will be incrementally updated by later patches.

Only two routines are exposed by the boot constraints core for now:

- dev_boot_constraint_add(): This shall be called by parts of the kernel (before the device is probed) to set the constraints.

- dev_boot_constraints_remove(): This is called only by the driver core after a device is probed successfully or unsuccessfully. Special handling is done here for deferred probing.

---
 drivers/Kconfig                 |   2 +
 drivers/Makefile                |   1 +
 drivers/base/dd.c               |  20 ++--
 drivers/bootconstraint/Kconfig  |   9 ++
 drivers/bootconstraint/Makefile |   3 +
 drivers/bootconstraint/core.c   | 219 ++++++++++++++++++++++++++++++++++++++++
 drivers/bootconstraint/core.h   |  30 ++++++
 include/linux/boot_constraint.h |  66 ++++++++++++
 8 files changed, 343 insertions(+), 7 deletions(-)
 create mode 100644 drivers/bootconstraint/Kconfig
 create mode 100644 drivers/bootconstraint/Makefile
 create mode 100644 drivers/bootconstraint/core.c
 create mode 100644 drivers/bootconstraint/core.h
 create mode 100644 include/linux/boot_constraint.h
drivers/Kconfig +2 -0
index 879dc0604cba..2cef3c2563b6 100644
@@ -5,6 +5,8 @@ source "drivers/amba/Kconfig"
 
 source "drivers/base/Kconfig"
 
+source "drivers/bootconstraint/Kconfig"
+
 source "drivers/bus/Kconfig"
 
 source "drivers/connector/Kconfig"
drivers/Makefile +1 -0
index 24cd47014657..a38c8b0af3af 100644
@@ -70,6 +70,7 @@ obj-$(CONFIG_FB_INTEL)          += video/fbdev/intelfb/
 obj-$(CONFIG_PARPORT)		+= parport/
 obj-$(CONFIG_NVM)		+= lightnvm/
 obj-y				+= base/ block/ misc/ mfd/ nfc/
+obj-$(CONFIG_DEV_BOOT_CONSTRAINT) += bootconstraint/
 obj-$(CONFIG_LIBNVDIMM)		+= nvdimm/
 obj-$(CONFIG_DAX)		+= dax/
 obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/
drivers/base/dd.c +13 -7
index de6fd092bf2f..777267aa1710 100644
@@ -16,6 +16,7 @@
  * Copyright (c) 2007-2009 Novell Inc.
  */
 
+#include <linux/boot_constraint.h>
 #include <linux/device.h>
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
@@ -445,15 +446,20 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 	 */
 	devices_kset_move_last(dev);
 
-	if (dev->bus->probe) {
+	if (dev->bus->probe)
 		ret = dev->bus->probe(dev);
-		if (ret)
-			goto probe_failed;
-	} else if (drv->probe) {
+	else if (drv->probe)
 		ret = drv->probe(dev);
-		if (ret)
-			goto probe_failed;
-	}
+
+	/*
+	 * Remove boot constraints for both successful and unsuccessful probe(),
+	 * except for the case where EPROBE_DEFER is returned by probe().
+	 */
+	if (ret != -EPROBE_DEFER)
+		dev_boot_constraints_remove(dev);
+
+	if (ret)
+		goto probe_failed;
 
 	if (test_remove) {
 		test_remove = false;
drivers/bootconstraint/Kconfig new file +9 -0
new file mode 100644
index 000000000000..9195f9a39fe2
@@ -0,0 +1,9 @@
+config DEV_BOOT_CONSTRAINT
+	bool "Boot constraints for devices"
+	help
+	  This enables boot constraints detection for devices. These constraints
+	  are (normally) set by the Bootloader and must be satisfied by the
+	  kernel until the relevant device driver is probed. Once the driver is
+	  probed, the constraint is dropped.
+
+	  If unsure, say N.
drivers/bootconstraint/Makefile new file +3 -0
new file mode 100644
index 000000000000..0f2680177974
@@ -0,0 +1,3 @@
+# Makefile for device boot constraints
+
+obj-y := core.o
drivers/bootconstraint/core.c new file +219 -0

219 lines not on this page · raw message

drivers/bootconstraint/core.h new file +30 -0
new file mode 100644
index 000000000000..d04bd484b2a7
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Linaro.
+ * Viresh Kumar <[email protected]>
+ */
+#ifndef _CORE_H
+#define _CORE_H
+
+#include <linux/boot_constraint.h>
+#include <linux/device.h>
+#include <linux/list.h>
+
+struct constraint_dev {
+	struct device *dev;
+	struct list_head node;
+	struct list_head constraints;
+};
+
+struct constraint {
+	struct constraint_dev *cdev;
+	struct list_head node;
+	enum dev_boot_constraint_type type;
+	void (*free_resources)(void *data);
+	void *free_resources_data;
+
+	int (*add)(struct constraint *constraint, void *data);
+	void (*remove)(struct constraint *constraint);
+	void *private;
+};
+#endif /* _CORE_H */
include/linux/boot_constraint.h new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
2.15.0.194.g9af6a3dea062
#4 lore raw

PATCH v7 4/13 boot_constraint: Add support for supply constraints

In reply to Viresh Kumar

This patch adds the first constraint type: power-supply.

The constraint is set by enabling the regulator and setting a voltage range (if required) for the respective regulator device, which will be honored by the regulator core even if more users turn up. Once the device is probed, the regulator is released and the constraint is removed.

---
 drivers/bootconstraint/Makefile |  2 +-
 drivers/bootconstraint/core.c   |  4 ++
 drivers/bootconstraint/core.h   |  5 +++
 drivers/bootconstraint/supply.c | 95 +++++++++++++++++++++++++++++++++++++++++
 include/linux/boot_constraint.h | 17 +++++++-
 5 files changed, 121 insertions(+), 2 deletions(-)
 create mode 100644 drivers/bootconstraint/supply.c
drivers/bootconstraint/Makefile +1 -1
index 0f2680177974..a45616f0c3b0 100644
@@ -1,3 +1,3 @@
 # Makefile for device boot constraints
 
-obj-y := core.o
+obj-y := core.o supply.o
drivers/bootconstraint/core.c +4 -0
index a9f38a0febb3..2973f8dd9094 100644
@@ -91,6 +91,10 @@ static struct constraint *constraint_allocate(struct constraint_dev *cdev,
 	void (*remove)(struct constraint *constraint);
 
 	switch (type) {
+	case DEV_BOOT_CONSTRAINT_SUPPLY:
+		add = constraint_supply_add;
+		remove = constraint_supply_remove;
+		break;
 	default:
 		return ERR_PTR(-EINVAL);
 	}
drivers/bootconstraint/core.h +5 -0
index d04bd484b2a7..44c219716be5 100644
@@ -27,4 +27,9 @@ struct constraint {
 	void (*remove)(struct constraint *constraint);
 	void *private;
 };
+
+/* Forward declarations of constraint specific callbacks */
+int constraint_supply_add(struct constraint *constraint, void *data);
+void constraint_supply_remove(struct constraint *constraint);
+
 #endif /* _CORE_H */
drivers/bootconstraint/supply.c new file +95 -0

95 lines not on this page · raw message

include/linux/boot_constraint.h +16 -1
index d56e33f3f921..736fe09a8589 100644
@@ -16,9 +16,24 @@ struct device;
 /**
  * enum dev_boot_constraint_type - This defines different boot constraint types.
  *
+ * @DEV_BOOT_CONSTRAINT_SUPPLY: This represents a power supply boot constraint.
  */
 enum dev_boot_constraint_type {
-	DEV_BOOT_CONSTRAINT_NONE,
+	DEV_BOOT_CONSTRAINT_SUPPLY,
+};
+
+/**
+ * struct dev_boot_constraint_supply_info - Power supply boot constraint
+ * information.
+ *
+ * @name: This must match the power supply name for the device.
+ * @u_volt_min: This is the minimum microvolts value supported by the device.
+ * @u_volt_max: This is the maximum microvolts value supported by the device.
+ */
+struct dev_boot_constraint_supply_info {
+	const char *name;
+	unsigned int u_volt_min;
+	unsigned int u_volt_max;
 };
 
 /**
Signature · 1 line
2.15.0.194.g9af6a3dea062
#5 lore raw

PATCH v7 5/13 boot_constraint: Add support for clk constraints

In reply to Viresh Kumar

This patch adds the clk constraint type.

The constraint is set by enabling the clk for the device. Once the device is probed, the clk is disabled and the constraint is removed.

We may want to do clk_set_rate() from here, but lets wait for some real users that really want it.

---
 drivers/bootconstraint/Makefile |  2 +-
 drivers/bootconstraint/clk.c    | 67 +++++++++++++++++++++++++++++++++++++++++
 drivers/bootconstraint/core.c   |  4 +++
 drivers/bootconstraint/core.h   |  3 ++
 include/linux/boot_constraint.h | 11 +++++++
 5 files changed, 86 insertions(+), 1 deletion(-)
 create mode 100644 drivers/bootconstraint/clk.c
drivers/bootconstraint/Makefile +1 -1
index a45616f0c3b0..3424379fd1e4 100644
@@ -1,3 +1,3 @@
 # Makefile for device boot constraints
 
-obj-y := core.o supply.o
+obj-y := clk.o core.o supply.o
drivers/bootconstraint/clk.c new file +67 -0

67 lines not on this page · raw message

drivers/bootconstraint/core.c +4 -0
index 2973f8dd9094..a73744c5d599 100644
@@ -91,6 +91,10 @@ static struct constraint *constraint_allocate(struct constraint_dev *cdev,
 	void (*remove)(struct constraint *constraint);
 
 	switch (type) {
+	case DEV_BOOT_CONSTRAINT_CLK:
+		add = constraint_clk_add;
+		remove = constraint_clk_remove;
+		break;
 	case DEV_BOOT_CONSTRAINT_SUPPLY:
 		add = constraint_supply_add;
 		remove = constraint_supply_remove;
drivers/bootconstraint/core.h +3 -0
index 44c219716be5..09a6176541d7 100644
@@ -29,6 +29,9 @@ struct constraint {
 };
 
 /* Forward declarations of constraint specific callbacks */
+int constraint_clk_add(struct constraint *constraint, void *data);
+void constraint_clk_remove(struct constraint *constraint);
+
 int constraint_supply_add(struct constraint *constraint, void *data);
 void constraint_supply_remove(struct constraint *constraint);
 
include/linux/boot_constraint.h +11 -0
index 736fe09a8589..4685ff55fff8 100644
@@ -16,12 +16,23 @@ struct device;
 /**
  * enum dev_boot_constraint_type - This defines different boot constraint types.
  *
+ * @DEV_BOOT_CONSTRAINT_CLK: This represents a clock boot constraint.
  * @DEV_BOOT_CONSTRAINT_SUPPLY: This represents a power supply boot constraint.
  */
 enum dev_boot_constraint_type {
+	DEV_BOOT_CONSTRAINT_CLK,
 	DEV_BOOT_CONSTRAINT_SUPPLY,
 };
 
+/**
+ * struct dev_boot_constraint_clk_info - Clock boot constraint information.
+ *
+ * @name: This must match the connection-id of the clock for the device.
+ */
+struct dev_boot_constraint_clk_info {
+	const char *name;
+};
+
 /**
  * struct dev_boot_constraint_supply_info - Power supply boot constraint
  * information.
Signature · 1 line
2.15.0.194.g9af6a3dea062
#6 lore raw

PATCH v7 6/13 boot_constraint: Add support for PM constraints

In reply to Viresh Kumar

This patch adds the PM constraint type.

The constraint is set by attaching the power domain for the device, which will also enable the power domain. This guarantees that the power domain doesn't get shut down while being used.

We don't need to detach the power domain to remove the constraint as the domain is attached only once, from here or before driver probe.

---
 drivers/bootconstraint/Makefile |  2 +-
 drivers/bootconstraint/core.c   |  4 ++++
 drivers/bootconstraint/core.h   |  3 +++
 drivers/bootconstraint/pm.c     | 21 +++++++++++++++++++++
 include/linux/boot_constraint.h |  2 ++
 5 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 drivers/bootconstraint/pm.c
drivers/bootconstraint/Makefile +1 -1
index 3424379fd1e4..b7ade1a7afb5 100644
@@ -1,3 +1,3 @@
 # Makefile for device boot constraints
 
-obj-y := clk.o core.o supply.o
+obj-y := clk.o core.o pm.o supply.o
drivers/bootconstraint/core.c +4 -0
index a73744c5d599..a6148b625b48 100644
@@ -95,6 +95,10 @@ static struct constraint *constraint_allocate(struct constraint_dev *cdev,
 		add = constraint_clk_add;
 		remove = constraint_clk_remove;
 		break;
+	case DEV_BOOT_CONSTRAINT_PM:
+		add = constraint_pm_add;
+		remove = constraint_pm_remove;
+		break;
 	case DEV_BOOT_CONSTRAINT_SUPPLY:
 		add = constraint_supply_add;
 		remove = constraint_supply_remove;
drivers/bootconstraint/core.h +3 -0
index 09a6176541d7..35ea984d74f0 100644
@@ -32,6 +32,9 @@ struct constraint {
 int constraint_clk_add(struct constraint *constraint, void *data);
 void constraint_clk_remove(struct constraint *constraint);
 
+int constraint_pm_add(struct constraint *constraint, void *data);
+void constraint_pm_remove(struct constraint *constraint);
+
 int constraint_supply_add(struct constraint *constraint, void *data);
 void constraint_supply_remove(struct constraint *constraint);
 
drivers/bootconstraint/pm.c new file +21 -0
new file mode 100644
index 000000000000..f52bff240dd5
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Linaro.
+ * Viresh Kumar <[email protected]>
+ */
+
+#include <linux/pm_domain.h>
+
+#include "core.h"
+
+int constraint_pm_add(struct constraint *constraint, void *data)
+{
+	struct device *dev = constraint->cdev->dev;
+
+	return dev_pm_domain_attach(dev, true);
+}
+
+void constraint_pm_remove(struct constraint *constraint)
+{
+	/* Nothing to do for now */
+}
include/linux/boot_constraint.h +2 -0
index 4685ff55fff8..fbccb62f423d 100644
@@ -17,10 +17,12 @@ struct device;
  * enum dev_boot_constraint_type - This defines different boot constraint types.
  *
  * @DEV_BOOT_CONSTRAINT_CLK: This represents a clock boot constraint.
+ * @DEV_BOOT_CONSTRAINT_PM: This represents a power domain boot constraint.
  * @DEV_BOOT_CONSTRAINT_SUPPLY: This represents a power supply boot constraint.
  */
 enum dev_boot_constraint_type {
 	DEV_BOOT_CONSTRAINT_CLK,
+	DEV_BOOT_CONSTRAINT_PM,
 	DEV_BOOT_CONSTRAINT_SUPPLY,
 };
 
Signature · 1 line
2.15.0.194.g9af6a3dea062
#7 lore raw

PATCH v7 7/13 boot_constraint: Add debugfs support

In reply to Viresh Kumar

This patch adds debugfs support for boot constraints. This is how it looks for a "vmmc-supply" constraint for the MMC device.

$ ls -R /sys/kernel/debug/boot_constraints/
/sys/kernel/debug/boot_constraints/:
f723d000.dwmmc0

/sys/kernel/debug/boot_constraints/f723d000.dwmmc0:
clk-ciu pm-domain supply-vmmc supply-vmmcaux

/sys/kernel/debug/boot_constraints/f723d000.dwmmc0/clk-ciu:

/sys/kernel/debug/boot_constraints/f723d000.dwmmc0/pm-domain:

/sys/kernel/debug/boot_constraints/f723d000.dwmmc0/supply-vmmc:
u_volt_max u_volt_min

/sys/kernel/debug/boot_constraints/f723d000.dwmmc0/supply-vmmcaux:
u_volt_max u_volt_min

---
 drivers/bootconstraint/clk.c    |  3 +++
 drivers/bootconstraint/core.c   | 59 +++++++++++++++++++++++++++++++++++++++++
 drivers/bootconstraint/core.h   |  6 +++++
 drivers/bootconstraint/pm.c     | 11 ++++++--
 drivers/bootconstraint/supply.c |  9 +++++++
 5 files changed, 86 insertions(+), 2 deletions(-)
drivers/bootconstraint/clk.c +3 -0
index 90262fe9057c..1ee8ab1978a5 100644
@@ -46,6 +46,8 @@ int constraint_clk_add(struct constraint *constraint, void *data)
 	cclk->clk_info.name = kstrdup_const(clk_info->name, GFP_KERNEL);
 	constraint->private = cclk;
 
+	constraint_add_debugfs(constraint, clk_info->name);
+
 	return 0;
 
 put_clk:
@@ -60,6 +62,7 @@ void constraint_clk_remove(struct constraint *constraint)
 {
 	struct constraint_clk *cclk = constraint->private;
 
+	constraint_remove_debugfs(constraint);
 	kfree_const(cclk->clk_info.name);
 	clk_disable_unprepare(cclk->clk);
 	clk_put(cclk->clk);
drivers/bootconstraint/core.c +59 -0

77 lines not on this page · raw message

drivers/bootconstraint/core.h +6 -0
index 35ea984d74f0..3084baaee127 100644
@@ -7,6 +7,7 @@
 #define _CORE_H
 
 #include <linux/boot_constraint.h>
+#include <linux/debugfs.h>
 #include <linux/device.h>
 #include <linux/list.h>
 
@@ -14,6 +15,7 @@ struct constraint_dev {
 	struct device *dev;
 	struct list_head node;
 	struct list_head constraints;
+	struct dentry *dentry;
 };
 
 struct constraint {
@@ -22,12 +24,16 @@ struct constraint {
 	enum dev_boot_constraint_type type;
 	void (*free_resources)(void *data);
 	void *free_resources_data;
+	struct dentry *dentry;
 
 	int (*add)(struct constraint *constraint, void *data);
 	void (*remove)(struct constraint *constraint);
 	void *private;
 };
 
+void constraint_add_debugfs(struct constraint *constraint, const char *suffix);
+void constraint_remove_debugfs(struct constraint *constraint);
+
 /* Forward declarations of constraint specific callbacks */
 int constraint_clk_add(struct constraint *constraint, void *data);
 void constraint_clk_remove(struct constraint *constraint);
drivers/bootconstraint/pm.c +9 -2
index f52bff240dd5..65810d9485bc 100644
@@ -11,11 +11,18 @@
 int constraint_pm_add(struct constraint *constraint, void *data)
 {
 	struct device *dev = constraint->cdev->dev;
+	int ret;
 
-	return dev_pm_domain_attach(dev, true);
+	ret = dev_pm_domain_attach(dev, true);
+	if (ret)
+		return ret;
+
+	constraint_add_debugfs(constraint, "domain");
+
+	return 0;
 }
 
 void constraint_pm_remove(struct constraint *constraint)
 {
-	/* Nothing to do for now */
+	constraint_remove_debugfs(constraint);
 }
drivers/bootconstraint/supply.c +9 -0
index 352ded92d057..8965db534be6 100644
@@ -57,6 +57,14 @@ int constraint_supply_add(struct constraint *constraint, void *data)
 	csupply->supply.name = kstrdup_const(supply->name, GFP_KERNEL);
 	constraint->private = csupply;
 
+	constraint_add_debugfs(constraint, supply->name);
+
+	debugfs_create_u32("u_volt_min", 0444, constraint->dentry,
+			   &csupply->supply.u_volt_min);
+
+	debugfs_create_u32("u_volt_max", 0444, constraint->dentry,
+			   &csupply->supply.u_volt_max);
+
 	return 0;
 
 remove_voltage:
@@ -77,6 +85,7 @@ void constraint_supply_remove(struct constraint *constraint)
 	struct device *dev = constraint->cdev->dev;
 	int ret;
 
+	constraint_remove_debugfs(constraint);
 	kfree_const(supply->name);
 
 	ret = regulator_disable(csupply->reg);
Signature · 1 line
2.15.0.194.g9af6a3dea062
#8 lore raw

PATCH v7 8/13 boot_constraint: Manage deferrable constraints

In reply to Viresh Kumar

It is possible that some of the resources aren't available at the time constraints are getting set and the boot constraints core will return -EPROBE_DEFER for them. In order to retry adding the constraints at a later point of time (after the resource is added and before any of its users come up), this patch proposes two things:

- Each constraint is represented by a virtual platform device, so that it is re-probed again until the time all the dependencies aren't met. The platform device is removed along with the constraint, with help of the free_resources() callback.

- Enable early defer probing support by calling driver_enable_deferred_probe(), so that the core retries probing deferred devices every time any device is bound to a driver. This makes sure that the constraint is set before any of the users of the resources come up.

This is tested on ARM64 Hikey board where probe was deferred for a device.

---
 drivers/base/dd.c                       |  12 ++
 drivers/bootconstraint/Makefile         |   2 +-
 drivers/bootconstraint/deferrable_dev.c | 241 ++++++++++++++++++++++++++++++++
 include/linux/boot_constraint.h         |  27 ++++
 4 files changed, 281 insertions(+), 1 deletion(-)
 create mode 100644 drivers/bootconstraint/deferrable_dev.c
drivers/base/dd.c +12 -0
index 777267aa1710..482d971ceac6 100644
@@ -227,6 +227,18 @@ void device_unblock_probing(void)
 	driver_deferred_probe_trigger();
 }
 
+/**
+ * driver_enable_deferred_probe() - Enable probing of deferred devices
+ *
+ * We don't want to get in the way when the bulk of drivers are getting probed
+ * and so deferred probe is disabled in the beginning. Enable it now because we
+ * need it.
+ */
+void driver_enable_deferred_probe(void)
+{
+	driver_deferred_probe_enable = true;
+}
+
 /**
  * deferred_probe_initcall() - Enable probing of deferred devices
  *
drivers/bootconstraint/Makefile +1 -1
index b7ade1a7afb5..a765094623a3 100644
@@ -1,3 +1,3 @@
 # Makefile for device boot constraints
 
-obj-y := clk.o core.o pm.o supply.o
+obj-y := clk.o deferrable_dev.o core.o pm.o supply.o
drivers/bootconstraint/deferrable_dev.c new file +241 -0

241 lines not on this page · raw message

include/linux/boot_constraint.h +27 -0
index fbccb62f423d..91cbcc66b2c3 100644
@@ -79,16 +79,43 @@ struct dev_boot_constraint_info {
 	void *free_resources_data;
 };
 
+/**
+ * struct dev_boot_constraint_of - This is used to add one or more boot
+ * constraints across one or more devices having the same compatibility in the
+ * device tree.
+ *
+ * @compat: This must match the compatible string of the devices to which we
+ * want to apply constraints.
+ * @constraints: This points to one or more boot constraints.
+ * @count: This contains the number of boot constraints pointed by the
+ * 'constraints' field.
+ * @dev_names: This is used to limit the application of boot constraints to only
+ * a subset of devices with matching compatibility.
+ * @dev_names_count: This is the number of devices pointed by the 'dev_names'
+ * array.
+ */
+struct dev_boot_constraint_of {
+	const char *compat;
+	struct dev_boot_constraint *constraints;
+	unsigned int count;
+
+	const char * const *dev_names;
+	unsigned int dev_names_count;
+};
+
 #ifdef CONFIG_DEV_BOOT_CONSTRAINT
 int dev_boot_constraint_add(struct device *dev,
 			    struct dev_boot_constraint_info *info);
 void dev_boot_constraints_remove(struct device *dev);
+void dev_boot_constraint_add_deferrable_of(struct dev_boot_constraint_of *oconst,
+					   int count);
 #else
 static inline
 int dev_boot_constraint_add(struct device *dev,
 			    struct dev_boot_constraint_info *info)
 { return 0; }
 static inline void dev_boot_constraints_remove(struct device *dev) {}
+static inline void dev_boot_constraint_add_deferrable_of(struct dev_boot_constraint_of *oconst, int count) {}
 #endif /* CONFIG_DEV_BOOT_CONSTRAINT */
 
 #endif /* _LINUX_BOOT_CONSTRAINT_H */
Signature · 1 line
2.15.0.194.g9af6a3dea062
#9 lore raw

PATCH v7 9/13 boot_constraint: Add support for Hisilicon platforms

In reply to Viresh Kumar

This adds boot constraint support for Hisilicon platforms. Currently only one use case is supported: earlycon. One of the UART is enabled by the bootloader and is used for early console in the kernel. The boot constraint core handles it properly and removes constraints once the serial device is probed by its driver.

This is tested on hi6220-hikey 96board.

---
 drivers/soc/Kconfig                     |   1 +
 drivers/soc/Makefile                    |   1 +
 drivers/soc/hisilicon/Kconfig           |  15 +++
 drivers/soc/hisilicon/Makefile          |   3 +
 drivers/soc/hisilicon/boot_constraint.c | 158 ++++++++++++++++++++++++++++++++
 5 files changed, 178 insertions(+)
 create mode 100644 drivers/soc/hisilicon/Kconfig
 create mode 100644 drivers/soc/hisilicon/Makefile
 create mode 100644 drivers/soc/hisilicon/boot_constraint.c
drivers/soc/Kconfig +1 -0
index c07b4a85253f..7fd6d59f15bd 100644
@@ -5,6 +5,7 @@ source "drivers/soc/amlogic/Kconfig"
 source "drivers/soc/atmel/Kconfig"
 source "drivers/soc/bcm/Kconfig"
 source "drivers/soc/fsl/Kconfig"
+source "drivers/soc/hisilicon/Kconfig"
 source "drivers/soc/imx/Kconfig"
 source "drivers/soc/mediatek/Kconfig"
 source "drivers/soc/qcom/Kconfig"
drivers/soc/Makefile +1 -0
index 40523577bdaa..2daf7c1a52ee 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_ARCH_DOVE)		+= dove/
 obj-$(CONFIG_MACH_DOVE)		+= dove/
 obj-y				+= fsl/
 obj-$(CONFIG_ARCH_GEMINI)	+= gemini/
+obj-$(CONFIG_ARCH_HISI)		+= hisilicon/
 obj-$(CONFIG_ARCH_MXC)		+= imx/
 obj-$(CONFIG_SOC_XWAY)		+= lantiq/
 obj-y				+= mediatek/
drivers/soc/hisilicon/Kconfig new file +15 -0
new file mode 100644
index 000000000000..7247b13a60a2
@@ -0,0 +1,15 @@
+#
+# Hisilicon Soc drivers
+#
+
+menu "Hisilicon SoC drivers"
+
+config HISI_BOOT_CONSTRAINT
+	bool "Hisilicon Boot Constraints"
+	depends on ARCH_HISI
+	select DEV_BOOT_CONSTRAINT
+	default y
+	help
+	  Say y here to enable Boot Constraints on Hisilicon platforms.
+
+endmenu
drivers/soc/hisilicon/Makefile new file +3 -0
new file mode 100644
index 000000000000..c63cb9b17bed
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_HISI_BOOT_CONSTRAINT) += boot_constraint.o
drivers/soc/hisilicon/boot_constraint.c new file +158 -0

158 lines not on this page · raw message

Signature · 1 line
2.15.0.194.g9af6a3dea062
#10 lore raw

PATCH v7 10/13 boot_constraint: Add support for IMX platform

In reply to Viresh Kumar

This adds boot constraint support for IMX platforms. Currently only one use case is supported: earlycon. Some of the UARTs are enabled by the bootloader and are used for early console in the kernel. The boot constraint core handles them properly and removes them once the serial device is probed by its driver.

This gets rid of lots of hacky code in the clock drivers.

---
 drivers/clk/imx/clk-imx25.c       |  12 ----
 drivers/clk/imx/clk-imx27.c       |  13 ----
 drivers/clk/imx/clk-imx31.c       |  12 ----
 drivers/clk/imx/clk-imx35.c       |  10 ---
 drivers/clk/imx/clk-imx51-imx53.c |  16 -----
 drivers/clk/imx/clk-imx6q.c       |   8 ---
 drivers/clk/imx/clk-imx6sl.c      |   8 ---
 drivers/clk/imx/clk-imx6sx.c      |   8 ---
 drivers/clk/imx/clk-imx7d.c       |  14 -----
 drivers/clk/imx/clk.c             |  38 ------------
 drivers/clk/imx/clk.h             |   1 -
 drivers/soc/imx/Kconfig           |   8 +++
 drivers/soc/imx/Makefile          |   1 +
 drivers/soc/imx/boot_constraint.c | 126 ++++++++++++++++++++++++++++++++++++++
 14 files changed, 135 insertions(+), 140 deletions(-)
 create mode 100644 drivers/soc/imx/boot_constraint.c
drivers/clk/imx/clk-imx25.c +0 -12
index 23686f756b5e..4df652cd912c 100644
@@ -86,16 +86,6 @@ enum mx25_clks {
 
 static struct clk *clk[clk_max];
 
-static struct clk ** const uart_clks[] __initconst = {
-	&clk[uart_ipg_per],
-	&clk[uart1_ipg],
-	&clk[uart2_ipg],
-	&clk[uart3_ipg],
-	&clk[uart4_ipg],
-	&clk[uart5_ipg],
-	NULL
-};
-
 static int __init __mx25_clocks_init(void __iomem *ccm_base)
 {
 	BUG_ON(!ccm_base);
@@ -241,8 +231,6 @@ static int __init __mx25_clocks_init(void __iomem *ccm_base)
 	 */
 	clk_set_parent(clk[cko_sel], clk[ipg]);
 
-	imx_register_uart_clocks(uart_clks);
-
 	return 0;
 }
 
drivers/clk/imx/clk-imx27.c +0 -13
index 0a0ab95d16fe..379709d21b04 100644
@@ -48,17 +48,6 @@ static const char *ssi_sel_clks[] = { "spll_gate", "mpll", };
 static struct clk *clk[IMX27_CLK_MAX];
 static struct clk_onecell_data clk_data;
 
-static struct clk ** const uart_clks[] __initconst = {
-	&clk[IMX27_CLK_PER1_GATE],
-	&clk[IMX27_CLK_UART1_IPG_GATE],
-	&clk[IMX27_CLK_UART2_IPG_GATE],
-	&clk[IMX27_CLK_UART3_IPG_GATE],
-	&clk[IMX27_CLK_UART4_IPG_GATE],
-	&clk[IMX27_CLK_UART5_IPG_GATE],
-	&clk[IMX27_CLK_UART6_IPG_GATE],
-	NULL
-};
-
 static void __init _mx27_clocks_init(unsigned long fref)
 {
 	BUG_ON(!ccm);
@@ -175,8 +164,6 @@ static void __init _mx27_clocks_init(unsigned long fref)
 
 	clk_prepare_enable(clk[IMX27_CLK_EMI_AHB_GATE]);
 
-	imx_register_uart_clocks(uart_clks);
-
 	imx_print_silicon_rev("i.MX27", mx27_revision());
 }
 
drivers/clk/imx/clk-imx31.c +0 -12
index cbce308aad04..d0a720b61aca 100644
@@ -63,16 +63,6 @@ enum mx31_clks {
 static struct clk *clk[clk_max];
 static struct clk_onecell_data clk_data;
 
-static struct clk ** const uart_clks[] __initconst = {
-	&clk[ipg],
-	&clk[uart1_gate],
-	&clk[uart2_gate],
-	&clk[uart3_gate],
-	&clk[uart4_gate],
-	&clk[uart5_gate],
-	NULL
-};
-
 static void __init _mx31_clocks_init(void __iomem *base, unsigned long fref)
 {
 	clk[dummy] = imx_clk_fixed("dummy", 0);
@@ -208,8 +198,6 @@ int __init mx31_clocks_init(unsigned long fref)
 	clk_register_clkdev(clk[sdma_gate], NULL, "imx31-sdma");
 	clk_register_clkdev(clk[iim_gate], "iim", NULL);
 
-
-	imx_register_uart_clocks(uart_clks);
 	mxc_timer_init(MX31_GPT1_BASE_ADDR, MX31_INT_GPT, GPT_TYPE_IMX31);
 
 	return 0;
drivers/clk/imx/clk-imx35.c +0 -10
index 203cad6c9aab..081aacd2335b 100644
@@ -86,14 +86,6 @@ enum mx35_clks {
 
 static struct clk *clk[clk_max];
 
-static struct clk ** const uart_clks[] __initconst = {
-	&clk[ipg],
-	&clk[uart1_gate],
-	&clk[uart2_gate],
-	&clk[uart3_gate],
-	NULL
-};
-
 static void __init _mx35_clocks_init(void)
 {
 	void __iomem *base;
@@ -247,8 +239,6 @@ static void __init _mx35_clocks_init(void)
 	 */
 	clk_prepare_enable(clk[scc_gate]);
 
-	imx_register_uart_clocks(uart_clks);
-
 	imx_print_silicon_rev("i.MX35", mx35_revision());
 }
 
drivers/clk/imx/clk-imx51-imx53.c +0 -16
index c864992e6983..d6af06129491 100644
@@ -131,20 +131,6 @@ static const char *ieee1588_sels[] = { "pll3_sw", "pll4_sw", "dummy" /* usbphy2_
 static struct clk *clk[IMX5_CLK_END];
 static struct clk_onecell_data clk_data;
 
-static struct clk ** const uart_clks[] __initconst = {
-	&clk[IMX5_CLK_UART1_IPG_GATE],
-	&clk[IMX5_CLK_UART1_PER_GATE],
-	&clk[IMX5_CLK_UART2_IPG_GATE],
-	&clk[IMX5_CLK_UART2_PER_GATE],
-	&clk[IMX5_CLK_UART3_IPG_GATE],
-	&clk[IMX5_CLK_UART3_PER_GATE],
-	&clk[IMX5_CLK_UART4_IPG_GATE],
-	&clk[IMX5_CLK_UART4_PER_GATE],
-	&clk[IMX5_CLK_UART5_IPG_GATE],
-	&clk[IMX5_CLK_UART5_PER_GATE],
-	NULL
-};
-
 static void __init mx5_clocks_common_init(void __iomem *ccm_base)
 {
 	clk[IMX5_CLK_DUMMY]		= imx_clk_fixed("dummy", 0);
@@ -321,8 +307,6 @@ static void __init mx5_clocks_common_init(void __iomem *ccm_base)
 	clk_prepare_enable(clk[IMX5_CLK_TMAX1]);
 	clk_prepare_enable(clk[IMX5_CLK_TMAX2]); /* esdhc2, fec */
 	clk_prepare_enable(clk[IMX5_CLK_TMAX3]); /* esdhc1, esdhc4 */
-
-	imx_register_uart_clocks(uart_clks);
 }
 
 static void __init mx50_clocks_init(struct device_node *np)
drivers/clk/imx/clk-imx6q.c +0 -8
index 8d518ad5dc13..255f571c0b0d 100644
@@ -150,12 +150,6 @@ static inline int clk_on_imx6dl(void)
 	return of_machine_is_compatible("fsl,imx6dl");
 }
 
-static struct clk ** const uart_clks[] __initconst = {
-	&clk[IMX6QDL_CLK_UART_IPG],
-	&clk[IMX6QDL_CLK_UART_SERIAL],
-	NULL
-};
-
 static int ldb_di_sel_by_clock_id(int clock_id)
 {
 	switch (clock_id) {
@@ -918,7 +912,5 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
 		clk_set_parent(clk[IMX6QDL_CLK_GPU2D_CORE_SEL],
 			       clk[IMX6QDL_CLK_PLL3_USB_OTG]);
 	}
-
-	imx_register_uart_clocks(uart_clks);
 }
 CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init);
drivers/clk/imx/clk-imx6sl.c +0 -8
index 9642cdf0fb88..97ab67783609 100644
@@ -185,12 +185,6 @@ void imx6sl_set_wait_clk(bool enter)
 		imx6sl_enable_pll_arm(false);
 }
 
-static struct clk ** const uart_clks[] __initconst = {
-	&clks[IMX6SL_CLK_UART],
-	&clks[IMX6SL_CLK_UART_SERIAL],
-	NULL
-};
-
 static void __init imx6sl_clocks_init(struct device_node *ccm_node)
 {
 	struct device_node *np;
@@ -447,7 +441,5 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
 
 	clk_set_parent(clks[IMX6SL_CLK_LCDIF_AXI_SEL],
 		       clks[IMX6SL_CLK_PLL2_PFD2]);
-
-	imx_register_uart_clocks(uart_clks);
 }
 CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init);
drivers/clk/imx/clk-imx6sx.c +0 -8
index e6d389e333d7..e38dfb855ae8 100644
@@ -137,12 +137,6 @@ static u32 share_count_ssi3;
 static u32 share_count_sai1;
 static u32 share_count_sai2;
 
-static struct clk ** const uart_clks[] __initconst = {
-	&clks[IMX6SX_CLK_UART_IPG],
-	&clks[IMX6SX_CLK_UART_SERIAL],
-	NULL
-};
-
 static void __init imx6sx_clocks_init(struct device_node *ccm_node)
 {
 	struct device_node *np;
@@ -566,7 +560,5 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
 
 	clk_set_parent(clks[IMX6SX_CLK_QSPI1_SEL], clks[IMX6SX_CLK_PLL2_BUS]);
 	clk_set_parent(clks[IMX6SX_CLK_QSPI2_SEL], clks[IMX6SX_CLK_PLL2_BUS]);
-
-	imx_register_uart_clocks(uart_clks);
 }
 CLK_OF_DECLARE(imx6sx, "fsl,imx6sx-ccm", imx6sx_clocks_init);
drivers/clk/imx/clk-imx7d.c +0 -14
index 80dc211eb74b..91e5bda48df2 100644
@@ -387,17 +387,6 @@ static int const clks_init_on[] __initconst = {
 
 static struct clk_onecell_data clk_data;
 
-static struct clk ** const uart_clks[] __initconst = {
-	&clks[IMX7D_UART1_ROOT_CLK],
-	&clks[IMX7D_UART2_ROOT_CLK],
-	&clks[IMX7D_UART3_ROOT_CLK],
-	&clks[IMX7D_UART4_ROOT_CLK],
-	&clks[IMX7D_UART5_ROOT_CLK],
-	&clks[IMX7D_UART6_ROOT_CLK],
-	&clks[IMX7D_UART7_ROOT_CLK],
-	NULL
-};
-
 static void __init imx7d_clocks_init(struct device_node *ccm_node)
 {
 	struct device_node *np;
@@ -884,8 +873,5 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)
 
 	/* set uart module clock's parent clock source that must be great then 80MHz */
 	clk_set_parent(clks[IMX7D_UART1_ROOT_SRC], clks[IMX7D_OSC_24M_CLK]);
-
-	imx_register_uart_clocks(uart_clks);
-
 }
 CLK_OF_DECLARE(imx7d, "fsl,imx7d-ccm", imx7d_clocks_init);
drivers/clk/imx/clk.c +0 -38
index 9074e6974b6d..d8a64367a061 100644
@@ -74,41 +74,3 @@ void imx_cscmr1_fixup(u32 *val)
 	*val ^= CSCMR1_FIXUP;
 	return;
 }
-
-static int imx_keep_uart_clocks __initdata;
-static struct clk ** const *imx_uart_clocks __initdata;
-
-static int __init imx_keep_uart_clocks_param(char *str)
-{
-	imx_keep_uart_clocks = 1;
-
-	return 0;
-}
-__setup_param("earlycon", imx_keep_uart_earlycon,
-	      imx_keep_uart_clocks_param, 0);
-__setup_param("earlyprintk", imx_keep_uart_earlyprintk,
-	      imx_keep_uart_clocks_param, 0);
-
-void __init imx_register_uart_clocks(struct clk ** const clks[])
-{
-	if (imx_keep_uart_clocks) {
-		int i;
-
-		imx_uart_clocks = clks;
-		for (i = 0; imx_uart_clocks[i]; i++)
-			clk_prepare_enable(*imx_uart_clocks[i]);
-	}
-}
-
-static int __init imx_clk_disable_uart(void)
-{
-	if (imx_keep_uart_clocks && imx_uart_clocks) {
-		int i;
-
-		for (i = 0; imx_uart_clocks[i]; i++)
-			clk_disable_unprepare(*imx_uart_clocks[i]);
-	}
-
-	return 0;
-}
-late_initcall_sync(imx_clk_disable_uart);
drivers/clk/imx/clk.h +0 -1
index d69c4bbf3597..c5edde073cea 100644
@@ -8,7 +8,6 @@
 extern spinlock_t imx_ccm_lock;
 
 void imx_check_clocks(struct clk *clks[], unsigned int count);
-void imx_register_uart_clocks(struct clk ** const clks[]);
 
 extern void imx_cscmr1_fixup(u32 *val);
 
drivers/soc/imx/Kconfig +8 -0
index a5b86a28f343..7a3fbdfa9db9 100644
@@ -7,4 +7,12 @@ config IMX7_PM_DOMAINS
 	select PM_GENERIC_DOMAINS
 	default y if SOC_IMX7D
 
+config IMX_BOOT_CONSTRAINT
+	bool "i.MX Boot Constraints"
+	depends on ARCH_MXC
+	select DEV_BOOT_CONSTRAINT
+	default y
+	help
+	  Say y here to enable Boot Constraints on i.MX platforms.
+
 endmenu
drivers/soc/imx/Makefile +1 -0
index aab41a5cc317..49663200faac 100644
@@ -1,2 +1,3 @@
+obj-$(IMXIG_IMX_BOOT_CONSTRAINT) += boot_constraint.o
 obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
 obj-$(CONFIG_IMX7_PM_DOMAINS) += gpcv2.o
drivers/soc/imx/boot_constraint.c new file +126 -0

126 lines not on this page · raw message

Signature · 1 line
2.15.0.194.g9af6a3dea062
#11 lore raw

PATCH v7 11/13 boot_constraint: Add Qualcomm display controller constraints

In reply to Viresh Kumar

This sets boot constraints for the display controller used on Qualcomm dragonboard 410c.

The display controlled is enabled by the bootloader to show a flash screen during kernel boot. The handover to kernel should be without any glitches on the screen.The resources of the display controller (like regulators) are shared with other peripherals, which may reconfigure those resources before the display driver comes up. The same problem can happen if the display driver probes first, as the constraints of the other devices (sharing same resources with display controller) may not be honored anymore by the kernel.

---
 drivers/soc/qcom/Kconfig           |   8 +++
 drivers/soc/qcom/Makefile          |   1 +
 drivers/soc/qcom/boot_constraint.c | 122 +++++++++++++++++++++++++++++++++++++
 3 files changed, 131 insertions(+)
 create mode 100644 drivers/soc/qcom/boot_constraint.c
drivers/soc/qcom/Kconfig +8 -0
index e050eb83341d..7bbe87f9c775 100644
@@ -107,4 +107,12 @@ config QCOM_WCNSS_CTRL
 	  Client driver for the WCNSS_CTRL SMD channel, used to download nv
 	  firmware to a newly booted WCNSS chip.
 
+config QCOM_BOOT_CONSTRAINT
+	bool "Qualcomm Boot Constraints"
+	depends on ARCH_QCOM
+	select DEV_BOOT_CONSTRAINT
+	default y
+	help
+	  Say y here to enable Boot Constraints on Qualcomm platforms.
+
 endmenu
drivers/soc/qcom/Makefile +1 -0
index dcebf2814e6d..fcff64ec6538 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_QCOM_BOOT_CONSTRAINT) += boot_constraint.o
 obj-$(CONFIG_QCOM_GLINK_SSR) +=	glink_ssr.o
 obj-$(CONFIG_QCOM_GSBI)	+=	qcom_gsbi.o
 obj-$(CONFIG_QCOM_MDT_LOADER)	+= mdt_loader.o
drivers/soc/qcom/boot_constraint.c new file +122 -0

122 lines not on this page · raw message

Signature · 1 line
2.15.0.194.g9af6a3dea062
#12 lore raw

PATCH v7 12/13 boot_constraint: Update MAINTAINERS

In reply to Viresh Kumar

Add entry for boot constraint subsystem in MAINTAINERS.

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index 9a7f76eadae9..e6a767245ea9 100644
@@ -2723,6 +2723,15 @@ S:	Supported
 F:	drivers/net/bonding/
 F:	include/uapi/linux/if_bonding.h
 
+BOOT CONSTRAINT SUBSYSTEM
+M:	Viresh Kumar <[email protected]>
+L:	linux-kernel at vger.kernel.org
+S:	Maintained
+T:	git git://git.linaro.org/people/vireshk/linux.git
+F:	Documentation/driver-api/boot_constraint/
+F:	drivers/bootconstraint/
+F:	include/linux/boot_constraint.h
+
 BPF (Safe dynamic programs and tools)
 M:	Alexei Starovoitov <[email protected]>
 M:	Daniel Borkmann <[email protected]>
Signature · 1 line
2.15.0.194.g9af6a3dea062
#13 lore raw

PATCH v7 13/13 boot_constraint: Add documentation

In reply to Viresh Kumar

This adds boot constraint documentation.

---
 .../driver-api/boot-constraint/constraints.rst     | 98 ++++++++++++++++++++++
 Documentation/driver-api/boot-constraint/index.rst |  4 +
 Documentation/driver-api/index.rst                 |  1 +
 3 files changed, 103 insertions(+)
 create mode 100644 Documentation/driver-api/boot-constraint/constraints.rst
 create mode 100644 Documentation/driver-api/boot-constraint/index.rst
Documentation/driver-api/boot-constraint/constraints.rst new file +98 -0
new file mode 100644
index 000000000000..6da2df33f2c9
@@ -0,0 +1,98 @@
+.. include:: <isonum.txt>
+
+=========================
+Boot Constraint Subsystem
+=========================
+
+:Copyright: |copy| 2017 Viresh Kumar <[email protected]>, Linaro Ltd.
+
+Introduction
+============
+
+A lot of devices are configured and powered ON by the bootloader before passing
+on control to the operating system, Linux in our case.  It is important for some
+of them to keep working until the time a Linux device driver probes the device
+and reconfigure it.
+
+A typical example of that can be the LCD controller, which is used by the
+bootloaders to show image(s) while the platform boots Linux.  The LCD controller
+can be using resources like clk, regulators, etc, that are shared with other
+devices. These shared resources should be configured in such a way that they
+satisfy need of all the user devices.  If another device's (X) driver gets
+probed before the LCD controller driver, then it may end up disabling or
+reconfiguring these resources to ranges satisfying only the current user (device
+X) and that may make the LCD screen unstable and present a bad user experience.
+
+Another case can be a debug serial port (earlycon) enabled from the bootloader,
+which may be used to debug early kernel oops.
+
+There are also cases where the resources may not be shared, but the kernel will
+disable them forcefully as no users may have appeared until a certain point in
+the kernel boot.
+
+Of course we can have more complex cases where the same resource is getting used
+by multiple devices while the kernel boots and the order in which the devices
+get probed wouldn't matter as the other devices may break because of the chosen
+configuration of the first probed device.
+
+Adding boot constraints
+=======================
+
+A boot constraint defines a configuration requirement set for the device by the
+boot loader. For example, if a clock is enabled for a device by the bootloader
+and we want the device to be working as is until the time the device is probed
+by its driver, then keeping this clock enabled is one of the boot constraint.
+
+Following are the different type of boot constraints supported currently by the
+core:
+
+.. kernel-doc:: include/linux/boot_constraint.h
+   :functions: dev_boot_constraint_type
+
+
+A single boot constraint can be added using the following helper:
+
+.. kernel-doc:: drivers/bootconstraint/core.c
+   :functions: dev_boot_constraint_add
+
+
+The second parameter to this routine describes the constraint to add and is
+represented by following structures:
+
+.. kernel-doc:: include/linux/boot_constraint.h
+   :functions: dev_boot_constraint dev_boot_constraint_info
+
+The power domain boot constraint doesn't need any data, while the clock and
+power supply boot constraint specific data is represented by following
+structures:
+
+.. kernel-doc:: include/linux/boot_constraint.h
+   :functions: dev_boot_constraint_supply_info dev_boot_constraint_clk_info
+
+
+In order to simplify adding multiple boot constraints for a platform, the boot
+constraints core supplies another helper which can be used to add all
+constraints for the platform.
+
+.. kernel-doc:: drivers/bootconstraint/deferrable_dev.c
+   :functions: dev_boot_constraint_add_deferrable_of
+
+
+The argument of this routine is described by following structure:
+
+.. kernel-doc:: include/linux/boot_constraint.h
+   :functions: dev_boot_constraint_of
+
+
+Removing boot constraints
+=========================
+
+Once the boot constraints are added, they will be honored by the boot constraint
+core until the time a driver tries to probe the device. The constraints are
+removed by the driver core if either the driver successfully probed the device
+or failed with an error value other than -EPROBE_DEFER. The constraints are kept
+as is for deferred probe. The driver core removes the constraints using the
+following helper, which must not be called directly by the platforms:
+
+.. kernel-doc:: drivers/bootconstraint/core.c
+   :functions: dev_boot_constraints_remove
Documentation/driver-api/boot-constraint/index.rst new file +4 -0
new file mode 100644
index 000000000000..d6fce17626a2
@@ -0,0 +1,4 @@
+.. toctree::
+   :maxdepth: 1
+
+   constraints
Documentation/driver-api/index.rst +1 -0
index e9b41b1634f3..f982e71efb73 100644
@@ -49,6 +49,7 @@ available subsections can be seen below.
    dmaengine/index
    slimbus
    soundwire/index
+   boot-constraint/index
 
 .. only::  subproject and html
 
Signature · 1 line
2.15.0.194.g9af6a3dea062
#14 lore raw
In reply to Viresh Kumar
Quoted 10 lines · Viresh Kumar

Hi Greg,

The V7 version incorporates the organizational changes suggested by Olof earlier. Everything else is same otherwise.

I have tested the Hisilicon patches (again) on hikey 9660 board, IMX stuff was earlier tested by Sascha (Pengutronix) on i.MX6 and Qualcomm stuff was earlier tested by Rajendra (Qualcomm) on Dragonboard 410C (This required some more patches related to display driver which Rajendra should be sending separately later on).

Hi Greg,

Are you going to pick this one for 4.17 ?

Thanks.

Signature · 1 line
viresh
#15 lore raw
In reply to Viresh Kumar
Quoted 17 lines · Viresh Kumar

Problem statement:

Some devices are powered ON by the bootloader before the bootloader handovers control to Linux. It maybe important for some of those devices to keep working until the time a Linux device driver probes the device and reconfigure its resources.

A typical example of that can be the LCD controller, which is used by the bootloaders to show image(s) while the platform is booting into Linux. The LCD controller can be using some resources, like clk, regulators, etc, that are shared between several devices. These shared resources should be configured to satisfy need of all the users. If another device's (X) driver gets probed before the LCD controller driver in this case, then it may end up disabling or reconfiguring these resources to ranges satisfying the current users (only device X) and that can make the LCD screen unstable.

Quoted 6 lines

Another case can be a debug serial port enabled from the bootloader.

Of course we can have more complex cases where the same resource is getting used by two devices while the kernel boots and the order in which devices get probed wouldn't matter as the other device will surely break then.

And we have a _real_ use case for this complex scenario as well.

Georgi (cc'd) is currently working[1] on implementing generic support for the interconnect bus, which tries to play with the bandwidth of the bus based on how much are the requirements from different parts of the SoC. The 4th version was posted recently by him, and things are looking good/positive.

The bootloader configures the interconnect to provide sufficient bandwidth for all the devices which are used during boot, few of them are the CPUs, serial and the LCD controller. As the kernel starts taking control of things, the drivers being probed start putting their requirements on the interconnect bus. Because the interconnect doesn't have any representation from the devices which are not yet initialized by the kernel, the interconnect core incorrectly reduces the bandwidth of the bus to a level unacceptable to the devices running currently, like the CPUs and this makes kernel boot awfully slow. This is not an ordering problem as no matter which device we probe first, we are going to break something else.

Georgi already tried using the boot constraint patches to solve this complex problem, and its a perfect fit.

Signature · 3 lines
viresh

[1] http://lkml.kernel.org/r/20180309210958.16672-1-georgi.djakov at linaro.org
#16 lore raw
Quoted 43 lines · Viresh Kumar
Quoted 17 lines · Viresh Kumar

Problem statement:

Some devices are powered ON by the bootloader before the bootloader handovers control to Linux. It maybe important for some of those devices to keep working until the time a Linux device driver probes the device and reconfigure its resources.

A typical example of that can be the LCD controller, which is used by the bootloaders to show image(s) while the platform is booting into Linux. The LCD controller can be using some resources, like clk, regulators, etc, that are shared between several devices. These shared resources should be configured to satisfy need of all the users. If another device's (X) driver gets probed before the LCD controller driver in this case, then it may end up disabling or reconfiguring these resources to ranges satisfying the current users (only device X) and that can make the LCD screen unstable.

Quoted 6 lines

Another case can be a debug serial port enabled from the bootloader.

Of course we can have more complex cases where the same resource is getting used by two devices while the kernel boots and the order in which devices get probed wouldn't matter as the other device will surely break then.

And we have a _real_ use case for this complex scenario as well.

Georgi (cc'd) is currently working[1] on implementing generic support for the interconnect bus, which tries to play with the bandwidth of the bus based on how much are the requirements from different parts of the SoC. The 4th version was posted recently by him, and things are looking good/positive.

The bootloader configures the interconnect to provide sufficient bandwidth for all the devices which are used during boot, few of them are the CPUs, serial and the LCD controller. As the kernel starts taking control of things, the drivers being probed start putting their requirements on the interconnect bus. Because the interconnect doesn't have any representation from the devices which are not yet initialized by the kernel, the interconnect core incorrectly reduces the bandwidth of the bus to a level unacceptable to the devices running currently, like the CPUs and this makes kernel boot awfully slow. This is not an ordering problem as no matter which device we probe first, we are going to break something else.

Quoted 2 lines

Georgi already tried using the boot constraint patches to solve this complex problem, and its a perfect fit.

I'm delaying this as I still don't see that "perfect fit" yet. If there are add-on patches that take better advantage of this, great, let's see those, but right now, it feels like you are the only one wanting this. And the increased complexity overall seems not really worth it yet :(

greg k-h

#17 lore raw

Hi Greg and Viresh,

Quoted 33 lines · Greg Kroah-Hartman
Quoted 32 lines · Viresh Kumar
Quoted 17 lines · Viresh Kumar

Problem statement:

Some devices are powered ON by the bootloader before the bootloader handovers control to Linux. It maybe important for some of those devices to keep working until the time a Linux device driver probes the device and reconfigure its resources.

A typical example of that can be the LCD controller, which is used by the bootloaders to show image(s) while the platform is booting into Linux. The LCD controller can be using some resources, like clk, regulators, etc, that are shared between several devices. These shared resources should be configured to satisfy need of all the users. If another device's (X) driver gets probed before the LCD controller driver in this case, then it may end up disabling or reconfiguring these resources to ranges satisfying the current users (only device X) and that can make the LCD screen unstable.

Quoted 6 lines

Another case can be a debug serial port enabled from the bootloader.

Of course we can have more complex cases where the same resource is getting used by two devices while the kernel boots and the order in which devices get probed wouldn't matter as the other device will surely break then.

And we have a _real_ use case for this complex scenario as well.

Georgi (cc'd) is currently working[1] on implementing generic support for the interconnect bus, which tries to play with the bandwidth of the bus based on how much are the requirements from different parts of the SoC. The 4th version was posted recently by him, and things are looking good/positive.

Quoted 10 lines
Quoted 10 lines

The bootloader configures the interconnect to provide sufficient bandwidth for all the devices which are used during boot, few of them are the CPUs, serial and the LCD controller. As the kernel starts taking control of things, the drivers being probed start putting their requirements on the interconnect bus. Because the interconnect doesn't have any representation from the devices which are not yet initialized by the kernel, the interconnect core incorrectly reduces the bandwidth of the bus to a level unacceptable to the devices running currently, like the CPUs and this makes kernel boot awfully slow. This is not an ordering problem as no matter which device we probe first, we are going to break something else.

The interconnect core takes requests from consumer drivers for their bandwidth needs and configures the hardware to keep the lowest possible power profile. I think that the boot constraint patches would be useful to make a board run at maximum performance during boot, until all consumer drivers are probed and all bandwidth requests are taken into account.

Quoted 2 lines
Quoted 2 lines

Georgi already tried using the boot constraint patches to solve this complex problem, and its a perfect fit.

These patches solve a common problem for different subsystems, so it makes sense to handle it into the driver core, instead of leaving each subsystem to do their own hacks.

Quoted 4 lines

I'm delaying this as I still don't see that "perfect fit" yet. If there are add-on patches that take better advantage of this, great, let's see those, but right now, it feels like you are the only one wanting this. And the increased complexity overall seems not really worth it yet :(

The interconnect code is still under review, but on the next submission i will include a patch to make use of the boot constraints, so that we hopefully move this forward.

Thanks,
Georgi

#18 lore raw

Hi Georgi,

Am Freitag, den 30.03.2018, 18:24 +0300 schrieb Georgi Djakov:
[...]

Quoted 6 lines

The interconnect core takes requests from consumer drivers for their bandwidth needs and configures the hardware to keep the lowest possible power profile. I think that the boot constraint patches would be useful to make a board run at maximum performance during boot, until all consumer drivers are probed and all bandwidth requests are taken into account.

Can you please describe how this bootconstraints core integration is simpler than a "run things at max performance until late kernel init", which could be triggered by a simple initcall similar to what is done for clocks and regulators?

To me the bootcontraints stuff looks like a fairly complex solution and your use-case doesn't even sound like you strictly want to keep a bootloader configuration, but rather run things at max performance until you are reasonably sure that you got all the necessary bandwidth requests.

Regards,
Lucas

#19 lore raw
Quoted 10 lines · Lucas Stach

Can you please describe how this bootconstraints core integration is simpler than a "run things at max performance until late kernel init", which could be triggered by a simple initcall similar to what is done for clocks and regulators?

To me the bootcontraints stuff looks like a fairly complex solution and your use-case doesn't even sound like you strictly want to keep a bootloader configuration, but rather run things at max performance until you are reasonably sure that you got all the necessary bandwidth requests.

What about this case where drivers of some of the devices used during boot are built as modules, like display, HDMI, etc., and would be available only after userspace is up. We need to take care of their bandwidth requirements as well, until the time their driver comes up.

Signature · 1 line
viresh