Hello Achin,
We originally discovered this problem while trying to enable the EHF framework in TF-A and get it to work with OPTEE, and that requires the build macro EL3_EXCEPTION_HANDLING to be turned on. The previous thread is here: https://lists.trustedfirmware.org/archives/list/tf-a@lists.trustedfirmware.o...
With EL3_EXCEPTION_HANDLING turned on, interrupts are unconditionally routed to BL31 which would then perform the necessary context switch to the correct world for handling, so if I understand correctly OPTEE's masking/unmasking of the interrupt should have no effect.
Thanks,
Caleb