From: Akhil P Oommen <quic_akhilpo@quicinc.com>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
"Konrad Dybcio" <konradybcio@kernel.org>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
<linux-arm-msm@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>,
<freedreno@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
<devicetree@vger.kernel.org>
Subject: Re: [PATCH RFC 1/4] drm/msm/adreno: Add speedbin support for X1-85
Date: Wed, 22 Jan 2025 19:45:49 +0530 [thread overview]
Message-ID: <f7b637d6-6afc-4102-aabd-aded710bd87f@quicinc.com> (raw)
In-Reply-To: <404e8b7d-30ef-47f2-8a44-927b201d60ec@oss.qualcomm.com>
On 1/17/2025 2:46 AM, Konrad Dybcio wrote:
> On 15.01.2025 8:59 PM, Dmitry Baryshkov wrote:
>> On Thu, Jan 16, 2025 at 01:07:17AM +0530, Akhil P Oommen wrote:
>>> On 1/9/2025 7:27 PM, Konrad Dybcio wrote:
>>>> On 8.01.2025 11:42 PM, Akhil P Oommen wrote:
>>>>> Adreno X1-85 has an additional bit which is at a non-contiguous
>>>>> location in qfprom. Add support for this new "hi" bit along with
>>>>> the speedbin mappings.
>>>>> ---
>>>>> drivers/gpu/drm/msm/adreno/a6xx_catalog.c | 5 +++++
>>>>> drivers/gpu/drm/msm/adreno/adreno_gpu.c | 15 ++++++++++++++-
>>>>> 2 files changed, 19 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_catalog.c b/drivers/gpu/drm/msm/adreno/a6xx_catalog.c
>>>>> index 0c560e84ad5a53bb4e8a49ba4e153ce9cf33f7ae..e2261f50aabc6a2f931d810f3637dfdba5695f43 100644
>>>>> --- a/drivers/gpu/drm/msm/adreno/a6xx_catalog.c
>>>>> +++ b/drivers/gpu/drm/msm/adreno/a6xx_catalog.c
>>>>> @@ -1412,6 +1412,11 @@ static const struct adreno_info a7xx_gpus[] = {
>>>>> .gmu_cgc_mode = 0x00020202,
>>>>> },
>>>>> .address_space_size = SZ_256G,
>>>>> + .speedbins = ADRENO_SPEEDBINS(
>>>>> + { 0, 0 },
>>>>> + { 263, 1 },
>>>>> + { 315, 0 },
>>>>> + ),
>>>>> .preempt_record_size = 4192 * SZ_1K,
>>>>> }, {
>>>>> .chip_ids = ADRENO_CHIP_IDS(0x43051401), /* "C520v2" */
>>>>> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
>>>>> index 75f5367e73caace4648491b041f80b7c4d26bf89..7b31379eff444cf3f8ed0dcfd23c14920c13ee9d 100644
>>>>> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
>>>>> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
>>>>> @@ -1078,7 +1078,20 @@ void adreno_gpu_ocmem_cleanup(struct adreno_ocmem *adreno_ocmem)
>>>>>
>>>>> int adreno_read_speedbin(struct device *dev, u32 *speedbin)
>>>>> {
>>>>> - return nvmem_cell_read_variable_le_u32(dev, "speed_bin", speedbin);
>>>>> + u32 hi_bits = 0;
>>>>> + int ret;
>>>>> +
>>>>> + ret = nvmem_cell_read_variable_le_u32(dev, "speed_bin", speedbin);
>>>>> + if (ret)
>>>>> + return ret;
>>>>> +
>>>>> + /* Some chipsets have MSB bits (BIT(8) and above) at a non-contiguous location */
>>>>> + ret = nvmem_cell_read_variable_le_u32(dev, "speed_bin_hi", &hi_bits);
>>>>> + if (ret != -ENOENT)
>>>>> + return ret;
>>>>> +
>>>>> + *speedbin |= (hi_bits << 8);
>>>>
>>>> Now that we're overwriting speedbin, we should probably have some checks in
>>>> order to make sure somebody passing a too-wide cell to one of these won't
>>>> result in cripplingly-untraceable value corruption
>>>>
>>>> I guess we could just introduce nvmem_cell_read_variable_le_u8() and call it
>>>> a day?
>>>
>>> X1E is an outlier here, because this was fixed from the next chipset
>>> onward. For newer chipsets, we can use just the "speed_bin" node, which
>>> represents a contiguous 9 bits. So, just do a "WARN_ON(fls(speedbin) >
>>> 8)" here?
>>
>> Or extend nvmem core to support non-contiguous fields.
>
> This sounds more desirable, as we surely aren't the only ones with
> such a "feature"..
Sounds good. I can explore that when I am back from vacation early next
month.
-Akhil.
>
> Konrad
next prev parent reply other threads:[~2025-01-22 14:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 22:42 [PATCH RFC 0/4] Support for Adreno X1-85 Speedbin along with new OPP levels Akhil P Oommen
2025-01-08 22:42 ` [PATCH RFC 1/4] drm/msm/adreno: Add speedbin support for X1-85 Akhil P Oommen
2025-01-09 13:57 ` Konrad Dybcio
2025-01-15 19:37 ` Akhil P Oommen
2025-01-15 19:59 ` Dmitry Baryshkov
2025-01-16 21:16 ` Konrad Dybcio
2025-01-22 14:15 ` Akhil P Oommen [this message]
2025-01-08 22:42 ` [PATCH RFC 2/4] dt-bindings: power: qcom,rpmpd: add Turbo L5 corner Akhil P Oommen
2025-01-11 9:51 ` Krzysztof Kozlowski
2025-01-08 22:42 ` [PATCH RFC 3/4] dt-bindings: nvmem: qfprom: Add X1E80100 compatible Akhil P Oommen
2025-01-11 9:51 ` Krzysztof Kozlowski
2025-01-08 22:42 ` [PATCH RFC 4/4] arm64: dts: qcom: x1e80100: Update GPU OPP table Akhil P Oommen
2025-02-17 10:17 ` (subset) [PATCH RFC 0/4] Support for Adreno X1-85 Speedbin along with new OPP levels Srinivas Kandagatla
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=f7b637d6-6afc-4102-aabd-aded710bd87f@quicinc.com \
--to=quic_akhilpo@quicinc.com \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=robh@kernel.org \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
--cc=srinivas.kandagatla@linaro.org \
/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