Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1560473 > unrolled thread

Re: [PATCH v19 10/15] clocksource/drivers/arm_arch_timer: Refactor the timer init code to prepare for GTDT

Started byFu Wei <fu.wei@linaro.org>
First post2017-01-17 11:40 +0100
Last post2017-01-17 14:30 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v19 10/15] clocksource/drivers/arm_arch_timer: Refactor  the timer init code to prepare for GTDT Fu Wei <fu.wei@linaro.org> - 2017-01-17 11:40 +0100
    Re: [PATCH v19 10/15] clocksource/drivers/arm_arch_timer: Refactor  the timer init code to prepare for GTDT Fu Wei <fu.wei@linaro.org> - 2017-01-17 11:50 +0100
    Re: [PATCH v19 10/15] clocksource/drivers/arm_arch_timer: Refactor  the timer init code to prepare for GTDT Timur Tabi <timur@codeaurora.org> - 2017-01-17 13:20 +0100
      Re: [PATCH v19 10/15] clocksource/drivers/arm_arch_timer: Refactor  the timer init code to prepare for GTDT Mark Rutland <mark.rutland@arm.com> - 2017-01-17 13:40 +0100
        Re: [PATCH v19 10/15] clocksource/drivers/arm_arch_timer: Refactor  the timer init code to prepare for GTDT Fu Wei <fu.wei@linaro.org> - 2017-01-17 14:30 +0100

#1560473 — Re: [PATCH v19 10/15] clocksource/drivers/arm_arch_timer: Refactor the timer init code to prepare for GTDT

FromFu Wei <fu.wei@linaro.org>
Date2017-01-17 11:40 +0100
SubjectRe: [PATCH v19 10/15] clocksource/drivers/arm_arch_timer: Refactor the timer init code to prepare for GTDT
Message-ID<t0zlh-5WC-39@gated-at.bofh.it>
Hi Mark,

On 17 January 2017 at 02:30, Mark Rutland <mark.rutland@arm.com> wrote:
> On Wed, Dec 21, 2016 at 02:45:58PM +0800, fu.wei@linaro.org wrote:
>> From: Fu Wei <fu.wei@linaro.org>
>>
>> The patch refactor original memory-mapped timer init code:
>>     (1) Refactor "arch_timer_mem_init", make it become a common code for
>>         memory-mapped timer init.
>>     (2) Add a new function "arch_timer_mem_of_init" for DT init.
>
> As a general note, please write proper commit messages, describing what
> the problem is, and why we are making the changes. These bullet points
> don't add anything to what can be derived from a glance at the code.
>
> For this patch, you can use:
>
>   clocksource: arm_arch_timer: refactor MMIO timer probing
>
>   Currently the code to probe MMIO architected timers mixes DT parsing
>   with actual poking of hardware. This makes the code harder than
>   necessary to understand, and makes it difficult to add support for
>   probing via ACPI.
>
>   This patch factors all the DT-specific logic out of
>   arch_timer_mem_init(), into a new function, arch_timer_mem_of_init().
>   The former pokes the hardware and determines the suitablility of
>   frames based on a datastructure populated by the latter.
>
>   This cleanly separates the two and will make it possible to add
>   probing using the ACPI GTDT in subsequent patches.

Great thanks for this upstream tip.
I have used your example commit message instead.
It will be in v20.

>
> [...]
>
>> +     for_each_available_child_of_node(np, frame_node) {
>> +             int n;
>> +             struct arch_timer_mem_frame *frame = &timer_mem->frame[i];
>> +
>> +             if (of_property_read_u32(frame_node, "frame-number", &n)) {
>> +                     pr_err("Missing frame-number\n");
>> +                     of_node_put(frame_node);
>> +                     goto out;
>> +             }
>> +             frame->frame_nr = n;
>> +
>> +             if (of_address_to_resource(frame_node, 0, &res)) {
>> +                     of_node_put(frame_node);
>> +                     goto out;
>> +             }
>> +             frame->cntbase = res.start;
>> +             frame->size = resource_size(&res);
>> +
>> +             frame->virt_irq = irq_of_parse_and_map(frame_node,
>> +                                                    ARCH_TIMER_VIRT_SPI);
>> +             frame->phys_irq = irq_of_parse_and_map(frame_node,
>> +                                                    ARCH_TIMER_PHYS_SPI);
>>
>> -     if (!arch_timer_needs_of_probing())
>> +             if (++i >= ARCH_TIMER_MEM_MAX_FRAMES)
>> +                     break;
>> +     }
>
> It would be good if we could warn upon seeing more than
> ARCH_TIMER_MEM_MAX_FRAMES children, since that's obviously an error.

OK, NP, will use

if (i >= ARCH_TIMER_MEM_MAX_FRAMES) {
        pr_err(FW_BUG "too many frames, ARMv8 spec only allows 8.\n");
        goto out;
}

at the beginning of this loop.

Here will be replaced by  i++;

Great thanks for your suggestion!

>
> Thanks,
> Mark.



-- 
Best regards,

Fu Wei
Software Engineer
Red Hat

[toc] | [next] | [standalone]


#1560487

FromFu Wei <fu.wei@linaro.org>
Date2017-01-17 11:50 +0100
Message-ID<t0zuW-609-21@gated-at.bofh.it>
In reply to#1560473
Hi Mark,

On 17 January 2017 at 18:30, Fu Wei <fu.wei@linaro.org> wrote:
> Hi Mark,
>
> On 17 January 2017 at 02:30, Mark Rutland <mark.rutland@arm.com> wrote:
>> On Wed, Dec 21, 2016 at 02:45:58PM +0800, fu.wei@linaro.org wrote:
>>> From: Fu Wei <fu.wei@linaro.org>
>>>
>>> The patch refactor original memory-mapped timer init code:
>>>     (1) Refactor "arch_timer_mem_init", make it become a common code for
>>>         memory-mapped timer init.
>>>     (2) Add a new function "arch_timer_mem_of_init" for DT init.
>>
>> As a general note, please write proper commit messages, describing what
>> the problem is, and why we are making the changes. These bullet points
>> don't add anything to what can be derived from a glance at the code.
>>
>> For this patch, you can use:
>>
>>   clocksource: arm_arch_timer: refactor MMIO timer probing
>>
>>   Currently the code to probe MMIO architected timers mixes DT parsing
>>   with actual poking of hardware. This makes the code harder than
>>   necessary to understand, and makes it difficult to add support for
>>   probing via ACPI.
>>
>>   This patch factors all the DT-specific logic out of
>>   arch_timer_mem_init(), into a new function, arch_timer_mem_of_init().
>>   The former pokes the hardware and determines the suitablility of
>>   frames based on a datastructure populated by the latter.
>>
>>   This cleanly separates the two and will make it possible to add
>>   probing using the ACPI GTDT in subsequent patches.
>
> Great thanks for this upstream tip.
> I have used your example commit message instead.
> It will be in v20.
>
>>
>> [...]
>>
>>> +     for_each_available_child_of_node(np, frame_node) {
>>> +             int n;
>>> +             struct arch_timer_mem_frame *frame = &timer_mem->frame[i];
>>> +
>>> +             if (of_property_read_u32(frame_node, "frame-number", &n)) {
>>> +                     pr_err("Missing frame-number\n");
>>> +                     of_node_put(frame_node);
>>> +                     goto out;
>>> +             }
>>> +             frame->frame_nr = n;
>>> +
>>> +             if (of_address_to_resource(frame_node, 0, &res)) {
>>> +                     of_node_put(frame_node);
>>> +                     goto out;
>>> +             }
>>> +             frame->cntbase = res.start;
>>> +             frame->size = resource_size(&res);
>>> +
>>> +             frame->virt_irq = irq_of_parse_and_map(frame_node,
>>> +                                                    ARCH_TIMER_VIRT_SPI);
>>> +             frame->phys_irq = irq_of_parse_and_map(frame_node,
>>> +                                                    ARCH_TIMER_PHYS_SPI);
>>>
>>> -     if (!arch_timer_needs_of_probing())
>>> +             if (++i >= ARCH_TIMER_MEM_MAX_FRAMES)
>>> +                     break;
>>> +     }
>>
>> It would be good if we could warn upon seeing more than
>> ARCH_TIMER_MEM_MAX_FRAMES children, since that's obviously an error.
>
> OK, NP, will use
>
> if (i >= ARCH_TIMER_MEM_MAX_FRAMES) {
>         pr_err(FW_BUG "too many frames, ARMv8 spec only allows 8.\n");

Sorry,  this should be "ARM spec only allows 8.\n"

Not only ARMv8, but also ARMv7


>         goto out;
> }
>
> at the beginning of this loop.
>
> Here will be replaced by  i++;
>
> Great thanks for your suggestion!
>
>>
>> Thanks,
>> Mark.
>
>
>
> --
> Best regards,
>
> Fu Wei
> Software Engineer
> Red Hat



-- 
Best regards,

Fu Wei
Software Engineer
Red Hat

[toc] | [prev] | [next] | [standalone]


#1560537

FromTimur Tabi <timur@codeaurora.org>
Date2017-01-17 13:20 +0100
Message-ID<t0AU1-6Zd-1@gated-at.bofh.it>
In reply to#1560473
Fu Wei wrote:
> if (i >= ARCH_TIMER_MEM_MAX_FRAMES) {
>         pr_err(FW_BUG "too many frames, ARMv8 spec only allows 8.\n");

pr_err(FW_BUG "too many frames, ARMv8 spec only allows %u.\n",
	ARCH_TIMER_MEM_MAX_FRAMES);

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

[toc] | [prev] | [next] | [standalone]


#1560558

FromMark Rutland <mark.rutland@arm.com>
Date2017-01-17 13:40 +0100
Message-ID<t0Bdn-768-3@gated-at.bofh.it>
In reply to#1560537
On Tue, Jan 17, 2017 at 06:18:12AM -0600, Timur Tabi wrote:
> Fu Wei wrote:
> >if (i >= ARCH_TIMER_MEM_MAX_FRAMES) {
> >        pr_err(FW_BUG "too many frames, ARMv8 spec only allows 8.\n");
> 
> pr_err(FW_BUG "too many frames, ARMv8 spec only allows %u.\n",
> 	ARCH_TIMER_MEM_MAX_FRAMES);

While I don't see ARCH_TIMER_MEM_MAX_FRAMES changing, this would be
nicer to ensure the result obviously matches.

As for wording, I'd perfer:

	pr_err(FW_BUG "too many frames, only %u are permitted.\n",
	       ARCH_TIMER_MEM_MAX_FRAMES);

... so as to avoid any confusion between spec versions and so on. We can
reconsider the message if/when that changes.

Thanks,
Mark.

[toc] | [prev] | [next] | [standalone]


#1560581

FromFu Wei <fu.wei@linaro.org>
Date2017-01-17 14:30 +0100
Message-ID<t0BZM-7Ce-7@gated-at.bofh.it>
In reply to#1560558
Hi Mark,

On 17 January 2017 at 20:29, Mark Rutland <mark.rutland@arm.com> wrote:
> On Tue, Jan 17, 2017 at 06:18:12AM -0600, Timur Tabi wrote:
>> Fu Wei wrote:
>> >if (i >= ARCH_TIMER_MEM_MAX_FRAMES) {
>> >        pr_err(FW_BUG "too many frames, ARMv8 spec only allows 8.\n");
>>
>> pr_err(FW_BUG "too many frames, ARMv8 spec only allows %u.\n",
>>       ARCH_TIMER_MEM_MAX_FRAMES);
>
> While I don't see ARCH_TIMER_MEM_MAX_FRAMES changing, this would be
> nicer to ensure the result obviously matches.
>
> As for wording, I'd perfer:
>
>         pr_err(FW_BUG "too many frames, only %u are permitted.\n",
>                ARCH_TIMER_MEM_MAX_FRAMES);

OK, will do so.
Thanks!

>
> ... so as to avoid any confusion between spec versions and so on. We can
> reconsider the message if/when that changes.
>
> Thanks,
> Mark.



-- 
Best regards,

Fu Wei
Software Engineer
Red Hat

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web