From 6cdf6b7a340db4ddd008516181de7e08e3f8c213 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Sat, 18 Mar 2023 00:22:51 +0800 Subject: arm64: Use FEAT_HAFDBS to track dirty pages when available Some recent arm64 cores have a facility that allows the page table walker to track the dirty state of a page. This makes it really efficient to perform CMOs by VA as we only need to look at dirty pages. Signed-off-by: Marc Zyngier [ Paul: pick from the Android tree. Rebase to the upstream ] Signed-off-by: Ying-Chun Liu (PaulLiu) Cc: Tom Rini Link: https://android.googlesource.com/platform/external/u-boot/+/3c433724e6f830a6b2edd5ec3d4a504794887263 --- arch/arm/cpu/armv8/cache_v8.c | 16 +++++++++++++++- arch/arm/include/asm/armv8/mmu.h | 14 ++++++++++---- arch/arm/include/asm/global_data.h | 1 + 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c index 697334086fd..4760064ee18 100644 --- a/arch/arm/cpu/armv8/cache_v8.c +++ b/arch/arm/cpu/armv8/cache_v8.c @@ -93,6 +93,8 @@ u64 get_tcr(u64 *pips, u64 *pva_bits) if (el == 1) { tcr = TCR_EL1_RSVD | (ips << 32) | TCR_EPD1_DISABLE; + if (gd->arch.has_hafdbs) + tcr |= TCR_HA | TCR_HD; } else if (el == 2) { tcr = TCR_EL2_RSVD | (ips << 16); } else { @@ -200,6 +202,9 @@ static void __cmo_on_leaves(void (*cmo_fn)(unsigned long, unsigned long), attrs != PTE_BLOCK_MEMTYPE(MT_NORMAL_NC)) continue; + if (gd->arch.has_hafdbs && (pte & (PTE_RDONLY | PTE_DBM)) != PTE_DBM) + continue; + end = va + BIT(level2shift(level)) - 1; /* No intersection with RAM? */ @@ -348,6 +353,9 @@ static void add_map(struct mm_region *map) if (va_bits < 39) level = 1; + if (gd->arch.has_hafdbs) + attrs |= PTE_DBM | PTE_RDONLY; + map_range(map->virt, map->phys, map->size, level, (u64 *)gd->arch.tlb_addr, attrs); } @@ -399,7 +407,13 @@ static int count_ranges(void) __weak u64 get_page_table_size(void) { u64 one_pt = MAX_PTE_ENTRIES * sizeof(u64); - u64 size; + u64 size, mmfr1; + + asm volatile("mrs %0, id_aa64mmfr1_el1" : "=r" (mmfr1)); + if ((mmfr1 & 0xf) == 2) + gd->arch.has_hafdbs = true; + else + gd->arch.has_hafdbs = false; /* Account for all page tables we would need to cover our memory map */ size = one_pt * count_ranges(); diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h index 9f58cedb650..98a27db3166 100644 --- a/arch/arm/include/asm/armv8/mmu.h +++ b/arch/arm/include/asm/armv8/mmu.h @@ -49,10 +49,13 @@ #define PTE_TYPE_BLOCK (1 << 0) #define PTE_TYPE_VALID (1 << 0) -#define PTE_TABLE_PXN (1UL << 59) -#define PTE_TABLE_XN (1UL << 60) -#define PTE_TABLE_AP (1UL << 61) -#define PTE_TABLE_NS (1UL << 63) +#define PTE_RDONLY BIT(7) +#define PTE_DBM BIT(51) + +#define PTE_TABLE_PXN BIT(59) +#define PTE_TABLE_XN BIT(60) +#define PTE_TABLE_AP BIT(61) +#define PTE_TABLE_NS BIT(63) /* * Block @@ -99,6 +102,9 @@ #define TCR_TG0_16K (2 << 14) #define TCR_EPD1_DISABLE (1 << 23) +#define TCR_HA BIT(39) +#define TCR_HD BIT(40) + #define TCR_EL1_RSVD (1U << 31) #define TCR_EL2_RSVD (1U << 31 | 1 << 23) #define TCR_EL3_RSVD (1U << 31 | 1 << 23) diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index 86987838f46..6956182accb 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -52,6 +52,7 @@ struct arch_global_data { #if defined(CONFIG_ARM64) unsigned long tlb_fillptr; unsigned long tlb_emerg; + bool has_hafdbs; #endif #endif #ifdef CFG_SYS_MEM_RESERVE_SECURE -- cgit v1.2.3 From 836b8d4b205d2175b57cb9ef271e638b0c116e89 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Sat, 18 Mar 2023 00:22:52 +0800 Subject: arm64: Use level-2 for largest block mappings when FEAT_HAFDBS is present In order to make invalidation by VA more efficient, set the largest block mapping to 2MB, mapping it onto level-2. This has no material impact on u-boot's runtime performance, and allows a huge speedup when cleaning the cache. Signed-off-by: Marc Zyngier [ Paul: pick from the Android tree. Rebase to the upstream ] Signed-off-by: Ying-Chun Liu (PaulLiu) Cc: Tom Rini Link: https://android.googlesource.com/platform/external/u-boot/+/417a73581a72ff6d6ee4b0938117b8a23e32f7e8 --- arch/arm/cpu/armv8/cache_v8.c | 14 ++++++++++---- arch/arm/include/asm/global_data.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c index 4760064ee18..4c6a1b1d6c5 100644 --- a/arch/arm/cpu/armv8/cache_v8.c +++ b/arch/arm/cpu/armv8/cache_v8.c @@ -314,7 +314,7 @@ static void map_range(u64 virt, u64 phys, u64 size, int level, for (i = idx; size; i++) { u64 next_size, *next_table; - if (level >= 1 && + if (level >= gd->arch.first_block_level && size >= map_size && !(virt & (map_size - 1))) { if (level == 3) table[i] = phys | attrs | PTE_TYPE_PAGE; @@ -353,6 +353,9 @@ static void add_map(struct mm_region *map) if (va_bits < 39) level = 1; + if (!gd->arch.first_block_level) + gd->arch.first_block_level = 1; + if (gd->arch.has_hafdbs) attrs |= PTE_DBM | PTE_RDONLY; @@ -369,7 +372,7 @@ static void count_range(u64 virt, u64 size, int level, int *cntp) for (i = idx; size; i++) { u64 next_size; - if (level >= 1 && + if (level >= gd->arch.first_block_level && size >= map_size && !(virt & (map_size - 1))) { virt += map_size; size -= map_size; @@ -410,10 +413,13 @@ __weak u64 get_page_table_size(void) u64 size, mmfr1; asm volatile("mrs %0, id_aa64mmfr1_el1" : "=r" (mmfr1)); - if ((mmfr1 & 0xf) == 2) + if ((mmfr1 & 0xf) == 2) { gd->arch.has_hafdbs = true; - else + gd->arch.first_block_level = 2; + } else { gd->arch.has_hafdbs = false; + gd->arch.first_block_level = 1; + } /* Account for all page tables we would need to cover our memory map */ size = one_pt * count_ranges(); diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index 6956182accb..0c130757110 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -52,6 +52,7 @@ struct arch_global_data { #if defined(CONFIG_ARM64) unsigned long tlb_fillptr; unsigned long tlb_emerg; + unsigned int first_block_level; bool has_hafdbs; #endif #endif -- cgit v1.2.3 From c1da6fdb5c239b432440721772d993e63cfdeb20 Mon Sep 17 00:00:00 2001 From: meitao Date: Sat, 18 Mar 2023 00:22:53 +0800 Subject: armv8: enable HAFDBS for other ELx when FEAT_HAFDBS is present u-boot could be run at EL1/EL2/EL3. so we set it as same as EL1 does. otherwise it will hang when enable mmu, that is what we encounter in our SOC. Signed-off-by: meitao [ Paul: pick from the Android tree. Rebase to the upstream ] Signed-off-by: Ying-Chun Liu (PaulLiu) Cc: Tom Rini Link: https://android.googlesource.com/platform/external/u-boot/+/3bf38943aeab4700c2319bff2a1477d99c6afd2f --- arch/arm/cpu/armv8/cache_v8.c | 6 +++++- arch/arm/include/asm/armv8/mmu.h | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c index 4c6a1b1d6c5..cb1131a0480 100644 --- a/arch/arm/cpu/armv8/cache_v8.c +++ b/arch/arm/cpu/armv8/cache_v8.c @@ -94,11 +94,15 @@ u64 get_tcr(u64 *pips, u64 *pva_bits) if (el == 1) { tcr = TCR_EL1_RSVD | (ips << 32) | TCR_EPD1_DISABLE; if (gd->arch.has_hafdbs) - tcr |= TCR_HA | TCR_HD; + tcr |= TCR_EL1_HA | TCR_EL1_HD; } else if (el == 2) { tcr = TCR_EL2_RSVD | (ips << 16); + if (gd->arch.has_hafdbs) + tcr |= TCR_EL2_HA | TCR_EL2_HD; } else { tcr = TCR_EL3_RSVD | (ips << 16); + if (gd->arch.has_hafdbs) + tcr |= TCR_EL3_HA | TCR_EL3_HD; } /* PTWs cacheable, inner/outer WBWA and inner shareable */ diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h index 98a27db3166..19a9e112a43 100644 --- a/arch/arm/include/asm/armv8/mmu.h +++ b/arch/arm/include/asm/armv8/mmu.h @@ -102,8 +102,14 @@ #define TCR_TG0_16K (2 << 14) #define TCR_EPD1_DISABLE (1 << 23) -#define TCR_HA BIT(39) -#define TCR_HD BIT(40) +#define TCR_EL1_HA BIT(39) +#define TCR_EL1_HD BIT(40) + +#define TCR_EL2_HA BIT(21) +#define TCR_EL2_HD BIT(22) + +#define TCR_EL3_HA BIT(21) +#define TCR_EL3_HD BIT(22) #define TCR_EL1_RSVD (1U << 31) #define TCR_EL2_RSVD (1U << 31 | 1 << 23) -- cgit v1.2.3 From 45981a9a3759eae8375c85927fb213e4cc14353d Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 24 Mar 2023 08:44:29 +0100 Subject: soc: soc_ti_k3: fix revision array bounds checks If rev is equal to the array size, we'll access the array one-past-the-end. Signed-off-by: Rasmus Villemoes Reviewed-by: Bryan Brattlof --- drivers/soc/soc_ti_k3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c index 42430d79a7a..b720131ae5d 100644 --- a/drivers/soc/soc_ti_k3.c +++ b/drivers/soc/soc_ti_k3.c @@ -70,12 +70,12 @@ static const char *get_rev_string(u32 idreg) switch (soc) { case JTAG_ID_PARTNO_J721E: - if (rev > ARRAY_SIZE(j721e_rev_string_map)) + if (rev >= ARRAY_SIZE(j721e_rev_string_map)) goto bail; return j721e_rev_string_map[rev]; default: - if (rev > ARRAY_SIZE(typical_rev_string_map)) + if (rev >= ARRAY_SIZE(typical_rev_string_map)) goto bail; return typical_rev_string_map[rev]; }; -- cgit v1.2.3 From 2e43ba78052825c62e3078e308d681da44ccdc8f Mon Sep 17 00:00:00 2001 From: Jayesh Choudhary Date: Tue, 28 Mar 2023 18:32:01 +0530 Subject: arch: mach-k3: j721s2_init: Disable the firewalls Some firewalls enabled by ROM are still left on. So some address space is inaccessible to the bootloader. For example, in OSPI boot mode we get an exception and the system hangs. Therefore, disable all the firewalls left on by the ROM. Signed-off-by: Jayesh Choudhary Reviewed-by: Andrew Davis Reviewed-by: Manorit Chawdhry --- arch/arm/mach-k3/j721s2_init.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/arch/arm/mach-k3/j721s2_init.c b/arch/arm/mach-k3/j721s2_init.c index 001d9466c20..712a7e253fa 100644 --- a/arch/arm/mach-k3/j721s2_init.c +++ b/arch/arm/mach-k3/j721s2_init.c @@ -22,6 +22,51 @@ #include #include +struct fwl_data cbass_hc_cfg0_fwls[] = { + { "PCIE0_CFG", 2577, 7 }, + { "EMMC8SS0_CFG", 2579, 4 }, + { "USB3SS0_CORE", 2580, 4 }, + { "USB3SS1_CORE", 2581, 1 }, +}, cbass_hc2_fwls[] = { + { "PCIE0", 2547, 24 }, + { "HC2_WIZ16B8M4CT2", 2552, 1 }, +}, cbass_rc_cfg0_fwls[] = { + { "EMMCSD4SS0_CFG", 2400, 4 }, +}, infra_cbass0_fwls[] = { + { "PSC0", 5, 1 }, + { "PLL_CTRL0", 6, 1 }, + { "PLL_MMR0", 8, 26 }, + { "CTRL_MMR0", 9, 16 }, + { "GPIO0", 16, 1 }, +}, mcu_cbass0_fwls[] = { + { "MCU_R5FSS0_CORE0", 1024, 4 }, + { "MCU_R5FSS0_CORE0_CFG", 1025, 3 }, + { "MCU_R5FSS0_CORE1", 1028, 4 }, + { "MCU_R5FSS0_CORE1_CFG", 1029, 1 }, + { "MCU_FSS0_CFG", 1032, 12 }, + { "MCU_FSS0_S1", 1033, 8 }, + { "MCU_FSS0_S0", 1036, 8 }, + { "MCU_PSROM49152X32", 1048, 1 }, + { "MCU_MSRAM128KX64", 1050, 8 }, + { "MCU_MSRAM128KX64_CFG", 1051, 1 }, + { "MCU_TIMER0", 1056, 1 }, + { "MCU_TIMER9", 1065, 1 }, + { "MCU_USART0", 1120, 1 }, + { "MCU_I2C0", 1152, 1 }, + { "MCU_CTRL_MMR0", 1200, 8 }, + { "MCU_PLL_MMR0", 1201, 3 }, + { "MCU_CPSW0", 1220, 2 }, +}, wkup_cbass0_fwls[] = { + { "WKUP_PSC0", 129, 1 }, + { "WKUP_PLL_CTRL0", 130, 1 }, + { "WKUP_CTRL_MMR0", 131, 16 }, + { "WKUP_GPIO0", 132, 1 }, + { "WKUP_I2C0", 144, 1 }, + { "WKUP_USART0", 160, 1 }, +}, navss_cbass0_fwls[] = { + { "NACSS_VIRT0", 6253, 1 }, +}; + static void ctrl_mmr_unlock(void) { /* Unlock all WKUP_CTRL_MMR0 module registers */ @@ -150,6 +195,14 @@ void k3_spl_init(void) if (ret) panic("Failed to initialize clk-k3!\n"); } + + remove_fwl_configs(cbass_hc_cfg0_fwls, ARRAY_SIZE(cbass_hc_cfg0_fwls)); + remove_fwl_configs(cbass_hc2_fwls, ARRAY_SIZE(cbass_hc2_fwls)); + remove_fwl_configs(cbass_rc_cfg0_fwls, ARRAY_SIZE(cbass_rc_cfg0_fwls)); + remove_fwl_configs(infra_cbass0_fwls, ARRAY_SIZE(infra_cbass0_fwls)); + remove_fwl_configs(mcu_cbass0_fwls, ARRAY_SIZE(mcu_cbass0_fwls)); + remove_fwl_configs(wkup_cbass0_fwls, ARRAY_SIZE(wkup_cbass0_fwls)); + remove_fwl_configs(navss_cbass0_fwls, ARRAY_SIZE(navss_cbass0_fwls)); } /* Output System Firmware version info */ -- cgit v1.2.3 From 990bf2f38feeed86545cd775b766513fa91dc3f7 Mon Sep 17 00:00:00 2001 From: Nikhil M Jain Date: Thu, 30 Mar 2023 14:24:09 +0530 Subject: include: configs: am64x_evm: Change to using .env Move to using .env file for setting up environment variables for am64x. Signed-off-by: Nikhil M Jain Reviewed-by: Devarsh Thakkar --- board/ti/am64x/am64x.env | 63 +++++++++++++++++++++++++++++++++ include/configs/am64x_evm.h | 85 --------------------------------------------- 2 files changed, 63 insertions(+), 85 deletions(-) create mode 100644 board/ti/am64x/am64x.env diff --git a/board/ti/am64x/am64x.env b/board/ti/am64x/am64x.env new file mode 100644 index 00000000000..c3960be38e3 --- /dev/null +++ b/board/ti/am64x/am64x.env @@ -0,0 +1,63 @@ +#include +#include +#include + +findfdt= + if test $board_name = am64x_gpevm; then + setenv name_fdt k3-am642-evm.dtb; fi; + if test $board_name = am64x_skevm; then + setenv name_fdt k3-am642-sk.dtb; fi; + if test $name_fdt = undefined; then + echo WARNING: Could not determine device tree to use; fi; +name_kern=Image +console=ttyS2,115200n8 +args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 ${mtdparts} +run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr} + +boot=mmc +mmcdev=1 +bootpart=1:2 +bootdir=/boot +rd_spec=- +init_mmc=run args_all args_mmc +get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt} +get_overlay_mmc= + fdt address ${fdtaddr}; + fdt resize 0x100000; + for overlay in $name_overlays; + do; + load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && + fdt apply ${dtboaddr}; + done; +get_kern_mmc=load mmc ${bootpart} ${loadaddr} + ${bootdir}/${name_kern} +get_fit_mmc=load mmc ${bootpart} ${addr_fit} + ${bootdir}/${name_fit} +partitions=name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs} + +args_usb=run finduuid;setenv bootargs console=${console} + ${optargs} + root=PARTUUID=${uuid} rw + rootfstype=${mmcrootfstype} +init_usb=run args_all args_usb +get_fdt_usb=load usb ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt} +get_overlay_usb= + fdt address ${fdtaddr}; + fdt resize 0x100000; + for overlay in $name_overlays; + do; + load usb ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && fdt apply + ${dtboaddr}; + done; +get_kern_usb=load usb ${bootpart} ${loadaddr} + ${bootdir}/${name_kern} +get_fit_usb=load usb ${bootpart} ${addr_fit} + ${bootdir}/${name_fit} +usbboot=setenv boot usb; + setenv bootpart 0:2; + usb start; + run findfdt; + run init_usb; + run get_kern_usb; + run get_fdt_usb; + run run_kern; diff --git a/include/configs/am64x_evm.h b/include/configs/am64x_evm.h index 26a7f2521ec..1e37ab47b9a 100644 --- a/include/configs/am64x_evm.h +++ b/include/configs/am64x_evm.h @@ -18,91 +18,6 @@ /* DDR Configuration */ #define CFG_SYS_SDRAM_BASE1 0x880000000 -#define PARTS_DEFAULT \ - /* Linux partitions */ \ - "name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0" - -/* U-Boot general configuration */ -#define EXTRA_ENV_AM642_BOARD_SETTINGS \ - "findfdt=" \ - "if test $board_name = am64x_gpevm; then " \ - "setenv fdtfile k3-am642-evm.dtb; fi; " \ - "if test $board_name = am64x_skevm; then " \ - "setenv fdtfile k3-am642-sk.dtb; fi;" \ - "if test $fdtfile = undefined; then " \ - "echo WARNING: Could not determine device tree to use; fi; \0" \ - "name_kern=Image\0" \ - "console=ttyS2,115200n8\0" \ - "args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 " \ - "${mtdparts}\0" \ - "run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0" - -/* U-Boot MMC-specific configuration */ -#define EXTRA_ENV_AM642_BOARD_SETTINGS_MMC \ - "boot=mmc\0" \ - "mmcdev=1\0" \ - "bootpart=1:2\0" \ - "bootdir=/boot\0" \ - "rd_spec=-\0" \ - "init_mmc=run args_all args_mmc\0" \ - "get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \ - "get_overlay_mmc=" \ - "fdt address ${fdtaddr};" \ - "fdt resize 0x100000;" \ - "for overlay in $name_overlays;" \ - "do;" \ - "load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && " \ - "fdt apply ${dtboaddr};" \ - "done;\0" \ - "get_kern_mmc=load mmc ${bootpart} ${loadaddr} " \ - "${bootdir}/${name_kern}\0" \ - "get_fit_mmc=load mmc ${bootpart} ${addr_fit} " \ - "${bootdir}/${name_fit}\0" \ - "partitions=" PARTS_DEFAULT - -#define EXTRA_ENV_AM642_BOARD_SETTING_USBMSC \ - "args_usb=run finduuid;setenv bootargs console=${console} " \ - "${optargs} " \ - "root=PARTUUID=${uuid} rw " \ - "rootfstype=${mmcrootfstype}\0" \ - "init_usb=run args_all args_usb\0" \ - "get_fdt_usb=load usb ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \ - "get_overlay_usb=" \ - "fdt address ${fdtaddr};" \ - "fdt resize 0x100000;" \ - "for overlay in $name_overlays;" \ - "do;" \ - "load usb ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && " \ - "fdt apply ${dtboaddr};" \ - "done;\0" \ - "get_kern_usb=load usb ${bootpart} ${loadaddr} " \ - "${bootdir}/${name_kern}\0" \ - "get_fit_usb=load usb ${bootpart} ${addr_fit} " \ - "${bootdir}/${name_fit}\0" \ - "usbboot=setenv boot usb;" \ - "setenv bootpart 0:2;" \ - "usb start;" \ - "run findfdt;" \ - "run init_usb;" \ - "run get_kern_usb;" \ - "run get_fdt_usb;" \ - "run run_kern\0" - -#define EXTRA_ENV_DFUARGS \ - DFU_ALT_INFO_MMC \ - DFU_ALT_INFO_EMMC \ - DFU_ALT_INFO_RAM \ - DFU_ALT_INFO_OSPI - -/* Incorporate settings into the U-Boot environment */ -#define CFG_EXTRA_ENV_SETTINGS \ - DEFAULT_LINUX_BOOT_ENV \ - DEFAULT_MMC_TI_ARGS \ - EXTRA_ENV_AM642_BOARD_SETTINGS \ - EXTRA_ENV_AM642_BOARD_SETTINGS_MMC \ - EXTRA_ENV_DFUARGS \ - EXTRA_ENV_AM642_BOARD_SETTING_USBMSC - /* Now for the remaining common defines */ #include -- cgit v1.2.3 From 3635df6bdf29cf22ce7378a50276cf71a6b3dc52 Mon Sep 17 00:00:00 2001 From: Peter Hoyes Date: Fri, 31 Mar 2023 09:58:11 +0100 Subject: vexpress64: Use OF_HAS_PRIOR_STAGE for BASE_FVP variant BASE_FVP now typically uses a devicetree provided by a prior boot stage (typically Arm TF-A), so imply this option by default when TARGET_VEXPRESS64_BASE_FVP is selected. OF_HAS_PRIOR_STAGE selects OF_BOARD so this change is minor, but aligns TARGET_VEXPRESS64_BASE_FVP with TARGET_VEXPRESS64_BASER_FVP. Signed-off-by: Peter Hoyes Reviewed-by: Andre Przywara --- board/armltd/vexpress64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/armltd/vexpress64/Kconfig b/board/armltd/vexpress64/Kconfig index 5616e223a90..bd15cbeb7ea 100644 --- a/board/armltd/vexpress64/Kconfig +++ b/board/armltd/vexpress64/Kconfig @@ -23,7 +23,7 @@ choice config TARGET_VEXPRESS64_BASE_FVP bool "Support Versatile Express ARMv8a FVP BASE model" select VEXPRESS64_BASE_MODEL - select OF_BOARD + imply OF_HAS_PRIOR_STAGE config TARGET_VEXPRESS64_BASER_FVP bool "Support Versatile Express ARMv8r64 FVP BASE model" -- cgit v1.2.3 From 3e15be549c64a6672c6688765d17a2312bc7e156 Mon Sep 17 00:00:00 2001 From: Peter Hoyes Date: Fri, 31 Mar 2023 09:58:12 +0100 Subject: vexpress64: Enable VIRTIO_MMIO and RTC_PL031 in the base model The Arm EBBR (Embedded Base Boot Requirements) require that the time and basic networking EFI interfaces are available and working, so long as the hardware has an RTC and network interface. Arm FVPs typically have a memory-mapped PL031 RTC and a VIRTIO_NET device defined in the device tree, so "imply" these in the Kconfig for the FVP base model to simplify creating EBBR-compliant firmware. Signed-off-by: Peter Hoyes --- board/armltd/vexpress64/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/board/armltd/vexpress64/Kconfig b/board/armltd/vexpress64/Kconfig index bd15cbeb7ea..cf998096e45 100644 --- a/board/armltd/vexpress64/Kconfig +++ b/board/armltd/vexpress64/Kconfig @@ -12,8 +12,13 @@ config SYS_CONFIG_NAME config VEXPRESS64_BASE_MODEL bool select SEMIHOSTING + imply VIRTIO_MMIO select VIRTIO_BLK if VIRTIO_MMIO select VIRTIO_NET if VIRTIO_MMIO + select DM_ETH if VIRTIO_NET + imply RTC_PL031 + select DM_RTC if RTC_PL031 + imply EFI_SET_TIME if DM_RTC select LINUX_KERNEL_IMAGE_HEADER select POSITION_INDEPENDENT -- cgit v1.2.3 From 23ff3e7b15d3734d349e2f80ca063ae2d0b53159 Mon Sep 17 00:00:00 2001 From: Peter Hoyes Date: Fri, 31 Mar 2023 09:58:13 +0100 Subject: configs: Create minimal vexpress_fvp_defconfig The vexpress64 board family now relies on OF_CONTROL and OF_HAS_PRIOR_STAGE, so platform-specific configuration requirements are minimal. The vexpress_aemv8a_semi_defconfig file defines many flags that are not needed for a minimal boot, such as flash memory configuration. Therefore create vexpress_fvp_defconfig which contains the minimum configuration required to boot on an Arm v8a FVP. Signed-off-by: Peter Hoyes --- configs/vexpress_fvp_defconfig | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 configs/vexpress_fvp_defconfig diff --git a/configs/vexpress_fvp_defconfig b/configs/vexpress_fvp_defconfig new file mode 100644 index 00000000000..7362c1fc35c --- /dev/null +++ b/configs/vexpress_fvp_defconfig @@ -0,0 +1,5 @@ +CONFIG_ARM=y +CONFIG_ARCH_VEXPRESS64=y +CONFIG_DEFAULT_DEVICE_TREE="arm_fvp" +CONFIG_IDENT_STRING=" arm_fvp" +# CONFIG_DISPLAY_CPUINFO is not set -- cgit v1.2.3 From de0095b4009b9d75d0c101643c3de60cb26d456d Mon Sep 17 00:00:00 2001 From: Pavel Skripkin Date: Sun, 2 Apr 2023 19:27:34 +0300 Subject: arm64: interrupts: print FAR_ELx on sync exceptions Default synchronous exceptions handler prints only esr and register dump. Sometimes it requiers to see an address which caused exceptions to understand what's going on ARM ARM in section D13.2.41 states that FAR_EL2 will contain meanfull value in case of ESR.EC holds 0x20, 0x21, 0x24, 0x25, 0x22, 0x34 or 0x35. Same applies for EL1. This patch adds function whivh determine current EL, gets correct FAR register and prints it on panic. Signed-off-by: Pavel Skripkin --- arch/arm/lib/interrupts_64.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/arch/arm/lib/interrupts_64.c b/arch/arm/lib/interrupts_64.c index 2e091415a46..125dc0bb390 100644 --- a/arch/arm/lib/interrupts_64.c +++ b/arch/arm/lib/interrupts_64.c @@ -37,6 +37,40 @@ static void show_efi_loaded_images(struct pt_regs *regs) efi_print_image_infos((void *)regs->elr); } +static void dump_far(unsigned long esr) +{ + unsigned long el, far; + + switch ((esr >> 26) & 0b111111) { + case 0x20: + case 0x21: + case 0x24: + case 0x25: + case 0x22: + case 0x34: + case 0x35: + break; + default: + return; + } + + asm("mrs %0, CurrentEl": "=r" (el)); + + switch (el >> 2) { + case 1: + asm("mrs %0, FAR_EL1": "=r" (far)); + break; + case 2: + asm("mrs %0, FAR_EL2": "=r" (far)); + break; + default: + /* don't print anything to make output pretty */ + return; + } + + printf(", far 0x%lx", far); +} + static void dump_instr(struct pt_regs *regs) { u32 *addr = (u32 *)(regs->elr & ~3UL); @@ -165,7 +199,9 @@ void do_sync(struct pt_regs *pt_regs) smh_emulate_trap(pt_regs)) return; efi_restore_gd(); - printf("\"Synchronous Abort\" handler, esr 0x%08lx\n", pt_regs->esr); + printf("\"Synchronous Abort\" handler, esr 0x%08lx", pt_regs->esr); + dump_far(pt_regs->esr); + printf("\n"); show_regs(pt_regs); show_efi_loaded_images(pt_regs); panic("Resetting CPU ...\n"); -- cgit v1.2.3 From 0b8b7d47aa9ca85af3ba4f84ae5679a54188fd32 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 3 Apr 2023 12:04:39 +0200 Subject: test: improve configuration for Kconfig test options * Fix dependencies * Provide labels that are easier to grasp. * Fix typo %s/whgch/which/ * Fix type %s/Is/is/ Fixes: 29784d62eded ("test: Add some tests for kconfig.h") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/lib/Kconfig | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/lib/Kconfig b/test/lib/Kconfig index dbb03e4a36f..ae0aa2ff7ac 100644 --- a/test/lib/Kconfig +++ b/test/lib/Kconfig @@ -1,23 +1,24 @@ # SPDX-License-Identifier: GPL-2.0+ # Copyright 2022 Google LLC -if SANDBOX - config TEST_KCONFIG bool "Enable detection of Kconfig macro errors" + depends on SANDBOX help This is used to test that the IF_ENABLED_INT() macro causes a build error - if the value is used when the CONFIG Is not enabled. + if the value is used when the CONFIG is not enabled. + +if TEST_KCONFIG config TEST_KCONFIG_ENABLE - bool "Option to enable" + bool "Provide a value for the Kconfig test" help This is the option that controls whether the value is present. config TEST_KCONFIG_VALUE - int "Value associated with the option" + int "Value used in Kconfig test" depends on TEST_KCONFIG_ENABLE help - This is the value whgch is present if TEST_KCONFIG_ENABLE is enabled. + This is the value which is present if TEST_KCONFIG_ENABLE is enabled. -endif # SANDBOX +endif # TEST_KCONFIG -- cgit v1.2.3 From 005acb2a6d84912525a87b74beb9d50f000509e1 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 3 Apr 2023 20:27:43 +0200 Subject: test: move unit tests into a sub-menu The main configuration menu should not contain detail settings. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/Kconfig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/Kconfig b/test/Kconfig index 465028265b2..6e859fb7d0d 100644 --- a/test/Kconfig +++ b/test/Kconfig @@ -3,7 +3,9 @@ config POST help See doc/README.POST for more details -menuconfig UNIT_TEST +menu "Unit tests" + +config UNIT_TEST bool "Unit tests" help Select this to compile in unit tests for various parts of @@ -107,3 +109,5 @@ source "test/env/Kconfig" source "test/lib/Kconfig" source "test/optee/Kconfig" source "test/overlay/Kconfig" + +endmenu -- cgit v1.2.3 From 142155103d93949fddfeb07eac708991d55a0a50 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Wed, 5 Apr 2023 22:40:22 +0800 Subject: fs: yaffs2: Make yaffsfs_deviceList static yaffsfs_deviceList is only referenced in yaffsfs.c Signed-off-by: Bin Meng --- fs/yaffs2/yaffsfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/yaffs2/yaffsfs.c b/fs/yaffs2/yaffsfs.c index 510faaeed14..d615f02d3fc 100644 --- a/fs/yaffs2/yaffsfs.c +++ b/fs/yaffs2/yaffsfs.c @@ -468,7 +468,7 @@ static int yaffsfs_alt_dir_path(const YCHAR *path, YCHAR **ret_path) return 0; } -LIST_HEAD(yaffsfs_deviceList); +static LIST_HEAD(yaffsfs_deviceList); /* * yaffsfs_FindDevice -- cgit v1.2.3 From c2e5eea38a25c3b787bb243f7d9638cd6e634cd4 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 5 Apr 2023 19:48:51 -0400 Subject: arm: Only support ARM64_CRC32 when using GCC Today, only gcc has __builtin_aarch64_crc32b (clang-16 does not, for example). Make this option depend on CC_IS_GCC. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f0118e22541..d7e65780605 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -12,7 +12,7 @@ config ARM64 config ARM64_CRC32 bool "Enable support for CRC32 instruction" - depends on ARM64 + depends on ARM64 && CC_IS_GCC default y help ARMv8 implements dedicated crc32 instruction for crc32 calculation. -- cgit v1.2.3 From fd0712acce928c7966c172b8014ca8007deb457c Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 5 Apr 2023 19:48:52 -0400 Subject: clang: Add $(CLANG_TARGET) to LDPPFLAGS When we invoke $(CPP) to make u-boot.lds we have LDPPFLAGS available to set other required flags here. As this file is for the target and not the host, we must ensure that CPP knows what the target architecture is. For this, pass in $(CLANG_TARGET). Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index eaaf7d267d3..9d8ec9f8655 100644 --- a/Makefile +++ b/Makefile @@ -437,6 +437,7 @@ KBUILD_LDFLAGS := ifeq ($(cc-name),clang) ifneq ($(CROSS_COMPILE),) CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) +LDPPFLAGS += $(CLANG_TARGET) GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) -- cgit v1.2.3 From 4ad6850d2b4ad0de6eedffc781d8152ec736e234 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 5 Apr 2023 19:48:53 -0400 Subject: clang: Don't look for libgcc In the case of using clang to build, and having not already enabled the private libgcc, do not look for it, as it will not be found nor required. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 9d8ec9f8655..166acba2703 100644 --- a/Makefile +++ b/Makefile @@ -894,8 +894,10 @@ u-boot-main := $(libs-y) ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y) PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a else +ifndef CONFIG_CC_IS_CLANG PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc endif +endif PLATFORM_LIBS += $(PLATFORM_LIBGCC) ifdef CONFIG_CC_COVERAGE -- cgit v1.2.3 From a27c8ea7f7fc269c2bf40468568a387d9e8db976 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 5 Apr 2023 19:48:54 -0400 Subject: arm: Centralize fixed register logic When building for ARM64, we need to pass -ffixed-x18 and otherwise pass -ffixed-r9. Rather than having this logic in two places, we can do this once in arch/arm/config.mk. Further, while gcc will ignore being passed both -ffixed-r9 and -ffixed-x18 and simply use -ffixed-x18, clang will note that -ffixed-r9 is not used. Remove this duplication to also remove the warning. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- arch/arm/config.mk | 10 ++++++++-- arch/arm/cpu/armv8/config.mk | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/config.mk b/arch/arm/config.mk index bf781f10262..5530d02b66c 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -3,7 +3,13 @@ # (C) Copyright 2000-2002 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections \ +ifeq ($(CONFIG_ARM64),y) +FIXED_REG := -ffixed-x18 +else +FIXED_REG := -ffixed-r9 +endif + +CFLAGS_NON_EFI := -fno-pic $(FIXED_REG) -ffunction-sections -fdata-sections \ -fstack-protector-strong CFLAGS_EFI := -fpic -fshort-wchar @@ -15,7 +21,7 @@ ifneq ($(LTO_ENABLE),y) PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections endif -PLATFORM_RELFLAGS += -fno-common -ffixed-r9 +PLATFORM_RELFLAGS += -fno-common $(FIXED_REG) PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \ $(call cc-option,-mgeneral-regs-only) \ $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) diff --git a/arch/arm/cpu/armv8/config.mk b/arch/arm/cpu/armv8/config.mk index ca06ed3d4f9..4d74b2a533e 100644 --- a/arch/arm/cpu/armv8/config.mk +++ b/arch/arm/cpu/armv8/config.mk @@ -2,7 +2,6 @@ # # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, -PLATFORM_RELFLAGS += -fno-common -ffixed-x18 PLATFORM_RELFLAGS += $(call cc-option,-mbranch-protection=none) PF_NO_UNALIGNED := $(call cc-option, -mstrict-align) -- cgit v1.2.3 From b5fc9f99d0d5324b6159b3a1da7bb679cf5fc901 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 5 Apr 2023 19:48:55 -0400 Subject: armv7: Use isb/dsb directly in start.S Toolchains which do not directly support using "isb" and "dsb" directly are no longer functionally supported in U-Boot. Furthermore, clang has for a long time warned about using the alternate form that we were. Update the code. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- arch/arm/cpu/armv7/start.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index 7d7aac021e2..69e281b086a 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -134,8 +134,8 @@ ENTRY(c_runtime_cpu_setup) */ #if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF) mcr p15, 0, r0, c7, c5, 0 @ invalidate icache - mcr p15, 0, r0, c7, c10, 4 @ DSB - mcr p15, 0, r0, c7, c5, 4 @ ISB + dsb + isb #endif bx lr @@ -188,8 +188,8 @@ ENTRY(cpu_init_cp15) mcr p15, 0, r0, c8, c7, 0 @ invalidate TLBs mcr p15, 0, r0, c7, c5, 0 @ invalidate icache mcr p15, 0, r0, c7, c5, 6 @ invalidate BP array - mcr p15, 0, r0, c7, c10, 4 @ DSB - mcr p15, 0, r0, c7, c5, 4 @ ISB + dsb + isb /* * disable MMU stuff and caches -- cgit v1.2.3 From 51a765b37671b4460fdefef5000b9eb6988fddc8 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 5 Apr 2023 19:48:56 -0400 Subject: boot/image-board.c: Silence warning in select_ramdisk When building with clang we get a warning that rdaddr could be uninitialized in one case. While this cannot functionally happen, we can easily silence the warning. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- boot/image-board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/image-board.c b/boot/image-board.c index c602832249e..d500da1b4b9 100644 --- a/boot/image-board.c +++ b/boot/image-board.c @@ -328,7 +328,7 @@ static int select_ramdisk(struct bootm_headers *images, const char *select, u8 a bool done_select = !select; bool done = false; int rd_noffset; - ulong rd_addr; + ulong rd_addr = 0; char *buf; if (CONFIG_IS_ENABLED(FIT)) { -- cgit v1.2.3 From 73b39a76e34a3b88a7a2c58588c9a5a604a51d90 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 5 Apr 2023 19:48:57 -0400 Subject: usb: gadget: f_mass_storage: Rework do_request_sense slightly When building with clang, it notes that sdinfo may be unused uninitialized in some cases. This appears to be true from reading the code, and we can simply set the variable to zero to start with and be as correct as before. Signed-off-by: Tom Rini Reviewed-by: Marek Vasut --- drivers/usb/gadget/f_mass_storage.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 45f0504b6e8..f46829eb7ad 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -1117,7 +1117,7 @@ static int do_request_sense(struct fsg_common *common, struct fsg_buffhd *bh) { struct fsg_lun *curlun = &common->luns[common->lun]; u8 *buf = (u8 *) bh->buf; - u32 sd, sdinfo; + u32 sd, sdinfo = 0; int valid; /* @@ -1145,7 +1145,6 @@ static int do_request_sense(struct fsg_common *common, struct fsg_buffhd *bh) if (!curlun) { /* Unsupported LUNs are okay */ common->bad_lun_okay = 1; sd = SS_LOGICAL_UNIT_NOT_SUPPORTED; - sdinfo = 0; valid = 0; } else { sd = curlun->sense_data; -- cgit v1.2.3 From af2fde49fe53810224c67d8d1cbc8080466da907 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 5 Apr 2023 22:19:39 -0400 Subject: pytest: Use --lazy with umount Sometimes when doing tests on real hardware we sometimes run in to the case where some of these mounts haven't been fully flushed. Using the --lazy option with umount will allow us to continue while letting the OS handle flushing the data out still. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- test/py/tests/test_ut.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py index e8c8a6d6bd5..0b45863b438 100644 --- a/test/py/tests/test_ut.py +++ b/test/py/tests/test_ut.py @@ -213,7 +213,7 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} str(exc)) finally: if mounted: - u_boot_utils.run_and_log(cons, 'sudo umount %s' % mnt) + u_boot_utils.run_and_log(cons, 'sudo umount --lazy %s' % mnt) if loop: u_boot_utils.run_and_log(cons, 'sudo losetup -d %s' % loop) @@ -274,7 +274,7 @@ label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) str(exc)) finally: if mounted: - u_boot_utils.run_and_log(cons, 'sudo umount %s' % mnt) + u_boot_utils.run_and_log(cons, 'sudo umount --lazy %s' % mnt) if loop: u_boot_utils.run_and_log(cons, 'sudo losetup -d %s' % loop) -- cgit v1.2.3 From 44cd761ad665f38f87f064ed0df5c013ec5f88cb Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 6 Apr 2023 10:04:15 +0200 Subject: xen: Fix Kconfig dependencies XEN config can be enabled by other platforms (even it doesn't need to make sense) that's why fix dependencies. XEN (xenbus.c) requires sscanf (also pvblock needs it). And PVBLOCK is inside drivers/xen folder which requires XEN to be enabled. Signed-off-by: Michal Simek Reviewed-by: Heinrich Schuchardt --- Kconfig | 1 + arch/arm/Kconfig | 1 - drivers/xen/Kconfig | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Kconfig b/Kconfig index f24e4f0a331..b4de17afac7 100644 --- a/Kconfig +++ b/Kconfig @@ -175,6 +175,7 @@ config CC_HAS_ASM_INLINE config XEN bool "Select U-Boot be run as a bootloader for XEN Virtual Machine" + select SSCANF help Enabling this option will make U-Boot be run as a bootloader for XEN [1] Virtual Machine. diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d7e65780605..ab22c0e657d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -2044,7 +2044,6 @@ config TARGET_XENGUEST_ARM64 select OF_CONTROL select LINUX_KERNEL_IMAGE_HEADER select XEN_SERIAL - select SSCANF imply OF_HAS_PRIOR_STAGE config ARCH_GXP diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 0ee74d036c7..6cb9149fa77 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -1,6 +1,6 @@ config PVBLOCK bool "Xen para-virtualized block device" - depends on DM + depends on DM && XEN select BLK help This driver implements the front-end of the Xen virtual -- cgit v1.2.3 From 1bd790bc4bb025423ca2edac8f7694787d0a2a81 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 6 Apr 2023 18:23:17 +0800 Subject: firmware: psci: enable DM_FLAG_PRE_RELOC It is possible that cpu core may reset before relocation with PSCI reset Signed-off-by: Peng Fan --- drivers/firmware/psci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index ef3e9836461..c6b9efab41c 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -319,4 +319,5 @@ U_BOOT_DRIVER(psci) = { #ifdef CONFIG_ARM_SMCCC_FEATURES .plat_auto = sizeof(struct psci_plat_data), #endif + .flags = DM_FLAG_PRE_RELOC, }; -- cgit v1.2.3 From 439b9383ee1a22ffb589e007745ffbeaf7806465 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 6 Apr 2023 18:23:18 +0800 Subject: sysreset: psci: enable DM_FLAG_PRE_RELOC It is possible that cpu core may reset before relocation with PSCI reset Signed-off-by: Peng Fan --- drivers/sysreset/sysreset_psci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/sysreset/sysreset_psci.c b/drivers/sysreset/sysreset_psci.c index 83ecbcb9d2c..30c4b9c1f5d 100644 --- a/drivers/sysreset/sysreset_psci.c +++ b/drivers/sysreset/sysreset_psci.c @@ -34,4 +34,5 @@ U_BOOT_DRIVER(psci_sysreset) = { .name = "psci-sysreset", .id = UCLASS_SYSRESET, .ops = &psci_sysreset_ops, + .flags = DM_FLAG_PRE_RELOC, }; -- cgit v1.2.3 From 6326519f5755bbb72ff2f1b4747236790b5bb980 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 6 Apr 2023 18:23:19 +0800 Subject: sysreset: psci: add psci_sysreset_get_status Add weak function psci_sysreset_get_status for platform to define their own reset status with CONFIG_SYSRESET enabled. Signed-off-by: Peng Fan --- drivers/sysreset/sysreset_psci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/sysreset/sysreset_psci.c b/drivers/sysreset/sysreset_psci.c index 30c4b9c1f5d..a8a41528a84 100644 --- a/drivers/sysreset/sysreset_psci.c +++ b/drivers/sysreset/sysreset_psci.c @@ -9,6 +9,11 @@ #include #include +__weak int psci_sysreset_get_status(struct udevice *dev, char *buf, int size) +{ + return -EOPNOTSUPP; +} + static int psci_sysreset_request(struct udevice *dev, enum sysreset_t type) { switch (type) { @@ -28,6 +33,7 @@ static int psci_sysreset_request(struct udevice *dev, enum sysreset_t type) static struct sysreset_ops psci_sysreset_ops = { .request = psci_sysreset_request, + .get_status = psci_sysreset_get_status, }; U_BOOT_DRIVER(psci_sysreset) = { -- cgit v1.2.3 From ac44c6cf957a91cea5271334c2d6e6cd867cb5d6 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 6 Apr 2023 09:48:58 -0400 Subject: api: Rework menu, and make it depend on CC_IS_GCC We can only use the old U-Boot API for standalone applications when building U-Boot with GCC as it relies upon the "gd is a register" trick that only GCC supports. Further, rework the rest of the options so that they are in the API menu and only visible if API support is enabled. Reported-by: Heinrich Schuchardt Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- api/Kconfig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/Kconfig b/api/Kconfig index 6072288f9bc..b5a7399d7f3 100644 --- a/api/Kconfig +++ b/api/Kconfig @@ -1,13 +1,14 @@ -menu "API" - config API bool "Enable U-Boot API" + depends on CC_IS_GCC help This option enables the U-Boot API. See api/README for more information. +menu "API" + depends on API + config SYS_MMC_MAX_DEVICE int "Maximum number of MMC devices exposed via the API" - depends on API default 1 config EXAMPLES -- cgit v1.2.3 From e97c89cc15b90c72dcf6a7a943fb52743a1f70fa Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 6 Apr 2023 09:58:40 -0400 Subject: qemu: dfu: Correct memset call in set_dfu_alt_info When building with clang, we see: board/emulation/common/qemu_dfu.c:51:24: warning: 'memset' call operates on objects of type 'char' while the size is based on a different type 'char *' [-Wsizeof-pointer-memaccess] As we're calling memset with the length set to the size of the pointer and not the size of the buffer. Correct this with a call of the size of the buffer itself. Signed-off-by: Tom Rini Reviewed-by: Simon Glass Acked-by: Sughosh Ganu --- board/emulation/common/qemu_dfu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/emulation/common/qemu_dfu.c b/board/emulation/common/qemu_dfu.c index 332d659c1f7..7e7d84f6c00 100644 --- a/board/emulation/common/qemu_dfu.c +++ b/board/emulation/common/qemu_dfu.c @@ -48,7 +48,7 @@ void set_dfu_alt_info(char *interface, char *devstr) env_get("dfu_alt_info")) return; - memset(buf, 0, sizeof(buf)); + memset(buf, 0, DFU_ALT_BUF_LEN); /* * Currently dfu_alt_info is needed on Qemu ARM64 for -- cgit v1.2.3 From 23fd87c489276050b229b469c0cba4cb0e9d7a59 Mon Sep 17 00:00:00 2001 From: Sinan Akman Date: Fri, 7 Apr 2023 18:03:44 -0400 Subject: mpc8379erdb: Convert to using DM_SERIAL Convert to DM_SERIAL for mpc8379erdb. Signed-off-by: Sinan Akman --- arch/powerpc/dts/mpc8379erdb.dts | 27 +++++++++++++++++++++++++++ configs/MPC837XERDB_defconfig | 7 ++++++- include/configs/MPC837XERDB.h | 2 ++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/dts/mpc8379erdb.dts b/arch/powerpc/dts/mpc8379erdb.dts index 2e7c8f103c3..3db5ececaec 100644 --- a/arch/powerpc/dts/mpc8379erdb.dts +++ b/arch/powerpc/dts/mpc8379erdb.dts @@ -13,6 +13,11 @@ #address-cells = <1>; #size-cells = <1>; + aliases { + serial0 = &serial0; + serial1 = &serial1; + }; + cpus { #address-cells = <1>; #size-cells = <0>; @@ -60,6 +65,28 @@ clock-frequency = <0>; }; + serial0: serial@4500 { + cell-index = <0>; + device_type = "serial"; + compatible = "fsl,ns16550", "ns16550"; + reg = <0x4500 0x100>; + clock-frequency = <333333000>; + interrupts = <9 0x8>; + interrupt-parent = <&ipic>; + bootph-all; + }; + + serial1: serial@4600 { + cell-index = <1>; + device_type = "serial"; + compatible = "fsl,ns16550", "ns16550"; + reg = <0x4600 0x100>; + clock-frequency = <333333000>; + interrupts = <10 0x8>; + interrupt-parent = <&ipic>; + bootph-all; + }; + ipic: interrupt-controller@700 { compatible = "fsl,ipic"; interrupt-controller; diff --git a/configs/MPC837XERDB_defconfig b/configs/MPC837XERDB_defconfig index 8f3f54cb4f2..7bb878f3697 100644 --- a/configs/MPC837XERDB_defconfig +++ b/configs/MPC837XERDB_defconfig @@ -4,6 +4,8 @@ CONFIG_SYS_MALLOC_LEN=0x80000 CONFIG_ENV_SIZE=0x4000 CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_DEFAULT_DEVICE_TREE="mpc8379erdb" +CONFIG_DEBUG_UART_BASE=0xe0004500 +CONFIG_DEBUG_UART_CLOCK=333333000 CONFIG_SYS_CLK_FREQ=66666667 CONFIG_ENV_ADDR=0xFE080000 # CONFIG_SYS_PCI_64BIT is not set @@ -118,6 +120,7 @@ CONFIG_LCRR_DBYP_PLL_BYPASSED=y CONFIG_LCRR_CLKDIV_8=y CONFIG_FSL_SERDES=y CONFIG_USE_UBOOTPATH=y +CONFIG_DEBUG_UART=y CONFIG_SYS_MONITOR_LEN=524288 CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -185,7 +188,9 @@ CONFIG_MII=y CONFIG_VSC7385_ENET=y CONFIG_TSEC_ENET=y CONFIG_RTC_DS1374=y -CONFIG_SYS_NS16550_SERIAL=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_FSL=y diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h index 70b1c399241..3967cc28363 100644 --- a/include/configs/MPC837XERDB.h +++ b/include/configs/MPC837XERDB.h @@ -140,7 +140,9 @@ /* * Serial Port */ +#if !CONFIG_IS_ENABLED(DM_SERIAL) && !CONFIG_IS_ENABLED(DM_CLK) #define CFG_SYS_NS16550_CLK get_bus_freq(0) +#endif #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 115200} -- cgit v1.2.3 From cc6259832a11093f5c6dd0183263de26eb49d8b1 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Tue, 11 Apr 2023 17:07:02 +0200 Subject: ata: pci: enable bus mastering The non DM code path already would enable pci bus mastering. Do the same for the DM code path. Fixes AHCI problems I am seeing on an Intel Apollolake device. Signed-off-by: Christian Gmeiner Reviewed-by: Bin Meng [trini: Use ahci_dev not dev in the calls] Signed-off-by: Tom Rini --- drivers/ata/ahci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 6998b82aa51..cb2c648a91f 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1152,7 +1152,12 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base) int ahci_probe_scsi_pci(struct udevice *ahci_dev) { ulong base; - u16 vendor, device; + u16 vendor, device, cmd; + + /* Enable bus mastering */ + dm_pci_read_config16(ahci_dev, PCI_COMMAND, &cmd); + cmd |= PCI_COMMAND_MASTER; + dm_pci_write_config16(ahci_dev, PCI_COMMAND, cmd); base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5, 0, 0, PCI_REGION_TYPE, PCI_REGION_MEM); -- cgit v1.2.3 From 51e0cacca7b8039a6c37cbd6b5f77ac2e91045f2 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Wed, 12 Apr 2023 12:24:26 +0100 Subject: tools: env: update lock path in README Commit aeb40f1166e0 ("tools: env: use /run to store lockfile") updated the path to the lockfile but did not update the documentation to match. Use the new path in the documentation. Fixes: aeb40f1166 ("tools: env: use /run to store lockfile") Signed-off-by: John Keeping Reviewed-by: Simon Glass --- tools/env/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/env/README b/tools/env/README index 709251383c6..480a893202f 100644 --- a/tools/env/README +++ b/tools/env/README @@ -59,5 +59,5 @@ this environment instance. On NAND this is used to limit the range within which bad blocks are skipped, on NOR it is not used. To prevent losing changes to the environment and to prevent confusing the MTD -drivers, a lock file at /var/lock/fw_printenv.lock is used to serialize access +drivers, a lock file at /run/fw_printenv.lock is used to serialize access to the environment. -- cgit v1.2.3 From 7add47959ed24a9cb7ffef081d2f9b5bdb8ae275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 13 Apr 2023 22:34:43 +0200 Subject: arm: omap3: Directly use SMC #1 in lowlevel_init.S MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit de39dc71625d ("arm: armv7-a: Compile and tune for armv7-a instead of armv5") is used -march=armv7-a option for Omap3 platforms. With directive ".arch_extension sec" it is possible for -march=armv7-a to directly use ARM SMC instruction. So enable ".arch_extension sec" in Omap3 lowlevel_init.S and replace hand assembled ".word 0xe1600071" by "SMC #1". Since commit 51d063865064 ("arm: omap-common: add secure smc entry") same pattern is already used in arch/arm/cpu/armv7/omap-common/lowlevel_init.S. Signed-off-by: Pali Rohár --- arch/arm/mach-omap2/omap3/lowlevel_init.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/omap3/lowlevel_init.S b/arch/arm/mach-omap2/omap3/lowlevel_init.S index ab7cdcf3d42..1ab9472e198 100644 --- a/arch/arm/mach-omap2/omap3/lowlevel_init.S +++ b/arch/arm/mach-omap2/omap3/lowlevel_init.S @@ -15,13 +15,14 @@ #include #include +.arch_extension sec + /* * Funtion for making PPA HAL API calls in secure devices * Input: * R0 - Service ID * R1 - paramer list */ -/* TODO: Re-evaluate the comment at the end regarding armv5 vs armv7 */ ENTRY(do_omap3_emu_romcode_call) PUSH {r4-r12, lr} @ Save all registers from ROM code! MOV r12, r0 @ Copy the Secure Service ID in R12 @@ -32,8 +33,7 @@ ENTRY(do_omap3_emu_romcode_call) MOV r6, #0xFF @ Indicate new Task call mcr p15, 0, r0, c7, c10, 4 @ DSB mcr p15, 0, r0, c7, c10, 5 @ DMB - .word 0xe1600071 @ SMC #1 to call PPA service - hand assembled - @ because we use -march=armv5 + SMC #1 @ Call PPA service POP {r4-r12, pc} ENDPROC(do_omap3_emu_romcode_call) -- cgit v1.2.3 From 539486787ec8bd9337c497171ff8bd67625a51a9 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 18 Apr 2023 14:51:55 +0200 Subject: xen: Add dependency on armv8 U-Boot currently implements hypervisor calls only for ARM64 that's why add dependency on ARM64. The hardware functionality is also available on ARMv7a, but currently not supported by U-Boot, hence it is not added to the list of dependencies here. Signed-off-by: Michal Simek --- Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/Kconfig b/Kconfig index b4de17afac7..888b9984ac3 100644 --- a/Kconfig +++ b/Kconfig @@ -175,6 +175,7 @@ config CC_HAS_ASM_INLINE config XEN bool "Select U-Boot be run as a bootloader for XEN Virtual Machine" + depends on ARM64 select SSCANF help Enabling this option will make U-Boot be run as a bootloader -- cgit v1.2.3 From b411ba921005f8aa7978dbd1c5fee630c4af298d Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 18 Apr 2023 14:51:56 +0200 Subject: xen: Limit execution to EL1 only Xen core_init() is calling HVC which should be called from EL1 level that's why do Xen initialization only when U-Boot runs in EL1. Signed-off-by: Michal Simek --- drivers/xen/hypervisor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/xen/hypervisor.c b/drivers/xen/hypervisor.c index 16c7c96c94e..0b2311ba267 100644 --- a/drivers/xen/hypervisor.c +++ b/drivers/xen/hypervisor.c @@ -264,8 +264,15 @@ void clear_evtchn(uint32_t port) int xen_init(void) { + int el = current_el(); + debug("%s\n", __func__); + if (el != 1) { + puts("XEN:\tnot running from EL1\n"); + return 0; + } + map_shared_info(NULL); init_events(); init_xenbus(); -- cgit v1.2.3 From 0fac5c47e4b82b78740264fd4ca53cd2ab28b34e Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 19 Apr 2023 12:10:13 +0200 Subject: gpio-uclass: fix off-by-one in gpio_request_list_by_name_nodev() By the time we jump to the err label, count represents the number of gpios we've successfully requested. So by subtracting one, we fail to free the most recently requested. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- drivers/gpio/gpio-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index c8be5a4d668..712119c3415 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -1219,7 +1219,7 @@ int gpio_request_list_by_name_nodev(ofnode node, const char *list_name, return count; err: - gpio_free_list_nodev(desc, count - 1); + gpio_free_list_nodev(desc, count); return ret; } -- cgit v1.2.3