* [PATCH] drm: rcar-du: Make sure DRM planes are created by VSP1
@ 2017-03-03 8:09 Jacopo Mondi
2017-03-03 11:26 ` Laurent Pinchart
0 siblings, 1 reply; 6+ messages in thread
From: Jacopo Mondi @ 2017-03-03 8:09 UTC (permalink / raw)
To: laurent.pinchart; +Cc: dri-devel, linux-renesas-soc
On Gen3 platforms compositing planes are allocated by VSP on behalf of
DRM/KMS.
If VSP support is not compiled in, vsp1 initialization stub routine is
called, leading to invalid memory accesses later on when un-initialized
planes are accessed.
Fail explicitly earlier if planes are not properly created.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/gpu/drm/rcar-du/rcar_du_kms.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index b5d3f16..7f56c09 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -616,6 +616,9 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
ret = rcar_du_vsp_init(vsp);
if (ret < 0)
return ret;
+
+ if (!vsp->planes)
+ return -EINVAL;
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: rcar-du: Make sure DRM planes are created by VSP1
2017-03-03 8:09 [PATCH] drm: rcar-du: Make sure DRM planes are created by VSP1 Jacopo Mondi
@ 2017-03-03 11:26 ` Laurent Pinchart
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2017-03-03 11:26 UTC (permalink / raw)
To: Jacopo Mondi; +Cc: dri-devel, linux-renesas-soc
Hi Jacopo,
Thank you for the patch.
On Friday 03 Mar 2017 09:09:38 Jacopo Mondi wrote:
> On Gen3 platforms compositing planes are allocated by VSP on behalf of
> DRM/KMS.
> If VSP support is not compiled in, vsp1 initialization stub routine is
> called, leading to invalid memory accesses later on when un-initialized
> planes are accessed.
>
> Fail explicitly earlier if planes are not properly created.
>
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
> drivers/gpu/drm/rcar-du/rcar_du_kms.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index b5d3f16..7f56c09 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -616,6 +616,9 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
> ret = rcar_du_vsp_init(vsp);
> if (ret < 0)
> return ret;
> +
> + if (!vsp->planes)
> + return -EINVAL;
Given that this code is only called when the DU hardware requires the VSP to
operate, how about modifying the rcar_du_vsp_init() stub function to return -
ENXIO instead of 0 ? That way you won't need to add an additional check here.
Ideally we should require VSP through Kconfig as well. If you feel like
submitting a patch (and testing it with various combinations of module and
built-in) it would be appreciated.
> }
> }
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: rcar-du: Make sure DRM planes are created by VSP1
@ 2017-03-03 11:26 ` Laurent Pinchart
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2017-03-03 11:26 UTC (permalink / raw)
To: Jacopo Mondi; +Cc: linux-renesas-soc, dri-devel
Hi Jacopo,
Thank you for the patch.
On Friday 03 Mar 2017 09:09:38 Jacopo Mondi wrote:
> On Gen3 platforms compositing planes are allocated by VSP on behalf of
> DRM/KMS.
> If VSP support is not compiled in, vsp1 initialization stub routine is
> called, leading to invalid memory accesses later on when un-initialized
> planes are accessed.
>
> Fail explicitly earlier if planes are not properly created.
>
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
> drivers/gpu/drm/rcar-du/rcar_du_kms.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index b5d3f16..7f56c09 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -616,6 +616,9 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
> ret = rcar_du_vsp_init(vsp);
> if (ret < 0)
> return ret;
> +
> + if (!vsp->planes)
> + return -EINVAL;
Given that this code is only called when the DU hardware requires the VSP to
operate, how about modifying the rcar_du_vsp_init() stub function to return -
ENXIO instead of 0 ? That way you won't need to add an additional check here.
Ideally we should require VSP through Kconfig as well. If you feel like
submitting a patch (and testing it with various combinations of module and
built-in) it would be appreciated.
> }
> }
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: rcar-du: Make sure DRM planes are created by VSP1
2017-03-03 11:26 ` Laurent Pinchart
(?)
@ 2017-03-03 12:37 ` jacopo mondi
2017-03-03 14:27 ` Laurent Pinchart
-1 siblings, 1 reply; 6+ messages in thread
From: jacopo mondi @ 2017-03-03 12:37 UTC (permalink / raw)
To: Laurent Pinchart, Jacopo Mondi; +Cc: dri-devel, linux-renesas-soc
HI Laurent,
On 03/03/2017 12:26, Laurent Pinchart wrote:
> Hi Jacopo,
>
> Thank you for the patch.
>
> On Friday 03 Mar 2017 09:09:38 Jacopo Mondi wrote:
>> On Gen3 platforms compositing planes are allocated by VSP on behalf of
>> DRM/KMS.
>> If VSP support is not compiled in, vsp1 initialization stub routine is
>> called, leading to invalid memory accesses later on when un-initialized
>> planes are accessed.
>>
>> Fail explicitly earlier if planes are not properly created.
>>
>> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
>> ---
>> drivers/gpu/drm/rcar-du/rcar_du_kms.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
>> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index b5d3f16..7f56c09 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
>> @@ -616,6 +616,9 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
>> ret = rcar_du_vsp_init(vsp);
>> if (ret < 0)
>> return ret;
>> +
>> + if (!vsp->planes)
>> + return -EINVAL;
>
> Given that this code is only called when the DU hardware requires the VSP to
> operate, how about modifying the rcar_du_vsp_init() stub function to return -
> ENXIO instead of 0 ? That way you won't need to add an additional check here.
>
Ok, I'll make sure it is only called there also.
> Ideally we should require VSP through Kconfig as well. If you feel like
> submitting a patch (and testing it with various combinations of module and
> built-in) it would be appreciated.
That would be ideal.
Am I wrong or the condition that selects DRM_RCAR_VSP is (DRM_RCAR_DU &&
Gen3-platform)? Implying that on Gen2 DU can live without VSP enabled?
Thanks
j
>
>> }
>> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: rcar-du: Make sure DRM planes are created by VSP1
2017-03-03 12:37 ` jacopo mondi
@ 2017-03-03 14:27 ` Laurent Pinchart
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2017-03-03 14:27 UTC (permalink / raw)
To: jacopo mondi; +Cc: Jacopo Mondi, dri-devel, linux-renesas-soc
Hi Jacopo,
On Friday 03 Mar 2017 13:37:56 jacopo mondi wrote:
> On 03/03/2017 12:26, Laurent Pinchart wrote:
> > On Friday 03 Mar 2017 09:09:38 Jacopo Mondi wrote:
> >> On Gen3 platforms compositing planes are allocated by VSP on behalf of
> >> DRM/KMS. If VSP support is not compiled in, vsp1 initialization stub
> >> routine is called, leading to invalid memory accesses later on when un-
> >> initialized planes are accessed.
> >>
> >> Fail explicitly earlier if planes are not properly created.
> >>
> >> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> >> ---
> >>
> >> drivers/gpu/drm/rcar-du/rcar_du_kms.c | 3 +++
> >> 1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> >> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index b5d3f16..7f56c09 100644
> >> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> >> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> >> @@ -616,6 +616,9 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
> >> ret = rcar_du_vsp_init(vsp);
> >> if (ret < 0)
> >> return ret;
> >> +
> >> + if (!vsp->planes)
> >> + return -EINVAL;
> >
> > Given that this code is only called when the DU hardware requires the VSP
> > to operate, how about modifying the rcar_du_vsp_init() stub function to
> > return - ENXIO instead of 0 ? That way you won't need to add an
> > additional check here.
>
> Ok, I'll make sure it is only called there also.
>
> > Ideally we should require VSP through Kconfig as well. If you feel like
> > submitting a patch (and testing it with various combinations of module and
> > built-in) it would be appreciated.
>
> That would be ideal.
> Am I wrong or the condition that selects DRM_RCAR_VSP is (DRM_RCAR_DU &&
> Gen3-platform)? Implying that on Gen2 DU can live without VSP enabled?
That's correct. On Gen2 VSP isn't required to operate the display.
> >> }
> >>
> >> }
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: rcar-du: Make sure DRM planes are created by VSP1
@ 2017-03-03 14:27 ` Laurent Pinchart
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2017-03-03 14:27 UTC (permalink / raw)
To: jacopo mondi; +Cc: linux-renesas-soc, Jacopo Mondi, dri-devel
Hi Jacopo,
On Friday 03 Mar 2017 13:37:56 jacopo mondi wrote:
> On 03/03/2017 12:26, Laurent Pinchart wrote:
> > On Friday 03 Mar 2017 09:09:38 Jacopo Mondi wrote:
> >> On Gen3 platforms compositing planes are allocated by VSP on behalf of
> >> DRM/KMS. If VSP support is not compiled in, vsp1 initialization stub
> >> routine is called, leading to invalid memory accesses later on when un-
> >> initialized planes are accessed.
> >>
> >> Fail explicitly earlier if planes are not properly created.
> >>
> >> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> >> ---
> >>
> >> drivers/gpu/drm/rcar-du/rcar_du_kms.c | 3 +++
> >> 1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> >> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index b5d3f16..7f56c09 100644
> >> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> >> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> >> @@ -616,6 +616,9 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
> >> ret = rcar_du_vsp_init(vsp);
> >> if (ret < 0)
> >> return ret;
> >> +
> >> + if (!vsp->planes)
> >> + return -EINVAL;
> >
> > Given that this code is only called when the DU hardware requires the VSP
> > to operate, how about modifying the rcar_du_vsp_init() stub function to
> > return - ENXIO instead of 0 ? That way you won't need to add an
> > additional check here.
>
> Ok, I'll make sure it is only called there also.
>
> > Ideally we should require VSP through Kconfig as well. If you feel like
> > submitting a patch (and testing it with various combinations of module and
> > built-in) it would be appreciated.
>
> That would be ideal.
> Am I wrong or the condition that selects DRM_RCAR_VSP is (DRM_RCAR_DU &&
> Gen3-platform)? Implying that on Gen2 DU can live without VSP enabled?
That's correct. On Gen2 VSP isn't required to operate the display.
> >> }
> >>
> >> }
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-03-03 14:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-03 8:09 [PATCH] drm: rcar-du: Make sure DRM planes are created by VSP1 Jacopo Mondi
2017-03-03 11:26 ` Laurent Pinchart
2017-03-03 11:26 ` Laurent Pinchart
2017-03-03 12:37 ` jacopo mondi
2017-03-03 14:27 ` Laurent Pinchart
2017-03-03 14:27 ` Laurent Pinchart
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.