Hi Johan, On Sun, 23 Apr 2023 at 03:24, Johan Jonker <jbx6...@gmail.com> wrote: > > > > On 4/23/23 03:51, Kever Yang wrote: > > Hi Johan, > > > > On 2023/4/21 23:34, Johan Jonker wrote: > >> > >> On 4/21/23 05:15, Kever Yang wrote: > >>> Hi Johan, > >>> > >>> I got below error report from CI test, I think it should be relate > >>> to this patch set. > >>> > >>> =================================== FAILURES > >>> =================================== > >>> 1107 > >>> <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1107>_________________ > >>> test_ut[ut_dm_dm_test_fdt_get_addr_ptr_flat] _________________ > >>> 1108 > >>> <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1108>test/py/tests/test_ut.py:346: > >>> in test_ut > >>> 1109 > >>> <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assert > >>> output.endswith('Failures: 0') > >>> 1110 > >>> <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1110>E > >>> AssertionError: assert False > >>> 1111 > >>> <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1111>E > >>> + where False = <built-in method endswith of str object at > >>> 0x7f7089240c10>('Failures: 0') > >>> 1112 > >>> <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1112>E > >>> + where <built-in method endswith of str object at 0x7f7089240c10> = > >>> 'Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat > >>> tree)\r\r\ntest/dm/test-fdt.c:627, > >> dm_test_fdt_get_addr_ptr_fla...xpected 0000000000008000, got > >> 0000000010009000\r\r\nTest dm_test_fdt_get_addr_ptr_flat failed 1 > >> times\r\r\nFailures: 1'.endswith > >> > >> It turns out that the suggestion by Simon to use map_sysmem() doesn't work > >> with devfdt_get_addr_index_ptr() somehow. > >> > >> To reproduce with this serie: > >> make sandbox_defconfig all > >> ./u-boot -T -c "ut dm fdt*" > >> > >> Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree) > >> test/dm/test-fdt.c:627, dm_test_fdt_get_addr_ptr_flat(): (void *)0x8000 = > >> ptr: Expected 0000000000008000, got 0000000010009000 > >> Test fdt* failed 1 times > >> > >> === > >> > >> Could Simon have a look at the internal map_sysmem() stuff? > >> > >> Will send 1 patch to replace: > >> [PATCH v8 14/24] core: fdtaddr: add devfdt_get_addr_size_index_ptr function > >> > >> for: > >> > >> [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function > >> > >> Could Kever retest with the patch above replacement? > > > > > The CI test pass with this replacement. > > I've sent a new separate patch that handles map_sysmem. > > [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return > https://lore.kernel.org/u-boot/4990a11d-638f-661d-a7c0-e0c5bf7ff...@gmail.com/T/#u > > Apply after: > [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 > with replacement: > [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function > > Please have a look.
Yes it looks good, thanks. Basically we try to use addresses (ulong) in U-Boot, rather than pointers. We try to show addresses to the user as well (rather than pointers). Same with tests. Pointers are typically used locally, as needed, e.g. to access a struct at that location. So in general we use map_sysmem() quite a bit (to convert an address to a pointer), but map_to_sysmem() not very often. Regards, Simon