From: Guillaume Tucker <guillaume.tucker@collabora.com>
To: Ben Skeggs <bskeggs@redhat.com>, Jon Hunter <jonathanh@nvidia.com>
Cc: David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] drm/nouveau/bar/gf100: fix hang when calling ->fini() before ->init()
Date: Wed, 6 Dec 2017 09:22:04 +0000 [thread overview]
Message-ID: <d5b6a012-52c4-dce3-1cc6-3041558e808b@collabora.com> (raw)
In-Reply-To: <CABDvA=krahNw3q+qpEPbbv8Y9fvX4jXc_B54qafwtgFyWpqKWg@mail.gmail.com>
On 05/12/17 18:32, Ben Skeggs wrote:
> On Wed, Dec 6, 2017 at 12:30 AM, Jon Hunter <jonathanh@nvidia.com> wrote:
>
>>
>> On 04/12/17 18:37, Guillaume Tucker wrote:
>>> If the firmware fails to load then ->fini() will be called before the
>>> device has been initialised, causing the kernel to hang while trying
>>> to write to a register. Add a test in ->fini() to avoid this issue.
>>>
>>> This fixes a kernel hang on tegra124.
>>>
>>> Fixes: b17de35a2ebbe ("drm/nouveau/bar: implement bar1 teardown")
>>> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
>>> CC: Ben Skeggs <bskeggs@redhat.com>
>>> ---
>>> drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c | 7 +++++--
>>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
>> b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
>>> index a3ba7f50198b..95e2aba64aad 100644
>>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
>>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
>>> @@ -43,9 +43,12 @@ gf100_bar_bar1_wait(struct nvkm_bar *base)
>>> }
>>>
>>> void
>>> -gf100_bar_bar1_fini(struct nvkm_bar *bar)
>>> +gf100_bar_bar1_fini(struct nvkm_bar *base)
>>> {
>>> - nvkm_mask(bar->subdev.device, 0x001704, 0x80000000, 0x00000000);
>>> + struct nvkm_device *device = base->subdev.device;
>>> +
>>> + if (base->subdev.oneinit)
>>> + nvkm_mask(device, 0x001704, 0x80000000, 0x00000000);
>>> }
>>>
>>> void
>>
>> I have tested this and it works for me. Thanks for fixing this! Would be
>> good to get Ben's ACK, but you can have my ...
>>
> I'd love to get a good explanation as to why it hangs without this change,
> as, on the surface, it's not immediately obvious as to why it's hanging.
To be fair I'm not entirely sure either why this causes a hang, I
haven't read the TRM... The iomem has been mapped at this point,
so accessing the register should work. One clue is when you look
at _bar1_init(), the 0x1704 register is initialised with
some (device instance?) memory address. So it's possible that
the hardware does something special when you set this to 0 as in
_bar1_fini(), which may fail in particular if it was previously
not initialised with a valid address.
This is merely guesswork, would be interested to find out the
real explanation though.
>> Tested-by: Jon Hunter <jonathanh@nvidia.com>
Thanks!
Guillaume
next prev parent reply other threads:[~2017-12-06 9:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 18:37 Guillaume Tucker
2017-12-04 18:37 ` [PATCH 2/2] drm/tegra: sor: Fix hang on tegra124 due to NULL clk_out Guillaume Tucker
2017-12-05 14:30 ` [PATCH 1/2] drm/nouveau/bar/gf100: fix hang when calling ->fini() before ->init() Jon Hunter
[not found] ` <CABDvA=krahNw3q+qpEPbbv8Y9fvX4jXc_B54qafwtgFyWpqKWg@mail.gmail.com>
2017-12-06 9:22 ` Guillaume Tucker [this message]
2017-12-06 17:18 ` Jon Hunter
2017-12-19 22:05 ` Jon Hunter
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=d5b6a012-52c4-dce3-1cc6-3041558e808b@collabora.com \
--to=guillaume.tucker@collabora.com \
--cc=airlied@linux.ie \
--cc=bskeggs@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jonathanh@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®