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


Groups > linux.kernel > #1528357

Re: [PATCH v16 14/15] clocksource/drivers/arm_arch_timer: Add GTDT support for memory-mapped timer

From Fu Wei <fu.wei@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v16 14/15] clocksource/drivers/arm_arch_timer: Add GTDT support for memory-mapped timer
Date 2016-11-23 13:20 +0100
Message-ID <sGEGR-4OI-3@gated-at.bofh.it> (permalink)
References <sE8L7-3uw-15@gated-at.bofh.it> <sE8UO-3xZ-53@gated-at.bofh.it> <sEXXk-3vd-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Mark,

On 19 November 2016 at 04:20, Mark Rutland <mark.rutland@arm.com> wrote:
> On Wed, Nov 16, 2016 at 09:49:07PM +0800, fu.wei@linaro.org wrote:
>> From: Fu Wei <fu.wei@linaro.org>
>>
>> The patch add memory-mapped timer register support by using the
>> information provided by the new GTDT driver of ACPI.
>>
>> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>> ---
>>  drivers/clocksource/arm_arch_timer.c | 26 +++++++++++++++++++++++++-
>>  1 file changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
>> index c494ca8..0aad60a 100644
>> --- a/drivers/clocksource/arm_arch_timer.c
>> +++ b/drivers/clocksource/arm_arch_timer.c
>> @@ -1067,7 +1067,28 @@ CLOCKSOURCE_OF_DECLARE(armv7_arch_timer_mem, "arm,armv7-timer-mem",
>>                      arch_timer_mem_of_init);
>>
>>  #ifdef CONFIG_ACPI_GTDT
>> -/* Initialize per-processor generic timer */
>> +static int __init arch_timer_mem_acpi_init(void)
>> +{
>> +     struct arch_timer_mem *timer_mem;
>> +     int ret = 0;
>> +     int i = 0;
>> +
>> +     timer_mem = kzalloc(sizeof(*timer_mem), GFP_KERNEL);
>
> Why do you need it zeroed? You don't clear it between iterations, so
> either you don't need this, or you have a bug in the loop.
>
>> +     if (!timer_mem)
>> +             return -ENOMEM;
>> +
>> +     while (!gtdt_arch_timer_mem_init(timer_mem, i)) {
>
> Huh?
>
> Why doesn't GTDT expose a function to fill in the entire arch_timer_mem
> in one go?

Yes, that is a good idea, but I need to find a way to get the number of
GT block in GTDT, then allocate a  struct arch_timer_mem array for all GT block

>
> There shouldn't be multiple instances, as far as I am aware. Am I
> mistaken?

I don't see any doc says : there is only one memory-mapped timer
in a soc.
Maybe we have more than one GT block in GTDT or
(in another word) we may have more than one memory-mapped
timer in a soc, right ??

Please correct me, If I miss something.

>
>> +             ret = arch_timer_mem_init(timer_mem);
>> +             if (ret)
>> +                     break;
>> +             i++;
>> +     }
>> +
>> +     kfree(timer_mem);
>> +     return ret;
>> +}
>
>
> Regardless, arch_timer_mem is small enough that you don't need dynamic
> allocaiton. Just put it on the stack, e.g.
>
> static int __init arch_timer_mem_acpi_init(void)
> {
>         int i = 0;
>         struct arch_timer_mem timer_mem;
>
>         while (!gtdt_arch_timer_mem_init(timer_mem, i)) {
>                 int ret = arch_timer_mem_init();
>                 if (ret)
>                         return ret;
>                 i++
>         }
>
>         return 0;
> }
>
> Thanks,
> Mark.



-- 
Best regards,

Fu Wei
Software Engineer
Red Hat

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v16 00/15] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer fu.wei@linaro.org - 2016-11-16 14:50 +0100
  [PATCH v16 07/15] clocksource/drivers/arm_arch_timer: Refactor arch_timer_detect_rate to keep dt code in *_of_init fu.wei@linaro.org - 2016-11-16 15:00 +0100
    Re: [PATCH v16 07/15] clocksource/drivers/arm_arch_timer: Refactor  arch_timer_detect_rate to keep dt code in *_of_init Mark Rutland <mark.rutland@arm.com> - 2016-11-18 21:00 +0100
      Re: [PATCH v16 07/15] clocksource/drivers/arm_arch_timer: Refactor  arch_timer_detect_rate to keep dt code in *_of_init Fu Wei <fu.wei@linaro.org> - 2016-11-21 15:10 +0100
  [PATCH v16 12/15] clocksource/drivers/arm_arch_timer: Simplify ACPI support code. fu.wei@linaro.org - 2016-11-16 15:00 +0100
  [PATCH v16 13/15] acpi/arm64: Add memory-mapped timer support in GTDT driver fu.wei@linaro.org - 2016-11-16 15:00 +0100
    Re: [PATCH v16 13/15] acpi/arm64: Add memory-mapped timer support in  GTDT driver Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-11-18 15:30 +0100
      Re: [PATCH v16 13/15] acpi/arm64: Add memory-mapped timer support in  GTDT driver Fu Wei <fu.wei@linaro.org> - 2016-11-23 13:00 +0100
        Re: [PATCH v16 13/15] acpi/arm64: Add memory-mapped timer support in  GTDT driver Fu Wei <fu.wei@linaro.org> - 2016-11-24 05:00 +0100
  [PATCH v16 10/15] clocksource/drivers/arm_arch_timer: Refactor the timer init code to prepare for GTDT fu.wei@linaro.org - 2016-11-16 15:00 +0100
    Re: [PATCH v16 10/15] clocksource/drivers/arm_arch_timer: Refactor  the timer init code to prepare for GTDT Mark Rutland <mark.rutland@arm.com> - 2016-11-18 21:10 +0100
      Re: [PATCH v16 10/15] clocksource/drivers/arm_arch_timer: Refactor  the timer init code to prepare for GTDT Fu Wei <fu.wei@linaro.org> - 2016-11-23 07:20 +0100
  [PATCH v16 11/15] acpi/arm64: Add GTDT table parse driver fu.wei@linaro.org - 2016-11-16 15:00 +0100
    Re: [PATCH v16 11/15] acpi/arm64: Add GTDT table parse driver Mark Rutland <mark.rutland@arm.com> - 2016-11-18 21:20 +0100
      Re: [PATCH v16 11/15] acpi/arm64: Add GTDT table parse driver Fu Wei <fu.wei@linaro.org> - 2016-11-23 13:10 +0100
  [PATCH v16 04/15] clocksource/drivers/arm_arch_timer: rename some enums and defines, and some cleanups. fu.wei@linaro.org - 2016-11-16 15:00 +0100
    Re: [PATCH v16 04/15] clocksource/drivers/arm_arch_timer: rename  some enums and defines, and some cleanups. Mark Rutland <mark.rutland@arm.com> - 2016-11-18 20:00 +0100
      Re: [PATCH v16 04/15] clocksource/drivers/arm_arch_timer: rename some  enums and defines, and some cleanups. Fu Wei <fu.wei@linaro.org> - 2016-11-21 07:20 +0100
  [PATCH v16 01/15] clocksource/drivers/arm_arch_timer: Move enums and defines to header file fu.wei@linaro.org - 2016-11-16 15:00 +0100
  [PATCH v16 15/15] acpi/arm64: Add SBSA Generic Watchdog support in GTDT driver fu.wei@linaro.org - 2016-11-16 15:00 +0100
  [PATCH v16 14/15] clocksource/drivers/arm_arch_timer: Add GTDT support for memory-mapped timer fu.wei@linaro.org - 2016-11-16 15:00 +0100
    Re: [PATCH v16 14/15] clocksource/drivers/arm_arch_timer: Add GTDT  support for memory-mapped timer Mark Rutland <mark.rutland@arm.com> - 2016-11-18 21:30 +0100
      Re: [PATCH v16 14/15] clocksource/drivers/arm_arch_timer: Add GTDT  support for memory-mapped timer Fu Wei <fu.wei@linaro.org> - 2016-11-23 13:20 +0100
  [PATCH v16 08/15] clocksource/drivers/arm_arch_timer: Refactor arch_timer_needs_probing, and call it only if acpi disabled. fu.wei@linaro.org - 2016-11-16 15:00 +0100
    Re: [PATCH v16 08/15] clocksource/drivers/arm_arch_timer: Refactor  arch_timer_needs_probing, and call it only if acpi disabled. Mark Rutland <mark.rutland@arm.com> - 2016-11-18 21:00 +0100
      Re: [PATCH v16 08/15] clocksource/drivers/arm_arch_timer: Refactor  arch_timer_needs_probing, and call it only if acpi disabled. Fu Wei <fu.wei@linaro.org> - 2016-11-21 15:40 +0100
  [PATCH v16 06/15] clocksource/drivers/arm_arch_timer: separate out arch_timer_uses_ppi init code to prepare for GTDT. fu.wei@linaro.org - 2016-11-16 15:00 +0100
    Re: [PATCH v16 06/15] clocksource/drivers/arm_arch_timer: separate  out arch_timer_uses_ppi init code to prepare for GTDT. Mark Rutland <mark.rutland@arm.com> - 2016-11-18 20:40 +0100
      Re: [PATCH v16 06/15] clocksource/drivers/arm_arch_timer: separate  out arch_timer_uses_ppi init code to prepare for GTDT. Fu Wei <fu.wei@linaro.org> - 2016-11-21 10:50 +0100
  [PATCH v16 03/15] clocksource/drivers/arm_arch_timer: Improve printk relevant code fu.wei@linaro.org - 2016-11-16 15:00 +0100
  [PATCH v16 02/15] clocksource/drivers/arm_arch_timer: Add a new enum for spi type fu.wei@linaro.org - 2016-11-16 15:00 +0100
  [PATCH v16 09/15] clocksource/drivers/arm_arch_timer: Introduce some new structs to prepare for GTDT fu.wei@linaro.org - 2016-11-16 15:00 +0100
  [PATCH v16 05/15] clocksource/drivers/arm_arch_timer: fix a bug in arch_timer_register about arch_timer_uses_ppi fu.wei@linaro.org - 2016-11-16 15:00 +0100
    Re: [PATCH v16 05/15] clocksource/drivers/arm_arch_timer: fix a bug  in arch_timer_register about arch_timer_uses_ppi Mark Rutland <mark.rutland@arm.com> - 2016-11-18 20:00 +0100
      Re: [PATCH v16 05/15] clocksource/drivers/arm_arch_timer: fix a bug  in arch_timer_register about arch_timer_uses_ppi Fu Wei <fu.wei@linaro.org> - 2016-11-21 08:40 +0100
  Re: [PATCH v16 00/15] acpi, clocksource: add GTDT driver and GTDT  support in arm_arch_timer Xiongfeng Wang <wangxiongfeng2@huawei.com> - 2016-11-17 04:50 +0100
    Re: [PATCH v16 00/15] acpi, clocksource: add GTDT driver and GTDT  support in arm_arch_timer Xiongfeng Wang <wangxiongfeng2@huawei.com> - 2016-11-17 10:40 +0100
      Re: [PATCH v16 00/15] acpi, clocksource: add GTDT driver and GTDT  support in arm_arch_timer Fu Wei <fu.wei@linaro.org> - 2016-11-17 12:20 +0100
  Re: [PATCH v16 00/15] acpi, clocksource: add GTDT driver and GTDT  support in arm_arch_timer Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-11-17 10:50 +0100

csiph-web