Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3110945imu; Mon, 19 Nov 2018 10:46:29 -0800 (PST) X-Google-Smtp-Source: AJdET5e7dwRqTe0+kjrVaQiLg2tZTeFxXbpdzBe3MiWLI/OOC+0l/begsak8PWopzGokA6FgbgZ8 X-Received: by 2002:a63:f515:: with SMTP id w21mr20994864pgh.220.1542653189016; Mon, 19 Nov 2018 10:46:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542653188; cv=none; d=google.com; s=arc-20160816; b=wy+FmTdzWLNt1jNCDlE4mvGKTJ8N8yqqoaviePeQOlRTCj7JynXlJosJDMFWFgYGUa tlO7tSk1CiTku+4TMAG/Whqyferjnli1H3oKfr8s0vMfznPGFodWXyCQrvDsz/h/6YLz hi0Ty02BvOLjv2FlZ7grdwZEv2xGchoxafSwn5vbU8ItHoTMkLy486B8k0Zx/Uz2qIq+ 7XFhKlyG9TVNKDkiVVhF13s39kt9VHBO4wptAl3a/VPISITWBkDrV8uVMPilAQJMOZ2Y JVnigwWKkLlgRbyB/pZ58lF9+qroNfYCtaAJuqd+BJGgClSqBSy4Z79UEhYBjhntfGcf 53Iw== 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=Z0FvFY53NnSTK/ldx+XWjNCPW0AchIVvjvkZa/EsZKU=; b=ObXUQFAisHcERpwAwf6nPX17EygVyJbo0Uso6eKSeRgq++I2FTpdszWRoAFCBk3aiM OEn85kNElG27RBLB6MRtNO/QgmxLKzCTQBdYr1HHYVCQUklUGp6Q2Xbq4VIg2Hp2+8yJ LBbsjF2sSXMryeyYaPJBtIuxhfqqyGNdIoCqq3nuc0WN7pKTc/sKa1FeVMLH7j5+wfqB pqZTEZxn1ofeWvoRQxdxtIbf7iZSi4zLaeXnp/5+DI88RglH87NeiVJxOmVufRTX5Xfp qZMUaJZOtnfwdSe88xs978eUXOhSDaaE4971o6fhTmfozMGwY5PbYCinzbxEKfZAG8KU 6Z+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=atN6wG1v; 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 28si19069523pgw.364.2018.11.19.10.46.14; Mon, 19 Nov 2018 10:46:28 -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=atN6wG1v; 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 S1732686AbeKTDDY (ORCPT + 99 others); Mon, 19 Nov 2018 22:03:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:35968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731712AbeKTDDW (ORCPT ); Mon, 19 Nov 2018 22:03:22 -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 DD154206BA; Mon, 19 Nov 2018 16:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645553; bh=k8BoKETUzD/udOlmmnfNnLMM3ggWU/n8S3cH0K8fjPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=atN6wG1v56cCXmHPy40Tjj/jESgn0CVizbrIchJelyuOP+X9emPT9WVM3XjMUOSf8 vUn8qOxLiCRDwgI1jX2LUAjs6c3U+EEAZdphUxNfh1NVs79Q9HN68BpcpWNh2GcyKX klIOym00foI6vOKe+Q717C9hMq3lEjiwCJLlORa4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Daniel Vetter , Rodrigo Vivi Subject: [PATCH 4.19 187/205] drm/i915: Dont unset intel_connector->mst_port Date: Mon, 19 Nov 2018 17:28:14 +0100 Message-Id: <20181119162641.715574423@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lyude Paul commit 80c188695a77eddaa6e8885510ff4ef59fd478c3 upstream. Currently we set intel_connector->mst_port to NULL to signify that the MST port has been removed from the system so that we can prevent further action on the port such as connector probes, mode probing, etc. However, we're going to need access to intel_connector->mst_port in order to fixup ->best_encoder() so that it can always return the correct encoder for an MST port to prevent legacy DPMS prop changes from failing. This should be safe, so instead keep intel_connector->mst_port always set and instead just check the status of drm_connector->regustered to signify whether or not the connector has disappeared from the system. Changes since v2: - Add a comment to mst_port_gone (Jani Nikula) - Change mst_port_gone to a u8 instead of a bool, per the kernel bot. Apparently bool is discouraged in structs these days Changes since v4: - Don't use mst_port_gone at all! Just check if the connector is registered or not - Daniel Vetter Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter Cc: stable@vger.kernel.org Link: https://patchwork.freedesktop.org/patch/msgid/20181008232437.5571-4-lyude@redhat.com (cherry picked from commit 6ed5bb1fbad34382c8cfe9a9bf737e9a43053df5) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_dp_mst.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c @@ -311,9 +311,8 @@ static int intel_dp_mst_get_ddc_modes(st struct edid *edid; int ret; - if (!intel_dp) { + if (!READ_ONCE(connector->registered)) return intel_connector_update_modes(connector, NULL); - } edid = drm_dp_mst_get_edid(connector, &intel_dp->mst_mgr, intel_connector->port); ret = intel_connector_update_modes(connector, edid); @@ -328,9 +327,10 @@ intel_dp_mst_detect(struct drm_connector struct intel_connector *intel_connector = to_intel_connector(connector); struct intel_dp *intel_dp = intel_connector->mst_port; - if (!intel_dp) + if (!READ_ONCE(connector->registered)) return connector_status_disconnected; - return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, intel_connector->port); + return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, + intel_connector->port); } static void @@ -370,7 +370,7 @@ intel_dp_mst_mode_valid(struct drm_conne int bpp = 24; /* MST uses fixed bpp */ int max_rate, mode_rate, max_lanes, max_link_clock; - if (!intel_dp) + if (!READ_ONCE(connector->registered)) return MODE_ERROR; if (mode->flags & DRM_MODE_FLAG_DBLSCAN) @@ -402,7 +402,7 @@ static struct drm_encoder *intel_mst_ato struct intel_dp *intel_dp = intel_connector->mst_port; struct intel_crtc *crtc = to_intel_crtc(state->crtc); - if (!intel_dp) + if (!READ_ONCE(connector->registered)) return NULL; return &intel_dp->mst_encoders[crtc->pipe]->base.base; } @@ -503,7 +503,6 @@ static void intel_dp_register_mst_connec static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, struct drm_connector *connector) { - struct intel_connector *intel_connector = to_intel_connector(connector); struct drm_i915_private *dev_priv = to_i915(connector->dev); DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); @@ -512,10 +511,6 @@ static void intel_dp_destroy_mst_connect if (dev_priv->fbdev) drm_fb_helper_remove_one_connector(&dev_priv->fbdev->helper, connector); - /* prevent race with the check in ->detect */ - drm_modeset_lock(&connector->dev->mode_config.connection_mutex, NULL); - intel_connector->mst_port = NULL; - drm_modeset_unlock(&connector->dev->mode_config.connection_mutex); drm_connector_put(connector); }