[{"id":1766060,"web_url":"http://patchwork.ozlabs.org/comment/1766060/","msgid":"<CAPnjgZ3vmDBqEr3_sETFk0Bc3Z9K9Qh=Hdpp53B2mL4QuSBhDg@mail.gmail.com>","list_archive_url":null,"date":"2017-09-11T06:17:30","subject":"Re: [U-Boot] [PATCH 06/10] spl: add support to booting with OP-TEE","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/","name":"Simon Glass","email":"sjg@chromium.org"},"content":"Hi,\n\nOn 5 September 2017 at 20:14, Kever Yang <kever.yang@rock-chips.com> wrote:\n> OP-TEE is an open source trusted OS, in armv7, its loading and\n> running are like this:\n> loading:\n> - SPL load both OP-TEE and U-Boot\n> running:\n> - SPL run into OP-TEE in secure mode;\n> - OP-TEE run into U-Boot in non-secure mode;\n>\n> More detail:\n> https://github.com/OP-TEE/optee_os\n> and search for 'boot arguments' for detail entry parameter in:\n> core/arch/arm/kernel/generic_entry_a32.S\n>\n> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>\n> ---\n>\n>  common/spl/Kconfig     |  7 +++++++\n>  common/spl/Makefile    |  1 +\n>  common/spl/spl.c       |  5 +++++\n>  common/spl/spl_optee.S | 13 +++++++++++++\n>  include/spl.h          |  9 +++++++++\n>  5 files changed, 35 insertions(+)\n>  create mode 100644 common/spl/spl_optee.S\n>\n> diff --git a/common/spl/Kconfig b/common/spl/Kconfig\n> index 582b685..85f8d66 100644\n> --- a/common/spl/Kconfig\n> +++ b/common/spl/Kconfig\n> @@ -700,6 +700,13 @@ config SPL_ATF_TEXT_BASE\n>         help\n>           This is the base address in memory for ATF BL31 text and entry point.\n>\n> +config SPL_OPTEE_SUPPORT\n\nCan you drop the _SUPPORT\n\n> +       bool \"Support OP-TEE Trusted OS\"\n> +       depends on ARM\n> +       help\n> +         OP-TEE is an open source Trusted OS  which is loaded by SPL.\n> +         More detail at: https://github.com/OP-TEE/optee_os\n> +\n>  config TPL\n>         bool\n>         depends on SUPPORT_TPL\n> diff --git a/common/spl/Makefile b/common/spl/Makefile\n> index fde0d09..ec37428 100644\n> --- a/common/spl/Makefile\n> +++ b/common/spl/Makefile\n> @@ -23,6 +23,7 @@ obj-$(CONFIG_$(SPL_TPL_)UBI) += spl_ubi.o\n>  obj-$(CONFIG_$(SPL_TPL_)NET_SUPPORT) += spl_net.o\n>  obj-$(CONFIG_$(SPL_TPL_)MMC_SUPPORT) += spl_mmc.o\n>  obj-$(CONFIG_$(SPL_TPL_)ATF_SUPPORT) += spl_atf.o\n> +obj-$(CONFIG_$(SPL_TPL_)OPTEE_SUPPORT) += spl_optee.o\n>  obj-$(CONFIG_$(SPL_TPL_)USB_SUPPORT) += spl_usb.o\n>  obj-$(CONFIG_$(SPL_TPL_)FAT_SUPPORT) += spl_fat.o\n>  obj-$(CONFIG_$(SPL_TPL_)EXT_SUPPORT) += spl_ext.o\n> diff --git a/common/spl/spl.c b/common/spl/spl.c\n> index d245cfc..6ff390c 100644\n> --- a/common/spl/spl.c\n> +++ b/common/spl/spl.c\n> @@ -430,6 +430,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)\n>                 bl31_entry();\n>         }\n>\n> +       if (CONFIG_IS_ENABLED(OPTEE_SUPPORT)) {\n> +               debug(\"loaded - jumping to U-Boot via OP-TEE.\\n\");\n> +               spl_optee_entry(0, 0, 0, (void *)spl_image.entry_point);\n> +       }\n> +\n>         debug(\"loaded - jumping to U-Boot...\\n\");\n>  #ifdef CONFIG_BOOTSTAGE_STASH\n>         int ret;\n> diff --git a/common/spl/spl_optee.S b/common/spl/spl_optee.S\n> new file mode 100644\n> index 0000000..4f7f8ba\n> --- /dev/null\n> +++ b/common/spl/spl_optee.S\n> @@ -0,0 +1,13 @@\n> +/*\n> + * Copyright (C) 2017 Rockchip Electronic Co.,Ltd\n> + *\n> + * SPDX-License-Identifier:    GPL-2.0+\n> + */\n> +\n> +#include <linux/linkage.h>\n> +#include <asm/assembler.h>\n> +\n> +ENTRY(spl_optee_entry)\n> +       ldr lr, =CONFIG_SYS_TEXT_BASE\n> +       mov pc, r3\n\nThis is ARM code so should go in arch/arm I think\n\n> +ENDPROC(spl_optee_entry)\n> diff --git a/include/spl.h b/include/spl.h\n> index ce4cf0a..13d46ed 100644\n> --- a/include/spl.h\n> +++ b/include/spl.h\n> @@ -270,6 +270,15 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,\n>  void bl31_entry(void);\n>\n>  /**\n> + * spl_optee_entry - entry function for optee\n> + * entry arg0, pagestore\n\nWhat does this mean? What exactly needs to be there?\n\n> + * entry arg1, (ARMv7 standard bootarg #1)\n> + * entry arg2, device tree address, (ARMv7 standard bootarg #2)\n> + * entry arg3, non-secure entry address (ARMv7 bootarg #0)\n> + */\n> +void spl_optee_entry(void *arg0, void *arg1, void *arg2, void *arg3);\n> +\n> +/**\n>   * board_return_to_bootrom - allow for boards to continue with the boot ROM\n>   *\n>   * If a board (e.g. the Rockchip RK3368 boards) provide some\n> --\n> 1.9.1\n>\n\nRegards,\nSimon","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"XBsFG/yT\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"BKon3rY7\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xrHrW2FF0z9s7g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 11 Sep 2017 16:21:47 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 05705C21DC6; Mon, 11 Sep 2017 06:18:32 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id D0078C21E74;\n\tMon, 11 Sep 2017 06:18:13 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 4CCD7C21E39; Mon, 11 Sep 2017 06:17:56 +0000 (UTC)","from mail-qt0-f170.google.com (mail-qt0-f170.google.com\n\t[209.85.216.170])\n\tby lists.denx.de (Postfix) with ESMTPS id E2094C21E4D\n\tfor <u-boot@lists.denx.de>; Mon, 11 Sep 2017 06:17:52 +0000 (UTC)","by mail-qt0-f170.google.com with SMTP id k2so17082614qte.2\n\tfor <u-boot@lists.denx.de>; Sun, 10 Sep 2017 23:17:52 -0700 (PDT)","by 10.200.37.200 with HTTP; Sun, 10 Sep 2017 23:17:30 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=20161025; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=5TmVbsCA5Aw6eMPdcfhh9bWGr+C3OxCSliNkwzL/+6g=;\n\tb=XBsFG/yTMvhebTt/6CzP3NIe6v7dh+O3r8bZEDDU2t2s7V5Y87Y+k7Kcs3364jbz0I\n\tOe6+vjBulR6snBslhp9Pw81b0EUgUog+UnqV28EkZJyyEh9Hf2OqRytTA+WscII0FmEw\n\tP4c1aYr76ZE5jvoMobkU0sqbDiI9azj1/yzKM5ozFh9WMSgZiA6v39ad4dtieJSAlQDy\n\tidmJSwA5JVuA95tieoDjWqaMENLyE0VHzRtLZqoDlyJbNDmLQOYdb9GbIo7+W6ID/QO6\n\tAHJ7h1AHnA15QRDhy0icGcP9PEOD3efzMzNg3EpOBzokVHmf/+EFIuD4gPn+GvkOjXXa\n\tRsLQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=5TmVbsCA5Aw6eMPdcfhh9bWGr+C3OxCSliNkwzL/+6g=;\n\tb=BKon3rY7+sIZfdOOHx1J871K5FpLcNMSoHCWGs4FEqPTDgJ/ENoWtrOro9HE16F968\n\t+n2ivXIx8XshZubDvZaE780ZK4U8PCA3EhvPqqGsk/pgCwoiaKPmbU4dqgKXUBFpc6mm\n\tXoA9HkB4Z93dgY74rk1WWTWioSWJAs2UobKfM="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=5TmVbsCA5Aw6eMPdcfhh9bWGr+C3OxCSliNkwzL/+6g=;\n\tb=TBLQjj3pN3yoNZz+hmHmnn9RM88z1OQFRaiatCaNKnUJVgXduV7lwM/akZPFlIcf4e\n\tdvJuRchaPzaWnRqQr7npWQUxP6bAxBcg9q00gB1swk2lnSdJHa/I+6OuYoXmJEQtRBfc\n\tHU8ZMBdu9jrARKQNtZPL7/HJmZG3dVAvAYDqJAr/rcP663X01Q3X/2G64TqBI5HfE4/H\n\tbZ49re4EwwAEEZtqrqUtlOCwZzL1y2NhVSEubVKFbX1oAONsTEmiIwhFS/PwUT+CoEl0\n\tYEiaOQ7EeCmtCuIkCeZVQuyCTf2YnSlRxtCZx9C0E2BmlcO3rz0yIHJlQiZhoup/wuOC\n\t8wsg==","X-Gm-Message-State":"AHPjjUhfSTayWhKnVzDC+Ivnr0m/9FqS2PUDATYaH961/RKlUxPGrY1J\n\t9uanL4/QvIx/tpfxPxx0euChh4onjs1A9MxnAikaiQ==","X-Google-Smtp-Source":"AOwi7QAPahB5h0Kakh+ybaOk/uoRmT2J7cwjjrqbfdDmqhw/o5dkZjBlJbxy9PbX6nfea501FH/HX8GpOy9atLJnwJ4=","X-Received":"by 10.200.63.154 with SMTP id d26mr14758135qtk.212.1505110671538;\n\tSun, 10 Sep 2017 23:17:51 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1504664087-26473-7-git-send-email-kever.yang@rock-chips.com>","References":"<1504664087-26473-1-git-send-email-kever.yang@rock-chips.com>\n\t<1504664087-26473-7-git-send-email-kever.yang@rock-chips.com>","From":"Simon Glass <sjg@chromium.org>","Date":"Mon, 11 Sep 2017 00:17:30 -0600","X-Google-Sender-Auth":"20lrR4kmUuACtNk14H3IXkR0yRc","Message-ID":"<CAPnjgZ3vmDBqEr3_sETFk0Bc3Z9K9Qh=Hdpp53B2mL4QuSBhDg@mail.gmail.com>","To":"Kever Yang <kever.yang@rock-chips.com>","Cc":"Alexandru Gagniuc <alex.g@adaptrum.com>,\n\tStefan Agner <stefan.agner@toradex.com>,\n\tVagrant Cascadian <vagrant@debian.org>,\n\tU-Boot Mailing List <u-boot@lists.denx.de>","Subject":"Re: [U-Boot] [PATCH 06/10] spl: add support to booting with OP-TEE","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1767187,"web_url":"http://patchwork.ozlabs.org/comment/1767187/","msgid":"<E1drnPb-00083Q-Ey@mail.theobroma-systems.com>","list_archive_url":null,"date":"2017-09-12T15:47:43","subject":"Re: [U-Boot] [U-Boot, 06/10] spl: add support to booting with OP-TEE","submitter":{"id":53488,"url":"http://patchwork.ozlabs.org/api/people/53488/","name":"Philipp Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"content":"> OP-TEE is an open source trusted OS, in armv7, its loading and\n> running are like this:\n> loading:\n> - SPL load both OP-TEE and U-Boot\n> running:\n> - SPL run into OP-TEE in secure mode;\n> - OP-TEE run into U-Boot in non-secure mode;\n> \n> More detail:\n> https://github.com/OP-TEE/optee_os\n> and search for 'boot arguments' for detail entry parameter in:\n> core/arch/arm/kernel/generic_entry_a32.S\n> \n> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>\n> ---\n> \n>  common/spl/Kconfig     |  7 +++++++\n>  common/spl/Makefile    |  1 +\n>  common/spl/spl.c       |  5 +++++\n>  common/spl/spl_optee.S | 13 +++++++++++++\n>  include/spl.h          |  9 +++++++++\n>  5 files changed, 35 insertions(+)\n>  create mode 100644 common/spl/spl_optee.S\n> \n\nAcked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xs8Sv2bW7z9s76\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 01:52:47 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 10D3FC222FA; Tue, 12 Sep 2017 15:49:45 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 95119C222E1;\n\tTue, 12 Sep 2017 15:47:53 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 9A7F3C2206D; Tue, 12 Sep 2017 15:47:45 +0000 (UTC)","from mail.theobroma-systems.com (vegas.theobroma-systems.com\n\t[144.76.126.164])\n\tby lists.denx.de (Postfix) with ESMTPS id B888BC2217E\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 15:47:44 +0000 (UTC)","from [86.59.122.178] (port=60150 helo=vpn-10-11-0-14.lan)\n\tby mail.theobroma-systems.com with esmtpsa\n\t(TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80)\n\t(envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1drnPb-00083Q-Ey; Tue, 12 Sep 2017 17:47:43 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0","MIME-Version":"1.0","From":"Philipp Tomsich <philipp.tomsich@theobroma-systems.com>","To":"Kever Yang <kever.yang@rock-chips.com>","In-Reply-To":"<1504664087-26473-7-git-send-email-kever.yang@rock-chips.com>","References":"<1504664087-26473-7-git-send-email-kever.yang@rock-chips.com>","Message-Id":"<E1drnPb-00083Q-Ey@mail.theobroma-systems.com>","Date":"Tue, 12 Sep 2017 17:47:43 +0200","Cc":"vagrant@debian.org, u-boot@lists.denx.de,\n\tStefan Agner <stefan.agner@toradex.com>,\n\tAlexandru Gagniuc <alex.g@adaptrum.com>","Subject":"Re: [U-Boot] [U-Boot, 06/10] spl: add support to booting with OP-TEE","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1767349,"web_url":"http://patchwork.ozlabs.org/comment/1767349/","msgid":"<alpine.OSX.2.21.1709122317200.47687@vpn-10-11-0-14.lan>","list_archive_url":null,"date":"2017-09-12T21:28:04","subject":"Re: [U-Boot] [U-Boot, 06/10] spl: add support to booting with OP-TEE","submitter":{"id":53488,"url":"http://patchwork.ozlabs.org/api/people/53488/","name":"Philipp Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"content":"On Wed, 6 Sep 2017, Kever Yang wrote:\n\n> OP-TEE is an open source trusted OS, in armv7, its loading and\n> running are like this:\n> loading:\n> - SPL load both OP-TEE and U-Boot\n> running:\n> - SPL run into OP-TEE in secure mode;\n> - OP-TEE run into U-Boot in non-secure mode;\n>\n> More detail:\n> https://github.com/OP-TEE/optee_os\n> and search for 'boot arguments' for detail entry parameter in:\n> core/arch/arm/kernel/generic_entry_a32.S\n\nAdding some documentation to U-Boot that documents the binary interface \nwith OPTEE would be helpful.\n\n>\n> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>\n> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>\n> ---\n>\n> common/spl/Kconfig     |  7 +++++++\n> common/spl/Makefile    |  1 +\n> common/spl/spl.c       |  5 +++++\n> common/spl/spl_optee.S | 13 +++++++++++++\n> include/spl.h          |  9 +++++++++\n> 5 files changed, 35 insertions(+)\n> create mode 100644 common/spl/spl_optee.S\n>\n> diff --git a/common/spl/Kconfig b/common/spl/Kconfig\n> index 582b685..85f8d66 100644\n> --- a/common/spl/Kconfig\n> +++ b/common/spl/Kconfig\n> @@ -700,6 +700,13 @@ config SPL_ATF_TEXT_BASE\n> \thelp\n> \t  This is the base address in memory for ATF BL31 text and entry point.\n>\n> +config SPL_OPTEE_SUPPORT\n> +\tbool \"Support OP-TEE Trusted OS\"\n> +\tdepends on ARM\n> +\thelp\n> +\t  OP-TEE is an open source Trusted OS  which is loaded by SPL.\n> +\t  More detail at: https://github.com/OP-TEE/optee_os\n> +\n> config TPL\n> \tbool\n> \tdepends on SUPPORT_TPL\n> diff --git a/common/spl/Makefile b/common/spl/Makefile\n> index fde0d09..ec37428 100644\n> --- a/common/spl/Makefile\n> +++ b/common/spl/Makefile\n> @@ -23,6 +23,7 @@ obj-$(CONFIG_$(SPL_TPL_)UBI) += spl_ubi.o\n> obj-$(CONFIG_$(SPL_TPL_)NET_SUPPORT) += spl_net.o\n> obj-$(CONFIG_$(SPL_TPL_)MMC_SUPPORT) += spl_mmc.o\n> obj-$(CONFIG_$(SPL_TPL_)ATF_SUPPORT) += spl_atf.o\n> +obj-$(CONFIG_$(SPL_TPL_)OPTEE_SUPPORT) += spl_optee.o\n> obj-$(CONFIG_$(SPL_TPL_)USB_SUPPORT) += spl_usb.o\n> obj-$(CONFIG_$(SPL_TPL_)FAT_SUPPORT) += spl_fat.o\n> obj-$(CONFIG_$(SPL_TPL_)EXT_SUPPORT) += spl_ext.o\n> diff --git a/common/spl/spl.c b/common/spl/spl.c\n> index d245cfc..6ff390c 100644\n> --- a/common/spl/spl.c\n> +++ b/common/spl/spl.c\n> @@ -430,6 +430,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)\n> \t\tbl31_entry();\n> \t}\n>\n> +\tif (CONFIG_IS_ENABLED(OPTEE_SUPPORT)) {\n> +\t\tdebug(\"loaded - jumping to U-Boot via OP-TEE.\\n\");\n> +\t\tspl_optee_entry(0, 0, 0, (void *)spl_image.entry_point);\n> +\t}\n> +\n\nShouldn't the fact that we will boot through the OPTEE tracked through \nspl_image->os and shouldn't there be a IH_OS_... constant that indicates \nthat we are going to jump to an OPTEE?  This would allow the above switch \nstatement to be extended for OPTEE.\n\n> \tdebug(\"loaded - jumping to U-Boot...\\n\");\n> #ifdef CONFIG_BOOTSTAGE_STASH\n> \tint ret;\n> diff --git a/common/spl/spl_optee.S b/common/spl/spl_optee.S\n> new file mode 100644\n> index 0000000..4f7f8ba\n> --- /dev/null\n> +++ b/common/spl/spl_optee.S\n> @@ -0,0 +1,13 @@\n> +/*\n> + * Copyright (C) 2017 Rockchip Electronic Co.,Ltd\n> + *\n> + * SPDX-License-Identifier:\tGPL-2.0+\n> + */\n> +\n> +#include <linux/linkage.h>\n> +#include <asm/assembler.h>\n> +\n> +ENTRY(spl_optee_entry)\n> +\tldr lr, =CONFIG_SYS_TEXT_BASE\n> +\tmov pc, r3\n> +ENDPROC(spl_optee_entry)\n\nThis looks ARM-specific and shouldn't be in common/spl.\n\nPlease note that the next OS image will not always be a CONFIG_SYS_TEXT_BASE.\nSo the address of the \"next image to boot\" should be an argument to this\nfunction (we will need to solve this cleanly anyway, as I am currently \ntrying to address the same issue with booting through ATF where I have an \nentry address into the ATF and need to keep track of the next image's \nentry address as well).\n\n> diff --git a/include/spl.h b/include/spl.h\n> index ce4cf0a..13d46ed 100644\n> --- a/include/spl.h\n> +++ b/include/spl.h\n> @@ -270,6 +270,15 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,\n> void bl31_entry(void);\n>\n> /**\n> + * spl_optee_entry - entry function for optee\n> + * entry arg0, pagestore\n> + * entry arg1, (ARMv7 standard bootarg #1)\n> + * entry arg2, device tree address, (ARMv7 standard bootarg #2)\n> + * entry arg3, non-secure entry address (ARMv7 bootarg #0)\n> + */\n> +void spl_optee_entry(void *arg0, void *arg1, void *arg2, void *arg3);\n> +\n> +/**\n>  * board_return_to_bootrom - allow for boards to continue with the boot ROM\n>  *\n>  * If a board (e.g. the Rockchip RK3368 boards) provide some\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xsHw80Dgjz9t2W\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 07:28:23 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 94EF9C2224A; Tue, 12 Sep 2017 21:28:13 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 628D4C22032;\n\tTue, 12 Sep 2017 21:28:10 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 47268C22032; Tue, 12 Sep 2017 21:28:09 +0000 (UTC)","from mail.theobroma-systems.com (vegas.theobroma-systems.com\n\t[144.76.126.164])\n\tby lists.denx.de (Postfix) with ESMTPS id 05D7EC21FE8\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 21:28:09 +0000 (UTC)","from [86.59.122.178] (port=59834 helo=android.lan)\n\tby mail.theobroma-systems.com with esmtps\n\t(TLS1.2:RSA_AES_128_CBC_SHA1:128)\n\t(Exim 4.80) (envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1drsj1-0002Vv-AL; Tue, 12 Sep 2017 23:28:07 +0200","from [10.11.0.14] (helo=vpn-10-11-0-14.lan)\n\tby android.lan with esmtp (Exim 4.84_2)\n\t(envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1drsj0-000A4S-T7; Tue, 12 Sep 2017 23:28:06 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0","Date":"Tue, 12 Sep 2017 23:28:04 +0200 (CEST)","From":"Philipp Tomsich <philipp.tomsich@theobroma-systems.com>","X-X-Sender":"ptomsich@vpn-10-11-0-14.lan","To":"Kever Yang <kever.yang@rock-chips.com>","In-Reply-To":"<1504664087-26473-7-git-send-email-kever.yang@rock-chips.com>","Message-ID":"<alpine.OSX.2.21.1709122317200.47687@vpn-10-11-0-14.lan>","References":"<1504664087-26473-7-git-send-email-kever.yang@rock-chips.com>","User-Agent":"Alpine 2.21 (OSX 202 2017-01-01)","MIME-Version":"1.0","Cc":"vagrant@debian.org, u-boot@lists.denx.de,\n\tStefan Agner <stefan.agner@toradex.com>,\n\tAlexandru Gagniuc <alex.g@adaptrum.com>","Subject":"Re: [U-Boot] [U-Boot, 06/10] spl: add support to booting with OP-TEE","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]