[PATCH 1/1] rtc: fix the description of the Goldfish RTC driver
Replace the incorrect description that was copied from another driver. Signed-off-by: Heinrich Schuchardt --- drivers/rtc/goldfish_rtc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/goldfish_rtc.c b/drivers/rtc/goldfish_rtc.c index 3231eb0daf8..e63a2766c76 100644 --- a/drivers/rtc/goldfish_rtc.c +++ b/drivers/rtc/goldfish_rtc.c @@ -2,7 +2,9 @@ /* * Copyright 2023, Heinrich Schuchardt * - * This driver emulates a real time clock based on timer ticks. + * This driver supports the Google Goldfish virtual platform RTC device. + * The device is provided by the RISC-V virt machine in QEMU. It exposes + * a 64-bit nanosecond timer via two memory-mapped 32-bit registers. */ #include -- 2.45.2
[PATCH v2 4/4] include: env: ti_common: Remove findfdt
From: Dhruva Gole findfdt is the legacy approach to find fdt and platforms have moved away from this and don't define this anymore. This causes an error that may seem alarming but is harmless. Remove it from the bootcmd_ti_mmc to avoid any panic and confusion. Signed-off-by: Dhruva Gole Signed-off-by: Manorit Chawdhry --- include/env/ti/ti_common.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/env/ti/ti_common.env b/include/env/ti/ti_common.env index c5c36421770c..7029d12bf203 100644 --- a/include/env/ti/ti_common.env +++ b/include/env/ti/ti_common.env @@ -25,7 +25,7 @@ get_fit_config=setexpr name_fit_config gsub / _ conf-${fdtfile} run_fit=run get_fit_config; bootm ${addr_fit}#${name_fit_config}${overlaystring} do_main_cpsw0_qsgmii_phyinit=0 bootcmd_ti_mmc= - run findfdt; run init_${boot}; + run init_${boot}; #if CONFIG_CMD_REMOTEPROC if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1; then run main_cpsw0_qsgmii_phyinit; -- 2.45.1
[PATCH v2 3/4] configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT
This is called to set fdtfile after the board is initialized. Signed-off-by: Manorit Chawdhry --- configs/am62px_evm_a53_defconfig | 1 + configs/j722s_evm_a53_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig index e1c9c8535e43..87005d03dee3 100644 --- a/configs/am62px_evm_a53_defconfig +++ b/configs/am62px_evm_a53_defconfig @@ -33,6 +33,7 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100 CONFIG_BOOTSTD_FULL=y CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" +CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_PAD_TO=0x0 CONFIG_SPL_SYS_MALLOC_SIMPLE=y diff --git a/configs/j722s_evm_a53_defconfig b/configs/j722s_evm_a53_defconfig index da0e9f4d524d..1675cedb25ef 100644 --- a/configs/j722s_evm_a53_defconfig +++ b/configs/j722s_evm_a53_defconfig @@ -33,6 +33,7 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100 CONFIG_BOOTSTD_FULL=y CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" +CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_PAD_TO=0x0 CONFIG_SPL_SYS_MALLOC_SIMPLE=y -- 2.45.1
[PATCH v2 2/4] board: ti: am62p|j722s: Add ti_set_fdt_env for fdtfile
stdboot and legacy boot now depend on fdtfile and fdtfile is populated based on evm code now. Populate fdtfile by calling ti_set_fdt_env in board files. Signed-off-by: Manorit Chawdhry --- board/ti/am62px/evm.c | 9 + board/ti/j722s/evm.c | 9 + 2 files changed, 18 insertions(+) diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c index 1a2c46c462b4..7362fa4520a3 100644 --- a/board/ti/am62px/evm.c +++ b/board/ti/am62px/evm.c @@ -13,6 +13,7 @@ #include #include #include +#include "../common/fdt_ops.h" struct efi_fw_image fw_images[] = { { @@ -61,3 +62,11 @@ int dram_init_banksize(void) { return fdtdec_setup_memory_banksize(); } + +#if IS_ENABLED(CONFIG_BOARD_LATE_INIT) +int board_late_init(void) +{ + ti_set_fdt_env(NULL, NULL); + return 0; +} +#endif diff --git a/board/ti/j722s/evm.c b/board/ti/j722s/evm.c index 515aaa818783..29e06a5442fe 100644 --- a/board/ti/j722s/evm.c +++ b/board/ti/j722s/evm.c @@ -12,6 +12,7 @@ #include #include #include +#include "../common/fdt_ops.h" int board_init(void) { @@ -27,3 +28,11 @@ int dram_init_banksize(void) { return fdtdec_setup_memory_banksize(); } + +#if IS_ENABLED(CONFIG_BOARD_LATE_INIT) +int board_late_init(void) +{ + ti_set_fdt_env(NULL, NULL); + return 0; +} +#endif -- 2.45.1
[PATCH v2 1/4] include: env: ti: mmc: Change name_fdt usage to fdtfile
name_fdt is kept for backward compatibility but it depends on EEPROM detection logic and some of the platforms like J7AHP/AM69 don't have that anymore which causes boot failure. Replacing name_fdt usage to fdtfile as fdtfile is populated based on CONFIG_DEFAULT_DEVICE_TREE. Signed-off-by: Manorit Chawdhry --- include/env/ti/mmc.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env index 0256a2d2aaca..037a09010ce4 100644 --- a/include/env/ti/mmc.env +++ b/include/env/ti/mmc.env @@ -16,7 +16,7 @@ importbootenv=echo Importing environment from mmc${mmcdev} ...; loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile} loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile} loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile} -get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt} +get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile} envboot=if mmc dev ${mmcdev}; then if mmc rescan; then echo SD/MMC found on device ${mmcdev}; -- 2.45.1
[PATCH v2 0/4] Fix fdtfile for j722s and am62p
fdtfile wasn't being populated in these boards, add the code in evm.c for the same. Signed-off-by: Manorit Chawdhry --- Changes in v2: - Replace findfdt with fdtfile as that is what the series fixes. (Nishanth) - Drop findfdt as well for K3 platforms legacy support - Link to v1: https://lore.kernel.org/r/20240628-b4-upstream-streamline-platform-v1-0-17659af99...@ti.com --- Dhruva Gole (1): include: env: ti_common: Remove findfdt Manorit Chawdhry (3): include: env: ti: mmc: Change name_fdt usage to fdtfile board: ti: am62p|j722s: Add ti_set_fdt_env for fdtfile configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT board/ti/am62px/evm.c| 9 + board/ti/j722s/evm.c | 9 + configs/am62px_evm_a53_defconfig | 1 + configs/j722s_evm_a53_defconfig | 1 + include/env/ti/mmc.env | 2 +- include/env/ti/ti_common.env | 2 +- 6 files changed, 22 insertions(+), 2 deletions(-) --- base-commit: 899b088674b6905710ce546f0a8848662904852a change-id: 20240628-b4-upstream-streamline-platform-f0d7453637b2 Best regards, -- Manorit Chawdhry
Re: [PATCH 1/3] include: env: ti: mmc: Change name_fdt usage to fdtfile
Hi Nishanth, On 08:05-20240628, Nishanth Menon wrote: > On 13:53-20240628, Manorit Chawdhry wrote: > > name_fdt is kept for backward compatibility but it depends on EEPROM > > detection logic and some of the platforms like J7AHP/AM69 don't have > > that anymore which causes boot failure. > > > > Replacing name_fdt usage to fdtfile as fdtfile is populated based on > > CONFIG_DEFAULT_DEVICE_TREE. > > > > Signed-off-by: Manorit Chawdhry > > --- > > include/env/ti/mmc.env | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env > > index 0256a2d2aaca..037a09010ce4 100644 > > --- a/include/env/ti/mmc.env > > +++ b/include/env/ti/mmc.env > > @@ -16,7 +16,7 @@ importbootenv=echo Importing environment from > > mmc${mmcdev} ...; > > loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile} > > loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile} > > loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile} > > -get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt} > > +get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile} > > Did you check the other users of mmc.env file? How about legacy boards like > k2g? Am not sure about the status of migration to ti_set_fdt_env for k2g platforms. Though I see k2g redefining get_fdt_mmc with name_fdt itself so hoping that this change wouldn't affect them. If they also migrate to ti_set_fdt_env then I think for them also this change would work and the override can be deleted later. Regards, Manorit > > > envboot=if mmc dev ${mmcdev}; then > > if mmc rescan; then > > echo SD/MMC found on device ${mmcdev}; > > > > -- > > 2.45.1 > > > > -- > Regards, > Nishanth Menon > Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 > 849D 1736 249D
Re: [PATCH 0/3] Fix findfdt for j722s and am62p
Hi Nishanth, On 08:06-20240628, Nishanth Menon wrote: > On 13:53-20240628, Manorit Chawdhry wrote: > > findfdt wasn't being populated in these boards, add the code in evm.c > > for the same. > > why not just drop findfdt? I am ok with #2,3 more or less, but keeping typo... should've written fdtfile. When all the boards migrate to your series for pulling in fdtfile from ti_set_fdt_env itself, I think findfdt can be dropped for k3 boards at that point. This series moves am62px and j722s to that. Regards, Manorit > findfdt alive is just a bad direction when we are moving to stdboot > flow. > > > > > > Signed-off-by: Manorit Chawdhry > > --- > > Manorit Chawdhry (3): > > include: env: ti: mmc: Change name_fdt usage to fdtfile > > board: ti: am62p|j722s: Add ti_set_fdt_env for findfdt > > configs: am62p|j722s_a53: Add CONFIG_BOARD_LATE_INIT > > > > board/ti/am62px/evm.c| 9 + > > board/ti/j722s/evm.c | 9 + > > configs/am62px_evm_a53_defconfig | 1 + > > configs/j722s_evm_a53_defconfig | 1 + > > include/env/ti/mmc.env | 2 +- > > 5 files changed, 21 insertions(+), 1 deletion(-) > > --- > > base-commit: 899b088674b6905710ce546f0a8848662904852a > > change-id: 20240628-b4-upstream-streamline-platform-f0d7453637b2 > > > > Best regards, > > -- > > Manorit Chawdhry > > > > -- > Regards, > Nishanth Menon > Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 > 849D 1736 249D
Re: [NEXT] Pull request efi-2024-10-rc1
On Sun, Jun 30, 2024 at 03:21:07PM +0200, Heinrich Schuchardt wrote: > Dear Tom, > > The following changes since commit 899b088674b6905710ce546f0a8848662904852a: > > Merge patch series "pxe: Add debugging for booting" (2024-06-26 > 13:17:52 -0600) > > are available in the Git repository at: > > https://source.denx.de/u-boot/custodians/u-boot-efi.git > tags/efi-2024-10-rc1 > > for you to fetch changes up to 636480e4e7088d05d7ff77af72ca00443c62b3e9: > > doc: develop: Add a general section on gdb usage (2024-06-30 13:58:31 > +0200) > Gitlab CI showed no issues: > https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/21383 > Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH] zlib: Fix big performance regression
On Sun, Jun 30, 2024 at 08:49:08PM +0200, Christophe Leroy wrote: > > > Le 30/06/2024 à 20:28, Christophe Leroy a écrit : > > > > > > Le 30/06/2024 à 16:54, Tom Rini a écrit : > > > On Sun, Jun 30, 2024 at 10:47:06AM +0200, Christophe Leroy wrote: > > > > > > > > > > > > Le 27/06/2024 à 21:40, Tom Rini a écrit : > > > > > On Thu, Jun 27, 2024 at 01:34:55PM -0600, Tom Rini wrote: > > > > > > On Thu, Jun 27, 2024 at 10:25:21AM +0200, Christophe Leroy wrote: > > > > > > > > > > > > > Commit 340fdf1303dc ("zlib: Port fix for CVE-2016-9841 to U-Boot") > > > > > > > brings a big performance regression in inflate_fast(), which leads > > > > > > > to watchdog timer reset on powerpc 8xx. > > > > > > > > > > > > > > It looks like that commit does more than what it describe, it > > > > > > > especially removed an important optimisation that was doing copies > > > > > > > using halfwords instead of bytes. That unexpected change > > > > > > > multiplied > > > > > > > by almost 4 the time spent in inflate_fast() and increased by 40% > > > > > > > the overall time needed to uncompress linux kernel image. > > > > > > > > > > > > > > So partially revert that commit but keep post incrementation as it > > > > > > > is the initial purpose of said commit. > > > > > > > > > > > > > > Fixes: 340fdf1303dc ("zlib: Port fix for CVE-2016-9841 to U-Boot") > > > > > > > Signed-off-by: Christophe Leroy > > > > > > > --- > > > > > > > lib/zlib/inffast.c | 51 > > > > > > > -- > > > > > > > 1 file changed, 40 insertions(+), 11 deletions(-) > > > > > > > > > > > > Both this, and my mostly revert lead to CI failures around > > > > > > compression > > > > > > tests: > > > > > > https://source.denx.de/u-boot/u-boot/-/jobs/859329 > > > > > > > > > > A full revert however, is fine. > > > > > > > > > > > > > Is it that ? : > > > > > > > > FAILED > > > > test/py/tests/test_ut.py::test_ut[ut_compression_compression_test_gzip] > > > > > > > > It seems like when the optimisation was added by commit > > > > cd514aeb996e ("zlib: > > > > Optimize decompression"), only the pre-increment implementation was > > > > available. > > > > > > > > When POSTINC was added by commit e89516f031db ("zlib: split up to match > > > > original source tree"), I guess it was not verified because POSTINC is > > > > #undef by zlib.h. > > > > > > > > With the following change I don't get the FAILED > > > > ut_compression_compression_test_gzip CI anymore > > > > (https://source.denx.de/u-boot/custodians/u-boot-mpc8xx/-/jobs/859937) > > > > > > > > diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c > > > > index c271d85ea1..5dc0574202 100644 > > > > --- a/lib/zlib/inffast.c > > > > +++ b/lib/zlib/inffast.c > > > > @@ -257,7 +257,7 @@ void inflate_fast(z_streamp strm, unsigned start) > > > > sfrom = (unsigned short *)(from - OFF); > > > > loops = len >> 1; > > > > do > > > > - PUP(sout) = get_unaligned(++sfrom); > > > > + PUP(sout) = get_unaligned(sfrom++); > > > > while (--loops); > > > > out = (unsigned char *)sout + OFF; > > > > from = (unsigned char *)sfrom + OFF; > > > > > > Ah, thanks! Testing again now. > > > > > > > That's probably not enough. I thought other failures were unrelated but > > I gave it a try with a full revert and I get no failure at all with that > > so there must be other things. > > > > I find that pat16 = *(sout-2+2*OFF) suspicious, sout being a short it > > means -4 bytes which is not what is expected I think. > > That's it. I get all green with the following, see > https://source.denx.de/u-boot/custodians/u-boot-mpc8xx/-/pipelines/21391 > > diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c > index c271d85ea1..69268caee8 100644 > --- a/lib/zlib/inffast.c > +++ b/lib/zlib/inffast.c > @@ -257,14 +257,14 @@ void inflate_fast(z_streamp strm, unsigned start) > sfrom = (unsigned short *)(from - OFF); > loops = len >> 1; > do > - PUP(sout) = get_unaligned(++sfrom); > + PUP(sout) = get_unaligned(sfrom++); > while (--loops); > out = (unsigned char *)sout + OFF; > from = (unsigned char *)sfrom + OFF; > } else { /* dist == 1 or dist == 2 */ > unsigned short pat16; > > - pat16 = *(sout-2+2*OFF); > + pat16 = *(sout-1+OFF); > if (dist == 1) > #if defined(__BIG_ENDIAN) > pat16 = (pat16 & 0xff) | ((pat16 & 0xff ) << 8); > OK, so at this point we're changing a lot of common paths, to things that haven't been tested before. I suspect it's all fine, but for the release on July 1 I'm
Re: [PATCH] ext4: Improve feature checking
On 6/30/24 20:23, Sean Anderson wrote: On 6/30/24 17:25, Richard Weinberger wrote: Evaluate the filesystem incompat and ro_compat bit fields to judge whether the filesystem can be read or written. For the read side only a scary warning is shown so far. I'd love to about mounting too, but I fear this will break some setups I think you are missing a verb in the first half of your sentence where the driver works by chance. Signed-off-by: Richard Weinberger --- After facing ext4 write corruptions and read errors I checked the ext4 implementation briefly. Hopefully this patch helps other users to detect earlier that they're using ext4 features which are not supported by u-boot. To make feature checking possible I had to figure what this implementation actually supports. I hope I got them right, feedback is welcome! Thanks, //richard --- fs/ext4/ext4_common.c | 8 +++ fs/ext4/ext4_write.c | 12 -- include/ext4fs.h | 55 ++- 3 files changed, 72 insertions(+), 3 deletions(-) diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index 2ff0dca249..7148d35ee0 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -2386,6 +2386,14 @@ int ext4fs_mount(void) fs->inodesz = 128; fs->gdsize = 32; } else { + int missing = __le32_to_cpu(data->sblock.feature_incompat) & \ + ~(EXT4_FEATURE_INCOMPAT_SUPP | \ + EXT4_FEATURE_INCOMPAT_SUPP_LAZY_RO); + + if (missing) + log_err("fs uses incompatible features: %08x, failures *are* expected!\n", + missing); + I think it is a bit unclear to the user what their action should be. Maybe something like printf("EXT4 incompatible features: %08x, ignoring...\n") and then maybe add a comment like what you have in the commit message. or maybe even printf("EXT4 incompatible features: %08x, mounting read-only...\n") debug("EXT4 features COMPAT: %08x INCOMPAT: %08x RO_COMPAT: %08x\n", __le32_to_cpu(data->sblock.feature_compatibility), __le32_to_cpu(data->sblock.feature_incompat), diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c index d057f6b5a7..4aae3c5f7f 100644 --- a/fs/ext4/ext4_write.c +++ b/fs/ext4/ext4_write.c @@ -869,6 +869,7 @@ int ext4fs_write(const char *fname, const char *buffer, ALLOC_CACHE_ALIGN_BUFFER(char, filename, 256); bool store_link_in_inode = false; memset(filename, 0x00, 256); + int missing_feat; if (type != FILETYPE_REG && type != FILETYPE_SYMLINK) return -1; @@ -882,8 +883,15 @@ int ext4fs_write(const char *fname, const char *buffer, return -1; } - if (le32_to_cpu(fs->sb->feature_ro_compat) & EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) { - printf("Unsupported feature metadata_csum found, not writing.\n"); + missing_feat = le32_to_cpu(fs->sb->feature_incompat) & ~EXT4_FEATURE_INCOMPAT_SUPP; + if (missing_feat) { + log_err("Unsupported features found %08x, not writing.\n", missing_feat); + return -1; + } + + missing_feat = le32_to_cpu(fs->sb->feature_ro_compat) & ~EXT4_FEATURE_RO_COMPAT_SUPP; + if (missing_feat) { + log_err("Unsupported RO compat features found %08x, not writing.\n", missing_feat); return -1; } diff --git a/include/ext4fs.h b/include/ext4fs.h index d96edfd057..01b66f469f 100644 --- a/include/ext4fs.h +++ b/include/ext4fs.h @@ -34,12 +34,65 @@ struct disk_partition; #define EXT4_TOPDIR_FL 0x0002 /* Top of directory hierarchies*/ #define EXT4_EXTENTS_FL 0x0008 /* Inode uses extents */ #define EXT4_EXT_MAGIC 0xf30a -#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 + +#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 +#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 +#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 +#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 +#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 +#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 +#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 +#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100 +#define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200 #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400 + +#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 +#define EXTE_FEATURE_INCOMPAT_RECOVER 0x0004 #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 +#define EXT4_FEATURE_INCOMPAT_MMP 0x0100 +#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 +#define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000 +#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x1 + #define EXT4_INDIRECT_BLOCKS 12 +/* + * Incompat features supported by this implementation. + */ +#define EXT4_FEATURE_INCOMPAT_SUPP ( EXT4_FEATURE_INCOMPAT_FILETYPE \ + | EXTE_FEATURE_INCOMPAT_RECOVER \ EXT4 + | EXT4_FEATURE_INCOMPAT_EXTENTS \ +
Re: [PATCH] ext4: Improve feature checking
On 6/30/24 17:25, Richard Weinberger wrote: Evaluate the filesystem incompat and ro_compat bit fields to judge whether the filesystem can be read or written. For the read side only a scary warning is shown so far. I'd love to about mounting too, but I fear this will break some setups I think you are missing a verb in the first half of your sentence where the driver works by chance. Signed-off-by: Richard Weinberger --- After facing ext4 write corruptions and read errors I checked the ext4 implementation briefly. Hopefully this patch helps other users to detect earlier that they're using ext4 features which are not supported by u-boot. To make feature checking possible I had to figure what this implementation actually supports. I hope I got them right, feedback is welcome! Thanks, //richard --- fs/ext4/ext4_common.c | 8 +++ fs/ext4/ext4_write.c | 12 -- include/ext4fs.h | 55 ++- 3 files changed, 72 insertions(+), 3 deletions(-) diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index 2ff0dca249..7148d35ee0 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -2386,6 +2386,14 @@ int ext4fs_mount(void) fs->inodesz = 128; fs->gdsize = 32; } else { + int missing = __le32_to_cpu(data->sblock.feature_incompat) & \ + ~(EXT4_FEATURE_INCOMPAT_SUPP | \ + EXT4_FEATURE_INCOMPAT_SUPP_LAZY_RO); + + if (missing) + log_err("fs uses incompatible features: %08x, failures *are* expected!\n", + missing); + I think it is a bit unclear to the user what their action should be. Maybe something like printf("EXT4 incompatible features: %08x, ignoring...\n") and then maybe add a comment like what you have in the commit message. debug("EXT4 features COMPAT: %08x INCOMPAT: %08x RO_COMPAT: %08x\n", __le32_to_cpu(data->sblock.feature_compatibility), __le32_to_cpu(data->sblock.feature_incompat), diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c index d057f6b5a7..4aae3c5f7f 100644 --- a/fs/ext4/ext4_write.c +++ b/fs/ext4/ext4_write.c @@ -869,6 +869,7 @@ int ext4fs_write(const char *fname, const char *buffer, ALLOC_CACHE_ALIGN_BUFFER(char, filename, 256); bool store_link_in_inode = false; memset(filename, 0x00, 256); + int missing_feat; if (type != FILETYPE_REG && type != FILETYPE_SYMLINK) return -1; @@ -882,8 +883,15 @@ int ext4fs_write(const char *fname, const char *buffer, return -1; } - if (le32_to_cpu(fs->sb->feature_ro_compat) & EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) { - printf("Unsupported feature metadata_csum found, not writing.\n"); + missing_feat = le32_to_cpu(fs->sb->feature_incompat) & ~EXT4_FEATURE_INCOMPAT_SUPP; + if (missing_feat) { + log_err("Unsupported features found %08x, not writing.\n", missing_feat); + return -1; + } + + missing_feat = le32_to_cpu(fs->sb->feature_ro_compat) & ~EXT4_FEATURE_RO_COMPAT_SUPP; + if (missing_feat) { + log_err("Unsupported RO compat features found %08x, not writing.\n", missing_feat); return -1; } diff --git a/include/ext4fs.h b/include/ext4fs.h index d96edfd057..01b66f469f 100644 --- a/include/ext4fs.h +++ b/include/ext4fs.h @@ -34,12 +34,65 @@ struct disk_partition; #define EXT4_TOPDIR_FL0x0002 /* Top of directory hierarchies*/ #define EXT4_EXTENTS_FL 0x0008 /* Inode uses extents */ #define EXT4_EXT_MAGIC0xf30a -#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM0x0010 + +#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 +#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE0x0002 +#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 +#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 +#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 +#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 +#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 +#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100 +#define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200 #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400 + +#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 +#define EXTE_FEATURE_INCOMPAT_RECOVER 0x0004 #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 +#define EXT4_FEATURE_INCOMPAT_MMP 0x0100 +#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 +#define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000 +#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x1 + #define EXT4_INDIRECT_BLOCKS 12 +/* + * Incompat features supported by this implementation. + */ +#define EXT4_FEATURE_INCOMPAT_SUPP ( EXT4_FEATURE_INCOMPAT_FILETYPE \ +
[PATCH] ext4: Improve feature checking
Evaluate the filesystem incompat and ro_compat bit fields to judge whether the filesystem can be read or written. For the read side only a scary warning is shown so far. I'd love to about mounting too, but I fear this will break some setups where the driver works by chance. Signed-off-by: Richard Weinberger --- After facing ext4 write corruptions and read errors I checked the ext4 implementation briefly. Hopefully this patch helps other users to detect earlier that they're using ext4 features which are not supported by u-boot. To make feature checking possible I had to figure what this implementation actually supports. I hope I got them right, feedback is welcome! Thanks, //richard --- fs/ext4/ext4_common.c | 8 +++ fs/ext4/ext4_write.c | 12 -- include/ext4fs.h | 55 ++- 3 files changed, 72 insertions(+), 3 deletions(-) diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index 2ff0dca249..7148d35ee0 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -2386,6 +2386,14 @@ int ext4fs_mount(void) fs->inodesz = 128; fs->gdsize = 32; } else { + int missing = __le32_to_cpu(data->sblock.feature_incompat) & \ + ~(EXT4_FEATURE_INCOMPAT_SUPP | \ + EXT4_FEATURE_INCOMPAT_SUPP_LAZY_RO); + + if (missing) + log_err("fs uses incompatible features: %08x, failures *are* expected!\n", + missing); + debug("EXT4 features COMPAT: %08x INCOMPAT: %08x RO_COMPAT: %08x\n", __le32_to_cpu(data->sblock.feature_compatibility), __le32_to_cpu(data->sblock.feature_incompat), diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c index d057f6b5a7..4aae3c5f7f 100644 --- a/fs/ext4/ext4_write.c +++ b/fs/ext4/ext4_write.c @@ -869,6 +869,7 @@ int ext4fs_write(const char *fname, const char *buffer, ALLOC_CACHE_ALIGN_BUFFER(char, filename, 256); bool store_link_in_inode = false; memset(filename, 0x00, 256); + int missing_feat; if (type != FILETYPE_REG && type != FILETYPE_SYMLINK) return -1; @@ -882,8 +883,15 @@ int ext4fs_write(const char *fname, const char *buffer, return -1; } - if (le32_to_cpu(fs->sb->feature_ro_compat) & EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) { - printf("Unsupported feature metadata_csum found, not writing.\n"); + missing_feat = le32_to_cpu(fs->sb->feature_incompat) & ~EXT4_FEATURE_INCOMPAT_SUPP; + if (missing_feat) { + log_err("Unsupported features found %08x, not writing.\n", missing_feat); + return -1; + } + + missing_feat = le32_to_cpu(fs->sb->feature_ro_compat) & ~EXT4_FEATURE_RO_COMPAT_SUPP; + if (missing_feat) { + log_err("Unsupported RO compat features found %08x, not writing.\n", missing_feat); return -1; } diff --git a/include/ext4fs.h b/include/ext4fs.h index d96edfd057..01b66f469f 100644 --- a/include/ext4fs.h +++ b/include/ext4fs.h @@ -34,12 +34,65 @@ struct disk_partition; #define EXT4_TOPDIR_FL 0x0002 /* Top of directory hierarchies*/ #define EXT4_EXTENTS_FL0x0008 /* Inode uses extents */ #define EXT4_EXT_MAGIC 0xf30a -#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM0x0010 + +#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 +#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE0x0002 +#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 +#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 +#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 +#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 +#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 +#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100 +#define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200 #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400 + +#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 +#define EXTE_FEATURE_INCOMPAT_RECOVER 0x0004 #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 #define EXT4_FEATURE_INCOMPAT_64BIT0x0080 +#define EXT4_FEATURE_INCOMPAT_MMP 0x0100 +#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 +#define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000 +#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x1 + #define EXT4_INDIRECT_BLOCKS 12 +/* + * Incompat features supported by this implementation. + */ +#define EXT4_FEATURE_INCOMPAT_SUPP ( EXT4_FEATURE_INCOMPAT_FILETYPE \ + | EXTE_FEATURE_INCOMPAT_RECOVER \ + | EXT4_FEATURE_INCOMPAT_EXTENTS \ + | EXT4_FEATURE_INCOMPAT_64BIT \ + | EXT4_FEATURE_INCOMPAT_FLEX_BG \ + ) + +/* + * Incompat features supported by this implementation only in a lazy + * way,
Re: [PATCH] zlib: Fix big performance regression
Le 30/06/2024 à 20:28, Christophe Leroy a écrit : Le 30/06/2024 à 16:54, Tom Rini a écrit : On Sun, Jun 30, 2024 at 10:47:06AM +0200, Christophe Leroy wrote: Le 27/06/2024 à 21:40, Tom Rini a écrit : On Thu, Jun 27, 2024 at 01:34:55PM -0600, Tom Rini wrote: On Thu, Jun 27, 2024 at 10:25:21AM +0200, Christophe Leroy wrote: Commit 340fdf1303dc ("zlib: Port fix for CVE-2016-9841 to U-Boot") brings a big performance regression in inflate_fast(), which leads to watchdog timer reset on powerpc 8xx. It looks like that commit does more than what it describe, it especially removed an important optimisation that was doing copies using halfwords instead of bytes. That unexpected change multiplied by almost 4 the time spent in inflate_fast() and increased by 40% the overall time needed to uncompress linux kernel image. So partially revert that commit but keep post incrementation as it is the initial purpose of said commit. Fixes: 340fdf1303dc ("zlib: Port fix for CVE-2016-9841 to U-Boot") Signed-off-by: Christophe Leroy --- lib/zlib/inffast.c | 51 -- 1 file changed, 40 insertions(+), 11 deletions(-) Both this, and my mostly revert lead to CI failures around compression tests: https://source.denx.de/u-boot/u-boot/-/jobs/859329 A full revert however, is fine. Is it that ? : FAILED test/py/tests/test_ut.py::test_ut[ut_compression_compression_test_gzip] It seems like when the optimisation was added by commit cd514aeb996e ("zlib: Optimize decompression"), only the pre-increment implementation was available. When POSTINC was added by commit e89516f031db ("zlib: split up to match original source tree"), I guess it was not verified because POSTINC is #undef by zlib.h. With the following change I don't get the FAILED ut_compression_compression_test_gzip CI anymore (https://source.denx.de/u-boot/custodians/u-boot-mpc8xx/-/jobs/859937) diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c index c271d85ea1..5dc0574202 100644 --- a/lib/zlib/inffast.c +++ b/lib/zlib/inffast.c @@ -257,7 +257,7 @@ void inflate_fast(z_streamp strm, unsigned start) sfrom = (unsigned short *)(from - OFF); loops = len >> 1; do - PUP(sout) = get_unaligned(++sfrom); + PUP(sout) = get_unaligned(sfrom++); while (--loops); out = (unsigned char *)sout + OFF; from = (unsigned char *)sfrom + OFF; Ah, thanks! Testing again now. That's probably not enough. I thought other failures were unrelated but I gave it a try with a full revert and I get no failure at all with that so there must be other things. I find that pat16 = *(sout-2+2*OFF) suspicious, sout being a short it means -4 bytes which is not what is expected I think. That's it. I get all green with the following, see https://source.denx.de/u-boot/custodians/u-boot-mpc8xx/-/pipelines/21391 diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c index c271d85ea1..69268caee8 100644 --- a/lib/zlib/inffast.c +++ b/lib/zlib/inffast.c @@ -257,14 +257,14 @@ void inflate_fast(z_streamp strm, unsigned start) sfrom = (unsigned short *)(from - OFF); loops = len >> 1; do - PUP(sout) = get_unaligned(++sfrom); + PUP(sout) = get_unaligned(sfrom++); while (--loops); out = (unsigned char *)sout + OFF; from = (unsigned char *)sfrom + OFF; } else { /* dist == 1 or dist == 2 */ unsigned short pat16; - pat16 = *(sout-2+2*OFF); + pat16 = *(sout-1+OFF); if (dist == 1) #if defined(__BIG_ENDIAN) pat16 = (pat16 & 0xff) | ((pat16 & 0xff ) << 8); Christophe
Re: [PATCH] zlib: Fix big performance regression
Le 30/06/2024 à 16:54, Tom Rini a écrit : On Sun, Jun 30, 2024 at 10:47:06AM +0200, Christophe Leroy wrote: Le 27/06/2024 à 21:40, Tom Rini a écrit : On Thu, Jun 27, 2024 at 01:34:55PM -0600, Tom Rini wrote: On Thu, Jun 27, 2024 at 10:25:21AM +0200, Christophe Leroy wrote: Commit 340fdf1303dc ("zlib: Port fix for CVE-2016-9841 to U-Boot") brings a big performance regression in inflate_fast(), which leads to watchdog timer reset on powerpc 8xx. It looks like that commit does more than what it describe, it especially removed an important optimisation that was doing copies using halfwords instead of bytes. That unexpected change multiplied by almost 4 the time spent in inflate_fast() and increased by 40% the overall time needed to uncompress linux kernel image. So partially revert that commit but keep post incrementation as it is the initial purpose of said commit. Fixes: 340fdf1303dc ("zlib: Port fix for CVE-2016-9841 to U-Boot") Signed-off-by: Christophe Leroy --- lib/zlib/inffast.c | 51 -- 1 file changed, 40 insertions(+), 11 deletions(-) Both this, and my mostly revert lead to CI failures around compression tests: https://source.denx.de/u-boot/u-boot/-/jobs/859329 A full revert however, is fine. Is it that ? : FAILED test/py/tests/test_ut.py::test_ut[ut_compression_compression_test_gzip] It seems like when the optimisation was added by commit cd514aeb996e ("zlib: Optimize decompression"), only the pre-increment implementation was available. When POSTINC was added by commit e89516f031db ("zlib: split up to match original source tree"), I guess it was not verified because POSTINC is #undef by zlib.h. With the following change I don't get the FAILED ut_compression_compression_test_gzip CI anymore (https://source.denx.de/u-boot/custodians/u-boot-mpc8xx/-/jobs/859937) diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c index c271d85ea1..5dc0574202 100644 --- a/lib/zlib/inffast.c +++ b/lib/zlib/inffast.c @@ -257,7 +257,7 @@ void inflate_fast(z_streamp strm, unsigned start) sfrom = (unsigned short *)(from - OFF); loops = len >> 1; do - PUP(sout) = get_unaligned(++sfrom); + PUP(sout) = get_unaligned(sfrom++); while (--loops); out = (unsigned char *)sout + OFF; from = (unsigned char *)sfrom + OFF; Ah, thanks! Testing again now. That's probably not enough. I thought other failures were unrelated but I gave it a try with a full revert and I get no failure at all with that so there must be other things. I find that pat16 = *(sout-2+2*OFF) suspicious, sout being a short it means -4 bytes which is not what is expected I think.
Re: [PATCH 1/3] pxe: Add debugging for booting
On Sat, Jun 29, 2024 at 07:56:00AM +0100, Simon Glass wrote: > Hi Tom, > > On Thu, 27 Jun 2024 at 02:19, Tom Rini wrote: > > > > On Wed, 19 Jun 2024 06:34:50 -0600, Simon Glass wrote: > > > > > Show which boot protocol is being used. > > > > > > > > > > Applied to u-boot/next, thanks! > > I wonder if this could go to -master since it is an important bugfix? > > https://patchwork.ozlabs.org/project/uboot/list/?series=411595&state=* It doesn't apply to master and v2024.04 was also seemingly broken. I think it's clear enough that it can be cherry-picked in places as needed. -- Tom signature.asc Description: PGP signature
Re: [PATCH] zlib: Fix big performance regression
On Sun, Jun 30, 2024 at 10:47:06AM +0200, Christophe Leroy wrote: > > > Le 27/06/2024 à 21:40, Tom Rini a écrit : > > On Thu, Jun 27, 2024 at 01:34:55PM -0600, Tom Rini wrote: > > > On Thu, Jun 27, 2024 at 10:25:21AM +0200, Christophe Leroy wrote: > > > > > > > Commit 340fdf1303dc ("zlib: Port fix for CVE-2016-9841 to U-Boot") > > > > brings a big performance regression in inflate_fast(), which leads > > > > to watchdog timer reset on powerpc 8xx. > > > > > > > > It looks like that commit does more than what it describe, it > > > > especially removed an important optimisation that was doing copies > > > > using halfwords instead of bytes. That unexpected change multiplied > > > > by almost 4 the time spent in inflate_fast() and increased by 40% > > > > the overall time needed to uncompress linux kernel image. > > > > > > > > So partially revert that commit but keep post incrementation as it > > > > is the initial purpose of said commit. > > > > > > > > Fixes: 340fdf1303dc ("zlib: Port fix for CVE-2016-9841 to U-Boot") > > > > Signed-off-by: Christophe Leroy > > > > --- > > > > lib/zlib/inffast.c | 51 -- > > > > 1 file changed, 40 insertions(+), 11 deletions(-) > > > > > > Both this, and my mostly revert lead to CI failures around compression > > > tests: > > > https://source.denx.de/u-boot/u-boot/-/jobs/859329 > > > > A full revert however, is fine. > > > > Is it that ? : > > FAILED > test/py/tests/test_ut.py::test_ut[ut_compression_compression_test_gzip] > > It seems like when the optimisation was added by commit cd514aeb996e ("zlib: > Optimize decompression"), only the pre-increment implementation was > available. > > When POSTINC was added by commit e89516f031db ("zlib: split up to match > original source tree"), I guess it was not verified because POSTINC is > #undef by zlib.h. > > With the following change I don't get the FAILED > ut_compression_compression_test_gzip CI anymore > (https://source.denx.de/u-boot/custodians/u-boot-mpc8xx/-/jobs/859937) > > diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c > index c271d85ea1..5dc0574202 100644 > --- a/lib/zlib/inffast.c > +++ b/lib/zlib/inffast.c > @@ -257,7 +257,7 @@ void inflate_fast(z_streamp strm, unsigned start) > sfrom = (unsigned short *)(from - OFF); > loops = len >> 1; > do > - PUP(sout) = get_unaligned(++sfrom); > + PUP(sout) = get_unaligned(sfrom++); > while (--loops); > out = (unsigned char *)sout + OFF; > from = (unsigned char *)sfrom + OFF; Ah, thanks! Testing again now. -- Tom signature.asc Description: PGP signature
Re: [PATCH v7 0/4] automatically add /chosen/kaslr-seed and deduplicate code
On Tue, 18 Jun 2024 14:06:05 -0700, Tim Harvey wrote: > This series will automatically add /chosen/kaslr-seed to the dt if > DM_RNG is enabled > during the boot process. > > If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to > randomize the virtual address at which the kernel image is loaded, it > expects entropy to be provided by the bootloader by populating > /chosen/kaslr-seed with a 64-bit value from source of entropy at boot. > > [...] Applied to u-boot/next, thanks! -- Tom
[PATCH v3] doc: add bootelf command documentation
Signed-off-by: Maxim Moskalets --- v3: Separate -p -s into different lines. v2: Add Configuration section. --- doc/usage/cmd/bootelf.rst | 61 +++ 1 file changed, 61 insertions(+) create mode 100644 doc/usage/cmd/bootelf.rst diff --git a/doc/usage/cmd/bootelf.rst b/doc/usage/cmd/bootelf.rst new file mode 100644 index 00..8bae31ef1f --- /dev/null +++ b/doc/usage/cmd/bootelf.rst @@ -0,0 +1,61 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright 2024, Maxim Moskalets + +.. index:: + single: bootelf (command) + +bootelf command +=== + +Synopsis + + +:: + +bootelf [-p|-s] [-d ] [ []...] + +Description +--- + +The *bootelf* command is used to launch a ELF binary at *image_addr*. If +*image_addr* is not specified, the bootelf command will try to find image in +*image_load_addr* variable (*CONFIG\_SYS\_LOAD\_ADDR* by default). + +Args after *image_addr* will be passed to application in common *argc*, *argv* +format. + +A command sequence to run a ELF image using FDT might look like + +:: + +load mmc 0:1 ${loadaddr} /kernel.elf +load mmc 0:1 ${fdt_addr_r} /soc-board.dtb +bootelf -d ${fdt_addr_r} ${loadaddr} ${loadaddr} + +image_addr +Address of the ELF binary. + +fdt_addr +Address of the device-tree. This argument in only needed if bootable +application uses FDT that requires additional setup (like /memory node). + +arg +Any text arguments for bootable application. This is usually the address +of the device-tree. + +Flags: + +-p +Load ELF image via program headers. + +-s +Load ELF image via section headers. + +-d +Setup FDT by address. + +Configuration +- + +The bootelf command is only available if CONFIG_CMD_ELF=y. FDT setup by flag -d +need CONFIG_CMD_ELF_FDT_SETUP=y. -- 2.39.2
[PATCH v2] doc: add bootelf command documentation
Signed-off-by: Maxim Moskalets --- v2: Add Configuration section. --- doc/usage/cmd/bootelf.rst | 58 +++ 1 file changed, 58 insertions(+) create mode 100644 doc/usage/cmd/bootelf.rst diff --git a/doc/usage/cmd/bootelf.rst b/doc/usage/cmd/bootelf.rst new file mode 100644 index 00..748c3e2e4b --- /dev/null +++ b/doc/usage/cmd/bootelf.rst @@ -0,0 +1,58 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright 2024, Maxim Moskalets + +.. index:: + single: bootelf (command) + +bootelf command +=== + +Synopsis + + +:: + +bootelf [-p|-s] [-d ] [ []...] + +Description +--- + +The *bootelf* command is used to launch a ELF binary at *image_addr*. If +*image_addr* is not specified, the bootelf command will try to find image in +*image_load_addr* variable (*CONFIG\_SYS\_LOAD\_ADDR* by default). + +Args after *image_addr* will be passed to application in common *argc*, *argv* +format. + +A command sequence to run a ELF image using FDT might look like + +:: + +load mmc 0:1 ${loadaddr} /kernel.elf +load mmc 0:1 ${fdt_addr_r} /soc-board.dtb +bootelf -d ${fdt_addr_r} ${loadaddr} ${loadaddr} + +image_addr +Address of the ELF binary. + +fdt_addr +Address of the device-tree. This argument in only needed if bootable +application uses FDT that requires additional setup (like /memory node). + +arg +Any text arguments for bootable application. This is usually the address +of the device-tree. + +Flags: + +-p|-s +Load ELF image via program headers (-p) or via section headers (-s). + +-d +Setup FDT by address. + +Configuration +- + +The bootelf command is only available if CONFIG_CMD_ELF=y. FDT setup by flag -d +need CONFIG_CMD_ELF_FDT_SETUP=y. -- 2.39.2
[NEXT] Pull request efi-2024-10-rc1
Dear Tom, The following changes since commit 899b088674b6905710ce546f0a8848662904852a: Merge patch series "pxe: Add debugging for booting" (2024-06-26 13:17:52 -0600) are available in the Git repository at: https://source.denx.de/u-boot/custodians/u-boot-efi.git tags/efi-2024-10-rc1 for you to fetch changes up to 636480e4e7088d05d7ff77af72ca00443c62b3e9: doc: develop: Add a general section on gdb usage (2024-06-30 13:58:31 +0200) Gitlab CI showed no issues: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/21383 Pull request efi-2024-10-rc1 Documentation: Update requirements.txt to use current Python module versions Add a page describing debugging U-Boot with GDB FIT: describe data-size as a conditionally mandatory property Correct link to FIT specification in SPL code. Correct kaslrseed command long text description UEFI: Add unit test checking that don't have kaslr-seed when measuring boot Deduplicate code for measured boot. Other: Print size information in fwu command Alexander Dahl (1): doc: develop: Add a general section on gdb usage Bastian Germann (1): doc: fit: Make data-size a conditionally mandatory property Heinrich Schuchardt (4): doc: update requirements.txt spl: correct link to FIT specification efi_selftest: can't have measured device-tree with kaslr-seed cmd: correct kaslrseed description Ilias Apalodimas (6): efi_loader: remove unused TCG algo definitions tpm: Move TCG headers into a separate file tpm: Move TCG functions into a separate file efi_loader: remove unneeded header files tpm: Untangle tpm2_get_pcr_info() tpm: allow the user to select the compiled algorithms Michal Simek (1): cmd: fwu: Also print information about size boot/Kconfig | 4 + boot/bootm.c | 1 + cmd/fwu_mdata.c | 1 + cmd/kaslrseed.c | 2 +- common/spl/spl_fit.c | 2 +- doc/develop/gdb.rst | 171 doc/develop/index.rst| 1 + doc/sphinx/requirements.txt | 16 +- doc/usage/fit/source_file_format.rst | 6 +- include/efi_tcg2.h | 9 +- include/tpm-v2.h | 388 +++--- include/tpm_tcg2.h | 348 lib/Kconfig | 6 +- lib/Makefile | 2 + lib/efi_loader/efi_tcg2.c| 3 +- lib/efi_selftest/efi_selftest_fdt.c | 7 + lib/tpm-v2.c | 767 +++ lib/tpm_tcg2.c | 731 + 18 files changed, 1386 insertions(+), 1079 deletions(-) create mode 100644 doc/develop/gdb.rst create mode 100644 include/tpm_tcg2.h create mode 100644 lib/tpm_tcg2.c
Re: [PATCH] doc: add bootelf command documentation
On 6/30/24 12:37, Maxim Moskalets wrote: Signed-off-by: Maxim Moskalets --- doc/usage/cmd/bootelf.rst | 52 +++ 1 file changed, 52 insertions(+) create mode 100644 doc/usage/cmd/bootelf.rst diff --git a/doc/usage/cmd/bootelf.rst b/doc/usage/cmd/bootelf.rst new file mode 100644 index 00..5472a90fe2 --- /dev/null +++ b/doc/usage/cmd/bootelf.rst @@ -0,0 +1,52 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright 2024, Maxim Moskalets + +.. index:: + single: bootelf (command) + +bootelf command +=== + +Synopsis + + +:: + +bootelf [-p|-s] [-d ] [ []...] + +Description +--- + +The *bootelf* command is used to launch a ELF binary at *image_addr*. If +*image_addr* is not specified, the bootelf command will try to find image in +*image_load_addr* variable (*CONFIG\_SYS\_LOAD\_ADDR* by default). + +Args after *image_addr* will be passed to application in common *argc*, *argv* +format. + +A command sequence to run a ELF image using FDT might look like + +:: + +load mmc 0:1 ${loadaddr} /kernel.elf +load mmc 0:1 ${fdt_addr_r} /soc-board.dtb +bootelf -d ${fdt_addr_r} ${loadaddr} ${loadaddr} Thank you for providing this man-page. Please, move the example to an Examples section. See other man-pages. + +image_addr +Address of the ELF binary. + +fdt_addr +Address of the device-tree. This argument in only needed if bootable +application uses FDT that requires additional setup (like /memory node). + +arg +Any text arguments for bootable application. This is usually the address +of the device-tree. + +Flags: + +-p|-s +Load ELF image via program headers (-p) or via section headers (-s). Please, separate -p -s into different lines. + +-d +Setup FDT by address. Available only if CONFIG_CMD_ELF_FDT_SETUP is enabled. Please, add a Configuration section like in the other man-pages describing which configuration setting enables the command. Best regards Heinrich
Re: [PATCH] efi_loader: adjust config options for capsule updates
Hi Heinrich, On Sun, 30 Jun 2024 at 15:23, Heinrich Schuchardt wrote: > > On 6/22/24 18:38, Ilias Apalodimas wrote: > > On Sat, 22 Jun 2024 at 19:36, Heinrich Schuchardt > > wrote: > >> > >> On 20.06.24 22:15, Ilias Apalodimas wrote: > >>> EFI_IGNORE_OSINDICATIONS is used to ignore OsIndications if setvariable > >>> at runtime is not supported and allow the platform to perform capsule > >>> updates on disk. With the recent changes boards can conditionally enable > >>> setvariable at runtime using EFI_RT_VOLATILE_STORE. > >>> > >>> Let's make that visible in our Kconfigs and enable > >>> EFI_IGNORE_OSINDICATIONS > >>> when set variable at runtime is disabled. > >>> > >>> Since EFI_RT_VOLATILE_STORE needs help from the OS to persist the > >>> variables, allow users to ignore OsIndications even if setvariable at > >>> runtime is enabled. > >>> > >>> Signed-off-by: Ilias Apalodimas > >> > >> So this v2: > > > > Yes sorry, forgot to add the tile and log... > > With this patch I get a failure on the sandbox in the CI: > > https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/21382 Yes, this test is trying to test updates with OsIndications not set and it obviously fails, because it expects the update to stop. I'll send a v3 and adjust the tests. Cheers /Ilias > > Without the patch the sandbox runs fine: > > https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/21383 > > Best regards > > Heinrich > > > > >> > >> v2: > >> allow EFI_IGNORE_OSINDICATIONS if EFI_RT_VOLATILE_STORE=y > >> > >> Reviewed-by: Heinrich Schuchardt > > > > Thanks Heinrich > > > >> > >>> --- > >>>lib/efi_loader/Kconfig | 1 + > >>>1 file changed, 1 insertion(+) > >>> > >>> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig > >>> index ee71f417147a..6006e845cb1f 100644 > >>> --- a/lib/efi_loader/Kconfig > >>> +++ b/lib/efi_loader/Kconfig > >>> @@ -220,6 +220,7 @@ config EFI_CAPSULE_ON_DISK > >>>config EFI_IGNORE_OSINDICATIONS > >>>bool "Ignore OsIndications for CapsuleUpdate on-disk" > >>>depends on EFI_CAPSULE_ON_DISK > >>> + default y if !EFI_RT_VOLATILE_STORE > >>>help > >>> There are boards where U-Boot does not support SetVariable at > >>> runtime. > >>> Select this option if you want to use the capsule-on-disk feature > >>> -- > >>> 2.43.0 > >>> > >> >
Re: [PATCH] efi_loader: adjust config options for capsule updates
On 6/22/24 18:38, Ilias Apalodimas wrote: On Sat, 22 Jun 2024 at 19:36, Heinrich Schuchardt wrote: On 20.06.24 22:15, Ilias Apalodimas wrote: EFI_IGNORE_OSINDICATIONS is used to ignore OsIndications if setvariable at runtime is not supported and allow the platform to perform capsule updates on disk. With the recent changes boards can conditionally enable setvariable at runtime using EFI_RT_VOLATILE_STORE. Let's make that visible in our Kconfigs and enable EFI_IGNORE_OSINDICATIONS when set variable at runtime is disabled. Since EFI_RT_VOLATILE_STORE needs help from the OS to persist the variables, allow users to ignore OsIndications even if setvariable at runtime is enabled. Signed-off-by: Ilias Apalodimas So this v2: Yes sorry, forgot to add the tile and log... With this patch I get a failure on the sandbox in the CI: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/21382 Without the patch the sandbox runs fine: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/21383 Best regards Heinrich v2: allow EFI_IGNORE_OSINDICATIONS if EFI_RT_VOLATILE_STORE=y Reviewed-by: Heinrich Schuchardt Thanks Heinrich --- lib/efi_loader/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index ee71f417147a..6006e845cb1f 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -220,6 +220,7 @@ config EFI_CAPSULE_ON_DISK config EFI_IGNORE_OSINDICATIONS bool "Ignore OsIndications for CapsuleUpdate on-disk" depends on EFI_CAPSULE_ON_DISK + default y if !EFI_RT_VOLATILE_STORE help There are boards where U-Boot does not support SetVariable at runtime. Select this option if you want to use the capsule-on-disk feature -- 2.43.0
Re: [PATCH] cmd: add resize for FDT in bootelf
Hi Simon, On 29.06.2024 09:56, Simon Glass wrote: Hi Maxim, On Fri, 28 Jun 2024 at 09:34, Maxim Moskalets wrote: In some FDTs, there is not enough free memory to add nodes, so this operation fails. Signed-off-by: Maxim Moskalets --- cmd/elf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/elf.c b/cmd/elf.c index 32b7462f92..673c6c3051 100644 --- a/cmd/elf.c +++ b/cmd/elf.c @@ -68,6 +68,8 @@ int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) log_debug("Setting up FDT at 0x%08lx ...\n", fdt_addr); flush(); + fdt_set_totalsize((void *)fdt_addr, + fdt_totalsize(fdt_addr) + CONFIG_SYS_FDT_PAD); if (image_setup_libfdt(&img, (void *)fdt_addr, NULL)) return 1; } -- 2.39.2 Reviewed-by: Simon Glass Would you mind adding some docs for this comment in doc/usage/cmd/elf.rst ? I added the documentation, but since it's not relevant to this patch, it's in the [PATCH] doc: add bootelf command documentation Regards, Maxim You can also use the 'fdt addr ' to expand the FDT. Regards, Simon
[PATCH] doc: add bootelf command documentation
Signed-off-by: Maxim Moskalets --- doc/usage/cmd/bootelf.rst | 52 +++ 1 file changed, 52 insertions(+) create mode 100644 doc/usage/cmd/bootelf.rst diff --git a/doc/usage/cmd/bootelf.rst b/doc/usage/cmd/bootelf.rst new file mode 100644 index 00..5472a90fe2 --- /dev/null +++ b/doc/usage/cmd/bootelf.rst @@ -0,0 +1,52 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright 2024, Maxim Moskalets + +.. index:: + single: bootelf (command) + +bootelf command +=== + +Synopsis + + +:: + +bootelf [-p|-s] [-d ] [ []...] + +Description +--- + +The *bootelf* command is used to launch a ELF binary at *image_addr*. If +*image_addr* is not specified, the bootelf command will try to find image in +*image_load_addr* variable (*CONFIG\_SYS\_LOAD\_ADDR* by default). + +Args after *image_addr* will be passed to application in common *argc*, *argv* +format. + +A command sequence to run a ELF image using FDT might look like + +:: + +load mmc 0:1 ${loadaddr} /kernel.elf +load mmc 0:1 ${fdt_addr_r} /soc-board.dtb +bootelf -d ${fdt_addr_r} ${loadaddr} ${loadaddr} + +image_addr +Address of the ELF binary. + +fdt_addr +Address of the device-tree. This argument in only needed if bootable +application uses FDT that requires additional setup (like /memory node). + +arg +Any text arguments for bootable application. This is usually the address +of the device-tree. + +Flags: + +-p|-s +Load ELF image via program headers (-p) or via section headers (-s). + +-d +Setup FDT by address. Available only if CONFIG_CMD_ELF_FDT_SETUP is enabled. -- 2.39.2
Re: [PATCH] zlib: Fix big performance regression
Le 27/06/2024 à 21:40, Tom Rini a écrit : On Thu, Jun 27, 2024 at 01:34:55PM -0600, Tom Rini wrote: On Thu, Jun 27, 2024 at 10:25:21AM +0200, Christophe Leroy wrote: Commit 340fdf1303dc ("zlib: Port fix for CVE-2016-9841 to U-Boot") brings a big performance regression in inflate_fast(), which leads to watchdog timer reset on powerpc 8xx. It looks like that commit does more than what it describe, it especially removed an important optimisation that was doing copies using halfwords instead of bytes. That unexpected change multiplied by almost 4 the time spent in inflate_fast() and increased by 40% the overall time needed to uncompress linux kernel image. So partially revert that commit but keep post incrementation as it is the initial purpose of said commit. Fixes: 340fdf1303dc ("zlib: Port fix for CVE-2016-9841 to U-Boot") Signed-off-by: Christophe Leroy --- lib/zlib/inffast.c | 51 -- 1 file changed, 40 insertions(+), 11 deletions(-) Both this, and my mostly revert lead to CI failures around compression tests: https://source.denx.de/u-boot/u-boot/-/jobs/859329 A full revert however, is fine. Is it that ? : FAILED test/py/tests/test_ut.py::test_ut[ut_compression_compression_test_gzip] It seems like when the optimisation was added by commit cd514aeb996e ("zlib: Optimize decompression"), only the pre-increment implementation was available. When POSTINC was added by commit e89516f031db ("zlib: split up to match original source tree"), I guess it was not verified because POSTINC is #undef by zlib.h. With the following change I don't get the FAILED ut_compression_compression_test_gzip CI anymore (https://source.denx.de/u-boot/custodians/u-boot-mpc8xx/-/jobs/859937) diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c index c271d85ea1..5dc0574202 100644 --- a/lib/zlib/inffast.c +++ b/lib/zlib/inffast.c @@ -257,7 +257,7 @@ void inflate_fast(z_streamp strm, unsigned start) sfrom = (unsigned short *)(from - OFF); loops = len >> 1; do - PUP(sout) = get_unaligned(++sfrom); + PUP(sout) = get_unaligned(sfrom++); while (--loops); out = (unsigned char *)sout + OFF; from = (unsigned char *)sfrom + OFF; Christophe