Page MenuHomeFreeBSD

imx clk: Skip reconfiguring the clock if we don't have a new best_parent
ClosedPublic

Authored by thj on Sep 13 2024, 1:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 2, 3:19 PM
Unknown Object (File)
Thu, Oct 24, 10:08 AM
Unknown Object (File)
Oct 6 2024, 2:36 PM
Unknown Object (File)
Oct 3 2024, 5:23 PM
Unknown Object (File)
Oct 3 2024, 3:33 PM
Unknown Object (File)
Sep 27 2024, 1:48 PM
Unknown Object (File)
Sep 25 2024, 6:14 PM
Unknown Object (File)
Sep 25 2024, 2:23 PM
Subscribers

Details

Summary

imx_clk_composite_find_best_parent can fail, when it does for all the
clocks checked we attempt to configure an uninitialized best_parent
leading to a panic.

Initialize best_parent and skip reconfiguring the clock if we
don't find a new best_parent to use.

Test Plan

A change like this is needed for me to boot on imx8mp, I was skipping the call
to clknode_set_parent_by_idx for testing of other stuff. Skipping all the
following clock configuration doesn't have any noticable impact on my test
system.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

thj requested review of this revision.Sep 13 2024, 1:19 PM
This revision is now accepted and ready to land.Sep 16 2024, 9:45 AM
mmel added inline comments.
sys/arm64/freescale/imx/clk/imx_clk_composite.c
249

This doesn't looks right, the <foo>_set_freq() in case of not-errored exit must set fout to real output frequency of given clock block.

However, at first glance, there are more problems in this feature:

  • best_diff should be initialized to INT64_MAX (and I think this is the correct fix for your problem).
  • It seems that READ4() is not followed by WRITE4() at the end of the function, so all calculated values are not written to hw.

Thanks for checking this over!

I think I assume that fout was starting with a good value and didn't dig beyond clearing the panic.

There are lot of issues with devices under this clock right now, so maybe writing out the selected clock will help.

I'll draft something up and tag you this week.