Skip to contentSkip to conversation

xen/arm: optee: Fix arm_smccc_smc's a0 for OPTEE_SMC_DISABLE_SHM_CACHE

PATCH In review Oleksandr Tyshchenko 5 participants 8 messages Sep 27, 2021 – Oct 7, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: optee: Fix arm_smccc_smc's a0 for OPTEE_SMC_DISABLE_SHM_CACHE

From: Oleksandr Tyshchenko <[email protected]>

Fix a possible copy-paste error in arm_smccc_smc's first argument (a0) for OPTEE_SMC_DISABLE_SHM_CACHE case.

This error causes Linux > v5.14-rc5 (b5c10dd04b7418793517e3286cde5c04759a86de
optee: Clear stale cache entries during initialization) to stuck repeatedly issuing OPTEE_SMC_DISABLE_SHM_CACHE call and waiting for the result to be OPTEE_SMC_RETURN_ENOTAVAIL which will never happen.

---
I wonder whether this patch wants backporting to the old versions since OPTEE support went in.

---
 xen/arch/arm/tee/optee.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/tee/optee.c +1 -1
index 3453615..6df0d44 100644
@@ -1692,7 +1692,7 @@ static bool optee_handle_call(struct cpu_user_regs *regs)
         return true;
 
     case OPTEE_SMC_DISABLE_SHM_CACHE:
-        arm_smccc_smc(OPTEE_SMC_ENABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
+        arm_smccc_smc(OPTEE_SMC_DISABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
                       OPTEE_CLIENT_ID(current->domain), &resp);
         set_user_reg(regs, 0, resp.a0);
         if ( resp.a0 == OPTEE_SMC_RETURN_OK ) {
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw

Hi Oleksandr,

Quoted 7 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Fix a possible copy-paste error in arm_smccc_smc's first argument (a0) for OPTEE_SMC_DISABLE_SHM_CACHE case.

Quoted 6 lines

This error causes Linux > v5.14-rc5 (b5c10dd04b7418793517e3286cde5c04759a86de
optee: Clear stale cache entries during initialization) to stuck repeatedly issuing OPTEE_SMC_DISABLE_SHM_CACHE call and waiting for the result to be OPTEE_SMC_RETURN_ENOTAVAIL which will never happen.

Sound like a reasonable change :-)

Cheers
Bertrand

Quoted 24 lines

---
I wonder whether this patch wants backporting to the old versions since OPTEE support went in.
---
xen/arch/arm/tee/optee.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/tee/optee.c +1 -1
index 3453615..6df0d44 100644
@@ -1692,7 +1692,7 @@ static bool optee_handle_call(struct cpu_user_regs *regs)
        return true;
 
    case OPTEE_SMC_DISABLE_SHM_CACHE:
-        arm_smccc_smc(OPTEE_SMC_ENABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
+        arm_smccc_smc(OPTEE_SMC_DISABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
                      OPTEE_CLIENT_ID(current->domain), &resp);
        set_user_reg(regs, 0, resp.a0);
        if ( resp.a0 == OPTEE_SMC_RETURN_OK ) {
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#2 lore raw
In reply to Oleksandr Tyshchenko

Hi Oleksandr,

Quoted 11 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Fix a possible copy-paste error in arm_smccc_smc's first argument (a0) for OPTEE_SMC_DISABLE_SHM_CACHE case.

This error causes Linux > v5.14-rc5 (b5c10dd04b7418793517e3286cde5c04759a86de
optee: Clear stale cache entries during initialization) to stuck repeatedly issuing OPTEE_SMC_DISABLE_SHM_CACHE call and waiting for the result to be OPTEE_SMC_RETURN_ENOTAVAIL which will never happen.

Quoted 20 lines

---
I wonder whether this patch wants backporting to the old versions since OPTEE support went in.

---
 xen/arch/arm/tee/optee.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/tee/optee.c +1 -1
index 3453615..6df0d44 100644
@@ -1692,7 +1692,7 @@ static bool optee_handle_call(struct cpu_user_regs *regs)
         return true;
 
     case OPTEE_SMC_DISABLE_SHM_CACHE:
-        arm_smccc_smc(OPTEE_SMC_ENABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
+        arm_smccc_smc(OPTEE_SMC_DISABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
                       OPTEE_CLIENT_ID(current->domain), &resp);
         set_user_reg(regs, 0, resp.a0);
         if ( resp.a0 == OPTEE_SMC_RETURN_OK ) {
Signature · 1 line
Volodymyr Babchuk at EPAM
Acked-by on v1 1/1
#3 lore raw
In reply to Oleksandr Tyshchenko
Quoted 11 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Fix a possible copy-paste error in arm_smccc_smc's first argument (a0) for OPTEE_SMC_DISABLE_SHM_CACHE case.

This error causes Linux > v5.14-rc5 (b5c10dd04b7418793517e3286cde5c04759a86de
optee: Clear stale cache entries during initialization) to stuck repeatedly issuing OPTEE_SMC_DISABLE_SHM_CACHE call and waiting for the result to be OPTEE_SMC_RETURN_ENOTAVAIL which will never happen.

I added Fixes: and Backport: tags to the commit

Quoted 23 lines

---
I wonder whether this patch wants backporting to the old versions since OPTEE support went in.

---
 xen/arch/arm/tee/optee.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/tee/optee.c +1 -1
index 3453615..6df0d44 100644
@@ -1692,7 +1692,7 @@ static bool optee_handle_call(struct cpu_user_regs *regs)
         return true;
 
     case OPTEE_SMC_DISABLE_SHM_CACHE:
-        arm_smccc_smc(OPTEE_SMC_ENABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
+        arm_smccc_smc(OPTEE_SMC_DISABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
                       OPTEE_CLIENT_ID(current->domain), &resp);
         set_user_reg(regs, 0, resp.a0);
         if ( resp.a0 == OPTEE_SMC_RETURN_OK ) {
Signature · 1 line
2.7.4
#4 lore raw

Hi Stefano,

Quoted 11 lines · Stefano Stabellini
Quoted 10 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Fix a possible copy-paste error in arm_smccc_smc's first argument (a0) for OPTEE_SMC_DISABLE_SHM_CACHE case.

This error causes Linux > v5.14-rc5 (b5c10dd04b7418793517e3286cde5c04759a86de
optee: Clear stale cache entries during initialization) to stuck repeatedly issuing OPTEE_SMC_DISABLE_SHM_CACHE call and waiting for the result to be OPTEE_SMC_RETURN_ENOTAVAIL which will never happen.

Quoted 5 lines
Quoted 1 line

I added Fixes: and Backport: tags to the commit

Per SUPPORT.MD, OP-TEE is still a technical preview. So I would argue that we should not do any backport because the feature itself is not officially considered supported.

That said, what's missing to make the feature officially supported?

Cheers,

Signature · 1 line
Julien Grall
#5 lore raw
Quoted 15 lines · Julien Grall

Hi Stefano,

Quoted 12 lines · Stefano Stabellini
Quoted 11 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Fix a possible copy-paste error in arm_smccc_smc's first argument (a0) for OPTEE_SMC_DISABLE_SHM_CACHE case.

This error causes Linux > v5.14-rc5 (b5c10dd04b7418793517e3286cde5c04759a86de
optee: Clear stale cache entries during initialization) to stuck repeatedly issuing OPTEE_SMC_DISABLE_SHM_CACHE call and waiting for the result to be OPTEE_SMC_RETURN_ENOTAVAIL which will never happen.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I added Fixes: and Backport: tags to the commit

Per SUPPORT.MD, OP-TEE is still a technical preview. So I would argue that we should not do any backport because the feature itself is not officially considered supported.

Good point!

Quoted 1 line

That said, what's missing to make the feature officially supported?

If Oleksandr is also happy to make OP-TEE support in Xen "Supported" in SUPPORT.md I'd be happy with that too. Specifically I suggest to change it to:

Status: Supported, not security supported

Security Support is a bit of a heavy process and I am thinking that "Supported, not security supported" would be an excellent next step.

author
#6 lore raw

On 07.10.21 01:42, Stefano Stabellini wrote:

Hi Stefano, Julien.

Quoted 27 lines · Julien Grall
Quoted 15 lines

Hi Stefano,

Quoted 12 lines · Stefano Stabellini
Quoted 11 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Fix a possible copy-paste error in arm_smccc_smc's first argument (a0) for OPTEE_SMC_DISABLE_SHM_CACHE case.

This error causes Linux > v5.14-rc5 (b5c10dd04b7418793517e3286cde5c04759a86de
optee: Clear stale cache entries during initialization) to stuck repeatedly issuing OPTEE_SMC_DISABLE_SHM_CACHE call and waiting for the result to be OPTEE_SMC_RETURN_ENOTAVAIL which will never happen.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I added Fixes: and Backport: tags to the commit

Per SUPPORT.MD, OP-TEE is still a technical preview. So I would argue that we should not do any backport because the feature itself is not officially considered supported.

Good point!

Quoted 1 line

That said, what's missing to make the feature officially supported?

Quoted 8 lines

If Oleksandr is also happy to make OP-TEE support in Xen "Supported" in SUPPORT.md I'd be happy with that too. Specifically I suggest to change it to:

Status: Supported, not security supported

Security Support is a bit of a heavy process and I am thinking that "Supported, not security supported" would be an excellent next step.

I would be happy, and can send a formal patch. But I am not an expert in this code.

As a user I can say that OP-TEE mediator works perfectly fine, but let's wait for the input from Volodymyr,

(looks like there are some TODO left in the code and I have no idea what are the implications)

Signature · 3 lines
Regards,

Oleksandr Tyshchenko
#7 lore raw

Hi Oleksandr, Stefano,

Quoted 35 lines · Oleksandr

On 07.10.21 01:42, Stefano Stabellini wrote:

Hi Stefano, Julien.

Quoted 31 lines · Julien Grall
Quoted 15 lines

Hi Stefano,

Quoted 12 lines · Stefano Stabellini
Quoted 11 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Fix a possible copy-paste error in arm_smccc_smc's first argument (a0) for OPTEE_SMC_DISABLE_SHM_CACHE case.

This error causes Linux > v5.14-rc5 (b5c10dd04b7418793517e3286cde5c04759a86de
optee: Clear stale cache entries during initialization) to stuck repeatedly issuing OPTEE_SMC_DISABLE_SHM_CACHE call and waiting for the result to be OPTEE_SMC_RETURN_ENOTAVAIL which will never happen.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I added Fixes: and Backport: tags to the commit

Per SUPPORT.MD, OP-TEE is still a technical preview. So I would argue that we should not do any backport because the feature itself is not officially considered supported.

Good point!

Quoted 1 line

That said, what's missing to make the feature officially supported?

If Oleksandr is also happy to make OP-TEE support in Xen "Supported" in SUPPORT.md I'd be happy with that too. Specifically I suggest to change it to:

Quoted 7 lines
Quoted 4 lines

Status: Supported, not security supported

Security Support is a bit of a heavy process and I am thinking that "Supported, not security supported" would be an excellent next step.

I would be happy, and can send a formal patch. But I am not an expert in this code.

I'm will be happy with this too. We are using this mediator in our projects and I know that OP-TEE community adopted tests for virtualization in theirs CI stack. So this is kind of official now.

Also, I helped other people to bring up virtualization on theirs platforms, so there are other users for this feature besides EPAM and Linaro.

Quoted 2 lines

(looks like there are some TODO left in the code and I have no idea what are the implications)

Well, there were a lot of TODOs when I submitted initial implementation. At that time it indeed wasn't ready for production. But I eventually fixed almost all of them. Only one left now. It is about very unlikely situation when one of guest pages in mapped at PA=0. I'm not sure that is even possible at all.

Signature · 1 line
Volodymyr Babchuk at EPAM