Re: svn commit: r364927 - head/sys/arm/allwinner/clkng
On 28/08/2020 21:25, Emmanuel Vadot wrote: > Author: manu > Date: Fri Aug 28 18:25:45 2020 > New Revision: 364927 > URL: https://svnweb.freebsd.org/changeset/base/364927 > > Log: > arm: allwinner: clk: Add printfs when we cannot set the correct freq > > For some unknown reason this seems to fix this function when we printf > the best variable. This isn't a delay problem as doing a printf without > it doesn't solve this problem. > This is way above my pay grade so add some printf that shouldn't be printed > in 99% of the case anyway. > Fix booting on most Allwinner boards as the mmc IP uses a NM clock. Just so that our IRC conversation does not get lost to time. I think that the real problem with the code is that it passes a difference between two uint64_t-s, which is uint64_t itself, to abs() which takes an int and returns an int. I am not sure what liberties compilers (especially, clang) can take with that incorrect code -- and they have some options, because abs() is an inline function -- and how the magic printf-s affect those liberties, but I think that it is better to make the code correct. I think that abs(x - y) can be replaced with a local function like: static inline uint64_t distance(uint64_t x, uint64_t y) { return (x >= y ? x - y : y - x); } > Reported by:Alexander Mishin > MFC after: 3 days > X-MFC-With: 363887 > > Modified: > head/sys/arm/allwinner/clkng/aw_clk_nm.c > > Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c > == > --- head/sys/arm/allwinner/clkng/aw_clk_nm.c Fri Aug 28 17:55:54 2020 > (r364926) > +++ head/sys/arm/allwinner/clkng/aw_clk_nm.c Fri Aug 28 18:25:45 2020 > (r364927) > @@ -221,11 +221,15 @@ aw_clk_nm_set_freq(struct clknode *clk, uint64_t fpare > if ((best < *fout) && > ((flags & CLK_SET_ROUND_DOWN) == 0)) { > *stop = 1; > + printf("best freq (%llu) < requested freq(%llu)\n", > + best, *fout); > return (ERANGE); > } > if ((best > *fout) && > ((flags & CLK_SET_ROUND_UP) == 0)) { > *stop = 1; > + printf("best freq (%llu) > requested freq(%llu)\n", > + best, *fout); > return (ERANGE); > } > > -- Andriy Gapon ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r364927 - head/sys/arm/allwinner/clkng
On Fri, 28 Aug 2020, at 18:25, Emmanuel Vadot wrote: > Author: manu > Date: Fri Aug 28 18:25:45 2020 > New Revision: 364927 > URL: https://svnweb.freebsd.org/changeset/base/364927 > > Log: > arm: allwinner: clk: Add printfs when we cannot set the correct freq > > For some unknown reason this seems to fix this function when we printf > the best variable. This isn't a delay problem as doing a printf without > it doesn't solve this problem. > This is way above my pay grade so add some printf that shouldn't be printed > in 99% of the case anyway. > Fix booting on most Allwinner boards as the mmc IP uses a NM clock. > > Reported by:Alexander Mishin > MFC after: 3 days > X-MFC-With: 363887 > > Modified: > head/sys/arm/allwinner/clkng/aw_clk_nm.c > > Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c > == > --- head/sys/arm/allwinner/clkng/aw_clk_nm.c Fri Aug 28 17:55:54 2020 > (r364926) > +++ head/sys/arm/allwinner/clkng/aw_clk_nm.c Fri Aug 28 18:25:45 2020 > (r364927) > @@ -221,11 +221,15 @@ aw_clk_nm_set_freq(struct clknode *clk, uint64_t fpare > if ((best < *fout) && > ((flags & CLK_SET_ROUND_DOWN) == 0)) { > *stop = 1; > + printf("best freq (%llu) < requested freq(%llu)\n", Salut Manu, Fails to build on aarch64 unless this is reverted, or I use printf("best freq (%lu) < requested freq(%lu)\n", > + best, *fout); > return (ERANGE); > } > if ((best > *fout) && > ((flags & CLK_SET_ROUND_UP) == 0)) { > *stop = 1; > + printf("best freq (%llu) > requested freq(%llu)\n", & again printf("best freq (%lu) > requested freq(%lu)\n", A+ Dave -- >>> stage 3.1: building everything -- /usr/src/sys/arm/allwinner/clkng/aw_clk_nm.c:225:7: error: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] best, *fout); ^~~~ /usr/src/sys/arm/allwinner/clkng/aw_clk_nm.c:225:13: error: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] best, *fout); ^ /usr/src/sys/arm/allwinner/clkng/aw_clk_nm.c:232:7: error: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] best, *fout); ^~~~ /usr/src/sys/arm/allwinner/clkng/aw_clk_nm.c:232:13: error: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat] best, *fout); ^ 4 errors generated. --- aw_clk_nm.o --- *** [aw_clk_nm.o] Error code 1 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r364927 - head/sys/arm/allwinner/clkng
Author: manu Date: Fri Aug 28 18:25:45 2020 New Revision: 364927 URL: https://svnweb.freebsd.org/changeset/base/364927 Log: arm: allwinner: clk: Add printfs when we cannot set the correct freq For some unknown reason this seems to fix this function when we printf the best variable. This isn't a delay problem as doing a printf without it doesn't solve this problem. This is way above my pay grade so add some printf that shouldn't be printed in 99% of the case anyway. Fix booting on most Allwinner boards as the mmc IP uses a NM clock. Reported by: Alexander Mishin MFC after:3 days X-MFC-With: 363887 Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c == --- head/sys/arm/allwinner/clkng/aw_clk_nm.cFri Aug 28 17:55:54 2020 (r364926) +++ head/sys/arm/allwinner/clkng/aw_clk_nm.cFri Aug 28 18:25:45 2020 (r364927) @@ -221,11 +221,15 @@ aw_clk_nm_set_freq(struct clknode *clk, uint64_t fpare if ((best < *fout) && ((flags & CLK_SET_ROUND_DOWN) == 0)) { *stop = 1; + printf("best freq (%llu) < requested freq(%llu)\n", + best, *fout); return (ERANGE); } if ((best > *fout) && ((flags & CLK_SET_ROUND_UP) == 0)) { *stop = 1; + printf("best freq (%llu) > requested freq(%llu)\n", + best, *fout); return (ERANGE); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"