From patchwork Tue Oct 20 07:45:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Almahallawy, Khaled" X-Patchwork-Id: 11845909 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=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 E708FC433DF for ; Tue, 20 Oct 2020 07:45:59 +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 07FD12224F for ; Tue, 20 Oct 2020 07:45:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07FD12224F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2613A6E045; Tue, 20 Oct 2020 07:45:58 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4690C6E045 for ; Tue, 20 Oct 2020 07:45:57 +0000 (UTC) IronPort-SDR: H34M9EIb1Zbbjs1MVHwtQJOJZF3NVF06h0vx6K260D0VKWX7ATRjiVdBF3ZPvAFk0TmBLDIb6B dZ7gjI7NYHgg== X-IronPort-AV: E=McAfee;i="6000,8403,9779"; a="184795983" X-IronPort-AV: E=Sophos;i="5.77,396,1596524400"; d="scan'208";a="184795983" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2020 00:45:56 -0700 IronPort-SDR: QfS6oZ2Z4kplb3l6+SZJAnfZSBtAFxUV9X2N7R18f85FvHyVxLR52cNpQzdfvVx4vTkvli2W3q FZycWzJyMlmg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,396,1596524400"; d="scan'208";a="532949044" Received: from kia-desk.jf.intel.com ([10.23.15.19]) by orsmga005.jf.intel.com with ESMTP; 20 Oct 2020 00:45:56 -0700 From: Khaled Almahallawy To: Intel-gfx@lists.freedesktop.org Date: Tue, 20 Oct 2020 00:45:55 -0700 Message-Id: <20201020074555.24315-1-khaled.almahallawy@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915/tgl: Set drm_crtc_state.active=false for all added disconnected CRTCs sharing MST stream. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: seanpaul@chromium.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This patch avoids failing atomic commits sent by user space by making sure CRTC/Connector added to drm_atomic_state by the driver are in valid state. When disconnecting MST hub with two or more connected displays. The user space sends IOCTL for each MST pipe to disable. drm_atomic_state object sent from user space contains only the state of the crtc/pipe intended to disable. In TGL, intel_dp_mst_atomic_master_trans_check will add all other CRTC and connectors that share the MST stream to drm_atomic_state: drm_atomic_commit drm_atomic_helper_check_modeset update_connector_routing intel_dp_mst_atomic_check = funcs->atomic_check(connector, state); intel_dp_mst_atomic_master_trans_check intel_atomic_get_digital_connector_state drm_atomic_get_connector_state <-- Add all Connectors drm_atomic_get_crtc_state <-- Add all CRTCs update_connector_routing <-- Check added Connector/CRTCs - Will fail However the added crtc/connector pair will be in invalid state (enabled state for a removed connector) triggering this condition in drm_atomic_helper.c/update_connector_routing: if (!state->duplicated && drm_connector_is_unregistered(connector) && crtc_state->active) { DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] is not registered\n", connector->base.id, connector->name); return -EINVAL; } Which will cause the drm_atomic_commit/IOCTL for disabling one of MST stream pipes (Main MST) to fail. The problem happens when a user space (as Chrome) doesn’t retry a falling commit, leaving a disconnected MST pipe still ON, which will result in failing reconnect of MST hub or even worse leaving TC PHY in a connected state while the MST Hub is disconnected. Tested on Ubuntu(drm-tip) and Chrome(kernel-next 5.9 rc7) Signed-off-by: Khaled Almahallawy --- drivers/gpu/drm/i915/display/intel_dp_mst.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index e948aacbd4ab..1ede980876ed 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -265,6 +265,9 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector, return ret; } crtc_state->uapi.mode_changed = true; + + if (connector_iter->base.status == connector_status_disconnected) + crtc_state->uapi.active = false; } drm_connector_list_iter_end(&connector_list_iter);