From e6e3b9d7b55ce2563f9da0b5991605f15bd38163 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Thu, 20 Jan 2022 16:17:30 -0300 Subject: xilinx: common: change bootm_size to not go beyond ram_top The available ram can be limited by ram_top as that depends on the reserved memory nodes provided by the device-tree (via board_get_usable_ram_top), so make sure to respect ram_top when setting up bootm_size to avoid overlapping reserved memory regions (e.g. memory used by OP-TEE). The same logic is available in env_get_bootm_size when bootm_size is not defined by the default environment. Signed-off-by: Ricardo Salveti Link: https://lore.kernel.org/r/20220120191730.2009270-1-ricardo@foundries.io Signed-off-by: Michal Simek --- board/xilinx/common/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'board') diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 78a5d0e..6fce231 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -377,7 +377,7 @@ int board_late_init_xilinx(void) u32 ret = 0; int i, id, macid = 0; struct xilinx_board_description *desc; - phys_size_t bootm_size = gd->ram_size; + phys_size_t bootm_size = gd->ram_top - gd->ram_base; if (!CONFIG_IS_ENABLED(MICROBLAZE)) { ulong scriptaddr; -- cgit v1.1 From 25a91f300578d5905029d5f44799ef71a755ff02 Mon Sep 17 00:00:00 2001 From: Jorge Ramirez-Ortiz Date: Wed, 13 Oct 2021 19:04:47 +0200 Subject: arm64: zynqmp: Print the secure boot status information Output the secure boot configuration to the console. Signed-off-by: Jorge Ramirez-Ortiz Link: https://lore.kernel.org/r/20211013170447.10414-1-jorge@foundries.io Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'board') diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 2b5239c..242e143 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -373,6 +373,18 @@ static void restore_jtag(void) } #endif +static void print_secure_boot(void) +{ + u32 status = 0; + + if (zynqmp_mmio_read((ulong)&csu_base->status, &status)) + return; + + printf("Secure Boot:\t%sauthenticated, %sencrypted\n", + status & ZYNQMP_CSU_STATUS_AUTHENTICATED ? "" : "not ", + status & ZYNQMP_CSU_STATUS_ENCRYPTED ? "" : "not "); +} + #define PS_SYSMON_ANALOG_BUS_VAL 0x3210 #define PS_SYSMON_ANALOG_BUS_REG 0xFFA50914 @@ -413,6 +425,8 @@ int board_init(void) fpga_add(fpga_xilinx, &zynqmppl); #endif + /* display secure boot information */ + print_secure_boot(); if (current_el() == 3) printf("Multiboot:\t%d\n", multi_boot()); -- cgit v1.1 From fac46bc446e0ca2e5bd8fa4d28f243ee4a1d8995 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 14 Jan 2022 13:25:38 +0100 Subject: arm64: zynqmp: Add command for disabling loading other overlays Add command "zynqmp pmufw node close" to disable permission to load additional pmufw config overlays. This command will make sure that any other sw will ask for changing permission. Signed-off-by: Michal Simek Link: https://lore.kernel.org/r/cfa5cc7909eb8deb23eb0f11c26954cbaddeb861.1642163135.git.michal.simek@xilinx.com --- board/xilinx/zynqmp/cmds.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'board') diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c index 5a277c7..2ab9596 100644 --- a/board/xilinx/zynqmp/cmds.c +++ b/board/xilinx/zynqmp/cmds.c @@ -209,6 +209,19 @@ static int do_zynqmp_pmufw(struct cmd_tbl *cmdtp, int flag, int argc, if (argc != cmdtp->maxargs) return CMD_RET_USAGE; + if (!strncmp(argv[2], "node", 4)) { + u32 id; + + if (!strncmp(argv[3], "close", 5)) + return zynqmp_pmufw_config_close(); + + id = dectoul(argv[3], NULL); + + printf("Enable permission for node ID %d\n", id); + + return zynqmp_pmufw_node(id); + } + addr = hextoul(argv[2], NULL); size = hextoul(argv[3], NULL); @@ -416,6 +429,9 @@ static char zynqmp_help_text[] = " lock(0)/split(1)\n" #endif "zynqmp pmufw address size - load PMU FW configuration object\n" + "zynqmp pmufw node - load PMU FW configuration object\n" + "zynqmp pmufw node close - disable config object loading\n" + " node: keyword, id: NODE_ID in decimal format\n" "zynqmp rsa srcaddr srclen mod exp rsaop -\n" " Performs RSA encryption and RSA decryption on blob of data\n" " at srcaddr and puts it back in srcaddr using modulus and\n" -- cgit v1.1 From 1669b3d1a0b56178ec8123c48fbf6dabe46b23a4 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Sun, 13 Feb 2022 10:09:20 +0200 Subject: microblaze: exception: migrate MICROBLAZE_V5 to Kconfig Also, rename it to XILINX_MICROBLAZE0_DELAY_SLOT_EXCEP, since it only covers delay slot exception support. Signed-off-by: Ovidiu Panait Link: https://lore.kernel.org/r/20220213080925.1548411-2-ovidiu.panait@windriver.com Signed-off-by: Michal Simek --- board/xilinx/microblaze-generic/Kconfig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'board') diff --git a/board/xilinx/microblaze-generic/Kconfig b/board/xilinx/microblaze-generic/Kconfig index e31257d..117b476 100644 --- a/board/xilinx/microblaze-generic/Kconfig +++ b/board/xilinx/microblaze-generic/Kconfig @@ -47,6 +47,15 @@ config XILINX_MICROBLAZE0_USR_EXCEP the exception vector table. The user exception vector is located at C_BASE_VECTORS + 0x8 address. +config XILINX_MICROBLAZE0_DELAY_SLOT_EXCEP + bool "MicroBlaze delay slot exception support" + default y + help + Enable this option if the MicroBlaze processor supports exceptions + caused by delay slot instructions (processor version >= v5.00). When + enabled, the hw exception handler will print a message indicating + whether the exception was triggered by a delay slot instruction. + config XILINX_MICROBLAZE0_VECTOR_BASE_ADDR hex "Location of MicroBlaze vectors" default 0x0 -- cgit v1.1 From f063100593942a33d8bf40dbc95b4b44e417a368 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 17 Feb 2022 14:28:38 +0100 Subject: xilinx: Enable OF_BOARD for zynq and zynqmp boards The commit 985503439762 ("fdt: Don't call board_fdt_blob_setup() without OF_BOARD") forced to enable OF_BOARD for platforms which provide DT externally. Zynq/ZynqMP boards are using this feature for a long time that's why there is a need to enable it by default. Also code expects to return error in case of error that's why also fill it. Signed-off-by: Michal Simek Link: https://lore.kernel.org/r/9f11bbffe2849f4da7d72712082d579262fe8fd8.1645104518.git.michal.simek@xilinx.com --- board/xilinx/common/board.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'board') diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 6fce231..0068cb8 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -319,7 +319,7 @@ __maybe_unused int xilinx_read_eeprom(void) return 0; } -#if defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE) +#if defined(CONFIG_OF_BOARD) void *board_fdt_blob_setup(int *err) { void *fdt_blob; @@ -355,6 +355,7 @@ void *board_fdt_blob_setup(int *err) debug("DTB is also not passed via %p\n", fdt_blob); + *err = -EINVAL; return NULL; } #endif -- cgit v1.1 From 83d2941fe9750f7d98d560d7782edcf31b574d3d Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 17 Feb 2022 14:28:40 +0100 Subject: arm64: zynqmp: Fix dependencies around ZYNQMP_PSU_INIT_ENABLED ZYNQMP_PSU_INIT_ENABLED is called only when BOARD_EARLY_INIT_F is defined that's why cover this dependency in Kconfig. board_early_init_f() is only part related to CONFIG_ZYNQMP_PSU_INIT_ENABLED which is disabled now that's why disable BOARD_EARLY_INIT_F and also build board_early_init_f() only when CONFIG_BOARD_EARLY_INIT_F is enabled. Signed-off-by: Michal Simek Link: https://lore.kernel.org/r/d89253ec1590cd513dcd4bfbedebae618bd6d605.1645104518.git.michal.simek@xilinx.com --- board/xilinx/zynqmp/zynqmp.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'board') diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 242e143..3a10ed8 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -313,6 +313,7 @@ static char *zynqmp_get_silicon_idcode_name(void) } #endif +#if defined(CONFIG_BOARD_EARLY_INIT_F) int board_early_init_f(void) { #if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED) @@ -345,6 +346,7 @@ int board_early_init_f(void) return 0; } +#endif static int multi_boot(void) { -- cgit v1.1 From 05f0f269b7a6e5c9b65e88bb8b691e28cb49da84 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 17 Feb 2022 14:28:41 +0100 Subject: ARM: zynq: Fix debug uart initialization The commit 0dba45864b2a ("arm: Init the debug UART") calls debug_uart_init() from crt0.S but it won't work because SOC is not configured yet. That's why create board_debug_uart_init() which calls ps7_init() earlier before the first access to UART. Signed-off-by: Michal Simek Link: https://lore.kernel.org/r/18e67e02a0c7190839a1ef3a11f3fd6babcf34cc.1645104518.git.michal.simek@xilinx.com --- board/xilinx/zynq/board.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'board') diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 1111ad6..26ef048 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -25,6 +25,13 @@ DECLARE_GLOBAL_DATA_PTR; +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DEBUG_UART_BOARD_INIT) +void board_debug_uart_init(void) +{ + /* Add initialization sequence if UART is not configured */ +} +#endif + int board_init(void) { if (IS_ENABLED(CONFIG_SPL_BUILD)) -- cgit v1.1 From 11381fba99dcadf9fa59dec08d78b730042ab134 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 17 Feb 2022 14:28:42 +0100 Subject: arm64: zynqmp: Fix debug uart initialization The commit 0dba45864b2a ("arm: Init the debug UART") calls debug_uart_init() from crt0.S but it won't work because SOC is not configured yet. That's why create board_debug_uart_init() which calls psu_init() via new psu_uboot_init() earlier before the first access to UART in SPL. In full U-Boot call psu_uboot_init() only when CONFIG_ZYNQMP_PSU_INIT_ENABLED is enabled. Signed-off-by: Michal Simek Link: https://lore.kernel.org/r/878dc2daaa8685346f889989fbfb98b2e44da7fb.1645104518.git.michal.simek@xilinx.com --- board/xilinx/zynqmp/zynqmp.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'board') diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 3a10ed8..70b3c81 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -313,10 +313,8 @@ static char *zynqmp_get_silicon_idcode_name(void) } #endif -#if defined(CONFIG_BOARD_EARLY_INIT_F) -int board_early_init_f(void) +int __maybe_unused psu_uboot_init(void) { -#if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED) int ret; ret = psu_init(); @@ -336,16 +334,30 @@ int board_early_init_f(void) /* Delay is required for clocks to be propagated */ udelay(1000000); -#endif + + return 0; +} -#ifdef CONFIG_DEBUG_UART - /* Uart debug for sure */ - debug_uart_init(); - puts("Debug uart enabled\n"); /* or printch() */ -#endif +#if !defined(CONFIG_SPL_BUILD) +# if defined(CONFIG_DEBUG_UART_BOARD_INIT) +void board_debug_uart_init(void) +{ +# if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED) + psu_uboot_init(); +# endif +} +# endif - return 0; +# if defined(CONFIG_BOARD_EARLY_INIT_F) +int board_early_init_f(void) +{ + int ret = 0; +# if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED) && !defined(CONFIG_DEBUG_UART_BOARD_INIT) + ret = psu_uboot_init(); +# endif + return ret; } +# endif #endif static int multi_boot(void) -- cgit v1.1