Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 580F7C433EF for ; Wed, 1 Jun 2022 07:29:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9F83382A57; Wed, 1 Jun 2022 09:29:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="wSz6OLtT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8A31183C61; Wed, 1 Jun 2022 09:29:41 +0200 (CEST) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 58A5882169 for ; Wed, 1 Jun 2022 09:29:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=n-francis@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2517TXHq005967; Wed, 1 Jun 2022 02:29:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1654068573; bh=q8WuliFQrt9Kw5AmPbe7xa8IG2LhNEhgU22xyFAKcMc=; h=Date:Subject:From:To:References:In-Reply-To; b=wSz6OLtT2L0gAUSUdKVrdxy0ZDLuHIJvsScj8dzq4q3p/+vi15BRoOpgW4vuj9i0L nIw1zPNCUhgGc9eErTSSA7ozPy2aIJQiJit0tcW9CGBGR0T/15p+JpgQ2lkmgxA9jP d+v+NDBnnym4T3mb/ff0APkKMwYF0v7hJqZOCfdg= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2517TXpV054375 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 1 Jun 2022 02:29:33 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Wed, 1 Jun 2022 02:29:33 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Wed, 1 Jun 2022 02:29:33 -0500 Received: from [172.24.218.149] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2517TVEU082644; Wed, 1 Jun 2022 02:29:32 -0500 Message-ID: <749d6cd5-e90a-3e39-a169-62b8568fa85c@ti.com> Date: Wed, 1 Jun 2022 12:59:30 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH RFC v2 03/11] ti: etype: sysfw: Add entry type for sysfw Content-Language: en-US From: Neha Malcom Francis To: Roger Quadros , References: <20220506043759.8193-1-n-francis@ti.com> <20220506043759.8193-4-n-francis@ti.com> <31dc2449-0c46-b602-c03d-bc95d7559479@kernel.org> <84b4607b-9b50-a8bf-fb9e-ea3735294ccb@ti.com> In-Reply-To: <84b4607b-9b50-a8bf-fb9e-ea3735294ccb@ti.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean Hi Roger, On 01/06/22 11:28, Neha Malcom Francis wrote: > Hi Roger, > > On 31/05/22 14:14, Roger Quadros wrote: >> >> >> On 06/05/2022 07:37, Neha Malcom Francis wrote: >>> For K3 devices that require a sysfw image, add entry for SYSFW. It can >> >> 'can' or 'should'? >> >> For binman, 'sysfw' and 'dm' (added in patch 4) are just binary blobs. >> correct? >> Why can't you just use blob entry type? >> > This was suggested so that there is space for changes that will be > required when scaling to High Security devices as well. > Also to add, this also enables us to take files given in "SYSFW" and "DM" arguments since it is an Entry_blob_named_by_arg. Similar to the use of etype/scp.py >>> contain system firmware image that can be packaged into sysfw.itb by >>> binman. >>> >>> Signed-off-by: Tarun Sahu >>> [n-francis@ti.com: added tests for addition of etype] >>> Signed-off-by: Neha Malcom Francis >> >> cheers, >> -roger >> >>> --- >>>   Makefile                           |  1 + >>>   tools/binman/entries.rst           | 11 +++++++++++ >>>   tools/binman/etype/ti_sysfw.py     | 28 ++++++++++++++++++++++++++++ >>>   tools/binman/ftest.py              |  7 +++++++ >>>   tools/binman/test/232_ti_sysfw.dts | 13 +++++++++++++ >>>   5 files changed, 60 insertions(+) >>>   create mode 100644 tools/binman/etype/ti_sysfw.py >>>   create mode 100644 tools/binman/test/232_ti_sysfw.dts >>> >>> diff --git a/Makefile b/Makefile >>> index 4b347d3603..581fbba4c3 100644 >>> --- a/Makefile >>> +++ b/Makefile >>> @@ -1338,6 +1338,7 @@ cmd_binman = $(srctree)/tools/binman/binman >>> $(if $(BINMAN_DEBUG),-D) \ >>>           -a opensbi-path=${OPENSBI} \ >>>           -a default-dt=$(default_dt) \ >>>           -a scp-path=$(SCP) \ >>> +        -a ti-sysfw-path=$(SYSFW) \ >>>           -a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \ >>>           -a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \ >>>           -a spl-dtb=$(CONFIG_SPL_OF_REAL) \ >>> diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst >>> index ae4305c99e..6c0f03b34f 100644 >>> --- a/tools/binman/entries.rst >>> +++ b/tools/binman/entries.rst >>> @@ -1203,6 +1203,17 @@ This entry holds firmware for an external >>> platform-specific coprocessor. >>> +Entry: sysfw: Texas Instruments System Firmware (SYSFW) blob >>> +------------------------------------------------------------ >>> + >>> +Properties / Entry arguments: >>> +    - ti-sysfw-path: Filename of file to read into the entry, >>> typically sysfw.bin >>> + >>> +This entry contains system firmware necessary for booting of K3 >>> architecture >>> +devices. >>> + >>> + >>> + >>>   Entry: section: Entry that contains other entries >>>   ------------------------------------------------- >>> diff --git a/tools/binman/etype/ti_sysfw.py >>> b/tools/binman/etype/ti_sysfw.py >>> new file mode 100644 >>> index 0000000000..5b5b307030 >>> --- /dev/null >>> +++ b/tools/binman/etype/ti_sysfw.py >>> @@ -0,0 +1,28 @@ >>> +# SPDX-License-Identifier: GPL-2.0+ >>> +# Copyright (C) 2022 Texas Instruments Incorporated - >>> https://www.ti.com/ >>> +# >>> +# Entry type module for TI SYSFW binary blob >>> +# >>> + >>> +import os >>> +import struct >>> +import sys >>> +import zlib >>> + >>> +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg >>> +from dtoc import fdt_util >>> +from patman import tools >>> + >>> + >>> +class Entry_ti_sysfw(Entry_blob_named_by_arg): >>> +    """Entry containing Texas Instruments System Firmware (SYSFW) blob >>> + >>> +    Properties / Entry arguments: >>> +        - ti-sysfw-path: Filename of file to read into the entry, >>> typically sysfw.bin >>> + >>> +    This entry contains system firmware necessary for booting of K3 >>> architecture devices. >>> +    """ >>> + >>> +    def __init__(self, section, etype, node): >>> +        super().__init__(section, etype, node, 'ti-sysfw') >>> +        self.external = True >>> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py >>> index 4ce181a066..ec408de334 100644 >>> --- a/tools/binman/ftest.py >>> +++ b/tools/binman/ftest.py >>> @@ -87,6 +87,7 @@ ATF_BL31_DATA         = b'bl31' >>>   TEE_OS_DATA           = b'this is some tee OS data' >>>   ATF_BL2U_DATA         = b'bl2u' >>>   OPENSBI_DATA          = b'opensbi' >>> +TI_SYSFW_DATA         = b'sysfw' >>>   SCP_DATA              = b'scp' >>>   TEST_FDT1_DATA        = b'fdt1' >>>   TEST_FDT2_DATA        = b'test-fdt2' >>> @@ -195,6 +196,7 @@ class TestFunctional(unittest.TestCase): >>>           TestFunctional._MakeInputFile('tee-pager.bin', TEE_OS_DATA) >>>           TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA) >>>           TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA) >>> +        TestFunctional._MakeInputFile('sysfw.bin', TI_SYSFW_DATA) >>>           TestFunctional._MakeInputFile('scp.bin', SCP_DATA) >>>           # Add a few .dtb files for testing >>> @@ -5522,6 +5524,11 @@ fdt         fdtmap                Extract the >>> devicetree blob from the fdtmap >>>           """Test an image with a pre-load header with an invalid key""" >>>           with self.assertRaises(ValueError) as e: >>>               data = self._DoReadFile('231_pre_load_invalid_key.dts') >>> + >>> +    def testPackTiSysfw(self): >>> +        """Test that an image with a SYSFW binary can be created""" >>> +        data = self._DoReadFile('232_ti_sysfw.dts') >>> +        self.assertEqual(TI_SYSFW_DATA, data[:len(TI_SYSFW_DATA)]) >>>   if __name__ == "__main__": >>>       unittest.main() >>> diff --git a/tools/binman/test/232_ti_sysfw.dts >>> b/tools/binman/test/232_ti_sysfw.dts >>> new file mode 100644 >>> index 0000000000..9e66cbe77b >>> --- /dev/null >>> +++ b/tools/binman/test/232_ti_sysfw.dts >>> @@ -0,0 +1,13 @@ >>> +// SPDX-License-Identifier: GPL-2.0+ >>> + >>> +/dts-v1/; >>> + >>> +/ { >>> +    #address-cells = <1>; >>> +    #size-cells = <1>; >>> +    binman { >>> +        ti-sysfw { >>> +            filename = "sysfw.bin"; >>> +        }; >>> +    }; >>> +}; > -- Thanking You Neha Malcom Francis