From patchwork Tue Jul 20 16:03:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Lin, Wayne" X-Patchwork-Id: 12388747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81641C07E9B for ; Tue, 20 Jul 2021 16:06:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4089161029 for ; Tue, 20 Jul 2021 16:06:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4089161029 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5ED36E44D; Tue, 20 Jul 2021 16:06:12 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2059.outbound.protection.outlook.com [40.107.237.59]) by gabe.freedesktop.org (Postfix) with ESMTPS id 51D5C6E40D for ; Tue, 20 Jul 2021 16:06:11 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LzUUToDaQu7IiX3fFr3juviuZ5qMCB0JEo30nM+Cn6ABlkOVmE/dujD8zKSdNbGq3R4PH+FrX20wft0XIyXheyZbOOKxlIO+yrT9+3lLlbRFFqIjDiVlBnBUsfLlqH3E5zLD6RwXO9c18qAdRoHatBj3WoW/YcU9KpIQ1+GM6R9TN3Qp6OhZQdR9FDz3dZPzYH4V9dOoHGZoOsefXBoF/5QrBkQq6IiGKgm+zAt2CAKxkYH4S6FKBOKSo52f43kFL8AKqOqUkCe3wAC/WnQmwVM1t3q0LasG4T4LM5bkwoVsCRsJVIFpHktjWWnpep3tKc7G39nUOCKTVNPHluTqaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KUx3xJryiElpCd2Vfr3UJIk072flXKARwVt2myM4U14=; b=RlFdV4ExChKLDDqWts5Lw5Wv+a0x/CCBFuS8zOBna4TdLvbEdNWTiHNbVSwvo2jnhvHz6HVoxgtPXuuPGtKRJYdpGPcH/51DtCn5pGj29Bmnv96r0bwzebfwwnA++s7d5JnqmZXuKVcOBS78MCQ1ZnY7GZ6vX2KcZsDHDlylOPnnE9YD4j+D6izqT1EX0KgRbTTOQaOKdQQWaBqKFmzv48n9RTGVKGU61hzoApH1aeaH84DnT0/HfUf/5i4RzKkO1JaHwbo6Hmi4pH4Y4+M/7h9srh2+E8g9sEgQ2LIfsvHFr5IsveU2V9EM/APt9DYputdYKQh+OpMG71RO5NyVnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KUx3xJryiElpCd2Vfr3UJIk072flXKARwVt2myM4U14=; b=BtCpK0zv2tczREBCuFof4LXc6MywNTy3A2u8OlkF8IQdWKVw50g2BdwLP2Ya0ScteEFJGw20vv6xy4dhdT6DlIqVINiFZpMcdZ4aQsBQezHn9Bsor0sP7JPrV1xoQOC+ACVE9zt0LHvMVThiwuOTyHBFm8kKfaOJ3o/TzW1q6Wc= Received: from BN0PR03CA0050.namprd03.prod.outlook.com (2603:10b6:408:e7::25) by CH0PR12MB5123.namprd12.prod.outlook.com (2603:10b6:610:be::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Tue, 20 Jul 2021 16:06:09 +0000 Received: from BN8NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e7:cafe::b2) by BN0PR03CA0050.outlook.office365.com (2603:10b6:408:e7::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.24 via Frontend Transport; Tue, 20 Jul 2021 16:06:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT021.mail.protection.outlook.com (10.13.177.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Tue, 20 Jul 2021 16:06:09 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 11:05:52 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 11:05:52 -0500 Received: from wayne-System-Product-Name.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:05:48 -0500 From: Wayne Lin To: Subject: [PATCH 1/4] drm/dp_mst: Put malloc_kref of vcpi pointing port when disable MST Date: Wed, 21 Jul 2021 00:03:39 +0800 Message-ID: <20210720160342.11415-2-Wayne.Lin@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720160342.11415-1-Wayne.Lin@amd.com> References: <20210720160342.11415-1-Wayne.Lin@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0a8d6ed-e247-47aa-1570-08d94b9849c2 X-MS-TrafficTypeDiagnostic: CH0PR12MB5123: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TvEiNe09POf0c6i1lolKCK/arv7f5nkFqKZm4FQ4yowDMrQ9Z6d6cjoy245s6noWCjhUTb9GgYr1qT67uIpDZLN1iZB30fQV9etUt9iYiglBHXxxp4Hh38aI5pViuIq7LSV7KeWYWR5mPh8OquaHrWB1mzsifYEOKXKSkdS3AUq0Y27iNJ6aw55YQ+p3MMqbhTnLAN3/Qvyf+mAMrfQkKVeVvR6oqWWR/0bIql1DRXUvCINEjRiiCrTw0otLr9nf8zQm3kPFhG/5G52DmYVle+wFwNZNSa8LgKRVind0WQ45ssxtiEtsDV1JRLjh7F4aZSppfRtIeRWsOyePd84XTS0InrkQzF+jhwXoZTDYW8UTTRbOt4tfhnP1Q/vFxVw90U1usbwdoV//1qYq2mt2ob/u9Xuiq7+Bfk2QokobNHUxQCBw5sllO8qJMuod5Ak2B2pkF2UuojE1bJXkFGJRSc1DWUWhEqm5pdwbTzmImuB5oYOPNz2btT7Ix3NhH6pZohsgYtrlqTGbTHPIyNTkj898IiBSQhoGGP3i3KEgT1JHIaLiWJeOeVN/7APvqWrWLWNjwMWLLpq56eAKuB8b/OtD4jJNcPn9U5c8hOxG8Be6cOBWQ3AolXVIVEcEGj6ZO3K+ENpHV65Jzxt7/Hp3jNFg8hGAeavgkUvVS7b1Yf9gVex4mP7qw+JVuIOW1L9erpRaZmz+DzN1fnNmc5Po0ZSORBknDdfuuRjTTPbxH1U= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(396003)(136003)(39860400002)(346002)(376002)(36840700001)(46966006)(336012)(86362001)(36756003)(54906003)(2906002)(82740400003)(8936002)(186003)(26005)(4326008)(6666004)(36860700001)(7696005)(7416002)(8676002)(478600001)(70586007)(5660300002)(70206006)(47076005)(316002)(82310400003)(81166007)(1076003)(426003)(2616005)(356005)(6916009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:06:09.3684 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c0a8d6ed-e247-47aa-1570-08d94b9849c2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5123 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , stable@vger.kernel.org, jerry.zuo@amd.com, hersenxs.wu@amd.com, Thomas Zimmermann , Wayne Lin , Nicholas.Kazlauskas@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] We directlly clean up proposed_vcpis[] but forget to put malloc_kref of ports which the proposed_vcpis[] are pointing to. [How] Iterate over proposed_vcpis[] and put malloc_kref of ports which used to have allocated payloads. Fixes: 8732fe46b20c ("drm/dp_mst: Fix clearing payload state on topology disable") Cc: Sean Paul Cc: Wayne Lin Cc: Ville Syrjälä Cc: stable@vger.kernel.org # v4.4+ Cc: Lyude Paul Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: # v5.7+ Signed-off-by: Wayne Lin --- drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index ad0795afc21c..51cd7f74f026 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -3765,12 +3765,26 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms ret = 0; } else { + int i; + struct drm_dp_vcpi *vcpi; + struct drm_dp_mst_port *port; /* disable MST on the device */ mstb = mgr->mst_primary; mgr->mst_primary = NULL; /* this can fail if the device is gone */ drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0); ret = 0; + + for (i = 0; i < mgr->max_payloads; i++) { + vcpi = mgr->proposed_vcpis[i]; + if (vcpi) { + port = container_of(vcpi, struct drm_dp_mst_port, + vcpi); + if (port) + drm_dp_mst_put_port_malloc(port); + } + } + memset(mgr->payloads, 0, mgr->max_payloads * sizeof(mgr->payloads[0])); memset(mgr->proposed_vcpis, 0, From patchwork Tue Jul 20 16:03:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Lin, Wayne" X-Patchwork-Id: 12388753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69CCAC636C9 for ; Tue, 20 Jul 2021 16:06:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 395F06100C for ; Tue, 20 Jul 2021 16:06:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 395F06100C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE3E86E459; Tue, 20 Jul 2021 16:06:21 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2050.outbound.protection.outlook.com [40.107.244.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id EEACC6E45D for ; Tue, 20 Jul 2021 16:06:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kg7zCDULrDcI1VQ7v1MQmjAr7aqLAcHtrSJu3Uy7zQvyBt/DClsiFHagukPOsczxw1ca4W8gPYlbvOjj8a1V0VSoodVthHJJOYjbw5moJyAVTxC+W1jNKgtHxOGfnMgfyO9qjVkj4VeAD+KS+HDva0f4KNI0E6+3X/RQveomwImavEUxoA8vUC57zXMYidKskr7V6iQzKXNt0ZTPpvvgcYthNzTohbbeDCz8SjXljgloQNcDmuK6zxHLwScHFfyy/0cP0hFFPd+Ik8ZY2MzxwYDcGYddallHkgMAmy6iMr/bNFYZDQWvUNvF9OOmUABUB0QQepztWEztJNLJo/d2XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GgRe0gwAxm8zAhn2oH+DKrNQWBlzFisJWCi9QjmF0L0=; b=JGhJugk54OZt/C0/F3Yq1Ub56OyUg0PCZ5fEbklKKSE/D09sR8cbHF8i1y3jD2uOp+3EgaNYKKEdAbSoVz/RU7Z0Ycq/NlaWwv5HMJVdEvr4Ynx36gs7vqIvt1FnTEXLUVGxj7iKYFkbBh/ziTFAsW6ijuesqgeKf1rfVlJeIFrrFOfdJYSBUiTa2Syv6yggo1dADwslbqcQ/x3SuhgOYTneodeSXD4aYVe6jvLyVjsrbwm5QQ8zYI9YkBpvU93Bi5sVNPz5fRyp3asniaQjCwoVF829/YOTz81eMDzXVbXnmfOgseEgSFHsSihLhARWGfBwL/H/m66zwTDkL+35jQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GgRe0gwAxm8zAhn2oH+DKrNQWBlzFisJWCi9QjmF0L0=; b=3QDVbMT+s7y6c/b2dVC8Dq6sGChss00/CTIQthk3tCryb9+ADUncimJCIKHMptK8kGzUz9Mli5C84OoBvkBWGziml96IyF7IU1eJfMZ806q9lqZAEyuq+QfmP77ACo4sDa6QO1F+KCxb4MqNO8ReOn1ThuDAy6ERP30RyqUpEu4= Received: from BN0PR03CA0049.namprd03.prod.outlook.com (2603:10b6:408:e7::24) by BL0PR12MB2482.namprd12.prod.outlook.com (2603:10b6:207:4a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.26; Tue, 20 Jul 2021 16:06:10 +0000 Received: from BN8NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e7:cafe::2e) by BN0PR03CA0049.outlook.office365.com (2603:10b6:408:e7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:06:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT021.mail.protection.outlook.com (10.13.177.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Tue, 20 Jul 2021 16:06:10 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 11:06:05 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 09:06:04 -0700 Received: from wayne-System-Product-Name.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:05:53 -0500 From: Wayne Lin To: Subject: [PATCH 2/4] drm/dp_mst: Only create connector for connected end device Date: Wed, 21 Jul 2021 00:03:40 +0800 Message-ID: <20210720160342.11415-3-Wayne.Lin@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720160342.11415-1-Wayne.Lin@amd.com> References: <20210720160342.11415-1-Wayne.Lin@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 49015f0e-f2e1-4f6d-8aa6-08d94b984a3c X-MS-TrafficTypeDiagnostic: BL0PR12MB2482: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gADEMcPxn1UnejJ5OE5GgmoxzRJ6BeCWQcSCsPdge5bHDOTCIOdC3gG77iOicdRFtfSzREvFyOyQfxJDnwYOrB/WWJwU0W4DCpmKD2xX9k3Sd0+TTYb8gtphgBSI0edqLQJXIbrFmeS8U0ZX9f+7INieqJ2tpzcV10CxQffjq5QOOuMOHxpeXeSo7U27EsYb0C033LD8x8+Q/Ku0+rai60usenrsBXfKTNtxVtL1NApmm0PoMIZD4e/Tx8UhjTAHi0EmwR8qBDfAiA8RE2xgxi/zDYdK2YiSLqH5qLOKciqdYsx2FXevqqjMIHhp3KzuF7nf0yLwPCgJ1n0iffOzvm/beBPAKf38frclhnm03W89WxiPTl6OdmjmwQfpyqNTufIQLLw36YXRuBwezkwaQ/KIqa98MBB5ccFGu/+AXilWoQMThagQ/IDwB98oG3F+XAzFUs6QrIpLJnW6BVOKwsHYyiBcPG3cZjwNiRuTcsjOIvOP36PbTIR4QADlnrjUzszATy/jsF4+sRzz5EXMWYIcTsfOaRaaIhd37P3oyfeThiEfsk1zT36QglC70DnzgY6GifteBC/G7pt9MKC8LZwisQGZ3hU4v33zacdK8aLyJMN1rFOzuE9VoX3uIwpmqSrbkmWm67UHZOvnE6iR3Sxo86d6SsYC3euph6xeDWX7TjWruOYVJBCpqPZeTL+CluSlrXKrkWYh9kRdob+CpatXOPcgFl4aiRTK3U8LaLM= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(346002)(39860400002)(376002)(396003)(136003)(46966006)(36840700001)(356005)(1076003)(83380400001)(478600001)(36860700001)(26005)(82740400003)(186003)(316002)(426003)(6666004)(7416002)(336012)(81166007)(8936002)(2906002)(86362001)(2616005)(36756003)(4326008)(5660300002)(66574015)(6916009)(54906003)(47076005)(82310400003)(7696005)(70206006)(8676002)(70586007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:06:10.1699 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49015f0e-f2e1-4f6d-8aa6-08d94b984a3c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2482 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Daniel Vetter , =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= , Harry Wentland , Rodrigo Siqueira , jerry.zuo@amd.com, Aurabindo Pillai , Ben Skeggs , Ankit Nautiyal , Juston Li , Thomas Zimmermann , Jani Nikula , Wayne Lin , Nikola Cornij , hersenxs.wu@amd.com, Sean Paul , Eryk Brol , stable@vger.kernel.org, Manasi Navare , Alex Deucher , Sean Paul , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] Currently, we will create connectors for all output ports no matter it's connected or not. However, in MST, we can only determine whether an output port really stands for a "connector" till it is connected and check its peer device type as an end device. In current code, we have chance to create connectors for output ports connected with branch device and these are redundant connectors. e.g. StarTech 1-to-4 DP hub is constructed by internal 2 layer 1-to-2 branch devices. Creating connectors for such internal output ports are redundant. [How] Put constraint on creating connector for connected end device only. Fixes: 6f85f73821f6 ("drm/dp_mst: Add basic topology reprobing when resuming") Cc: Juston Li Cc: Imre Deak Cc: Ville Syrjälä Cc: Harry Wentland Cc: Daniel Vetter Cc: Sean Paul Cc: Lyude Paul Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Cc: Alex Deucher Cc: Nicholas Kazlauskas Cc: Rodrigo Siqueira Cc: Aurabindo Pillai Cc: Eryk Brol Cc: Bas Nieuwenhuizen Cc: Nikola Cornij Cc: Wayne Lin Cc: "Ville Syrjälä" Cc: Jani Nikula Cc: Manasi Navare Cc: Ankit Nautiyal Cc: "José Roberto de Souza" Cc: Sean Paul Cc: Ben Skeggs Cc: dri-devel@lists.freedesktop.org Cc: # v5.5+ Signed-off-by: Wayne Lin --- drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 51cd7f74f026..f13c7187b07f 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -2474,7 +2474,8 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb, if (port->connector) drm_modeset_unlock(&mgr->base.lock); - else if (!port->input) + else if (!port->input && port->pdt != DP_PEER_DEVICE_NONE && + drm_dp_mst_is_end_device(port->pdt, port->mcs)) drm_dp_mst_port_add_connector(mstb, port); if (send_link_addr && port->mstb) { @@ -2557,6 +2558,10 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb, dowork = false; } + if (!port->input && !port->connector && new_pdt != DP_PEER_DEVICE_NONE && + drm_dp_mst_is_end_device(new_pdt, new_mcs)) + create_connector = true; + if (port->connector) drm_modeset_unlock(&mgr->base.lock); else if (create_connector) From patchwork Tue Jul 20 16:03:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lin, Wayne" X-Patchwork-Id: 12388751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 525B8C636C8 for ; Tue, 20 Jul 2021 16:06:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 267F560233 for ; Tue, 20 Jul 2021 16:06:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 267F560233 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 682D86E457; Tue, 20 Jul 2021 16:06:16 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2061.outbound.protection.outlook.com [40.107.236.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1FC536E40D for ; Tue, 20 Jul 2021 16:06:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V+P7YIUL8pMb7FuZPELdXYxL17iqP022zwmeffTEwtZ94OnIWvdmyJFjCsyqISTVvqkPjGo4itfrMC1/XHCw1vfDdecp6W7mN3NlU9mcOHUYsPthMbtNPJ4Wj0kSA1upbzYpS+dwiwd6hi1gHZNgwScNjD8O8dH4a86MECao6ri0Gf5jQ5TNJ/jaLE0R6BLsrhXdAKhB7udSeEsucBNlGcT5qBMDJP+zXlsjKduff1KlcyTrIu6xDeeNzN6hY/g+Jn8uFGKZx+9RqojlgcJvFPjW4p8OJDOhE0P1miOAkgi4PP53PUXflEc5KBy/vl/Zx04jEwbNADcFeCL/UeVD6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2t9uyzPrDPABnP7V7j85exXP8BhEOCS7x/8PBkA8zF4=; b=GCyoM1YDX6m/cxE2WrdljL/yf4hcg/U/tfIiFysm+7Urxz3AHUPl7aswy/vAKtd7XiG31zKvBRMa5rwYaLJuBdLm0L/InXYINxHFBKhCWh8jsaRlzaHPJ2Mo4GddpDfcQ6A9+jJp0XJtNAIKr1BQ2QqfDysw5ChRxnioqRJzqpBhB6NvWb37qgzVJ+IUkE12KPnKidgwIrxhyIBpn+Q2XNy4W/uR3koEZ60fhHu3c2k0DxQ+kwPBNWZH3UQKVqd2hiiy8T/CWpfSv82uVia7c4LSLXTlnNySeVamUAARyAV4fUu6K3Vx4UVqB96rozRMczBfZVmYQp6wvlo98UBznw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2t9uyzPrDPABnP7V7j85exXP8BhEOCS7x/8PBkA8zF4=; b=R4hsMY4XkdD+1JczI0cQ8U0WRiHUnnHyxRSK5+BcTQyDdKqtmLh6rlgHlP4q3xTDFNubwTsIadyquwres1C0ni2QzdH32iuCkhX3ovRyGz15VVFQOUUHzHJEbAn1JpJTrAvziZMPicfNMRskX1LAMovTYMnqtS13blEmxky/R7c= Received: from BN0PR03CA0055.namprd03.prod.outlook.com (2603:10b6:408:e7::30) by CY4PR1201MB0247.namprd12.prod.outlook.com (2603:10b6:910:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.24; Tue, 20 Jul 2021 16:06:10 +0000 Received: from BN8NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e7:cafe::2b) by BN0PR03CA0055.outlook.office365.com (2603:10b6:408:e7::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.24 via Frontend Transport; Tue, 20 Jul 2021 16:06:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT021.mail.protection.outlook.com (10.13.177.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Tue, 20 Jul 2021 16:06:10 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 11:06:08 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 11:06:08 -0500 Received: from wayne-System-Product-Name.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:06:06 -0500 From: Wayne Lin To: Subject: [PATCH 3/4] drm/dp_mst: Put connector of disconnected end device when handling CSN Date: Wed, 21 Jul 2021 00:03:41 +0800 Message-ID: <20210720160342.11415-4-Wayne.Lin@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720160342.11415-1-Wayne.Lin@amd.com> References: <20210720160342.11415-1-Wayne.Lin@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 430ef928-89cc-4994-0967-08d94b984a6d X-MS-TrafficTypeDiagnostic: CY4PR1201MB0247: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:195; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UTOGPxYFjmd4mfojZfRfY00aXo+izUmvM5T7pv88kBd8FRlYVZC9YA4UtLxOBZkUkavEuq6WwiJsrWnGOF45yFUI6ya4NJqCoEsvy93R2RgA/4MFvjGle73UhiavcIza8gxMGPmebUBPS+3qyqGuhW0VYnwABdI0ZQaBJa1JVYe3gLzSMY9QRUXZTOFRmecO+HLwpDVUdtbyG6OC9mlJhB3pyshhfEGbV8ny6TJIpz8ctzVdrmoiZyx/8tRvSLQ0jeKEGnN6cn8VgBL6N8YuOzv/tAry88m52i6k1bdZDcvPMItiSZEFXvqp+kmAnx+wIgvPuYb08ebz8u75mFlETliuZce41YsGh9Kix97jk3yU0p7qWg0YoJBxgUl5kZCZgf2itd3m4rP54hgxC20E7O4/JaP/+fwZshIuKrmjh4CkT4wHE1ij3+Q/gvu87xbvlJ1BxoNsfokleui47SKk0cU3UTgNzM/MDcREcIKtBmzn4NJrkromKo/Aoih4MNtLuPsh/sr3eei9lLQoXQtCqlIz2rf9w/WfxdSmVUQUAMsZQ19knKq+Yis/cRGtubQ/h+Bb2U4lp3ksa1zzQw8hliME50yMlDTbDWeGRBUZolFV+4/AX0n7f9ufRV1CeA281HZ4NNQBcl+N5Qwsf2mtw9FyJBzgg4PL63TkxwEGOmKuTc1MGFs9ovrRFLKgrNYwEgaph+w0RorqAFfU5jHFNDDA4NwRCoDg/K8Zv6Iq6/E= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(346002)(136003)(376002)(39860400002)(396003)(46966006)(36840700001)(2906002)(186003)(6916009)(8936002)(336012)(426003)(478600001)(1076003)(26005)(82310400003)(4326008)(70586007)(2616005)(316002)(70206006)(54906003)(83380400001)(36860700001)(81166007)(86362001)(6666004)(82740400003)(356005)(47076005)(5660300002)(36756003)(7696005)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:06:10.4888 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 430ef928-89cc-4994-0967-08d94b984a6d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0247 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable@vger.kernel.org, jerry.zuo@amd.com, hersenxs.wu@amd.com, Wayne Lin , Nicholas.Kazlauskas@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] Now, after receiving CSN notifying that a port is disconnected, we can unregister child connectors under a branch device via drm_dp_mst_topology_put_mstb() in drm_dp_port_set_pdt(). However, if this reported disconnected port is used to connect to an end device(sst/dp_to_legace converter), we won't unregiser such connector. [How] Take sst/dp_to_legacy conveter device into consideration, also unregister connectors of this case when handling CSN. In addition, check whether port->connector exist to avoid null pointer dereference. Cc: stable@vger.kernel.org Signed-off-by: Wayne Lin --- drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index f13c7187b07f..85a959427247 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -2567,6 +2567,12 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb, else if (create_connector) drm_dp_mst_port_add_connector(mstb, port); + if (port->connector && port->pdt == DP_PEER_DEVICE_NONE) { + drm_connector_unregister(port->connector); + drm_connector_put(port->connector); + port->connector = NULL; + } + out: drm_dp_mst_topology_put_port(port); if (dowork) @@ -4442,10 +4448,12 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, req_slots = DIV_ROUND_UP(pbn, pbn_div); drm_dbg_atomic(mgr->dev, "[CONNECTOR:%d:%s] [MST PORT:%p] VCPI %d -> %d\n", - port->connector->base.id, port->connector->name, + port->connector ? port->connector->base.id : 0, + port->connector ? port->connector->name : "NULL", port, prev_slots, req_slots); drm_dbg_atomic(mgr->dev, "[CONNECTOR:%d:%s] [MST PORT:%p] PBN %d -> %d\n", - port->connector->base.id, port->connector->name, + port->connector ? port->connector->base.id : 0, + port->connector ? port->connector->name : "NULL", port, prev_bw, pbn); /* Add the new allocation to the state */ From patchwork Tue Jul 20 16:03:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lin, Wayne" X-Patchwork-Id: 12388749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EEC2C07E95 for ; Tue, 20 Jul 2021 16:06:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EAB4F60233 for ; Tue, 20 Jul 2021 16:06:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAB4F60233 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2085F6E456; Tue, 20 Jul 2021 16:06:16 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2088.outbound.protection.outlook.com [40.107.94.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9EBF16E456 for ; Tue, 20 Jul 2021 16:06:14 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BQn5n2AhyPnfyDE06VpXkM+lIM+nSpPl2dJ46yO6CVFZ3fKAVgOZwnwYTkac5V+tME0DiuPyzSd7GT381gHVh4XPFKbFc+LADE+M4ibX2Opes9QYLkulGGzJFHeuV42hMw30Yu8aZT4cXAA7ckQX7JiMOTrkwD863uplPyUvPb/0qh58ntLAKtxt+yNWJ/5092Ng+VdoVY/hGQVhrVGLX1nGPqKQxd+ELG1TnJ4KMnVHdwrI2Mb9JdsHKOuHb6DVUl7kr5NZlmE2e4WwrEv9LTmfPh8fAG24h+BMgzJ/vCPLPMnXUI2mldHWwkx+dRrKEMTNKaezS1MAFXcCdYKQew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ObpvobRwDFTxdLEuwNKXCWqKl11FvEP01gDlhjRAz+k=; b=RfvoyBATMLrq7TWz78aG3lF1Xn5JzQ0e/1y+InYXJnHBc5mq9tswGKzBFPtQiuIK/PmbCczbtwWRQLsfcBuOfqgajmb8+82C7NiGxVvkdOGRsn4+66/MlOj0v09gB82jtm8TCOjajxSFZ7wqAe9afqMvpfJ0Vx61ZHNqf0qlEdmCD7jj56xxcIzX3uGYWsipOzAF2jiv1d4zlh5KH3rZg2pKHk8FRII4bkmpMMGOFhjwR2bXWjrBBvwnpDEOeD88mJP0Aal+k9FLcmMn3KX7ziKqU33Mel5ozyFP9tIzX++b8l82DJs2GcCqvaGcB9uTbYbKmVkaM4/U2MKKV9tuPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ObpvobRwDFTxdLEuwNKXCWqKl11FvEP01gDlhjRAz+k=; b=YGC5vTiUGz1AJ7z0ue8qBWd9oVHgWhsN9aEZTDiFrx617lcKgbemL14aDzMtoyjUI2Di1nQYkQiVF3zq8HqYqZurzyvydDppZxjpbOpBj7UQ9w890bVQRqIfYhPnmpYgMvKYkd5q+JpsOpdKhu7Fzs/l3/M7D0h5XsxEx+87F20= Received: from BN9PR03CA0089.namprd03.prod.outlook.com (2603:10b6:408:fc::34) by DM4PR12MB5183.namprd12.prod.outlook.com (2603:10b6:5:396::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.24; Tue, 20 Jul 2021 16:06:12 +0000 Received: from BN8NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fc:cafe::53) by BN9PR03CA0089.outlook.office365.com (2603:10b6:408:fc::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:06:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT045.mail.protection.outlook.com (10.13.177.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:06:12 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 11:06:11 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 09:06:11 -0700 Received: from wayne-System-Product-Name.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:06:09 -0500 From: Wayne Lin To: Subject: [PATCH 4/4] drm/dp_mst: Release disconnected connectors when resume Date: Wed, 21 Jul 2021 00:03:42 +0800 Message-ID: <20210720160342.11415-5-Wayne.Lin@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720160342.11415-1-Wayne.Lin@amd.com> References: <20210720160342.11415-1-Wayne.Lin@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f9052a7b-5e8a-4c8e-8079-08d94b984b73 X-MS-TrafficTypeDiagnostic: DM4PR12MB5183: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ngzJbE1vCiffCaNIF7qLWz7jYwQ1M1TQiJkV0vMGtH+FtLujyeTwZR4HF29Rd99VH3rTFg8UwvP5i9jRKMGIk2GjQwExnL+bt2oGo5qdNfXkOLsB9H3Et55BCUCzIrjfXP6yoRLLeAD0W6MzOhOJqi1q6VIShaMYoI6CyeWE5hFSqP9o4x/LYgtK1PVf/A8SdIcQXhAEJTPG1L+BJTkMUCWFn/QaArM2A8KEhNkCEBV6qlx81ZzHZGU0oMAvKqFdD1LfqE6zwSNihbYePdIgcxNAMpNCJ2ZSYWlPgkzUaxdawikyFvWE2j6jQp1Q5LQEb3vW903kyiIQa2QlxibX2OpPXWJ780LND3XeqJfN/JHJd4CDxBPWcOMBDWiPAV+G9rw4opQhHa+Jg2oxXeLD0d91f40zMMFZ6F42cCpxflGafPdF+Z0ZX9YWCZTeZjoq2G5hfmHhYGgE7xprks0aCM3n6SaF/f19IByUmwD1ShNm1qUhrD978UCkBtbtGlk0hlyVUtfDqSTUjISbE0J2x4/nJ2Jq+PCuY3R1STv0YGyLRPcB3i4iZ2wTqiUW4zIgJSj6TRT0xT+vj6+Bu7ySw80RzKCUFgDv+gef8hK/3KxiZIMREhOCs1HID1OFx+zKUJQRuXdh6q3oek0nVmoTGUSAb8lXU8WochWkKgfABFIqU0psUq8Nw6/yDg4m1QTQEzxVhMqdxydwqUQ+oWQUeGmChuMSFFycG4pTYDSlKGo= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(136003)(396003)(346002)(39860400002)(376002)(36840700001)(46966006)(81166007)(7696005)(36756003)(5660300002)(8936002)(356005)(4326008)(1076003)(36860700001)(26005)(2906002)(47076005)(6916009)(6666004)(70586007)(70206006)(8676002)(82310400003)(83380400001)(186003)(336012)(86362001)(2616005)(426003)(316002)(478600001)(54906003)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:06:12.2079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9052a7b-5e8a-4c8e-8079-08d94b984b73 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5183 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable@vger.kernel.org, jerry.zuo@amd.com, hersenxs.wu@amd.com, Wayne Lin , Nicholas.Kazlauskas@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [why] When resume, we will reprobe the topology to detect any changes during suspend. If we unplug a branch device during suspend and then resume, we can eventually unregister child connectors of this branch device because we call drm_dp_mst_topology_put_mstb() in drm_dp_port_set_pdt(). However, we don't unregister connectors for end devices which is disconnected during suspend. e.g. Unplug a SST monitor during suspend then resume. We won't unregister this connector which is no longer exist in the topology. [How] Unregister connectors for disconnected end devices when resume. Cc: stable@vger.kernel.org Signed-off-by: Wayne Lin --- drivers/gpu/drm/drm_dp_mst_topology.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 85a959427247..0b04ea65cb8e 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -2478,6 +2478,12 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb, drm_dp_mst_is_end_device(port->pdt, port->mcs)) drm_dp_mst_port_add_connector(mstb, port); + if (port->connector && port->pdt == DP_PEER_DEVICE_NONE) { + drm_connector_unregister(port->connector); + drm_connector_put(port->connector); + port->connector = NULL; + } + if (send_link_addr && port->mstb) { ret = drm_dp_send_link_address(mgr, port->mstb); if (ret == 1) /* MSTB below us changed */