* [PATCH] drm/radeon: fix atom aux payload size check for writes
@ 2015-02-20 16:56 Alex Deucher
2015-02-23 3:54 ` Michel Dänzer
0 siblings, 1 reply; 2+ messages in thread
From: Alex Deucher @ 2015-02-20 16:56 UTC (permalink / raw)
To: dri-devel; +Cc: Alex Deucher
The atom aux param interface only supports 4 bits for
the total write transfer size (header + payload). This
limits us to 12 bytes of payload rather than 16. Add a
check for this. Reads are not affected.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/radeon/atombios_dp.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 5bf825d..c57706e6 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -178,6 +178,13 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
switch (msg->request & ~DP_AUX_I2C_MOT) {
case DP_AUX_NATIVE_WRITE:
case DP_AUX_I2C_WRITE:
+ /* The atom implementation only supports writes with a max payload of
+ * 12 bytes since it uses 4 bits for the total count (header + payload)
+ * in the parameter space. The atom interface supports 16 byte
+ * payloads for reads. The hw itself supports up to 16 bytes of payload.
+ */
+ if (WARN_ON(msg->size > 12))
+ return -E2BIG;
/* tx_size needs to be 4 even for bare address packets since the atom
* table needs the info in tx_buf[3].
*/
--
1.8.3.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/radeon: fix atom aux payload size check for writes
2015-02-20 16:56 [PATCH] drm/radeon: fix atom aux payload size check for writes Alex Deucher
@ 2015-02-23 3:54 ` Michel Dänzer
0 siblings, 0 replies; 2+ messages in thread
From: Michel Dänzer @ 2015-02-23 3:54 UTC (permalink / raw)
To: Alex Deucher; +Cc: dri-devel
On 21.02.2015 01:56, Alex Deucher wrote:
> The atom aux param interface only supports 4 bits for
> the total write transfer size (header + payload). This
> limits us to 12 bytes of payload rather than 16. Add a
> check for this. Reads are not affected.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/radeon/atombios_dp.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
> index 5bf825d..c57706e6 100644
> --- a/drivers/gpu/drm/radeon/atombios_dp.c
> +++ b/drivers/gpu/drm/radeon/atombios_dp.c
> @@ -178,6 +178,13 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
> switch (msg->request & ~DP_AUX_I2C_MOT) {
> case DP_AUX_NATIVE_WRITE:
> case DP_AUX_I2C_WRITE:
> + /* The atom implementation only supports writes with a max payload of
> + * 12 bytes since it uses 4 bits for the total count (header + payload)
> + * in the parameter space. The atom interface supports 16 byte
> + * payloads for reads. The hw itself supports up to 16 bytes of payload.
> + */
> + if (WARN_ON(msg->size > 12))
> + return -E2BIG;
> /* tx_size needs to be 4 even for bare address packets since the atom
> * table needs the info in tx_buf[3].
> */
>
Might be safer to use WARN_ON_ONCE to avoid spamming dmesg if the
warning ever gets triggered.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-23 3:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-20 16:56 [PATCH] drm/radeon: fix atom aux payload size check for writes Alex Deucher
2015-02-23 3:54 ` Michel Dänzer
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.