Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2907554imm; Mon, 16 Jul 2018 17:00:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdvdWmOlfLPu0O3OgDRxVEooLKv/I9NO5I/645tZUnMb1fpEV5xAkmEb/SoRF/8ZeaS5ueR X-Received: by 2002:aa7:850b:: with SMTP id v11-v6mr19639652pfn.165.1531785659414; Mon, 16 Jul 2018 17:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531785659; cv=none; d=google.com; s=arc-20160816; b=SCZ9uCGV+T4PrSLr7QCGiLopsaLqE1C+QXaRtZv0WsBgXxhh2SVKsAuoqrOFl0Qclo TDX8Q7kMu8w8sDjPUz4L2TChhNYMgnvGxYlQUYX1PCaRhDYEAGp8+7/15349cYJPhxHP EMwUyVQijvq1rxRUweIacJTwYvqRv3r5llHuozGIW1u0OcWbGXYfgvpkj3EhEqJpJS57 M3K3MMyhjSKJF6R/8MfVKyCF5xqFla8y6Ouslq/MjLneT/C0OxmGrpTa8DCeuWqH+aCN 6006J9YakzV/N3O5dG6JDu/tLVt0Tz55Hk9wf6POAcfAbmMNAvf77UD3qdQkIQex2aGE FThw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=6LwpJ/iYx2/heTjuittO1Ob1cYOXcpbnbUm9g0Vs/vM=; b=u7KJnq0nzl0XOPcLwuOtMs+3ANR5cf9A0NZbVm0693TfZaYhaVrfP4k7l7eqTjK395 JTTLj5V4dl9cqlU/oucghMqKyXg61ugKbIXDHT0Zrslt9x/mTneAR8hW0nAXb2j2aH2H fEqNhdE09uL7Oi6Fee6j3oeeRr07RHKOW7fHxQpnCmw58fSDBGIW2ndpWnDJNXWXar4o a6qhNiZDoXplB/8QGRgegDkVOWtjgI5oTPfJgfDOjnhd4KxUo4oxSgBi3RFRqrsHE8lg eR6ejdFWbRWlE82/yMexUk6j/WcW+Ama61VWneW9jCnmrPaK44XuOv/2jAexW0k66kE4 4pZg== 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 t188-v6si26895192pfd.148.2018.07.16.17.00.44; Mon, 16 Jul 2018 17:00:59 -0700 (PDT) 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 S1729934AbeGQA3q (ORCPT + 99 others); Mon, 16 Jul 2018 20:29:46 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56650 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729613AbeGQA3q (ORCPT ); Mon, 16 Jul 2018 20:29:46 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6F2C281A4EB9; Tue, 17 Jul 2018 00:00:00 +0000 (UTC) Received: from whitewolf.lyude.net.com (ovpn-124-27.rdu2.redhat.com [10.10.124.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id C878A2026D65; Mon, 16 Jul 2018 23:59:59 +0000 (UTC) From: Lyude Paul To: nouveau@lists.freedesktop.org Cc: Karol Herbst , stable@vger.kernel.org, Ben Skeggs , David Airlie , Daniel Vetter , Maarten Lankhorst , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] drm/nouveau: Add missing RPM get/put() when probing connectors Date: Mon, 16 Jul 2018 19:59:27 -0400 Message-Id: <20180716235936.11268-4-lyude@redhat.com> In-Reply-To: <20180716235936.11268-1-lyude@redhat.com> References: <20180716235936.11268-1-lyude@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 17 Jul 2018 00:00:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 17 Jul 2018 00:00:00 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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 the GPU is guaranteed to be on when a hotplug has been received, the same assertion does not hold true if a connector probe has been started by userspace without having had received a sysfs event. So ensure that any connector probing keeps the GPU alive for the duration of the probe. Signed-off-by: Lyude Paul Cc: Karol Herbst Cc: stable@vger.kernel.org --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 21 +++++++++++++++++++-- drivers/gpu/drm/nouveau/nouveau_connector.h | 3 +++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index ea2a886854fe..0f283ca75189 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -858,7 +858,7 @@ static const struct drm_connector_funcs nv50_mstc = { .reset = nouveau_conn_reset, .detect = nv50_mstc_detect, - .fill_modes = drm_helper_probe_single_connector_modes, + .fill_modes = nouveau_connector_probe_single_connector_modes, .destroy = nv50_mstc_destroy, .atomic_duplicate_state = nouveau_conn_atomic_duplicate_state, .atomic_destroy_state = nouveau_conn_atomic_destroy_state, diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 2a45b4c2ceb0..feb142fb7a8a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -770,6 +770,23 @@ nouveau_connector_force(struct drm_connector *connector) nouveau_connector_set_encoder(connector, nv_encoder); } +int +nouveau_connector_probe_single_connector_modes(struct drm_connector *connector, + uint32_t maxX, uint32_t maxY) +{ + struct device *dev = connector->dev->dev; + int ret; + + ret = pm_runtime_get_sync(dev); + if (WARN_ON(ret < 0 && ret != -EACCES)) + return 0; + + ret = drm_helper_probe_single_connector_modes(connector, maxX, maxY); + + pm_runtime_put_autosuspend(dev); + return ret; +} + static int nouveau_connector_set_property(struct drm_connector *connector, struct drm_property *property, uint64_t value) @@ -1088,7 +1105,7 @@ nouveau_connector_funcs = { .reset = nouveau_conn_reset, .detect = nouveau_connector_detect, .force = nouveau_connector_force, - .fill_modes = drm_helper_probe_single_connector_modes, + .fill_modes = nouveau_connector_probe_single_connector_modes, .set_property = nouveau_connector_set_property, .destroy = nouveau_connector_destroy, .atomic_duplicate_state = nouveau_conn_atomic_duplicate_state, @@ -1103,7 +1120,7 @@ nouveau_connector_funcs_lvds = { .reset = nouveau_conn_reset, .detect = nouveau_connector_detect_lvds, .force = nouveau_connector_force, - .fill_modes = drm_helper_probe_single_connector_modes, + .fill_modes = nouveau_connector_probe_single_connector_modes, .set_property = nouveau_connector_set_property, .destroy = nouveau_connector_destroy, .atomic_duplicate_state = nouveau_conn_atomic_duplicate_state, diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h index 2d9d35a146a4..e9ffc6eebda2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.h +++ b/drivers/gpu/drm/nouveau/nouveau_connector.h @@ -106,6 +106,9 @@ nouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc) struct drm_connector * nouveau_connector_create(struct drm_device *, const struct dcb_output *); +int +nouveau_connector_probe_single_connector_modes(struct drm_connector *, + uint32_t, uint32_t); extern int nouveau_tv_disable; extern int nouveau_ignorelid; -- 2.17.1