[v2,06/18] media: venus: firmware: Leave a clue for homegrown porters

Message ID 20230228-topic-venus-v2-6-d95d14949c79@linaro.org
State New
Headers
Series Venus QoL / maintainability fixes |

Commit Message

Konrad Dybcio May 4, 2023, 8:01 a.m. UTC
  Leave a clue about where the seemingly magic values come from, as it
is not obvious and requires some digging downstream..

Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 drivers/media/platform/qcom/venus/firmware.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Vikash Garodia May 5, 2023, 12:57 p.m. UTC | #1
On 5/4/2023 1:31 PM, Konrad Dybcio wrote:
> Leave a clue about where the seemingly magic values come from, as it
> is not obvious and requires some digging downstream..
>
> Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>
> ---
>   drivers/media/platform/qcom/venus/firmware.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c
> index cfb11c551167..a4cd919e1dbe 100644
> --- a/drivers/media/platform/qcom/venus/firmware.c
> +++ b/drivers/media/platform/qcom/venus/firmware.c
> @@ -241,6 +241,13 @@ int venus_boot(struct venus_core *core)
>   		return ret;
>   
>   	if (core->use_tz && res->cp_size) {
> +		/*
> +		 * Clues for porting using downstream data:
> +		 * cp_start = 0
> +		 * cp_size = venus_ns/virtual-addr-pool[0] (yes, addr not size)

The field is the start address of ns context bank. Since the cp_start is 
0, the start address for (next) non-secure context bank

is interpreted as size of the (previous) content protection region.

> +		 * cp_nonpixel_start = venus_sec_non_pixel/virtual-addr-pool[0]
> +		 * cp_nonpixel_size = venus_sec_non_pixel/virtual-addr-pool[1]
> +		 */
>   		ret = qcom_scm_mem_protect_video_var(res->cp_start,
>   						     res->cp_size,
>   						     res->cp_nonpixel_start,
>
  
Vikash Garodia May 5, 2023, 1 p.m. UTC | #2
On 5/5/2023 6:27 PM, Vikash Garodia wrote:
>
> On 5/4/2023 1:31 PM, Konrad Dybcio wrote:
>> Leave a clue about where the seemingly magic values come from, as it
>> is not obvious and requires some digging downstream..
Rephrase the commit text.
>> Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>
>> ---
>>   drivers/media/platform/qcom/venus/firmware.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/media/platform/qcom/venus/firmware.c 
>> b/drivers/media/platform/qcom/venus/firmware.c
>> index cfb11c551167..a4cd919e1dbe 100644
>> --- a/drivers/media/platform/qcom/venus/firmware.c
>> +++ b/drivers/media/platform/qcom/venus/firmware.c
>> @@ -241,6 +241,13 @@ int venus_boot(struct venus_core *core)
>>           return ret;
>>         if (core->use_tz && res->cp_size) {
>> +        /*
>> +         * Clues for porting using downstream data:
>> +         * cp_start = 0
>> +         * cp_size = venus_ns/virtual-addr-pool[0] (yes, addr not size)
>
> The field is the start address of ns context bank. Since the cp_start 
> is 0, the start address for (next) non-secure context bank
>
> is interpreted as size of the (previous) content protection region.
>
>> +         * cp_nonpixel_start = venus_sec_non_pixel/virtual-addr-pool[0]
>> +         * cp_nonpixel_size = venus_sec_non_pixel/virtual-addr-pool[1]
>> +         */
>>           ret = qcom_scm_mem_protect_video_var(res->cp_start,
>>                                res->cp_size,
>>                                res->cp_nonpixel_start,
>>
  
Konrad Dybcio May 5, 2023, 7:24 p.m. UTC | #3
On 5.05.2023 15:00, Vikash Garodia wrote:
> 
> On 5/5/2023 6:27 PM, Vikash Garodia wrote:
>>
>> On 5/4/2023 1:31 PM, Konrad Dybcio wrote:
>>> Leave a clue about where the seemingly magic values come from, as it
>>> is not obvious and requires some digging downstream..
> Rephrase the commit text.
Please be more specific, do you want me to use the
explanations you gave in the previous reply?

Konrad
>>> Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>> Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>
>>> ---
>>>   drivers/media/platform/qcom/venus/firmware.c | 7 +++++++
>>>   1 file changed, 7 insertions(+)
>>>
>>> diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c
>>> index cfb11c551167..a4cd919e1dbe 100644
>>> --- a/drivers/media/platform/qcom/venus/firmware.c
>>> +++ b/drivers/media/platform/qcom/venus/firmware.c
>>> @@ -241,6 +241,13 @@ int venus_boot(struct venus_core *core)
>>>           return ret;
>>>         if (core->use_tz && res->cp_size) {
>>> +        /*
>>> +         * Clues for porting using downstream data:
>>> +         * cp_start = 0
>>> +         * cp_size = venus_ns/virtual-addr-pool[0] (yes, addr not size)
>>
>> The field is the start address of ns context bank. Since the cp_start is 0, the start address for (next) non-secure context bank
>>
>> is interpreted as size of the (previous) content protection region.
>>
>>> +         * cp_nonpixel_start = venus_sec_non_pixel/virtual-addr-pool[0]
>>> +         * cp_nonpixel_size = venus_sec_non_pixel/virtual-addr-pool[1]
>>> +         */
>>>           ret = qcom_scm_mem_protect_video_var(res->cp_start,
>>>                                res->cp_size,
>>>                                res->cp_nonpixel_start,
>>>
  
Vikash Garodia May 9, 2023, noon UTC | #4
On 5/6/2023 12:54 AM, Konrad Dybcio wrote:
> 
> 
> On 5.05.2023 15:00, Vikash Garodia wrote:
>>
>> On 5/5/2023 6:27 PM, Vikash Garodia wrote:
>>>
>>> On 5/4/2023 1:31 PM, Konrad Dybcio wrote:
>>>> Leave a clue about where the seemingly magic values come from, as it
>>>> is not obvious and requires some digging downstream..
>> Rephrase the commit text.
> Please be more specific, do you want me to use the
> explanations you gave in the previous reply?

Something which describes the patch like - Add comments to describe the
arguments of the qcom_scm_mem_protect_video_var TZ call. The TZ call programs
the video hardware with CP and non-CP VARs, and the comments describes these VARs.

> Konrad
>>>> Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>>> Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>
>>>> ---
>>>>   drivers/media/platform/qcom/venus/firmware.c | 7 +++++++
>>>>   1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c
>>>> index cfb11c551167..a4cd919e1dbe 100644
>>>> --- a/drivers/media/platform/qcom/venus/firmware.c
>>>> +++ b/drivers/media/platform/qcom/venus/firmware.c
>>>> @@ -241,6 +241,13 @@ int venus_boot(struct venus_core *core)
>>>>           return ret;
>>>>         if (core->use_tz && res->cp_size) {
>>>> +        /*
>>>> +         * Clues for porting using downstream data:
>>>> +         * cp_start = 0
>>>> +         * cp_size = venus_ns/virtual-addr-pool[0] (yes, addr not size)
>>>
>>> The field is the start address of ns context bank. Since the cp_start is 0, the start address for (next) non-secure context bank
>>>
>>> is interpreted as size of the (previous) content protection region.
>>>
>>>> +         * cp_nonpixel_start = venus_sec_non_pixel/virtual-addr-pool[0]
>>>> +         * cp_nonpixel_size = venus_sec_non_pixel/virtual-addr-pool[1]
>>>> +         */
>>>>           ret = qcom_scm_mem_protect_video_var(res->cp_start,
>>>>                                res->cp_size,
>>>>                                res->cp_nonpixel_start,
>>>>
  

Patch

diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c
index cfb11c551167..a4cd919e1dbe 100644
--- a/drivers/media/platform/qcom/venus/firmware.c
+++ b/drivers/media/platform/qcom/venus/firmware.c
@@ -241,6 +241,13 @@  int venus_boot(struct venus_core *core)
 		return ret;
 
 	if (core->use_tz && res->cp_size) {
+		/*
+		 * Clues for porting using downstream data:
+		 * cp_start = 0
+		 * cp_size = venus_ns/virtual-addr-pool[0] (yes, addr not size)
+		 * cp_nonpixel_start = venus_sec_non_pixel/virtual-addr-pool[0]
+		 * cp_nonpixel_size = venus_sec_non_pixel/virtual-addr-pool[1]
+		 */
 		ret = qcom_scm_mem_protect_video_var(res->cp_start,
 						     res->cp_size,
 						     res->cp_nonpixel_start,