linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mark.yao@rock-chips.com (Mark yao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 4/7] drm/rockchip: vop: group vop registers
Date: Fri, 28 Jul 2017 09:02:48 +0800	[thread overview]
Message-ID: <597A8D38.3040905@rock-chips.com> (raw)
In-Reply-To: <10499935.q3BgzX4LKL@diego>

Hi Heiko

Thanks for the test.

On 2017?07?27? 18:10, Heiko St?bner wrote:
> Am Donnerstag, 27. Juli 2017, 11:51:06 CEST schrieb Heiko St?bner:
>> Hi Mark,
>>
>> Am Mittwoch, 26. Juli 2017, 14:19:25 CEST schrieb Mark Yao:
>>> Grouping the vop registers facilitates make register
>>> definition clearer, and also is useful for different vop
>>> reuse the same group register.
>>>
>>> Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
>>> ---
>>>
>>>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  99
>>>   ++++++++++++------------
>>>   drivers/gpu/drm/rockchip/rockchip_drm_vop.h |  60 ++++++++-------
>>>   drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 112
>>>
>>> +++++++++++++++------------- 3 files changed, 144 insertions(+), 127
>>> deletions(-)
>> This breaks display support on both rk3036 and rk3288 and I end up
>> with a null pointer dereference in
>>
>> [   10.640297] Unable to handle kernel NULL pointer dereference at virtual
>> address 00000000 [   10.654430] pgd = c0204000
>> [   10.657452] [00000000] *pgd=00000000
>> [   10.661473] Internal error: Oops: 5 [#1] SMP ARM
>> [   10.666635] Modules linked in: snd_pcm media snd_timer phy_rockchip_dp
>> snd soundcore rockchipdrm dw_hdmi analogix_dp rtc_rk808 pwm_rockchip
>> clk_rk808 spi_rockchip [   10.682897] CPU: 2 PID: 143 Comm: kworker/2:2 Not
>> tainted 4.13.0-rc2-01791-g2b86603d0515 #355 [   10.692430] Hardware name:
>> Rockchip (Device Tree)
>> [   10.697692] Workqueue: events deferred_probe_work_func
>> [   10.702152] Linux video capture interface: v2.00
>> [   10.708590] task: ee38c800 task.stack: ed2e6000
>> [   10.713656] PC is at vop_reg_set.constprop.4+0x4/0xa8 [rockchipdrm]
>> [   10.720668] LR is at vop_bind+0x568/0x8a0 [rockchipdrm]
> The obvious reason for that is
>
>> @@ -164,14 +153,20 @@ static inline uint32_t vop_read_reg(struct vop *vop,
>> uint32_t base, return (vop_readl(vop, base + reg->offset) >> reg->shift) &
>> reg->mask; }
>>
>> -static inline void vop_mask_write(struct vop *vop, uint32_t offset,
>> -				  uint32_t mask, uint32_t shift, uint32_t v,
>> -				  bool write_mask, bool relaxed)
>> +static void vop_reg_set(struct vop *vop, const struct vop_reg *reg,
>> +			uint32_t _offset, uint32_t _mask, uint32_t v,
>> +			const char *reg_name)
>>   {
>> -	if (!mask)
>> +	int offset = reg->offset + _offset;
>> +	int mask = reg->mask & _mask;
>> +	int shift = reg->shift;

Does the crash is that using reg->offset/mask/shift before !reg checking?

>> +
>> +	if (!reg || !reg->mask) {
>> +		dev_dbg(vop->dev, "Warning: not support %s\n", reg_name);
>>   		return;
>> +	}
> where the check for !reg happens after it got already dereferenced.
> But even with that fixed I end up with
>
> on rk3288:
> [    7.254823] rockchip-vop ff930000.vop: Warning: not support global_regdone_en
> [    7.262847] rockchip-vop ff930000.vop: Warning: not support gate
> [    7.269580] rockchip-vop ff930000.vop: Warning: not support gate
> [    7.302765] rockchip-vop ff940000.vop: Warning: not support global_regdone_en
> [    7.310758] rockchip-vop ff940000.vop: Warning: not support gate
> [    7.317475] rockchip-vop ff940000.vop: Warning: not support gate
> [    7.425724] rockchip-vop ff930000.vop: Warning: not support edp_pin_pol
> [    7.526298] rockchip-vop ff940000.vop: Warning: not support hdmi_pin_pol

Rk3288 does not support independent pin_pol settings, all output interfaces share the pin_pol register,
So not support hdmi_pin_pol here is correct.

hdmi pin pol would be set by following register:
     .pin_pol = VOP_REG(RK3288_DSP_CTRL0, 0xf, 4),

>
> on rk3036:
> [   12.389138] rockchip-vop 10118000.vop: Warning: not support global_regdone_en
> [   12.397324] rockchip-vop 10118000.vop: Warning: not support gate
> [   12.404165] rockchip-vop 10118000.vop: Warning: not support gate
> [   13.747361] rockchip-vop 10118000.vop: Warning: not support hdmi_pin_pol
> [   13.747371] rockchip-vop 10118000.vop: Warning: not support hdmi_en
> [   13.747379] rockchip-vop 10118000.vop: Warning: not support hpost_st_end
> [   13.747385] rockchip-vop 10118000.vop: Warning: not support vpost_st_end
> [   13.747461] rockchip-vop 10118000.vop: Warning: not support src_alpha_ctl
> [   13.767098] rockchip-vop 10118000.vop: Warning: not support src_alpha_ctl
> [   13.786060] rockchip-vop 10118000.vop: Warning: not support src_alpha_ctl
>
> While reqdone and friends are obviously features of newer vops, at least
> the hdmi pin-pol is available on both these socs.
>
> With this patch applied (and null-ptr fixed) I end up without hdmi output
> on both socs.

Hmmm, I am confused, from code review, I didn't see what will cause hdmi not work on rk3036 and rk3288,

Give me some time, I try to bringup my popmetal rk3288 board to do the test.

Heiko, Thanks very much for your test.

>
>
> Heiko
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>
>
>


-- 
?ark Yao

  reply	other threads:[~2017-07-28  1:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26  6:18 [PATCH v6 0/7] drm/rockchip: add all full framework vop support Mark Yao
2017-07-26  6:19 ` [PATCH v6 1/7] drm/rockchip: vop: initialize registers directly Mark Yao
2017-07-26 22:44   ` Heiko Stuebner
2017-07-27  8:31   ` [v6,1/7] " jeffy
2017-07-26  6:19 ` [PATCH v6 2/7] drm/rockchip: vop: move write_relaxed flags to vop register Mark Yao
2017-07-26 22:46   ` Heiko Stuebner
2017-07-27  8:43   ` [v6, " jeffy
2017-07-26  6:19 ` [PATCH v6 3/7] drm/rockchip: vop: move line_flag_num to interrupt registers Mark Yao
2017-07-26 22:50   ` Heiko Stuebner
2017-07-26  6:19 ` [PATCH v6 4/7] drm/rockchip: vop: group vop registers Mark Yao
2017-07-27  8:49   ` [v6,4/7] " jeffy
2017-07-27  9:51   ` [PATCH v6 4/7] " Heiko Stübner
2017-07-27 10:10     ` Heiko Stübner
2017-07-28  1:02       ` Mark yao [this message]
2017-07-28  2:45         ` Mark yao
2017-07-28  6:06   ` [PATCH v6.1 " Mark Yao
2017-07-28  9:21     ` Heiko Stuebner
2017-07-26  6:19 ` [PATCH v6 5/7] drm/rockchip: vop: add a series of vop support Mark Yao
2017-07-27  8:59   ` [v6,5/7] " jeffy
2017-07-28 12:48   ` [PATCH v6 5/7] " Heiko Stuebner
2017-07-26  6:19 ` [PATCH v6 6/7] dt-bindings: display: rockchip: fill Documents for vop series Mark Yao
2017-07-28  9:25   ` Heiko Stuebner
2017-07-26  6:19 ` [PATCH v6 7/7] drm/rockchip: vop: rk3328: fix overlay abnormal Mark Yao
2017-07-27  8:42   ` [v6,7/7] " jeffy
2017-07-28 13:06   ` [PATCH v6 7/7] " Heiko Stuebner
2017-07-31  1:02 ` [PATCH v6 0/7] drm/rockchip: add all full framework vop support Mark yao

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=597A8D38.3040905@rock-chips.com \
    --to=mark.yao@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).