6. Global privilege controller (GTZC)

6.1 Introduction

This section describes the global privilege controller (GTZC) block that contains the following subblocks:

These subblocks are used to configure privilege in a product having bus agents with privileged attributes such as:

6.2 GTZC main features

The GTZC main features are listed below:

GTZC privilege system architecture

AHB and APB Peripherals can be categorized as:

The privilege protection architecture with privilege and privilege-aware peripherals is shown in the figure below.

Figure 8. GTZC privilege architecture

Figure 8. GTZC privilege architecture diagram showing the Cortex-M33, AHB masters, AHB bus, AHB2/APB bridge, Priv gate, TZSC, MPCBBx, GTZC1, UART, SPI, Timer, APB bus, Internal SRAM, and Backup SRAM.

The diagram illustrates the GTZC privilege architecture. At the top, the Cortex-M33 and AHB masters are connected to a horizontal AHB bus. Below the AHB bus, on the left, is an AHB2/APB bridge containing a Priv gate. This bridge connects to an APB bus. Peripherals connected to the APB bus include a UART, SPI, and Timer. In the center, a large shaded box represents the GTZC1 block, which contains the TZSC and two MPCBBx subblocks. The Priv gate is connected to the TZSC via a 'Periph priv' signal. The AHB bus also connects directly to the GTZC1 block. To the right of the GTZC1 block, the AHB bus connects to an MPCWWM block, which in turn connects to a Backup SRAM. The Backup SRAM is divided into Subregion A and Sp. Below the GTZC1 block, there is an Internal SRAM block divided into multiple blocks (Block 1, Block 2, Block 3, Block 4, ..., Block N-1, Block N). The AHB bus also connects to this Internal SRAM block.

Figure 8. GTZC privilege architecture diagram showing the Cortex-M33, AHB masters, AHB bus, AHB2/APB bridge, Priv gate, TZSC, MPCBBx, GTZC1, UART, SPI, Timer, APB bus, Internal SRAM, and Backup SRAM.

6.3 GTZC implementation

The STM32H503xx devices embed one instance of GTZC.

Table 13. GTZC implementation

GTZC subblocksGTZC1
TZSCX
TZIC-
Number of MPCBB subblock2

Table 14. GTZC features

FeatureGTZC
Arm® TrustZone®-
PrivilegeX

The table below shows the address offset of GTZC subblocks versus GTZC base address (refer to Section 2.2 for GTZC1 base address).

Table 15. GTZC1 subblock address offset
GTZC1 subblockAddress offset
GTZC1_TZSC0x0
GTZC1_MPCBB10x800
GTZC1_MPCBB20xC00

The table below describes the characteristics of the available MPCWM.

Table 16. MPCWM resource assignment
GTZCMPCTarget memory interfaceNumber of priv/unpriv regionsWatermark granularity (bytes)
GTZC1MPCWMBKPSRAM132

The table below describes the characteristics of the available MPCBB.

Table 17. MPCBB resource assignment
GTZCMPCResourceMemory size (Kbytes)Block size (bytes)Number of blocksNumber of super-blocks
GTZC1MPCBB1SRAM116512321
MPCBB2SRAM2

6.4 GTZC functional description

6.4.1 GTZC block diagram

The figure below describes the combined feature of TZSC and MPCBB. Each sub-block is controlled by its own AHB configuration port.

The TZSC defines which peripheral is privileged. The privileged configuration bit of a peripheral can be modified by a privileged transaction.

Figure 9. GTZC block diagram

Figure 9. GTZC block diagram. The diagram shows the GTZC block containing the TZSC and MPCBB sub-blocks. The TZSC contains the PRIVCFGR register and the MPCWM4ACFGR/MPCWM4AR registers. The MPCBB contains the PRIVCFGR register. Two AHB buses enter the GTZC block. The TZSC's PRIVCFGR register controls access to peripherals. The MPCWM4ACFGR/MPCWM4AR registers control access to backup SRAM. The MPCBB's PRIVCFGR register controls access to internal SRAMs. All access paths are labeled 'Privileged/unprivileged'.

MSv69942V2

Figure 9. GTZC block diagram. The diagram shows the GTZC block containing the TZSC and MPCBB sub-blocks. The TZSC contains the PRIVCFGR register and the MPCWM4ACFGR/MPCWM4AR registers. The MPCBB contains the PRIVCFGR register. Two AHB buses enter the GTZC block. The TZSC's PRIVCFGR register controls access to peripherals. The MPCWM4ACFGR/MPCWM4AR registers control access to backup SRAM. The MPCBB's PRIVCFGR register controls access to internal SRAMs. All access paths are labeled 'Privileged/unprivileged'.

6.4.2 Illegal unprivileged access

Any unprivileged transaction trying to access a privileged resource is considered as illegal. There is no illegal access event generated for illegal read and write access. The addressed resource follows a silent-fail behavior, returning all zero data for read and ignoring any write. No bus error is generated. A bus error is generated when any unprivileged execute transaction tries to access a privileged memory.

6.4.3 Privilege controller (TZSC)

The TZSC is composed of a configurable set of registers, providing the following features:

The control register for the subregion can be used to enable/disable the watermark memory protection controller as well as defining the right attribute.

Figure 10. Watermark memory protection controller (region x/subregion A)

Diagram of Watermark memory protection controller (region x/subregion A). It shows a memory region 'Region x in privilege by default' divided into three horizontal sections. The top section is labeled 'Privileged', the middle is 'Unprivileged', and the bottom is 'Privileged'. Arrows from the left indicate 'SUBA_START' pointing to the boundary between the top and middle sections, and 'SUBA_START + SUBA_LENGTH' pointing to the boundary between the middle and bottom sections. The middle 'Unprivileged' section is labeled 'Subregion A' with an arrow from the right. The reference code 'MSv69714V2' is in the bottom right corner.
Diagram of Watermark memory protection controller (region x/subregion A). It shows a memory region 'Region x in privilege by default' divided into three horizontal sections. The top section is labeled 'Privileged', the middle is 'Unprivileged', and the bottom is 'Privileged'. Arrows from the left indicate 'SUBA_START' pointing to the boundary between the top and middle sections, and 'SUBA_START + SUBA_LENGTH' pointing to the boundary between the middle and bottom sections. The middle 'Unprivileged' section is labeled 'Subregion A' with an arrow from the right. The reference code 'MSv69714V2' is in the bottom right corner.

In the figure above, region x represents the backup SRAM region. The privileged attribute of subregion A is configurable. When no subregion is defined or enabled on the region x, then the default attribute of the region x is set as privileged.

6.4.4 Memory protection controller - block based (MPCBB)

The MPCBB is composed of a configurable set of registers allowing to define privileged policy for internal SRAM memories. The privileged policy can be individually configured per each 512-byte block of SRAM.

Figure 11. MPCBB block diagram

Block diagram of the MPCBB. A bidirectional arrow labeled 'AHB' connects to a box labeled 'MPCBB'. Inside the 'MPCBB' box is a smaller box labeled 'MPCBB_PRIVCFGR'. An arrow points from this inner box to the right, labeled 'Privileged/unprivileged'. The reference code 'MSv69715V2' is in the bottom right corner.
Block diagram of the MPCBB. A bidirectional arrow labeled 'AHB' connects to a box labeled 'MPCBB'. Inside the 'MPCBB' box is a smaller box labeled 'MPCBB_PRIVCFGR'. An arrow points from this inner box to the right, labeled 'Privileged/unprivileged'. The reference code 'MSv69715V2' is in the bottom right corner.

In order to setup the MPCBB, the privileged firmware must define which memory blocks are privileged by setting the correct bits in GTZC1_MPCBBz_PRIVCFGRx. A MPCBB super-block is made of 32 consecutive blocks.

Note: The block size is 512 bytes. The super-block size is 512 * 32 = 16 Kbytes.

6.4.5 Power-on/reset state

The power-on and reset state of the TZSC clear to 0 all bits of GTZC1_TZSC_PRIVCFGRx, meaning that all peripherals are set to unprivileged.

For internal SRAMx (x = 1 to 2), all GTZC1_MPCBBz_PRIVCFGRx are set to 0x0000 0000, making these internal memory block unprivileged by default.

For backup SRAM, GTZC1_TZSC_MPCWM4AR is set to 0x0800 0000, making the memory unprivileged by default.

6.5 GTZC1 TZSC registers

All registers are accessed only by words (32-bit).

6.5.1 GTZC1 TZSC privilege configuration register 1 (GTZC1_TZSC_PRIVCFGR1)

Address offset: 0x020

Reset value: 0x0000 0000

Write-privileged access only.

This register can be read or written only by privileged transaction.

Read accesses are authorized for any type of transactions, privileged or not.

31302928272625242322212019181716
LPTIM2PRIVDTSPRIVRes.Res.Res.Res.DAC1PRIVRes.Res.Res.Res.CRSPRIVI3C1PRIVI2C2PRIVI2C1PRIVRes.
rwrwrwrwrwrwrw
1514131211109876543210
Res.USART3PRIVUSART2PRIVSPI3PRIVSPI2PRIVIWDGPRIVWWDGPRIVRes.Res.Res.TIM7PRIVTIM6PRIVRes.Res.TIM3PRIVTIM2PRIV
rwrwrwrwrwrwrwrwrwrw

Bit 31 LPTIM2PRIV: privileged access mode for LPTIM2

Bit 30 DTSPRIV: privileged access mode for DTS

Bits 29:26 Reserved, must be kept at reset value.

Bit 25 DAC1PRIV: privileged access mode for DAC1

Bits 24:21 Reserved, must be kept at reset value.

Bit 20 CRSPRIV: privileged access mode for CRS

Bit 19 I3C1PRIV: privileged access mode for I3C1

Bit 18 I2C2PRIV: privileged access mode for I2C2

6.5.2 GTZC1 TZSC privilege configuration register 2 (GTZC1_TZSC_PRIVCFGR2)

Address offset: 0x024

Reset value: 0x0000 0000

Write-privileged access only.

This register can be read or written only by privileged transaction.

Read accesses are authorized for any type of transactions, privileged or not.

31302928272625242322212019181716
Res.Res.Res.LPTIM1PRIVRes.Res.LPUART1PRIVRes.Res.Res.Res.Res.USBPRIVRes.Res.Res.
rwrwrw
1514131211109876543210
Res.Res.Res.Res.USART1PRIVRes.SPI1PRIVTIM1PRIVRes.Res.Res.COMPPRIVOPAMPRIVRes.Res.FDCAN1PRIV
rwrwrwrwrwrw

Bits 31:29 Reserved, must be kept at reset value.

Bit 28 LPTIM1PRIV: privileged access mode for LPTIM1

0: unprivileged

1: privileged

Bits 27:26 Reserved, must be kept at reset value.

Bit 25 LPUART1PRIV: privileged access mode for LPUART

0: unprivileged

1: privileged

Bits 24:20 Reserved, must be kept at reset value.

Bit 19 USBPRIV: privileged access mode for USBSF

0: unprivileged

1: privileged

Bits 18:12 Reserved, must be kept at reset value.

Bit 11 USART1PRIV: privileged access mode for USART1

0: unprivileged

1: privileged

Bit 10 Reserved, must be kept at reset value.

Bit 9 SPI1PRIV: privileged access mode for SPI1

0: unprivileged

1: privileged

6.5.3 GTZC1 TZSC privilege configuration register 3 (GTZC1_TZSC_PRIVCFGR3)

Address offset: 0x028

Reset value: 0x0000 0000

Write-privileged access only.

This register can be read or written only by privileged transaction.

Read accesses are authorized for any type of transactions, privileged or not.

31302928272625242322212019181716
Res.Res.Res.Res.Res.RAMCFGPRIVRes.Res.Res.Res.Res.Res.Res.RNGPRIVHASHPRIVRes.
rwrwrw
1514131211109876543210
Res.ADC1PRIVRes.ICACHEPRIVRes.Res.Res.CRCPRIVRes.Res.Res.Res.Res.I3C2PRIVRes.Res.
rwrwrwrw

6.5.4 GTZC1 TZSC BKPSRAM subregion A watermark configuration register (GTZC1_TZSC_MPCWM4ACFGR)

Address offset: 0x070

Reset value: 0x0000 0000

Privilege access only.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.PRIVRes.Res.Res.Res.Res.Res.Res.SRLOCKSREN
rwrsrw

Bits 31:10 Reserved, must be kept at reset value.

Bit 9 PRIV: Privileged subregion A

This bit is taken into account only if SREN is set.

0: Privileged and unprivileged accesses are granted in subregion A.

1: Only privileged accesses are granted in subregion A.

Bits 8:2 Reserved, must be kept at reset value.

Bit 1 SRLOCK: Subregion A lock

This bit, once set, can be cleared only by a system reset.

0: GTZC1_TZSC_MPCWM4ACFGR and GTZC1_TZSC_MPCWM4AR can be written.

1: Writes to GTZC1_TZSC_MPCWM4ACFGR and GTZC1_TZSC_MPCWM4AR are ignored.

Bit 0 SREN: Subregion A enable

0: Subregion A is disabled. Access control of base region applies to any access between this subregion start- and end-addresses.

1: Subregion A is enabled. Access control defined in GTZC1_TZSC_MPCWM4ACFGR applies to any access between this subregion start- and end-address, both defined in GTZC1_TZSC_MPCWM4AR.

6.5.5 GTZC1 TZSC BKPSRAM subregion A watermark register (GTZC1_TZSC_MPCWM4AR)

Address offset: 0x074

Reset value: 0x0800 0000

Privilege access only.

When SUBA_START + SUBA_LENGTH is higher than the maximum size allowed for the memory, a saturation of SUBA_LENGTH is applied automatically.

31302928272625242322212019181716
Res.Res.Res.Res.SUBA_LENGTH[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.SUBA_START[10:0]
rwrwrwrwrwrwrwrwrwrwrw

Bits 31:28 Reserved, must be kept at reset value.

Bits 27:16 SUBA_LENGTH[11:0]: Length of subregion A

This field defines the length of the subregion A, to be multiplied by the granularity defined in Table 16.

When SUBA_START + SUBA_LENGTH is higher than the maximum size allowed for the memory, a saturation of SUBA_LENGTH is applied automatically.

If SUBA_LENGTH = 0, the subregion A is disabled (SREN bit in GTZC1_TZSC_MPCWM4ACFGR is cleared).

Bits 15:11 Reserved, must be kept at reset value.

Bits 10:0 SUBA_START[10:0]: Start of subregion A

This field defines the address offset of the subregion A, to be multiplied by the granularity defined in Table 16.

6.5.6 GTZC1 TZSC register map

Table 18. GTZC1 TZSC register map and reset values
OffsetRegister313029282726252423222120191817161514131211109876543210
0x000-
0x01C
ReservedReserved
0x020GTZC1_TZSC_
PRIVCFGR1
LPTIM2PRIVDTSPRIVRes.Res.Res.Res.Res.DAC1PRIVRes.Res.Res.CRSPRIVI3C1PRIVI2C2PRIVI2C1PRIVRes.Res.USART3PRIVUSART2PRIVSPI3PRIVSPI2PRIVIWDGPRIVWWDGPRIVRes.Res.Res.TIM7PRIVTIM6PRIVRes.Res.TIM3PRIVTIM2PRIV
Reset value00000000000000000
0x024GTZC1_TZSC_
PRIVCFGR2
Res.Res.Res.LPTIM1PRIVRes.Res.LPUART1PRIVRes.Res.Res.Res.Res.USBPRIVRes.Res.Res.Res.Res.Res.Res.USART1PRIVSPI1PRIVTIM1PRIVRes.Res.Res.Res.COMPPRIVOPAMPRIVRes.Res.FDCAN1PRIV
Reset value000000000
0x028GTZC1_TZSC_
PRIVCFGR3
Res.Res.Res.Res.Res.RAMCFGPRIVRes.Res.Res.Res.Res.Res.Res.RNGPRIVHASHPRIVRes.Res.ADC1PRIVRes.ICACHEPRIVRes.Res.CRCPRIVRes.Res.Res.Res.Res.Res.I3C2PRIVRes.Res.
Reset value0000000
0x02C-
0x06C
ReservedReserved
0x070GTZC1_TZSC_
MPCWM4ACFGR
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVRes.Res.Res.Res.Res.Res.Res.Res.SRLOCKSREN
Reset value000
0x74GTZC1_TZSC_
MPCWM4AR
Res.Res.Res.Res.SUBA_LENGTH[11:0]Res.Res.Res.Res.Res.SUBA_START[10:0]
Reset value10000000000000000000000

Refer to Table 15: GTZC1 subblock address offset.

6.6 GTZC1 MPCBBz registers (z = 1 to 2)

All registers are accessed only by words (32-bit).

6.6.1 GTZC1 SRAMz MPCBB privileged configuration for super-block x register (GTZC1_MPCBBz_PRIVCFGRx) (z = 1 to 2)

Address offset: Block 1: 0x200+0x04*x, (x = 0 to 31)

Address offset: Block 2: 0x600+0x04*x, (x = 0 to 31)

Reset value: 0x0000 0000

Write access to this register is privileged only. Any read is allowed.

31302928272625242322212019181716
PRIV31PRIV30PRIV29PRIV28PRIV27PRIV26PRIV25PRIV24PRIV23PRIV22PRIV21PRIV20PRIV19PRIV18PRIV17PRIV16
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
PRIV15PRIV14PRIV13PRIV12PRIV11PRIV10PRIV9PRIV8PRIV7PRIV6PRIV5PRIV4PRIV3PRIV2PRIV1PRIV0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 PRIVy: Privileged configuration for block y, belonging to super-block x (y = 31 to 0).

0: Privileged and unprivileged access to block y, belonging to super-block x

1: Only privileged access to block y, belonging to super-block x

6.6.2 GTZC1 MPCBBz register map (z = 1 to 2)

Table 19. GTZC1 MPCBBz register map and reset values (z = 1 to 2)

OffsetRegister313029282726252423222120191817161514131211109876543210
0x200+0x04*x
(x = 0 to 31)
GTZC1_MPCBB1_PRIVCFGRxPRIV31PRIV30PRIV29PRIV28PRIV27PRIV26PRIV25PRIV24PRIV23PRIV22PRIV21PRIV20PRIV19PRIV18PRIV17PRIV16PRIV15PRIV14PRIV13PRIV12PRIV11PRIV10PRIV9PRIV8PRIV7PRIV6PRIV5PRIV4PRIV3PRIV2PRIV1PRIV0
Reset value00000000000000000000000000000000
0x600+0x04*x
(x = 0 to 31)
GTZC1_MPCBB2_PRIVCFGRxPRIV31PRIV30PRIV29PRIV28PRIV27PRIV26PRIV25PRIV24PRIV23PRIV22PRIV21PRIV20PRIV19PRIV18PRIV17PRIV16PRIV15PRIV14PRIV13PRIV12PRIV11PRIV10PRIV9PRIV8PRIV7PRIV6PRIV5PRIV4PRIV3PRIV2PRIV1PRIV0
Reset value00000000000000000000000000000000

Refer to Table 15: GTZC1 subblock address offset.