diff options
author | Tom Rini <trini@konsulko.com> | 2023-02-08 14:10:45 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-02-08 14:10:45 -0500 |
commit | ba9e7ceb7ab2652fcaa14cc51ec9d8d0d94c14ae (patch) | |
tree | 4ac3ecd1f78009efcb8a91fdece387aad2b4dc0d | |
parent | 94fe4ed9455d559ccca45865c195fe4ecdaffb51 (diff) | |
parent | 2dc16a2c1f924985216b3f1d6710f96d6c4fb1ab (diff) | |
download | u-boot-WIP/08Feb2023.zip u-boot-WIP/08Feb2023.tar.gz u-boot-WIP/08Feb2023.tar.bz2 |
Merge branch '2023-02-08-increase-default-LMB-regions'WIP/08Feb2023
- Correct my mistake with defaulting to not setting LMB_USE_MAX_REGIONS,
and fix the lmb test to scale with more than 8 regions before setting
the new default to 16 regions.
-rw-r--r-- | configs/a3y17lte_defconfig | 1 | ||||
-rw-r--r-- | configs/a5y17lte_defconfig | 1 | ||||
-rw-r--r-- | configs/a7y17lte_defconfig | 1 | ||||
-rw-r--r-- | configs/dragonboard845c_defconfig | 1 | ||||
-rw-r--r-- | configs/mt7981_emmc_rfb_defconfig | 1 | ||||
-rw-r--r-- | configs/mt7981_rfb_defconfig | 1 | ||||
-rw-r--r-- | configs/mt7981_sd_rfb_defconfig | 1 | ||||
-rw-r--r-- | configs/mt7986_rfb_defconfig | 1 | ||||
-rw-r--r-- | configs/mt7986a_bpir3_emmc_defconfig | 1 | ||||
-rw-r--r-- | configs/mt7986a_bpir3_sd_defconfig | 1 | ||||
-rw-r--r-- | configs/qcs404evb_defconfig | 1 | ||||
-rw-r--r-- | configs/starqltechn_defconfig | 1 | ||||
-rw-r--r-- | lib/Kconfig | 3 | ||||
-rw-r--r-- | test/lib/lmb.c | 44 |
14 files changed, 40 insertions, 19 deletions
diff --git a/configs/a3y17lte_defconfig b/configs/a3y17lte_defconfig index 0215c5f..124fb8d 100644 --- a/configs/a3y17lte_defconfig +++ b/configs/a3y17lte_defconfig @@ -24,3 +24,4 @@ CONFIG_SYS_BOOTM_LEN=0x2000000 CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_DM_I2C_GPIO=y +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/a5y17lte_defconfig b/configs/a5y17lte_defconfig index d1cd97b..ffb0b3f 100644 --- a/configs/a5y17lte_defconfig +++ b/configs/a5y17lte_defconfig @@ -24,3 +24,4 @@ CONFIG_SYS_BOOTM_LEN=0x2000000 CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_DM_I2C_GPIO=y +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/a7y17lte_defconfig b/configs/a7y17lte_defconfig index bef2d09..8c1229d 100644 --- a/configs/a7y17lte_defconfig +++ b/configs/a7y17lte_defconfig @@ -24,3 +24,4 @@ CONFIG_SYS_BOOTM_LEN=0x2000000 CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_DM_I2C_GPIO=y +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/dragonboard845c_defconfig b/configs/dragonboard845c_defconfig index cef82f5..a69d827 100644 --- a/configs/dragonboard845c_defconfig +++ b/configs/dragonboard845c_defconfig @@ -26,3 +26,4 @@ CONFIG_DM_PMIC=y CONFIG_PMIC_QCOM=y CONFIG_MSM_GENI_SERIAL=y CONFIG_SPMI_MSM=y +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/mt7981_emmc_rfb_defconfig b/configs/mt7981_emmc_rfb_defconfig index 4832a22..b3b37b6 100644 --- a/configs/mt7981_emmc_rfb_defconfig +++ b/configs/mt7981_emmc_rfb_defconfig @@ -62,3 +62,4 @@ CONFIG_MTK_SERIAL=y CONFIG_FAT_WRITE=y CONFIG_HEXDUMP=y # CONFIG_EFI_LOADER is not set +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/mt7981_rfb_defconfig b/configs/mt7981_rfb_defconfig index c397527..b7ffb4df 100644 --- a/configs/mt7981_rfb_defconfig +++ b/configs/mt7981_rfb_defconfig @@ -64,3 +64,4 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_MTK_SPIM=y CONFIG_HEXDUMP=y +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/mt7981_sd_rfb_defconfig b/configs/mt7981_sd_rfb_defconfig index 17592dc..85be9bb 100644 --- a/configs/mt7981_sd_rfb_defconfig +++ b/configs/mt7981_sd_rfb_defconfig @@ -62,3 +62,4 @@ CONFIG_MTK_SERIAL=y CONFIG_FAT_WRITE=y CONFIG_HEXDUMP=y # CONFIG_EFI_LOADER is not set +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/mt7986_rfb_defconfig b/configs/mt7986_rfb_defconfig index 1363f9d..ac91c93 100644 --- a/configs/mt7986_rfb_defconfig +++ b/configs/mt7986_rfb_defconfig @@ -64,3 +64,4 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_MTK_SPIM=y CONFIG_HEXDUMP=y +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/mt7986a_bpir3_emmc_defconfig b/configs/mt7986a_bpir3_emmc_defconfig index 354159d..2d4876f 100644 --- a/configs/mt7986a_bpir3_emmc_defconfig +++ b/configs/mt7986a_bpir3_emmc_defconfig @@ -62,3 +62,4 @@ CONFIG_MTK_SERIAL=y CONFIG_FAT_WRITE=y CONFIG_HEXDUMP=y # CONFIG_EFI_LOADER is not set +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/mt7986a_bpir3_sd_defconfig b/configs/mt7986a_bpir3_sd_defconfig index db7ef98..08edfe7 100644 --- a/configs/mt7986a_bpir3_sd_defconfig +++ b/configs/mt7986a_bpir3_sd_defconfig @@ -62,3 +62,4 @@ CONFIG_MTK_SERIAL=y CONFIG_FAT_WRITE=y CONFIG_HEXDUMP=y # CONFIG_EFI_LOADER is not set +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/qcs404evb_defconfig b/configs/qcs404evb_defconfig index d3608ca..dae1551 100644 --- a/configs/qcs404evb_defconfig +++ b/configs/qcs404evb_defconfig @@ -51,3 +51,4 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_STORAGE=y +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/starqltechn_defconfig b/configs/starqltechn_defconfig index 81fd7b2..7a64f2a 100644 --- a/configs/starqltechn_defconfig +++ b/configs/starqltechn_defconfig @@ -33,3 +33,4 @@ CONFIG_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_SIMPLE=y CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_LMB_MAX_REGIONS=64 diff --git a/lib/Kconfig b/lib/Kconfig index 59e4304..06c873c 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -1028,6 +1028,7 @@ config LMB config LMB_USE_MAX_REGIONS bool "Use a common number of memory and reserved regions in lmb lib" depends on LMB + default y help Define the number of supported memory regions in the library logical memory blocks. @@ -1037,7 +1038,7 @@ config LMB_USE_MAX_REGIONS config LMB_MAX_REGIONS int "Number of memory and reserved regions in lmb lib" depends on LMB && LMB_USE_MAX_REGIONS - default 8 + default 16 help Define the number of supported regions, memory and reserved, in the library logical memory blocks. diff --git a/test/lib/lmb.c b/test/lib/lmb.c index 157c263..1628875 100644 --- a/test/lib/lmb.c +++ b/test/lib/lmb.c @@ -665,10 +665,17 @@ static int lib_test_lmb_get_free_size(struct unit_test_state *uts) DM_TEST(lib_test_lmb_get_free_size, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +#ifdef CONFIG_LMB_USE_MAX_REGIONS static int lib_test_lmb_max_regions(struct unit_test_state *uts) { const phys_addr_t ram = 0x00000000; - const phys_size_t ram_size = 0x8000000; + /* + * 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; struct lmb lmb; @@ -677,54 +684,55 @@ static int lib_test_lmb_max_regions(struct unit_test_state *uts) lmb_init(&lmb); ut_asserteq(lmb.memory.cnt, 0); - ut_asserteq(lmb.memory.max, 8); + ut_asserteq(lmb.memory.max, CONFIG_LMB_MAX_REGIONS); ut_asserteq(lmb.reserved.cnt, 0); - ut_asserteq(lmb.reserved.max, 8); + ut_asserteq(lmb.reserved.max, CONFIG_LMB_MAX_REGIONS); - /* Add 8 memory regions */ - for (i = 0; i < 8; i++) { + /* 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(&lmb, offset, ram_size); ut_asserteq(ret, 0); } - ut_asserteq(lmb.memory.cnt, 8); + ut_asserteq(lmb.memory.cnt, CONFIG_LMB_MAX_REGIONS); ut_asserteq(lmb.reserved.cnt, 0); - /* error for the 9th memory regions */ - offset = ram + 2 * 8 * ram_size; + /* error for the (CONFIG_LMB_MAX_REGIONS + 1) memory regions */ + offset = ram + 2 * (CONFIG_LMB_MAX_REGIONS + 1) * ram_size; ret = lmb_add(&lmb, offset, ram_size); ut_asserteq(ret, -1); - ut_asserteq(lmb.memory.cnt, 8); + ut_asserteq(lmb.memory.cnt, CONFIG_LMB_MAX_REGIONS); ut_asserteq(lmb.reserved.cnt, 0); - /* reserve 8 regions */ - for (i = 0; i < 8; i++) { + /* reserve CONFIG_LMB_MAX_REGIONS regions */ + for (i = 0; i < CONFIG_LMB_MAX_REGIONS; i++) { offset = ram + 2 * i * blk_size; ret = lmb_reserve(&lmb, offset, blk_size); ut_asserteq(ret, 0); } - ut_asserteq(lmb.memory.cnt, 8); - ut_asserteq(lmb.reserved.cnt, 8); + 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 * 8 * blk_size; + offset = ram + 2 * (CONFIG_LMB_MAX_REGIONS + 1) * blk_size; ret = lmb_reserve(&lmb, offset, blk_size); ut_asserteq(ret, -1); - ut_asserteq(lmb.memory.cnt, 8); - ut_asserteq(lmb.reserved.cnt, 8); + 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 < 8; i++) + 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 < 8; i++) + for (i = 0; i < CONFIG_LMB_MAX_REGIONS; i++) ut_asserteq(lmb.reserved.region[i].base, ram + 2 * i * blk_size); return 0; } +#endif DM_TEST(lib_test_lmb_max_regions, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); |