Re: [Freedreno] patches dropped from drm-misc-next [Was: Re: [PATCH 00/53] drm: Convert to platform remove callback returning] void

2023-06-17 Thread Doug Anderson
Hi,

On Sat, Jun 17, 2023 at 9:15 AM Uwe Kleine-König
 wrote:
>
> [expanding recipents by the other affected persons]
>
> On Thu, Jun 08, 2023 at 09:08:15AM -0700, Doug Anderson wrote:
> > On Thu, Jun 1, 2023 at 8:40 AM Uwe Kleine-König
> >  wrote:
> > >
> > > Hello,
> > >
> > > On Sun, May 07, 2023 at 06:25:23PM +0200, Uwe Kleine-König wrote:
> > > > this patch series adapts the platform drivers below drivers/gpu/drm
> > > > to use the .remove_new() callback. Compared to the traditional .remove()
> > > > callback .remove_new() returns no value. This is a good thing because
> > > > the driver core doesn't (and cannot) cope for errors during remove. The
> > > > only effect of a non-zero return value in .remove() is that the driver
> > > > core emits a warning. The device is removed anyhow and an early return
> > > > from .remove() usually yields a resource leak.
> > > >
> > > > By changing the remove callback to return void driver authors cannot
> > > > reasonably (but wrongly) assume any more that there happens some kind of
> > > > cleanup later.
> > >
> > > I wonder if someone would volunteer to add the whole series to
> > > drm-misc-next?!
> >
> > It looks as if Neil applied quite a few of them already, so I looked
> > at what was left...
> >
> > I'm a little hesitant to just apply the whole kit-and-caboodle to
> > drm-misc-next since there are specific DRM trees for a bunch of them
> > and it would be better if they landed there. ...so I went through all
> > the patches that still applied to drm-misc-next, then used
> > 'scripts/get_maintainer.pl --scm' to check if they were maintained
> > through drm-misc. That still left quite a few patches. I've applied
> > those ones and pushed to drm-misc-next:
> >
> > 71722685cd17 drm/xlnx/zynqmp_dpsub: Convert to platform remove
> > callback returning void
> > 1ed54a19f3b3 drm/vc4: Convert to platform remove callback returning void
> > b957812839f8 drm/v3d: Convert to platform remove callback returning void
> > e2fd3192e267 drm/tve200: Convert to platform remove callback returning void
> > 84e6da7ad553 drm/tiny: Convert to platform remove callback returning void
> > 34cdd1f691ad drm/tidss: Convert to platform remove callback returning void
> > d665e3c9d37a drm/sun4i: Convert to platform remove callback returning void
> > 0c259ab19146 drm/stm: Convert to platform remove callback returning void
> > 9a865e45884a drm/sti: Convert to platform remove callback returning void
> > 3c855610840e drm/rockchip: Convert to platform remove callback returning 
> > void
> > e41977a83b71 drm/panfrost: Convert to platform remove callback returning 
> > void
> > cef3776d0b5a drm/panel: Convert to platform remove callback returning void
> > bd296a594e87 drm/mxsfb: Convert to platform remove callback returning void
> > 38ca2d93d323 drm/meson: Convert to platform remove callback returning void
> > fd1457d84bae drm/mcde: Convert to platform remove callback returning void
> > 41a56a18615c drm/logicvc: Convert to platform remove callback returning void
> > 980ec6444372 drm/lima: Convert to platform remove callback returning void
> > 82a2c0cc1a22 drm/hisilicon: Convert to platform remove callback returning 
> > void
> > c3b28b29ac0a drm/fsl-dcu: Convert to platform remove callback returning void
> > a118fc6e71f9 drm/atmel-hlcdc: Convert to platform remove callback returning 
> > void
> > 9a32dd324c46 drm/aspeed: Convert to platform remove callback returning void
> > 2c7d291c498c drm/arm/malidp: Convert to platform remove callback returning 
> > void
> > a920028df679 drm/arm/hdlcd: Convert to platform remove callback returning 
> > void
> > 1bf3d76a7d15 drm/komeda: Convert to platform remove callback returning void
>
> Together with the patches that were applied later the topmost commit
> from this series is c2807ecb5290 ("drm/omap: Convert to platform remove
> callback returning void"). This commit was part for the following next
> tags:
>
> $ git tag -l --contains c2807ecb5290
> next-20230609
> next-20230613
> next-20230614
> next-20230615
>
> However in next-20230616 they are missing. In next-20230616
> drm-misc/for-linux-next was cf683e8870bd4be0fd6b98639286700a35088660.
> Compared to c2807ecb5290 this adds 1149 patches but drops 37 (that are
> also not included with a different commit id). The 37 patches dropped
> are 13cdd12a9f934158f4ec817cf048fcb4384aa9dc..c2807ecb5290:
>
> $ git shortlog -s 
> 13cdd12a9f934158f4ec817cf048fcb4384aa9dc..c2807ecb5290
>  1  Christophe JAILLET
>  2  Jessica Zhang
>  5  Karol Wachowski
>  1  Laura Nao
> 27  Uwe Kleine-König
>  1  Wang Jianzheng
>
>
> I guess this was done by mistake because nobody told me about dropping
> my/these patches? Can c2807ecb5290 please be merged into drm-misc-next
> again?

Actually, it was probably a mistake that these patches got merged to
linuxnext during the 4 days that you noticed. However, your patches

Re: [Freedreno] patches dropped from drm-misc-next [Was: Re: [PATCH 00/53] drm: Convert to platform remove callback returning] void

2023-06-17 Thread Chen-Yu Tsai
On Sun, Jun 18, 2023 at 12:13 AM Uwe Kleine-König
 wrote:
>
> [expanding recipents by the other affected persons]
>
> On Thu, Jun 08, 2023 at 09:08:15AM -0700, Doug Anderson wrote:
> > On Thu, Jun 1, 2023 at 8:40 AM Uwe Kleine-König
> >  wrote:
> > >
> > > Hello,
> > >
> > > On Sun, May 07, 2023 at 06:25:23PM +0200, Uwe Kleine-König wrote:
> > > > this patch series adapts the platform drivers below drivers/gpu/drm
> > > > to use the .remove_new() callback. Compared to the traditional .remove()
> > > > callback .remove_new() returns no value. This is a good thing because
> > > > the driver core doesn't (and cannot) cope for errors during remove. The
> > > > only effect of a non-zero return value in .remove() is that the driver
> > > > core emits a warning. The device is removed anyhow and an early return
> > > > from .remove() usually yields a resource leak.
> > > >
> > > > By changing the remove callback to return void driver authors cannot
> > > > reasonably (but wrongly) assume any more that there happens some kind of
> > > > cleanup later.
> > >
> > > I wonder if someone would volunteer to add the whole series to
> > > drm-misc-next?!
> >
> > It looks as if Neil applied quite a few of them already, so I looked
> > at what was left...
> >
> > I'm a little hesitant to just apply the whole kit-and-caboodle to
> > drm-misc-next since there are specific DRM trees for a bunch of them
> > and it would be better if they landed there. ...so I went through all
> > the patches that still applied to drm-misc-next, then used
> > 'scripts/get_maintainer.pl --scm' to check if they were maintained
> > through drm-misc. That still left quite a few patches. I've applied
> > those ones and pushed to drm-misc-next:
> >
> > 71722685cd17 drm/xlnx/zynqmp_dpsub: Convert to platform remove
> > callback returning void
> > 1ed54a19f3b3 drm/vc4: Convert to platform remove callback returning void
> > b957812839f8 drm/v3d: Convert to platform remove callback returning void
> > e2fd3192e267 drm/tve200: Convert to platform remove callback returning void
> > 84e6da7ad553 drm/tiny: Convert to platform remove callback returning void
> > 34cdd1f691ad drm/tidss: Convert to platform remove callback returning void
> > d665e3c9d37a drm/sun4i: Convert to platform remove callback returning void
> > 0c259ab19146 drm/stm: Convert to platform remove callback returning void
> > 9a865e45884a drm/sti: Convert to platform remove callback returning void
> > 3c855610840e drm/rockchip: Convert to platform remove callback returning 
> > void
> > e41977a83b71 drm/panfrost: Convert to platform remove callback returning 
> > void
> > cef3776d0b5a drm/panel: Convert to platform remove callback returning void
> > bd296a594e87 drm/mxsfb: Convert to platform remove callback returning void
> > 38ca2d93d323 drm/meson: Convert to platform remove callback returning void
> > fd1457d84bae drm/mcde: Convert to platform remove callback returning void
> > 41a56a18615c drm/logicvc: Convert to platform remove callback returning void
> > 980ec6444372 drm/lima: Convert to platform remove callback returning void
> > 82a2c0cc1a22 drm/hisilicon: Convert to platform remove callback returning 
> > void
> > c3b28b29ac0a drm/fsl-dcu: Convert to platform remove callback returning void
> > a118fc6e71f9 drm/atmel-hlcdc: Convert to platform remove callback returning 
> > void
> > 9a32dd324c46 drm/aspeed: Convert to platform remove callback returning void
> > 2c7d291c498c drm/arm/malidp: Convert to platform remove callback returning 
> > void
> > a920028df679 drm/arm/hdlcd: Convert to platform remove callback returning 
> > void
> > 1bf3d76a7d15 drm/komeda: Convert to platform remove callback returning void
>
> Together with the patches that were applied later the topmost commit
> from this series is c2807ecb5290 ("drm/omap: Convert to platform remove
> callback returning void"). This commit was part for the following next
> tags:
>
> $ git tag -l --contains c2807ecb5290
> next-20230609
> next-20230613
> next-20230614
> next-20230615
>
> However in next-20230616 they are missing. In next-20230616
> drm-misc/for-linux-next was cf683e8870bd4be0fd6b98639286700a35088660.
> Compared to c2807ecb5290 this adds 1149 patches but drops 37 (that are
> also not included with a different commit id). The 37 patches dropped
> are 13cdd12a9f934158f4ec817cf048fcb4384aa9dc..c2807ecb5290:
>
> $ git shortlog -s 
> 13cdd12a9f934158f4ec817cf048fcb4384aa9dc..c2807ecb5290
>  1  Christophe JAILLET
>  2  Jessica Zhang
>  5  Karol Wachowski
>  1  Laura Nao
> 27  Uwe Kleine-König
>  1  Wang Jianzheng
>
>
> I guess this was done by mistake because nobody told me about dropping
> my/these patches? Can c2807ecb5290 please be merged into drm-misc-next
> again?

AFAIK drm-misc/for-linux-next cuts off at -rc6, at which point any patches
merged get queued up for -next-next. I think that's what happened 

[Freedreno] patches dropped from drm-misc-next [Was: Re: [PATCH 00/53] drm: Convert to platform remove callback returning] void

2023-06-17 Thread Uwe Kleine-König
[expanding recipents by the other affected persons]

On Thu, Jun 08, 2023 at 09:08:15AM -0700, Doug Anderson wrote:
> On Thu, Jun 1, 2023 at 8:40 AM Uwe Kleine-König
>  wrote:
> >
> > Hello,
> >
> > On Sun, May 07, 2023 at 06:25:23PM +0200, Uwe Kleine-König wrote:
> > > this patch series adapts the platform drivers below drivers/gpu/drm
> > > to use the .remove_new() callback. Compared to the traditional .remove()
> > > callback .remove_new() returns no value. This is a good thing because
> > > the driver core doesn't (and cannot) cope for errors during remove. The
> > > only effect of a non-zero return value in .remove() is that the driver
> > > core emits a warning. The device is removed anyhow and an early return
> > > from .remove() usually yields a resource leak.
> > >
> > > By changing the remove callback to return void driver authors cannot
> > > reasonably (but wrongly) assume any more that there happens some kind of
> > > cleanup later.
> >
> > I wonder if someone would volunteer to add the whole series to
> > drm-misc-next?!
> 
> It looks as if Neil applied quite a few of them already, so I looked
> at what was left...
> 
> I'm a little hesitant to just apply the whole kit-and-caboodle to
> drm-misc-next since there are specific DRM trees for a bunch of them
> and it would be better if they landed there. ...so I went through all
> the patches that still applied to drm-misc-next, then used
> 'scripts/get_maintainer.pl --scm' to check if they were maintained
> through drm-misc. That still left quite a few patches. I've applied
> those ones and pushed to drm-misc-next:
> 
> 71722685cd17 drm/xlnx/zynqmp_dpsub: Convert to platform remove
> callback returning void
> 1ed54a19f3b3 drm/vc4: Convert to platform remove callback returning void
> b957812839f8 drm/v3d: Convert to platform remove callback returning void
> e2fd3192e267 drm/tve200: Convert to platform remove callback returning void
> 84e6da7ad553 drm/tiny: Convert to platform remove callback returning void
> 34cdd1f691ad drm/tidss: Convert to platform remove callback returning void
> d665e3c9d37a drm/sun4i: Convert to platform remove callback returning void
> 0c259ab19146 drm/stm: Convert to platform remove callback returning void
> 9a865e45884a drm/sti: Convert to platform remove callback returning void
> 3c855610840e drm/rockchip: Convert to platform remove callback returning void
> e41977a83b71 drm/panfrost: Convert to platform remove callback returning void
> cef3776d0b5a drm/panel: Convert to platform remove callback returning void
> bd296a594e87 drm/mxsfb: Convert to platform remove callback returning void
> 38ca2d93d323 drm/meson: Convert to platform remove callback returning void
> fd1457d84bae drm/mcde: Convert to platform remove callback returning void
> 41a56a18615c drm/logicvc: Convert to platform remove callback returning void
> 980ec6444372 drm/lima: Convert to platform remove callback returning void
> 82a2c0cc1a22 drm/hisilicon: Convert to platform remove callback returning void
> c3b28b29ac0a drm/fsl-dcu: Convert to platform remove callback returning void
> a118fc6e71f9 drm/atmel-hlcdc: Convert to platform remove callback returning 
> void
> 9a32dd324c46 drm/aspeed: Convert to platform remove callback returning void
> 2c7d291c498c drm/arm/malidp: Convert to platform remove callback returning 
> void
> a920028df679 drm/arm/hdlcd: Convert to platform remove callback returning void
> 1bf3d76a7d15 drm/komeda: Convert to platform remove callback returning void

Together with the patches that were applied later the topmost commit
from this series is c2807ecb5290 ("drm/omap: Convert to platform remove
callback returning void"). This commit was part for the following next
tags:

$ git tag -l --contains c2807ecb5290
next-20230609
next-20230613
next-20230614
next-20230615

However in next-20230616 they are missing. In next-20230616
drm-misc/for-linux-next was cf683e8870bd4be0fd6b98639286700a35088660.
Compared to c2807ecb5290 this adds 1149 patches but drops 37 (that are
also not included with a different commit id). The 37 patches dropped
are 13cdd12a9f934158f4ec817cf048fcb4384aa9dc..c2807ecb5290:

$ git shortlog -s 13cdd12a9f934158f4ec817cf048fcb4384aa9dc..c2807ecb5290
 1  Christophe JAILLET
 2  Jessica Zhang
 5  Karol Wachowski
 1  Laura Nao
27  Uwe Kleine-König
 1  Wang Jianzheng


I guess this was done by mistake because nobody told me about dropping
my/these patches? Can c2807ecb5290 please be merged into drm-misc-next
again?

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | https://www.pengutronix.de/ |


signature.asc
Description: PGP signature


Re: [Freedreno] [PATCH v8 10/18] drm/msm/a6xx: Introduce GMU wrapper support

2023-06-17 Thread Akhil P Oommen
On Sat, Jun 17, 2023 at 02:00:50AM +0200, Konrad Dybcio wrote:
> 
> On 16.06.2023 19:54, Akhil P Oommen wrote:
> > On Thu, Jun 15, 2023 at 11:43:04PM +0200, Konrad Dybcio wrote:
> >>
> >> On 10.06.2023 00:06, Akhil P Oommen wrote:
> >>> On Mon, May 29, 2023 at 03:52:29PM +0200, 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 rails, clocks and bandwidth ourselves.
> 
>  Reuse existing Adreno-common code and modify the deeply-GMU-infused
>  A6XX code to facilitate these GPUs. This involves if-ing out lots
>  of GMU callbacks and introducing a new type of GMU - GMU wrapper (it's
>  the actual name that Qualcomm uses in their downstream kernels).
> 
>  This is essentially a register region which is convenient to model
>  as a device. We'll use it for managing the GDSCs. The register
>  layout matches the actual GMU_CX/GX regions on the "real GMU" devices
>  and lets us reuse quite a bit of gmu_read/write/rmw calls.
> 
>  Signed-off-by: Konrad Dybcio 
>  ---
> [...]
> 
>  +
>  +ret = clk_bulk_prepare_enable(gpu->nr_clocks, gpu->grp_clks);
>  +if (ret)
>  +goto err_bulk_clk;
>  +
>  +/* If anything goes south, tear the GPU down piece by piece.. */
>  +if (ret) {
>  +err_bulk_clk:
> >>>
> >>> Goto jump directly to another block looks odd to me. Why do you need this 
> >>> label
> >>> anyway?
> >> If clk_bulk_prepare_enable() fails, trying to proceed will hang the
> >> platform with unclocked accesses. We need to unwind everything that
> >> has been done up until that point, in reverse order.
> > 
> > I missed this response from you earlier.
> > 
> > But you are checking for 'ret' twice here. You will end up here even
> > if you don't jump! So "if (ret) goto err_bulk_clk;" looks
> > unnecessary.
> > 
> > -Akhil.
> Ohhh right, silly mistake on my part ;)
> 
> I already sent out a v9 since.. Please check it out and if you
> have any further comments, I'll fix this, and if not.. Perhaps I
> could fix it in an incremental patch if that revision is gtg?

Incremental patch is fine as there is no functional issue.

-Akhil.

> 
> Konrad
> > 
> >>
> >>>
>  +pm_runtime_put(gmu->gxpd);
>  +pm_runtime_put(gmu->dev);
>  +dev_pm_opp_set_opp(&gpu->pdev->dev, NULL);
>  +}
>  +err_set_opp:
> >>>
> >>> Generally, it is better to name the label based on what you do here. For
> >>> eg: "unlock_lock:".
> >> That seems to be a mixed bag all throughout the kernel, I've seen many
> >> usages of err_(what went wrong)
> >>
> >>>
> >>> Also, this function is small enough that it is better to return directly
> >>> in case of error. I think that would be more readable.
> >> Not really, adding the necessary cleanup steps in `if (ret)`
> >> blocks would roughly double the function's size.
> >>
> >>>
>  +mutex_unlock(&a6xx_gpu->gmu.lock);
>  +
>  +if (!ret)
>  +msm_devfreq_resume(gpu);
>  +
>  +return ret;
>  +}
>  +
>  +static int a6xx_gmu_pm_suspend(struct msm_gpu *gpu)
>   {
>   struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
>   struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
>  @@ -1720,7 +1799,40 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu)
>   return 0;
>   }
>   
>  -static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value)
>  +static int a6xx_pm_suspend(struct msm_gpu *gpu)
>  +{
>  +struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
>  +struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
>  +struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
>  +int i;
>  +
>  +trace_msm_gpu_suspend(0);
>  +
>  +msm_devfreq_suspend(gpu);
>  +
>  +mutex_lock(&a6xx_gpu->gmu.lock);
> >>>
> >>> Again, is this initialized somewhere?
> >>>
>  +
>  +/* Drain the outstanding traffic on memory buses */
>  +a6xx_bus_clear_pending_transactions(adreno_gpu, true);
>  +
>  +clk_bulk_disable_unprepare(gpu->nr_clocks, gpu->grp_clks);
>  +
>  +pm_runtime_put_sync(gmu->gxpd);
>  +dev_pm_opp_set_opp(&gpu->pdev->dev, NULL);
>  +pm_runtime_put_sync(gmu->dev);
>  +
>  +mutex_unlock(&a6xx_gpu->gmu.lock);
>  +
>  +if (a6xx_gpu->shadow_bo)
>  +for (i = 0; i < gpu->nr_rings; i++)
>  +a6xx_gpu->shadow[i] = 0;
>  +
>  +gpu->suspend_count++;
>  +
>  +return 0;
>  +}
>  +
>  +static int

Re: [Freedreno] [2/2] drm: Remove struct drm_driver.gem_prime_mmap

2023-06-17 Thread Sui Jingfeng

Hi,

On 2023/6/14 13:34, Thomas Zimmermann wrote:

Hi

Am 14.06.23 um 04:06 schrieb Sui Jingfeng:


On 2023/6/14 01:27, Sui Jingfeng wrote:

Wow, so many drivers get nuked!

On 2023/6/13 22:51, Thomas Zimmermann wrote:

All drivers initialize this field with drm_gem_prime_mmap(). Call
the function directly and remove the field. Simplifies the code and
resolves a long-standing TODO item.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Alex Deucher 



I have tested this patch briefly with drm/amdgpu(RX560), Running 
glmark2, the rendered scene looks OK.


But single driver is self-sharing.  I think I should test this more 
with multiple video card.



No need to test; it's equivalent to removing a wrapper.


Yes, only msm hardware might be affected.



But new DRM (un-upstreamed) drivers cannot be compiled anymore with 
this patch applied.


This makes them all out-of-date or going to be outdated; this is 
embarrassing!


What do you mean by embarrassing? Simply rebase your driver onto the 
change and that's it. This happens regularly for out-of-tree drivers. 
But if such a driver would land before this patchset, I'd have to 
update the patchset instead.



Thanks for you told me this then.

I worry about what it will happen if two conflict patch got merged together.

If my driver got merged, then one more driver will be nuked together. 
Saving a lot of effort.




Best regards
Thomas






---
  Documentation/gpu/todo.rst  |  9 -
  drivers/accel/ivpu/ivpu_drv.c   |  1 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  1 -
  drivers/gpu/drm/drm_fbdev_dma.c |  6 +-
  drivers/gpu/drm/drm_prime.c | 14 ++
  drivers/gpu/drm/etnaviv/etnaviv_drv.c   |  1 -
  drivers/gpu/drm/exynos/exynos_drm_drv.c |  1 -
  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c |  1 -
  drivers/gpu/drm/lima/lima_drv.c |  1 -
  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  1 -
  drivers/gpu/drm/msm/msm_drv.c   |  1 -
  drivers/gpu/drm/msm/msm_drv.h   |  1 -
  drivers/gpu/drm/msm/msm_gem_prime.c |  5 -
  drivers/gpu/drm/nouveau/nouveau_drm.c   |  1 -
  drivers/gpu/drm/panfrost/panfrost_drv.c |  1 -
  drivers/gpu/drm/pl111/pl111_drv.c   |  1 -
  drivers/gpu/drm/radeon/radeon_drv.c |  1 -
  drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c   |  1 -
  drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  1 -
  drivers/gpu/drm/v3d/v3d_drv.c   |  1 -
  drivers/gpu/drm/virtio/virtgpu_drv.c    |  1 -
  drivers/gpu/drm/xen/xen_drm_front.c |  1 -
  include/drm/drm_drv.h   | 14 --
  include/drm/drm_gem_dma_helper.h    |  6 ++
  include/drm/drm_gem_shmem_helper.h  |  1 -
  include/drm/drm_gem_vram_helper.h   |  1 -
  26 files changed, 5 insertions(+), 69 deletions(-)

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 68bdafa0284f5..ca1efad8c89c3 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -319,15 +319,6 @@ Contact: Daniel Vetter, Noralf Tronnes
    Level: Advanced
  -struct drm_gem_object_funcs

-
-GEM objects can now have a function table instead of having the 
callbacks on the
-DRM driver struct. This is now the preferred way. Callbacks in 
drivers have been

-converted, except for struct drm_driver.gem_prime_mmap.
-
-Level: Intermediate
-
  connector register/unregister fixes
  ---
  diff --git a/drivers/accel/ivpu/ivpu_drv.c 
b/drivers/accel/ivpu/ivpu_drv.c

index 2df7643b843d5..9f2b9fdcc5498 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -376,7 +376,6 @@ static const struct drm_driver driver = {
  .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
  .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
  .gem_prime_import = ivpu_gem_prime_import,
-    .gem_prime_mmap = drm_gem_prime_mmap,
    .ioctls = ivpu_drm_ioctls,
  .num_ioctls = ARRAY_SIZE(ivpu_drm_ioctls),
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

index c9a41c997c6c7..7681f79f462eb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2809,7 +2809,6 @@ static const struct drm_driver 
amdgpu_kms_driver = {

  .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
  .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
  .gem_prime_import = amdgpu_gem_prime_import,
-    .gem_prime_mmap = drm_gem_prime_mmap,
    .name = DRIVER_NAME,
  .desc = DRIVER_DESC,
diff --git a/drivers/gpu/drm/drm_fbdev_dma.c 
b/drivers/gpu/drm/drm_fbdev_dma.c

index d86773fa8ab00..8217f1ddc0075 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -54,12 +54,8 @@ static void drm_fbdev_

Re: [Freedreno] [PATCH] drm/msm/adreno: Update MODULE_FIRMWARE macros

2023-06-17 Thread Brian Masney
Hi Juerg,

On Fri, Jun 16, 2023 at 02:28:15PM +0200, Juerg Haefliger wrote:
> Add missing MODULE_FIRMWARE macros and remove some for firmwares that
> the driver no longer references.
> 
> Signed-off-by: Juerg Haefliger 
> ---
>  drivers/gpu/drm/msm/adreno/adreno_device.c | 23 ++
>  1 file changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c 
> b/drivers/gpu/drm/msm/adreno/adreno_device.c
> index 8cff86e9d35c..9f70d7c1a72a 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_device.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
> @@ -364,17 +364,32 @@ MODULE_FIRMWARE("qcom/a330_pm4.fw");
>  MODULE_FIRMWARE("qcom/a330_pfp.fw");
>  MODULE_FIRMWARE("qcom/a420_pm4.fw");
>  MODULE_FIRMWARE("qcom/a420_pfp.fw");
> +MODULE_FIRMWARE("qcom/a506_zap.mdt");
> +MODULE_FIRMWARE("qcom/a508_zap.mdt");
> +MODULE_FIRMWARE("qcom/a512_zap.mdt");
>  MODULE_FIRMWARE("qcom/a530_pm4.fw");
>  MODULE_FIRMWARE("qcom/a530_pfp.fw");
>  MODULE_FIRMWARE("qcom/a530v3_gpmu.fw2");
>  MODULE_FIRMWARE("qcom/a530_zap.mdt");
> -MODULE_FIRMWARE("qcom/a530_zap.b00");
> -MODULE_FIRMWARE("qcom/a530_zap.b01");
> -MODULE_FIRMWARE("qcom/a530_zap.b02");
> +MODULE_FIRMWARE("qcom/a540_gpmu.fw2");
> +MODULE_FIRMWARE("qcom/a540_zap.mdt");
> +MODULE_FIRMWARE("qcom/a615_zap.mdt");
>  MODULE_FIRMWARE("qcom/a619_gmu.bin");
>  MODULE_FIRMWARE("qcom/a630_sqe.fw");
>  MODULE_FIRMWARE("qcom/a630_gmu.bin");
> -MODULE_FIRMWARE("qcom/a630_zap.mbn");
> +MODULE_FIRMWARE("qcom/a630_zap.mdt");
> +MODULE_FIRMWARE("qcom/a640_gmu.bin");
> +MODULE_FIRMWARE("qcom/a640_zap.mdt");
> +MODULE_FIRMWARE("qcom/a650_gmu.bin");
> +MODULE_FIRMWARE("qcom/a650_sqe.fw");
> +MODULE_FIRMWARE("qcom/a650_zap.mdt");
> +MODULE_FIRMWARE("qcom/a660_gmu.bin");
> +MODULE_FIRMWARE("qcom/a660_sqe.fw");
> +MODULE_FIRMWARE("qcom/a660_zap.mdt");
> +MODULE_FIRMWARE("qcom/leia_pfp_470.fw");
> +MODULE_FIRMWARE("qcom/leia_pm4_470.fw");
> +MODULE_FIRMWARE("qcom/yamato_pfp.fw");
> +MODULE_FIRMWARE("qcom/yamato_pm4.fw");

You should rebase this on top of the latest -next since the a690 needs
to be added as well.

Brian



Re: [Freedreno] [2/2] drm: Remove struct drm_driver.gem_prime_mmap

2023-06-17 Thread Sui Jingfeng



On 2023/6/14 01:27, Sui Jingfeng wrote:

Wow, so many drivers get nuked!

On 2023/6/13 22:51, Thomas Zimmermann wrote:

All drivers initialize this field with drm_gem_prime_mmap(). Call
the function directly and remove the field. Simplifies the code and
resolves a long-standing TODO item.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Alex Deucher 



I have tested this patch briefly with drm/amdgpu(RX560), Running 
glmark2, the rendered scene looks OK.


But single driver is self-sharing.  I think I should test this more 
with multiple video card.



No need to test; it's equivalent to removing a wrapper.

But new DRM (un-upstreamed) drivers cannot be compiled anymore with this 
patch applied.


This makes them all out-of-date or going to be outdated; this is 
embarrassing!





---
  Documentation/gpu/todo.rst  |  9 -
  drivers/accel/ivpu/ivpu_drv.c   |  1 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  1 -
  drivers/gpu/drm/drm_fbdev_dma.c |  6 +-
  drivers/gpu/drm/drm_prime.c | 14 ++
  drivers/gpu/drm/etnaviv/etnaviv_drv.c   |  1 -
  drivers/gpu/drm/exynos/exynos_drm_drv.c |  1 -
  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c |  1 -
  drivers/gpu/drm/lima/lima_drv.c |  1 -
  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  1 -
  drivers/gpu/drm/msm/msm_drv.c   |  1 -
  drivers/gpu/drm/msm/msm_drv.h   |  1 -
  drivers/gpu/drm/msm/msm_gem_prime.c |  5 -
  drivers/gpu/drm/nouveau/nouveau_drm.c   |  1 -
  drivers/gpu/drm/panfrost/panfrost_drv.c |  1 -
  drivers/gpu/drm/pl111/pl111_drv.c   |  1 -
  drivers/gpu/drm/radeon/radeon_drv.c |  1 -
  drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c   |  1 -
  drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  1 -
  drivers/gpu/drm/v3d/v3d_drv.c   |  1 -
  drivers/gpu/drm/virtio/virtgpu_drv.c    |  1 -
  drivers/gpu/drm/xen/xen_drm_front.c |  1 -
  include/drm/drm_drv.h   | 14 --
  include/drm/drm_gem_dma_helper.h    |  6 ++
  include/drm/drm_gem_shmem_helper.h  |  1 -
  include/drm/drm_gem_vram_helper.h   |  1 -
  26 files changed, 5 insertions(+), 69 deletions(-)

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 68bdafa0284f5..ca1efad8c89c3 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -319,15 +319,6 @@ Contact: Daniel Vetter, Noralf Tronnes
    Level: Advanced
  -struct drm_gem_object_funcs

-
-GEM objects can now have a function table instead of having the 
callbacks on the
-DRM driver struct. This is now the preferred way. Callbacks in 
drivers have been

-converted, except for struct drm_driver.gem_prime_mmap.
-
-Level: Intermediate
-
  connector register/unregister fixes
  ---
  diff --git a/drivers/accel/ivpu/ivpu_drv.c 
b/drivers/accel/ivpu/ivpu_drv.c

index 2df7643b843d5..9f2b9fdcc5498 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -376,7 +376,6 @@ static const struct drm_driver driver = {
  .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
  .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
  .gem_prime_import = ivpu_gem_prime_import,
-    .gem_prime_mmap = drm_gem_prime_mmap,
    .ioctls = ivpu_drm_ioctls,
  .num_ioctls = ARRAY_SIZE(ivpu_drm_ioctls),
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

index c9a41c997c6c7..7681f79f462eb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2809,7 +2809,6 @@ static const struct drm_driver 
amdgpu_kms_driver = {

  .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
  .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
  .gem_prime_import = amdgpu_gem_prime_import,
-    .gem_prime_mmap = drm_gem_prime_mmap,
    .name = DRIVER_NAME,
  .desc = DRIVER_DESC,
diff --git a/drivers/gpu/drm/drm_fbdev_dma.c 
b/drivers/gpu/drm/drm_fbdev_dma.c

index d86773fa8ab00..8217f1ddc0075 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -54,12 +54,8 @@ static void drm_fbdev_dma_fb_destroy(struct 
fb_info *info)
  static int drm_fbdev_dma_fb_mmap(struct fb_info *info, struct 
vm_area_struct *vma)

  {
  struct drm_fb_helper *fb_helper = info->par;
-    struct drm_device *dev = fb_helper->dev;
-
-    if (drm_WARN_ON_ONCE(dev, !fb_helper->dev->driver->gem_prime_mmap))
-    return -ENODEV;
  -    return 
fb_helper->dev->driver->gem_prime_mmap(fb_helper->buffer->gem, vma);

+    return drm_gem_prime_mmap(fb_helper->buffer->gem, vma);
  }
    static const struct fb_ops drm_fbdev_dma_fb_ops = {
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index d29dafce9b

Re: [Freedreno] [2/2] drm: Remove struct drm_driver.gem_prime_mmap

2023-06-17 Thread Sui Jingfeng

Wow, so many drivers get nuked!

On 2023/6/13 22:51, Thomas Zimmermann wrote:

All drivers initialize this field with drm_gem_prime_mmap(). Call
the function directly and remove the field. Simplifies the code and
resolves a long-standing TODO item.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Alex Deucher 



I have tested this patch briefly with drm/amdgpu(RX560), Running 
glmark2, the rendered scene looks OK.


But single driver is self-sharing.  I think I should test this more with 
multiple video card.




---
  Documentation/gpu/todo.rst  |  9 -
  drivers/accel/ivpu/ivpu_drv.c   |  1 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  1 -
  drivers/gpu/drm/drm_fbdev_dma.c |  6 +-
  drivers/gpu/drm/drm_prime.c | 14 ++
  drivers/gpu/drm/etnaviv/etnaviv_drv.c   |  1 -
  drivers/gpu/drm/exynos/exynos_drm_drv.c |  1 -
  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c |  1 -
  drivers/gpu/drm/lima/lima_drv.c |  1 -
  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  1 -
  drivers/gpu/drm/msm/msm_drv.c   |  1 -
  drivers/gpu/drm/msm/msm_drv.h   |  1 -
  drivers/gpu/drm/msm/msm_gem_prime.c |  5 -
  drivers/gpu/drm/nouveau/nouveau_drm.c   |  1 -
  drivers/gpu/drm/panfrost/panfrost_drv.c |  1 -
  drivers/gpu/drm/pl111/pl111_drv.c   |  1 -
  drivers/gpu/drm/radeon/radeon_drv.c |  1 -
  drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c   |  1 -
  drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  1 -
  drivers/gpu/drm/v3d/v3d_drv.c   |  1 -
  drivers/gpu/drm/virtio/virtgpu_drv.c|  1 -
  drivers/gpu/drm/xen/xen_drm_front.c |  1 -
  include/drm/drm_drv.h   | 14 --
  include/drm/drm_gem_dma_helper.h|  6 ++
  include/drm/drm_gem_shmem_helper.h  |  1 -
  include/drm/drm_gem_vram_helper.h   |  1 -
  26 files changed, 5 insertions(+), 69 deletions(-)

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 68bdafa0284f5..ca1efad8c89c3 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -319,15 +319,6 @@ Contact: Daniel Vetter, Noralf Tronnes
  
  Level: Advanced
  
-struct drm_gem_object_funcs


-
-GEM objects can now have a function table instead of having the callbacks on 
the
-DRM driver struct. This is now the preferred way. Callbacks in drivers have 
been
-converted, except for struct drm_driver.gem_prime_mmap.
-
-Level: Intermediate
-
  connector register/unregister fixes
  ---
  
diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c

index 2df7643b843d5..9f2b9fdcc5498 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -376,7 +376,6 @@ static const struct drm_driver driver = {
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_import = ivpu_gem_prime_import,
-   .gem_prime_mmap = drm_gem_prime_mmap,
  
  	.ioctls = ivpu_drm_ioctls,

.num_ioctls = ARRAY_SIZE(ivpu_drm_ioctls),
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index c9a41c997c6c7..7681f79f462eb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2809,7 +2809,6 @@ static const struct drm_driver amdgpu_kms_driver = {
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_import = amdgpu_gem_prime_import,
-   .gem_prime_mmap = drm_gem_prime_mmap,
  
  	.name = DRIVER_NAME,

.desc = DRIVER_DESC,
diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
index d86773fa8ab00..8217f1ddc0075 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -54,12 +54,8 @@ static void drm_fbdev_dma_fb_destroy(struct fb_info *info)
  static int drm_fbdev_dma_fb_mmap(struct fb_info *info, struct vm_area_struct 
*vma)
  {
struct drm_fb_helper *fb_helper = info->par;
-   struct drm_device *dev = fb_helper->dev;
-
-   if (drm_WARN_ON_ONCE(dev, !fb_helper->dev->driver->gem_prime_mmap))
-   return -ENODEV;
  
-	return fb_helper->dev->driver->gem_prime_mmap(fb_helper->buffer->gem, vma);

+   return drm_gem_prime_mmap(fb_helper->buffer->gem, vma);
  }
  
  static const struct fb_ops drm_fbdev_dma_fb_ops = {

diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index d29dafce9bb0a..6bcf324ef81c9 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -715,8 +715,6 @@ EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
   * the same codepath that is used for regular GEM buffer mapping on the DRM 
fd.
   * The

Re: [Freedreno] [PATCH 2/2] drm/msm/dsi: don't allow enabling 7nm VCO with unprogrammed rate

2023-06-17 Thread Degdag Mohamed
[Dmitry Baryshkov],

Thank you for sharing the patches. I have reviewed and tested all
three patches, and they seem to be working correctly.

Tested-by: Degdag Mohamed degdagmoha...@gmail.com

Please let me know if you need any further information or assistance.

Best regards,
Degdag Mohamed

On 6/12/23, Dmitry Baryshkov  wrote:
> CCF can try enabling VCO before the rate has been programmed. This can
> cause clock lockups and/or other boot issues. Program the VCO to the
> minimal PLL rate if the read rate is 0 Hz.
>
> Reported-by: Degdag Mohamed 
> Fixes: 1ef7c99d145c ("drm/msm/dsi: add support for 7nm DSI PHY/PLL")
> Signed-off-by: Dmitry Baryshkov 
> ---
>  drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> index 3b1ed02f644d..6979d35eb7c3 100644
> --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> @@ -395,11 +395,16 @@ static void dsi_pll_phy_dig_reset(struct dsi_pll_7nm
> *pll)
>   wmb(); /* Ensure that the reset is deasserted */
>  }
>
> +static unsigned long dsi_pll_7nm_vco_recalc_rate(struct clk_hw *hw,
> +   unsigned long parent_rate);
>  static int dsi_pll_7nm_vco_prepare(struct clk_hw *hw)
>  {
>   struct dsi_pll_7nm *pll_7nm = to_pll_7nm(hw);
>   int rc;
>
> + if (dsi_pll_7nm_vco_recalc_rate(hw, VCO_REF_CLK_RATE) == 0)
> + dsi_pll_7nm_vco_set_rate(hw, pll_7nm->phy->cfg->min_pll_rate,
> VCO_REF_CLK_RATE);
> +
>   dsi_pll_enable_pll_bias(pll_7nm);
>   if (pll_7nm->slave)
>   dsi_pll_enable_pll_bias(pll_7nm->slave);
> --
> 2.39.2
>
>