All of lore.kernel.org
 help / color / mirror / Atom feed
From: cov@codeaurora.org (Christopher Covington)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clocksource: arch_timer: Fix code to use physical timers when requested
Date: Thu, 28 Aug 2014 13:09:32 -0400	[thread overview]
Message-ID: <53FF624C.3090002@codeaurora.org> (raw)
In-Reply-To: <20140828093505.GC14650@leverpostej>

Hi Mark,

On 08/28/2014 05:35 AM, Mark Rutland wrote:
> On Thu, Aug 28, 2014 at 04:33:31AM +0100, Doug Anderson wrote:
>> Hi,
>>
>> On Wed, Aug 27, 2014 at 7:58 PM, Olof Johansson <olof@lixom.net> wrote:
>>> On Wed, Aug 27, 2014 at 5:56 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>>>> On 08/27/14 15:33, Olof Johansson wrote:
>>>>> On Wed, Aug 27, 2014 at 3:26 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>>>>>
>>>>>> Is there any reason why the virtual counter can't be read? Maybe we're
>>>>>> the hyp and we need to make sure we don't use the virtual timer so that
>>>>>> the guest can use it, but that doesn't have any effect on the usage of
>>>>>> the virtual counter for the clocksource.
>>>>>
>>>>> There are several cases where virtual is unusable -- in particular it
>>>>> might not have been configured properly (i.e. the phys/virt offset is
>>>>> at a bad value).
>>>>
>>>> Any specifics? It would be nice to say so in the commit text so that
>>>> others using such devices know they need this patch. I'm guessing the
>>>> firmware can't be fixed?
>>
>> Even if we could change things to use a virtual timer in some cases,
>> Sonny's patch still fixes a bug.  The code as written right now makes
>> pretenses about supporting the physical timer, but it doesn't work.
>> That should be fixed.
> 
> The code does support the physical timer. It does not support the
> physical counter (and makes no pretenses that it does).

I think if you could please explain the following code, that may help clear up
some of the confusion.

		if (arch_timer_use_virtual) {
			clk->irq = arch_timer_ppi[VIRT_PPI];
			clk->set_mode = arch_timer_set_mode_virt;
			clk->set_next_event = arch_timer_set_next_event_virt;
		} else {
			clk->irq = arch_timer_ppi[PHYS_SECURE_PPI];
			clk->set_mode = arch_timer_set_mode_phys;
			clk->set_next_event = arch_timer_set_next_event_phys;
		}

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/clocksource/arm_arch_timer.c#n272

Perhaps you mean to say the code does not support *non-secure access* to the
physical timer?

Thanks,
Christopher

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.

WARNING: multiple messages have this Message-ID (diff)
From: Christopher Covington <cov@codeaurora.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Doug Anderson <dianders@chromium.org>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	Russell King <linux@arm.linux.org.uk>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Will Deacon <Will.Deacon@arm.com>,
	Sudeep Holla <Sudeep.Holla@arm.com>,
	Olof Johansson <olof@lixom.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Sonny Rao <sonnyrao@chromium.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] clocksource: arch_timer: Fix code to use physical timers when requested
Date: Thu, 28 Aug 2014 13:09:32 -0400	[thread overview]
Message-ID: <53FF624C.3090002@codeaurora.org> (raw)
In-Reply-To: <20140828093505.GC14650@leverpostej>

Hi Mark,

On 08/28/2014 05:35 AM, Mark Rutland wrote:
> On Thu, Aug 28, 2014 at 04:33:31AM +0100, Doug Anderson wrote:
>> Hi,
>>
>> On Wed, Aug 27, 2014 at 7:58 PM, Olof Johansson <olof@lixom.net> wrote:
>>> On Wed, Aug 27, 2014 at 5:56 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>>>> On 08/27/14 15:33, Olof Johansson wrote:
>>>>> On Wed, Aug 27, 2014 at 3:26 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>>>>>
>>>>>> Is there any reason why the virtual counter can't be read? Maybe we're
>>>>>> the hyp and we need to make sure we don't use the virtual timer so that
>>>>>> the guest can use it, but that doesn't have any effect on the usage of
>>>>>> the virtual counter for the clocksource.
>>>>>
>>>>> There are several cases where virtual is unusable -- in particular it
>>>>> might not have been configured properly (i.e. the phys/virt offset is
>>>>> at a bad value).
>>>>
>>>> Any specifics? It would be nice to say so in the commit text so that
>>>> others using such devices know they need this patch. I'm guessing the
>>>> firmware can't be fixed?
>>
>> Even if we could change things to use a virtual timer in some cases,
>> Sonny's patch still fixes a bug.  The code as written right now makes
>> pretenses about supporting the physical timer, but it doesn't work.
>> That should be fixed.
> 
> The code does support the physical timer. It does not support the
> physical counter (and makes no pretenses that it does).

I think if you could please explain the following code, that may help clear up
some of the confusion.

		if (arch_timer_use_virtual) {
			clk->irq = arch_timer_ppi[VIRT_PPI];
			clk->set_mode = arch_timer_set_mode_virt;
			clk->set_next_event = arch_timer_set_next_event_virt;
		} else {
			clk->irq = arch_timer_ppi[PHYS_SECURE_PPI];
			clk->set_mode = arch_timer_set_mode_phys;
			clk->set_next_event = arch_timer_set_next_event_phys;
		}

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/clocksource/arm_arch_timer.c#n272

Perhaps you mean to say the code does not support *non-secure access* to the
physical timer?

Thanks,
Christopher

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.

  reply	other threads:[~2014-08-28 17:09 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 21:03 [PATCH] clocksource: arch_timer: Fix code to use physical timers when requested Sonny Rao
2014-08-27 21:03 ` Sonny Rao
2014-08-27 21:19 ` Olof Johansson
2014-08-27 21:19   ` Olof Johansson
2014-08-27 21:27   ` Sonny Rao
2014-08-27 21:27     ` Sonny Rao
2014-08-27 22:26     ` Stephen Boyd
2014-08-27 22:26       ` Stephen Boyd
2014-08-27 22:33       ` Olof Johansson
2014-08-27 22:33         ` Olof Johansson
2014-08-28  0:56         ` Stephen Boyd
2014-08-28  0:56           ` Stephen Boyd
2014-08-28  2:58           ` Olof Johansson
2014-08-28  2:58             ` Olof Johansson
2014-08-28  3:33             ` Doug Anderson
2014-08-28  3:33               ` Doug Anderson
2014-08-28  9:35               ` Mark Rutland
2014-08-28  9:35                 ` Mark Rutland
2014-08-28 17:09                 ` Christopher Covington [this message]
2014-08-28 17:09                   ` Christopher Covington
2014-08-28 18:04                   ` Mark Rutland
2014-08-28 18:04                     ` Mark Rutland
2014-08-29  0:10                 ` Sonny Rao
2014-08-29  0:10                   ` Sonny Rao
2014-08-29 10:04                   ` Mark Rutland
2014-08-29 10:04                     ` Mark Rutland
2014-09-04 17:01                     ` Sonny Rao
2014-09-04 17:01                       ` Sonny Rao
2014-09-04 17:47                       ` Mark Rutland
2014-09-04 17:47                         ` Mark Rutland
2014-09-04 17:48                       ` Lorenzo Pieralisi
2014-09-04 17:48                         ` Lorenzo Pieralisi
2014-09-05 22:11                 ` Doug Anderson
2014-09-05 22:11                   ` Doug Anderson
2014-09-08 13:54                   ` Catalin Marinas
2014-09-08 13:54                     ` Catalin Marinas
2014-09-10 17:17                     ` Doug Anderson
2014-09-10 17:17                       ` Doug Anderson
2014-09-10 17:34                       ` Will Deacon
2014-09-10 17:34                         ` Will Deacon
2014-09-10 18:09                         ` Doug Anderson
2014-09-10 18:09                           ` Doug Anderson
2014-09-10 18:46                           ` Will Deacon
2014-09-10 18:46                             ` Will Deacon
2014-09-10 19:50                             ` Doug Anderson
2014-09-10 19:50                               ` Doug Anderson
2014-09-11  9:57                               ` Will Deacon
2014-09-11  9:57                                 ` Will Deacon
2014-09-11 15:54                                 ` Doug Anderson
2014-09-11 15:54                                   ` Doug Anderson
2014-09-10 14:58                   ` Christopher Covington
2014-09-10 14:58                     ` Christopher Covington
2014-09-10 15:47                     ` Catalin Marinas
2014-09-10 15:47                       ` Catalin Marinas
2014-09-10 15:55                     ` Mark Rutland
2014-09-10 15:55                       ` Mark Rutland
2014-09-10 16:39                       ` Olof Johansson
2014-09-10 16:39                         ` Olof Johansson
2014-09-10 17:19                       ` Doug Anderson
2014-09-10 17:19                         ` Doug Anderson
2014-08-28  9:23 ` Marc Zyngier
2014-08-28  9:23   ` Marc Zyngier
2014-09-10 17:27 ` Mark Rutland
2014-09-10 17:27   ` Mark Rutland
2014-09-10 17:52   ` Doug Anderson
2014-09-10 17:52     ` Doug Anderson
2014-09-10 18:05     ` Sonny Rao
2014-09-10 18:05       ` Sonny Rao
2014-09-10 18:35     ` Doug Anderson
2014-09-10 18:35       ` Doug Anderson

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=53FF624C.3090002@codeaurora.org \
    --to=cov@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.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.