[v2,10/18] media: venus: hfi_venus: Fix version checks in venus_isr()

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

Commit Message

Konrad Dybcio May 4, 2023, 8:01 a.m. UTC
  IS_V6 was used there IS_IRIS2(_1) should have been and the !IS_V6
condition was only correct by luck and for now. Replace them both
with VPU version checks.

Fixes: 24fcc0522d87 ("media: venus: hfi: Add 6xx interrupt support")
Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 drivers/media/platform/qcom/venus/hfi_venus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Vikash Garodia May 5, 2023, 1:29 p.m. UTC | #1
On 5/4/2023 1:31 PM, Konrad Dybcio wrote:
> IS_V6 was used there IS_IRIS2(_1) should have been and the !IS_V6
> condition was only correct by luck and for now. Replace them both
> with VPU version checks.

Existing video driver supports IRIS2(_1) under V6 category. What is meant by

!IS_V6 condition was correct by luck ?

-Vikash

> Fixes: 24fcc0522d87 ("media: venus: hfi: Add 6xx interrupt support")
> Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
>   drivers/media/platform/qcom/venus/hfi_venus.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
> index ca56b1a8eb71..6d5906fab800 100644
> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
> @@ -1130,7 +1130,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
>   	wrapper_base = hdev->core->wrapper_base;
>   
>   	status = readl(wrapper_base + WRAPPER_INTR_STATUS);
> -	if (IS_V6(core)) {
> +	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
>   		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
>   		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 ||
>   		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
> @@ -1142,7 +1142,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
>   			hdev->irq_status = status;
>   	}
>   	writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR);
> -	if (!IS_V6(core))
> +	if (!(IS_AR50_LITE(core) || IS_IRIS2(core) || IS_IRIS2_1(core)))
>   		writel(status, wrapper_base + WRAPPER_INTR_CLEAR);
>   
>   	return IRQ_WAKE_THREAD;
>
  
Konrad Dybcio May 5, 2023, 7:13 p.m. UTC | #2
On 5.05.2023 15:29, Vikash Garodia wrote:
> 
> On 5/4/2023 1:31 PM, Konrad Dybcio wrote:
>> IS_V6 was used there IS_IRIS2(_1) should have been and the !IS_V6
>> condition was only correct by luck and for now. Replace them both
>> with VPU version checks.
> 
> Existing video driver supports IRIS2(_1) under V6 category. What is meant by
> 
> !IS_V6 condition was correct by luck ?
Right, I didn't quite think of it this way. I probably meant "it works
just because there are no other HFIv6 cores supported", but that might
have just as well been a design choice. I'll reword and drop fixes.

Konrad
> 
> -Vikash
> 
>> Fixes: 24fcc0522d87 ("media: venus: hfi: Add 6xx interrupt support")
>> Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>> ---
>>   drivers/media/platform/qcom/venus/hfi_venus.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
>> index ca56b1a8eb71..6d5906fab800 100644
>> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
>> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
>> @@ -1130,7 +1130,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
>>       wrapper_base = hdev->core->wrapper_base;
>>         status = readl(wrapper_base + WRAPPER_INTR_STATUS);
>> -    if (IS_V6(core)) {
>> +    if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
>>           if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
>>               status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 ||
>>               status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
>> @@ -1142,7 +1142,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
>>               hdev->irq_status = status;
>>       }
>>       writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR);
>> -    if (!IS_V6(core))
>> +    if (!(IS_AR50_LITE(core) || IS_IRIS2(core) || IS_IRIS2_1(core)))
>>           writel(status, wrapper_base + WRAPPER_INTR_CLEAR);
>>         return IRQ_WAKE_THREAD;
>>
  

Patch

diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
index ca56b1a8eb71..6d5906fab800 100644
--- a/drivers/media/platform/qcom/venus/hfi_venus.c
+++ b/drivers/media/platform/qcom/venus/hfi_venus.c
@@ -1130,7 +1130,7 @@  static irqreturn_t venus_isr(struct venus_core *core)
 	wrapper_base = hdev->core->wrapper_base;
 
 	status = readl(wrapper_base + WRAPPER_INTR_STATUS);
-	if (IS_V6(core)) {
+	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
 		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
 		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 ||
 		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
@@ -1142,7 +1142,7 @@  static irqreturn_t venus_isr(struct venus_core *core)
 			hdev->irq_status = status;
 	}
 	writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR);
-	if (!IS_V6(core))
+	if (!(IS_AR50_LITE(core) || IS_IRIS2(core) || IS_IRIS2_1(core)))
 		writel(status, wrapper_base + WRAPPER_INTR_CLEAR);
 
 	return IRQ_WAKE_THREAD;