OP-TEE / optee_os

Trusted side of the TEE
Other
1.51k stars 1.03k forks source link

Virt notif watchdog #6881

Open jenswi-linaro opened 2 weeks ago

jenswi-linaro commented 2 weeks ago

This pull request adds support for notifications with nonsecure virtualization enabled. This PR needs https://patchew.org/Xen/20240529072559.2486986-1-jens.wiklander@linaro.org/ for notifications to become enabled, but it's backward compatible so nothing should break.

jenswi-linaro commented 2 weeks ago

I believe the checkpatch issues are false positives.

jenswi-linaro commented 4 days ago

Addressing comments.

jenswi-linaro commented 4 days ago

Rebased to fix CI issue.

ldts commented 3 days ago

@jenswi-linaro just curious, how are you testing? could you describe your setup? Would be great to have a doc mentioning Xen. I am OoO for a few weeks and was toying around with Xen on Versal ACAP - maybe I can replicate on real hardware.

jenswi-linaro commented 3 days ago

We plan to have a working CI setup for this once the needed patches have been released in Xen version 4.19 and Linux v6.10.

You'll need:

Xen must be configured with CONFIG_FFA=y and each guest have tee="ffa" in their config file.

OP-TEE should be configured with: CFG_NS_VIRTUALIZATION=y CFG_CORE_SEL1_SPMC=y CFG_CORE_ASYNC_NOTIF=y CFG_NOTIF_TEST_WD=y CFG_CORE_ASYNC_NOTIF_GIC_INTID ?= 8

TF-A need be configured for SPMC at S-EL1 with SPD=spmd CTX_INCLUDE_EL2_REGS=0 SPMD_SPM_AT_SEL2=0 QEMU_TOS_FW_CONFIG_DTS=.../spmc_el1_manifest.dts SPMC_OPTEE=1

When booting you should notice lines like: D/TC:0 0 periodic_callback:136 seconds 1 millis 62 count 1 Indicating that the periodic callback works

When DOM0 has booted you should see lines like:

D/TC:0 0   test_wd_callback:46 WD 1 call_count 1, timeout_count 0
D/TC:1 ? 0 wd_ndrv_yielding_cb:85 Clearing pending

Where 0 0 indicates test_wd_callback is called in an atomic context. 1 ? 0 indicates that wd_ndrv_yielding_cb is called in a thread context of guest 1 (increased by 1 compared to what Xen is using).

You may want to test this on QEMU first (don't forget to update the optee_os, linux, and xen gits) to get the hang of it: