Commit b71ccff6 authored by Jani Nikula's avatar Jani Nikula

drm/amd/display: switch to guid_gen() to generate valid GUIDs

Instead of just smashing jiffies into a GUID, use guid_gen() to generate
RFC 4122 compliant GUIDs.
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Acked-by: default avatarHamza Mahfooz <hamza.mahfooz@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240812122312.1567046-3-jani.nikula@intel.comSigned-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 4548f10b
...@@ -2568,9 +2568,9 @@ static int dm_late_init(void *handle) ...@@ -2568,9 +2568,9 @@ static int dm_late_init(void *handle)
static void resume_mst_branch_status(struct drm_dp_mst_topology_mgr *mgr) static void resume_mst_branch_status(struct drm_dp_mst_topology_mgr *mgr)
{ {
u8 buf[UUID_SIZE];
guid_t guid;
int ret; int ret;
u8 guid[16];
u64 tmp64;
mutex_lock(&mgr->lock); mutex_lock(&mgr->lock);
if (!mgr->mst_primary) if (!mgr->mst_primary)
...@@ -2591,26 +2591,27 @@ static void resume_mst_branch_status(struct drm_dp_mst_topology_mgr *mgr) ...@@ -2591,26 +2591,27 @@ static void resume_mst_branch_status(struct drm_dp_mst_topology_mgr *mgr)
} }
/* Some hubs forget their guids after they resume */ /* Some hubs forget their guids after they resume */
ret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16); ret = drm_dp_dpcd_read(mgr->aux, DP_GUID, buf, sizeof(buf));
if (ret != 16) { if (ret != sizeof(buf)) {
drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n"); drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n");
goto out_fail; goto out_fail;
} }
if (memchr_inv(guid, 0, 16) == NULL) { import_guid(&guid, buf);
tmp64 = get_jiffies_64();
memcpy(&guid[0], &tmp64, sizeof(u64));
memcpy(&guid[8], &tmp64, sizeof(u64));
ret = drm_dp_dpcd_write(mgr->aux, DP_GUID, guid, 16); if (guid_is_null(&guid)) {
guid_gen(&guid);
export_guid(buf, &guid);
if (ret != 16) { ret = drm_dp_dpcd_write(mgr->aux, DP_GUID, buf, sizeof(buf));
if (ret != sizeof(buf)) {
drm_dbg_kms(mgr->dev, "check mstb guid failed - undocked during suspend?\n"); drm_dbg_kms(mgr->dev, "check mstb guid failed - undocked during suspend?\n");
goto out_fail; goto out_fail;
} }
} }
import_guid(&mgr->mst_primary->guid, guid); guid_copy(&mgr->mst_primary->guid, &guid);
out_fail: out_fail:
mutex_unlock(&mgr->lock); mutex_unlock(&mgr->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment