Skip to contentSkip to conversation

drm/dp_mst: correct the shifting in DP_REMOTE_I2C_READ

PATCH In review Wayne Lin 3 participants 5 messages Jan 3, 2020 – Jan 6, 2020

Subsystems (3)
lore
Share & tools
lore

Wayne Lin

author
#0 lore raw

PATCH v2 1/1 drm/dp_mst: correct the shifting in DP_REMOTE_I2C_READ

[Why]
According to DP spec, it should shift left 4 digits for NO_STOP_BIT in REMOTE_I2C_READ message. Not 5 digits.

In current code, NO_STOP_BIT is always set to zero which means I2C master is always generating a I2C stop at the end of each I2C write transaction while handling REMOTE_I2C_READ sideband message. This issue might have the generated I2C signal not meeting the requirement. Take random read in I2C for instance, I2C master should generate a repeat start to start to read data after writing the read address. This issue will cause the I2C master to generate a stop-start rather than a re-start which is not expected in I2C random read.

[How]
Correct the shifting value of NO_STOP_BIT for DP_REMOTE_I2C_READ case in drm_dp_encode_sideband_req().

Changes since v1:(https://patchwork.kernel.org/patch/11312667/)
* Add more descriptions in commit and cc to stable

Fixes ad7f8a1f9ce (drm/helper: add Displayport multi-stream helper (v0.6))
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
index 1cf5f8b8bbb8..9d24c98bece1 100644
@@ -393,7 +393,7 @@ drm_dp_encode_sideband_req(const struct drm_dp_sideband_msg_req_body *req,
 			memcpy(&buf[idx], req->u.i2c_read.transactions[i].bytes, req->u.i2c_read.transactions[i].num_bytes);
 			idx += req->u.i2c_read.transactions[i].num_bytes;
 
-			buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 5;
+			buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 4;
 			buf[idx] |= (req->u.i2c_read.transactions[i].i2c_transaction_delay & 0xf);
 			idx++;
 		}
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 4 lines · Wayne Lin

[Why]
According to DP spec, it should shift left 4 digits for NO_STOP_BIT in REMOTE_I2C_READ message. Not 5 digits.

Quoted 9 lines

In current code, NO_STOP_BIT is always set to zero which means I2C master is always generating a I2C stop at the end of each I2C write transaction while handling REMOTE_I2C_READ sideband message. This issue might have the generated I2C signal not meeting the requirement. Take random read in I2C for instance, I2C master should generate a repeat start to start to read data after writing the read address. This issue will cause the I2C master to generate a stop-start rather than a re-start which is not expected in I2C random read.

Thanks for elaborating on the potential consequences of this bug.

Harry

Quoted 21 lines

[How]
Correct the shifting value of NO_STOP_BIT for DP_REMOTE_I2C_READ case in drm_dp_encode_sideband_req().

Changes since v1:(https://patchwork.kernel.org/patch/11312667/)
* Add more descriptions in commit and cc to stable

Fixes ad7f8a1f9ce (drm/helper: add Displayport multi-stream helper (v0.6))
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 1cf5f8b8bbb8..9d24c98bece1 100644

drivers/gpu/drm/drm_dp_mst_topology.c drm_dp_encode_sideband_req(const struct drm_dp_sideband_msg_req_body *req, · line 399

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -393,7 +393,7 @@ drm_dp_encode_sideband_req(const struct drm_dp_sideband_msg_req_body *req,
 			memcpy(&buf[idx], req->u.i2c_read.transactions[i].bytes, req->u.i2c_read.transactions[i].num_bytes);
 			idx += req->u.i2c_read.transactions[i].num_bytes;
 
-			buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 5;
+			buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 4;
 			buf[idx] |= (req->u.i2c_read.transactions[i].i2c_transaction_delay & 0xf);
 			idx++;
 		}

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v2 1/1
#2 lore raw
In reply to Wayne Lin

Thanks for all of the contributions you've made as of late! I will go ahead and push this into drm-misc-fixes

Quoted 48 lines · Wayne Lin

[Why]
According to DP spec, it should shift left 4 digits for NO_STOP_BIT in REMOTE_I2C_READ message. Not 5 digits.

In current code, NO_STOP_BIT is always set to zero which means I2C master is always generating a I2C stop at the end of each I2C write transaction while handling REMOTE_I2C_READ sideband message. This issue might have the generated I2C signal not meeting the requirement. Take random read in I2C for instance, I2C master should generate a repeat start to start to read data after writing the read address. This issue will cause the I2C master to generate a stop-start rather than a re-start which is not expected in I2C random read.

[How]
Correct the shifting value of NO_STOP_BIT for DP_REMOTE_I2C_READ case in drm_dp_encode_sideband_req().

Changes since v1:(https://patchwork.kernel.org/patch/11312667/)
* Add more descriptions in commit and cc to stable

Fixes ad7f8a1f9ce (drm/helper: add Displayport multi-stream helper (v0.6))
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 1cf5f8b8bbb8..9d24c98bece1 100644
@@ -393,7 +393,7 @@ drm_dp_encode_sideband_req(const struct
 drm_dp_sideband_msg_req_body *req,
 			memcpy(&buf[idx], req-
Quoted 2 lines

u.i2c_read.transactions[i].bytes, req-
u.i2c_read.transactions[i].num_bytes);

drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
 			idx += req->u.i2c_read.transactions[i].num_bytes;
 
-			buf[idx] = (req-
Quoted 1 line

u.i2c_read.transactions[i].no_stop_bit & 0x1) << 5;

drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
+			buf[idx] = (req-
Quoted 1 line

u.i2c_read.transactions[i].no_stop_bit & 0x1) << 4;

buf[idx] |= (req-

Quoted 1 line

u.i2c_read.transactions[i].i2c_transaction_delay & 0xf);

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 			idx++;
 		}
Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
In reply to Wayne Lin

Oh! Just a friendly tip, I fixed this before pushing your patch:

➜ drm-maint git:(drm-misc-fixes) dim push
dim: 0b1d54cedbb4 ("drm/dp_mst: correct the shifting in DP_REMOTE_I2C_READ"): Fixes: SHA1 needs at least 12 digits:
dim: ad7f8a1f9ce (drm/helper: add Displayport multi-stream helper (v0.6))
dim: ERROR: issues in commits detected, aborting

For the future, we have a set of DRM maintainer tools (they're quite useful for people who aren't maintainers though!) that you can use to make sure your patch is formatted correctly ahead of time:

https://drm.pages.freedesktop.org/maintainer-tools/dim.html

Particularly useful commands:
* dim sparse # Checks for trivial code issues, like set but unused variables
* dim checkpatch # Checks for code style issues
* dim fixes $COMMIT_ID # Adds an appropriately formatted Fixes: tag
* dim cite $COMMIT_ID # Adds an appropriately formatted Reference: tag

Quoted 48 lines · Wayne Lin

[Why]
According to DP spec, it should shift left 4 digits for NO_STOP_BIT in REMOTE_I2C_READ message. Not 5 digits.

In current code, NO_STOP_BIT is always set to zero which means I2C master is always generating a I2C stop at the end of each I2C write transaction while handling REMOTE_I2C_READ sideband message. This issue might have the generated I2C signal not meeting the requirement. Take random read in I2C for instance, I2C master should generate a repeat start to start to read data after writing the read address. This issue will cause the I2C master to generate a stop-start rather than a re-start which is not expected in I2C random read.

[How]
Correct the shifting value of NO_STOP_BIT for DP_REMOTE_I2C_READ case in drm_dp_encode_sideband_req().

Changes since v1:(https://patchwork.kernel.org/patch/11312667/)
* Add more descriptions in commit and cc to stable

Fixes ad7f8a1f9ce (drm/helper: add Displayport multi-stream helper (v0.6))
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 1cf5f8b8bbb8..9d24c98bece1 100644
@@ -393,7 +393,7 @@ drm_dp_encode_sideband_req(const struct
 drm_dp_sideband_msg_req_body *req,
 			memcpy(&buf[idx], req-
Quoted 2 lines

u.i2c_read.transactions[i].bytes, req-
u.i2c_read.transactions[i].num_bytes);

drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
 			idx += req->u.i2c_read.transactions[i].num_bytes;
 
-			buf[idx] = (req-
Quoted 1 line

u.i2c_read.transactions[i].no_stop_bit & 0x1) << 5;

drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
+			buf[idx] = (req-
Quoted 1 line

u.i2c_read.transactions[i].no_stop_bit & 0x1) << 4;

buf[idx] |= (req-

Quoted 1 line

u.i2c_read.transactions[i].i2c_transaction_delay & 0xf);

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 			idx++;
 		}
Signature · 2 lines
Cheers,
	Lyude Paul
author
#4 lore raw

[AMD Public Use]

Quoted 23 lines

-----Original Message-----
From: Lyude Paul <[email protected]>
Sent: Saturday, January 4, 2020 6:02 AM
To: Lin, Wayne <[email protected]>; [email protected]; [email protected]
Cc: Kazlauskas, Nicholas <[email protected]>; Wentland, Harry <[email protected]>; Zuo, Jerry <[email protected]>; [email protected]
Subject: Re: [PATCH v2] drm/dp_mst: correct the shifting in DP_REMOTE_I2C_READ

Oh! Just a friendly tip, I fixed this before pushing your patch:

➜ drm-maint git:(drm-misc-fixes) dim push
dim: 0b1d54cedbb4 ("drm/dp_mst: correct the shifting in DP_REMOTE_I2C_READ"): Fixes: SHA1 needs at least 12 digits:
dim: ad7f8a1f9ce (drm/helper: add Displayport multi-stream helper (v0.6))
dim: ERROR: issues in commits detected, aborting

For the future, we have a set of DRM maintainer tools (they're quite useful for people who aren't maintainers though!) that you can use to make sure your patch is formatted correctly ahead of time:

Quoted 8 lines

https://drm.pages.freedesktop.org/maintainer-tools/dim.html>

Particularly useful commands:
* dim sparse # Checks for trivial code issues, like set but unused variables
* dim checkpatch # Checks for code style issues
* dim fixes $COMMIT_ID # Adds an appropriately formatted Fixes: tag
* dim cite $COMMIT_ID # Adds an appropriately formatted Reference: tag

Really appreciate for your time!
I will have a look on this. Thanks a lot.

Quoted 57 lines · Wayne Lin
Quoted 13 lines

[Why]
According to DP spec, it should shift left 4 digits for NO_STOP_BIT in REMOTE_I2C_READ message. Not 5 digits.

In current code, NO_STOP_BIT is always set to zero which means I2C master is always generating a I2C stop at the end of each I2C write transaction while handling REMOTE_I2C_READ sideband message. This issue might have the generated I2C signal not meeting the requirement. Take random read in I2C for instance, I2C master should generate a repeat start to start to read data after writing the read address. This issue will cause the I2C master to generate a stop-start rather than a re-start which is not expected in I2C random read.

Quoted 6 lines

[How]
Correct the shifting value of NO_STOP_BIT for DP_REMOTE_I2C_READ case in drm_dp_encode_sideband_req().

Changes since

v1:(https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F

Quoted 1 line

patchwork.kernel.org%2Fpatch%2F11312667%2F&amp;data=02%7C01%7Cw ayne.li

Quoted 1 line

n%40amd.com%7Ce4299c1721bd4bcb486708d790989148%7C3dd8961fe4884e 608e11a

Quoted 1 line

82d994e183d%7C0%7C0%7C637136857271065549&amp;sdata=eoxiRojffBepY YoQbjp

Quoted 27 lines

j8b6R%2BkwaOQWBoU%2Fu8lY5gIQ%3D&amp;reserved=0)
* Add more descriptions in commit and cc to stable

Fixes ad7f8a1f9ce (drm/helper: add Displayport multi-stream helper

(v0.6))

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 1cf5f8b8bbb8..9d24c98bece1 100644
@@ -393,7 +393,7 @@ drm_dp_encode_sideband_req(const struct
 drm_dp_sideband_msg_req_body *req,
 			memcpy(&buf[idx], req-
Quoted 2 lines

u.i2c_read.transactions[i].bytes, req-
u.i2c_read.transactions[i].num_bytes);

drivers/gpu/drm/drm_dp_mst_topology.c +0 -1
 			idx += req->u.i2c_read.transactions[i].num_bytes;
 
-			buf[idx] = (req-
Quoted 1 line

u.i2c_read.transactions[i].no_stop_bit & 0x1) << 5;

drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
+			buf[idx] = (req-
Quoted 8 lines

drivers/gpu/drm/drm_dp_mst_topology.c

Quoted 5 lines
Quoted 1 line

u.i2c_read.transactions[i].no_stop_bit & 0x1) << 4;

buf[idx] |= (req-

Quoted 1 line

u.i2c_read.transactions[i].i2c_transaction_delay & 0xf);

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 			idx++;
 		}

--
Cheers,
Lyude Paul

--
Best Regards,
Wayne Lin
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel