From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Alexandre Courbot
<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
Haojian Zhuang
<haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>,
Stefano Stabellini
<stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ@public.gmane.org>,
Christoffer Dall
<christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] ARM: tegra: Use PMC scratch register 40 for tegra_resume() location store
Date: Thu, 8 Jan 2015 11:57:43 +0100 [thread overview]
Message-ID: <20150108105742.GI1987@ulmo.nvidia.com> (raw)
In-Reply-To: <54985C30.7020605-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2995 bytes --]
On Mon, Dec 22, 2014 at 11:00:16AM -0700, Stephen Warren wrote:
> On 12/22/2014 10:27 AM, Dmitry Osipenko wrote:
> >22.12.2014 19:17, Stephen Warren пишет:
> >>On 12/21/2014 03:52 PM, Dmitry Osipenko wrote:
> >>>Commit 7232398abc6a ("ARM: tegra: Convert PMC to a driver") changed
> >>>tegra_resume()
> >>>location storing from late to early and as result broke suspend on tegra20.
> >>>PMC scratch register 41 was used by tegra lp1 suspend core code for storing
> >>>physical memory address of common resume function and in the same time used by
> >>>tegra20 cpuidle driver for storing cpu1 "resettable" status, so it implied
> >>>strict order of scratch register use. Fix it by using scratch 40 instead of 41
> >>>for tegra_resume() location store.
> >>
> >>You likely can't simply change the PMC scratch register usage arbitrarily;
> >>specific registers are designated for specific purposes, and code outside the
> >>Linux kernel (bootloaders, LP0 resume code, secure monitors, etc.) may depend on
> >>those specific values being in those registers. Without significant research,
> >>I'd suggest not changing the PMC scratch register usage.
> >
> >Sure, that's why I asked to verify if scratch register 40 is in use in the
> >comment after commit message.
>
> Sorry, I didn't notice that.
>
> >I've checked that u-boot doesn't use it (since
> >upstream kernel doesn't care about any other bootloader), but no idea about
> >secure monitor. It's definitely safer to avoid changing scratch regs usage, I
> >thought that proposed solution would be best from the pure code point of view.
> >So, I'm considering your answer as a rejection of the patch (please, let me know
> >if I'm wrong) and will prepare another one. Btw, it would be nice to have
> >scratch registers usage publicly documented somewhere (on "Tegra Public
> >Application Notes" webpage for example), if it's possible, of course.
>
> At this stage in Tegra20 development, I think it'd be best to avoid changing
> any scratch register usage if at all possible.
Sorry, I had completely missed this discussion. When looking at the code
it doesn't look like this particular "resettable" status needs to be
stored in a PMC scratch register. It can't be stored in RAM because that
goes into self-refresh as part of LP1, but how about just putting it
into IRAM? That stays on in both LP1 and LP2, so should be suitable for
this use-case. It would make the code slightly more complex but using a
single scratch register for multiple purposes sounds brittle and easy to
break (as evidenced by the offending commit).
Otherwise it would seem that PMC_SCRATCH40 is only used to store EMC
configuration data across LP0 suspend/resume, so I wouldn't think it'd
cause problems if we used that instead of PMC_SCRATCH41 to store the
"resettable" state.
Changing the storage location for tegra_resume() isn't such a good idea
since that's a documented use of PMC_SCRATCH41.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: tegra: Use PMC scratch register 40 for tegra_resume() location store
Date: Thu, 8 Jan 2015 11:57:43 +0100 [thread overview]
Message-ID: <20150108105742.GI1987@ulmo.nvidia.com> (raw)
In-Reply-To: <54985C30.7020605@wwwdotorg.org>
On Mon, Dec 22, 2014 at 11:00:16AM -0700, Stephen Warren wrote:
> On 12/22/2014 10:27 AM, Dmitry Osipenko wrote:
> >22.12.2014 19:17, Stephen Warren ?????:
> >>On 12/21/2014 03:52 PM, Dmitry Osipenko wrote:
> >>>Commit 7232398abc6a ("ARM: tegra: Convert PMC to a driver") changed
> >>>tegra_resume()
> >>>location storing from late to early and as result broke suspend on tegra20.
> >>>PMC scratch register 41 was used by tegra lp1 suspend core code for storing
> >>>physical memory address of common resume function and in the same time used by
> >>>tegra20 cpuidle driver for storing cpu1 "resettable" status, so it implied
> >>>strict order of scratch register use. Fix it by using scratch 40 instead of 41
> >>>for tegra_resume() location store.
> >>
> >>You likely can't simply change the PMC scratch register usage arbitrarily;
> >>specific registers are designated for specific purposes, and code outside the
> >>Linux kernel (bootloaders, LP0 resume code, secure monitors, etc.) may depend on
> >>those specific values being in those registers. Without significant research,
> >>I'd suggest not changing the PMC scratch register usage.
> >
> >Sure, that's why I asked to verify if scratch register 40 is in use in the
> >comment after commit message.
>
> Sorry, I didn't notice that.
>
> >I've checked that u-boot doesn't use it (since
> >upstream kernel doesn't care about any other bootloader), but no idea about
> >secure monitor. It's definitely safer to avoid changing scratch regs usage, I
> >thought that proposed solution would be best from the pure code point of view.
> >So, I'm considering your answer as a rejection of the patch (please, let me know
> >if I'm wrong) and will prepare another one. Btw, it would be nice to have
> >scratch registers usage publicly documented somewhere (on "Tegra Public
> >Application Notes" webpage for example), if it's possible, of course.
>
> At this stage in Tegra20 development, I think it'd be best to avoid changing
> any scratch register usage if at all possible.
Sorry, I had completely missed this discussion. When looking at the code
it doesn't look like this particular "resettable" status needs to be
stored in a PMC scratch register. It can't be stored in RAM because that
goes into self-refresh as part of LP1, but how about just putting it
into IRAM? That stays on in both LP1 and LP2, so should be suitable for
this use-case. It would make the code slightly more complex but using a
single scratch register for multiple purposes sounds brittle and easy to
break (as evidenced by the offending commit).
Otherwise it would seem that PMC_SCRATCH40 is only used to store EMC
configuration data across LP0 suspend/resume, so I wouldn't think it'd
cause problems if we used that instead of PMC_SCRATCH41 to store the
"resettable" state.
Changing the storage location for tegra_resume() isn't such a good idea
since that's a documented use of PMC_SCRATCH41.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150108/30d5bef1/attachment.sig>
WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: Dmitry Osipenko <digetx@gmail.com>,
Alexandre Courbot <gnurou@gmail.com>,
Joseph Lo <josephl@nvidia.com>,
stable@vger.kernel.org, Russell King <linux@arm.linux.org.uk>,
Haojian Zhuang <haojian.zhuang@gmail.com>,
Sekhar Nori <nsekhar@ti.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Christoffer Dall <christoffer.dall@linaro.org>,
Shawn Guo <shawn.guo@linaro.org>,
linux-arm-kernel@lists.infradead.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: tegra: Use PMC scratch register 40 for tegra_resume() location store
Date: Thu, 8 Jan 2015 11:57:43 +0100 [thread overview]
Message-ID: <20150108105742.GI1987@ulmo.nvidia.com> (raw)
In-Reply-To: <54985C30.7020605@wwwdotorg.org>
[-- Attachment #1: Type: text/plain, Size: 2995 bytes --]
On Mon, Dec 22, 2014 at 11:00:16AM -0700, Stephen Warren wrote:
> On 12/22/2014 10:27 AM, Dmitry Osipenko wrote:
> >22.12.2014 19:17, Stephen Warren пишет:
> >>On 12/21/2014 03:52 PM, Dmitry Osipenko wrote:
> >>>Commit 7232398abc6a ("ARM: tegra: Convert PMC to a driver") changed
> >>>tegra_resume()
> >>>location storing from late to early and as result broke suspend on tegra20.
> >>>PMC scratch register 41 was used by tegra lp1 suspend core code for storing
> >>>physical memory address of common resume function and in the same time used by
> >>>tegra20 cpuidle driver for storing cpu1 "resettable" status, so it implied
> >>>strict order of scratch register use. Fix it by using scratch 40 instead of 41
> >>>for tegra_resume() location store.
> >>
> >>You likely can't simply change the PMC scratch register usage arbitrarily;
> >>specific registers are designated for specific purposes, and code outside the
> >>Linux kernel (bootloaders, LP0 resume code, secure monitors, etc.) may depend on
> >>those specific values being in those registers. Without significant research,
> >>I'd suggest not changing the PMC scratch register usage.
> >
> >Sure, that's why I asked to verify if scratch register 40 is in use in the
> >comment after commit message.
>
> Sorry, I didn't notice that.
>
> >I've checked that u-boot doesn't use it (since
> >upstream kernel doesn't care about any other bootloader), but no idea about
> >secure monitor. It's definitely safer to avoid changing scratch regs usage, I
> >thought that proposed solution would be best from the pure code point of view.
> >So, I'm considering your answer as a rejection of the patch (please, let me know
> >if I'm wrong) and will prepare another one. Btw, it would be nice to have
> >scratch registers usage publicly documented somewhere (on "Tegra Public
> >Application Notes" webpage for example), if it's possible, of course.
>
> At this stage in Tegra20 development, I think it'd be best to avoid changing
> any scratch register usage if at all possible.
Sorry, I had completely missed this discussion. When looking at the code
it doesn't look like this particular "resettable" status needs to be
stored in a PMC scratch register. It can't be stored in RAM because that
goes into self-refresh as part of LP1, but how about just putting it
into IRAM? That stays on in both LP1 and LP2, so should be suitable for
this use-case. It would make the code slightly more complex but using a
single scratch register for multiple purposes sounds brittle and easy to
break (as evidenced by the offending commit).
Otherwise it would seem that PMC_SCRATCH40 is only used to store EMC
configuration data across LP0 suspend/resume, so I wouldn't think it'd
cause problems if we used that instead of PMC_SCRATCH41 to store the
"resettable" state.
Changing the storage location for tegra_resume() isn't such a good idea
since that's a documented use of PMC_SCRATCH41.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-01-08 10:57 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-21 22:52 [PATCH] ARM: tegra: Use PMC scratch register 40 for tegra_resume() location store Dmitry Osipenko
2014-12-21 22:52 ` Dmitry Osipenko
2014-12-21 22:52 ` Dmitry Osipenko
2014-12-22 16:17 ` Stephen Warren
2014-12-22 16:17 ` Stephen Warren
[not found] ` <54984429.8040905-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-12-22 17:27 ` Dmitry Osipenko
2014-12-22 17:27 ` Dmitry Osipenko
2014-12-22 17:27 ` Dmitry Osipenko
[not found] ` <5498549B.8070101-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-12-22 18:00 ` Stephen Warren
2014-12-22 18:00 ` Stephen Warren
2014-12-22 18:00 ` Stephen Warren
[not found] ` <54985C30.7020605-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-01-08 10:57 ` Thierry Reding [this message]
2015-01-08 10:57 ` Thierry Reding
2015-01-08 10:57 ` Thierry Reding
2015-01-08 12:37 ` Peter De Schrijver
2015-01-08 12:37 ` Peter De Schrijver
2015-01-08 12:37 ` Peter De Schrijver
2015-01-09 9:51 ` Thierry Reding
2015-01-09 9:51 ` Thierry Reding
2015-01-09 9:51 ` Thierry Reding
2015-01-09 10:29 ` Peter De Schrijver
2015-01-09 10:29 ` Peter De Schrijver
2015-01-09 10:29 ` Peter De Schrijver
[not found] ` <20150109102922.GC10073-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2015-01-09 14:36 ` Dmitry Osipenko
2015-01-09 14:36 ` Dmitry Osipenko
2015-01-09 14:36 ` Dmitry Osipenko
2015-01-09 16:57 ` Stephen Warren
2015-01-09 16:57 ` Stephen Warren
2015-01-09 16:57 ` Stephen Warren
2015-01-09 17:07 ` Dmitry Osipenko
2015-01-09 17:07 ` Dmitry Osipenko
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=20150108105742.GI1987@ulmo.nvidia.com \
--to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nsekhar-l0cyMroinI0@public.gmane.org \
--cc=shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@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.