From: Lyude Paul <lyude@redhat.com>
To: nouveau@lists.freedesktop.org
Cc: "Karol Herbst" <karolherbst@gmail.com>,
stable@vger.kernel.org, "Ben Skeggs" <bskeggs@redhat.com>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
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 [thread overview]
Message-ID: <20180716235936.11268-4-lyude@redhat.com> (raw)
In-Reply-To: <20180716235936.11268-1-lyude@redhat.com>
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 <lyude@redhat.com>
Cc: Karol Herbst <karolherbst@gmail.com>
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
next prev parent reply other threads:[~2018-07-17 0:00 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-16 23:59 [PATCH 0/5] drm/nouveau: Fix a lot of nasty RPM bugs and deadlocks Lyude Paul
2018-07-16 23:59 ` [PATCH 1/5] drm/nouveau: Prevent RPM callback recursion in suspend/resume paths Lyude Paul
2018-07-17 7:16 ` [Nouveau] " Lukas Wunner
2018-07-17 7:39 ` Rafael J. Wysocki
2018-07-17 16:53 ` Lyude Paul
2018-07-17 18:20 ` Lukas Wunner
2018-07-17 18:24 ` Lyude Paul
2018-07-17 18:32 ` Lukas Wunner
2018-07-17 18:34 ` Lyude Paul
2018-07-18 7:40 ` Rafael J. Wysocki
2018-07-18 7:47 ` Lukas Wunner
2018-07-18 7:38 ` Rafael J. Wysocki
2018-07-18 8:25 ` Lukas Wunner
2018-07-18 8:35 ` Rafael J. Wysocki
2018-07-18 8:36 ` Lukas Wunner
2018-07-18 20:11 ` Lyude Paul
2018-07-18 21:49 ` Rafael J. Wysocki
2018-07-16 23:59 ` [PATCH 2/5] drm/nouveau: Grab RPM ref while probing outputs Lyude Paul
2018-07-17 7:21 ` [Nouveau] " Lukas Wunner
2018-07-17 10:12 ` Karol Herbst
2018-07-16 23:59 ` Lyude Paul [this message]
2018-07-17 10:11 ` [Nouveau] [PATCH 3/5] drm/nouveau: Add missing RPM get/put() when probing connectors Karol Herbst
2018-07-16 23:59 ` [PATCH 4/5] drm/nouveau: Grab RPM ref when i2c bus is in use Lyude Paul
2018-07-17 10:17 ` [Nouveau] " Karol Herbst
2018-07-17 11:54 ` Ben Skeggs
2018-07-17 12:10 ` Karol Herbst
2018-07-16 23:59 ` [PATCH 5/5] drm/nouveau: Grab RPM ref when aux " Lyude Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180716235936.11268-4-lyude@redhat.com \
--to=lyude@redhat.com \
--cc=airlied@linux.ie \
--cc=bskeggs@redhat.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=karolherbst@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=nouveau@lists.freedesktop.org \
--cc=stable@vger.kernel.org \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).