From 58fc2b54f5b9102d593f3b98c370b6cbaeb97ac2 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 5 Feb 2020 21:59:12 +0100 Subject: [PATCH 1/8] pci: definition of pci_addr_t and pci_size_t Currently the size of pci_addr_t and pci_size_t depends on CONFIG_SYS_PCI_64BIT. For qemu_arm64_defconfig with 4 GiB RAM this leads to an error pci_hose_phys_to_bus: invalid physical address which is due to the truncation of the bus address in _dm_pci_phys_to_bus. Defining CONFIG_SYS_PCI_64BIT is not a solution as this results in an error PCI: Failed autoconfig bar 10 So let's use unsigned long for pci_addr_t and pci_size_t if CONFIG_SYS_PCI_64BIT is not defined. Considering that 32bit U-Boot is used to launch some 64bit x86 systems we cannot do without CONFIG_SYS_PCI_64BIT requiring u64 as type. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- include/pci.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pci.h b/include/pci.h index 50ca249f2d..174ddd4460 100644 --- a/include/pci.h +++ b/include/pci.h @@ -488,8 +488,8 @@ typedef u64 pci_addr_t; typedef u64 pci_size_t; #else -typedef u32 pci_addr_t; -typedef u32 pci_size_t; +typedef unsigned long pci_addr_t; +typedef unsigned long pci_size_t; #endif struct pci_region { From 58b209cf6060db60375a2ca9fb21febfae3b8f31 Mon Sep 17 00:00:00 2001 From: Philippe Reynes Date: Thu, 6 Feb 2020 17:12:59 +0100 Subject: [PATCH 2/8] test: aes: fix memleak In the first version, the result of malloc is checked with ut_assertnonnull. But on a fail, this macro exit the function, so previously malloc are not freed. So to avoid a memleak, we don't use ut_assertnonnull, but simply check the return of malloc. If one has failed, we freed all the allocated memory and quit the function. Reported-by: Coverity (CID: 284403) Reported-by: Coverity (CID: 284404) Reported-by: Coverity (CID: 284405) Reported-by: Coverity (CID: 284406) Reported-by: Coverity (CID: 284407) Signed-off-by: Philippe Reynes --- test/lib/test_aes.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/lib/test_aes.c b/test/lib/test_aes.c index b7b4b775df..fb8a0b17ba 100644 --- a/test/lib/test_aes.c +++ b/test/lib/test_aes.c @@ -88,17 +88,17 @@ static int _lib_test_aes_run(struct unit_test_state *uts, int key_len, /* Allocate all the buffer */ key = malloc(key_len); - ut_assertnonnull(key); key_exp = malloc(key_exp_len); - ut_assertnonnull(key_exp); iv = malloc(AES_BLOCK_LENGTH); - ut_assertnonnull(iv); nocipher = malloc(num_block * AES_BLOCK_LENGTH); - ut_assertnonnull(nocipher); ciphered = malloc((num_block + 1) * AES_BLOCK_LENGTH); - ut_assertnonnull(ciphered); uncipher = malloc((num_block + 1) * AES_BLOCK_LENGTH); - ut_assertnonnull(uncipher); + + if (!key || !key_exp || !iv || !nocipher || !ciphered || !uncipher) { + printf("%s: can't allocate memory\n", __func__); + ret = -1; + goto out; + } /* Initialize all buffer */ rand_buf(key, key_len); @@ -127,6 +127,7 @@ static int _lib_test_aes_run(struct unit_test_state *uts, int key_len, ret = -1; }; + out: /* Free all the data */ free(key); free(key_exp); From a3a9e046570ab6fb552ed7b5d04c3417e5debf91 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 12 Feb 2020 18:23:49 +0100 Subject: [PATCH 3/8] common/console.c: discard volatile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid errors of like common/console.c: In function ‘console_record_reset’: common/console.c:615:16: error: passing argument 1 of ‘membuff_purge’ discards ‘volatile’ qualifier from pointer target type [-Werror=discarded-qualifiers] 615 | membuff_purge(&gd->console_out); | ^~~~~~~~~~~~~~~~ by casting to non-volatile. The volatile property stems from declarations like arch/arm/include/asm/global_data.h:114: But there is no need to treat gd->console_out and gd->console_in as volatile in the context of common/console.c. Fixes: b612312816ff ("console: Add a function to read a line of the output / eof") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- common/console.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/common/console.c b/common/console.c index 7681da19a2..e398530a13 100644 --- a/common/console.c +++ b/common/console.c @@ -401,7 +401,7 @@ int getc(void) if (gd->console_in.start) { int ch; - ch = membuff_getbyte(&gd->console_in); + ch = membuff_getbyte((struct membuff *)&gd->console_in); if (ch != -1) return 1; } @@ -426,7 +426,7 @@ int tstc(void) return 0; #ifdef CONFIG_CONSOLE_RECORD if (gd->console_in.start) { - if (membuff_peekbyte(&gd->console_in) != -1) + if (membuff_peekbyte((struct membuff *)&gd->console_in) != -1) return 1; } #endif @@ -518,7 +518,7 @@ void putc(const char c) return; #ifdef CONFIG_CONSOLE_RECORD if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) - membuff_putbyte(&gd->console_out, c); + membuff_putbyte((struct membuff *)&gd->console_out, c); #endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) { @@ -569,7 +569,7 @@ void puts(const char *s) return; #ifdef CONFIG_CONSOLE_RECORD if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) - membuff_put(&gd->console_out, s, strlen(s)); + membuff_put((struct membuff *)&gd->console_out, s, strlen(s)); #endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) { @@ -602,18 +602,20 @@ int console_record_init(void) { int ret; - ret = membuff_new(&gd->console_out, CONFIG_CONSOLE_RECORD_OUT_SIZE); + ret = membuff_new((struct membuff *)&gd->console_out, + CONFIG_CONSOLE_RECORD_OUT_SIZE); if (ret) return ret; - ret = membuff_new(&gd->console_in, CONFIG_CONSOLE_RECORD_IN_SIZE); + ret = membuff_new((struct membuff *)&gd->console_in, + CONFIG_CONSOLE_RECORD_IN_SIZE); return ret; } void console_record_reset(void) { - membuff_purge(&gd->console_out); - membuff_purge(&gd->console_in); + membuff_purge((struct membuff *)&gd->console_out); + membuff_purge((struct membuff *)&gd->console_in); } void console_record_reset_enable(void) @@ -624,12 +626,13 @@ void console_record_reset_enable(void) int console_record_readline(char *str, int maxlen) { - return membuff_readline(&gd->console_out, str, maxlen, ' '); + return membuff_readline((struct membuff *)&gd->console_out, str, + maxlen, ' '); } int console_record_avail(void) { - return membuff_avail(&gd->console_out); + return membuff_avail((struct membuff *)&gd->console_out); } #endif From 7d92204bc0eb0a775810f887838a93a218a22f96 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 7 Feb 2020 21:25:09 +0100 Subject: [PATCH 4/8] doc: board: add Rockchip to doc/board/index.rst Fix a build error checking consistency... /doc/board/rockchip/index.rst: WARNING: document isn't included in any toctree Fixes: 338b86c9b305 ("doc: boards: Add rockchip documentation") Signed-off-by: Heinrich Schuchardt --- doc/board/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/board/index.rst b/doc/board/index.rst index 00e72f57cd..b8b956d730 100644 --- a/doc/board/index.rst +++ b/doc/board/index.rst @@ -14,5 +14,6 @@ Board-specific doc google/index intel/index renesas/index + rockchip/index sifive/index xilinx/index From e3dc5924ca07d91cb8dbad507515255bc26c5434 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 13 Feb 2020 08:29:45 +0100 Subject: [PATCH 5/8] ram: rockchip: Fix Kconfig dependency for RAM_ROCKCHIP_DEBUG There is no reason to show RAM_ROCKCHIP_DEBUG entry in other .config files as I see it for Xilinx ZynqMP. \# CONFIG_U_QE is not set \# CONFIG_RAM is not set CONFIG_RAM_ROCKCHIP_DEBUG=y Add missing dependency on RAM_ROCKCHIP driver. Signed-off-by: Michal Simek --- drivers/ram/rockchip/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ram/rockchip/Kconfig b/drivers/ram/rockchip/Kconfig index b75d581f57..8e97c2f49e 100644 --- a/drivers/ram/rockchip/Kconfig +++ b/drivers/ram/rockchip/Kconfig @@ -13,6 +13,7 @@ config ROCKCHIP_SDRAM_COMMON config RAM_ROCKCHIP_DEBUG bool "Rockchip ram drivers debugging" + depends on RAM_ROCKCHIP default y help This enables debugging ram driver API's for the platforms From 215df01de40bfefc32c86c73e4acbca1bbb74329 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 7 Feb 2020 15:17:42 +0000 Subject: [PATCH 6/8] net: convert NET_MAXDEFRAG to Kconfig Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- net/Kconfig | 10 ++++++++++ net/net.c | 3 --- scripts/config_whitelist.txt | 1 - 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/net/Kconfig b/net/Kconfig index a07f6746c5..96bbce1778 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -29,6 +29,16 @@ config IP_DEFRAG Selecting this will enable IP datagram reassembly according to the algorithm in RFC815. +config NET_MAXDEFRAG + int "Size of buffer used for IP datagram reassembly" + depends on IP_DEFRAG + default 16384 + range 1024 65536 + help + This defines the size of the statically allocated buffer + used for reassembly, and thus an upper bound for the size of + IP datagrams that can be received. + config TFTP_BLOCKSIZE int "TFTP block size" default 1468 diff --git a/net/net.c b/net/net.c index d8a60b6119..087d399a24 100644 --- a/net/net.c +++ b/net/net.c @@ -883,9 +883,6 @@ int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport, * to the algorithm in RFC815. It returns NULL or the pointer to * a complete packet, in static storage */ -#ifndef CONFIG_NET_MAXDEFRAG -#define CONFIG_NET_MAXDEFRAG 16384 -#endif #define IP_PKTSIZE (CONFIG_NET_MAXDEFRAG) #define IP_MAXUDP (IP_PKTSIZE - IP_HDR_SIZE) diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 874f268cb2..405c62e9be 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1212,7 +1212,6 @@ CONFIG_NETSPACE_LITE_V2 CONFIG_NETSPACE_MAX_V2 CONFIG_NETSPACE_MINI_V2 CONFIG_NETSPACE_V2 -CONFIG_NET_MAXDEFRAG CONFIG_NET_MULTI CONFIG_NET_RETRY_COUNT CONFIG_NEVER_ASSERT_ODT_TO_CPU From fbf9c154a6d9c600b355076c33f60781ddbd34f2 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Wed, 5 Feb 2020 08:54:42 +0200 Subject: [PATCH 7/8] board_f: Make clear_bss generic clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic and provide a weak nop stub for it. This also removes arch-specific ifdef duplications around clear_bss. Signed-off-by: Ovidiu Panait --- common/board_f.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 8fa26e3ca5..82a164752a 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -867,6 +867,11 @@ __weak int checkcpu(void) return 0; } +__weak int clear_bss(void) +{ + return 0; +} + static const init_fnc_t init_sequence_f[] = { setup_mon_len, #ifdef CONFIG_OF_CONTROL @@ -1002,11 +1007,8 @@ static const init_fnc_t init_sequence_f[] = { #if defined(CONFIG_X86) || defined(CONFIG_ARC) copy_uboot_to_ram, do_elf_reloc_fixups, - clear_bss, #endif -#if defined(CONFIG_XTENSA) clear_bss, -#endif #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \ !CONFIG_IS_ENABLED(X86_64) jump_to_copy, From 26a426a1001d0f84fc1627ea547fb4f406e85d5c Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 11 Feb 2020 12:41:14 -0500 Subject: [PATCH 8/8] travis/gitlab/azure: Ensure we use python3 always When running our tests there are some cases where as part of the Python 2.7 to Python 3.6 migration we didn't force Python 3.6 to be used as everything wasn't yet migrated. Now that everything is, make sure to tell virtualenv to use python3. In the case of Travis this is best done by making the tools test happen after the main tests so that it will already have been run in all cases, TEST_PY_TOOLS is a subset of TEST_PY_BD. Signed-off-by: Tom Rini --- .azure-pipelines.yml | 2 +- .gitlab-ci.yml | 4 ++-- .travis.yml | 18 ++++++++---------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 052c3aa278..c22095830c 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -123,7 +123,7 @@ jobs: git config --global user.name "Azure Pipelines" git config --global user.email bmeng.cn@gmail.com export USER=azure - virtualenv /tmp/venv + virtualenv -p /usr/bin/python3 /tmp/venv . /tmp/venv/bin/activate pip install pyelftools export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e20a789ac1..d486e72042 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -72,7 +72,7 @@ build all 64bit ARM platforms: tags: [ 'all' ] stage: world build script: - - virtualenv /tmp/venv + - virtualenv -p /usr/bin/python3 /tmp/venv - . /tmp/venv/bin/activate - pip install pyelftools - ret=0; @@ -157,7 +157,7 @@ Run binman, buildman, dtoc and patman testsuites: - git config --global user.name "GitLab CI Runner"; git config --global user.email trini@konsulko.com; export USER=gitlab; - virtualenv /tmp/venv; + virtualenv -p /usr/bin/python3 /tmp/venv; . /tmp/venv/bin/activate; pip install pyelftools; export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl; diff --git a/.travis.yml b/.travis.yml index 44e539038a..e6db9d6a72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -133,16 +133,6 @@ script: cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/; cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi; cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi; - if [[ -n "${TEST_PY_TOOLS}" ]]; then - PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt" - PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}" - ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test && - ./tools/patman/patman --test && - ./tools/buildman/buildman -t && - PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt" - PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}" - ./tools/dtoc/dtoc -t; - fi; if [[ "${TEST_PY_BD}" != "" ]]; then virtualenv -p /usr/bin/python3 /tmp/venv; . /tmp/venv/bin/activate; @@ -154,6 +144,14 @@ script: if [[ $ret -ne 0 ]]; then exit $ret; fi; + if [[ -n "${TEST_PY_TOOLS}" ]]; then + export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"; + export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"; + ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test && + ./tools/patman/patman --test && + ./tools/buildman/buildman -t && + ./tools/dtoc/dtoc -t; + fi; fi matrix: