Message ID | 20230228-topic-venus-v1-5-58c2c88384e9@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3080156wrd; Tue, 28 Feb 2023 07:27:46 -0800 (PST) X-Google-Smtp-Source: AK7set+OA21kZ4csWCjPVLaXqH0SGv6fryXdpQDXvCA2iKjB5eef9G0V3WnTp2cNfX9D0sJYzIhH X-Received: by 2002:a05:6a20:4320:b0:b8:8a19:d6ad with SMTP id h32-20020a056a20432000b000b88a19d6admr4152355pzk.24.1677598066093; Tue, 28 Feb 2023 07:27:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677598066; cv=none; d=google.com; s=arc-20160816; b=h/KLl9rl2iuv9w9vHzifq+AXwZFgezz/vno3ajZcaGdSratzvJt+ABivhulKz+HHbz 3cGrCl6P/Xj7h4/EuKmiFNwu0cGICX52wzbYUJFaDdTC5E1IlTHuVSwH0kF5y5HdG4Te 8Yl1MdvlHK4S9iLFzAgAfCGfAv0uWkuKSYmo1ZcuunpBDkZT8TLFqyPhJSpd6KAFz+3f t+88syHv4G8Y8kFKCfZVUMga32eaK+F8MsdzXALRGz+JvedTJMASJu+ioTRLU73qXJRZ BnRasheq6VRwaskvgC5eZ5S8Di73zZyj4Rrr0SA9Ks8QEfkT+iaQjkBHBqVz0evhK+Ru tRAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=XR97t0vv1eCXn18PURYfzYkLTv3CB1qpCk7uOk1LjA4=; b=NGRrkWW3CXBvCDrdj6qoCapfDD5zJedXMLMicxfnx2fjTuInD23Hcbrya1oS8dBlgq bkZAHoUuRLLG9FVogItnkomPhbMCNE5i8+7NbHnt7LXqQhM1vIc1X9XV0C1y4x2pbaxJ aUuc1cHes49Qs+Nc+LDrIEKARuZp9W57ANKlxk0FGDhmHJe7bOr/A28PlcWeeGoyom5U dTfmIPa0SITLvAPsxHa+m+Z0+xWxkjSavdVwezU/IWxrQLyJXUNJxdfarXVsEB8dba7g GUtKmBIdq1PP5TGzCfoVsEU5Bf7elsB9nVg27jRdiYk7y2IOMp5h8xHzjri++4owy5cD Sl6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j7igxwPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 69-20020a630248000000b004fbbc2aff2asi10239345pgc.549.2023.02.28.07.27.31; Tue, 28 Feb 2023 07:27:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j7igxwPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229989AbjB1PZI (ORCPT <rfc822;brysonjbanks@gmail.com> + 99 others); Tue, 28 Feb 2023 10:25:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbjB1PYo (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Feb 2023 10:24:44 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04F0028218 for <linux-kernel@vger.kernel.org>; Tue, 28 Feb 2023 07:24:41 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id i28so971323lfv.0 for <linux-kernel@vger.kernel.org>; Tue, 28 Feb 2023 07:24:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677597881; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XR97t0vv1eCXn18PURYfzYkLTv3CB1qpCk7uOk1LjA4=; b=j7igxwPlJ9BZPas8I+MoCiShBmXS/UAf/QUDhGhej2SAJ4CambOCAU2pbuaHfzxlR2 vwyl7zMF6TZDUTImvA/++pkTUaXGKkHoPPx/nGljXhZ3zj+/GlBrEQC+yRuIdL5g234Z FS+PBZL1AAtQynHPBtzi1sSL6cFws0lfp5lB61NSrij9qKbi3hbOKgvSaZ1oSqiiVxSo OZJxhUGHfECFRvLDXPPMMc7HqFwpjK8DnQkuJTnuZKCn3fbj5r9c2W0/dLHN1cwfVs9V eCBVLcdVSfFpANSRgAEy0HxLEstzZOiEdfL+ay5bGhMMuXwCtZZNyFQa3RvxXPvSmBwq RjTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677597881; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XR97t0vv1eCXn18PURYfzYkLTv3CB1qpCk7uOk1LjA4=; b=lTbr+U0KMSs9clw3WMK1rhIHC4MHwqwYgWR7gWqVFk0KgKrP+t9cLWQOhR12k2mRom ipUWhrrve/cBBMhdk73c4RKIO0W8y247ZnKqW/4wHugSI0jE6Cd/KIUWfCi7Ew0NQnhw f21ibnossEV3EkUYr+lVSOqKjIOG8/wxkXvONL/RLTI8EDGUC1WHGHvRrl2LUKxSli3u GnodaQcqi9VQRPbt2pDqflpkU5ZI+vPfmCEbD3BIhrsEarX9UEqORe7QW0MtXlWfHcdZ QY0hRySR4spM5y0M96wFPMFmwnGA/Aug7y7Ijlc80JO+K0GQ9zQibh499nDMKzAriDR/ dJkg== X-Gm-Message-State: AO0yUKXIB/p3IAimBzbAy5xgOTzNV8XFwQCt2ej9HOR1BNCKcDKMvHmG DxuId1Aie0gQrWERaY3qAwKL7w== X-Received: by 2002:ac2:4c26:0:b0:4db:2cdf:4c12 with SMTP id u6-20020ac24c26000000b004db2cdf4c12mr702484lfq.43.1677597881420; Tue, 28 Feb 2023 07:24:41 -0800 (PST) Received: from [192.168.1.101] (abym99.neoplus.adsl.tpnet.pl. [83.9.32.99]) by smtp.gmail.com with ESMTPSA id h17-20020ac250d1000000b004db3aa3c542sm1363688lfm.47.2023.02.28.07.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 07:24:41 -0800 (PST) From: Konrad Dybcio <konrad.dybcio@linaro.org> Date: Tue, 28 Feb 2023 16:24:29 +0100 Subject: [PATCH 05/18] media: venus: hfi_venus: Sanitize venus_boot_core() per-VPU-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230228-topic-venus-v1-5-58c2c88384e9@linaro.org> References: <20230228-topic-venus-v1-0-58c2c88384e9@linaro.org> In-Reply-To: <20230228-topic-venus-v1-0-58c2c88384e9@linaro.org> To: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>, Vikash Garodia <quic_vgarodia@quicinc.com>, Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Mauro Carvalho Chehab <mchehab@kernel.org>, Dikshita Agarwal <dikshita@qti.qualcomm.com>, Bryan O'Donoghue <bryan.odonoghue@linaro.org>, Dikshita Agarwal <dikshita@codeaurora.org>, Mansur Alisha Shaik <mansur@codeaurora.org>, Jonathan Marek <jonathan@marek.ca> Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>, Stanimir Varbanov <stanimir.varbanov@linaro.org>, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Vikash Garodia <vgarodia@codeaurora.org>, Konrad Dybcio <konrad.dybcio@linaro.org> X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1677597872; l=1913; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=8YSW7Fu2jndgl/WxEEUigTPoBYrgxNe8jMMj7hfx/lY=; b=eZ46AiY3nhnu+cy0+y1yQj4bdcJFZ1gHXkkMCflRQXkQ3MH8Q0iTHj3iMafScPFEp64ToPtdlzJH 4WenP9s0DhOZrMVabSSDtUsxV662HGzrEnYhfRGAm3SNPsOH/R3+ X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759089069645224186?= X-GMAIL-MSGID: =?utf-8?q?1759089069645224186?= |
Series |
Venus QoL / maintainability fixes
|
|
Commit Message
Konrad Dybcio
Feb. 28, 2023, 3:24 p.m. UTC
The current assumption of IS_V6 is overgeneralized. Adjust the logic
to take the VPU hardware version into account.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/media/platform/qcom/venus/hfi_venus.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Comments
On 2/28/2023 8:54 PM, Konrad Dybcio wrote: > The current assumption of IS_V6 is overgeneralized. Adjust the logic > to take the VPU hardware version into account. > > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > drivers/media/platform/qcom/venus/hfi_venus.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c > index 4ccf31147c2a..772e5e9cf127 100644 > --- a/drivers/media/platform/qcom/venus/hfi_venus.c > +++ b/drivers/media/platform/qcom/venus/hfi_venus.c > @@ -448,20 +448,21 @@ static int venus_boot_core(struct venus_hfi_device *hdev) > { > struct device *dev = hdev->core->dev; > static const unsigned int max_tries = 100; > - u32 ctrl_status = 0, mask_val; > + u32 ctrl_status = 0, mask_val = 0; > unsigned int count = 0; > void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; > void __iomem *wrapper_base = hdev->core->wrapper_base; > int ret = 0; > > writel(BIT(VIDC_CTRL_INIT_CTRL_SHIFT), cpu_cs_base + VIDC_CTRL_INIT); > - if (IS_V6(hdev->core)) { > + if (IS_IRIS1(hdev->core) || IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) { I think the IRIS1 check can be removed from here as we are not handling IRIS1 related things at other places. we can add the required checks for IRIS1 when we add support for any IRIS1 based chipset. Thanks, Dikshita > mask_val = readl(wrapper_base + WRAPPER_INTR_MASK); > mask_val &= ~(WRAPPER_INTR_MASK_A2HWD_BASK_V6 | > WRAPPER_INTR_MASK_A2HCPU_MASK); > } else { > mask_val = WRAPPER_INTR_MASK_A2HVCODEC_MASK; > } > + > writel(mask_val, wrapper_base + WRAPPER_INTR_MASK); > writel(1, cpu_cs_base + CPU_CS_SCIACMDARG3); > > @@ -480,10 +481,11 @@ static int venus_boot_core(struct venus_hfi_device *hdev) > if (count >= max_tries) > ret = -ETIMEDOUT; > > - if (IS_V6(hdev->core)) { > + if (IS_AR50_LITE(hdev->core) || IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) > writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6); > + > + if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) > writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6); > - } > > return ret; > } >
On 2.03.2023 12:00, Dikshita Agarwal wrote: > > On 2/28/2023 8:54 PM, Konrad Dybcio wrote: >> The current assumption of IS_V6 is overgeneralized. Adjust the logic >> to take the VPU hardware version into account. >> >> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >> --- >> drivers/media/platform/qcom/venus/hfi_venus.c | 10 ++++++---- >> 1 file changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c >> index 4ccf31147c2a..772e5e9cf127 100644 >> --- a/drivers/media/platform/qcom/venus/hfi_venus.c >> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c >> @@ -448,20 +448,21 @@ static int venus_boot_core(struct venus_hfi_device *hdev) >> { >> struct device *dev = hdev->core->dev; >> static const unsigned int max_tries = 100; >> - u32 ctrl_status = 0, mask_val; >> + u32 ctrl_status = 0, mask_val = 0; >> unsigned int count = 0; >> void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; >> void __iomem *wrapper_base = hdev->core->wrapper_base; >> int ret = 0; >> writel(BIT(VIDC_CTRL_INIT_CTRL_SHIFT), cpu_cs_base + VIDC_CTRL_INIT); >> - if (IS_V6(hdev->core)) { >> + if (IS_IRIS1(hdev->core) || IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) { > > I think the IRIS1 check can be removed from here as we are not handling IRIS1 related things at other places. > > we can add the required checks for IRIS1 when we add support for any IRIS1 based chipset. Up to you really, I plan on getting IRIS1 (SM8150) supported and have some mumbling going on for that on my local branch. FWIW these checks are logically correct and I would personally prefer not to have to go through each one of them and remove them just to bring them back soon. Konrad > > Thanks, > > Dikshita > >> mask_val = readl(wrapper_base + WRAPPER_INTR_MASK); >> mask_val &= ~(WRAPPER_INTR_MASK_A2HWD_BASK_V6 | >> WRAPPER_INTR_MASK_A2HCPU_MASK); >> } else { >> mask_val = WRAPPER_INTR_MASK_A2HVCODEC_MASK; >> } >> + >> writel(mask_val, wrapper_base + WRAPPER_INTR_MASK); >> writel(1, cpu_cs_base + CPU_CS_SCIACMDARG3); >> @@ -480,10 +481,11 @@ static int venus_boot_core(struct venus_hfi_device *hdev) >> if (count >= max_tries) >> ret = -ETIMEDOUT; >> - if (IS_V6(hdev->core)) { >> + if (IS_AR50_LITE(hdev->core) || IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) >> writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6); >> + >> + if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) >> writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6); >> - } >> return ret; >> } >>
On 3/2/2023 4:40 PM, Konrad Dybcio wrote: > > On 2.03.2023 12:00, Dikshita Agarwal wrote: >> On 2/28/2023 8:54 PM, Konrad Dybcio wrote: >>> The current assumption of IS_V6 is overgeneralized. Adjust the logic >>> to take the VPU hardware version into account. >>> >>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>> --- >>> drivers/media/platform/qcom/venus/hfi_venus.c | 10 ++++++---- >>> 1 file changed, 6 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c >>> index 4ccf31147c2a..772e5e9cf127 100644 >>> --- a/drivers/media/platform/qcom/venus/hfi_venus.c >>> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c >>> @@ -448,20 +448,21 @@ static int venus_boot_core(struct venus_hfi_device *hdev) >>> { >>> struct device *dev = hdev->core->dev; >>> static const unsigned int max_tries = 100; >>> - u32 ctrl_status = 0, mask_val; >>> + u32 ctrl_status = 0, mask_val = 0; >>> unsigned int count = 0; >>> void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; >>> void __iomem *wrapper_base = hdev->core->wrapper_base; >>> int ret = 0; >>> writel(BIT(VIDC_CTRL_INIT_CTRL_SHIFT), cpu_cs_base + VIDC_CTRL_INIT); >>> - if (IS_V6(hdev->core)) { >>> + if (IS_IRIS1(hdev->core) || IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) { >> I think the IRIS1 check can be removed from here as we are not handling IRIS1 related things at other places. >> >> we can add the required checks for IRIS1 when we add support for any IRIS1 based chipset. > Up to you really, I plan on getting IRIS1 (SM8150) supported and have > some mumbling going on for that on my local branch. FWIW these checks > are logically correct and I would personally prefer not to have to go > through each one of them and remove them just to bring them back soon. > > Konrad oh, I see. I wasn't aware about the plan for IRIS1. if you plan to add these checks on all relevant places then it should be fine. Thanks, Dikshita >> Thanks, >> >> Dikshita >> >>> mask_val = readl(wrapper_base + WRAPPER_INTR_MASK); >>> mask_val &= ~(WRAPPER_INTR_MASK_A2HWD_BASK_V6 | >>> WRAPPER_INTR_MASK_A2HCPU_MASK); >>> } else { >>> mask_val = WRAPPER_INTR_MASK_A2HVCODEC_MASK; >>> } >>> + >>> writel(mask_val, wrapper_base + WRAPPER_INTR_MASK); >>> writel(1, cpu_cs_base + CPU_CS_SCIACMDARG3); >>> @@ -480,10 +481,11 @@ static int venus_boot_core(struct venus_hfi_device *hdev) >>> if (count >= max_tries) >>> ret = -ETIMEDOUT; >>> - if (IS_V6(hdev->core)) { >>> + if (IS_AR50_LITE(hdev->core) || IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) >>> writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6); >>> + >>> + if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) >>> writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6); >>> - } >>> return ret; >>> } >>>
diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 4ccf31147c2a..772e5e9cf127 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -448,20 +448,21 @@ static int venus_boot_core(struct venus_hfi_device *hdev) { struct device *dev = hdev->core->dev; static const unsigned int max_tries = 100; - u32 ctrl_status = 0, mask_val; + u32 ctrl_status = 0, mask_val = 0; unsigned int count = 0; void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; void __iomem *wrapper_base = hdev->core->wrapper_base; int ret = 0; writel(BIT(VIDC_CTRL_INIT_CTRL_SHIFT), cpu_cs_base + VIDC_CTRL_INIT); - if (IS_V6(hdev->core)) { + if (IS_IRIS1(hdev->core) || IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) { mask_val = readl(wrapper_base + WRAPPER_INTR_MASK); mask_val &= ~(WRAPPER_INTR_MASK_A2HWD_BASK_V6 | WRAPPER_INTR_MASK_A2HCPU_MASK); } else { mask_val = WRAPPER_INTR_MASK_A2HVCODEC_MASK; } + writel(mask_val, wrapper_base + WRAPPER_INTR_MASK); writel(1, cpu_cs_base + CPU_CS_SCIACMDARG3); @@ -480,10 +481,11 @@ static int venus_boot_core(struct venus_hfi_device *hdev) if (count >= max_tries) ret = -ETIMEDOUT; - if (IS_V6(hdev->core)) { + if (IS_AR50_LITE(hdev->core) || IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6); + + if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6); - } return ret; }