21 Jun, 2017

1 commit


14 Jun, 2017

2 commits

  • The macro name is now renamed to 'TIMER_ACPI_DECLARE' for consistency
    with the CLOCKSOURCE_OF_DECLARE => TIMER_OF_DECLARE change.

    Signed-off-by: Daniel Lezcano
    Reviewed-by: Linus Walleij

    Daniel Lezcano
     
  • The CLOCKSOURCE_OF_DECLARE macro is used widely for the timers to declare the
    clocksource at early stage. However, this macro is also used to initialize
    the clockevent if any, or the clockevent only.

    It was originally suggested to declare another macro to initialize a
    clockevent, so in order to separate the two entities even they belong to the
    same IP. This was not accepted because of the impact on the DT where splitting
    a clocksource/clockevent definition does not make sense as it is a Linux
    concept not a hardware description.

    On the other side, the clocksource has not interrupt declared while the
    clockevent has, so it is easy from the driver to know if the description is
    for a clockevent or a clocksource, IOW it could be implemented at the driver
    level.

    So instead of dealing with a named clocksource macro, let's use a more generic
    one: TIMER_OF_DECLARE.

    The patch has not functional changes.

    Signed-off-by: Daniel Lezcano
    Acked-by: Heiko Stuebner
    Acked-by: Neil Armstrong
    Acked-by: Arnd Bergmann
    Acked-by: Matthias Brugger
    Reviewed-by: Linus Walleij

    Daniel Lezcano
     

12 Jun, 2017

1 commit


09 May, 2017

1 commit

  • arch_timer_mem_find_best_frame() looks through ARCH_TIMER_MEM_MAX_FRAMES
    frames even after finding matches to ensure the best frame is chosen,
    which means the variable frame will point to the last valid frame but
    not necessarily the best frame.

    On Juno, we get the following error as the wrong frame is returned as the
    best frame from arch_timer_mem_find_best_frame():

    arch_timer: Unable to map frame @ 0x0000000000000000
    arch_timer: Frame missing phys irq.
    Failed to initialize '/timer@2a810000': -22

    Fix the issue by correctly returning the best frame from
    arch_timer_mem_find_best_frame().

    Fixes: c389d701dfb7 ("clocksource: arm_arch_timer: split MMIO timer probing.")
    Signed-off-by: Sudeep Holla
    Acked-by: Mark Rutland
    Cc: Marc Zyngier
    Cc: Daniel Lezcano
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lkml.kernel.org/r/1494246747-17267-1-git-send-email-sudeep.holla@arm.com
    Signed-off-by: Thomas Gleixner

    Sudeep Holla
     

20 Apr, 2017

2 commits

  • In some rare randconfig builds, we end up with two functions being entirely
    unused:

    drivers/clocksource/arm_arch_timer.c:342:12: error: 'erratum_set_next_event_tval_phys' defined but not used [-Werror=unused-function]
    static int erratum_set_next_event_tval_phys(unsigned long evt,
    drivers/clocksource/arm_arch_timer.c:335:12: error: 'erratum_set_next_event_tval_virt' defined but not used [-Werror=unused-function]
    static int erratum_set_next_event_tval_virt(unsigned long evt,

    We could add an #ifdef around them, but we would already have to check for
    several symbols there and there is a chance this would get more complicated
    over time, so marking them as __maybe_unused is the simplest way to avoid the
    harmless warnings.

    Fixes: 01d3e3ff2608 ("arm64: arch_timer: Rework the set_next_event workarounds")
    Signed-off-by: Arnd Bergmann
    Acked-by: Marc Zyngier
    Acked-by: Daniel Lezcano
    Cc: Mark Rutland
    Cc: Will Deacon
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: Christoffer Dall
    Link: http://lkml.kernel.org/r/20170419173737.3846098-1-arnd@arndb.de
    Signed-off-by: Thomas Gleixner

    Arnd Bergmann
     
  • 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
    Reviewed-by: Hanjun Guo
    [Mark: verify CNTFRQ, only register the first frame]
    Signed-off-by: Mark Rutland

    Fu Wei
     

19 Apr, 2017

5 commits

  • The patch update arm_arch_timer driver to use the function
    provided by the new GTDT driver of ACPI.
    By this way, arm_arch_timer.c can be simplified, and separate
    all the ACPI GTDT knowledge from this timer driver.

    Signed-off-by: Fu Wei
    Signed-off-by: Hanjun Guo
    Tested-by: Xiongfeng Wang
    Reviewed-by: Hanjun Guo
    Tested-by: Hanjun Guo
    Signed-off-by: Mark Rutland

    Fu Wei
     
  • 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 splits the DT parsing from HW probing. The DT parsing now
    lives in arch_timer_mem_of_init(), which fills in an arch_timer_mem
    structure that it hands to probing functions that can be reused for ACPI
    support.

    Since the rate detection logic will be slight different when using ACPI,
    the probing is performed as a number of steps. This results in more code
    for the moment, and some arguably redundant work, but simplifies matters
    considerably when ACPI support is added.

    Signed-off-by: Fu Wei
    [Mark: refactor the probing split]
    Signed-off-by: Mark Rutland

    Fu Wei
     
  • To cleanly split code paths specific to ACPI or DT at a higher level,
    this patch removes arch_timer_init(), folding the relevant
    parts of its logic into existing callers.

    This pathes the way for further rework, and saves a few lines.

    Signed-off-by: Fu Wei
    Reviewed-by: Hanjun Guo
    [Mark: reword commit message]
    Signed-off-by: Mark Rutland

    Fu Wei
     
  • When booting with DT, it's possible for timer nodes to be probed in any
    order. Some common initialisation needs to occur after all nodes have
    been probed, and arch_timer_common_init() has code to detect when this
    has happened.

    This logic is DT-specific, and it would be best to factor it out of the
    common code that will be shared with ACPI.

    This patch folds this into the existing arch_timer_needs_probing(),
    which is renamed to arch_timer_needs_of_probing(), and no longer takes
    any arguments. This is only called when using DT, and not when using
    ACPI, which will have a deterministic probe order.

    Signed-off-by: Fu Wei
    Reviewed-by: Hanjun Guo
    [Mark: reword commit message]
    Signed-off-by: Mark Rutland

    Fu Wei
     
  • For historical reasons, rate detection when probing via DT is somewhat
    convoluted. We tried to package this up in arch_timer_detect_rate(), but
    with the addition of ACPI worse, and gets in the way of stringent rate
    checking when ACPI is used.

    This patch makes arch_timer_detect_rate() specific to DT, ripping out
    ACPI logic. In preparation for rework of the MMIO timer probing, the
    reading of the relevant CNTFRQ register is factored out to callers. The
    function is then renamed to arch_timer_of_configure_rate(), which better
    represents its new place in the world.

    Comments are added in the DT and ACPI probe paths to explain this.

    Signed-off-by: Fu Wei
    [Mark: reword commit message]
    Signed-off-by: Mark Rutland

    Fu Wei
     

10 Apr, 2017

6 commits

  • Currently, the arch timer driver uses ARCH_TIMER_PHYS_SECURE_PPI to mean
    the driver will use the secure PPI *and* potentially also use the
    non-secure PPI. This is somewhat confusing.

    For arm64 it never makes sense to use the secure PPI, but we do anyway,
    inheriting this behaviour from 32-bit arm. For ACPI, we may not even
    have a valid secure PPI, so we need to be able to only request the
    non-secure PPI.

    To that end, this patch reworks the timer driver so that we can request
    the non-secure PPI alone. The PPI selection is split out into a new
    function, arch_timer_select_ppi(), and verification of the selected PPI
    is shifted out to callers (as DT may select the PPI by other means and
    must handle this anyway).

    We now consistently use arch_timer_has_nonsecure_ppi() to determine
    whether we must manage a non-secure PPI *in addition* to a secure PPI.
    When we only have a non-secure PPI, this returns false.

    Signed-off-by: Fu Wei
    Tested-by: Xiongfeng Wang
    [Mark: reword commit message]
    Signed-off-by: Mark Rutland

    Fu Wei
     
  • This patch add a new enum "arch_timer_spi_nr" and use it in the driver.
    Just for code's readability, no functional change.

    Signed-off-by: Fu Wei
    Acked-by: Mark Rutland
    Signed-off-by: Mark Rutland

    Fu Wei
     
  • To support the arm_arch_timer via ACPI we need to share defines and enums
    between the driver and the ACPI parser code.
    So we split out the relevant defines and enums into arm_arch_timer.h.

    No functional change.

    Signed-off-by: Fu Wei
    Acked-by: Mark Rutland
    Tested-by: Xiongfeng Wang
    Signed-off-by: Mark Rutland

    Fu Wei
     
  • In preparation for moving the PPI enum out into a header, rename the
    enum and its constituent values these so they are namespaced w.r.t. the
    arch timer. This will aid consistency and avoid potential name clashes
    when this move occurs.

    No functional change.

    Signed-off-by: Fu Wei
    Tested-by: Xiongfeng Wang
    [Mark: reword commit message]
    Signed-off-by: Mark Rutland

    Fu Wei
     
  • In preparation for moving the type macros out into a header, rename
    these so they are namespaced w.r.t. the arch timer. We'll apply the same
    prefix to other definitions in subsequent patches. This will aid
    consistency and avoid potential name clahses when this move occurs.

    No functional change.

    Signed-off-by: Fu Wei
    Tested-by: Xiongfeng Wang
    [Mark: reword commit message]
    Signed-off-by: Mark Rutland

    Fu Wei
     
  • Almost all string in the arm_arch_timer driver duplicate an common
    prefix (though a few do not). For consistency, it would be better to use
    pr_fmt(), and always use this prefix. At the same time, we may as well
    clean up some whitespace issues in arch_timer_banner and
    arch_timer_init.

    No functional change.

    Signed-off-by: Fu Wei
    Acked-by: Mark Rutland
    Tested-by: Xiongfeng Wang
    [Mark: reword commit message]
    Signed-off-by: Mark Rutland

    Fu Wei
     

07 Apr, 2017

12 commits


02 Mar, 2017

1 commit


12 Feb, 2017

1 commit

  • The object cyclecounter of type cyclecounter is only modified during
    initialization in arch_counter_register. So it can be marked
    __ro_after_init.

    Signed-off-by: Bhumika Goyal
    Cc: mark.rutland@arm.com
    Cc: keescook@chromium.org
    Cc: marc.zyngier@arm.com
    Cc: daniel.lezcano@linaro.org
    Cc: julia.lawall@lip6.fr
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lkml.kernel.org/r/1486840818-22214-1-git-send-email-bhumirks@gmail.com
    Signed-off-by: Thomas Gleixner

    Bhumika Goyal
     

08 Feb, 2017

3 commits

  • Erratum Hisilicon-161010101 says that the ARM generic timer counter "has
    the potential to contain an erroneous value when the timer value
    changes". Accesses to TVAL (both read and write) are also affected due
    to the implicit counter read. Accesses to CVAL are not affected.

    The workaround is to reread the system count registers until the value
    of the second read is larger than the first one by less than 32, the
    system counter can be guaranteed not to return wrong value twice by
    back-to-back read and the error value is always larger than the correct
    one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.

    Signed-off-by: Ding Tianhong
    [Mark: split patch, fix Kconfig, reword commit message]
    Signed-off-by: Mark Rutland
    Acked-by: Daniel Lezcano
    Signed-off-by: Daniel Lezcano

    Ding Tianhong
     
  • Currently we have code inline in the arch timer probe path to cater for
    Freescale erratum A-008585, complete with ifdeffery. This is a little
    ugly, and will get worse as we try to add more errata handling.

    This patch refactors the handling of Freescale erratum A-008585. Now the
    erratum is described in a generic arch_timer_erratum_workaround
    structure, and the probe path can iterate over these to detect errata
    and enable workarounds.

    This will simplify the addition and maintenance of code handling
    Hisilicon erratum 161010101.

    Signed-off-by: Ding Tianhong
    [Mark: split patch, correct Kconfig, reword commit message]
    Signed-off-by: Mark Rutland
    Acked-by: Daniel Lezcano
    Signed-off-by: Daniel Lezcano

    Ding Tianhong
     
  • Having a command line option to flip the errata handling for a
    particular erratum is a little bit unusual, and it's vastly superior to
    pass this in the DT. By common consensus, it's best to kill off the
    command line parameter.

    Signed-off-by: Ding Tianhong
    [Mark: split patch, reword commit message]
    Signed-off-by: Mark Rutland
    Acked-by: Daniel Lezcano
    Signed-off-by: Daniel Lezcano

    Ding Tianhong
     

26 Dec, 2016

1 commit

  • Pull timer type cleanups from Thomas Gleixner:
    "This series does a tree wide cleanup of types related to
    timers/timekeeping.

    - Get rid of cycles_t and use a plain u64. The type is not really
    helpful and caused more confusion than clarity

    - Get rid of the ktime union. The union has become useless as we use
    the scalar nanoseconds storage unconditionally now. The 32bit
    timespec alike storage got removed due to the Y2038 limitations
    some time ago.

    That leaves the odd union access around for no reason. Clean it up.

    Both changes have been done with coccinelle and a small amount of
    manual mopping up"

    * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    ktime: Get rid of ktime_equal()
    ktime: Cleanup ktime_set() usage
    ktime: Get rid of the union
    clocksource: Use a plain u64 instead of cycle_t

    Linus Torvalds
     

25 Dec, 2016

2 commits

  • There is no point in having an extra type for extra confusion. u64 is
    unambiguous.

    Conversion was done with the following coccinelle script:

    @rem@
    @@
    -typedef u64 cycle_t;

    @fix@
    typedef cycle_t;
    @@
    -cycle_t
    +u64

    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: John Stultz

    Thomas Gleixner
     
  • When the state names got added a script was used to add the extra argument
    to the calls. The script basically converted the state constant to a
    string, but the cleanup to convert these strings into meaningful ones did
    not happen.

    Replace all the useless strings with 'subsys/xxx/yyy:state' strings which
    are used in all the other places already.

    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: Sebastian Siewior
    Link: http://lkml.kernel.org/r/20161221192112.085444152@linutronix.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

21 Nov, 2016

2 commits