All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Ben Skeggs <skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH] drm/nouveau: POST the card before GPIO initialization
Date: Fri, 14 Sep 2012 00:21:33 +0200	[thread overview]
Message-ID: <20120913222133.GA8982@joi.lan> (raw)

Otherwise my card (nv92) never resumes from suspend to ram, hanging on
nv_mask in nv50_gpio_drive. Before rework, initialization was done only
from POST, so this patch restores previous behaviour.

Signed-off-by: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---

Let me tell you little story about this patch...

It took me ~week to figure it out.
1) I bisected it to "drm/nouveau/gpio: port gpio to subdev interfaces", but
looking at this commit I couldn't spot anything (who would...).
2) Netconsole hanged immediately on boot (I found the commit which broke
netconsole and it turned out to be already known broken with patch fixing it
waiting for pull).
3) Even with netconsole working, completely nothing reached netconsole across
S/R - I had to add no_console_suspend on kernel command line to see anything.
4) I still couldn't see anything Nouveau related, because Nouveau tried to
resume before network card... (so when network card finally resumed on another
CPU, Nouveau's resume was already hanging)
5) With information from 1) I found hanging code by placing BUG()'s in various
places and seeing if network card resumed...
6) Then I had the idea to add msleep(10000) at the beginning of
nouveau_drm_resume and voila! I could see Nouveau resuming.
7) ... But I still couldn't see debugging messages (only KERN_INFO and above),
so I patched nv_printk to emit all debugging messages on KERN_INFO level.
8) I checked all variables in nv50_gpio_reset to see if dcb entries are
calculated correctly - they were.
9) At this point my S/R counter reached ~40, so I started to wonder how to
debug it without actually doing S/R. So I came up with an idea of booting
with NvForcePost=1. With all debugging messages reaching console I hit
what turned out to be vgacon/Nouveau memory corruption bug... Facepalm.
I fixed it 2 days later (patch posted yesterday), but... I still couldn't
reproduce original issue without suspending.
10) And then... I noticed in resume log that GPIO init is the very first thing
Nouveau does on resume. Moving GPIO init after POST fixed everything. Yeah!

PS: Yes, I know my English is awkward - sorry about it.

---
 drivers/gpu/drm/nouveau/core/include/core/device.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/core/include/core/device.h b/drivers/gpu/drm/nouveau/core/include/core/device.h
index 588deb9..3a6482e 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/device.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/device.h
@@ -8,11 +8,11 @@
 enum nv_subdev_type {
 	NVDEV_SUBDEV_DEVICE,
 	NVDEV_SUBDEV_VBIOS,
-	NVDEV_SUBDEV_GPIO,
 	NVDEV_SUBDEV_I2C,
 	NVDEV_SUBDEV_CLOCK,
 	NVDEV_SUBDEV_MXM,
 	NVDEV_SUBDEV_DEVINIT,
+	NVDEV_SUBDEV_GPIO,
 	NVDEV_SUBDEV_MC,
 	NVDEV_SUBDEV_TIMER,
 	NVDEV_SUBDEV_FB,
-- 
1.7.12

             reply	other threads:[~2012-09-13 22:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13 22:21 Marcin Slusarz [this message]
     [not found] ` <20120913222133.GA8982-OI9uyE9O0yo@public.gmane.org>
2012-09-14  6:44   ` [PATCH] drm/nouveau: POST the card before GPIO initialization Ben Skeggs
     [not found]     ` <20120914064459.GE4289-7ZJhIA9XobDzA+JJ9lL7d4GKTjYczspe@public.gmane.org>
2012-09-14 11:45       ` Marcin Slusarz
     [not found]         ` <20120914114518.GA3619-OI9uyE9O0yo@public.gmane.org>
2012-09-14 12:28           ` Ben Skeggs
2012-09-16 23:15           ` Marcin Slusarz
     [not found]             ` <20120916231524.GA25218-OI9uyE9O0yo@public.gmane.org>
2012-09-18 15:38               ` Ben Skeggs

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=20120913222133.GA8982@joi.lan \
    --to=marcin.slusarz-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.