Re: [Freedreno] [PATCH] drm/msm/dpu: fix stack smashing in dpu_hw_ctl_setup_blendstage

2023-02-23 Thread Abhinav Kumar
On 2/23/2023 2:08 PM, Dmitry Baryshkov wrote: Hi Abhinav, On Thu, 23 Feb 2023 at 21:17, Abhinav Kumar wrote: Hi Dmitry On 2/23/2023 1:57 AM, Dmitry Baryshkov wrote: The rewritten dpu_hw_ctl_setup_blendstage() can lightly smash the stack when setting the SSPP_NONE pipe. However it was unn

Re: [Freedreno] [PATCH] drm/msm/dpu: fix stack smashing in dpu_hw_ctl_setup_blendstage

2023-02-23 Thread Dmitry Baryshkov
Hi Abhinav, On Thu, 23 Feb 2023 at 21:17, Abhinav Kumar wrote: > > Hi Dmitry > > On 2/23/2023 1:57 AM, Dmitry Baryshkov wrote: > > The rewritten dpu_hw_ctl_setup_blendstage() can lightly smash the stack > > when setting the SSPP_NONE pipe. However it was unnoticed until the > > kernel was tested

Re: [Freedreno] [PATCH] drm/msm/dpu: fix stack smashing in dpu_hw_ctl_setup_blendstage

2023-02-23 Thread Abhinav Kumar
Hi Dmitry On 2/23/2023 1:57 AM, Dmitry Baryshkov wrote: The rewritten dpu_hw_ctl_setup_blendstage() can lightly smash the stack when setting the SSPP_NONE pipe. However it was unnoticed until the kernel was tested under AOSP (with some kind of stack protection/check). This fixes the following b

Re: [Freedreno] [PATCH v4 06/14] dma-buf/sync_file: Support (E)POLLPRI

2023-02-23 Thread Rob Clark
On Thu, Feb 23, 2023 at 1:38 AM Pekka Paalanen wrote: > > On Wed, 22 Feb 2023 07:37:26 -0800 > Rob Clark wrote: > > > On Wed, Feb 22, 2023 at 1:49 AM Pekka Paalanen wrote: > > > > > > On Tue, 21 Feb 2023 09:53:56 -0800 > > > Rob Clark wrote: > > > > > > > On Tue, Feb 21, 2023 at 8:48 AM Luben T

Re: [Freedreno] [PATCH] drm/msm/dpu: fix stack smashing in dpu_hw_ctl_setup_blendstage

2023-02-23 Thread Amit Pundir
On Thu, 23 Feb 2023 at 15:27, Dmitry Baryshkov wrote: > > The rewritten dpu_hw_ctl_setup_blendstage() can lightly smash the stack > when setting the SSPP_NONE pipe. However it was unnoticed until the > kernel was tested under AOSP (with some kind of stack protection/check). > > This fixes the foll

Re: [Freedreno] [PATCH v3 2/7] drm/msm/a2xx: Add REG_A2XX_RBBM_PM_OVERRIDE2 to XML

2023-02-23 Thread Dmitry Baryshkov
On 23/02/2023 12:51, Konrad Dybcio wrote: This is a partial merge of [1], subject to be dropped if a header update is executed. [1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21484 Suggested-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a2xx

Re: [Freedreno] [PATCH v3 1/7] drm/msm/a2xx: Include perf counter reg values in XML

2023-02-23 Thread Dmitry Baryshkov
On 23/02/2023 12:51, Konrad Dybcio wrote: This is a partial merge of [1], subject to be dropped if a header update is executed. [1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21480/ Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a2xx.xml.h | 6 ++ 1 file chan

Re: [Freedreno] [RFC PATCH 0/2] drm/msm/dp: refactor the msm dp driver resources

2023-02-23 Thread Dmitry Baryshkov
On Thu, 23 Feb 2023 at 15:57, Sankeerth Billakanti wrote: > > The DP driver resources are currently enabled and disabled directly based on > code flow. > As mentioned in bug 230631602, we want to do the following: private bug tracker > > 1) Refactor the dp/edp parsing code to move it to probe (

Re: [Freedreno] [RFC PATCH 1/2] drm/msm/dp: enumerate edp panel during driver probe

2023-02-23 Thread Dmitry Baryshkov
On Thu, 23 Feb 2023 at 15:57, Sankeerth Billakanti wrote: > > The eDP panel is identified and enumerated during probe of the panel-edp > driver. The current DP driver triggers this panel-edp driver probe while > getting the panel-bridge associated with the eDP panel from the platform > driver bind

Re: [Freedreno] [PATCH v3 10/15] drm/msm/a6xx: Fix A680 highest bank bit value

2023-02-23 Thread Konrad Dybcio
On 23.02.2023 15:48, Dmitry Baryshkov wrote: > On Thu, 23 Feb 2023 at 15:49, Konrad Dybcio wrote: >> >> >> >> On 23.02.2023 14:06, Dmitry Baryshkov wrote: >>> On Thu, 23 Feb 2023 at 14:07, Konrad Dybcio >>> wrote: According to the vendor sources, it's equal to 16, which makes hbb_lo

Re: [Freedreno] [PATCH v3 10/15] drm/msm/a6xx: Fix A680 highest bank bit value

2023-02-23 Thread Dmitry Baryshkov
On Thu, 23 Feb 2023 at 15:49, Konrad Dybcio wrote: > > > > On 23.02.2023 14:06, Dmitry Baryshkov wrote: > > On Thu, 23 Feb 2023 at 14:07, Konrad Dybcio > > wrote: > >> > >> According to the vendor sources, it's equal to 16, which makes hbb_lo > >> equal to 3. > > > > I think we might be stricken

Re: [Freedreno] [PATCH v3 05/15] drm/msm/a6xx: Introduce GMU wrapper support

2023-02-23 Thread Konrad Dybcio
On 23.02.2023 15:43, Dmitry Baryshkov wrote: > On Thu, 23 Feb 2023 at 14:06, Konrad Dybcio wrote: >> >> Some (particularly SMD_RPM, a.k.a non-RPMh) SoCs implement A6XX GPUs >> but don't implement the associated GMUs. This is due to the fact that >> the GMU directly pokes at RPMh. Sadly, this me

Re: [Freedreno] [PATCH v3 05/15] drm/msm/a6xx: Introduce GMU wrapper support

2023-02-23 Thread Dmitry Baryshkov
On Thu, 23 Feb 2023 at 14:06, Konrad Dybcio wrote: > > Some (particularly SMD_RPM, a.k.a non-RPMh) SoCs implement A6XX GPUs > but don't implement the associated GMUs. This is due to the fact that > the GMU directly pokes at RPMh. Sadly, this means we have to take care > of enabling & scaling power

[Freedreno] [RFC PATCH 2/2] drm/msm/dp: enable pm_runtime support for dp driver

2023-02-23 Thread Sankeerth Billakanti
The current DP driver directly enables or disables the necessary control resources based on code flow. This could disable a required resource that is needed in a different usecase. It can also lead to excessive voting of a resource and may increase power consumption. The pm_runtime framework can s

[Freedreno] [RFC PATCH 1/2] drm/msm/dp: enumerate edp panel during driver probe

2023-02-23 Thread Sankeerth Billakanti
The eDP panel is identified and enumerated during probe of the panel-edp driver. The current DP driver triggers this panel-edp driver probe while getting the panel-bridge associated with the eDP panel from the platform driver bind. If the panel-edp probe is deferred, then the whole bunch of MDSS pa

[Freedreno] [RFC PATCH 0/2] drm/msm/dp: refactor the msm dp driver resources

2023-02-23 Thread Sankeerth Billakanti
The DP driver resources are currently enabled and disabled directly based on code flow. As mentioned in bug 230631602, we want to do the following: 1) Refactor the dp/edp parsing code to move it to probe (it is currently done in bind). 2) Then bind all the power resources needed for AUX in pm_r

Re: [Freedreno] [PATCH v3 10/15] drm/msm/a6xx: Fix A680 highest bank bit value

2023-02-23 Thread Konrad Dybcio
On 23.02.2023 14:06, Dmitry Baryshkov wrote: > On Thu, 23 Feb 2023 at 14:07, Konrad Dybcio wrote: >> >> According to the vendor sources, it's equal to 16, which makes hbb_lo >> equal to 3. > > I think we might be stricken with the ddr kind difference here, but I > would not bet on it. It total

Re: [Freedreno] [PATCH v3 10/15] drm/msm/a6xx: Fix A680 highest bank bit value

2023-02-23 Thread Dmitry Baryshkov
On Thu, 23 Feb 2023 at 14:07, Konrad Dybcio wrote: > > According to the vendor sources, it's equal to 16, which makes hbb_lo > equal to 3. I think we might be stricken with the ddr kind difference here, but I would not bet on it. > > Fixes: 840d10b64dad ("drm: msm: Add 680 gpu to the adreno gpu

Re: [Freedreno] [PATCH v3 01/15] dt-bindings: display/msm: gpu: Document GMU wrapper-equipped A6xx

2023-02-23 Thread Konrad Dybcio
On 23.02.2023 13:06, Konrad Dybcio wrote: > GMU wrapper-equipped A6xx GPUs require clocks and clock-names to be > specified under the GPU node, just like their older cousins. > Account for that. > > Signed-off-by: Konrad Dybcio > --- [...] > -then: # Since Adreno 6xx series clocks should b

[Freedreno] [PATCH v3 15/15] drm/msm/a6xx: Add A610 speedbin support

2023-02-23 Thread Konrad Dybcio
A610 is implemented on at least three SoCs: SM6115 (bengal), SM6125 (trinket) and SM6225 (khaje). Trinket does not support speed binning (only a single SKU exists) and we don't yet support khaje upstream. Hence, add a fuse mapping table for bengal to allow for per-chip frequency limiting. Reviewed

[Freedreno] [PATCH v3 14/15] drm/msm/a6xx: Add A619_holi speedbin support

2023-02-23 Thread Konrad Dybcio
A619_holi is implemented on at least two SoCs: SM4350 (holi) and SM6375 (blair). This is what seems to be a first occurrence of this happening, but it's easy to overcome by guarding the SoC-specific fuse values with of_machine_is_compatible(). Do just that to enable frequency limiting on these SoCs

[Freedreno] [PATCH v3 11/15] drm/msm/a6xx: Fix some A619 tunables

2023-02-23 Thread Konrad Dybcio
Adreno 619 expects some tunables to be set differently. Make up for it. Fixes: b7616b5c69e6 ("drm/msm/adreno: Add A619 support") Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff

[Freedreno] [PATCH v3 13/15] drm/msm/a6xx: Use adreno_is_aXYZ macros in speedbin matching

2023-02-23 Thread Konrad Dybcio
Before transitioning to using per-SoC and not per-Adreno speedbin fuse values (need another patchset to land elsewhere), a good improvement/stopgap solution is to use adreno_is_aXYZ macros in place of explicit revision matching. Do so to allow differentiating between A619 and A619_holi. Signed-off

[Freedreno] [PATCH v3 12/15] drm/msm/a6xx: Use "else if" in GPU speedbin rev matching

2023-02-23 Thread Konrad Dybcio
The GPU can only be one at a time. Turn a series of ifs into if + elseifs to save some CPU cycles. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm

[Freedreno] [PATCH v3 10/15] drm/msm/a6xx: Fix A680 highest bank bit value

2023-02-23 Thread Konrad Dybcio
According to the vendor sources, it's equal to 16, which makes hbb_lo equal to 3. Fixes: 840d10b64dad ("drm: msm: Add 680 gpu to the adreno gpu list") Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a

[Freedreno] [PATCH v3 09/15] drm/msm/a6xx: Add A610 support

2023-02-23 Thread Konrad Dybcio
A610 is one of (if not the) lowest-tier SKUs in the A6XX family. It features no GMU, as it's implemented solely on SoCs with SMD_RPM. What's more interesting is that it does not feature a VDDGX line either, being powered solely by VDDCX and has an unfortunate hardware quirk that makes its reset lin

[Freedreno] [PATCH v3 08/15] drm/msm/a6xx: Add support for A619_holi

2023-02-23 Thread Konrad Dybcio
A619_holi is a GMU-less variant of the already-supported A619 GPU. It's present on at least SM4350 (holi) and SM6375 (blair). No mesa changes are required. Add the required kernel-side support for it. Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 43 +

[Freedreno] [PATCH v3 07/15] drm/msm/adreno: Disable has_cached_coherent in GMU wrapper configurations

2023-02-23 Thread Konrad Dybcio
A610 and A619_holi don't support the feature. Disable it to make the GPU stop crashing after almost each and every submission - the received data on the GPU end was simply incomplete in garbled, resulting in almost nothing being executed properly. Extend the disablement to adreno_has_gmu_wrapper, a

[Freedreno] [PATCH v3 06/15] drm/msm/a6xx: Remove both GBIF and RBBM GBIF halt on hw init

2023-02-23 Thread Konrad Dybcio
Currently we're only deasserting REG_A6XX_RBBM_GBIF_HALT, but we also need REG_A6XX_GBIF_HALT to be set to 0. For GMU-equipped GPUs this is done in a6xx_bus_clear_pending_transactions(), but for the GMU-less ones we have to do it *somewhere*. Unhalting both side by side sounds like a good plan and

[Freedreno] [PATCH v3 04/15] drm/msm/a6xx: Extend and explain UBWC config

2023-02-23 Thread Konrad Dybcio
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. Port setting min_access_length, ubwc_mode and hbb_hi from downstream. Set default values for all of the tunables to zero, a

[Freedreno] [PATCH v3 05/15] drm/msm/a6xx: Introduce GMU wrapper support

2023-02-23 Thread Konrad Dybcio
Some (particularly SMD_RPM, a.k.a non-RPMh) SoCs implement A6XX GPUs but don't implement the associated GMUs. This is due to the fact that the GMU directly pokes at RPMh. Sadly, this means we have to take care of enabling & scaling power rails, clocks and bandwidth ourselves. Reuse existing Adreno

[Freedreno] [PATCH v3 02/15] dt-bindings: display/msm/gmu: Add GMU wrapper

2023-02-23 Thread Konrad Dybcio
GMU wrapper is essentially a register space within the GPU, which Linux sees as a dumbed-down regular GMU: there's no clocks, interrupts, multiple regs, iommus and OPP. Document it. Signed-off-by: Konrad Dybcio --- .../devicetree/bindings/display/msm/gmu.yaml | 49 -- 1

[Freedreno] [PATCH v3 03/15] drm/msm/a6xx: Remove static keyword from sptprac en/disable functions

2023-02-23 Thread Konrad Dybcio
These two will be reused by at least A619_holi in the non-gmu paths. Turn them non-static them to make it possible. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 4 ++-- drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 2 ++ 2 files changed, 4 ins

[Freedreno] [PATCH v3 01/15] dt-bindings: display/msm: gpu: Document GMU wrapper-equipped A6xx

2023-02-23 Thread Konrad Dybcio
GMU wrapper-equipped A6xx GPUs require clocks and clock-names to be specified under the GPU node, just like their older cousins. Account for that. Signed-off-by: Konrad Dybcio --- .../devicetree/bindings/display/msm/gpu.yaml | 63 ++ 1 file changed, 53 insertions(+), 10

[Freedreno] [PATCH v3 00/15] GMU-less A6xx support (A610, A619_holi)

2023-02-23 Thread Konrad Dybcio
v2 -> v3: New dependencies: - https://lore.kernel.org/linux-arm-msm/20230223-topic-opp-v3-0-5f22163cd...@linaro.org/T/#t - https://lore.kernel.org/linux-arm-msm/20230120172233.1905761-1-konrad.dyb...@linaro.org/ Sidenote: A speedbin rework is in progress, the of_machine_is_compatible calls

Re: [Freedreno] drm/msm/dpu: fix stack smashing in dpu_hw_ctl_setup_blendstage

2023-02-23 Thread Konrad Dybcio
On 23.02.2023 12:53, Dmitry Baryshkov wrote: > On Thu, 23 Feb 2023 at 12:57, Konrad Dybcio wrote: >> >> >> >> On 23.02.2023 10:57, Dmitry Baryshkov wrote: >>> The rewritten dpu_hw_ctl_setup_blendstage() can lightly smash the stack >>> when setting the SSPP_NONE pipe. However it was unnoticed un

Re: [Freedreno] drm/msm/dpu: fix stack smashing in dpu_hw_ctl_setup_blendstage

2023-02-23 Thread Dmitry Baryshkov
On Thu, 23 Feb 2023 at 12:57, Konrad Dybcio wrote: > > > > On 23.02.2023 10:57, Dmitry Baryshkov wrote: > > The rewritten dpu_hw_ctl_setup_blendstage() can lightly smash the stack > > when setting the SSPP_NONE pipe. However it was unnoticed until the > > kernel was tested under AOSP (with some ki

Re: [Freedreno] drm/msm/dpu: fix stack smashing in dpu_hw_ctl_setup_blendstage

2023-02-23 Thread Konrad Dybcio
On 23.02.2023 10:57, Dmitry Baryshkov wrote: > The rewritten dpu_hw_ctl_setup_blendstage() can lightly smash the stack > when setting the SSPP_NONE pipe. However it was unnoticed until the > kernel was tested under AOSP (with some kind of stack protection/check). > > This fixes the following ba

[Freedreno] [PATCH v3 4/7] drm/msm/a2xx: Implement .gpu_busy

2023-02-23 Thread Konrad Dybcio
Implement gpu_busy based on the downstream msm-3.4 code [1]. This allows us to use devfreq on this old old old hardware! [1] https://github.com/LineageOS/android_kernel_sony_apq8064/blob/lineage-16.0/drivers/gpu/msm/adreno_a2xx.c#L1975 Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio

[Freedreno] [PATCH v3 6/7] drm/msm/a4xx: Implement .gpu_busy

2023-02-23 Thread Konrad Dybcio
Add support for gpu_busy on a4xx, which is required for devfreq support. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a4xx_gpu.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c b/drivers/gpu/drm

[Freedreno] [PATCH v3 5/7] drm/msm/a3xx: Implement .gpu_busy

2023-02-23 Thread Konrad Dybcio
Add support for gpu_busy on a3xx, which is required for devfreq support. Tested-by: Dmitry Baryshkov #ifc6410 Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/ms

[Freedreno] [PATCH v3 7/7] drm/msm/adreno: Enable optional icc voting from OPP tables

2023-02-23 Thread Konrad Dybcio
Add the dev_pm_opp_of_find_icc_paths() call to let the OPP framework handle bus voting as part of power level setting. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/adreno_device.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/dr

[Freedreno] [PATCH v3 3/7] drm/msm/adreno: Use OPP for every GPU generation

2023-02-23 Thread Konrad Dybcio
Some older GPUs (namely a2xx with no opp tables at all and a320 with downstream-remnants gpu pwrlevels) used not to have OPP tables. They both however had just one frequency defined, making it extremely easy to construct such an OPP table from within the driver if need be. Do so and switch all clk

[Freedreno] [PATCH v3 0/7] OPP and devfreq for all Adrenos

2023-02-23 Thread Konrad Dybcio
v2 -> v3: - Add [2/7], x-ref with https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21484 - De-magic-ify the remaining BIT(6) in a2xx_busy (thanks Dmitry) - Drop unnecessary else{} level in [3/7] - Pick up tags v2: https://lore.kernel.org/linux-arm-msm/20230223-topic-opp-v2-0-24ed24

[Freedreno] [PATCH v3 2/7] drm/msm/a2xx: Add REG_A2XX_RBBM_PM_OVERRIDE2 to XML

2023-02-23 Thread Konrad Dybcio
This is a partial merge of [1], subject to be dropped if a header update is executed. [1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21484 Suggested-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a2xx.xml.h | 12 1 file changed, 12

[Freedreno] [PATCH v3 1/7] drm/msm/a2xx: Include perf counter reg values in XML

2023-02-23 Thread Konrad Dybcio
This is a partial merge of [1], subject to be dropped if a header update is executed. [1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21480/ Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a2xx.xml.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu

Re: [Freedreno] [PATCH v2 3/6] drm/msm/a2xx: Implement .gpu_busy

2023-02-23 Thread Konrad Dybcio
On 23.02.2023 03:09, Dmitry Baryshkov wrote: > On Thu, 23 Feb 2023 at 03:47, Konrad Dybcio wrote: >> >> Implement gpu_busy based on the downstream msm-3.4 code [1]. This >> allows us to use devfreq on this old old old hardware! >> >> [1] >> https://github.com/LineageOS/android_kernel_sony_apq8

[Freedreno] [PATCH] drm/msm/dpu: fix stack smashing in dpu_hw_ctl_setup_blendstage

2023-02-23 Thread Dmitry Baryshkov
The rewritten dpu_hw_ctl_setup_blendstage() can lightly smash the stack when setting the SSPP_NONE pipe. However it was unnoticed until the kernel was tested under AOSP (with some kind of stack protection/check). This fixes the following backtrace: Unexpected kernel BRK exception at EL1 Internal

Re: [Freedreno] [PATCH v4 06/14] dma-buf/sync_file: Support (E)POLLPRI

2023-02-23 Thread Pekka Paalanen
On Wed, 22 Feb 2023 07:37:26 -0800 Rob Clark wrote: > On Wed, Feb 22, 2023 at 1:49 AM Pekka Paalanen wrote: > > > > On Tue, 21 Feb 2023 09:53:56 -0800 > > Rob Clark wrote: > > > > > On Tue, Feb 21, 2023 at 8:48 AM Luben Tuikov > > > wrote: > > > > > > > > On 2023-02-20 11:14, Rob Clark wr

Re: [Freedreno] [PATCH v4 05/14] dma-buf/sync_file: Add SET_DEADLINE ioctl

2023-02-23 Thread Christian König
Am 20.02.23 um 17:09 schrieb Rob Clark: On Mon, Feb 20, 2023 at 12:27 AM Christian König wrote: Am 18.02.23 um 22:15 schrieb Rob Clark: From: Rob Clark The initial purpose is for igt tests, but this would also be useful for compositors that wait until close to vblank deadline to make decisio