Skip to contentSkip to conversation

Revert "clk: Detect failure to set defaults"

PATCH In review Marek Vasut 5 participants 12 messages Jan 1, 2022 – Jan 9, 2022 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "clk: Detect failure to set defaults"

This reverts commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646. The aforementioned patch causes massive breakage on all platforms which have 'assigned-clock' DT property in their DT which references any clock that are not supported by the platform clock driver. That can easily happen either in SPL, or because the clock driver is reduced. Currently it seems all iMX8M are affected and fail to boot altogether.

---
 drivers/clk/clk-uclass.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/clk/clk-uclass.c +1 -5
index f2d26427543..094b1abf13c 100644
@@ -846,17 +846,13 @@ void devm_clk_put(struct udevice *dev, struct clk *clk)
 
 int clk_uclass_post_probe(struct udevice *dev)
 {
-	int ret;
-
 	/*
 	 * when a clock provider is probed. Call clk_set_defaults()
 	 * also after the device is probed. This takes care of cases
 	 * where the DT is used to setup default parents and rates
 	 * using assigned-clocks
 	 */
-	ret = clk_set_defaults(dev, CLK_DEFAULTS_POST);
-	if (ret)
-		return log_ret(ret);
+	clk_set_defaults(dev, CLK_DEFAULTS_POST);
 
 	return 0;
 }
Signature · 1 line
2.34.1
#1 lore raw

Hi Marek,

Please CC clock maintainers for future patches.

Quoted 28 lines · Marek Vasut

This reverts commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646. The aforementioned patch causes massive breakage on all platforms which have 'assigned-clock' DT property in their DT which references any clock that are not supported by the platform clock driver. That can easily happen either in SPL, or because the clock driver is reduced. Currently it seems all iMX8M are affected and fail to boot altogether.

---
  drivers/clk/clk-uclass.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/clk/clk-uclass.c +0 -2
index f2d26427543..094b1abf13c 100644
@@ -846,17 +846,13 @@ void devm_clk_put(struct udevice *dev, struct clk *clk)
 
  int clk_uclass_post_probe(struct udevice *dev)
  {
-	int ret;
-
  	/*
  	 * when a clock provider is probed. Call clk_set_defaults()
  	 * also after the device is probed. This takes care of cases

drivers/clk/clk-uclass.c void devm_clk_put(struct udevice *dev, struct clk *clk) · line 858

Quoted 10 lines
drivers/clk/clk-uclass.c +1 -3
  	 * where the DT is used to setup default parents and rates
  	 * using assigned-clocks
  	 */
-	ret = clk_set_defaults(dev, CLK_DEFAULTS_POST);
-	if (ret)
-		return log_ret(ret);
+	clk_set_defaults(dev, CLK_DEFAULTS_POST);
 
  	return 0;
  }

See [1] for previous discussion. For more background,

- Device trees for i.MX are sync'd with Linux.
- General clock assignments may live in the clock-controller node, including those which U-Boot does not implement, but which Linux does. It's OK to not set up these clocks, but U-Boot doesn't know that and fails.

We don't necessarily need to revert this commit, but we do need a way to say "it's OK not to set the defaults, since we can function without them". Tom suggested doing this in the clock driver last time. I think a Kconfig or a device tree property would work, perhaps something like 'u-boot,clock-defaults-optional'.

--Sean

[1] https://lore.kernel.org/u-boot/[email protected]/

#2 lore raw
Quoted 1 line · Sean Anderson

Hi Marek,

Hi,

Quoted 1 line

Please CC clock maintainers for future patches.

btw. I'm surprised the commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646 has zero reviews/acks from clock maintainers.

Quoted 41 lines · Marek Vasut
Quoted 27 lines

This reverts commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646. The aforementioned patch causes massive breakage on all platforms which have 'assigned-clock' DT property in their DT which references any clock that are not supported by the platform clock driver. That can easily happen either in SPL, or because the clock driver is reduced. Currently it seems all iMX8M are affected and fail to boot altogether.

---
  drivers/clk/clk-uclass.c | 6 +-----

  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/clk/clk-uclass.c +0 -2
index f2d26427543..094b1abf13c 100644
@@ -846,17 +846,13 @@ void devm_clk_put(struct udevice *dev, struct 
 clk *clk)
   int clk_uclass_post_probe(struct udevice *dev)
   {
-    int ret;
-
       /*
        * when a clock provider is probed. Call clk_set_defaults()
        * also after the device is probed. This takes care of cases

drivers/clk/clk-uclass.c void devm_clk_put(struct udevice *dev, struct · line 858

Quoted 10 lines
drivers/clk/clk-uclass.c +1 -3
        * where the DT is used to setup default parents and rates
        * using assigned-clocks
        */
-    ret = clk_set_defaults(dev, CLK_DEFAULTS_POST);
-    if (ret)
-        return log_ret(ret);
+    clk_set_defaults(dev, CLK_DEFAULTS_POST);
       return 0;
   }
 

See [1] for previous discussion. For more background,

Quoted 2 lines

- Device trees for i.MX are sync'd with Linux.
- General clock assignments may live in the clock-controller node,

clock assignments can be anywhere, even in non-clock-controller nodes.

Quoted 9 lines

  including those which U-Boot does not implement, but which Linux does. It's OK to not set up these clocks, but U-Boot doesn't know that and fails.

We don't necessarily need to revert this commit, but we do need a way to say "it's OK not to set the defaults, since we can function without them". Tom suggested doing this in the clock driver last time. I think a Kconfig or a device tree property would work, perhaps something like 'u-boot,clock-defaults-optional'.

We didn't need custom DT properties before, Linux doesn't need them either, so that approach seems wrong.

If the clock driver could say "skip unimplemented clock, because I don't implement them and that is OK", that sounds like the right approach.

Unless the 2022.01 release should be completely broken for a lot of platforms, I would propose we revert the clock uclass patch now and re-add it right after the release, so we would not roll out a completely broken release and would have more time to fix this properly.

#3 lore raw
Quoted 69 lines · Marek Vasut
Quoted 1 line · Sean Anderson

Hi Marek,

Hi,

Quoted 1 line

Please CC clock maintainers for future patches.

btw. I'm surprised the commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646 has zero reviews/acks from clock maintainers.

Quoted 41 lines · Marek Vasut
Quoted 27 lines

This reverts commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646. The aforementioned patch causes massive breakage on all platforms which have 'assigned-clock' DT property in their DT which references any clock that are not supported by the platform clock driver. That can easily happen either in SPL, or because the clock driver is reduced. Currently it seems all iMX8M are affected and fail to boot altogether.

---
  drivers/clk/clk-uclass.c | 6 +-----

  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/clk/clk-uclass.c +0 -2
index f2d26427543..094b1abf13c 100644
@@ -846,17 +846,13 @@ void devm_clk_put(struct udevice *dev, struct
 clk *clk)
   int clk_uclass_post_probe(struct udevice *dev)
   {
-    int ret;
-
       /*
        * when a clock provider is probed. Call clk_set_defaults()
        * also after the device is probed. This takes care of cases

drivers/clk/clk-uclass.c void devm_clk_put(struct udevice *dev, struct · line 858

Quoted 10 lines
drivers/clk/clk-uclass.c +1 -3
        * where the DT is used to setup default parents and rates
        * using assigned-clocks
        */
-    ret = clk_set_defaults(dev, CLK_DEFAULTS_POST);
-    if (ret)
-        return log_ret(ret);
+    clk_set_defaults(dev, CLK_DEFAULTS_POST);
       return 0;
   }
 

See [1] for previous discussion. For more background,

Quoted 2 lines

- Device trees for i.MX are sync'd with Linux.
- General clock assignments may live in the clock-controller node,

clock assignments can be anywhere, even in non-clock-controller nodes.

Quoted 9 lines

  including those which U-Boot does not implement, but which Linux does. It's OK to not set up these clocks, but U-Boot doesn't know that and fails.

We don't necessarily need to revert this commit, but we do need a way to say "it's OK not to set the defaults, since we can function without them". Tom suggested doing this in the clock driver last time. I think a Kconfig or a device tree property would work, perhaps something like 'u-boot,clock-defaults-optional'.

We didn't need custom DT properties before, Linux doesn't need them either, so that approach seems wrong.

Quoted 7 lines

If the clock driver could say "skip unimplemented clock, because I don't implement them and that is OK", that sounds like the right approach.

Unless the 2022.01 release should be completely broken for a lot of platforms, I would propose we revert the clock uclass patch now and re-add it right after the release, so we would not roll out a completely broken release and would have more time to fix this properly.

It'll be no more broken than v2021.10 was for whatever platforms have problems here, yes? Since that's what has the problematic commit.

Signature · 1 line
Tom
#4 lore raw
Quoted 73 lines · Tom Rini
Quoted 72 lines · Marek Vasut
Quoted 1 line · Sean Anderson

Hi Marek,

Hi,

Quoted 1 line

Please CC clock maintainers for future patches.

btw. I'm surprised the commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646 has zero reviews/acks from clock maintainers.

Quoted 41 lines · Marek Vasut
Quoted 27 lines

This reverts commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646. The aforementioned patch causes massive breakage on all platforms which have 'assigned-clock' DT property in their DT which references any clock that are not supported by the platform clock driver. That can easily happen either in SPL, or because the clock driver is reduced. Currently it seems all iMX8M are affected and fail to boot altogether.

---
   drivers/clk/clk-uclass.c | 6 +-----
   1 file changed, 1 insertion(+), 5 deletions(-)
drivers/clk/clk-uclass.c +0 -2
index f2d26427543..094b1abf13c 100644
@@ -846,17 +846,13 @@ void devm_clk_put(struct udevice *dev, struct
 clk *clk)
   int clk_uclass_post_probe(struct udevice *dev)
   {
-    int ret;
-
       /*
        * when a clock provider is probed. Call clk_set_defaults()
        * also after the device is probed. This takes care of cases

drivers/clk/clk-uclass.c void devm_clk_put(struct udevice *dev, struct · line 858

Quoted 10 lines
drivers/clk/clk-uclass.c +1 -3
        * where the DT is used to setup default parents and rates
        * using assigned-clocks
        */
-    ret = clk_set_defaults(dev, CLK_DEFAULTS_POST);
-    if (ret)
-        return log_ret(ret);
+    clk_set_defaults(dev, CLK_DEFAULTS_POST);
       return 0;
   }
 

See [1] for previous discussion. For more background,

Quoted 2 lines

- Device trees for i.MX are sync'd with Linux.
- General clock assignments may live in the clock-controller node,

clock assignments can be anywhere, even in non-clock-controller nodes.

Quoted 9 lines

  including those which U-Boot does not implement, but which Linux does. It's OK to not set up these clocks, but U-Boot doesn't know that and fails.

We don't necessarily need to revert this commit, but we do need a way to say "it's OK not to set the defaults, since we can function without them". Tom suggested doing this in the clock driver last time. I think a Kconfig or a device tree property would work, perhaps something like 'u-boot,clock-defaults-optional'.

We didn't need custom DT properties before, Linux doesn't need them either, so that approach seems wrong.

If the clock driver could say "skip unimplemented clock, because I don't implement them and that is OK", that sounds like the right approach.

Quoted 7 lines
Quoted 4 lines

Unless the 2022.01 release should be completely broken for a lot of platforms, I would propose we revert the clock uclass patch now and re-add it right after the release, so we would not roll out a completely broken release and would have more time to fix this properly.

It'll be no more broken than v2021.10 was for whatever platforms have problems here, yes? Since that's what has the problematic commit.

So it seems. Does that mean we are OK with releasing such a broken release, even though there is an easy way to improve the situation ?

#5 lore raw
Quoted 79 lines · Marek Vasut
Quoted 78 lines · Tom Rini
Quoted 76 lines · Marek Vasut
Quoted 1 line · Sean Anderson

Hi Marek,

Hi,

Quoted 1 line

Please CC clock maintainers for future patches.

btw. I'm surprised the commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646 has zero reviews/acks from clock maintainers.

Quoted 41 lines · Marek Vasut
Quoted 27 lines

This reverts commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646. The aforementioned patch causes massive breakage on all platforms which have 'assigned-clock' DT property in their DT which references any clock that are not supported by the platform clock driver. That can easily happen either in SPL, or because the clock driver is reduced. Currently it seems all iMX8M are affected and fail to boot altogether.

---
   drivers/clk/clk-uclass.c | 6 +-----
   1 file changed, 1 insertion(+), 5 deletions(-)
drivers/clk/clk-uclass.c +0 -2
index f2d26427543..094b1abf13c 100644
@@ -846,17 +846,13 @@ void devm_clk_put(struct udevice *dev, struct
 clk *clk)
   int clk_uclass_post_probe(struct udevice *dev)
   {
-    int ret;
-
       /*
        * when a clock provider is probed. Call clk_set_defaults()
        * also after the device is probed. This takes care of cases

drivers/clk/clk-uclass.c void devm_clk_put(struct udevice *dev, struct · line 858

Quoted 10 lines
drivers/clk/clk-uclass.c +1 -3
        * where the DT is used to setup default parents and rates
        * using assigned-clocks
        */
-    ret = clk_set_defaults(dev, CLK_DEFAULTS_POST);
-    if (ret)
-        return log_ret(ret);
+    clk_set_defaults(dev, CLK_DEFAULTS_POST);
       return 0;
   }
 

See [1] for previous discussion. For more background,

Quoted 2 lines

- Device trees for i.MX are sync'd with Linux.
- General clock assignments may live in the clock-controller node,

clock assignments can be anywhere, even in non-clock-controller nodes.

Quoted 9 lines

  including those which U-Boot does not implement, but which Linux does. It's OK to not set up these clocks, but U-Boot doesn't know that and fails.

We don't necessarily need to revert this commit, but we do need a way to say "it's OK not to set the defaults, since we can function without them". Tom suggested doing this in the clock driver last time. I think a Kconfig or a device tree property would work, perhaps something like 'u-boot,clock-defaults-optional'.

We didn't need custom DT properties before, Linux doesn't need them either, so that approach seems wrong.

If the clock driver could say "skip unimplemented clock, because I don't implement them and that is OK", that sounds like the right approach.

Unless the 2022.01 release should be completely broken for a lot of platforms, I would propose we revert the clock uclass patch now and re-add it right after the release, so we would not roll out a completely broken release and would have more time to fix this properly.

Quoted 5 lines
Quoted 2 lines

It'll be no more broken than v2021.10 was for whatever platforms have problems here, yes? Since that's what has the problematic commit.

So it seems. Does that mean we are OK with releasing such a broken release, even though there is an easy way to improve the situation ?

I will defer to the clock maintainer who I see agrees with your patch. I was just noting that we'd already shipped one release so a last minute revert is not something I'm happy about either.

Signature · 1 line
Tom
Reviewed-by
#6 lore raw

Hi,

Quoted 84 lines · Tom Rini
Quoted 82 lines · Marek Vasut
Quoted 80 lines · Tom Rini
Quoted 69 lines · Marek Vasut
Quoted 1 line · Sean Anderson

Hi Marek,

Hi,

Quoted 1 line

Please CC clock maintainers for future patches.

btw. I'm surprised the commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646 has zero reviews/acks from clock maintainers.

Quoted 41 lines · Marek Vasut
Quoted 27 lines

This reverts commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646. The aforementioned patch causes massive breakage on all platforms which have 'assigned-clock' DT property in their DT which references any clock that are not supported by the platform clock driver. That can easily happen either in SPL, or because the clock driver is reduced. Currently it seems all iMX8M are affected and fail to boot altogether.

---
   drivers/clk/clk-uclass.c | 6 +-----
   1 file changed, 1 insertion(+), 5 deletions(-)
drivers/clk/clk-uclass.c +0 -2
index f2d26427543..094b1abf13c 100644
@@ -846,17 +846,13 @@ void devm_clk_put(struct udevice *dev, struct
 clk *clk)
   int clk_uclass_post_probe(struct udevice *dev)
   {
-    int ret;
-
       /*
        * when a clock provider is probed. Call clk_set_defaults()
        * also after the device is probed. This takes care of cases

drivers/clk/clk-uclass.c void devm_clk_put(struct udevice *dev, struct · line 858

Quoted 10 lines
drivers/clk/clk-uclass.c +1 -3
        * where the DT is used to setup default parents and rates
        * using assigned-clocks
        */
-    ret = clk_set_defaults(dev, CLK_DEFAULTS_POST);
-    if (ret)
-        return log_ret(ret);
+    clk_set_defaults(dev, CLK_DEFAULTS_POST);
       return 0;
   }
 

See [1] for previous discussion. For more background,

Quoted 2 lines

- Device trees for i.MX are sync'd with Linux.
- General clock assignments may live in the clock-controller node,

clock assignments can be anywhere, even in non-clock-controller nodes.

Quoted 9 lines

including those which U-Boot does not implement, but which Linux does. It's OK to not set up these clocks, but U-Boot doesn't know that and fails.

We don't necessarily need to revert this commit, but we do need a way to say "it's OK not to set the defaults, since we can function without them". Tom suggested doing this in the clock driver last time. I think a Kconfig or a device tree property would work, perhaps something like 'u-boot,clock-defaults-optional'.

We didn't need custom DT properties before, Linux doesn't need them either, so that approach seems wrong.

Quoted 7 lines

If the clock driver could say "skip unimplemented clock, because I don't implement them and that is OK", that sounds like the right approach.

Unless the 2022.01 release should be completely broken for a lot of platforms, I would propose we revert the clock uclass patch now and re-add it right after the release, so we would not roll out a completely broken release and would have more time to fix this properly.

It'll be no more broken than v2021.10 was for whatever platforms have problems here, yes? Since that's what has the problematic commit.

Quoted 6 lines
Quoted 2 lines

So it seems. Does that mean we are OK with releasing such a broken release, even though there is an easy way to improve the situation ?

I will defer to the clock maintainer who I see agrees with your patch. I was just noting that we'd already shipped one release so a last minute revert is not something I'm happy about either.

I'll just note that we should not be ignoring errors. It makes things very hard to debug. The root cause of this issue, IMO, is that the clock subsystem started ignoring errors. People relied on that and then it was hard to put the cat back in the bag.

But we should put the cat back in the bag and use a DT property to indicate that the defaults are advisory only, for the case where the U-Boot driver does not support a clock.

So long we we can undo this patch immediately after the release, you can add my:

Regards,
Simon

#7 lore raw
In reply to Tom Rini

Hi Tom,

Quoted 3 lines · Tom Rini

I will defer to the clock maintainer who I see agrees with your patch. I was just noting that we'd already shipped one release so a last minute revert is not something I'm happy about either.

Do you want me to send a PR for this or can you pick it up directly?

--Sean

Reviewed-by
#9 lore raw
In reply to Tom Rini
Quoted 10 lines · Tom Rini
Quoted 9 lines · Marek Vasut
Quoted 1 line · Sean Anderson

Hi Marek,

Hi,

Quoted 1 line

Please CC clock maintainers for future patches.

btw. I'm surprised the commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646 has zero reviews/acks from clock maintainers.

At the time, I reviewed it. However, I was also not a clock maintainer at that point, and my RB was not picked up when Simon sent v2.

Ultimately the original problem was that errors when assigning clocks automatically were generally not reported. The only way to detect them was to verify that the clocks were configured correctly after the fact. My attempt to address this was [2].

[1] https://lore.kernel.org/u-boot/[email protected]/
[2] https://lore.kernel.org/u-boot/[email protected]/

Quoted 41 lines
Quoted 41 lines
Quoted 41 lines · Marek Vasut
Quoted 27 lines

This reverts commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646. The aforementioned patch causes massive breakage on all platforms which have 'assigned-clock' DT property in their DT which references any clock that are not supported by the platform clock driver. That can easily happen either in SPL, or because the clock driver is reduced. Currently it seems all iMX8M are affected and fail to boot altogether.

---
   drivers/clk/clk-uclass.c | 6 +-----
   1 file changed, 1 insertion(+), 5 deletions(-)
drivers/clk/clk-uclass.c +0 -2
index f2d26427543..094b1abf13c 100644
@@ -846,17 +846,13 @@ void devm_clk_put(struct udevice *dev, struct
 clk *clk)
   int clk_uclass_post_probe(struct udevice *dev)
   {
-    int ret;
-
       /*
        * when a clock provider is probed. Call clk_set_defaults()
        * also after the device is probed. This takes care of cases

drivers/clk/clk-uclass.c void devm_clk_put(struct udevice *dev, struct · line 858

Quoted 10 lines
drivers/clk/clk-uclass.c +1 -3
        * where the DT is used to setup default parents and rates
        * using assigned-clocks
        */
-    ret = clk_set_defaults(dev, CLK_DEFAULTS_POST);
-    if (ret)
-        return log_ret(ret);
+    clk_set_defaults(dev, CLK_DEFAULTS_POST);
       return 0;
   }
 

See [1] for previous discussion. For more background,

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

- Device trees for i.MX are sync'd with Linux.
- General clock assignments may live in the clock-controller node,

clock assignments can be anywhere, even in non-clock-controller nodes.

Sure, but since those assignments are made only when the device is probed, it is generally safe to assume that they are necessary for the device to function. This is opposed to assignments in the clock node, which may be OK to ignore (as long as the system functions properly).

Quoted 16 lines
Quoted 16 lines
Quoted 9 lines

including those which U-Boot does not implement, but which Linux does. It's OK to not set up these clocks, but U-Boot doesn't know that and fails.

We don't necessarily need to revert this commit, but we do need a way to say "it's OK not to set the defaults, since we can function without them". Tom suggested doing this in the clock driver last time. I think a Kconfig or a device tree property would work, perhaps something like 'u-boot,clock-defaults-optional'.

We didn't need custom DT properties before, Linux doesn't need them either, so that approach seems wrong.

If the clock driver could say "skip unimplemented clock, because I don't implement them and that is OK", that sounds like the right approach.

Quoted 7 lines
Quoted 4 lines

Unless the 2022.01 release should be completely broken for a lot of platforms, I would propose we revert the clock uclass patch now and re-add it right after the release, so we would not roll out a completely broken release and would have more time to fix this properly.

It'll be no more broken than v2021.10 was for whatever platforms have problems here, yes? Since that's what has the problematic commit.

I agree with Marek here. We knew this broke boards before v2021.10 was released, but it was not reverted for that release. We should not make the same mistake again.

[3] https://lore.kernel.org/u-boot/[email protected]/

Reviewed-by on v1 1/1
#10 lore raw
In reply to Marek Vasut

Hi Marek,

Quoted 11 lines · Marek Vasut

This reverts commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646. The aforementioned patch causes massive breakage on all platforms which have 'assigned-clock' DT property in their DT which references any clock that are not supported by the platform clock driver. That can easily happen either in SPL, or because the clock driver is reduced. Currently it seems all iMX8M are affected and fail to boot altogether.

#11 lore raw
In reply to Marek Vasut
Quoted 7 lines · Marek Vasut

This reverts commit 92f1e9a4b31c0bf0f4f61ab823a6a88657323646. The aforementioned patch causes massive breakage on all platforms which have 'assigned-clock' DT property in their DT which references any clock that are not supported by the platform clock driver. That can easily happen either in SPL, or because the clock driver is reduced. Currently it seems all iMX8M are affected and fail to boot altogether.

Quoted 6 lines

Applied to u-boot/master, thanks!

Signature · 1 line
Tom