summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-07-29 19:10:23 +0300
committerTom Rini <trini@konsulko.com>2021-07-29 19:10:55 +0300
commit15f7e0dc01d8a851fb1bfbf0e47eab5b67ed26b3 (patch)
treea05518590771cfaff996f35856b9d9d8edfa7221
parent38436abd5e58044eccddbcd7ec3610a9104e86b6 (diff)
parent62b27a561c2868d95445905ad554297e43cc0f2b (diff)
downloadu-boot-15f7e0dc01d8a851fb1bfbf0e47eab5b67ed26b3.tar.xz
Merge branch '2021-07-28-assorted-fixes'
- Assorted bugfixes
-rw-r--r--Makefile2
-rw-r--r--arch/arm/cpu/armv8/cache_v8.c10
-rw-r--r--arch/arm/include/asm/io.h25
-rw-r--r--arch/arm/mach-mediatek/mt8183/init.c2
-rw-r--r--board/congatec/cgtqmx8/cgtqmx8.c2
-rw-r--r--board/hoperun/hihope-rzg2/hihope-rzg2.c2
-rw-r--r--board/silinux/ek874/ek874.c2
-rw-r--r--doc/arch/sandbox.rst6
-rw-r--r--doc/build/gcc.rst6
-rw-r--r--doc/uImage.FIT/signature.txt4
-rw-r--r--drivers/misc/swap_case.c13
-rw-r--r--include/cpu_func.h1
-rw-r--r--lib/rsa/rsa-sign.c13
-rw-r--r--lib/rsa/rsa-verify.c2
-rw-r--r--scripts/Makefile.spl2
-rwxr-xr-xscripts/gen_ll_addressable_symbols.sh5
-rw-r--r--test/py/tests/test_fs/test_squashfs/sqfs_common.py2
17 files changed, 68 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index b4ae66b201..8c84c22b72 100644
--- a/Makefile
+++ b/Makefile
@@ -1735,7 +1735,7 @@ u-boot-keep-syms-lto_c := $(patsubst %.o,%.c,$(u-boot-keep-syms-lto))
quiet_cmd_keep_syms_lto = KSL $@
cmd_keep_syms_lto = \
- NM=$(NM) $(srctree)/scripts/gen_ll_addressable_symbols.sh $^ >$@
+ $(srctree)/scripts/gen_ll_addressable_symbols.sh $(NM) $^ > $@
quiet_cmd_keep_syms_lto_cc = KSLCC $@
cmd_keep_syms_lto_cc = \
diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
index 15cecb5e0b..3de18c7675 100644
--- a/arch/arm/cpu/armv8/cache_v8.c
+++ b/arch/arm/cpu/armv8/cache_v8.c
@@ -719,6 +719,11 @@ int icache_status(void)
return (get_sctlr() & CR_I) != 0;
}
+int mmu_status(void)
+{
+ return (get_sctlr() & CR_M) != 0;
+}
+
void invalidate_icache_all(void)
{
__asm_invalidate_icache_all();
@@ -740,6 +745,11 @@ int icache_status(void)
return 0;
}
+int mmu_status(void)
+{
+ return 0;
+}
+
void invalidate_icache_all(void)
{
}
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index df264a170b..36b840378a 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -338,6 +338,7 @@ extern void __readwrite_bug(const char *fn);
/* Optimized copy functions to read from/write to IO sapce */
#ifdef CONFIG_ARM64
+#include <cpu_func.h>
/*
* Copy data from IO memory space to "real" memory space.
*/
@@ -351,11 +352,13 @@ void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
count--;
}
- while (count >= 8) {
- *(u64 *)to = __raw_readq(from);
- from += 8;
- to += 8;
- count -= 8;
+ if (mmu_status()) {
+ while (count >= 8) {
+ *(u64 *)to = __raw_readq(from);
+ from += 8;
+ to += 8;
+ count -= 8;
+ }
}
while (count) {
@@ -379,11 +382,13 @@ void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
count--;
}
- while (count >= 8) {
- __raw_writeq(*(u64 *)from, to);
- from += 8;
- to += 8;
- count -= 8;
+ if (mmu_status()) {
+ while (count >= 8) {
+ __raw_writeq(*(u64 *)from, to);
+ from += 8;
+ to += 8;
+ count -= 8;
+ }
}
while (count) {
diff --git a/arch/arm/mach-mediatek/mt8183/init.c b/arch/arm/mach-mediatek/mt8183/init.c
index 877f387102..7496029705 100644
--- a/arch/arm/mach-mediatek/mt8183/init.c
+++ b/arch/arm/mach-mediatek/mt8183/init.c
@@ -48,7 +48,7 @@ int mtk_soc_early_init(void)
return 0;
}
-void reset_cpu(ulong addr)
+void reset_cpu(void)
{
psci_system_reset();
}
diff --git a/board/congatec/cgtqmx8/cgtqmx8.c b/board/congatec/cgtqmx8/cgtqmx8.c
index fb0cf09138..a50a052df7 100644
--- a/board/congatec/cgtqmx8/cgtqmx8.c
+++ b/board/congatec/cgtqmx8/cgtqmx8.c
@@ -374,7 +374,7 @@ void detail_board_ddr_info(void)
/*
* Board specific reset that is system reset.
*/
-void reset_cpu(ulong addr)
+void reset_cpu(void)
{
/* TODO */
}
diff --git a/board/hoperun/hihope-rzg2/hihope-rzg2.c b/board/hoperun/hihope-rzg2/hihope-rzg2.c
index c1bfdcbc1d..c1db387b27 100644
--- a/board/hoperun/hihope-rzg2/hihope-rzg2.c
+++ b/board/hoperun/hihope-rzg2/hihope-rzg2.c
@@ -65,7 +65,7 @@ int board_init(void)
return 0;
}
-void reset_cpu(ulong addr)
+void reset_cpu(void)
{
unsigned long midr, cputype;
diff --git a/board/silinux/ek874/ek874.c b/board/silinux/ek874/ek874.c
index 5a219cd98d..1e948489f3 100644
--- a/board/silinux/ek874/ek874.c
+++ b/board/silinux/ek874/ek874.c
@@ -24,7 +24,7 @@ int board_init(void)
return 0;
}
-void reset_cpu(ulong addr)
+void reset_cpu(void)
{
writel(RST_CA53_CODE, RST_CA53RESCNT);
}
diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst
index 9e23e1618c..f8804e1f41 100644
--- a/doc/arch/sandbox.rst
+++ b/doc/arch/sandbox.rst
@@ -43,11 +43,7 @@ Note that standalone/API support is not available at present.
Prerequisites
-------------
-Here are some packages that are worth installing if you are doing sandbox or
-tools development in U-Boot:
-
- python3-pytest lzma lzma-alone lz4 python3 python3-virtualenv
- libssl1.0-dev
+Install the dependencies noted in :doc:`../build/gcc`.
Basic Operation
diff --git a/doc/build/gcc.rst b/doc/build/gcc.rst
index c51b3e73b8..8ffb4e3447 100644
--- a/doc/build/gcc.rst
+++ b/doc/build/gcc.rst
@@ -26,8 +26,10 @@ Depending on the build targets further packages maybe needed
sudo apt-get install bc bison build-essential coccinelle \
device-tree-compiler dfu-util efitools flex gdisk liblz4-tool \
libguestfs-tools libncurses-dev libpython3-dev libsdl2-dev libssl-dev \
- lzma-alone openssl python3 python3-coverage python3-pyelftools \
- python3-pytest python3-sphinxcontrib.apidoc python3-sphinx-rtd-theme swig
+ lz4 lzma lzma-alone openssl python3 python3-coverage \
+ python3-pycryptodome python3-pyelftools python3-pytest \
+ python3-sphinxcontrib.apidoc python3-sphinx-rtd-theme python3-virtualenv \
+ swig
SUSE based
~~~~~~~~~~
diff --git a/doc/uImage.FIT/signature.txt b/doc/uImage.FIT/signature.txt
index 7cb1c15e5e..61a72db3c7 100644
--- a/doc/uImage.FIT/signature.txt
+++ b/doc/uImage.FIT/signature.txt
@@ -533,8 +533,8 @@ Generic engine key ids:
or
"<key-name-hint>"
-As mkimage does not at this time support prompting for passwords HSM may need
-key preloading wrapper to be used when invoking mkimage.
+In order to set the pin in the HSM, an environment variable "MKIMAGE_SIGN_PIN"
+can be specified.
The following examples use the Nitrokey Pro using pkcs11 engine. Instructions
for other devices may vary.
diff --git a/drivers/misc/swap_case.c b/drivers/misc/swap_case.c
index 3cbc8f37ec..7093ad1cd4 100644
--- a/drivers/misc/swap_case.c
+++ b/drivers/misc/swap_case.c
@@ -302,7 +302,6 @@ static int sandbox_swap_case_write_io(struct udevice *dev, unsigned int addr,
}
static int pci_ea_bar2_magic = PCI_EA_BAR2_MAGIC;
-static int pci_ea_bar4_magic = PCI_EA_BAR4_MAGIC;
static int sandbox_swap_case_map_physmem(struct udevice *dev,
phys_addr_t addr, unsigned long *lenp, void **ptrp)
@@ -332,12 +331,22 @@ static int sandbox_swap_case_map_physmem(struct udevice *dev,
*ptrp = &pci_ea_bar2_magic;
*lenp = PCI_CAP_EA_SIZE_LO;
break;
+#ifdef CONFIG_HOST_64BIT
+ /*
+ * This cannot be work on a 32-bit machine since *lenp is ulong
+ * which is 32-bits, but it needs to have a 64-bit value
+ * assigned
+ */
case (phys_addr_t)((PCI_CAP_EA_BASE_HI4 << 32) |
- PCI_CAP_EA_BASE_LO4):
+ PCI_CAP_EA_BASE_LO4): {
+ static int pci_ea_bar4_magic = PCI_EA_BAR4_MAGIC;
+
*ptrp = &pci_ea_bar4_magic;
*lenp = (PCI_CAP_EA_SIZE_HI << 32) |
PCI_CAP_EA_SIZE_LO;
break;
+ }
+#endif
default:
return -ENOENT;
}
diff --git a/include/cpu_func.h b/include/cpu_func.h
index c3a66f0405..23cd5eca39 100644
--- a/include/cpu_func.h
+++ b/include/cpu_func.h
@@ -59,6 +59,7 @@ int dcache_status(void);
void dcache_enable(void);
void dcache_disable(void);
void mmu_disable(void);
+int mmu_status(void);
/* arch/$(ARCH)/lib/cache.c */
void enable_caches(void);
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
index f4ed11e74a..085dc89bf7 100644
--- a/lib/rsa/rsa-sign.c
+++ b/lib/rsa/rsa-sign.c
@@ -338,6 +338,7 @@ static int rsa_init(void)
static int rsa_engine_init(const char *engine_id, ENGINE **pe)
{
+ const char *key_pass;
ENGINE *e;
int ret;
@@ -362,10 +363,20 @@ static int rsa_engine_init(const char *engine_id, ENGINE **pe)
goto err_set_rsa;
}
+ key_pass = getenv("MKIMAGE_SIGN_PIN");
+ if (key_pass) {
+ if (!ENGINE_ctrl_cmd_string(e, "PIN", key_pass, 0)) {
+ fprintf(stderr, "Couldn't set PIN\n");
+ ret = -1;
+ goto err_set_pin;
+ }
+ }
+
*pe = e;
return 0;
+err_set_pin:
err_set_rsa:
ENGINE_finish(e);
err_engine_init:
@@ -473,7 +484,7 @@ static int rsa_sign_with_key(EVP_PKEY *pkey, struct padding_algo *padding_algo,
#endif
EVP_MD_CTX_destroy(context);
- debug("Got signature: %d bytes, expected %zu\n", *sig_size, size);
+ debug("Got signature: %zu bytes, expected %d\n", size, EVP_PKEY_size(pkey));
*sigp = sig;
*sig_size = size;
diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
index bb8cc61d94..3840764e42 100644
--- a/lib/rsa/rsa-verify.c
+++ b/lib/rsa/rsa-verify.c
@@ -556,7 +556,7 @@ int rsa_verify(struct image_sign_info *info,
*/
if (info->checksum->checksum_len >
info->crypto->key_len) {
- debug("%s: invlaid checksum-algorithm %s for %s\n",
+ debug("%s: invalid checksum-algorithm %s for %s\n",
__func__, info->checksum->name, info->crypto->name);
return -EINVAL;
}
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 5be1a9ba1b..25a3e7fa52 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -459,7 +459,7 @@ u-boot-spl-keep-syms-lto_c := \
quiet_cmd_keep_syms_lto = KSL $@
cmd_keep_syms_lto = \
- NM=$(NM) $(srctree)/scripts/gen_ll_addressable_symbols.sh $^ >$@
+ $(srctree)/scripts/gen_ll_addressable_symbols.sh $(NM) $^ > $@
quiet_cmd_keep_syms_lto_cc = KSLCC $@
cmd_keep_syms_lto_cc = \
diff --git a/scripts/gen_ll_addressable_symbols.sh b/scripts/gen_ll_addressable_symbols.sh
index 3978a39d97..b8840dd011 100755
--- a/scripts/gen_ll_addressable_symbols.sh
+++ b/scripts/gen_ll_addressable_symbols.sh
@@ -5,8 +5,11 @@
# Generate __ADDRESSABLE(symbol) for every linker list entry symbol, so that LTO
# does not optimize these symbols away
+# The expected parameter of this script is the command requested to have
+# the U-Boot symbols to parse, for example: $(NM) $(u-boot-main)
+
set -e
echo '#include <common.h>'
-$NM "$@" 2>/dev/null | grep -oe '_u_boot_list_2_[a-zA-Z0-9_]*_2_[a-zA-Z0-9_]*' | \
+$@ 2>/dev/null | grep -oe '_u_boot_list_2_[a-zA-Z0-9_]*_2_[a-zA-Z0-9_]*' | \
sort -u | sed -e 's/^\(.*\)/extern char \1[];\n__ADDRESSABLE(\1);/'
diff --git a/test/py/tests/test_fs/test_squashfs/sqfs_common.py b/test/py/tests/test_fs/test_squashfs/sqfs_common.py
index 267c4b57d1..8b84c2cdca 100644
--- a/test/py/tests/test_fs/test_squashfs/sqfs_common.py
+++ b/test/py/tests/test_fs/test_squashfs/sqfs_common.py
@@ -146,7 +146,7 @@ def get_mksquashfs_version():
out = subprocess.run(['mksquashfs -version'], shell=True, check=True,
capture_output=True, text=True)
# 'out' is: mksquashfs version X (yyyy/mm/dd) ...
- return float(out.stdout.split()[2])
+ return float(out.stdout.split()[2].split('-')[0])
def check_mksquashfs_version():
""" Checks if mksquashfs meets the required version. """