From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Connor Abbott <cwabbott0@gmail.com>,
Bjorn Andersson <andersson@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Jun Nie <jun.nie@linaro.org>, Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>
Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
freedreno@lists.freedesktop.org
Subject: Re: [PATCH v2 4/6] drm/msm/a7xx: Initialize a750 "software fuse"
Date: Sat, 27 Apr 2024 14:19:40 +0200 [thread overview]
Message-ID: <12db74c2-87ec-45e3-9ca0-c5f2328c5f8b@linaro.org> (raw)
In-Reply-To: <20240426-a750-raytracing-v2-4-562ac9866d63@gmail.com>
On 26.04.2024 8:34 PM, Connor Abbott wrote:
> On all Qualcomm platforms with a7xx GPUs, qcom_scm provides a method to
> initialize cx_mem. Copy this from downstream (minus BCL which we
> currently don't support). On a750, this includes a new "fuse" register
> which can be used by qcom_scm to fuse off certain features like
> raytracing in software. The fuse is default off, and is initialized by
> calling the method. Afterwards we have to read it to find out which
> features were enabled.
>
> Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
> ---
[...]
> +static void a7xx_sw_fuse_violation_irq(struct msm_gpu *gpu)
> +{
> + u32 status;
> +
> + status = gpu_read(gpu, REG_A7XX_RBBM_SW_FUSE_INT_STATUS);
> + gpu_write(gpu, REG_A7XX_RBBM_SW_FUSE_INT_MASK, 0);
> +
> + dev_err_ratelimited(&gpu->pdev->dev, "SW fuse violation status=%8.8x\n", status);
> +
> + /* Ignore FASTBLEND violations, because the HW will silently fall back
> + * to legacy blending.
/*
* foo
> + */
> + if (status & (A7XX_CX_MISC_SW_FUSE_VALUE_RAYTRACING |
> + A7XX_CX_MISC_SW_FUSE_VALUE_LPAC)) {
> + del_timer(&gpu->hangcheck_timer);
> +
> + kthread_queue_work(gpu->worker, &gpu->recover_work);
> + }
> +}
> +
> static irqreturn_t a6xx_irq(struct msm_gpu *gpu)
> {
> struct msm_drm_private *priv = gpu->dev->dev_private;
> @@ -2384,6 +2406,9 @@ static irqreturn_t a6xx_irq(struct msm_gpu *gpu)
> if (status & A6XX_RBBM_INT_0_MASK_UCHE_OOB_ACCESS)
> dev_err_ratelimited(&gpu->pdev->dev, "UCHE | Out of bounds access\n");
>
> + if (status & A6XX_RBBM_INT_0_MASK_SWFUSEVIOLATION)
Does this field actualy exist on a6 too?
> + a7xx_sw_fuse_violation_irq(gpu);
> +
> if (status & A6XX_RBBM_INT_0_MASK_CP_CACHE_FLUSH_TS)
> msm_gpu_retire(gpu);
>
> @@ -2525,6 +2550,59 @@ static void a6xx_llc_slices_init(struct platform_device *pdev,
> a6xx_gpu->llc_mmio = ERR_PTR(-EINVAL);
> }
>
> +static int a7xx_cx_mem_init(struct a6xx_gpu *a6xx_gpu)
> +{
> + struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
> + struct msm_gpu *gpu = &adreno_gpu->base;
> + u32 fuse_val;
> + int ret = 0;
> +
> + if (adreno_is_a750(adreno_gpu)) {
> + /* Assume that if qcom scm isn't available, that whatever
> + * replacement allows writing the fuse register ourselves.
> + * Users of alternative firmware need to make sure this
> + * register is writeable or indicate that it's not somehow.
> + * Print a warning because if you mess this up you're about to
> + * crash horribly.
> + */
> + if (!qcom_scm_is_available()) {
> + dev_warn_once(gpu->dev->dev,
> + "SCM is not available, poking fuse register\n");
> + a6xx_llc_write(a6xx_gpu, REG_A7XX_CX_MISC_SW_FUSE_VALUE,
> + A7XX_CX_MISC_SW_FUSE_VALUE_RAYTRACING |
> + A7XX_CX_MISC_SW_FUSE_VALUE_FASTBLEND |
> + A7XX_CX_MISC_SW_FUSE_VALUE_LPAC);
> + adreno_gpu->has_ray_tracing = true;
I'm not 100% sure. I'm afraid there may be SKUs with RT cores fused
off (as in, cut off from the rest, not "indicated unavailable") or
otherwise dysfunctional..
My guess would be that TZ probably has some sort of a LUT/match table
based on other SoC identifiers
> + return 0;
> + }
> +
> + ret = qcom_scm_gpu_init_regs(QCOM_SCM_GPU_ALWAYS_EN_REQ |
> + QCOM_SCM_GPU_TSENSE_EN_REQ);
> + if (ret)
> + return ret;
> +
> + /* On a750 raytracing may be disabled by the firmware, find out whether
> + * that's the case. The scm call above sets the fuse register.
> + */
> + fuse_val = a6xx_llc_read(a6xx_gpu, REG_A7XX_CX_MISC_SW_FUSE_VALUE);
> + adreno_gpu->has_ray_tracing =
> + !!(fuse_val & A7XX_CX_MISC_SW_FUSE_VALUE_RAYTRACING);
> + } else {
> + if (adreno_is_a740(adreno_gpu)) {
> + /* Raytracing is always enabled on a740 */
> + adreno_gpu->has_ray_tracing = true;
> + }
> +
> + if (!qcom_scm_is_available())
> + return 0;
> +
> + ret = qcom_scm_gpu_init_regs(QCOM_SCM_GPU_ALWAYS_EN_REQ);
> + }
> +
> + return ret;
if (qcom_scm_is_available())
return qcom_scm_gpu_init_regs(QCOM_SCM_GPU_ALWAYS_EN_REQ);
}
return 0;
?
Konrad
next prev parent reply other threads:[~2024-04-27 12:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-26 18:33 [PATCH v2 0/6] drm/msm: Support a750 "software fuse" for raytracing Connor Abbott
2024-04-26 18:33 ` [PATCH v2 1/6] arm64: dts: qcom: sm8650: Fix GPU cx_mem size Connor Abbott
2024-04-26 18:36 ` Dmitry Baryshkov
2024-04-27 12:04 ` Konrad Dybcio
2024-05-02 8:03 ` Neil Armstrong
2024-04-26 18:34 ` [PATCH v2 2/6] firmware: qcom_scm: Add gpu_init_regs call Connor Abbott
2024-04-26 18:38 ` Dmitry Baryshkov
2024-04-27 12:07 ` Konrad Dybcio
2024-04-26 18:34 ` [PATCH v2 3/6] drm/msm: Update a6xx registers Connor Abbott
2024-04-26 18:38 ` Dmitry Baryshkov
2024-04-26 18:34 ` [PATCH v2 4/6] drm/msm/a7xx: Initialize a750 "software fuse" Connor Abbott
2024-04-26 18:44 ` Dmitry Baryshkov
2024-04-27 12:19 ` Konrad Dybcio [this message]
2024-04-30 10:31 ` Connor Abbott
2024-04-26 18:34 ` [PATCH v2 5/6] drm/msm: Add MSM_PARAM_RAYTRACING uapi Connor Abbott
2024-04-26 18:44 ` Dmitry Baryshkov
2024-04-27 12:20 ` Konrad Dybcio
2024-04-26 18:34 ` [PATCH v2 6/6] drm/msm/a7xx: Add missing register writes from downstream Connor Abbott
2024-04-27 12:23 ` Konrad Dybcio
2024-05-01 20:20 ` (subset) [PATCH v2 0/6] drm/msm: Support a750 "software fuse" for raytracing Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12db74c2-87ec-45e3-9ca0-c5f2328c5f8b@linaro.org \
--to=konrad.dybcio@linaro.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=cwabbott0@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jun.nie@linaro.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=neil.armstrong@linaro.org \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=robh@kernel.org \
--cc=sean@poorly.run \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).