diff mbox series

[2/2] tee: optee: allow selection of ti-smc as a calling method

Message ID 20170918205005.30235-2-afd@ti.com
State Changes Requested, archived
Headers show
Series None | expand

Commit Message

Andrew Davis Sept. 18, 2017, 8:50 p.m. UTC
On TI platforms OP-TEE must be called using a modified SMC call,
allow the selection of this though DT.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt | 2 ++
 drivers/tee/optee/core.c                                           | 2 ++
 2 files changed, 4 insertions(+)

Comments

Rob Herring Sept. 19, 2017, 1:36 p.m. UTC | #1
On Mon, Sep 18, 2017 at 3:50 PM, Andrew F. Davis <afd@ti.com> wrote:
> On TI platforms OP-TEE must be called using a modified SMC call,
> allow the selection of this though DT.
>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt | 2 ++
>  drivers/tee/optee/core.c                                           | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
> index d38834c67dff..a3275ecdf186 100644
> --- a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
> +++ b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
> @@ -20,6 +20,8 @@ the reference implementation maintained by Linaro.
>                     "hvc" : HVC #0, with the register assignments specified
>                            in drivers/tee/optee/optee_smc.h
>
> +                   "ti-smc" : Similar to "smc" with TI specific register
> +                             adjustments

Sigh, really? IMO, this should be determined from the compatible
string. Then the next TI (or any vendor) specific thing can be handled
without a DT change.

Maybe some day we'll figure out that not just h/w needs to be
probe-able, but all the firmware pieces do too.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Rutland Sept. 19, 2017, 2:09 p.m. UTC | #2
On Mon, Sep 18, 2017 at 03:50:05PM -0500, Andrew F. Davis wrote:
> On TI platforms OP-TEE must be called using a modified SMC call,
> allow the selection of this though DT.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt | 2 ++
>  drivers/tee/optee/core.c                                           | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
> index d38834c67dff..a3275ecdf186 100644
> --- a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
> +++ b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
> @@ -20,6 +20,8 @@ the reference implementation maintained by Linaro.
>                     "hvc" : HVC #0, with the register assignments specified
>  		           in drivers/tee/optee/optee_smc.h
>  
> +                   "ti-smc" : Similar to "smc" with TI specific register
> +		              adjustments

... which are what, exactly? Specified where?

As Rob said, this should really have a new compat string.

Thanks,
Mark.

>  
>  
>  Example:
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index 7952357df9c8..dfa9de590d98 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -441,6 +441,8 @@ static optee_invoke_fn *get_invoke_func(struct device_node *np)
>  		return optee_smccc_hvc;
>  	else if (!strcmp("smc", method))
>  		return optee_smccc_smc;
> +	else if (!strcmp("ti-smc", method))
> +		return arm_ti_smccc_smc;
>  
>  	pr_warn("invalid \"method\" property: %s\n", method);
>  	return ERR_PTR(-EINVAL);
> -- 
> 2.14.1
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Davis Sept. 19, 2017, 3:54 p.m. UTC | #3
On 09/19/2017 08:36 AM, Rob Herring wrote:
> On Mon, Sep 18, 2017 at 3:50 PM, Andrew F. Davis <afd@ti.com> wrote:
>> On TI platforms OP-TEE must be called using a modified SMC call,
>> allow the selection of this though DT.
>>
>> Signed-off-by: Andrew F. Davis <afd@ti.com>
>> ---
>>  Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt | 2 ++
>>  drivers/tee/optee/core.c                                           | 2 ++
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
>> index d38834c67dff..a3275ecdf186 100644
>> --- a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
>> +++ b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
>> @@ -20,6 +20,8 @@ the reference implementation maintained by Linaro.
>>                     "hvc" : HVC #0, with the register assignments specified
>>                            in drivers/tee/optee/optee_smc.h
>>
>> +                   "ti-smc" : Similar to "smc" with TI specific register
>> +                             adjustments
> 
> Sigh, really? IMO, this should be determined from the compatible
> string. Then the next TI (or any vendor) specific thing can be handled
> without a DT change.
> 

Which compatible string, do you mean the OP-TEE driver check the top
level platform compatible string?

> Maybe some day we'll figure out that not just h/w needs to be
> probe-able, but all the firmware pieces do too.
> 
> Rob
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring Sept. 19, 2017, 9:10 p.m. UTC | #4
On Tue, Sep 19, 2017 at 10:54 AM, Andrew F. Davis <afd@ti.com> wrote:
> On 09/19/2017 08:36 AM, Rob Herring wrote:
>> On Mon, Sep 18, 2017 at 3:50 PM, Andrew F. Davis <afd@ti.com> wrote:
>>> On TI platforms OP-TEE must be called using a modified SMC call,
>>> allow the selection of this though DT.
>>>
>>> Signed-off-by: Andrew F. Davis <afd@ti.com>
>>> ---
>>>  Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt | 2 ++
>>>  drivers/tee/optee/core.c                                           | 2 ++
>>>  2 files changed, 4 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
>>> index d38834c67dff..a3275ecdf186 100644
>>> --- a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
>>> +++ b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
>>> @@ -20,6 +20,8 @@ the reference implementation maintained by Linaro.
>>>                     "hvc" : HVC #0, with the register assignments specified
>>>                            in drivers/tee/optee/optee_smc.h
>>>
>>> +                   "ti-smc" : Similar to "smc" with TI specific register
>>> +                             adjustments
>>
>> Sigh, really? IMO, this should be determined from the compatible
>> string. Then the next TI (or any vendor) specific thing can be handled
>> without a DT change.
>>
>
> Which compatible string, do you mean the OP-TEE driver check the top
> level platform compatible string?

No, you need to have something like "ti,optee-tz" for the driver to
match on because your implementation is different.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot Sept. 20, 2017, 12:27 a.m. UTC | #5
Hi Andrew,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc1 next-20170919]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andrew-F-Davis/ARM-smccc-call-Use-r12-to-route-secure-monitor-calls-on-TI-platforms/20170920-052543
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

>> ERROR: "arm_ti_smccc_smc" [drivers/tee/optee/optee.ko] undefined!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Sept. 20, 2017, 12:44 a.m. UTC | #6
Hi Andrew,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc1 next-20170919]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andrew-F-Davis/ARM-smccc-call-Use-r12-to-route-secure-monitor-calls-on-TI-platforms/20170920-052543
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   drivers/tee/optee/core.o: In function `get_invoke_func':
>> drivers/tee/optee/core.c:445: undefined reference to `arm_ti_smccc_smc'
   drivers/tee/optee/core.c:445:(.init.text+0xc0): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against undefined symbol `arm_ti_smccc_smc'
>> drivers/tee/optee/core.c:445: undefined reference to `arm_ti_smccc_smc'

vim +445 drivers/tee/optee/core.c

   428	
   429	static optee_invoke_fn *get_invoke_func(struct device_node *np)
   430	{
   431		const char *method;
   432	
   433		pr_info("probing for conduit method from DT.\n");
   434	
   435		if (of_property_read_string(np, "method", &method)) {
   436			pr_warn("missing \"method\" property\n");
   437			return ERR_PTR(-ENXIO);
   438		}
   439	
   440		if (!strcmp("hvc", method))
   441			return optee_smccc_hvc;
   442		else if (!strcmp("smc", method))
   443			return optee_smccc_smc;
   444		else if (!strcmp("ti-smc", method))
 > 445			return arm_ti_smccc_smc;
   446	
   447		pr_warn("invalid \"method\" property: %s\n", method);
   448		return ERR_PTR(-EINVAL);
   449	}
   450	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
index d38834c67dff..a3275ecdf186 100644
--- a/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
+++ b/Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt
@@ -20,6 +20,8 @@  the reference implementation maintained by Linaro.
                    "hvc" : HVC #0, with the register assignments specified
 		           in drivers/tee/optee/optee_smc.h
 
+                   "ti-smc" : Similar to "smc" with TI specific register
+		              adjustments
 
 
 Example:
diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 7952357df9c8..dfa9de590d98 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -441,6 +441,8 @@  static optee_invoke_fn *get_invoke_func(struct device_node *np)
 		return optee_smccc_hvc;
 	else if (!strcmp("smc", method))
 		return optee_smccc_smc;
+	else if (!strcmp("ti-smc", method))
+		return arm_ti_smccc_smc;
 
 	pr_warn("invalid \"method\" property: %s\n", method);
 	return ERR_PTR(-EINVAL);