From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Akhil P Oommen <quic_akhilpo@quicinc.com>,
Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Sean Paul <sean@poorly.run>, David Airlie <airlied@gmail.com>,
Daniel Vetter <daniel@ffwll.ch>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@somainline.org>
Cc: Rob Clark <robdclark@chromium.org>,
devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org
Subject: Re: [Freedreno] [PATCH v3 04/15] drm/msm/a6xx: Extend and explain UBWC config
Date: Tue, 28 Feb 2023 22:22:05 +0100 [thread overview]
Message-ID: <c608fa1b-96dd-8d32-3d00-28d40c734b43@linaro.org> (raw)
In-Reply-To: <5a8a7fa1-bba3-50a2-aa39-83d342ba70c1@quicinc.com>
On 28.02.2023 21:48, Akhil P Oommen wrote:
> On 3/1/2023 2:14 AM, Akhil P Oommen wrote:
>> On 3/1/2023 2:10 AM, Konrad Dybcio wrote:
>>> On 28.02.2023 21:23, Akhil P Oommen wrote:
>>>> On 2/23/2023 5:36 PM, Konrad Dybcio wrote:
>>>>> Rename lower_bit to hbb_lo and explain what it signifies.
>>>>> Add explanations (wherever possible to other tunables).
>>>>>
>>>>> Sort the variable definition and assignment alphabetically.
>>>> Sorting based on decreasing order of line length is more readable, isn't it?
>>> I can do that.
>>>
>>>>> Port setting min_access_length, ubwc_mode and hbb_hi from downstream.
>>>>> Set default values for all of the tunables to zero, as they should be.
>>>>>
>>>>> Values were validated against downstream and will be fixed up in
>>>>> separate commits so as not to make this one even more messy.
>>>>>
>>>>> A618 remains untouched (left at hw defaults) in this patch.
>>>>>
>>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>>>>> ---
>>>>> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 55 ++++++++++++++++++++++++++++-------
>>>>> 1 file changed, 45 insertions(+), 10 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>>>>> index c5f5d0bb3fdc..bdae341e0a7c 100644
>>>>> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>>>>> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>>>>> @@ -786,39 +786,74 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
>>>>> static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
>>>>> {
>>>>> struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
>>>>> - u32 lower_bit = 2;
>>>>> + /* Unknown, introduced with A640/680 */
>>>>> u32 amsbc = 0;
>>>>> + /*
>>>>> + * The Highest Bank Bit value represents the bit of the highest DDR bank.
>>>>> + * We then subtract 13 from it (13 is the minimum value allowed by hw) and
>>>>> + * write the lowest two bits of the remaining value as hbb_lo and the
>>>>> + * one above it as hbb_hi to the hardware. The default values (when HBB is
>>>>> + * not specified) are 0, 0.
>>>>> + */
>>>>> + u32 hbb_hi = 0;
>>>>> + u32 hbb_lo = 0;
>>>>> + /* Whether the minimum access length is 64 bits */
>>>>> + u32 min_acc_len = 0;
>>>>> + /* Unknown, introduced with A650 family, related to UBWC mode/ver 4 */
>>>>> u32 rgb565_predicator = 0;
>>>>> + /* Unknown, introduced with A650 family */
>>>>> u32 uavflagprd_inv = 0;
>>>>> + /* Entirely magic, per-GPU-gen value */
>>>>> + u32 ubwc_mode = 0;
>>>>>
>>>>> /* a618 is using the hw default values */
>>>>> if (adreno_is_a618(adreno_gpu))
>>>>> return;
>>>>>
>>>>> - if (adreno_is_a640_family(adreno_gpu))
>>>>> + if (adreno_is_a619(adreno_gpu)) {
>>>>> + /* HBB = 14 */
>>>>> + hbb_lo = 1;
>>>>> + }
>>>>> +
>>>>> + if (adreno_is_a630(adreno_gpu)) {
>>>>> + /* HBB = 15 */
>>>>> + hbb_lo = 2;
>>>>> + }
>>>>> +
>>>>> + if (adreno_is_a640_family(adreno_gpu)) {
>>>>> amsbc = 1;
>>>>> + /* HBB = 15 */
>>>>> + hbb_lo = 2;
>>>>> + }
>>>>>
>>>>> if (adreno_is_a650(adreno_gpu) || adreno_is_a660(adreno_gpu)) {
>>>>> - /* TODO: get ddr type from bootloader and use 2 for LPDDR4 */
>>>>> - lower_bit = 3;
>>>>> amsbc = 1;
>>>>> + /* TODO: get ddr type from bootloader and use 2 for LPDDR4 */
>>>>> + /* HBB = 16 */
>>>>> + hbb_lo = 3;
>>>>> rgb565_predicator = 1;
>>>>> uavflagprd_inv = 2;
>>>>> }
>>>>>
>>>>> if (adreno_is_7c3(adreno_gpu)) {
>>>>> - lower_bit = 1;
>>>>> amsbc = 1;
>>>>> + /* HBB is unset in downstream DTS, defaulting to 0 */
>>>> This is incorrect. For 7c3 hbb value is 14. So hbb_lo should be 1. FYI, hbb configurations were moved to the driver from DT in recent downstream kernels.
>>> Right, seems to have happened with msm-5.10. Though a random kernel I
>>> grabbed seems to suggest it's 15 and not 14?
>>>
>>> https://github.com/sonyxperiadev/kernel/blob/aosp/K.P.1.0.r1/drivers/gpu/msm/adreno-gpulist.h#L1710
>> We override that with 14 in a6xx_init() for LP4 platforms dynamically. Since 7c3 is only supported on LP4, we can hardcode 14 here.
Okay, I see.
>> In the downstream kernel, there is an api (of_fdt_get_ddrtype()) to detect ddrtype. If we can get something like that in upstream, we should implement a similar logic here.
Yeah, I mentioned it here [1], but I doubt it'd be implemented,
given what Krzysztof pointed out.
>>
>> -Akhil.
> Also, I haven't closely reviewed other targets configuration you updated, but it is a good idea to leave the existing configurations here as it in this refactor patch. Any update should be a separate patch.
Sure, will do.
Konrad
[1] https://github.com/devicetree-org/devicetree-specification/issues/62
>
> -Akhil.
>>> Konrad
>>>> -Akhil.
>>>>> rgb565_predicator = 1;
>>>>> uavflagprd_inv = 2;
>>>>> }
>>>>>
>>>>> gpu_write(gpu, REG_A6XX_RB_NC_MODE_CNTL,
>>>>> - rgb565_predicator << 11 | amsbc << 4 | lower_bit << 1);
>>>>> - gpu_write(gpu, REG_A6XX_TPL1_NC_MODE_CNTL, lower_bit << 1);
>>>>> - gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL,
>>>>> - uavflagprd_inv << 4 | lower_bit << 1);
>>>>> - gpu_write(gpu, REG_A6XX_UCHE_MODE_CNTL, lower_bit << 21);
>>>>> + rgb565_predicator << 11 | hbb_hi << 10 | amsbc << 4 |
>>>>> + min_acc_len << 3 | hbb_lo << 1 | ubwc_mode);
>>>>> +
>>>>> + gpu_write(gpu, REG_A6XX_TPL1_NC_MODE_CNTL, hbb_hi << 4 |
>>>>> + min_acc_len << 3 | hbb_lo << 1 | ubwc_mode);
>>>>> +
>>>>> + gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL, hbb_hi << 10 |
>>>>> + uavflagprd_inv << 4 | min_acc_len << 3 |
>>>>> + hbb_lo << 1 | ubwc_mode);
>>>>> +
>>>>> + gpu_write(gpu, REG_A6XX_UCHE_MODE_CNTL, min_acc_len << 23 | hbb_lo << 21);
>>>>> }
>>>>>
>>>>> static int a6xx_cp_init(struct msm_gpu *gpu)
>>>>>
>
next prev parent reply other threads:[~2023-02-28 21:22 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 12:06 [PATCH v3 00/15] GMU-less A6xx support (A610, A619_holi) Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 01/15] dt-bindings: display/msm: gpu: Document GMU wrapper-equipped A6xx Konrad Dybcio
2023-02-23 12:08 ` Konrad Dybcio
2023-02-24 11:17 ` Krzysztof Kozlowski
2023-02-24 11:51 ` Konrad Dybcio
2023-02-24 12:54 ` Krzysztof Kozlowski
2023-02-23 12:06 ` [PATCH v3 02/15] dt-bindings: display/msm/gmu: Add GMU wrapper Konrad Dybcio
2023-02-24 11:19 ` Krzysztof Kozlowski
2023-02-24 11:50 ` Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 03/15] drm/msm/a6xx: Remove static keyword from sptprac en/disable functions Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 04/15] drm/msm/a6xx: Extend and explain UBWC config Konrad Dybcio
2023-02-28 20:23 ` Akhil P Oommen
2023-02-28 20:40 ` Konrad Dybcio
2023-02-28 20:44 ` Akhil P Oommen
2023-02-28 20:48 ` [Freedreno] " Akhil P Oommen
2023-02-28 21:22 ` Konrad Dybcio [this message]
2023-02-23 12:06 ` [PATCH v3 05/15] drm/msm/a6xx: Introduce GMU wrapper support Konrad Dybcio
2023-02-23 14:43 ` Dmitry Baryshkov
2023-02-23 14:46 ` Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 06/15] drm/msm/a6xx: Remove both GBIF and RBBM GBIF halt on hw init Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 07/15] drm/msm/adreno: Disable has_cached_coherent in GMU wrapper configurations Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 08/15] drm/msm/a6xx: Add support for A619_holi Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 09/15] drm/msm/a6xx: Add A610 support Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 10/15] drm/msm/a6xx: Fix A680 highest bank bit value Konrad Dybcio
2023-02-23 13:06 ` Dmitry Baryshkov
2023-02-23 13:49 ` Konrad Dybcio
2023-02-23 14:48 ` Dmitry Baryshkov
2023-02-23 14:51 ` Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 11/15] drm/msm/a6xx: Fix some A619 tunables Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 12/15] drm/msm/a6xx: Use "else if" in GPU speedbin rev matching Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 13/15] drm/msm/a6xx: Use adreno_is_aXYZ macros in speedbin matching Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 14/15] drm/msm/a6xx: Add A619_holi speedbin support Konrad Dybcio
2023-02-23 12:06 ` [PATCH v3 15/15] drm/msm/a6xx: Add A610 " Konrad Dybcio
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=c608fa1b-96dd-8d32-3d00-28d40c734b43@linaro.org \
--to=konrad.dybcio@linaro.org \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=konrad.dybcio@somainline.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_akhilpo@quicinc.com \
--cc=robdclark@chromium.org \
--cc=robdclark@gmail.com \
--cc=robh+dt@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).