OP-TEE / optee_os

Trusted side of the TEE
Other
1.57k stars 1.06k forks source link

GICv3 for optee #1244

Closed chinnabha closed 7 years ago

chinnabha commented 7 years ago

Hi Jens,

My initial plan is to commit the code changes for gicv3 support in optee for aarch64. I am not sure if we need gicv3 support for ARMv7. Please suggest if that makes sense. All the below questions are w.r.t. aarch64:

  1. Do we want to have standalone gicv3 implementation in optee? (or) Can we assume gicv3 initializations are part of ATF and optee can have rest of the functionality? Already it seems aarch64 platforms (juno/fvp/qemu_armv8a) assume the later approach for gicv2 support in optee. The new piece of code needed is very minimal if I assume the later approach.

  2. The ATF Opteed (which is part of EL3 runtime services) routes the S-EL1/EL0 interrupts when generated during code execution in the non-secure state (NS-EL2/EL1/EL0) to Optee. Whereas, the Opteed doesn't involve in routing the NS-EL2/EL1/EL0 interrupts when generated during code executing in S-EL1/EL0 to Optee. Does optee handles the second case directly (or) optee won't support the second case?

  3. Do we need the support for handling both of the above scenarios or is it ok to have the support for the first of the two scenarios explained in case 2?

jbech-linaro commented 7 years ago

Hi @chinnabha ,

Thanks for picking this up. I need to loop in both ARM developers and ZTE developers into the discussion here, since I know that ZTE already have a GICv3 implementation in OP-TEE and ARM have started to work a on an implementation that they plan to upstream. I'll try to see if I can get them to reply here or of we can loop you into the discussion via email. I just want to avoid that different people are working on the same thing without working towards the same solution. Do you have any email I could use? Mine is "joakim.bech" and the end is "at linaro.org" (hopefully prevent a spam email or two by separating it).

chinnabha commented 7 years ago

Thanks @jbech-linaro for the prompt help. Please use bbudiredla@apm.com for the discussions on this.

But I would like to get the question 2 answered as it is an independent one. Please help.

jenswi-linaro commented 7 years ago

Hi @chinnabha

1: As an initial step we can depend on ARM-TF to initialize, that will cover all ARMv8 platforms. We'll need to support GICv3 in both S-EL1 AArch64 and AArch32 though.

2: OP-TEE handles routing of NS interrupts directly via an RPC to normal world, so no special intervention needed by the dispatcher.

3: With GICv3 it's possible to target EL3 also, we'd like to support that, I guess it comes more or less for free in ARM-TF. When it comes to routing interrupts to the other world (secure or non-secure) we need to support both directions. Routing NS interrupts to normal world already has a generic solution so we don't need to worry about that. I assume that routing of secure interrupts from normal world can be done more or less as today with some small changes.

Thanks, Jens

chinnabha commented 7 years ago

Thanks @jenswi-linaro for the help.

Currently ATF doesn't has interrupt handler to handle EL3 (or G0) interrupts. The ATF folks are working on a framework to handle EL3 interrupts via EL3 runtime services. Once that framework is in place we can visit the case to route the EL3 interrupts from S-EL1. Also, I haven't seen any platform using EL3 interrupts in the open source ATF. This could be very low importance.

jbech-linaro commented 7 years ago

@chinnabha , there has been a pull request related to this #1345, please see this as a FYI. I also realize that I've totally forgot about including you in the loop as I said. I'll send you an email where you will find a bit more information about it (apologize for missing this).

chinnabha commented 7 years ago

Sorry, I was completely busy in something else. Does 1345 has merged GICv3 into optee? I really didn't sync up the latest optee code. We can close this issue if the answer is yes.

david-wang-2015 commented 7 years ago

Hi @chinnabha @jbech-linaro , I think these patches fixed this issue. We can close... https://github.com/OP-TEE/optee_os/pull/1345 https://github.com/OP-TEE/optee_os/pull/1465 https://github.com/OP-TEE/optee_os/pull/1508

ghost commented 7 years ago

Agreed, thanks for reminding us David.

We're closing this issue since the question has been answered. If you however feel that you have additional questions or still thinks this is an issue, please feel free to re-open the issue again.