linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Hunter <jon-hunter@ti.com>
To: "Cousson, Benoit" <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>, Paul Walmsley <paul@pwsan.com>,
	Ming Lei <ming.lei@canonical.com>,
	Will Deacon <will.deacon@arm.com>,
	Maynard Johnson <maynardj@us.ibm.com>,
	"Shilimkar, Santosh" <santosh.shilimkar@ti.com>,
	"oprofile-list@lists.sourceforge.net"
	<oprofile-list@lists.sourceforge.net>,
	Lik Lik <lik88888@gmail.com>,
	"eranian@gmail.com" <eranian@gmail.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: oprofile and ARM A9 hardware counter
Date: Wed, 9 May 2012 16:45:08 -0500	[thread overview]
Message-ID: <4FAAE564.6040708@ti.com> (raw)
In-Reply-To: <4FAAC549.6010206@ti.com>

Hi All,

On 05/09/2012 02:28 PM, Jon Hunter wrote:

[...]

>>>>> No hacking intended here, just getting the flags correct ;-)
>>>>>
>>>>> So let me start from the beginning ...
>>>>>
>>>>> 1. I agree that for the EMU CD that the valid HW states are HW_AUTO and
>>>>> SW_WKUP.
>>>>>
>>>>> 2. When the EMU CD is active (due to something like PMU), we want to
>>>>> keep the CD in the SW_WKUP state, otherwise we can automatically
>>>>> transition to idle and reset the IP (at least for omap4430).
>>>>
>>>>> 3. When the EMU CD is inactive, we want to keep the CD in the HW_AUTO
>>>>> state because SW_SLEEP is NOT supported.
>>>>>
>>>>> In the current code, we have the CLKDM_CAN_DISABLE_AUTO flag disabled
>>>>> and the CLKDM_CAN_ENABLE_AUTO flag enabled. If CLKDM_CAN_ENABLE_AUTO is
>>>>> set then the omap_pm_clkdms_setup() function will place the CD into
>>>>> HW_AUTO regardless of CLKDM_CAN_DISABLE_AUTO, and the next time the
>>>>> hwmod _enable() is called it is in the HW_AUTO state and so it is
>>>>> allowed to idle. This is not what we want. Do you agree?
>>>>>
>>>>> If I set CLKDM_CAN_DISABLE_AUTO flag and disable CLKDM_CAN_ENABLE_AUTO,
>>>>> then I do not have the above problem.
>>>>>
>>>>> To be honest, with you the more I look and test the code, the more
>>>>> confused I am by the definition of the CLKDM_CAN_HWSUP ...
>>>>>
>>>>> #define CLKDM_CAN_HWSUP	(CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)
>>>>>
>>>>> When I look at where these flags are used, I see that
>>>>> CLKDM_CAN_ENABLE_AUTO is used in clkdm_allow_idle and
>>>>> CLKDM_CAN_DISABLE_AUTO is used in clkdm_deny_idle. So this implies that ...
>>>>>
>>>>> CLKDM_CAN_ENABLE_AUTO = Supports HW_AUTO state when CD is active
>>>>> CLKDM_CAN_DISABLE_AUTO = Does NOT supports HW_AUTO state when CD is active
>>>>>
>>>>> Are the above the correct definitions?
>>>>
>>>> Not quite.
>>>>
>>>> These flags describe the capabilities as defined in CLKTRCTRL field of
>>>> the CLKSTCTRL register (e.g. CM_EMU_CLKSTCTRL)
>>>>
>>>> CLKDM_CAN_ENABLE_AUTO: IP supports HW_AUTO state (and it can be enabled)
>>>> CLKDM_CAN_DISABLE_AUTO: HW_AUTO feature can be disabled (a.k.a. NO_SLEEP)
>>>>
>>>> Note that in OMAP4, the latter called NO_SLEEP in the TRM, but in OMAP3
>>>> it's described as "The automatic hardware-supervised mode is disabled"
>>>
>>> Yeah, in fact this is the source of the current confusion for my point of view.
>>>
>>> We chat about that with Paul some time back.
>>>  
>>> EMU CD does support HW_AUTO and SW_WKUP, so it means that if you want to disable the AUTO mode you can use the SW_WKUP.
>>> Assuming that CLKDM_CAN_DISABLE_AUTO is equivalent to NO_SLEEP is thus not correct. In fact any state != HW_AUTO should be considered a non-automatic mode.
>>> So EMU does support CLKDM_CAN_ENABLE_AUTO, CLKDM_CAN_DISABLE_AUTO and CLKDM_CAN_FORCE_WAKEUP.
>>>
>>> But the way it is implemented does not really allow that, because disable hwsup imply setting state to OMAP34XX_CLKSTCTRL_DISABLE_AUTO.
>>>
>>> void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs)
>>> {
>>>         _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, part, inst, cdoffs);
>>> }
>>>
>>> So if we want to allow that, some code change are needed in order to set the clkdm mode to OMAP34XX_CLKSTCTRL_FORCE_WAKEUP if OMAP34XX_CLKSTCTRL_DISABLE_AUTO is not supported.
>>>
>>>> What is confusing to me is that the OMAP4 TRM doesn't list the NO_SLEEP
>>>> mode as supported by the EMU.   It seems to me that if the IP supports
>>>> HW_AUTO, it should be able to be enabled *and* disabled.
>>>
>>> No, not really, this is mostly OMAP3 legacy, and we do have plan to remove these useless modes going forward. We can effectively disable AUTO mode by going to FORCE_WAKEUP.
>>>
>>> - 0x0 NO_SLEEP A clock domain sleep transition is never initiated, irrespective of the hardware conditions.
>>> - 0x1 SW_SLEEP A software-forced sleep transition. The transition is initiated when the associated hardware conditions are satisfied
>>> - 0x2 SW_WKUP A software-forced clock domain wake-up transition is initiated, irrespective of the hardware conditions.
>>> - 0x3 HW_AUTO Hardware-controlled automatic sleep and wake-up transition is initiated by the PRCM module when the associated hardware conditions are satisfied
>>>
>>>
>>> On OMAP4, SW_SLEEP is equivalent to ENABLE_AUTO and 
>>> NO_SLEEP is equivalent to SW_WKUP. There are some slight differences inside the HW, but in term of functionality this is mostly equivalent.
>>>
>>>
>>> Bottom-line, if we fix the omap4_cminst_clkdm_disable_hwsup, we can consider that the EMU CD does support CLKDM_CAN_ENABLE_AUTO, CLKDM_CAN_DISABLE_AUTO and CLKDM_CAN_FORCE_WAKEUP, which is equivalent to CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP.
>>
>> Per our discussion and just to re-iterate here for OMAP4+ devices, we
>> should have ...
>>
>> CAN_DISABLE_AUTO 	--> SW_WKUP
>> CAN_ENABLE_AUTO		--> HW_AUTO
>> CAN_FORCE_WAKEUP	--> SW_WKUP
>> CAN_FORCE_SLEEP		--> HW_AUTO
>>
>> Hence, the NO_SLEEP and SW_SLEEP should not be used for OMAP4+ (per the
>> equivalents highlighted above). At least that is the current theory :-)
> 
> I realise now the the l4cfg CD does not support SW_WKUP and so I guess
> we still need NO_SLEEP in that case. So that would break the above
> mapping and we would have to handle it in software.

I have posted my latest series here [1] based upon that from Will [2]
which attempts to fix the EMU CD based upon the inputs from this thread.
It is working on my omap4460 panda. Hopefully Ming and/or Will can also
test. I know that Ming is out this week but said he can test next week.

Cheers
Jon

[1] http://marc.info/?l=linux-omap&m=133659938028348&w=2
[2] git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git perf/omap4

  reply	other threads:[~2012-05-09 21:45 UTC|newest]

Thread overview: 111+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAAO=S0+L2Q1YZC-pfm2Lz8jPooTeHYOMaZbtRgHYFoL_m7rvhA@mail.gmail.com>
     [not found] ` <4F0B182D.7060507@us.ibm.com>
2012-01-09 22:49   ` oprofile and ARM A9 hardware counter Will Deacon
2012-01-09 23:30     ` Ming Lei
2012-01-10  0:46       ` stephane eranian
2012-01-18  4:18         ` Ming Lei
2012-01-18  9:33           ` Ming Lei
2012-01-18 11:39             ` Shilimkar, Santosh
2012-01-18 12:24               ` Ming Lei
2012-01-18 12:33                 ` Shilimkar, Santosh
2012-04-03  9:25                   ` Will Deacon
2012-04-03  9:42                     ` Shilimkar, Santosh
2012-04-03  9:47                       ` Will Deacon
2012-04-03 10:01                         ` Shilimkar, Santosh
2012-04-03 12:34                           ` Will Deacon
2012-04-03 12:41                             ` Shilimkar, Santosh
2012-04-03 14:27                             ` Kevin Hilman
2012-04-03 16:07                               ` Will Deacon
2012-04-03 23:14                                 ` Kevin Hilman
2012-04-03 23:29                                   ` Paul Walmsley
2012-04-04  3:42                                     ` Ming Lei
2012-04-04 11:15                                     ` Will Deacon
2012-04-26 18:07                                       ` Will Deacon
2012-04-30 22:25                                         ` Kevin Hilman
2012-05-07 17:27                                           ` Ming Lei
2012-05-04 22:17                                         ` Jon Hunter
2012-05-07 17:15                                           ` Kevin Hilman
2012-05-07 19:53                                             ` Jon Hunter
2012-05-07 23:28                                               ` Kevin Hilman
2012-05-08 11:01                                                 ` Cousson, Benoit
2012-05-08 11:23                                                   ` Jean Pihet
2012-05-08 12:37                                                     ` Cousson, Benoit
2012-05-08 13:18                                                       ` Jean Pihet
2012-05-08 14:00                                                         ` Kevin Hilman
2012-05-08 14:03                                                           ` Cousson, Benoit
2012-05-08 16:18                                                             ` Kevin Hilman
2012-05-08 19:51                                                               ` Jon Hunter
2012-05-08 21:28                                                                 ` Kevin Hilman
2012-05-08 22:20                                                                   ` Jon Hunter
2012-05-08 22:12                                                                 ` Ming Lei
2012-05-08 17:31                                                   ` Jon Hunter
2012-05-08 21:22                                                     ` Kevin Hilman
2012-05-08 23:59                                                       ` Jon Hunter
2012-05-09 10:58                                                       ` Cousson, Benoit
2012-05-09 18:04                                                         ` Jon Hunter
2012-05-09 19:28                                                           ` Jon Hunter
2012-05-09 21:45                                                             ` Jon Hunter [this message]
2012-05-10  8:44                                                               ` Will Deacon
2012-05-10  9:12                                                                 ` stephane eranian
2012-05-10 18:55                                                                 ` Jon Hunter
2012-05-11 12:25                                                                   ` Will Deacon
2012-05-11 13:47                                                                     ` Jon Hunter
2012-05-11 13:49                                                                       ` Will Deacon
2012-05-11 14:52                                                                         ` Jon Hunter
2012-05-11 15:02                                                                           ` Will Deacon
2012-05-11 16:31                                                                             ` Jon Hunter
2012-05-11 16:38                                                                               ` Will Deacon
2012-05-11 23:51                                                                                 ` Jon Hunter
2012-05-15 13:52                                                                                   ` Will Deacon
2012-05-10 14:12                                                               ` Kevin Hilman
2012-05-10 19:05                                                                 ` Jon Hunter
2012-05-10  6:59                                                         ` Santosh Shilimkar
2012-05-08 21:50                                                 ` Paul Walmsley
2012-04-04  0:00                             ` Paul Walmsley
2012-04-04 11:07                               ` Will Deacon
2012-01-18  9:54           ` stephane eranian
2012-01-18 10:07             ` Ming Lei
2012-01-18 21:58               ` stephane eranian
2012-01-19  1:21                 ` Ming Lei
2012-01-19 11:34                   ` stephane eranian
2012-01-19 12:45                     ` Ming Lei
2012-01-19 12:51                       ` stephane eranian
2012-01-19 12:55                         ` stephane eranian
2012-01-19 13:14                         ` Ming Lei
2012-01-19 13:26                           ` Ming Lei
2012-01-19 13:32                             ` stephane eranian
2012-01-19 13:51                               ` Ming Lei
2012-01-19 17:07                                 ` stephane eranian
2012-01-20 13:47                                   ` stephane eranian
2012-01-21  3:25                                     ` Ming Lei
2012-01-21  9:16                                       ` stephane eranian
2012-01-27 12:13                                         ` Will Deacon
2012-01-27 12:45                                           ` stephane eranian
2012-01-27 12:56                                           ` Måns Rullgård
2012-01-27 13:28                                             ` Will Deacon
2012-01-27 13:32                                               ` stephane eranian
2012-01-27 13:47                                               ` Måns Rullgård
2012-01-27 13:56                                                 ` Will Deacon
2012-01-27 14:05                                                   ` Måns Rullgård
2012-01-27 14:09                                               ` Ming Lei
2012-01-27 15:45                                                 ` stephane eranian
2012-01-27 15:54                                                   ` Will Deacon
2012-01-27 15:57                                                     ` stephane eranian
2012-01-27 16:59                                                       ` Will Deacon
2012-01-27 17:03                                                         ` stephane eranian
2012-01-27 17:10                                                           ` Will Deacon
2012-01-27 17:16                                                             ` stephane eranian
2012-01-29 17:36                                                               ` stephane eranian
2012-01-30  9:40                                                                 ` Ming Lei
2012-01-30 10:24                                                                   ` stephane eranian
2012-01-30 13:43                                                                     ` stephane eranian
2012-01-30 14:49                                                                       ` Ming Lei
2012-01-30 16:02                                                                         ` stephane eranian
2012-01-30 16:08                                                                           ` Måns Rullgård
2012-01-30 17:15                                                                             ` stephane eranian
2012-01-30 17:24                                                                               ` Will Deacon
2012-01-30 17:45                                                                                 ` stephane eranian
2012-01-30 19:14                                                                                   ` Will Deacon
2012-01-30 20:45                                                                                     ` stephane eranian
2012-03-07  2:49                                                     ` Ming Lei
2012-03-07  9:48                                                       ` Will Deacon
2012-01-27 14:06                                           ` Ming Lei
2012-01-18 10:18             ` Russell King - ARM Linux

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=4FAAE564.6040708@ti.com \
    --to=jon-hunter@ti.com \
    --cc=b-cousson@ti.com \
    --cc=eranian@gmail.com \
    --cc=khilman@ti.com \
    --cc=lik88888@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=maynardj@us.ibm.com \
    --cc=ming.lei@canonical.com \
    --cc=oprofile-list@lists.sourceforge.net \
    --cc=paul@pwsan.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=will.deacon@arm.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).