aboutsummaryrefslogtreecommitdiff
path: root/tftf/tests/runtime_services/secure_service/spm_common.c
AgeCommit message (Collapse)Author
2024-01-31fix(spm): logs with errors in verbose buildsJ-Alves
Fix few instances with verbose logs that contained build errors. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I08a2c23d831e5882939efce655c9c95485e2c9b9
2024-01-23fix(memory share): arguments used in retrieve testsJ-Alves
Fix a few small arguments that are used in the hypervisor retrieve request tests. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I9f6d2d10178331ffea6387a00c05002c07346bc6
2024-01-22feat(ff-a): add impdef field to ffa_memory_accessDaniel Boulby
Add impdef field to the endpoint memory access descriptor as introduced by FF-A v1.2. Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: Ieb2808a5b4a8773cb4729c5aa10a6a0223ed8039
2024-01-11feat(memory share): support sending fragmented messages.Karl Meakin
Updates `memory_init_and_send` to allow sending memory share messages across multiple fragments. Tests for this functionality will be added in the next commit. Change-Id: I6a47735415a8fed1d15322499f1d08cc3e1fd6a2 Signed-off-by: Karl Meakin <karl.meakin@arm.com>
2024-01-11feat(memory share): send multiple receiver regionsKarl Meakin
Updates `memory_init_and_send` to allow passing more than one receiver. Tests for this functionality will be added in the next commit. Change-Id: I51d92d74f64bfebfa3d49ff6d5066050087b44ef Signed-off-by: Karl Meakin <karl.meakin@arm.com>
2024-01-11test(memory share): hypervisor retrieve requestKarl Meakin
Checks that the hypervisor retrieve request from section 17.4.3 of FF-A v1.2 REL0 is supported. Specifically, the tests: 1. Sends a FFA_MEM_SHARE/FFA_MEM_LEND/FFA_MEM_DONATE message from the tftf target to the SPMC. 2. Sends a hypervisor retrieve request from the tftf target to the SPMC. 3. Verify the contents of the FFA_MEM_RETRIEVE_RESP message against the previously sent message. 4. Invoke reclaim interface for SPMC to free memory owned by the handle. Change-Id: If27d8d5b515c5e468977ed4f5f4ddeb86e44c5df Signed-off-by: Karl Meakin <karl.meakin@arm.com>
2024-01-09refactor(spm): `ffa_memory_access` constructorsKarl Meakin
Add `ffa_memory_access_init_permissions` and `ffa_memory_access_init_permissions_from_mem_func` helpers. Change-Id: I9a5bb09e7f230a65decff7f58a0c188aff3e7449 Signed-off-by: Karl Meakin <karl.meakin@arm.com>
2023-10-12fix(spm_common): fix comparison that is always trueKarl Meakin
This comparison always evaluates to true. I assume it was a typo when copy and pasting a line. Signed-off-by: Karl Meakin <karl.meakin@arm.com> Change-Id: I90d8a33b3a9b4ac0aabc9cafa11b5b705ef1aab0
2023-09-28fix(spm): instruction permissions on memory sharingJ-Alves
- FFA_MEM_SHARE the instruction access to be used shall be NX, however both sender and the borrower should leave it not specified. - FFA_MEM_LEND/FFA_MEM_DONATE the lender must specify the instruction permissions it wishes to receive on the retrieve request. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I0c6e49c30cbbca513644b592695f853bbdf1994b
2023-08-03test: add discovery of el3 spmd logical partitionsRaghu Krishnamurthy
This patch adds a test to query the presence of an SPMD logical partition and also tests basic functionality using the ffa_partition_info_get_regs abi. Note that the register based discovery reports the presence of el3 spmd logical partitions whereas the memory based discovery interface does not report the el3 spmd logical partitions. To that end, the patch adds helper functions to use the register based discovery, and also refactors code that can be shared between the register and memory based interfaces. Signed-off-by: Raghu Krishnamurthy <raghu.ncstate@gmail.com> Change-Id: I755ffe4098c635de2c6aeb0ebe73eb16c3acd206
2023-05-24Merge changes from topic "realm-sve"Soby Mathew
* changes: tftf(rme): check if RMM doesn't leak Realm contents in SVE registers tftf(rme): intermittently switch to Realm while doing NS SVE ops refactor(sve): move sve operations to a lib routine feat(rme): add SVE Realm tests
2023-05-24refactor(sve): move sve operations to a lib routineArunachalam Ganapathy
This patch moves the SVE subtract operation to a common sve library routine and takes a callback function that does the world switch while SVE operations are done in a loop. The callback is invoked after z0, z1 vectors are loaded and before the calculated results are stored back in the vector registers. This refactoring later helps to use this function to do context switch from NS to Secure world or from NS to Realm world based on the callback type. This patch also moves the SVE fill vector registers, read vector registers to a common sve library routine. Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com> Change-Id: Iceb34b96fa85597be63a50c429ae0eb29f8fcaf8
2023-05-19chore: tidy setup and discovery logsJ-Alves
The tests of setup and discovery interfaces took too much space. Made more summarized and clean. Tests still show relevant information in case of failure. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I32901c257ed42bc684eb5a9432b862ad8d824255
2023-05-05refactor(tftf): move SIMD/FPU save/restore routine to common libShruti Gupta
- Move FPU routines to common lib - FPU/SIMD state consist of the 32 SIMD vectors, FPCR and FPSR registers - Test that FPU/SIMD state are preserved during a context switch between secure/non-secure. Signed-off-by: Shruti Gupta <shruti.gupta@arm.com> Change-Id: I88f0a9f716aafdd634c4eae5b885f839bb3deb00
2023-04-18refact(twdog): move trusted wdog API to spm_commonnabkah01
Other tests cases need same API to enable/disable twdog, so we need to move them to common place. Signed-off-by: Nabil Kahlouche <nabil.kahlouche@arm.com> Change-Id: Ie54cfdf44777000dda924bb1239b77182a3dced9
2023-04-03feat(memory share): FFA_FEATURES(FFA_MEM_RETRIEVE_REQ)Karl Meakin
Updates tests to pass when built against https://review.trustedfirmware.org/c/hafnium/hafnium/+/18909 Signed-off-by: Karl Meakin <karl.meakin@arm.com> Change-Id: Ic6c39ca6916b9f9298d7668021963fec287b72c8
2022-10-12fix: change verbosity of error messageMadhukar Pappireddy
Certain negative tests perform corner testing leading to error messages being reported. These error messages are expected. It is in the best interest of user to qualify them as VERBOSE to not cause confusion. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: I765cb1763c8641134d892c2f5f89861e2a9b5666
2022-08-24refactor: rename FFA_MSG_RUN to FFA_RUNOlivier Deprez
The correct ABI function name is FFA_RUN per FF-A v1.1 EAC0 specification. Update it in the relevant FF-A helpers. Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Change-Id: I82858c6a6080b946f4882f8d85a30795d8e60e58
2022-08-04fix(sve): discover the SVE vector lengthOlivier Deprez
Currently the (SPM) test that the SVE vectors are preserved assumes that the SVE vector length is whatever the hard coded maximum vector length we have at build time is, currently 512 bits. The tests fill a buffer that can hold the full set of maximally sized vectors, load it into the registers, do a call and then read the values back into a separate buffer and compare with the original buffer. If the VL is less than the maximum then this comparison will fail since only the subset of the read buffer used by the actual vector length will be filled. Fix this by reading the SVE vector length at runtime and using that when verifying the read data rather than the hard coded maximum value. Increase the SVE test buffers to the maximum permitted by the architecture. Configure ZCR_EL2.LEN to the maximum permitted value (to the limit of the implementation and EL3 constraint). Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Change-Id: I1d96327d3423f2f8a3d7289ae02ab06a4bf9fde3
2022-07-04fix(memory share): memory type not specified for mem lendJ-Alves
Update memory share tests to match [1] in Hafnium. The memory attributes are not to be specified by the sender for memory lend or donate operations. [1] https://review.trustedfirmware.org/c/hafnium/hafnium/+/15514/4 Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Ieed108ad3cfc8f0335ca6f0d7477a9766d8a40d5
2022-06-23test(ff-a): uuid field for ffa_partition_info_getDaniel Boulby
The EAC0 v1.1 FF-A spec now requires that the UUID field in the partition information descriptors is only populated when FFA_PARTITION_INFO_GET is supplied with a null uuid (Table 13.37). This patch updates the tests to check for this. Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: I241c6bed4fc5f63ec91a7b86725be5b2ee838601
2022-06-23test(ff-a): check w3 for ffa_partition_info_getDaniel Boulby
Check that the size of the partition info descriptor is correctly populated when calling ffa_partition_info_get. Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: I56fa0e82e52c1ed35fc2ea0208d69eabc5800935
2022-05-19test(spm): use ffa_helpers for ivy partitionDaniel Boulby
Allow the ivy partition to use the ffa_helpers functions. To achieve this we create a common struct for ff-a calls that is used for both parameters and returns, this aligns with the Hafnium implementation. We can then use preprocessor macros to pick either SMC or SVC as the conduit depending on the exception level the SP is running at. Change-Id: Ic9525baabcf40d15545b6f6d504cf954373f08f9 Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
2022-04-04fix: spurious error log message with mem share testJ-Alves
Made a log line as VERBOSE to avoid an error log printed in the output, in a test that was validating an FF-A error return. Change-Id: Iae8192e91c437eec541b5a1fe64f647a4dad729b Signed-off-by: J-Alves <joao.alves@arm.com>
2022-03-04Merge "test(ff-a): versioned partition info descriptors"Olivier Deprez
2022-03-01test(cactus): prevent realm region access from swdOlivier Deprez
This change adds TFTF and cactus tests to check a realm region cannot be accessed from secure world. A non-secure buffer is delegated to realm PAS and shared to a secure partition through FF-A memory sharing operations. The SP retrieves the region from the SPM, maps it and attempts a write access. The PE is expected to trigger a GPF data abort caught by a custom exception handler. Exception is trapped at S-EL1 within the secure partition because Hafnium configures HCR_EL2.GPF=0 (and SCR_EL3.GPF=0). Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Change-Id: I8f855f394d0490b3584e60ceba4f3d2a20197495
2022-02-09feat(cactus): memory sharing flags in test commandsJ-Alves
Extend the test command CACTUS_MEM_SEND_CMD: - To include the flags for the retriever to use in transaction descriptor to the FFA_MEM_RETRIEVE_REQ. - Number of words cactus should write to the shared page after retrieving it. - Check if memory has been cleared after mapping to cactus address space if clear memory flag was propagated in the command arguments. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I825b0f766bd7132a3488cdd17d83fce85adf4a5a
2022-02-04test(ff-a): versioned partition info descriptorsDaniel Boulby
Add test to ensure an endpoint that sets it's version to v1.0 receives v1.0 partition info descriptors as defined in table 8.25 in the v1.0 FF-A specification when calling ffa_partition_info_get. Also introduce ffa_partition_info_count wrapper. Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: I9f42e1898230208d85153714592b1a4165c92ce1
2022-01-20Merge changes from topic "ms/acs_mem_share"Olivier Deprez
* changes: test(ff-a): test SP to NS-endpoint mem lend/share refactor(ff-a): mem share helper change to test error returns
2022-01-19fix(ff-a): mem retrieve request attributesOlivier Deprez
Hafnium enforces attributes on memory retrieve request to be normal memory, cache write-back, inner shareable [1]. This change updates cactus memory retrieve helper to use inner shareable attribute rather than outer. Removed TODO about shareability attribute as the link is broken and it is now better understood that inner shareable attribute shall be enforced in our test scenarios. [1] https://review.trustedfirmware.org/c/hafnium/hafnium/+/13339 Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Change-Id: Icf2597f55bd5b8e1f945d6f3e95c09d11d4d66ea
2022-01-14refactor(ff-a): mem share helper change to test error returnsMaksims Svecovs
In order to test FF-A memory sharing operations in faulty cases we need to be able to get the details of smc call failure in tftf and cactus. Passes smc_ret_value in the relevant memory management test helpers. Signed-off-by: Maksims Svecovs <maksims.svecovs@arm.com> Change-Id: I81059b77cbb01fe9427905adbe262ba8d0670cee
2022-01-06test(ff-a): update partition info to include uuidsDaniel Boulby
The ffa_partition_info_get interface has been updated in spm to return the uuid of the partition in the descriptor. Updates the tests to check this. Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: I8f4cc4a26a781288896e56977c198c69fa09d974
2021-11-10feat(notifications): update FFA_FEATURES testJ-Alves
Updated FFA_FEATURES to include notifications interfaces. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Ibecd168b7c480201f069d340199b323ec7c48efe
2021-10-05Merge changes from topic "ja/notifications"Olivier Deprez
* changes: feat(spm): Helper to dump smc_ret_values content feat(spm): Test helper to verify response fix: argument size in a Cactus response API
2021-10-04feat(spm): Helper to dump smc_ret_values contentJ-Alves
Change-Id: If83aa22c778d7f6a261753f5c18d8a708763799c Signed-off-by: J-Alves <joao.alves@arm.com>
2021-10-04feat(spm): Test helper to verify responseJ-Alves
Added function helper to validate the response sent by Cactus SP is as expected. Change-Id: Ia0118063f1af65daed19443b6951b338bae7d668 Signed-off-by: J-Alves <joao.alves@arm.com>
2021-10-01fix(ff-a): Fix ffa_features test for indirect msgDaniel Boulby
Indirect messaging has not been implemented and tested for SPMC, so FFA_FEATURES return FFA_ERROR for the indirect messaging interfaces FFA_MSG_POLL, FFA_YIELD and FFA_MSG_SEND. Change the cactus tests to reflect this. Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: I7533b86795b5538a9201ecc87090a3865588900c
2021-08-09feat(ff-a): update FF-A version to v1.1Olivier Deprez
Bump the required FF-A version in framework and manifests to v1.1 as upstream feature development goes. Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Change-Id: If3dc227635f1c65d0623ed36ad7e3766c5d5e132
2021-08-04test(ff-a): add tests for the FFA_RXTX_UNMAP ABIDaniel Boulby
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: Id4d8cfd2f94ff15201de70a13eececf444d5e66e
2021-07-15refactor(ff-a): partition info test functionsMax Shvetsov
Move common ffa_partition_info_get functions to the spm_common. Secure test target now supports both sending and receiving direct messages. Changes in SP manifests to align with a new messaging method representation in partition manifests. Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com> Change-Id: I9f6f24d6b800283a07e84a2a27708c0313b68fdc
2021-06-29feat(sve): enable SVE tests in tftfMax Shvetsov
Adding two tests to check that floating point context is preserved. 1. Use SIMD instructions on SVE-enabled system. 2. Use SVE instruction on a full-length vectors. Both tests check that floating point context is preserved after returning from the secure world. Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com> Change-Id: Idccff7c3f1658cc66b64e144cc00cda6e0aeea50
2021-06-18Merge changes from topic "db/spm_id_get"Olivier Deprez
* changes: Group FF-A Setup and Discovery interface tests Add tests for FFA function FFA_SPM_ID_GET Change the name of type ffa_vm_id_t
2021-06-11Add tests for FFA function FFA_SPM_ID_GETDaniel Boulby
Also add the ability for ffa_features_test to only use the expected return if the minimum FF-A version for the feature is met. Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: I276500c666365c563a117aa7b250b18f51dcace7
2021-06-03fix(spm): change error logs to verboseJ-Alves
Helper functions to validate return of FF-A calls or responses from other endpoints in 'spm_common', were printing ERROR also in cases where this was actually expected. Changing those ERROR messages to VERBOSE, given ERROR as referred was misleading. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Id3feac197e8dbff78a616392b5ac7ca914c219df
2021-05-04Change the name of type ffa_vm_id_tDaniel Boulby
The type ffa_vm_id_t is used for all ffa_id variables not just ones specific to vms so remove this element from the name to make it simple ffa_id_t Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: I29d751880c29b0a401cbc698f856c3651cc02789
2021-03-12SPM: Helpers for error logging after FF-A callsJ-Alves
Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I7c4cb416baf6eb024eb134edb4bbb62d8746629f
2021-03-12FF-A: Tidying direct messaging API definitionsJ-Alves
Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Ia04cde158510824086624c1d725f2a6eb68a4702
2021-03-12SPM: Tidying FF-A Memory Sharing testsJ-Alves
Moving code about memory sharing tests to comply with recent changes: - Placed helper functions that can be used by TFTF and Cactus in files spm_common.c/h. - Removed 'ffa_memory_sharing_test' and added its body to handler of test command CACTUS_MEM_SEND_CMD. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I58af9b475730d171306581741becbb0665e1859d
2021-02-10[SPM] checks if SIMD vectors are preservedOlivier Deprez
Populates the SIMD registers in the normal world, then modifies those in the secure world. Upon return to the normal world checks that vectors are restored to the original values. Note: Does not check if SIMD vectors are preserved when returning back to the secure world. Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com> Change-Id: I3ae223af64597f83afa6624122109db2cf0077f7
2021-02-10[SPM] tidying common code to tftf and cactusMax Shvetsov
This patch moves the code used to test SPM functionality, not explicitly described in FF-A specification, from ffa_helpers to spm_common which is built for both tftf and cactus. Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com> Change-Id: I461efad977cc4d02701feea7b2215a61453716ef