diff options
| author | Manish Pandey <manish.pandey2@arm.com> | 2022-05-19 15:15:49 +0200 |
|---|---|---|
| committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2022-05-19 15:15:49 +0200 |
| commit | 0a9a0edf98d3ce83e5578e6261d81b45a0dc1ed9 (patch) | |
| tree | f25b091f28e3cba564993792694064a33797b29d | |
| parent | 687cb6bdd3c8d01128661b52b118c689b1bdc9a1 (diff) | |
| parent | 0de3edac37a242984d0e85ca2fb4b4443bd4414f (diff) | |
| download | arm-trusted-firmware-0a9a0edf98d3ce83e5578e6261d81b45a0dc1ed9.tar.gz | |
Merge changes from topic "mb/drtm-work-phase-1" into integration
* changes:
build(changelog): add new scope for Arm SMMU driver
feat(smmu): add SMMU abort transaction function
docs(build): add build option for DRTM support
build(drtm): add DRTM support build option
| -rw-r--r-- | Makefile | 6 | ||||
| -rw-r--r-- | changelog.yaml | 3 | ||||
| -rw-r--r-- | docs/getting_started/build-options.rst | 10 | ||||
| -rw-r--r-- | drivers/arm/smmu/smmu_v3.c | 27 | ||||
| -rw-r--r-- | include/drivers/arm/smmu_v3.h | 7 | ||||
| -rw-r--r-- | make_helpers/defaults.mk | 3 |
6 files changed, 55 insertions, 1 deletions
@@ -833,6 +833,10 @@ ifeq (${CTX_INCLUDE_FPREGS},1) endif endif +ifeq ($(DRTM_SUPPORT),1) + $(info DRTM_SUPPORT is an experimental feature) +endif + ################################################################################ # Process platform overrideable behaviour ################################################################################ @@ -1008,6 +1012,7 @@ $(eval $(call assert_booleans,\ HW_ASSISTED_COHERENCY \ INVERTED_MEMMAP \ MEASURED_BOOT \ + DRTM_SUPPORT \ NS_TIMER_SWITCH \ OVERRIDE_LIBC \ PL011_GENERIC_UART \ @@ -1144,6 +1149,7 @@ $(eval $(call add_defines,\ HW_ASSISTED_COHERENCY \ LOG_LEVEL \ MEASURED_BOOT \ + DRTM_SUPPORT \ NS_TIMER_SWITCH \ PL011_GENERIC_UART \ PLAT_${PLAT} \ diff --git a/changelog.yaml b/changelog.yaml index cc8137111..e2184e461 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -645,6 +645,9 @@ subsections: - title: GIC-600AE scope: gic600ae + - title: SMMU + scope: smmu + - title: TZC scope: tzc diff --git a/docs/getting_started/build-options.rst b/docs/getting_started/build-options.rst index 742b6b589..be50e5edf 100644 --- a/docs/getting_started/build-options.rst +++ b/docs/getting_started/build-options.rst @@ -649,6 +649,15 @@ Common build options This option defaults to 0. +- ``DRTM_SUPPORT``: Boolean flag to enable support for Dynamic Root of Trust + for Measurement (DRTM). This feature has trust dependency on BL31 for taking + the measurements and recording them as per `PSA DRTM specification`_. For + platforms which use BL2 to load/authenticate BL31 ``TRUSTED_BOARD_BOOT`` can + be used and for the platforms which use ``RESET_TO_BL31`` platform owners + should have mechanism to authenticate BL31. + + This option defaults to 0. + - ``NON_TRUSTED_WORLD_KEY``: This option is used when ``GENERATE_COT=1``. It specifies the file that contains the Non-Trusted World private key in PEM format. If ``SAVE_KEYS=1``, this file name will be used to save the key. @@ -1116,3 +1125,4 @@ Firmware update options .. _DEN0115: https://developer.arm.com/docs/den0115/latest .. _PSA FW update specification: https://developer.arm.com/documentation/den0118/a/ +.. _PSA DRTM specification: https://developer.arm.com/documentation/den0113/a diff --git a/drivers/arm/smmu/smmu_v3.c b/drivers/arm/smmu/smmu_v3.c index 45f6df9f1..6c6f978d4 100644 --- a/drivers/arm/smmu/smmu_v3.c +++ b/drivers/arm/smmu/smmu_v3.c @@ -14,7 +14,7 @@ /* SMMU poll number of retries */ #define SMMU_POLL_TIMEOUT_US U(1000) -static int __init smmuv3_poll(uintptr_t smmu_reg, uint32_t mask, +static int smmuv3_poll(uintptr_t smmu_reg, uint32_t mask, uint32_t value) { uint32_t reg_val; @@ -155,3 +155,28 @@ int __init smmuv3_init(uintptr_t smmu_base) return smmuv3_poll(smmu_base + SMMU_S_INIT, SMMU_S_INIT_INV_ALL, 0U); } + +int smmuv3_ns_set_abort_all(uintptr_t smmu_base) +{ + /* Attribute update has completed when SMMU_GBPA.Update bit is 0 */ + if (smmuv3_poll(smmu_base + SMMU_GBPA, SMMU_GBPA_UPDATE, 0U) != 0U) { + return -1; + } + + /* + * Set GBPA's ABORT bit. Other GBPA fields are presumably ignored then, + * so simply preserve their value. + */ + mmio_setbits_32(smmu_base + SMMU_GBPA, SMMU_GBPA_UPDATE | SMMU_GBPA_ABORT); + if (smmuv3_poll(smmu_base + SMMU_GBPA, SMMU_GBPA_UPDATE, 0U) != 0U) { + return -1; + } + + /* Disable the SMMU to engage the GBPA fields previously configured. */ + mmio_clrbits_32(smmu_base + SMMU_CR0, SMMU_CR0_SMMUEN); + if (smmuv3_poll(smmu_base + SMMU_CR0ACK, SMMU_CR0_SMMUEN, 0U) != 0U) { + return -1; + } + + return 0; +} diff --git a/include/drivers/arm/smmu_v3.h b/include/drivers/arm/smmu_v3.h index e60c75445..37da56f6e 100644 --- a/include/drivers/arm/smmu_v3.h +++ b/include/drivers/arm/smmu_v3.h @@ -12,6 +12,8 @@ #include <platform_def.h> /* SMMUv3 register offsets from device base */ +#define SMMU_CR0 U(0x0020) +#define SMMU_CR0ACK U(0x0024) #define SMMU_GBPA U(0x0044) #define SMMU_S_IDR1 U(0x8004) #define SMMU_S_INIT U(0x803c) @@ -37,6 +39,9 @@ #endif /* ENABLE_RME */ +/* SMMU_CR0 and SMMU_CR0ACK register fields */ +#define SMMU_CR0_SMMUEN (1UL << 0) + /* SMMU_GBPA register fields */ #define SMMU_GBPA_UPDATE (1UL << 31) #define SMMU_GBPA_ABORT (1UL << 20) @@ -61,4 +66,6 @@ int smmuv3_init(uintptr_t smmu_base); int smmuv3_security_init(uintptr_t smmu_base); +int smmuv3_ns_set_abort_all(uintptr_t smmu_base); + #endif /* SMMU_V3_H */ diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk index d5383a10f..fab6bf6da 100644 --- a/make_helpers/defaults.mk +++ b/make_helpers/defaults.mk @@ -463,3 +463,6 @@ TWED_DELAY := 0 # By default, disable the mocking of RSS provided services PLAT_RSS_NOT_SUPPORTED := 0 + +# Dynamic Root of Trust for Measurement support +DRTM_SUPPORT := 0 |
