Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5252390imu; Tue, 15 Jan 2019 14:07:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN70bHuPSCTZc3yZAlPMK6tOaKqxSjpnHKPoWkTJWfHDw66/HQQ2O+G3cuC/IdgsuSEiSKj5 X-Received: by 2002:a17:902:27e6:: with SMTP id i35mr6256425plg.222.1547590068155; Tue, 15 Jan 2019 14:07:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547590068; cv=none; d=google.com; s=arc-20160816; b=sBW8DGkmHVKA5RZvm40Fd94s0eI7lrpwxF8cmMUr1GqsPJ+wLv7/fPK0XEIeXObjad 8n1WFaj69hcwa+auqKDzKTyrsptUn9HhWf9nPTvMKpCb9SKu/oWdtWRBc+0OHd/9534u NoAP7UGJDCAfAGJ2K/b3MDfeTIhj+ADT1hOKPZwfj/Zf6BByQ8CQsrWRQxK9/8jUTUIz 4ZJ9Ul5mWUqBivyncDxRLO/TbywfEF0yBI76utErwx32TNxIVZ2WnsHk6KJ/K4d/l/oV v2cYuPYvP03JV3z4mL1hek+/ILc2KoCHMCNAx7LGOSf1AjX8kBxQCXRWwJQQ+sO36fK4 yptw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dZ+DgiTV8C8LNtKMvNTYT4JzvMxbRW/kjxDBVf1TC/A=; b=GU9Es+IeVVDGX494AmngNuy//mp4atRFACuqRtlpUwNNpHR7N8Tw0fdbjFIAa9L7AL mvAMiQrnm5DICLU+gvQwpqK+eFfqvnDUC8TBPgOn1Ucray9U4waKSdnzBr2c3Off6If0 vCk1MAWUOl/UQ02nD9MpMagbYzsc4aMEUXIR77G9HkNrBFjawVJmgqspRKsoyb58WzuT V+y6jYCm2WZVaPmENVhNqYyKnIpgNFx++BgreDA2iceo0viJ6/G1UGgajyP/GhhMkrmn E+HtopvRFmiJp9qFpLXMbI81DYgEImY6cvDOo5PYdGg/CHbmn1RPRt+deW12SMh46yIm CW9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hlaUeztd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f189si4539963pfg.123.2019.01.15.14.07.31; Tue, 15 Jan 2019 14:07:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hlaUeztd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387777AbfAOQpX (ORCPT + 99 others); Tue, 15 Jan 2019 11:45:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:34896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387728AbfAOQpN (ORCPT ); Tue, 15 Jan 2019 11:45:13 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 96E1020645; Tue, 15 Jan 2019 16:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570712; bh=5ritQIkldwqUkK1z2ZXq/ilZ3qQC0h1gjJkpBXL8dH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hlaUeztdpXf+nEA+GI9Ag3eq63HWrvfmOd4q7HfZjM74lPeBim2ddN8mMgajxoIog o7RvBZK0fi2SykjkKfPmLQEKadYKzXpo7rW8xC7Cib86ZXWq0gj/vpaEvYkGICbJq4 oMHYPm1+ZmRhi/gU/iFlLiset+maq7qQyg1zPRfY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Harry Wentland , Jerry Zuo Subject: [PATCH 4.20 44/57] drm/amdgpu: Dont ignore rc from drm_dp_mst_topology_mgr_resume() Date: Tue, 15 Jan 2019 17:36:25 +0100 Message-Id: <20190115154913.416329594@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154910.734892368@linuxfoundation.org> References: <20190115154910.734892368@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lyude Paul commit fe7553bef8d676d1d8b40666868b33ec39b9df5d upstream. drm_dp_mst_topology_mgr_resume() returns whether or not it managed to find the topology in question after a suspend resume cycle, and the driver is supposed to check this value and disable MST accordingly if it's gone-in addition to sending a hotplug in order to notify userspace that something changed during suspend. Currently, amdgpu just makes the mistake of ignoring the return code from drm_dp_mst_topology_mgr_resume() which means that if a topology was removed in suspend, amdgpu never notices and assumes it's still connected which leads to all sorts of problems. So, fix this by actually checking the rc from drm_dp_mst_topology_mgr_resume(). Also, reformat the rest of the function while we're at it to fix the over-indenting. Signed-off-by: Lyude Paul Reviewed-by: Harry Wentland Cc: Jerry Zuo Cc: # v4.15+ Link: https://patchwork.freedesktop.org/patch/msgid/20190108211133.32564-2-lyude@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 34 +++++++++++++++------- 1 file changed, 24 insertions(+), 10 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -645,22 +645,36 @@ static void s3_handle_mst(struct drm_dev { struct amdgpu_dm_connector *aconnector; struct drm_connector *connector; + struct drm_dp_mst_topology_mgr *mgr; + int ret; + bool need_hotplug = false; drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - aconnector = to_amdgpu_dm_connector(connector); - if (aconnector->dc_link->type == dc_connection_mst_branch && - !aconnector->mst_port) { - - if (suspend) - drm_dp_mst_topology_mgr_suspend(&aconnector->mst_mgr); - else - drm_dp_mst_topology_mgr_resume(&aconnector->mst_mgr); - } + list_for_each_entry(connector, &dev->mode_config.connector_list, + head) { + aconnector = to_amdgpu_dm_connector(connector); + if (aconnector->dc_link->type != dc_connection_mst_branch || + aconnector->mst_port) + continue; + + mgr = &aconnector->mst_mgr; + + if (suspend) { + drm_dp_mst_topology_mgr_suspend(mgr); + } else { + ret = drm_dp_mst_topology_mgr_resume(mgr); + if (ret < 0) { + drm_dp_mst_topology_mgr_set_mst(mgr, false); + need_hotplug = true; + } + } } drm_modeset_unlock(&dev->mode_config.connection_mutex); + + if (need_hotplug) + drm_kms_helper_hotplug_event(dev); } static int dm_hw_init(void *handle)