ATF and OP-TEE Firewalling for K3 devices.
v2 cover ATF and OP-TEE Firewalling for K3 devices.
K3 devices have firewalls that are used to prevent illegal accesses to memory regions that are deemed secure. The series prevents the illegal accesses to ATF and OP-TEE regions that are present in different K3 devices.
AM62AX and AM64X are currently in hold due to some firewall configurations that our System Controller (TIFS) needs to handle.
---
Changes in v2:
Andrew:
- Make the firewall DTS more readable with CONSTANTS
Neha:
- Move GetHexOctet to dtoc for common usage
- Update the documentation in ti-secure
- s/indentifier/identifier/
- Add firewall binman test
- Remove slave firewall multiple background regions
( Single firewall region works fine )
- Add a check in the subnodes to check for the node.name 'firewall'
- Change firewall indexing with id and region number so that it is easy
to purge out firewalls and we don't need to redo the numbering.
- Add information for all the firewalls.
- Link to v1: https://lore.kernel.org/u-boot/[email protected]/
---
Manorit Chawdhry (8):
dtoc: openssl: Add GetHexOctet method
binman: ti-secure: Add support for firewalling entities
binman: ftest: Add test for ti-secure firewall node
binman: k3: add k3-security.h and include it in k3-binman.dtsi
binman: j721e: Add firewall configurations for atf
binman: am62x: Add firewalling configurations
binman: j721s2: Add firewall configurations
binman: j7200: Add firewall configurations
arch/arm/dts/k3-am625-sk-binman.dtsi | 49 +++++++ arch/arm/dts/k3-binman.dtsi | 2 + arch/arm/dts/k3-j7200-binman.dtsi | 137 ++++++++++++++++++ arch/arm/dts/k3-j721e-binman.dtsi | 183 ++++++++++++++++++++++++ arch/arm/dts/k3-j721s2-binman.dtsi | 206 +++++++++++++++++++++++++++ arch/arm/dts/k3-security.h | 58 ++++++++ tools/binman/btool/openssl.py | 16 ++- tools/binman/etype/ti_secure.py | 85 +++++++++++ tools/binman/etype/x509_cert.py | 3 +- tools/binman/ftest.py | 12 ++ tools/binman/test/311_ti_secure_firewall.dts | 28 ++++ tools/dtoc/fdt_util.py | 20 +++ 12 files changed, 796 insertions(+), 3 deletions(-)
---
base-commit: 2fe4b54556ea6271237b35de68dc458bfceab94c
change-id: 20230724-binman-firewalling-65ecdb23ec0a
Best regards,
Signature · 1 line
Manorit Chawdhry <[email protected]>
RFC PATCH v2 1/8 dtoc: openssl: Add GetHexOctet method
HexOctet format is used by openssl for FORMAT:HEX,OCT property in x509 certificates. Add a helper function to extract the integer numbers in HEX,OCT format to pass to openssl directly.
--- tools/dtoc/fdt_util.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
tools/dtoc/fdt_util.py +20 -0
@@ -100,6 +100,26 @@ def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): command.run(dtc, *args, capture_stderr=capture_stderr) return dtb_output +def GetHexOctet(node, propname, default=None): + """Get an integer from a property in hex octet form required by openssl + + Args: + node: Node object to read from + propname: property name to read + default: Default value to use if the node/property do not exist + + Returns: + Integer value read as a String in Hex Octet Form + """ + prop = node.props.get(propname) + if not isinstance(prop.value, list) or len(prop.value) != 2: + value = GetInt(node, propname) + elif isinstance(prop.value, list) and len(prop.value) == 2: + value = GetInt64(node, propname) + + hex_value = '%x' % (value) + return ('0' * (len(hex_value) & 1)) + hex_value + def GetInt(node, propname, default=None): """Get an integer from a property
Signature · 1 line
2.41.0
Re: [RFC PATCH v2 1/8] dtoc: openssl: Add GetHexOctet method
Hi Manorit,
Quoted 15 lines · Manorit Chawdhry
HexOctet format is used by openssl for FORMAT:HEX,OCT property in x509 certificates. Add a helper function to extract the integer numbers in HEX,OCT format to pass to openssl directly.
Signed-off-by Manorit Chawdhry <[email protected]>--- tools/dtoc/fdt_util.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)tools/dtoc/fdt_util.py +0
-0
tools/dtoc/fdt_util.py def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): · line 103
Quoted 4 lines
tools/dtoc/fdt_util.py +1
-0@@ -100,6 +100,26 @@ def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): command.run(dtc, *args, capture_stderr=capture_stderr) return dtb_output +def GetHexOctet(node, propname, default=None):
What is a hex octet?
tools/dtoc/fdt_util.py def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): · line 105
Quoted 2 lines
tools/dtoc/fdt_util.py +2
-0+ """Get an integer from a property in hex octet form required by openssl +
You should mention what size property is permitted.
tools/dtoc/fdt_util.py def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): · line 118
Quoted 13 lines
tools/dtoc/fdt_util.py +13
-0+ Args: + node: Node object to read from + propname: property name to read + default: Default value to use if the node/property do not exist + + Returns: + Integer value read as a String in Hex Octet Form + """ + prop = node.props.get(propname) + if not isinstance(prop.value, list) or len(prop.value) != 2: + value = GetInt(node, propname) + elif isinstance(prop.value, list) and len(prop.value) == 2: + value = GetInt64(node, propname)
What if it is neither of those?
tools/dtoc/fdt_util.py def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): · line 121
Quoted 3 lines
tools/dtoc/fdt_util.py +3
-0+ + hex_value = '%x' % (value) + return ('0' * (len(hex_value) & 1)) + hex_value
Can you do:
return f'{value:02x}'
?
Quoted 8 lines
tools/dtoc/fdt_util.py +1
-1+ def GetInt(node, propname, default=None): """Get an integer from a property --2.41.0
Re: [RFC PATCH v2 1/8] dtoc: openssl: Add GetHexOctet method
Hi Simon,
Quoted 21 lines · Simon Glass
Hi Manorit,
Quoted 18 lines · Manorit Chawdhry
HexOctet format is used by openssl for FORMAT:HEX,OCT property in x509 certificates. Add a helper function to extract the integer numbers in HEX,OCT format to pass to openssl directly.
Signed-off-by Manorit Chawdhry <[email protected]>--- tools/dtoc/fdt_util.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)tools/dtoc/fdt_util.py +0
-0@@ -100,6 +100,26 @@ def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): command.run(dtc, *args, capture_stderr=capture_stderr) return dtb_output
Quoted 4 lines
tools/dtoc/fdt_util.py def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): · line 103
Quoted 1 line
tools/dtoc/fdt_util.py +1
-0+def GetHexOctet(node, propname, default=None):What is a hex octet?
It is actually a Hex number in Octet form, basically using 0x0a instead of 0xa type of thing.
OpenSSL has complained when we use FORMAT:HEX,OCT:0 type of string instead of FORMAT:HEX,OCT:00. Tbvh I still haven't been able to find a clear documentation for this but this is what I have been able to figure out based on my tests.
Quoted 21 lines
tools/dtoc/fdt_util.py def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): · line 105
Quoted 2 lines
tools/dtoc/fdt_util.py +2
-0+ """Get an integer from a property in hex octet form required by openssl +You should mention what size property is permitted.
tools/dtoc/fdt_util.py def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): · line 118
Quoted 13 lines
tools/dtoc/fdt_util.py +13
-0+ Args: + node: Node object to read from + propname: property name to read + default: Default value to use if the node/property do not exist + + Returns: + Integer value read as a String in Hex Octet Form + """ + prop = node.props.get(propname) + if not isinstance(prop.value, list) or len(prop.value) != 2: + value = GetInt(node, propname) + elif isinstance(prop.value, list) and len(prop.value) == 2: + value = GetInt64(node, propname)What if it is neither of those?
Quoted 8 lines
tools/dtoc/fdt_util.py def EnsureCompiled(fname, tmpdir=None, capture_stderr=False): · line 121
Quoted 3 lines
tools/dtoc/fdt_util.py +3
-0+ + hex_value = '%x' % (value) + return ('0' * (len(hex_value) & 1)) + hex_valueCan you do:
return f'{value:02x}'
With the following suggestion I don't think I need the patch at all anymore given that no one else seems to be requiring this HEX,OCT just yet and am still in the process of finding a clear documentation for it.
Will be dropping that patch after testing if not required to be generic. Thanks!
Regards,
Manorit
Quoted 11 lines
?
Quoted 8 lines
tools/dtoc/fdt_util.py +1
-1+ def GetInt(node, propname, default=None): """Get an integer from a property --2.41.0
RFC PATCH v2 2/8 binman: ti-secure: Add support for firewalling entities
In reply to Manorit ChawdhryWe can now firewall entities while loading them through our secure entity TIFS, the required information should be present in the certificate that is being parsed by TIFS.
The following commit adds the support to enable the certificates to be generated if the firewall configurations are present in the binman dtsi nodes.
--- tools/binman/btool/openssl.py | 16 +++++++- tools/binman/etype/ti_secure.py | 85 +++++++++++++++++++++++++++++++++++++++++ tools/binman/etype/x509_cert.py | 3 +- 3 files changed, 101 insertions(+), 3 deletions(-)
tools/binman/btool/openssl.py +14 -2
@@ -82,7 +82,7 @@ imageSize = INTEGER:{len(indata)} return self.run_cmd(*args) def x509_cert_sysfw(self, cert_fname, input_fname, key_fname, sw_rev, - config_fname, req_dist_name_dict): + config_fname, req_dist_name_dict, firewall_cert_data): """Create a certificate to be booted by system firmware Args:
@@ -94,6 +94,13 @@ imageSize = INTEGER:{len(indata)} req_dist_name_dict (dict): Dictionary containing key-value pairs of req_distinguished_name section extensions, must contain extensions for C, ST, L, O, OU, CN and emailAddress + firewall_cert_data (dict): + - auth_in_place (int): The Priv ID for copying as the + specific host in firewall protected region + - num_firewalls (int): The number of firewalls in the + extended certificate + - certificate (str): Extended firewall certificate with + the information for the firewall configurations. Returns: str: Tool output
@@ -121,6 +128,7 @@ basicConstraints = CA:true 1.3.6.1.4.1.294.1.3 = ASN1:SEQUENCE:swrv 1.3.6.1.4.1.294.1.34 = ASN1:SEQUENCE:sysfw_image_integrity 1.3.6.1.4.1.294.1.35 = ASN1:SEQUENCE:sysfw_image_load +1.3.6.1.4.1.294.1.37 = ASN1:SEQUENCE:firewall [ swrv ] swrv = INTEGER:{sw_rev}
@@ -132,7 +140,11 @@ imageSize = INTEGER:{len(indata)} [ sysfw_image_load ] destAddr = FORMAT:HEX,OCT:00000000 -authInPlace = INTEGER:2 +authInPlace = INTEGER:{hex(firewall_cert_data['auth_in_place'])} + +[ firewall ] +numFirewallRegions = INTEGER:{firewall_cert_data['num_firewalls']} +{firewall_cert_data['certificate']} ''', file=outf) args = ['req', '-new', '-x509', '-key', key_fname, '-nodes', '-outform', 'DER', '-out', cert_fname, '-config', config_fname,
tools/binman/etype/ti_secure.py +85 -0
123 lines not on this page · raw message
tools/binman/etype/x509_cert.py +2 -1
@@ -98,7 +98,8 @@ class Entry_x509_cert(Entry_collection): key_fname=self.key_fname, config_fname=config_fname, sw_rev=self.sw_rev, - req_dist_name_dict=self.req_dist_name) + req_dist_name_dict=self.req_dist_name, + firewall_cert_data=self.firewall_cert_data) elif type == 'rom': stdout = self.openssl.x509_cert_rom( cert_fname=output_fname,
Signature · 1 line
2.41.0
Re: [RFC PATCH v2 2/8] binman: ti-secure: Add support for firewalling entities
Hi Manorit,
Quoted 9 lines · Manorit Chawdhry
We can now firewall entities while loading them through our secure entity TIFS, the required information should be present in the certificate that is being parsed by TIFS.
The following commit adds the support to enable the certificates to be generated if the firewall configurations are present in the binman dtsi nodes.
Quoted 7 lines
Signed-off-by Manorit Chawdhry <[email protected]>--- tools/binman/btool/openssl.py | 16 +++++++- tools/binman/etype/ti_secure.py | 85 +++++++++++++++++++++++++++++++++++++++++ tools/binman/etype/x509_cert.py | 3 +- 3 files changed, 101 insertions(+), 3 deletions(-)
Please do check that you have 100% test coverage here (binman test -T)
Regards,
Simon
Re: [RFC PATCH v2 2/8] binman: ti-secure: Add support for firewalling entities
Hi Simon,
Quoted 20 lines · Simon Glass
Hi Manorit,
Quoted 9 lines · Manorit Chawdhry
We can now firewall entities while loading them through our secure entity TIFS, the required information should be present in the certificate that is being parsed by TIFS.
The following commit adds the support to enable the certificates to be generated if the firewall configurations are present in the binman dtsi nodes.
Quoted 7 lines
Signed-off-by Manorit Chawdhry <[email protected]>--- tools/binman/btool/openssl.py | 16 +++++++- tools/binman/etype/ti_secure.py | 85 +++++++++++++++++++++++++++++++++++++++++ tools/binman/etype/x509_cert.py | 3 +- 3 files changed, 101 insertions(+), 3 deletions(-)
Quoted 2 lines
Please do check that you have 100% test coverage here (binman test -T)
Name Stmts Miss Cover
---------------------------------------------------------------------------
[snip]
tools/binman/btool/openssl.py 42 0 100% tools/binman/etype/ti_secure.py 57 0 100% tools/binman/etype/x509_cert.py 70 0 100%
[snip]
---------------------------------------------------------------------------
TOTAL 5588 134 98%
I did check that, did you notice something else that I might've missed? I just checked for the files that I have changed, I am not sure if there are any dependencies that I also have to keep in mind. Do let me know if I missed something.
Regards,
Manorit
Quoted 2 lines
Regards,
Simon
Re: [RFC PATCH v2 2/8] binman: ti-secure: Add support for firewalling entities
Hi Manorit,
Quoted 33 lines · Manorit Chawdhry
Hi Simon,
Quoted 20 lines · Simon Glass
Hi Manorit,
Quoted 9 lines · Manorit Chawdhry
We can now firewall entities while loading them through our secure entity TIFS, the required information should be present in the certificate that is being parsed by TIFS.
The following commit adds the support to enable the certificates to be generated if the firewall configurations are present in the binman dtsi nodes.
Quoted 7 lines
Signed-off-by Manorit Chawdhry <[email protected]>--- tools/binman/btool/openssl.py | 16 +++++++- tools/binman/etype/ti_secure.py | 85 +++++++++++++++++++++++++++++++++++++++++ tools/binman/etype/x509_cert.py | 3 +- 3 files changed, 101 insertions(+), 3 deletions(-)Quoted 2 lines
Please do check that you have 100% test coverage here (binman test -T)
Name Stmts Miss Cover
---------------------------------------------------------------------------
[snip]tools/binman/btool/openssl.py 42 0 100% tools/binman/etype/ti_secure.py 57 0 100% tools/binman/etype/x509_cert.py 70 0 100%
Quoted 8 lines
[snip]
---------------------------------------------------------------------------
TOTAL 5588 134 98%I did check that, did you notice something else that I might've missed? I just checked for the files that I have changed, I am not sure if there are any dependencies that I also have to keep in mind. Do let me know if I missed something.
Yes it seems to be a problem with a Xilinx tool. I sent an email about it, so don't worry about this.
Regards,
iSimon
RFC PATCH v2 3/8 binman: ftest: Add test for ti-secure firewall node
In reply to Manorit ChawdhryAdd test for TI firewalling node in ti-secure.
--- tools/binman/ftest.py | 12 ++++++++++++ tools/binman/test/311_ti_secure_firewall.dts | 28 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
tools/binman/ftest.py +12 -0
@@ -7030,6 +7030,18 @@ fdt fdtmap Extract the devicetree blob from the fdtmap entry_args=entry_args)[0] self.assertGreater(len(data), len(TI_UNSECURE_DATA)) + def testPackTiSecureFirewall(self): + """Test that an image with a TI secured binary can be created""" + keyfile = self.TestFile('key.key') + entry_args = { + 'keyfile': keyfile, + } + data_no_firewall = self._DoReadFileDtb('296_ti_secure.dts', + entry_args=entry_args)[0] + data_firewall = self._DoReadFileDtb('311_ti_secure_firewall.dts', + entry_args=entry_args)[0] + self.assertGreater(len(data_firewall),len(data_no_firewall)) + def testPackTiSecureMissingTool(self): """Test that an image with a TI secured binary (non-functional) can be created when openssl is missing"""
tools/binman/test/311_ti_secure_firewall.dts new file +28 -0
@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-secure { + content = <&unsecure_binary>; + auth_in_place = <0xa02>; + + firewall-0-2 { + id = <0>; + region = <2>; + control = <0x31a>; + permissions = <0xc3ffff>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + }; + unsecure_binary: blob-ext { + filename = "ti_unsecure.bin"; + }; + }; +};
Signature · 1 line
2.41.0
Re: [RFC PATCH v2 3/8] binman: ftest: Add test for ti-secure firewall node
Quoted 9 lines · Manorit Chawdhry
Add test for TI firewalling node in ti-secure.
Signed-off-by Manorit Chawdhry <[email protected]>--- tools/binman/ftest.py | 12 ++++++++++++ tools/binman/test/311_ti_secure_firewall.dts | 28 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
RFC PATCH v2 4/8 binman: k3: add k3-security.h and include it in k3-binman.dtsi
In reply to Manorit ChawdhryFor readability during configuring firewalls, adding k3-security.h file and including it in k3-binman.dtsi to be accessible across K3 SoCs
--- arch/arm/dts/k3-binman.dtsi | 2 ++ arch/arm/dts/k3-security.h | 58 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+)
arch/arm/dts/k3-binman.dtsi +2 -0
@@ -3,6 +3,8 @@ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/ */ +#include "k3-security.h" + / { binman: binman { multiple-images;
arch/arm/dts/k3-security.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.41.0
Re: [RFC PATCH v2 4/8] binman: k3: add k3-security.h and include it in k3-binman.dtsi
Hi Manorit,
Quoted 10 lines · Manorit Chawdhry
For readability during configuring firewalls, adding
k3-security.hfile and including it ink3-binman.dtsito be accessible across K3 SoCsSigned-off-by Manorit Chawdhry <[email protected]>--- arch/arm/dts/k3-binman.dtsi | 2 ++ arch/arm/dts/k3-security.h | 58 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+)
nits below
Quoted 20 lines
arch/arm/dts/k3-binman.dtsi +2
-0@@ -3,6 +3,8 @@ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/ */ +#include "k3-security.h" + / { binman: binman { multiple-images;arch/arm/dts/k3-security.h new file +1
-0@@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0
arch/arm/dts/k3-security.h line 11
Quoted 10 lines
arch/arm/dts/k3-security.h new file +10
-0+/* +* Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/ +*/ + +#ifndef DTS_ARM64_TI_K3_FIREWALL_H +#define DTS_ARM64_TI_K3_FIREWALL_H + +#define FWPRIVID_ALL (0xc3) +#define FWPRIVID_ARMV8 (1) +#define FWPRIVID_SHIFT (16)
drop () on those three and the next one
Quoted 49 lines
arch/arm/dts/k3-security.h new file +47
-1+ +#define FWCTRL_EN (0xA) +#define FWCTRL_LOCK (1 << 4) +#define FWCTRL_BG (1 << 8) +#define FWCTRL_CACHE (1 << 9) + +#define FWPERM_SECURE_PRIV_WRITE (1 << 0) +#define FWPERM_SECURE_PRIV_READ (1 << 1) +#define FWPERM_SECURE_PRIV_CACHEABLE (1 << 2) +#define FWPERM_SECURE_PRIV_DEBUG (1 << 3) + +#define FWPERM_SECURE_PRIV_RWCD (FWPERM_SECURE_PRIV_READ | \ + FWPERM_SECURE_PRIV_WRITE | \ + FWPERM_SECURE_PRIV_CACHEABLE | \ + FWPERM_SECURE_PRIV_DEBUG) + +#define FWPERM_SECURE_USER_WRITE (1 << 4) +#define FWPERM_SECURE_USER_READ (1 << 5) +#define FWPERM_SECURE_USER_CACHEABLE (1 << 6) +#define FWPERM_SECURE_USER_DEBUG (1 << 7) + +#define FWPERM_SECURE_USER_RWCD (FWPERM_SECURE_USER_READ | \ + FWPERM_SECURE_USER_WRITE | \ + FWPERM_SECURE_USER_CACHEABLE | \ + FWPERM_SECURE_USER_DEBUG) + +#define FWPERM_NON_SECURE_PRIV_WRITE (1 << 8) +#define FWPERM_NON_SECURE_PRIV_READ (1 << 9) +#define FWPERM_NON_SECURE_PRIV_CACHEABLE (1 << 10) +#define FWPERM_NON_SECURE_PRIV_DEBUG (1 << 11) + +#define FWPERM_NON_SECURE_PRIV_RWCD (FWPERM_NON_SECURE_PRIV_READ | \ + FWPERM_NON_SECURE_PRIV_WRITE | \ + FWPERM_NON_SECURE_PRIV_CACHEABLE | \ + FWPERM_NON_SECURE_PRIV_DEBUG) + +#define FWPERM_NON_SECURE_USER_WRITE (1 << 12) +#define FWPERM_NON_SECURE_USER_READ (1 << 13) +#define FWPERM_NON_SECURE_USER_CACHEABLE (1 << 14) +#define FWPERM_NON_SECURE_USER_DEBUG (1 << 15) + +#define FWPERM_NON_SECURE_USER_RWCD (FWPERM_NON_SECURE_USER_READ | \ + FWPERM_NON_SECURE_USER_WRITE | \ + FWPERM_NON_SECURE_USER_CACHEABLE | \ + FWPERM_NON_SECURE_USER_DEBUG) + +#endif --
Quoted 2 lines
2.41.0
Regards,
Simon
Re: [RFC PATCH v2 4/8] binman: k3: add k3-security.h and include it in k3-binman.dtsi
Hi Simon,
Quoted 42 lines · Simon Glass
Hi Manorit,
Quoted 10 lines · Manorit Chawdhry
For readability during configuring firewalls, adding
k3-security.hfile and including it ink3-binman.dtsito be accessible across K3 SoCsSigned-off-by Manorit Chawdhry <[email protected]>--- arch/arm/dts/k3-binman.dtsi | 2 ++ arch/arm/dts/k3-security.h | 58 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+)Reviewed-by Simon Glass <[email protected]>nits below
Quoted 24 lines
arch/arm/dts/k3-binman.dtsi +2
-0@@ -3,6 +3,8 @@ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/ */ +#include "k3-security.h" + / { binman: binman { multiple-images;arch/arm/dts/k3-security.h new file +5
-0@@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/ +*/ +
Quoted 9 lines
arch/arm/dts/k3-security.h line 11
Quoted 6 lines
arch/arm/dts/k3-security.h new file +6
-0+#ifndef DTS_ARM64_TI_K3_FIREWALL_H +#define DTS_ARM64_TI_K3_FIREWALL_H + +#define FWPRIVID_ALL (0xc3) +#define FWPRIVID_ARMV8 (1) +#define FWPRIVID_SHIFT (16)drop () on those three and the next one
Would fix those in next revision. Thanks for the reviews!
Regards,
Manorit
Quoted 54 lines
Quoted 49 lines
arch/arm/dts/k3-security.h new file +47
-1+ +#define FWCTRL_EN (0xA) +#define FWCTRL_LOCK (1 << 4) +#define FWCTRL_BG (1 << 8) +#define FWCTRL_CACHE (1 << 9) + +#define FWPERM_SECURE_PRIV_WRITE (1 << 0) +#define FWPERM_SECURE_PRIV_READ (1 << 1) +#define FWPERM_SECURE_PRIV_CACHEABLE (1 << 2) +#define FWPERM_SECURE_PRIV_DEBUG (1 << 3) + +#define FWPERM_SECURE_PRIV_RWCD (FWPERM_SECURE_PRIV_READ | \ + FWPERM_SECURE_PRIV_WRITE | \ + FWPERM_SECURE_PRIV_CACHEABLE | \ + FWPERM_SECURE_PRIV_DEBUG) + +#define FWPERM_SECURE_USER_WRITE (1 << 4) +#define FWPERM_SECURE_USER_READ (1 << 5) +#define FWPERM_SECURE_USER_CACHEABLE (1 << 6) +#define FWPERM_SECURE_USER_DEBUG (1 << 7) + +#define FWPERM_SECURE_USER_RWCD (FWPERM_SECURE_USER_READ | \ + FWPERM_SECURE_USER_WRITE | \ + FWPERM_SECURE_USER_CACHEABLE | \ + FWPERM_SECURE_USER_DEBUG) + +#define FWPERM_NON_SECURE_PRIV_WRITE (1 << 8) +#define FWPERM_NON_SECURE_PRIV_READ (1 << 9) +#define FWPERM_NON_SECURE_PRIV_CACHEABLE (1 << 10) +#define FWPERM_NON_SECURE_PRIV_DEBUG (1 << 11) + +#define FWPERM_NON_SECURE_PRIV_RWCD (FWPERM_NON_SECURE_PRIV_READ | \ + FWPERM_NON_SECURE_PRIV_WRITE | \ + FWPERM_NON_SECURE_PRIV_CACHEABLE | \ + FWPERM_NON_SECURE_PRIV_DEBUG) + +#define FWPERM_NON_SECURE_USER_WRITE (1 << 12) +#define FWPERM_NON_SECURE_USER_READ (1 << 13) +#define FWPERM_NON_SECURE_USER_CACHEABLE (1 << 14) +#define FWPERM_NON_SECURE_USER_DEBUG (1 << 15) + +#define FWPERM_NON_SECURE_USER_RWCD (FWPERM_NON_SECURE_USER_READ | \ + FWPERM_NON_SECURE_USER_WRITE | \ + FWPERM_NON_SECURE_USER_CACHEABLE | \ + FWPERM_NON_SECURE_USER_DEBUG) + +#endif --Quoted 2 lines
2.41.0
Regards,
Simon
RFC PATCH v2 5/8 binman: j721e: Add firewall configurations for atf
In reply to Manorit ChawdhryThe following commits adds the configuration of firewalls required to protect ATF and OP-TEE memory region from non-secure reads and writes using master and slave firewalls present in our K3 SOCs.
--- arch/arm/dts/k3-j721e-binman.dtsi | 183 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+)
arch/arm/dts/k3-j721e-binman.dtsi +183 -0
@@ -330,6 +330,100 @@ ti-secure { content = <&atf>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + firewall-257-0 { + /* cpu_0_cpu_0_msmc Background Firewall */ + id = <257>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-257-1 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + firewall-284-0 { + /* dru_0_msmc Background Firewall */ + id = <284>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-284-1 { + /* dru_0_msmc Foreground Firewall */ + id = <284>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-4760-0 { + nb_slv0__mem0 Background Firewall + Already configured by the secure entity + }; */ + + firewall-4760-1 { + /* nb_slv0__mem0 Foreground Firewall */ + id = <4760>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-4761-0 { + nb_slv1__mem0 Background Firewall + Already configured by the secure entity + }; */ + + firewall-4761-1 { + /* nb_slv1__mem0 Foreground Firewall */ + id = <4761>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + }; atf: atf-bl31 { };
@@ -346,6 +440,95 @@ ti-secure { content = <&tee>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + /* cpu_0_cpu_0_msmc region 0 and 1 configured + during ATF Firewalling */ + + firewall-257-2 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + /* dru_0_msmc region 0 and 1 configured + during ATF Firewalling */ + + firewall-284-2 { + /* dru_0_msmc Foreground Firewall */ + id = <284>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-4762-0 { + /* nb_slv2__mem0 Background Firewall */ + id = <4762>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-4762-1 { + /* nb_slv2__mem0 Foreground Firewall */ + id = <4762>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-4763-0 { + /* nb_slv3__mem0 Background Firewall */ + id = <4763>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-4763-1 { + /* nb_slv3__mem0 Foreground Firewall */ + id = <4763>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; }; tee: tee-os { };
Signature · 1 line
2.41.0
RFC PATCH v2 6/8 binman: am62x: Add firewalling configurations
In reply to Manorit ChawdhryThe following commits adds the configuration of firewalls required to protect ATF and OP-TEE memory region from non-secure reads and writes using master and slave firewalls present in our K3 SOCs.
--- arch/arm/dts/k3-am625-sk-binman.dtsi | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
arch/arm/dts/k3-am625-sk-binman.dtsi +49 -0
@@ -175,6 +175,36 @@ ti-secure { content = <&atf>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + firewall-1-0 { + /* sdram Background Firewall - 0 */ + id = <1>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-1-1 { + /* sdram Foreground Firewall */ + id = <1>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e780000>; + end_address = <0x0 0x9e7fffff>; + }; + }; atf: atf-bl31 { };
@@ -191,8 +221,27 @@ ti-secure { content = <&tee>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + /* sdram region 0 and 1 configured during + ATF Firewalling */ + + firewall-1-2 { + /* sdram Foreground Firewall */ + id = <1>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + }; tee: tee-os { + }; };
Signature · 1 line
2.41.0
RFC PATCH v2 7/8 binman: j721s2: Add firewall configurations
In reply to Manorit ChawdhryThe following commits adds the configuration of firewalls required to protect ATF and OP-TEE memory region from non-secure reads and writes using master and slave firewalls present in our K3 SOCs.
--- arch/arm/dts/k3-j721s2-binman.dtsi | 206 +++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+)
arch/arm/dts/k3-j721s2-binman.dtsi +206 -0
@@ -177,6 +177,100 @@ ti-secure { content = <&atf>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + firewall-257-0 { + /* cpu_0_cpu_0_msmc Background Firewall */ + id = <257>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-257-1 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + firewall-284-0 { + /* dru_0_msmc Background Firewall */ + id = <284>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-284-1 { + /* dru_0_msmc Foreground Firewall */ + id = <284>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-5140-0 { + nb_slv0__mem0 Background Firewall + Already configured by the secure entity + }; */ + + firewall-5140-1 { + /* nb_slv0__mem0 Foreground Firewall */ + id = <5140>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-5140-0 { + nb_slv1__mem0 Background Firewall + Already configured by the secure entity + }; */ + + firewall-5141-1 { + /* nb_slv1__mem0 Foreground Firewall */ + id = <5141>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + }; atf: atf-bl31 { };
@@ -193,6 +287,118 @@ ti-secure { content = <&tee>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + firewall-257-2 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-284-2 { + /* dru_0_msmc Foreground Firewall */ + id = <284>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-5142-0 { + /* nb_slv2__mem0 Background Firewall - 0 */ + id = <5142>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-5142-1 { + /* nb_slv2__mem0 Foreground Firewall */ + id = <5142>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-5143-0 { + /* nb_slv3__mem0 Background Firewall - 0 */ + id = <5143>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-5143-1 { + /* nb_slv3__mem0 Foreground Firewall */ + id = <5143>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-5144-0 { + /* nb_slv4__mem0 Background Firewall - 0 */ + id = <5144>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-5144-1 { + /* nb_slv4__mem0 Foreground Firewall */ + id = <5144>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + }; tee: tee-os { };
Signature · 1 line
2.41.0
RFC PATCH v2 8/8 binman: j7200: Add firewall configurations
In reply to Manorit ChawdhryThe following commits adds the configuration of firewalls required to protect ATF and OP-TEE memory region from non-secure reads and writes using master and slave firewalls present in our K3 SOCs.
--- arch/arm/dts/k3-j7200-binman.dtsi | 137 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+)
arch/arm/dts/k3-j7200-binman.dtsi +137 -0
@@ -214,6 +214,72 @@ ti-secure { content = <&atf>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + firewall-257-0 { + /* cpu_0_cpu_0_msmc Background Firewall */ + id = <257>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-257-1 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-4760-0 { + nb_slv0__mem0 Background Firewall + Already configured by the secure entity + }; */ + + firewall-4760-1 { + /* nb_slv0__mem0 Foreground Firewall */ + id = <4760>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-4761-0 { + nb_slv1__mem0 Background Firewall + Already configured by the secure entity + }; */ + + firewall-4761-1 { + /* nb_slv1__mem0 Foreground Firewall */ + id = <4761>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + }; atf: atf-bl31 { };
@@ -230,6 +296,77 @@ ti-secure { content = <&tee>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + firewall-257-2 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-4762-0 { + /* nb_slv2__mem0 Background Firewall - 0 */ + id = <4762>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-4762-1 { + /* nb_slv2__mem0 Foreground Firewall */ + id = <4762>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-4763-0 { + /* nb_slv3__mem0 Background Firewall - 0 */ + id = <4763>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-4763-1 { + /* nb_slv3__mem0 Foreground Firewall */ + id = <4763>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + }; tee: tee-os { };
Signature · 1 line
2.41.0
Quoted 10 lines · Manorit Chawdhry
K3 devices have firewalls that are used to prevent illegal accesses to memory regions that are deemed secure. The series prevents the illegal accesses to ATF and OP-TEE regions that are present in different K3 devices.
AM62AX and AM64X are currently in hold due to some firewall configurations that our System Controller (TIFS) needs to handle.
Signed-off-by Manorit Chawdhry <[email protected]>---
You have mixed tabs and spaces in the .dtsi patches.
Andrew
Quoted 48 lines
Changes in v2:
Andrew:
- Make the firewall DTS more readable with CONSTANTSNeha:
- Move GetHexOctet to dtoc for common usage
- Update the documentation in ti-secure
- s/indentifier/identifier/
- Add firewall binman test- Remove slave firewall multiple background regions
( Single firewall region works fine )
- Add a check in the subnodes to check for the node.name 'firewall'
- Change firewall indexing with id and region number so that it is easy
to purge out firewalls and we don't need to redo the numbering.
- Add information for all the firewalls.
- Link to v1: https://lore.kernel.org/u-boot/[email protected]/---
Manorit Chawdhry (8):
dtoc: openssl: Add GetHexOctet method
binman: ti-secure: Add support for firewalling entities
binman: ftest: Add test for ti-secure firewall node
binman: k3: addk3-security.hand include it ink3-binman.dtsi
binman: j721e: Add firewall configurations for atf
binman: am62x: Add firewalling configurations
binman: j721s2: Add firewall configurations
binman: j7200: Add firewall configurationsarch/arm/dts/k3-am625-sk-binman.dtsi | 49 +++++++ arch/arm/dts/k3-binman.dtsi | 2 + arch/arm/dts/k3-j7200-binman.dtsi | 137 ++++++++++++++++++ arch/arm/dts/k3-j721e-binman.dtsi | 183 ++++++++++++++++++++++++ arch/arm/dts/k3-j721s2-binman.dtsi | 206 +++++++++++++++++++++++++++ arch/arm/dts/k3-security.h | 58 ++++++++ tools/binman/btool/openssl.py | 16 ++- tools/binman/etype/ti_secure.py | 85 +++++++++++ tools/binman/etype/x509_cert.py | 3 +- tools/binman/ftest.py | 12 ++ tools/binman/test/311_ti_secure_firewall.dts | 28 ++++ tools/dtoc/fdt_util.py | 20 +++ 12 files changed, 796 insertions(+), 3 deletions(-)---
base-commit:2fe4b54556ea6271237b35de68dc458bfceab94c
change-id: 20230724-binman-firewalling-65ecdb23ec0aBest regards,
Hi Andrew,
Quoted 6 lines · Andrew Davis
Quoted 5 lines · Manorit Chawdhry
K3 devices have firewalls that are used to prevent illegal accesses to memory regions that are deemed secure. The series prevents the illegal accesses to ATF and OP-TEE regions that are present in different K3 devices.
Quoted 7 lines
Quoted 5 lines
AM62AX and AM64X are currently in hold due to some firewall configurations that our System Controller (TIFS) needs to handle.
Signed-off-by Manorit Chawdhry <[email protected]>---
You have mixed tabs and spaces in the .dtsi patches.
Thanks for this, would be sending a v3 with the fixes.
Regards,
Manorit
Quoted 51 lines
Andrew
Quoted 48 lines
Changes in v2:
Andrew:
- Make the firewall DTS more readable with CONSTANTSNeha:
- Move GetHexOctet to dtoc for common usage
- Update the documentation in ti-secure
- s/indentifier/identifier/
- Add firewall binman test- Remove slave firewall multiple background regions
( Single firewall region works fine )
- Add a check in the subnodes to check for the node.name 'firewall'
- Change firewall indexing with id and region number so that it is easy
to purge out firewalls and we don't need to redo the numbering.
- Add information for all the firewalls.
- Link to v1: https://lore.kernel.org/u-boot/[email protected]/---
Manorit Chawdhry (8):
dtoc: openssl: Add GetHexOctet method
binman: ti-secure: Add support for firewalling entities
binman: ftest: Add test for ti-secure firewall node
binman: k3: addk3-security.hand include it ink3-binman.dtsi
binman: j721e: Add firewall configurations for atf
binman: am62x: Add firewalling configurations
binman: j721s2: Add firewall configurations
binman: j7200: Add firewall configurationsarch/arm/dts/k3-am625-sk-binman.dtsi | 49 +++++++ arch/arm/dts/k3-binman.dtsi | 2 + arch/arm/dts/k3-j7200-binman.dtsi | 137 ++++++++++++++++++ arch/arm/dts/k3-j721e-binman.dtsi | 183 ++++++++++++++++++++++++ arch/arm/dts/k3-j721s2-binman.dtsi | 206 +++++++++++++++++++++++++++ arch/arm/dts/k3-security.h | 58 ++++++++ tools/binman/btool/openssl.py | 16 ++- tools/binman/etype/ti_secure.py | 85 +++++++++++ tools/binman/etype/x509_cert.py | 3 +- tools/binman/ftest.py | 12 ++ tools/binman/test/311_ti_secure_firewall.dts | 28 ++++ tools/dtoc/fdt_util.py | 20 +++ 12 files changed, 796 insertions(+), 3 deletions(-)---
base-commit:2fe4b54556ea6271237b35de68dc458bfceab94c
change-id: 20230724-binman-firewalling-65ecdb23ec0aBest regards,