From patchwork Mon May 31 10:14:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1485622 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=JeEAai7f; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ftrl92nb1z9sW6 for ; Mon, 31 May 2021 20:15:17 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E84882D71; Mon, 31 May 2021 12:15:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="JeEAai7f"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E95682E76; Mon, 31 May 2021 12:14:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BAF7780F0E for ; Mon, 31 May 2021 12:14:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ed1-x536.google.com with SMTP id b11so6060592edy.4 for ; Mon, 31 May 2021 03:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6LVjrnzFFWsUGREOfNe9A2inFek/B/TQ5F9ELdUR1RY=; b=JeEAai7fxxZzMzubx4BQvE9PmzlBUaU8RGLpG4VY9xBQ6zs6WZFIhZVa3mQDzhKWNE kwPMZkHsieGy2iGQA1qQfQzN9wiRb+mUFw1Sr4dalDyF2FP59CUpdLmJkV5OzSILAfR2 wMRQullalGkjVtftXAfk1lnJNcA5fC5qe9C0dYdVVdXISZJafx4lBLwsJsJW3XcXBWf0 HKWsY1ZzdEF2PaO2wYngTI/wD+tTZbAGBIyX9QHlmFTH0A4Kz7SoNHfUmUPrWhesMTMs 29ecM+5TibEtDKa+/Y99RBj5LC69dC+2RHH5MNTvJOezjqWgpgGI7UL4IgGJ+lmN1HBv W+QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6LVjrnzFFWsUGREOfNe9A2inFek/B/TQ5F9ELdUR1RY=; b=H/N508j2kCJQllGcWZidcblceduCDzBSR6tmKo9HeCArkaCNl0wjPwh/ggyweB0DpC 6jlEkAHcjEqJN7NjFPmKDmk8mxbcfrkxDVH+yghb1Z1JgrgZfACKJKst8/aFPL2dfGZu YkiAHoGIDwUGuubbduOIsU3T/xgIGgjz+jdrEUxh9OJYVtkdCn7wNLHDYdMXpJTLf6I3 DhjKOGPas7UkvDi/7BIcAtW9jjHMjuU3n7gIHEv2N5YYmMqIVdbK6NOcjT1TX87XwBgA elKP+OCV9Pa09Yc9QTfhdz4IkdAPqhkulMakyzmveSd/YGgrsYcEQd0kZQ+GJQxD3O/+ Kwlg== X-Gm-Message-State: AOAM5320p/c1YJ1topxxiVfBEAT0BpWdku8lHMTUnGciDJlAsEoKIY+2 KNOMog4I66Mznif06WjKiVsxsBPEKxijd1dH X-Google-Smtp-Source: ABdhPJzc2vizX0DfK4dMDJApMWErMNHICfhAbkM+OEx9/8M/MiUb9tHpG2mIymoKKdh6R34t1h4hzw== X-Received: by 2002:aa7:cd19:: with SMTP id b25mr22627870edw.84.1622456090284; Mon, 31 May 2021 03:14:50 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::e05]) by smtp.gmail.com with ESMTPSA id z17sm5760734ejc.69.2021.05.31.03.14.49 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 May 2021 03:14:49 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com, Ricardo Salveti Subject: [PATCH 1/3] zynqmp: Do not place u-boot to reserved memory location Date: Mon, 31 May 2021 12:14:45 +0200 Message-Id: <9db36046a3f60dd15a69fe2257b32ce098638ce2.1622456084.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean TF-A and SecureOS can allocate the part of DDR for self but U-Boot is not handling this configuration that the part of memory is reserved and shouldn't be used by U-Boot. That's why read all reserved memory locations and don't use it. The code was taken from commit 4a1b975dac02 ("board: stm32mp1: reserve memory for OP-TEE in device tree") and commit 1419e5b5167e ("stm32mp: update MMU config before the relocation") which is used by stm32 and does the job properly. Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 46dee80470fa..3fe0b0dc29f6 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include #include @@ -442,6 +444,25 @@ int dram_init(void) return 0; } + +ulong board_get_usable_ram_top(ulong total_size) +{ + phys_size_t size; + phys_addr_t reg; + struct lmb lmb; + + /* found enough not-reserved memory to relocated U-Boot */ + lmb_init(&lmb); + lmb_add(&lmb, gd->ram_base, gd->ram_size); + boot_fdt_add_mem_rsv_regions(&lmb, (void *)gd->fdt_blob); + size = ALIGN(CONFIG_SYS_MALLOC_LEN + total_size, MMU_SECTION_SIZE), + reg = lmb_alloc(&lmb, size, MMU_SECTION_SIZE); + + if (!reg) + reg = gd->ram_top - size; + + return reg + size; +} #else int dram_init_banksize(void) { From patchwork Mon May 31 10:14:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1485623 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=bJ99TPMC; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FtrlL45ZQz9sVb for ; Mon, 31 May 2021 20:15:26 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DC14082E88; Mon, 31 May 2021 12:15:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="bJ99TPMC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B75B782E76; Mon, 31 May 2021 12:14:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2C2D482B1C for ; Mon, 31 May 2021 12:14:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x62d.google.com with SMTP id l3so15939938ejc.4 for ; Mon, 31 May 2021 03:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h2KbVdTXSGIW3C1b2d9IOuFtzf49W+dux/kqTW0JW/M=; b=bJ99TPMCt0H+sQ7B28lbkdpN9gnsMcjxKvbeBVXtNdZmqiCtrPQkBMEEG0WdiTP0MR u47I1XSheq223ctNA/5wELU0NWx00rkns6yxb0yAZOL1ZMMFQIabj0w/SQd6zOktUD3x ABmt7at4QrKFJgtI3v5oO5g0tOm2atKgo4Ur+I3sA6YFwR1BaVeGhNj4uwW1t1MQImx4 QEVg7H8OTc4ZcibclRinQPI4kAqH7uBbHdMFqeYH440R59T0fCeTvPdrD+j0BnAP/LEx 390RL5Az/hIT2wBfkblQpKrbmAn7Z8lLp1lEbejRaGSMSZN9/MGaR4QSkRKHo4egackQ 5W/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=h2KbVdTXSGIW3C1b2d9IOuFtzf49W+dux/kqTW0JW/M=; b=FPbsR/vtmr7Ssymqc2WhjeRtLdvwqBIgcScr3DCTQJfnuY/5GUaMwTdgRNdVdLBQad Ni/IhdNtgKX7VDjhMUPa/mBnCGvyPkRjpeqI3BadsEDvxTCvQ5WkB/Um+hbME1xYGgVX 1PNnQZNCQNed27leyWwb8zy9OTMxMYrbZ9FcIEsZz4Ve0teV34JO77fJ6ArAJZcuBLEt E9t51ldHRXH1SiGlH+MoJWK7KCE7SE0gcfRsLSzjApUCQUpyLwLTi0oSpj6gZLbnEm4z AiWMLr9ANDUxQN8MiAK8N++b+smM7QrZa16x+FkrIQZUSlQc1xxiD39IZeFAYECumwSL n8LQ== X-Gm-Message-State: AOAM532ne+dRl8+b5L1q358I4vAmUacJDp0rgWYd9en4LQCN/edotCno shCRENv4Nu1g2TEA1K8xY2xeEgDjEtafKG1/ X-Google-Smtp-Source: ABdhPJzwTqmbGPxC0xOVXde2LUfAVghTsLeFTc/FPdNmN/9wl0fsXngJEz9y+Q64gH42gDTJHdqr+g== X-Received: by 2002:a17:907:9602:: with SMTP id gb2mr13257059ejc.159.1622456091675; Mon, 31 May 2021 03:14:51 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::e05]) by smtp.gmail.com with ESMTPSA id hz10sm5771482ejc.40.2021.05.31.03.14.51 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 May 2021 03:14:51 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com, Ricardo Salveti Subject: [PATCH 2/3] zynqmp: Generate u-boot.its also with TEE dynamically Date: Mon, 31 May 2021 12:14:46 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean The first change is to trying to find out TF-A load address based on reading elf file. Expectation is that bl31.bin is in the same folder as bl31.elf. It brings new flexibility to place TF-A to any address (DDR included). And also enable TEE generation also with TEE configuration. Expecation is the same as above that tee.bin and tee.elf are in the same folder. User has to just define link to BL31/BL32 binary files and the rest should be handled by the script. Signed-off-by: Michal Simek --- I am using bash that's why not sure if ${BL31%.*} will work on other shells but let's see. --- arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 41 ++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-zynqmp/mkimage_fit_atf.sh b/arch/arm/mach-zynqmp/mkimage_fit_atf.sh index 92e31849f88d..700871dbe109 100755 --- a/arch/arm/mach-zynqmp/mkimage_fit_atf.sh +++ b/arch/arm/mach-zynqmp/mkimage_fit_atf.sh @@ -8,9 +8,19 @@ BL33="u-boot-nodtb.bin" [ -z "$BL31" ] && BL31="bl31.bin" -# Can be also done as ${CROSS_COMPILE}readelf -l bl31.elf | awk '/Entry point/ { print $3 }' +BL31_ELF="${BL31%.*}.elf" +[ -f ${BL31_ELF} ] && ATF_LOAD_ADDR=`${CROSS_COMPILE}readelf -l "${BL31_ELF}" | \ +awk '/Entry point/ { print $3 }'` + [ -z "$ATF_LOAD_ADDR" ] && ATF_LOAD_ADDR="0xfffea000" +[ -z "$BL32" ] && BL32="tee.bin" +BL32_ELF="${BL32%.*}.elf" +[ -f ${BL32_ELF} ] && TEE_LOAD_ADDR=`${CROSS_COMPILE}readelf -l "${BL32_ELF}" | \ +awk '/Entry point/ { print $3 }'` + +[ -z "$TEE_LOAD_ADDR" ] && TEE_LOAD_ADDR="0x60000000" + if [ -z "$BL33_LOAD_ADDR" ];then BL33_LOAD_ADDR=`awk '/CONFIG_SYS_TEXT_BASE/ { print $3 }' include/generated/autoconf.h` fi @@ -75,6 +85,24 @@ cat << __ATF __ATF fi +if [ -f $BL32 ]; then +cat << __TEE + tee { + description = "TEE firmware"; + data = /incbin/("$BL32"); + type = "firmware"; + os = "tee"; + arch = "arm64"; + compression = "none"; + load = <$TEE_LOAD_ADDR>; + entry = <$TEE_LOAD_ADDR>; + hash { + algo = "md5"; + }; + }; +__TEE +fi + DEFAULT=1 cnt=1 for dtname in $DT @@ -117,6 +145,16 @@ cat << __CONF_SECTION1_EOF }; __CONF_SECTION1_EOF else +if [ -f $BL32 ]; then +cat << __CONF_SECTION1_EOF + config_$cnt { + description = "$(basename $dtname .dtb)"; + firmware = "atf"; + loadables = "uboot", "tee"; + fdt = "fdt_$cnt"; + }; +__CONF_SECTION1_EOF +else cat << __CONF_SECTION1_EOF config_$cnt { description = "$(basename $dtname .dtb)"; @@ -126,6 +164,7 @@ cat << __CONF_SECTION1_EOF }; __CONF_SECTION1_EOF fi +fi cnt=$((cnt+1)) done From patchwork Mon May 31 10:14:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1485624 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=RhNAmXOg; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FtrlY0G1qz9sVb for ; Mon, 31 May 2021 20:15:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A3A6A82E81; Mon, 31 May 2021 12:15:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="RhNAmXOg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D04A82E6D; Mon, 31 May 2021 12:14:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 989D882B82 for ; Mon, 31 May 2021 12:14:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x631.google.com with SMTP id h24so11967766ejy.2 for ; Mon, 31 May 2021 03:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iherpdeh05RHBc9TLJsRP+0lasnqAdPdfP4OUtL69o0=; b=RhNAmXOgbci0MvDisMzB0Crv2Qz7Rrhnop8Dq+VvCSnfpPvxIYoEw0IOTe5xVbtwjR 0PFdls3TYPwvrcx1kNJGY68lqPOj1BCUrebvqTPv1poQQ0QmUGdGAca2O5Tper5GNGJa wmS4o9qP/WXw+ovseyk9QZfTKb6GMHqA+Wc0U1QKtkBFHe7JSUG6rLePFfPKBKn0oy1m PvAGBUx7M39blWk8esUormdennI+0shf5tG5G0ZN7wSDCUWi+t4dDNPD5ZMmOWcON5EX W2q93VfJZ28268T8Oc+GN5uF+yv83iKoci/HB09KIKr1TAKuY3882jje/pj9QZPAaBln 7J4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=iherpdeh05RHBc9TLJsRP+0lasnqAdPdfP4OUtL69o0=; b=WqdrMU7h/QmoKqCwT6+dVInc2YnqwX44GBeabks4b0t7TdHxS+fEX4zSSudp658Rjq mfNBx4RNBg7qml/uFpbQCz1fpdTlXG3zCbKibYvPaD3XRj8vpGikXTDxZ3N8mG8hSde2 k65zVKsfjNWk3PpirqQ7q89re2TLo8/cUBK5G/SiOKHB3uGcCeZtciyiw7l9vn7o4CjX 14jtYHHvqRyla57dtJVxaP/2Q4SD7jmHU4lirQDT/awGuASU82Fx6kDFIsPaZk3lqIji qWxbKGe3OiK90O/DvA3hcDigfXFdWYZkAAVnil25G+HeKYeDdLR3lk214ugmuFlmxzuj gR2A== X-Gm-Message-State: AOAM531oannKGpOFfya6OxAYLAF5fOHKvYmxHE/KooWumG4QY8l5GbtX 4Ae8QRrTtWNOMQDd7TlmbXMcuPd+jhNbSMvh X-Google-Smtp-Source: ABdhPJxGjJmU0lotlezKxfMtRIsSXcVFPisPuY03Rk9asZkRsbUy0drDZGd2M+nj0JocRpywzaOtig== X-Received: by 2002:a17:906:58d1:: with SMTP id e17mr22196684ejs.179.1622456093079; Mon, 31 May 2021 03:14:53 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::e05]) by smtp.gmail.com with ESMTPSA id c14sm1228813ejb.2.2021.05.31.03.14.52 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 May 2021 03:14:52 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com, Ricardo Salveti Subject: [PATCH 3/3] zynqmp: Pass bl32 entry to TF-A via xilinx handoff structure Date: Mon, 31 May 2021 12:14:47 +0200 Message-Id: <9dab51eb33a63ef892855b11a494283aa50b75c8.1622456084.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean There is need to pass entry about secure OS when bl32_entry is defined. Currently only 64bit support is added but /fit-images node have been extended to also record if this is 32bit or 64bit secure OS. When this is tested the code will be update to support this configuration too. Signed-off-by: Michal Simek --- arch/arm/mach-zynqmp/handoff.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-zynqmp/handoff.c b/arch/arm/mach-zynqmp/handoff.c index 7d7ab9da6ec2..31346d9b2e21 100644 --- a/arch/arm/mach-zynqmp/handoff.c +++ b/arch/arm/mach-zynqmp/handoff.c @@ -71,6 +71,7 @@ struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl32_entry, uintptr_t fdt_addr) { struct xfsbl_atf_handoff_params *atfhandoffparams; + u32 index = 0; atfhandoffparams = (void *)CONFIG_SPL_TEXT_BASE; atfhandoffparams->magic[0] = 'X'; @@ -78,14 +79,22 @@ struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl32_entry, atfhandoffparams->magic[2] = 'N'; atfhandoffparams->magic[3] = 'X'; - atfhandoffparams->num_entries = 0; + if (bl32_entry) { + atfhandoffparams->partition[index].entry_point = bl32_entry; + atfhandoffparams->partition[index].flags = FSBL_FLAGS_EL1 << FSBL_FLAGS_EL_SHIFT | + FSBL_FLAGS_SECURE << FSBL_FLAGS_TZ_SHIFT; + index++; + } + if (bl33_entry) { - atfhandoffparams->partition[0].entry_point = bl33_entry; - atfhandoffparams->partition[0].flags = FSBL_FLAGS_EL2 << - FSBL_FLAGS_EL_SHIFT; - atfhandoffparams->num_entries++; + atfhandoffparams->partition[index].entry_point = bl33_entry; + atfhandoffparams->partition[index].flags = FSBL_FLAGS_EL2 << + FSBL_FLAGS_EL_SHIFT; + index++; } + atfhandoffparams->num_entries = index; + writel(CONFIG_SPL_TEXT_BASE, &pmu_base->gen_storage6); return NULL;