[RFT,00/20] Venus cleanups

Message ID 20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org (mailing list archive)
Headers
Series Venus cleanups |

Message

Konrad Dybcio Sept. 11, 2023, 3:10 p.m. UTC
  With the driver supporting multiple generations of hardware, some mold
has definitely grown over the code..

This series attempts to amend this situation a bit by commonizing some
code paths and fixing some bugs while at it.

Only tested on SM8250.

Definitely needs testing on:

- SDM845 with old bindings
- SDM845 with new bindings or 7180
- MSM8916
- MSM8996

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
Konrad Dybcio (20):
      media: venus: pm_helpers: Only set rate of the core clock in core_clks_enable
      media: venus: pm_helpers: Rename core_clks_get to venus_clks_get
      media: venus: pm_helpers: Add kerneldoc to venus_clks_get()
      media: venus: core: Set OPP clkname in a common code path
      media: venus: pm_helpers: Kill dead code
      media: venus: pm_helpers: Move reset acquisition to common code
      media: venus: pm_helpers: Use reset_bulk API
      media: venus: core: Constify all members of the resource struct
      media: venus: core: Deduplicate OPP genpd names
      media: venus: core: Get rid of vcodec_num
      media: venus: core: Drop cache properties in resource struct
      media: venus: core: Use GENMASK for dma_mask
      media: venus: core: Remove cp_start
      media: venus: pm_helpers: Commonize core_power
      media: venus: pm_helpers: Remove pm_ops->core_put
      media: venus: core: Define a pointer to core->res
      media: venus: pm_helpers: Simplify vcodec clock handling
      media: venus: pm_helpers: Commonize getting clocks and GenPDs
      media: venus: pm_helpers: Commonize vdec_get()
      media: venus: pm_helpers: Commonize venc_get()

 drivers/media/platform/qcom/venus/core.c       | 138 ++++-------
 drivers/media/platform/qcom/venus/core.h       |  64 +++--
 drivers/media/platform/qcom/venus/firmware.c   |   3 +-
 drivers/media/platform/qcom/venus/hfi_venus.c  |   7 +-
 drivers/media/platform/qcom/venus/pm_helpers.c | 328 +++++++++----------------
 drivers/media/platform/qcom/venus/pm_helpers.h |  10 +-
 drivers/media/platform/qcom/venus/vdec.c       |   9 +-
 drivers/media/platform/qcom/venus/venc.c       |   9 +-
 8 files changed, 213 insertions(+), 355 deletions(-)
---
base-commit: 7bc675554773f09d88101bf1ccfc8537dc7c0be9
change-id: 20230911-topic-mars-e60bb2269411

Best regards,
  

Comments

Bryan O'Donoghue Sept. 12, 2023, 6:19 a.m. UTC | #1
On 11/09/2023 16:10, Konrad Dybcio wrote:
> With the driver supporting multiple generations of hardware, some mold
> has definitely grown over the code..
> 
> This series attempts to amend this situation a bit by commonizing some
> code paths and fixing some bugs while at it.
> 
> Only tested on SM8250.
> 
> Definitely needs testing on:
> 
> - SDM845 with old bindings
> - SDM845 with new bindings or 7180
> - MSM8916
> - MSM8996
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Don't we have both a db410c and db845c in Bjorn's lab you could test 
this on ?

---
bod
  
Konrad Dybcio Sept. 13, 2023, 12:03 p.m. UTC | #2
On 12.09.2023 08:19, Bryan O'Donoghue wrote:
> On 11/09/2023 16:10, Konrad Dybcio wrote:
>> With the driver supporting multiple generations of hardware, some mold
>> has definitely grown over the code..
>>
>> This series attempts to amend this situation a bit by commonizing some
>> code paths and fixing some bugs while at it.
>>
>> Only tested on SM8250.
>>
>> Definitely needs testing on:
>>
>> - SDM845 with old bindings
>> - SDM845 with new bindings or 7180
>> - MSM8916
>> - MSM8996
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> 
> Don't we have both a db410c and db845c in Bjorn's lab you could test this on ?
None that work

Konrad
  
Bryan O'Donoghue Sept. 13, 2023, 12:26 p.m. UTC | #3
On 13/09/2023 13:03, Konrad Dybcio wrote:
> On 12.09.2023 08:19, Bryan O'Donoghue wrote:
>> On 11/09/2023 16:10, Konrad Dybcio wrote:
>>> With the driver supporting multiple generations of hardware, some mold
>>> has definitely grown over the code..
>>>
>>> This series attempts to amend this situation a bit by commonizing some
>>> code paths and fixing some bugs while at it.
>>>
>>> Only tested on SM8250.
>>>
>>> Definitely needs testing on:
>>>
>>> - SDM845 with old bindings
>>> - SDM845 with new bindings or 7180
>>> - MSM8916
>>> - MSM8996
>>>
>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>>
>> Don't we have both a db410c and db845c in Bjorn's lab you could test this on ?
> None that work
> 
> Konrad

If you agree to bring more Polish candy to Ams, I will test this series 
for you.

Fair exchange.

---
bod
  
Bryan O'Donoghue Sept. 15, 2023, 2:13 p.m. UTC | #4
On 11/09/2023 16:10, Konrad Dybcio wrote:
> With the driver supporting multiple generations of hardware, some mold
> has definitely grown over the code..
> 
> This series attempts to amend this situation a bit by commonizing some
> code paths and fixing some bugs while at it.
> 
> Only tested on SM8250.
> 
> Definitely needs testing on:
> 
> - SDM845 with old bindings
> - SDM845 with new bindings or 7180
> - MSM8916
> - MSM8996
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
> Konrad Dybcio (20):
>        media: venus: pm_helpers: Only set rate of the core clock in core_clks_enable
>        media: venus: pm_helpers: Rename core_clks_get to venus_clks_get
>        media: venus: pm_helpers: Add kerneldoc to venus_clks_get()
>        media: venus: core: Set OPP clkname in a common code path
>        media: venus: pm_helpers: Kill dead code
>        media: venus: pm_helpers: Move reset acquisition to common code
>        media: venus: pm_helpers: Use reset_bulk API
>        media: venus: core: Constify all members of the resource struct
>        media: venus: core: Deduplicate OPP genpd names
>        media: venus: core: Get rid of vcodec_num
>        media: venus: core: Drop cache properties in resource struct
>        media: venus: core: Use GENMASK for dma_mask
>        media: venus: core: Remove cp_start
>        media: venus: pm_helpers: Commonize core_power
>        media: venus: pm_helpers: Remove pm_ops->core_put
>        media: venus: core: Define a pointer to core->res
>        media: venus: pm_helpers: Simplify vcodec clock handling
>        media: venus: pm_helpers: Commonize getting clocks and GenPDs
>        media: venus: pm_helpers: Commonize vdec_get()
>        media: venus: pm_helpers: Commonize venc_get()
> 
>   drivers/media/platform/qcom/venus/core.c       | 138 ++++-------
>   drivers/media/platform/qcom/venus/core.h       |  64 +++--
>   drivers/media/platform/qcom/venus/firmware.c   |   3 +-
>   drivers/media/platform/qcom/venus/hfi_venus.c  |   7 +-
>   drivers/media/platform/qcom/venus/pm_helpers.c | 328 +++++++++----------------
>   drivers/media/platform/qcom/venus/pm_helpers.h |  10 +-
>   drivers/media/platform/qcom/venus/vdec.c       |   9 +-
>   drivers/media/platform/qcom/venus/venc.c       |   9 +-
>   8 files changed, 213 insertions(+), 355 deletions(-)
> ---
> base-commit: 7bc675554773f09d88101bf1ccfc8537dc7c0be9
> change-id: 20230911-topic-mars-e60bb2269411
> 
> Best regards,

b4 shazam 20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org
Grabbing thread from 
lore.kernel.org/all/20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org/t.mbox.gz
Checking for newer revisions
Grabbing search results from lore.kernel.org
Analyzing 27 messages in the thread
Checking attestation on all messages, may take a moment...
---
   [PATCH 1/20] media: venus: pm_helpers: Only set rate of the core 
clock in core_clks_enable
   [PATCH 2/20] media: venus: pm_helpers: Rename core_clks_get to 
venus_clks_get
   [PATCH 3/20] media: venus: pm_helpers: Add kerneldoc to venus_clks_get()
   [PATCH 4/20] media: venus: core: Set OPP clkname in a common code path
   [PATCH 5/20] media: venus: pm_helpers: Kill dead code
   [PATCH 6/20] media: venus: pm_helpers: Move reset acquisition to 
common code
   [PATCH 7/20] media: venus: pm_helpers: Use reset_bulk API
   [PATCH 8/20] media: venus: core: Constify all members of the resource 
struct
   [PATCH 9/20] media: venus: core: Deduplicate OPP genpd names
   [PATCH 10/20] media: venus: core: Get rid of vcodec_num
   [PATCH 11/20] media: venus: core: Drop cache properties in resource 
struct
   [PATCH 12/20] media: venus: core: Use GENMASK for dma_mask
   [PATCH 13/20] media: venus: core: Remove cp_start
   [PATCH 14/20] media: venus: pm_helpers: Commonize core_power
   [PATCH 15/20] media: venus: pm_helpers: Remove pm_ops->core_put
   [PATCH 16/20] media: venus: core: Define a pointer to core->res
   [PATCH 17/20] media: venus: pm_helpers: Simplify vcodec clock handling
   [PATCH 18/20] media: venus: pm_helpers: Commonize getting clocks and 
GenPDs
   [PATCH 19/20] media: venus: pm_helpers: Commonize vdec_get()
   [PATCH 20/20] media: venus: pm_helpers: Commonize venc_get()
   ---
   ✗ No key: ed25519/konrad.dybcio@linaro.org
   ---
   NOTE: install dkimpy for DKIM signature verification
---
Total patches: 20
---
  Base: base-commit 7bc675554773f09d88101bf1ccfc8537dc7c0be9 not known, 
ignoring
Applying: media: venus: pm_helpers: Only set rate of the core clock in 
core_clks_enable
Applying: media: venus: pm_helpers: Rename core_clks_get to venus_clks_get
Applying: media: venus: pm_helpers: Add kerneldoc to venus_clks_get()
Applying: media: venus: core: Set OPP clkname in a common code path
Applying: media: venus: pm_helpers: Kill dead code
Applying: media: venus: pm_helpers: Move reset acquisition to common code
Applying: media: venus: pm_helpers: Use reset_bulk API
Applying: media: venus: core: Constify all members of the resource struct
Applying: media: venus: core: Deduplicate OPP genpd names
Applying: media: venus: core: Get rid of vcodec_num
Applying: media: venus: core: Drop cache properties in resource struct
Applying: media: venus: core: Use GENMASK for dma_mask
Applying: media: venus: core: Remove cp_start
Applying: media: venus: pm_helpers: Commonize core_power
Applying: media: venus: pm_helpers: Remove pm_ops->core_put
Applying: media: venus: core: Define a pointer to core->res
Applying: media: venus: pm_helpers: Simplify vcodec clock handling
Applying: media: venus: pm_helpers: Commonize getting clocks and GenPDs
Applying: media: venus: pm_helpers: Commonize vdec_get()
Applying: media: venus: pm_helpers: Commonize venc_get()

   MODPOST Module.symvers
^[[BERROR: modpost: "vcodec_clks_get" 
[drivers/media/platform/qcom/venus/venus-dec.ko] undefined!
ERROR: modpost: "vcodec_clks_get" 
[drivers/media/platform/qcom/venus/venus-enc.ko] undefined!
make[3]: *** 
[/home/deckard/Development/qualcomm/qlt-kernel/scripts/Makefile.modpost:145: 
Module.symvers] Error 1
make[2]: *** 
[/home/deckard/Development/qualcomm/qlt-kernel/Makefile:1865: modpost] 
Error 2
make[1]: *** 
[/home/deckard/Development/qualcomm/qlt-kernel/Makefile:234: __sub-make] 
Error 2

---
bod
  
Konrad Dybcio Sept. 15, 2023, 2:15 p.m. UTC | #5
On 15.09.2023 16:13, Bryan O'Donoghue wrote:
> On 11/09/2023 16:10, Konrad Dybcio wrote:
>> With the driver supporting multiple generations of hardware, some mold
>> has definitely grown over the code..
>>
>> This series attempts to amend this situation a bit by commonizing some
>> code paths and fixing some bugs while at it.
>>
>> Only tested on SM8250.
>>
>> Definitely needs testing on:
>>
>> - SDM845 with old bindings
>> - SDM845 with new bindings or 7180
>> - MSM8916
>> - MSM8996
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>> ---
>> Konrad Dybcio (20):
>>        media: venus: pm_helpers: Only set rate of the core clock in core_clks_enable
>>        media: venus: pm_helpers: Rename core_clks_get to venus_clks_get
>>        media: venus: pm_helpers: Add kerneldoc to venus_clks_get()
>>        media: venus: core: Set OPP clkname in a common code path
>>        media: venus: pm_helpers: Kill dead code
>>        media: venus: pm_helpers: Move reset acquisition to common code
>>        media: venus: pm_helpers: Use reset_bulk API
>>        media: venus: core: Constify all members of the resource struct
>>        media: venus: core: Deduplicate OPP genpd names
>>        media: venus: core: Get rid of vcodec_num
>>        media: venus: core: Drop cache properties in resource struct
>>        media: venus: core: Use GENMASK for dma_mask
>>        media: venus: core: Remove cp_start
>>        media: venus: pm_helpers: Commonize core_power
>>        media: venus: pm_helpers: Remove pm_ops->core_put
>>        media: venus: core: Define a pointer to core->res
>>        media: venus: pm_helpers: Simplify vcodec clock handling
>>        media: venus: pm_helpers: Commonize getting clocks and GenPDs
>>        media: venus: pm_helpers: Commonize vdec_get()
>>        media: venus: pm_helpers: Commonize venc_get()
>>
>>   drivers/media/platform/qcom/venus/core.c       | 138 ++++-------
>>   drivers/media/platform/qcom/venus/core.h       |  64 +++--
>>   drivers/media/platform/qcom/venus/firmware.c   |   3 +-
>>   drivers/media/platform/qcom/venus/hfi_venus.c  |   7 +-
>>   drivers/media/platform/qcom/venus/pm_helpers.c | 328 +++++++++----------------
>>   drivers/media/platform/qcom/venus/pm_helpers.h |  10 +-
>>   drivers/media/platform/qcom/venus/vdec.c       |   9 +-
>>   drivers/media/platform/qcom/venus/venc.c       |   9 +-
>>   8 files changed, 213 insertions(+), 355 deletions(-)
>> ---
>> base-commit: 7bc675554773f09d88101bf1ccfc8537dc7c0be9
>> change-id: 20230911-topic-mars-e60bb2269411
>>
>> Best regards,
> 
> b4 shazam 20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org
> Grabbing thread from lore.kernel.org/all/20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org/t.mbox.gz
> Checking for newer revisions
> Grabbing search results from lore.kernel.org
> Analyzing 27 messages in the thread
> Checking attestation on all messages, may take a moment...
> ---
>   [PATCH 1/20] media: venus: pm_helpers: Only set rate of the core clock in core_clks_enable
>   [PATCH 2/20] media: venus: pm_helpers: Rename core_clks_get to venus_clks_get
>   [PATCH 3/20] media: venus: pm_helpers: Add kerneldoc to venus_clks_get()
>   [PATCH 4/20] media: venus: core: Set OPP clkname in a common code path
>   [PATCH 5/20] media: venus: pm_helpers: Kill dead code
>   [PATCH 6/20] media: venus: pm_helpers: Move reset acquisition to common code
>   [PATCH 7/20] media: venus: pm_helpers: Use reset_bulk API
>   [PATCH 8/20] media: venus: core: Constify all members of the resource struct
>   [PATCH 9/20] media: venus: core: Deduplicate OPP genpd names
>   [PATCH 10/20] media: venus: core: Get rid of vcodec_num
>   [PATCH 11/20] media: venus: core: Drop cache properties in resource struct
>   [PATCH 12/20] media: venus: core: Use GENMASK for dma_mask
>   [PATCH 13/20] media: venus: core: Remove cp_start
>   [PATCH 14/20] media: venus: pm_helpers: Commonize core_power
>   [PATCH 15/20] media: venus: pm_helpers: Remove pm_ops->core_put
>   [PATCH 16/20] media: venus: core: Define a pointer to core->res
>   [PATCH 17/20] media: venus: pm_helpers: Simplify vcodec clock handling
>   [PATCH 18/20] media: venus: pm_helpers: Commonize getting clocks and GenPDs
>   [PATCH 19/20] media: venus: pm_helpers: Commonize vdec_get()
>   [PATCH 20/20] media: venus: pm_helpers: Commonize venc_get()
>   ---
>   ✗ No key: ed25519/konrad.dybcio@linaro.org
>   ---
>   NOTE: install dkimpy for DKIM signature verification
> ---
> Total patches: 20
> ---
>  Base: base-commit 7bc675554773f09d88101bf1ccfc8537dc7c0be9 not known, ignoring
> Applying: media: venus: pm_helpers: Only set rate of the core clock in core_clks_enable
> Applying: media: venus: pm_helpers: Rename core_clks_get to venus_clks_get
> Applying: media: venus: pm_helpers: Add kerneldoc to venus_clks_get()
> Applying: media: venus: core: Set OPP clkname in a common code path
> Applying: media: venus: pm_helpers: Kill dead code
> Applying: media: venus: pm_helpers: Move reset acquisition to common code
> Applying: media: venus: pm_helpers: Use reset_bulk API
> Applying: media: venus: core: Constify all members of the resource struct
> Applying: media: venus: core: Deduplicate OPP genpd names
> Applying: media: venus: core: Get rid of vcodec_num
> Applying: media: venus: core: Drop cache properties in resource struct
> Applying: media: venus: core: Use GENMASK for dma_mask
> Applying: media: venus: core: Remove cp_start
> Applying: media: venus: pm_helpers: Commonize core_power
> Applying: media: venus: pm_helpers: Remove pm_ops->core_put
> Applying: media: venus: core: Define a pointer to core->res
> Applying: media: venus: pm_helpers: Simplify vcodec clock handling
> Applying: media: venus: pm_helpers: Commonize getting clocks and GenPDs
> Applying: media: venus: pm_helpers: Commonize vdec_get()
> Applying: media: venus: pm_helpers: Commonize venc_get()
> 
>   MODPOST Module.symvers
> ^[[BERROR: modpost: "vcodec_clks_get" [drivers/media/platform/qcom/venus/venus-dec.ko] undefined!
> ERROR: modpost: "vcodec_clks_get" [drivers/media/platform/qcom/venus/venus-enc.ko] undefined!
> make[3]: *** [/home/deckard/Development/qualcomm/qlt-kernel/scripts/Makefile.modpost:145: Module.symvers] Error 1
> make[2]: *** [/home/deckard/Development/qualcomm/qlt-kernel/Makefile:1865: modpost] Error 2
> make[1]: *** [/home/deckard/Development/qualcomm/qlt-kernel/Makefile:234: __sub-make] Error 2
Yeah I noticed after sending..

I have some fixups locally, see output of `b4 prep --compare-to v1`:

 1:  ef4effbdd61b =  1:  07193da8f8b2 media: venus: pm_helpers: Only set rate of the core clock in core_clks_enable
 2:  46a6466fff36 =  2:  c8598ffa711a media: venus: pm_helpers: Rename core_clks_get to venus_clks_get
 3:  733411cd167d =  3:  bcc0385fe8a3 media: venus: pm_helpers: Add kerneldoc to venus_clks_get()
 4:  42f089b8ee90 =  4:  181a2a4f7a4b media: venus: core: Set OPP clkname in a common code path
 5:  e0cd37c576cf =  5:  182ba8feb561 media: venus: pm_helpers: Kill dead code
 6:  232c32d813b8 =  6:  06fd32b2f112 media: venus: pm_helpers: Move reset acquisition to common code
 7:  0ab76762c149 =  7:  f0aaaca1fe70 media: venus: pm_helpers: Use reset_bulk API
 8:  e47564b87e77 =  8:  2ddb02b05d0f media: venus: core: Constify all members of the resource struct
 9:  c5e157de604e =  9:  918f3dc5f2f6 media: venus: core: Deduplicate OPP genpd names
10:  3500b515c0cb = 10:  ee194c584ce0 media: venus: core: Get rid of vcodec_num
11:  b179e47b6db6 ! 11:  81fa7517b057 media: venus: core: Drop cache properties in resource struct
    @@ drivers/media/platform/qcom/venus/core.h: struct venus_resources {
        const u32 cp_nonpixel_start;
     
      ## drivers/media/platform/qcom/venus/hfi_venus.c ##
    +@@ drivers/media/platform/qcom/venus/hfi_venus.c: static void venus_process_msg_sys_error(struct venus_hfi_device *hdev,
    + static irqreturn_t venus_isr_thread(struct venus_core *core)
    + {
    +   struct venus_hfi_device *hdev = to_hfi_priv(core);
    +-  const struct venus_resources *res;
    +   void *pkt;
    +   u32 msg_ret;
    + 
    +   if (!hdev)
    +           return IRQ_NONE;
    + 
    +-  res = hdev->core->res;
    +   pkt = hdev->pkt_buf;
    + 
    +-
    +   while (!venus_iface_msgq_read(hdev, pkt)) {
    +           msg_ret = hfi_process_msg_packet(core, pkt);
    +           switch (msg_ret) {
     @@ drivers/media/platform/qcom/venus/hfi_venus.c: static irqreturn_t venus_isr_thread(struct venus_core *core)
                        venus_process_msg_sys_error(hdev, pkt);
                        break;
12:  aa122db08d64 = 12:  8cf3d701f0b4 media: venus: core: Use GENMASK for dma_mask
13:  548235220fcd = 13:  3aa4f40a1818 media: venus: core: Remove cp_start
14:  9fd8a8515795 = 14:  7f65994f7c7c media: venus: pm_helpers: Commonize core_power
15:  09c778667817 = 15:  45c51bcaeb17 media: venus: pm_helpers: Remove pm_ops->core_put
16:  955470ceffa0 = 16:  63aba2146a15 media: venus: core: Define a pointer to core->res
17:  3a6fbeac1f5c = 17:  bafeb6dc5525 media: venus: pm_helpers: Simplify vcodec clock handling
18:  ee1234ce5c19 = 18:  e4500b65ff24 media: venus: pm_helpers: Commonize getting clocks and GenPDs
19:  155ca91c4ece ! 19:  8d86b33d0614 media: venus: pm_helpers: Commonize vdec_get()
    @@ drivers/media/platform/qcom/venus/pm_helpers.c: static int core_clks_set_rate(st
      {
        char buf[13] = { 0 }; /* vcodecX_core\0 */
      
    +@@ drivers/media/platform/qcom/venus/pm_helpers.c: static int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id)
    + 
    +   return 0;
    + }
    ++EXPORT_SYMBOL_GPL(vcodec_clks_get);
    + 
    + static int vcodec_clks_enable(struct venus_core *core, u8 id)
    + {
     @@ drivers/media/platform/qcom/venus/pm_helpers.c: vcodec_control_v3(struct venus_core *core, u32 session_type, bool enable)
                writel(1, ctrl);
      }


Konrad