summaryrefslogtreecommitdiff
path: root/spm/cactus/cactus_tests
AgeCommit message (Collapse)Author
2023-10-25feat(fpu): add helper routines to read, write, compare FPU registersArunachalam Ganapathy
Add helper routines to read, write, write_rand and compare FPU state and FPU control/status registers. These helper routines can be called by testcases running in NS-EL2, R-EL1, S-EL1 payload. The caller has to pass memory to read/write FPU registers. Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com> Change-Id: I10ae5487c9f58e46434c1bd5b42fd458ec755045
2023-10-20Merge "test: exercise secure espi interrupt handling"Madhukar Pappireddy
2023-10-13test: exercise secure espi interrupt handlingRaghu Krishnamurthy
Hafnium/SPMC added support for enabling interrupts in the extended SPI range. With the help of an SiP SMC call that can pend an interrupt, this patch adds a test to trigger an espi interrupt when cactus is running and ensure it is handled. Additionally, a dummy device region node representing a fake peripheral has been added to the Cactus SP manifest. It is used to specify properties of the interrupt in the extended SPI range used for the above test scenario. Signed-off-by: Raghu Krishnamurthy <raghu.ncstate@gmail.com> Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: Ief932c40e3abd33d619f2b144e61cae449147b27
2023-10-13feat(cactus): use security state attributeJ-Alves
Cactus uses security attribute from memory transaction descriptor in the shared memory related tests. Change-Id: I7c4f3ef2c72e36236d23e5a061e27a2ea60fa2d6 Signed-off-by: J-Alves <joao.alves@arm.com>
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-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-14feat(interrupts): support for registering irq handlersMadhukar Pappireddy
This patch provides support for registering and unregistering handler that is invoked by Cactus SP while processing virtual irq interrupt. For this, we simply repurpose the existing framework that was used to perform tail end of interrupt handling. Also, this patch increases the count of virtual interrupts supported by Cactus SP inline with the corresponding change in Hafnium[1]. [1] https://review.trustedfirmware.org/c/hafnium/hafnium/+/19232 Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: Ife41f0d3bb7eebb7c78657abb5b4c5ad41202bb9
2022-10-04fix(interrupts): deny new direct request message from endpointMadhukar Pappireddy
Please refer to detailed description in the comment preceding the helper function introduced in cactus_interrupt.c file. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: Ie70d68514dac44211767d611db6d84991a8b48c6
2022-10-04test(interrupts): hint fwd destination SP could be interruptedMadhukar Pappireddy
TFTF can send a hint to the destination SP to expect that the forwarded sleep command could be preempted by a non-secure interrupt. This can make the tests exercising SP's response to non-secure interrupt robust by allowing the destination SP to check if the forward destination SP has indeed been preempted. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: I808ee6c63687438d0092a53389f11bf9b3dd532d
2022-09-29feat(interrupts): resume interrupted target vCPUMadhukar Pappireddy
An SP could be interrupted by a NS interrupt whilst handling a direct message request from another SP. The target SP could send a managed exit response, if supported. Consequently, the sender of the direct message request resumes the target SP by allocating CPU cycles using dummy direct message request. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: I697aeb189da12850af9a1db4c3e3e550b5b36541
2022-09-29feat(interrupts): add support for handling managed exit through vIRQMadhukar Pappireddy
An SP could specify, through its partition manifest, that the preferred signaling mechanism for it to handle managed exit is vIRQ instead of the default choice (vFIQ). Hence, separate the vIRQ and vFIQ handlers and add support for identifying the source of the direct message request for the current endpoint to send the managed exit response. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: I06d6d81232de58779f81f40d4c6d2a96df0da27a
2022-09-29fix(direct message request): incorrect response for illegal transitionMadhukar Pappireddy
FF-A v1.1 EAC0 spec states that partition manager must return DENIED as the error code when an illegal transition is attempted by a vCPU. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: Ibb86cc4e688c9f64d83a776dddb4434c741d268f
2022-07-21fix(spm): reference to ffa_value struct fieldsJ-Alves
Some verbose message logs in TF-A-Tests needed to be updated in accordance to [1]. In the referred patch a common structure was introduced for ff-a calls. This patch fixes pending changes in verbose log messages. [1] https://review.trustedfirmware.org/c/TF-A/tf-a-tests/+/14733 Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Ib20919d1933f601ed36d9f1011c94193adf4847a
2022-06-15Merge "fix: NS buffer (48b PA) memory sharing between SPs"Madhukar Pappireddy
2022-06-09fix: NS buffer (48b PA) memory sharing between SPsOlivier Deprez
Fix [1] by increasing cactus number of xlat tables. This permits running the SP SP mem sharing of a buffer located at a high physical PA region. Test config [2] provides the model parameters to configurare the PE, interconnect and SMMU to handle 48b physical address size. [1] https://review.trustedfirmware.org/c/TF-A/tf-a-tests/+/13599 [2] https://review.trustedfirmware.org/c/ci/tf-a-ci-scripts/+/15445 Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Change-Id: Ia290f15a6d30c898a5219d2bc1c3949b6ae7e7ef
2022-05-19test(spm): run ffa_tests on ivyDaniel Boulby
Move cactus_test_ffa.c to a common directory for SPs so the ivy partition can also run the same tests. We also create a sp_platform_def.h file which contains various plaform defines required for the tests. This header is defined in both cactus and ivy directories and then fvp and tc0 subdirectories within those. The appropriate header for the sp and platform being built is then included in the build scripts. Signed-off-by: Daniel Boulby <daniel.boulby@arm.com> Change-Id: If65d099d43cd930ef730539b5ad1596e686f788a
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-04Merge changes from topic "mp/sec_intr_management"Olivier Deprez
* changes: test(interrupts): check if last service interrupt is Trusted Wdog timer feat(interrupts): query last serviced interrupt test(interrupts): use custom handler for interrupt feat(interrupts): support for registering custom handler refactor(interrupts): enhance secure interrupt handling test
2022-03-25test(cactus): add test for NS memory sharing between SPsFederico Recanati
Define a new shared memory region in 48-bit address range (configured as NS in the TZC) in cactus-tertiary's manifest. Since SPs can share either secure or non-secure memory, propagate the security information in the relevant cactus commands: CACTUS_REQ_MEM_SEND_CMD and CACTUS_MEM_SEND_CMD. Change-Id: I10af24c96ff8fc0d13c80a52b0264a1482a5cf56 Signed-off-by: Federico Recanati <federico.recanati@arm.com>
2022-03-22feat(interrupts): query last serviced interruptMadhukar Pappireddy
This patch introduces a helper API to request Cactus SP to return the ID of the last serviced secure virtual interrupt. It is built on cactus command framework by leveraging direct message request and response pair. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: I316268f4d9b80f29c308d1a1488945a272ffbc93
2022-03-22test(interrupts): use custom handler for interruptMadhukar Pappireddy
SP registers a custom handler that checks and updates a flag. Once the watchdog interrupt triggers, the custom handler is invoked at the tail end of interrupt handling. This helps the test to ensure the virtual interrupt corresponding to the trusted watchdog timer was correctly handled. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: I7e388076165d097ec7f2bb493b83fe11d2bc0f34
2022-03-17refactor(interrupts): enhance secure interrupt handling testMadhukar Pappireddy
This test makes sure SPMC was able to handle back-to-back secure interrupts targetting Cactus SP while the SP was in RUNNING state. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: If2e93017e2c21ad91fe527fb140f0fd5e0252370
2022-03-08fix(tftf): remove invalid_access test from standard testsManish Pandey
Invalid_access test suite performs negative tests by accessing invalid memory and catching it in custom exception handler. This test suite was made part of standard tests which is called for all platforms and each EL3 configuration. This test was failing for the case when EL3 was build with "HANDLE_EA_EL3_FIRST = 1" causing exceptions to be trapped in EL3 and not forwarded to EL2 to be handled by custom exception handler. To avoid this problem, remove this suite from standard test and introduce a new test configuration. This patch also fixes a minor compilation error in file cactus_test_memory_sharing.c Signed-off-by: Manish Pandey <manish.pandey2@arm.com> Change-Id: I8a13617a01411be45c623dde2ccfc7d950f05f9a
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-01-14test(ff-a): test SP to NS-endpoint mem lend/shareMaksims Svecovs
Memory sharing/lending from SP to NS-endpoint is not allowed. Checks that the said operations are denied by SPMC. Signed-off-by: Maksims Svecovs <maksims.svecovs@arm.com> Change-Id: I86f3bd637711735b40de9a169e2b3c934d32f1be
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-10test(notifications): signaling from MP SP to UP SPJ-Alves
Test setting notifications from all running cores, sender being an MP SP and the receiver an UP SP. Intent is to validate a different flow for triggering SRI, and validate handling of per-vCPU notifications targeting a UP SP. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I4f54ef9c4de0558dcbc3a1245cafb6da267752b7
2021-11-10feat(cactus): enable notifications for cactus tertiaryJ-Alves
Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Ifaa6f29b36931e7d23023b8a7762f0a2ec35cc1f
2021-11-10test(notification): support included in FFA_PARTITION_INFO_GETJ-Alves
Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I2587138332af11df6720c880c1ea9dcfe9795a98
2021-11-10feat: spm helper functions for MP testsJ-Alves
Added two helper functions to help with SPM tests in a MP setup. - spm_core_sp_init: to initialize an SP in a given core. - get_current_core_id: to get the current core ID. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Iad10d43f258f5ed05ce52b87c94a9333c228f26d
2021-11-10feat(cactus): validate NPI injectionJ-Alves
Cactus SP can now handle the Notification Pending Interrupt: - Added `npi_handled` array to track the CPUs that have handled the NPI. The NPI handler will set the index of related to the respective core. - Extended and refactored cactus command CACTUS_NOTIFICATION_GET_CMD, such that the sender can specify that the NPI is to be validated. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I2d5728ec4fe2d14fb9ba6f0ba5230ef652467f85
2021-11-09refactor(cactus): notification set command for SRI testJ-Alves
Refactored slightly the notification set command in order to validate behavior from SWd for different configurations of the SRI flag. The test command now accepts another argument, which specifies the ID of an SP to send a request after setting the notification. This will be useful to test that sending SRI was delayed, and after the notification set call the execution continued in the SWd. TFTF will be able to check if the specified SP processed a command recurring to the test command CACTUS_GET_REQ_COUNT_CMD. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I10779629be06275c844a2ad9afed72bd61c8a14a
2021-11-09feat(cactus): count requests receivedJ-Alves
Message loop counts the amount of requests received in each core. The counting can be accessed through newly added test command CACTUS_GET_REQ_COUNT_CMD. Added such special command to be able to test delay Schedule Receiver Interrupt, in the context of the notifications feature. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Id0a5a9cf58e10d1221a1a0f0af6264474fe7e020
2021-11-09fix(cactus_tests/ffa): dynamically calculate array sizeVarun Wadekar
This patch uses the ARRAY_SIZE() macro to calculate the number of elements in the 'ffa_expected_partition_info' array instead of hard-coding to '4'. Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Change-Id: Ia0f19785b99e4b645ffa2ca61705f2329640a130
2021-11-05feat: add support for secure interrupt handling and completionMadhukar Pappireddy
As per FF-A v1.1 spec, the conduit used by SPM to signal an interrupt to S-EL1 Partition is vIRQ and/or ERET. Depending on the execution state of the vCPU of the target SP, FFA_INTERRUPT ABI and/or Interrupt ID can be used as parameters during eret to the SP. This patch adds support for secure interrupt handling in Cactus SP as well as adds support for FFA_INTERRUPT ABI in the message loop. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: I173b9e0af11b6fd2605145391da68dfda04a14f2
2021-11-05feat: add a test command to send request to a VM/SP ..Madhukar Pappireddy
requesting it to forward sleep request to another VM/SP. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: I26f25fba93bedc38bfd0a5d785591582715921c3
2021-11-05feat: add a test command to request a Cactus SP to start wdog timerMadhukar Pappireddy
cactus_send_twdog_cmd() API sends a direct request message to target SP which (re)starts the Trusted Watchdog timer. The SP then sends back a direct response message indicating successful command. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: If09ce76b46a6339f08f26be90e566550931fb3c7
2021-11-05feat: add helper functions for SP sleepMadhukar Pappireddy
This patch introduces new helper utilities: virtualcounter_read() and sp_sleep_elapsed_time() which are further used in sp_sleep() utility. This patch also adds a needed isb when reading the virtual counter, to prevent reading stale values, as well as reducing the number of reads of the virtual counter required. Refer Arm ARM D11.2.2 Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: Icaf1777e85ee2efc043bfa83d630edf54bf5a099
2021-10-12Merge changes from topic "ja/notifications"Olivier Deprez
* changes: test(ff-a): notifications set and get interfaces feat(cactus): commands to set and get notifications feat(ff-a): notifications set and get ABIs test(ff-a): bind and unbind notifications feat(cactus): commands for notifications bindings test(ff-a): notifications bitmap create and destroy feat(ff-a): notifications bind and unbind ABIs feat(ff-a): notifications bitmap create and destroy ABIs
2021-10-12feat(cactus): commands to set and get notificationsJ-Alves
Added test command to test FFA_NOTIFICATION_SET and FFA_NOTIFICATION_GET interfaces. Both commands allow for the arguments to the call to be propagated on the request payload. If the call to the interfaces returns with an error Cactus responds with CACTUS_ERROR and adds the respective FF-A error code. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I7c3425bf240cafd89613e4c5cc2ece6d58625ac2
2021-10-12feat(cactus): commands for notifications bindingsJ-Alves
Added test command to test FFA_NOTIFICATION_BIND and FFA_NOTIFICATION_UNBIND interfaces. Both commands allow for the arguments to the call to be propagated in the request payload. If the call to the interfaces returns with an error Cactus places it in the response CACTUS_ERROR and adds the respective FF-A error code. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I3fc3a5e559d0c6d6742f5d86973f6e67891ad790
2021-10-08fix(ff-a): cactus and ivy verbosityOlivier Deprez
Unify welcome message for all test partition types. Reduce verbosity for release builds. Signed-off-by: Olivier Deprez <olivier.deprez@arm.com> Change-Id: I747ab52f13942d655092b07d029292895cb01159
2021-10-04fix(cactus): memory sharing tests failure MPJ-Alves
The last test to share memory functionality tested the FFA_MEMORY_DONATE interface. After donating the memory, the original owner didn't update its stage-1 translation at EL1. Hence, when booting a MP setup, there would be a data abort, as at stage-2 translation the memory region is now owned by the receiver of the test. Share memory region was being allocated part of the BSS section, was being mapped as a static region in the xlat libraries. A static region is not meant to be unmapped. To fix the above points: - allocated a memory region in the partition manifest of all Cactus SPs for the sake of the memory sharing tests. - at stage-1 before using it for the first memory share operation, the sender would map its segment as a dynamic region. - if test included a FFA_MEMORY_DONATE call, after donation the owner unmaps the memory region from its stage-1 translation. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: I039c0d0d1633688b0e9d6ba1e2bbebfd518fc72b
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-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(cactus): remove misleading ERROR logJ-Alves
The cactus message loop the log message for unhandled commands is misleading because it is expected to receive some direct messages for set-up configuration discovery. These messages are not handled by cactus and could indicate when a given test must be skipped or not. Namely, some SPM tests are skipped if OPTEE deployed as SP. This discovery "protocol" is executed at the beginning of most SPM related tests, which lead to a lot of ERROR messages, that often mislead developers into thinking there was a problem in the system. Signed-off-by: J-Alves <joao.alves@arm.com> Change-Id: Ib14dc3bf7f9c916fd5addf24675ea111eef5248e
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