Received: by 10.223.185.111 with SMTP id b44csp779009wrg; Fri, 9 Mar 2018 13:36:00 -0800 (PST) X-Google-Smtp-Source: AG47ELsQLNYvffxXzF513Y5cS+xW2voIX6mNfzCLjZO6a9GqysPcqqPHKQ1eapSaIL33vZYiAE3X X-Received: by 2002:a17:902:a9c3:: with SMTP id b3-v6mr994555plr.190.1520631360010; Fri, 09 Mar 2018 13:36:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520631359; cv=none; d=google.com; s=arc-20160816; b=IREcfrXEaAXkOeA4L0LBXjpftAD5hOrC6orrqcTUdl3ivi9j5Vxo6EQcSdC5NqOwHV xTqPVCe7Wk7ksVQVPkf1CvZkPst07/nmSKGa0WoVGdsu4r7DvQCd4XDu45fsknb961Jt db5GoOGzETbVjk0OvBWGJatk3Dbp1vVsVr6rgtBULda8RS4KwYQUYSdmJxgwNlNHCvY7 noH7p4r9xzRC+VwwOh8fOA18goj/5tZ09IudVMk+z9s7AOCB+CUx4yiwocEmBu4GMd2J WFY3Rg62O0VxeXNwBrQswf7R0le0I+yvSygSXEiDwD391NB4ybn50FBCY3H79Nhat8BS 3Czg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=5ZZV2EHRIP2VP5Moi2DvH5N3upKnNybhhrNdVHwL0Is=; b=Uq6pIW3ypbG3KVvAl/NHe7QrtK1jyP9CcCtGM3u7+vC++SZR6X0hIMs7P1Jy4ioM3G fJuHAEruO8Nl/Td69x6Nn2VXw1Y4Nv3Vjrxjz1Z7ZFTTf35K4+8RLj+yVABMoR+48l8k 1fU2coIYyVwdc3J3t0WG/PrJ9PsB0S31253Ul9HPxHaCyfAaiAB8m29I7iNIRvDBOUcA PgechtYBtJBVvvNf5beFMfTIKv6A0EYuJnUfk9K2IHHxyGP8eWORSzprK/ft52QK+bji PtYijQ4KyAGwr6ru+TKltPDRtj5dvvLpI9a0K77OYB+pDPOmmNGMl9psbJ/d1jHveAQf Swyg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12-v6si1512118plk.295.2018.03.09.13.35.45; Fri, 09 Mar 2018 13:35:59 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932335AbeCIVdH (ORCPT + 99 others); Fri, 9 Mar 2018 16:33:07 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36898 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751211AbeCIVdG (ORCPT ); Fri, 9 Mar 2018 16:33:06 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 681578151D49; Fri, 9 Mar 2018 21:33:05 +0000 (UTC) Received: from malachite.bss.redhat.com (dhcp-10-20-1-30.bss.redhat.com [10.20.1.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id E47526353B; Fri, 9 Mar 2018 21:33:01 +0000 (UTC) From: Lyude Paul To: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, Manasi Navare , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , linux-kernel@vger.kernel.org Subject: [PATCH v3 1/5] drm/i915: Move DP modeset retry work into intel_dp Date: Fri, 9 Mar 2018 16:32:27 -0500 Message-Id: <20180309213232.19855-1-lyude@redhat.com> In-Reply-To: <20180308232421.14049-1-lyude@redhat.com> References: <20180308232421.14049-1-lyude@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 09 Mar 2018 21:33:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 09 Mar 2018 21:33:05 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lyude@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While having the modeset_retry_work in intel_connector makes sense with SST, this paradigm doesn't make a whole ton of sense when it comes to MST since we have to deal with multiple connectors. In most cases, it's more useful to just use the intel_dp struct since it indicates whether or not we're dealing with an MST device, along with being able to easily trace the intel_dp struct back to it's respective connector (if there is any). So, move the modeset_retry_work function out of the intel_connector struct and into intel_dp. Signed-off-by: Lyude Paul Reviewed-by: Manasi Navare Cc: Manasi Navare Cc: Ville Syrjälä V2: - Remove accidental duplicate modeset_retry_work in intel_connector V3: - Also check against eDP in intel_hpd_poll_fini() - mdnavare Signed-off-by: Lyude Paul --- drivers/gpu/drm/i915/intel_display.c | 25 +++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_dp.c | 10 ++++------ drivers/gpu/drm/i915/intel_dp_link_training.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 6 +++--- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index f424fff477f6..3b7fa430a84a 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -15394,16 +15394,37 @@ static void intel_hpd_poll_fini(struct drm_device *dev) { struct intel_connector *connector; struct drm_connector_list_iter conn_iter; + struct work_struct *work; + int conn_type; /* Kill all the work that may have been queued by hpd. */ drm_connector_list_iter_begin(dev, &conn_iter); for_each_intel_connector_iter(connector, &conn_iter) { - if (connector->modeset_retry_work.func) - cancel_work_sync(&connector->modeset_retry_work); if (connector->hdcp_shim) { cancel_delayed_work_sync(&connector->hdcp_check_work); cancel_work_sync(&connector->hdcp_prop_work); } + + conn_type = connector->base.connector_type; + if (conn_type != DRM_MODE_CONNECTOR_eDP && + conn_type != DRM_MODE_CONNECTOR_DisplayPort) + continue; + + if (connector->mst_port) { + work = &connector->mst_port->modeset_retry_work; + } else { + struct intel_encoder *intel_encoder = + connector->encoder; + struct intel_dp *intel_dp; + + if (!intel_encoder) + continue; + + intel_dp = enc_to_intel_dp(&intel_encoder->base); + work = &intel_dp->modeset_retry_work; + } + + cancel_work_sync(work); } drm_connector_list_iter_end(&conn_iter); } diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 4dd1b2287dd6..5abf0c95725a 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -6261,12 +6261,10 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, static void intel_dp_modeset_retry_work_fn(struct work_struct *work) { - struct intel_connector *intel_connector; - struct drm_connector *connector; + struct intel_dp *intel_dp = container_of(work, typeof(*intel_dp), + modeset_retry_work); + struct drm_connector *connector = &intel_dp->attached_connector->base; - intel_connector = container_of(work, typeof(*intel_connector), - modeset_retry_work); - connector = &intel_connector->base; DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); @@ -6295,7 +6293,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, int type; /* Initialize the work for modeset in case of link train failure */ - INIT_WORK(&intel_connector->modeset_retry_work, + INIT_WORK(&intel_dp->modeset_retry_work, intel_dp_modeset_retry_work_fn); if (WARN(intel_dig_port->max_lanes < 1, diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c index f59b59bb0a21..2cfa58ce1f95 100644 --- a/drivers/gpu/drm/i915/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c @@ -340,7 +340,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) intel_dp->link_rate, intel_dp->lane_count)) /* Schedule a Hotplug Uevent to userspace to start modeset */ - schedule_work(&intel_connector->modeset_retry_work); + schedule_work(&intel_dp->modeset_retry_work); } else { DRM_ERROR("[CONNECTOR:%d:%s] Link Training failed at link rate = %d, lane count = %d", intel_connector->base.base.id, diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 83e5ca889d9c..3f19dc80997f 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -406,9 +406,6 @@ struct intel_connector { struct intel_dp *mst_port; - /* Work struct to schedule a uevent on link train failure */ - struct work_struct modeset_retry_work; - const struct intel_hdcp_shim *hdcp_shim; struct mutex hdcp_mutex; uint64_t hdcp_value; /* protected by hdcp_mutex */ @@ -1135,6 +1132,9 @@ struct intel_dp { /* Displayport compliance testing */ struct intel_dp_compliance compliance; + + /* Work struct to schedule a uevent on link train failure */ + struct work_struct modeset_retry_work; }; struct intel_lspcon { -- 2.14.3