diff mbox series

[RFC,v2,15/48] test: lmb: remove the test for max regions

Message ID 20240704073544.670249-16-sughosh.ganu@linaro.org
State Superseded
Headers show
Series Make U-Boot memory reservations coherent | expand

Commit Message

Sughosh Ganu July 4, 2024, 7:35 a.m. UTC
The LMB memory map is now persistent and global, and the
CONFIG_LMB_USE_MAX_REGIONS config symbol has now been removed. Remove
the corresponding lmb test case.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
Changes since V1: New patch

 test/lib/lmb.c | 67 --------------------------------------------------
 1 file changed, 67 deletions(-)

Comments

Simon Glass July 13, 2024, 3:15 p.m. UTC | #1
On Thu, 4 Jul 2024 at 08:36, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> The LMB memory map is now persistent and global, and the
> CONFIG_LMB_USE_MAX_REGIONS config symbol has now been removed. Remove
> the corresponding lmb test case.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
> Changes since V1: New patch
>
>  test/lib/lmb.c | 67 --------------------------------------------------
>  1 file changed, 67 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Ilias Apalodimas July 22, 2024, 11:24 a.m. UTC | #2
On Thu, 4 Jul 2024 at 10:36, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> The LMB memory map is now persistent and global, and the
> CONFIG_LMB_USE_MAX_REGIONS config symbol has now been removed. Remove
> the corresponding lmb test case.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
> Changes since V1: New patch
>
>  test/lib/lmb.c | 67 --------------------------------------------------
>  1 file changed, 67 deletions(-)
>
> diff --git a/test/lib/lmb.c b/test/lib/lmb.c
> index 9f6b5633a7..a3a7ad904c 100644
> --- a/test/lib/lmb.c
> +++ b/test/lib/lmb.c
> @@ -648,73 +648,6 @@ static int lib_test_lmb_get_free_size(struct unit_test_state *uts)
>  }
>  LIB_TEST(lib_test_lmb_get_free_size, 0);
>
> -#ifdef CONFIG_LMB_USE_MAX_REGIONS
> -static int lib_test_lmb_max_regions(struct unit_test_state *uts)
> -{
> -       const phys_addr_t ram = 0x00000000;
> -       /*
> -        * All of 32bit memory space will contain regions for this test, so
> -        * we need to scale ram_size (which in this case is the size of the lmb
> -        * region) to match.
> -        */
> -       const phys_size_t ram_size = ((0xFFFFFFFF >> CONFIG_LMB_MAX_REGIONS)
> -                       + 1) * CONFIG_LMB_MAX_REGIONS;
> -       const phys_size_t blk_size = 0x10000;
> -       phys_addr_t offset;
> -       int ret, i;
> -
> -       ut_asserteq(lmb.memory.cnt, 0);
> -       ut_asserteq(lmb.memory.max, CONFIG_LMB_MAX_REGIONS);
> -       ut_asserteq(lmb.reserved.cnt, 0);
> -       ut_asserteq(lmb.reserved.max, CONFIG_LMB_MAX_REGIONS);
> -
> -       /*  Add CONFIG_LMB_MAX_REGIONS memory regions */
> -       for (i = 0; i < CONFIG_LMB_MAX_REGIONS; i++) {
> -               offset = ram + 2 * i * ram_size;
> -               ret = lmb_add(offset, ram_size);
> -               ut_asserteq(ret, 0);
> -       }
> -       ut_asserteq(lmb.memory.cnt, CONFIG_LMB_MAX_REGIONS);
> -       ut_asserteq(lmb.reserved.cnt, 0);
> -
> -       /*  error for the (CONFIG_LMB_MAX_REGIONS + 1) memory regions */
> -       offset = ram + 2 * (CONFIG_LMB_MAX_REGIONS + 1) * ram_size;
> -       ret = lmb_add(offset, ram_size);
> -       ut_asserteq(ret, -1);
> -
> -       ut_asserteq(lmb.memory.cnt, CONFIG_LMB_MAX_REGIONS);
> -       ut_asserteq(lmb.reserved.cnt, 0);
> -
> -       /*  reserve CONFIG_LMB_MAX_REGIONS regions */
> -       for (i = 0; i < CONFIG_LMB_MAX_REGIONS; i++) {
> -               offset = ram + 2 * i * blk_size;
> -               ret = lmb_reserve(offset, blk_size);
> -               ut_asserteq(ret, 0);
> -       }
> -
> -       ut_asserteq(lmb.memory.cnt, CONFIG_LMB_MAX_REGIONS);
> -       ut_asserteq(lmb.reserved.cnt, CONFIG_LMB_MAX_REGIONS);
> -
> -       /*  error for the 9th reserved blocks */
> -       offset = ram + 2 * (CONFIG_LMB_MAX_REGIONS + 1) * blk_size;
> -       ret = lmb_reserve(offset, blk_size);
> -       ut_asserteq(ret, -1);
> -
> -       ut_asserteq(lmb.memory.cnt, CONFIG_LMB_MAX_REGIONS);
> -       ut_asserteq(lmb.reserved.cnt, CONFIG_LMB_MAX_REGIONS);
> -
> -       /*  check each regions */
> -       for (i = 0; i < CONFIG_LMB_MAX_REGIONS; i++)
> -               ut_asserteq(lmb.memory.region[i].base, ram + 2 * i * ram_size);
> -
> -       for (i = 0; i < CONFIG_LMB_MAX_REGIONS; i++)
> -               ut_asserteq(lmb.reserved.region[i].base, ram + 2 * i * blk_size);
> -
> -       return 0;
> -}
> -LIB_TEST(lib_test_lmb_max_regions, 0);
> -#endif
> -
>  static int lib_test_lmb_flags(struct unit_test_state *uts)
>  {
>         const phys_addr_t ram = 0x40000000;
> --
> 2.34.1
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index 9f6b5633a7..a3a7ad904c 100644
--- a/test/lib/lmb.c
+++ b/test/lib/lmb.c
@@ -648,73 +648,6 @@  static int lib_test_lmb_get_free_size(struct unit_test_state *uts)
 }
 LIB_TEST(lib_test_lmb_get_free_size, 0);
 
-#ifdef CONFIG_LMB_USE_MAX_REGIONS
-static int lib_test_lmb_max_regions(struct unit_test_state *uts)
-{
-	const phys_addr_t ram = 0x00000000;
-	/*
-	 * All of 32bit memory space will contain regions for this test, so
-	 * we need to scale ram_size (which in this case is the size of the lmb
-	 * region) to match.
-	 */
-	const phys_size_t ram_size = ((0xFFFFFFFF >> CONFIG_LMB_MAX_REGIONS)
-			+ 1) * CONFIG_LMB_MAX_REGIONS;
-	const phys_size_t blk_size = 0x10000;
-	phys_addr_t offset;
-	int ret, i;
-
-	ut_asserteq(lmb.memory.cnt, 0);
-	ut_asserteq(lmb.memory.max, CONFIG_LMB_MAX_REGIONS);
-	ut_asserteq(lmb.reserved.cnt, 0);
-	ut_asserteq(lmb.reserved.max, CONFIG_LMB_MAX_REGIONS);
-
-	/*  Add CONFIG_LMB_MAX_REGIONS memory regions */
-	for (i = 0; i < CONFIG_LMB_MAX_REGIONS; i++) {
-		offset = ram + 2 * i * ram_size;
-		ret = lmb_add(offset, ram_size);
-		ut_asserteq(ret, 0);
-	}
-	ut_asserteq(lmb.memory.cnt, CONFIG_LMB_MAX_REGIONS);
-	ut_asserteq(lmb.reserved.cnt, 0);
-
-	/*  error for the (CONFIG_LMB_MAX_REGIONS + 1) memory regions */
-	offset = ram + 2 * (CONFIG_LMB_MAX_REGIONS + 1) * ram_size;
-	ret = lmb_add(offset, ram_size);
-	ut_asserteq(ret, -1);
-
-	ut_asserteq(lmb.memory.cnt, CONFIG_LMB_MAX_REGIONS);
-	ut_asserteq(lmb.reserved.cnt, 0);
-
-	/*  reserve CONFIG_LMB_MAX_REGIONS regions */
-	for (i = 0; i < CONFIG_LMB_MAX_REGIONS; i++) {
-		offset = ram + 2 * i * blk_size;
-		ret = lmb_reserve(offset, blk_size);
-		ut_asserteq(ret, 0);
-	}
-
-	ut_asserteq(lmb.memory.cnt, CONFIG_LMB_MAX_REGIONS);
-	ut_asserteq(lmb.reserved.cnt, CONFIG_LMB_MAX_REGIONS);
-
-	/*  error for the 9th reserved blocks */
-	offset = ram + 2 * (CONFIG_LMB_MAX_REGIONS + 1) * blk_size;
-	ret = lmb_reserve(offset, blk_size);
-	ut_asserteq(ret, -1);
-
-	ut_asserteq(lmb.memory.cnt, CONFIG_LMB_MAX_REGIONS);
-	ut_asserteq(lmb.reserved.cnt, CONFIG_LMB_MAX_REGIONS);
-
-	/*  check each regions */
-	for (i = 0; i < CONFIG_LMB_MAX_REGIONS; i++)
-		ut_asserteq(lmb.memory.region[i].base, ram + 2 * i * ram_size);
-
-	for (i = 0; i < CONFIG_LMB_MAX_REGIONS; i++)
-		ut_asserteq(lmb.reserved.region[i].base, ram + 2 * i * blk_size);
-
-	return 0;
-}
-LIB_TEST(lib_test_lmb_max_regions, 0);
-#endif
-
 static int lib_test_lmb_flags(struct unit_test_state *uts)
 {
 	const phys_addr_t ram = 0x40000000;