Re: [PATCH RFC v3 04/11] ti: etype: dm: Add entry type for TI DM

Alper Nebi Yasak
2022-07-01T19:09:54Z

On 15/06/2022 09:47, Neha Malcom Francis wrote:
> K3 devices introduces the concept of centralized power, resource and
> security management to System Firmware. This is to overcome challenges
> by the traditional approach that implements system control functions on
> each of the processing units.
>
> The software interface for System Firmware is split into TIFS and DM. DM

TIFS (TI Foundational Security), I assume.

> (Device Manager) is responsible for resource and power management from
> secure and non-secure hosts. This additional binary is necessary for
> specific platforms' ROM boot images and is to be packaged into tispl.bin
>
> Add an entry for DM. The entry can be used for the packaging of
> tispl.bin by binman along with ATF and TEE.
>
> Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
> ---
> Makefile | 1 +
> tools/binman/entries.rst | 10 ++++++++++
> tools/binman/etype/ti_dm.py | 23 +++++++++++++++++++++++
> tools/binman/ftest.py | 7 +++++++
> tools/binman/test/225_ti_dm.dts | 13 +++++++++++++
> 5 files changed, 54 insertions(+)
> create mode 100644 tools/binman/etype/ti_dm.py
> create mode 100644 tools/binman/test/225_ti_dm.dts

Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>

Same minor issues as the previous patch.

> diff --git a/Makefile b/Makefile
> index d20d264c53..9b29e8e6a2 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1342,6 +1342,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
> $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
> -a atf-bl31-path=${BL31} \
> -a tee-os-path=${TEE} \
> + -a ti-dm-path=${DM} \
> -a opensbi-path=${OPENSBI} \
> -a default-dt=$(default_dt) \
> -a scp-path=$(SCP) \
> diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
> index 9fc5c48c35..b6915ef12e 100644
> --- a/tools/binman/entries.rst
> +++ b/tools/binman/entries.rst
> @@ -1214,6 +1214,16 @@ devices.
>
>
>
> +Entry: ti-dm: Texas Instruments Device Manager (DM) blob
> +-----------------------------------------------------------------
> +
> +Properties / Entry arguments:
> + - ti-dm-path: Filename of file to read into the entry, typically dm.bin
> +
> +This entry holds the device manager responsible for resource and power management in K3 devices.
> +
> +
> +
> Entry: section: Entry that contains other entries
> -------------------------------------------------
>
> diff --git a/tools/binman/etype/ti_dm.py b/tools/binman/etype/ti_dm.py
> new file mode 100644
> index 0000000000..4203fff36e
> --- /dev/null
> +++ b/tools/binman/etype/ti_dm.py
> @@ -0,0 +1,23 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
> +#
> +# Entry type for TI Device Manager
> +
> +import os
> +
> +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
> +
> +
> +class Entry_ti_dm(Entry_blob_named_by_arg):
> + """Entry containing a Texas Instruments Device Manager (DM)
> +
> + Properties / Entry arguments:
> + - ti-dm-path: Filename of file to read into the entry, typically dm.bin
> +
> + This entry holds the device manager responsible for resource and power management
> + in K3 devices.
> + """
> +
> + def __init__(self, section, etype, node):
> + super().__init__(section, etype, node, 'ti-dm')
> + self.external = True
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index 671d083c54..3709b68297 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -85,6 +85,7 @@ FSP_S_DATA = b'fsp_s'
> FSP_T_DATA = b'fsp_t'
> ATF_BL31_DATA = b'bl31'
> TEE_OS_DATA = b'this is some tee OS data'
> +TI_DM_DATA = b'tidmtidm'
> ATF_BL2U_DATA = b'bl2u'
> OPENSBI_DATA = b'opensbi'
> TI_SYSFW_DATA = b'sysfw'
> @@ -194,6 +195,7 @@ class TestFunctional(unittest.TestCase):
> TestFunctional._MakeInputFile('compress_big', COMPRESS_DATA_BIG)
> TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
> TestFunctional._MakeInputFile('tee-pager.bin', TEE_OS_DATA)
> + TestFunctional._MakeInputFile('dm.bin', TI_DM_DATA)
> TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA)
> TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA)
> TestFunctional._MakeInputFile('sysfw.bin', TI_SYSFW_DATA)
> @@ -5307,6 +5309,11 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
> data = self._DoReadFile('222_tee_os.dts')
> self.assertEqual(TEE_OS_DATA, data[:len(TEE_OS_DATA)])
>
> + def testPackTiDm(self):
> + """Test that an image with a TI DM binary can be created"""
> + data = self._DoReadFile('225_ti_dm.dts')
> + self.assertEqual(TI_DM_DATA, data[:len(TI_DM_DATA)])
> +
> def testFitFdtOper(self):
> """Check handling of a specified FIT operation"""
> entry_args = {
> diff --git a/tools/binman/test/225_ti_dm.dts b/tools/binman/test/225_ti_dm.dts
> new file mode 100644
> index 0000000000..3ab754131e
> --- /dev/null
> +++ b/tools/binman/test/225_ti_dm.dts
> @@ -0,0 +1,13 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +/dts-v1/;
> +
> +/ {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + binman {
> + ti-dm {
> + filename = "dm.bin";
> + };
> + };
> +};