From: Manish V Badarkhe Date: Wed, 21 Sep 2022 09:04:16 +0000 (+0100) Subject: feat(drtm): add DRTM parameters structure version check X-Git-Tag: baikal/aarch64/sdk5.9~48^2 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=c503ded2c5d9ceec9fba4cc0901805307a14af3d;p=arm-tf.git feat(drtm): add DRTM parameters structure version check Added DRTM parameters structure version check that as per the current released DRTM specification [1]. Mainly to cater below mentioned in the specification [1] section 3.12 - For a given DRTM major version number this structure will always be extended in a backwards compatible manner. [1]: https://developer.arm.com/documentation/den0113/a Change-Id: I9f312c7f9f20152c5d7e40a22b462c7fe8db70bc Signed-off-by: Manish V Badarkhe --- diff --git a/services/std_svc/drtm/drtm_main.c b/services/std_svc/drtm/drtm_main.c index e0f5c1784..3acf6838e 100644 --- a/services/std_svc/drtm/drtm_main.c +++ b/services/std_svc/drtm/drtm_main.c @@ -366,9 +366,10 @@ static enum drtm_retc drtm_dl_check_args(uint64_t x1, } a = &args_buf; - if (a->version != 1) { - ERROR("DRTM: parameters structure incompatible with major version %d\n", - ARM_DRTM_VERSION_MAJOR); + if (!((a->version >= ARM_DRTM_PARAMS_MIN_VERSION) && + (a->version <= ARM_DRTM_PARAMS_MAX_VERSION))) { + ERROR("DRTM: parameters structure version %u is unsupported\n", + a->version); return NOT_SUPPORTED; } diff --git a/services/std_svc/drtm/drtm_main.h b/services/std_svc/drtm/drtm_main.h index baa37ae7d..60051632e 100644 --- a/services/std_svc/drtm/drtm_main.h +++ b/services/std_svc/drtm/drtm_main.h @@ -36,6 +36,12 @@ #define DL_ARGS_GET_DLME_ENTRY_POINT(a) \ (((a)->dlme_paddr + (a)->dlme_img_off + (a)->dlme_img_ep_off)) +/* + * Range(Min/Max) of DRTM parameter structure versions supported + */ +#define ARM_DRTM_PARAMS_MIN_VERSION U(1) +#define ARM_DRTM_PARAMS_MAX_VERSION U(1) + enum drtm_dlme_el { DLME_AT_EL1 = MODE_EL1, DLME_AT_EL2 = MODE_EL2