08 Mar, 2020

1 commit

  • Merge Linux stable release v5.4.24 into imx_5.4.y

    * tag 'v5.4.24': (3306 commits)
    Linux 5.4.24
    blktrace: Protect q->blk_trace with RCU
    kvm: nVMX: VMWRITE checks unsupported field before read-only field
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm/boot/dts/imx6sll-evk.dts
    arch/arm/boot/dts/imx7ulp.dtsi
    arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
    drivers/clk/imx/clk-composite-8m.c
    drivers/gpio/gpio-mxc.c
    drivers/irqchip/Kconfig
    drivers/mmc/host/sdhci-of-esdhc.c
    drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
    drivers/net/can/flexcan.c
    drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
    drivers/net/ethernet/mscc/ocelot.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/realtek.c
    drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/tee/optee/shm_pool.c
    drivers/usb/cdns3/gadget.c
    kernel/sched/cpufreq.c
    net/core/xdp.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c
    sound/soc/sof/core.c
    sound/soc/sof/imx/Kconfig
    sound/soc/sof/loader.c

    Jason Liu
     

26 Feb, 2020

1 commit

  • When kernel uses SDK version DPAA/FMan drivers, user could
    select to use ptp_qoriq driver, or FMan RTC driver to manage
    1588 timer. But neither should not be enabled together.
    This patch is to add dependency !FSL_SDK_FMAN_RTC_API for
    ptp_qoriq driver.

    Signed-off-by: Yangbo Lu
    (cherry picked from commit 88573b6472bf6d91c69f024b0f2a4e85533f6c0e)

    Yangbo Lu
     

23 Jan, 2020

1 commit

  • [ Upstream commit 75718584cb3c64e6269109d4d54f888ac5a5fd15 ]

    There is a bug in ptp_clock_unregister(), where ptp_cleanup_pin_groups()
    first frees ptp->pin_{,dev_}attr, but then posix_clock_unregister() needs
    them to destroy a related sysfs device.

    These functions can not be just swapped, as posix_clock_unregister() frees
    ptp which is needed in the ptp_cleanup_pin_groups(). Fix this by calling
    ptp_cleanup_pin_groups() in ptp_clock_release(), right before ptp is freed.

    This makes this patch fix an UAF bug in a patch which fixes an UAF bug.

    Reported-by: Antti Laakso
    Fixes: a33121e5487b ("ptp: fix the race between the release of ptp_clock and cdev")
    Link: https://lore.kernel.org/netdev/3d2bd09735dbdaf003585ca376b7c1e5b69a19bd.camel@intel.com/
    Signed-off-by: Vladis Dronov
    Acked-by: Richard Cochran
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Vladis Dronov
     

05 Jan, 2020

1 commit

  • [ Upstream commit a33121e5487b424339636b25c35d3a180eaa5f5e ]

    In a case when a ptp chardev (like /dev/ptp0) is open but an underlying
    device is removed, closing this file leads to a race. This reproduces
    easily in a kvm virtual machine:

    ts# cat openptp0.c
    int main() { ... fp = fopen("/dev/ptp0", "r"); ... sleep(10); }
    ts# uname -r
    5.5.0-rc3-46cf053e
    ts# cat /proc/cmdline
    ... slub_debug=FZP
    ts# modprobe ptp_kvm
    ts# ./openptp0 &
    [1] 670
    opened /dev/ptp0, sleeping 10s...
    ts# rmmod ptp_kvm
    ts# ls /dev/ptp*
    ls: cannot access '/dev/ptp*': No such file or directory
    ts# ...woken up
    [ 48.010809] general protection fault: 0000 [#1] SMP
    [ 48.012502] CPU: 6 PID: 658 Comm: openptp0 Not tainted 5.5.0-rc3-46cf053e #25
    [ 48.014624] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), ...
    [ 48.016270] RIP: 0010:module_put.part.0+0x7/0x80
    [ 48.017939] RSP: 0018:ffffb3850073be00 EFLAGS: 00010202
    [ 48.018339] RAX: 000000006b6b6b6b RBX: 6b6b6b6b6b6b6b6b RCX: ffff89a476c00ad0
    [ 48.018936] RDX: fffff65a08d3ea08 RSI: 0000000000000247 RDI: 6b6b6b6b6b6b6b6b
    [ 48.019470] ... ^^^ a slub poison
    [ 48.023854] Call Trace:
    [ 48.024050] __fput+0x21f/0x240
    [ 48.024288] task_work_run+0x79/0x90
    [ 48.024555] do_exit+0x2af/0xab0
    [ 48.024799] ? vfs_write+0x16a/0x190
    [ 48.025082] do_group_exit+0x35/0x90
    [ 48.025387] __x64_sys_exit_group+0xf/0x10
    [ 48.025737] do_syscall_64+0x3d/0x130
    [ 48.026056] entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [ 48.026479] RIP: 0033:0x7f53b12082f6
    [ 48.026792] ...
    [ 48.030945] Modules linked in: ptp i6300esb watchdog [last unloaded: ptp_kvm]
    [ 48.045001] Fixing recursive fault but reboot is needed!

    This happens in:

    static void __fput(struct file *file)
    { ...
    if (file->f_op->release)
    file->f_op->release(inode, file); <<< cdev is kfree'd here
    if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL &&
    !(mode & FMODE_PATH))) {
    cdev_put(inode->i_cdev); <<< cdev fields are accessed here

    Namely:

    __fput()
    posix_clock_release()
    kref_put(&clk->kref, delete_clock) <<< the last reference
    delete_clock()
    delete_ptp_clock()
    kfree(ptp) <<< cdev is embedded in ptp
    cdev_put
    module_put(p->owner) <<< *p is kfree'd, bang!

    Here cdev is embedded in posix_clock which is embedded in ptp_clock.
    The race happens because ptp_clock's lifetime is controlled by two
    refcounts: kref and cdev.kobj in posix_clock. This is wrong.

    Make ptp_clock's sysfs device a parent of cdev with cdev_device_add()
    created especially for such cases. This way the parent device with its
    ptp_clock is not released until all references to the cdev are released.
    This adds a requirement that an initialized but not exposed struct
    device should be provided to posix_clock_register() by a caller instead
    of a simple dev_t.

    This approach was adopted from the commit 72139dfa2464 ("watchdog: Fix
    the race between the release of watchdog_core_data and cdev"). See
    details of the implementation in the commit 233ed09d7fda ("chardev: add
    helper function to register char devs with a struct device").

    Link: https://lore.kernel.org/linux-fsdevel/20191125125342.6189-1-vdronov@redhat.com/T/#u
    Analyzed-by: Stephen Johnston
    Analyzed-by: Vern Lovejoy
    Signed-off-by: Vladis Dronov
    Acked-by: Richard Cochran
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Vladis Dronov
     

02 Dec, 2019

1 commit


16 Nov, 2019

2 commits


08 Oct, 2019

1 commit


03 Oct, 2019

1 commit

  • Because ptp_qoriq_settime is being called prior to spin_lock_init, the
    following stack trace can be seen at driver probe time:

    [ 2.269117] the code is fine but needs lockdep annotation.
    [ 2.274569] turning off the locking correctness validator.
    [ 2.280027] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.3.0-rc7-01478-g01eaa67a4797 #263
    [ 2.288073] Hardware name: Freescale LS1021A
    [ 2.292337] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
    [ 2.300045] [] (show_stack) from [] (dump_stack+0xcc/0xf8)
    [ 2.307235] [] (dump_stack) from [] (register_lock_class+0x730/0x73c)
    [ 2.315372] [] (register_lock_class) from [] (__lock_acquire+0x78/0x270c)
    [ 2.323856] [] (__lock_acquire) from [] (lock_acquire+0xe0/0x22c)
    [ 2.331649] [] (lock_acquire) from [] (_raw_spin_lock_irqsave+0x54/0x68)
    [ 2.340048] [] (_raw_spin_lock_irqsave) from [] (ptp_qoriq_settime+0x38/0x80)
    [ 2.348878] [] (ptp_qoriq_settime) from [] (ptp_qoriq_init+0x1f8/0x484)
    [ 2.357189] [] (ptp_qoriq_init) from [] (ptp_qoriq_probe+0xd0/0x184)
    [ 2.365243] [] (ptp_qoriq_probe) from [] (platform_drv_probe+0x48/0x9c)
    [ 2.373555] [] (platform_drv_probe) from [] (really_probe+0x1c4/0x400)
    [ 2.381779] [] (really_probe) from [] (driver_probe_device+0x78/0x1b8)
    [ 2.390003] [] (driver_probe_device) from [] (device_driver_attach+0x58/0x60)
    [ 2.398832] [] (device_driver_attach) from [] (__driver_attach+0xfc/0x160)
    [ 2.407402] [] (__driver_attach) from [] (bus_for_each_dev+0x68/0xb4)
    [ 2.415539] [] (bus_for_each_dev) from [] (bus_add_driver+0x104/0x20c)
    [ 2.423763] [] (bus_add_driver) from [] (driver_register+0x78/0x10c)
    [ 2.431815] [] (driver_register) from [] (do_one_initcall+0x8c/0x3ac)
    [ 2.439954] [] (do_one_initcall) from [] (kernel_init_freeable+0x468/0x548)
    [ 2.448610] [] (kernel_init_freeable) from [] (kernel_init+0x8/0x10c)
    [ 2.456745] [] (kernel_init) from [] (ret_from_fork+0x14/0x20)
    [ 2.464273] Exception stack(0xea89ffb0 to 0xea89fff8)
    [ 2.469297] ffa0: 00000000 00000000 00000000 00000000
    [ 2.477432] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    [ 2.485566] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000

    Fixes: ff54571a747b ("ptp_qoriq: convert to use ptp_qoriq_init/free")
    Signed-off-by: Vladimir Oltean
    Signed-off-by: David S. Miller

    Vladimir Oltean
     

28 Sep, 2019

1 commit

  • Commit 415606588c61 ("PTP: introduce new versions of IOCTLs",
    2019-09-13) introduced new versions of the PTP ioctls which actually
    validate that the flags are acceptable values.

    As part of this, it cleared the flags value using a bitwise
    and+negation, in an attempt to prevent the old ioctl from accidentally
    enabling new features.

    This is incorrect for a couple of reasons. First, it results in
    accidentally preventing previously working flags on the request ioctl.
    By clearing the "valid" flags, we now no longer allow setting the
    enable, rising edge, or falling edge flags.

    Second, if we add new additional flags in the future, they must not be
    set by the old ioctl. (Since the flag wasn't checked before, we could
    potentially break userspace programs which sent garbage flag data.

    The correct way to resolve this is to check for and clear all but the
    originally valid flags.

    Create defines indicating which flags are correctly checked and
    interpreted by the original ioctls. Use these to clear any bits which
    will not be correctly interpreted by the original ioctls.

    In the future, new flags must be added to the VALID_FLAGS macros, but
    *not* to the V1_VALID_FLAGS macros. In this way, new features may be
    exposed over the v2 ioctls, but without breaking previous userspace
    which happened to not clear the flags value properly. The old ioctl will
    continue to behave the same way, while the new ioctl gains the benefit
    of using the flags fields.

    Cc: Richard Cochran
    Cc: Felipe Balbi
    Cc: David S. Miller
    Cc: Christopher Hall
    Signed-off-by: Jacob Keller
    Acked-by: Richard Cochran
    Signed-off-by: David S. Miller

    Jacob Keller
     

13 Sep, 2019

1 commit

  • The current version of the IOCTL have a small problem which prevents us
    from extending the API by making use of reserved fields. In these new
    IOCTLs, we are now making sure that flags and rsv fields are zero which
    will allow us to extend the API in the future.

    Reviewed-by: Richard Cochran
    Signed-off-by: Felipe Balbi
    Signed-off-by: David S. Miller

    Felipe Balbi
     

26 Jul, 2019

1 commit


16 Jun, 2019

1 commit

  • This patch is to add QorIQ PTP support for DPAA2.
    Although dpaa2-ptp.c driver is a fsl_mc_driver which
    is using MC APIs for register accessing, it's same
    IP block with eTSEC/DPAA/ENETC 1588 timer. We will
    convert to reuse ptp_qoriq driver by using register
    ioremap and dropping related MC APIs.
    Also allow to compile ptp_qoriq with COMPILE_TEST.

    Signed-off-by: Yangbo Lu
    Signed-off-by: David S. Miller

    Yangbo Lu
     

14 Jun, 2019

1 commit


31 May, 2019

2 commits

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation version 2 of the license this program
    is distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not write to the free
    software foundation inc 59 temple place suite 330 boston ma 02111
    1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 83 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Richard Fontana
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070034.021731668@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Based on 3 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version [author] [kishon] [vijay] [abraham]
    [i] [kishon]@[ti] [com] this program is distributed in the hope that
    it will be useful but without any warranty without even the implied
    warranty of merchantability or fitness for a particular purpose see
    the gnu general public license for more details

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version [author] [graeme] [gregory]
    [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
    [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
    [hk] [hemahk]@[ti] [com] this program is distributed in the hope
    that it will be useful but without any warranty without even the
    implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1105 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

24 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    675 mass ave cambridge ma 02139 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 441 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Michael Ellerman (powerpc)
    Reviewed-by: Richard Fontana
    Reviewed-by: Allison Randal
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


10 May, 2019

1 commit


06 Mar, 2019

1 commit

  • Pull year 2038 updates from Thomas Gleixner:
    "Another round of changes to make the kernel ready for 2038. After lots
    of preparatory work this is the first set of syscalls which are 2038
    safe:

    403 clock_gettime64
    404 clock_settime64
    405 clock_adjtime64
    406 clock_getres_time64
    407 clock_nanosleep_time64
    408 timer_gettime64
    409 timer_settime64
    410 timerfd_gettime64
    411 timerfd_settime64
    412 utimensat_time64
    413 pselect6_time64
    414 ppoll_time64
    416 io_pgetevents_time64
    417 recvmmsg_time64
    418 mq_timedsend_time64
    419 mq_timedreceiv_time64
    420 semtimedop_time64
    421 rt_sigtimedwait_time64
    422 futex_time64
    423 sched_rr_get_interval_time64

    The syscall numbers are identical all over the architectures"

    * 'timers-2038-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
    riscv: Use latest system call ABI
    checksyscalls: fix up mq_timedreceive and stat exceptions
    unicore32: Fix __ARCH_WANT_STAT64 definition
    asm-generic: Make time32 syscall numbers optional
    asm-generic: Drop getrlimit and setrlimit syscalls from default list
    32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option
    compat ABI: use non-compat openat and open_by_handle_at variants
    y2038: add 64-bit time_t syscalls to all 32-bit architectures
    y2038: rename old time and utime syscalls
    y2038: remove struct definition redirects
    y2038: use time32 syscall names on 32-bit
    syscalls: remove obsolete __IGNORE_ macros
    y2038: syscalls: rename y2038 compat syscalls
    x86/x32: use time64 versions of sigtimedwait and recvmmsg
    timex: change syscalls to use struct __kernel_timex
    timex: use __kernel_timex internally
    sparc64: add custom adjtimex/clock_adjtime functions
    time: fix sys_timer_settime prototype
    time: Add struct __kernel_timex
    time: make adjtime compat handling available for 32 bit
    ...

    Linus Torvalds
     

20 Feb, 2019

1 commit

  • Passing the struct ptp_clock_info caps by parameter is passing over 130 bytes
    of data by value on the stack. Optimize this by passing it by reference instead.
    Also shinks the object code size:

    Before:
    text data bss dec hex filename
    12596 2160 64 14820 39e4 drivers/ptp/ptp_qoriq.o

    After:
    text data bss dec hex filename
    12567 2160 64 14791 39c7 drivers/ptp/ptp_qoriq.o

    Signed-off-by: Colin Ian King
    Signed-off-by: David S. Miller

    Colin Ian King
     

13 Feb, 2019

6 commits

  • This patch is to add QorIQ PTP support for ENETC.
    ENETC PTP driver which is a PCI driver for same
    1588 timer IP block will reuse QorIQ PTP driver.

    Signed-off-by: Yangbo Lu
    Signed-off-by: David S. Miller

    Yangbo Lu
     
  • The 1588 timer on eTSEC Ethernet controller uses different
    register memory map with DPAA Ethernet controller.
    Now the new ENETC Ethernet controller uses same reigster
    memory map with DPAA. To support ENETC, let's use register
    memory map of DPAA/ENETC in default.

    Signed-off-by: Yangbo Lu
    Signed-off-by: David S. Miller

    Yangbo Lu
     
  • There is QorIQ 1588 timer IP block on the new ENETC Ethernet
    controller. However it uses little endian mode which is different
    with before. This patch is to add little endian support for the
    driver by using "little-endian" dts node property.

    Signed-off-by: Yangbo Lu
    Signed-off-by: David S. Miller

    Yangbo Lu
     
  • Moved QorIQ PTP clock initialization/free into new functions
    ptp_qoriq_init()/ptp_qoriq_free(). These functions could also
    be reused by ENETC PTP drvier which is a PCI driver for same
    1588 timer IP block.

    Signed-off-by: Yangbo Lu
    Signed-off-by: David S. Miller

    Yangbo Lu
     
  • This patch is to make functions of ptp operations global,
    so that ENETC PTP driver which is a PCI driver for same
    1588 timer IP block could reuse them.

    Signed-off-by: Yangbo Lu
    Signed-off-by: David S. Miller

    Yangbo Lu
     
  • Strings containing "ptp_qoriq" or "qoriq_ptp" which were used for
    structure/function names were complained by users. Let's just use
    the unique "ptp_qoriq" to make these names more consistent.
    This patch is just to unify the names using "ptp_qoriq". It hasn't
    changed any functions.

    Signed-off-by: Yangbo Lu
    Signed-off-by: David S. Miller

    Yangbo Lu
     

11 Feb, 2019

1 commit

  • …/arnd/playground into timers/2038

    Pull y2038 - time64 system calls from Arnd Bergmann:

    This series finally gets us to the point of having system calls with 64-bit
    time_t on all architectures, after a long time of incremental preparation
    patches.

    There was actually one conversion that I missed during the summer,
    i.e. Deepa's timex series, which I now updated based the 5.0-rc1 changes
    and review comments.

    The following system calls are now added on all 32-bit architectures using
    the same system call numbers:

    403 clock_gettime64
    404 clock_settime64
    405 clock_adjtime64
    406 clock_getres_time64
    407 clock_nanosleep_time64
    408 timer_gettime64
    409 timer_settime64
    410 timerfd_gettime64
    411 timerfd_settime64
    412 utimensat_time64
    413 pselect6_time64
    414 ppoll_time64
    416 io_pgetevents_time64
    417 recvmmsg_time64
    418 mq_timedsend_time64
    419 mq_timedreceiv_time64
    420 semtimedop_time64
    421 rt_sigtimedwait_time64
    422 futex_time64
    423 sched_rr_get_interval_time64

    Each one of these corresponds directly to an existing system call that
    includes a 'struct timespec' argument, or a structure containing a timespec
    or (in case of clock_adjtime) timeval. Not included here are new versions
    of getitimer/setitimer and getrusage/waitid, which are planned for the
    future but only needed to make a consistent API rather than for correct
    operation beyond y2038. These four system calls are based on 'timeval', and
    it has not been finally decided what the replacement kernel interface will
    use instead.

    So far, I have done a lot of build testing across most architectures, which
    has found a number of bugs. Runtime testing so far included testing LTP on
    32-bit ARM with the existing system calls, to ensure we do not regress for
    existing binaries, and a test with a 32-bit x86 build of LTP against a
    modified version of the musl C library that has been adapted to the new
    system call interface [3]. This library can be used for testing on all
    architectures supported by musl-1.1.21, but it is not how the support is
    getting integrated into the official musl release. Official musl support is
    planned but will require more invasive changes to the library.

    Link: https://lore.kernel.org/lkml/20190110162435.309262-1-arnd@arndb.de/T/
    Link: https://lore.kernel.org/lkml/20190118161835.2259170-1-arnd@arndb.de/
    Link: https://git.linaro.org/people/arnd/musl-y2038.git/ [2]

    Thomas Gleixner
     

07 Feb, 2019

1 commit

  • struct timex is not y2038 safe.
    Replace all uses of timex with y2038 safe __kernel_timex.

    Note that struct __kernel_timex is an ABI interface definition.
    We could define a new structure based on __kernel_timex that
    is only available internally instead. Right now, there isn't
    a strong motivation for this as the structure is isolated to
    a few defined struct timex interfaces and such a structure would
    be exactly the same as struct timex.

    The patch was generated by the following coccinelle script:

    virtual patch

    @depends on patch forall@
    identifier ts;
    expression e;
    @@
    (
    - struct timex ts;
    + struct __kernel_timex ts;
    |
    - struct timex ts = {};
    + struct __kernel_timex ts = {};
    |
    - struct timex ts = e;
    + struct __kernel_timex ts = e;
    |
    - struct timex *ts;
    + struct __kernel_timex *ts;
    |
    (memset \| copy_from_user \| copy_to_user \)(...,
    - sizeof(struct timex))
    + sizeof(struct __kernel_timex))
    )

    @depends on patch forall@
    identifier ts;
    identifier fn;
    @@
    fn(...,
    - struct timex *ts,
    + struct __kernel_timex *ts,
    ...) {
    ...
    }

    @depends on patch forall@
    identifier ts;
    identifier fn;
    @@
    fn(...,
    - struct timex *ts) {
    + struct __kernel_timex *ts) {
    ...
    }

    Signed-off-by: Deepa Dinamani
    Cc: linux-alpha@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Signed-off-by: Arnd Bergmann

    Deepa Dinamani
     

26 Jan, 2019

1 commit

  • Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
    for debugfs files.

    Semantic patch information:
    Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
    imposes some significant overhead as compared to
    DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

    Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

    Signed-off-by: YueHaibing
    Acked-by: Yangbo Lu
    Signed-off-by: David S. Miller

    YueHaibing
     

23 Jan, 2019

3 commits

  • This patch is to add debugfs support for ptp_qoriq. Current debugfs
    supports to control fiper1/fiper2 loopback mode. If the loopback mode
    is enabled, the fiper1/fiper2 pulse is looped back into trigger1/
    trigger2 input. This is very useful for validating hardware and driver
    without external hardware. Below is an example to enable fiper1 loopback.

    echo 1 > /sys/kernel/debug/2d10e00.ptp_clock/fiper1-loopback

    Signed-off-by: Yangbo Lu
    Signed-off-by: David S. Miller

    Yangbo Lu
     
  • The external trigger stamp FIFO was introduced as a new feature
    for QorIQ 1588 timer IP block. This patch is to support it by
    adding a new dts property "fsl,extts-fifo". Any QorIQ 1588 timer
    supporting this feature is required to add this property in its
    dts node.

    In addition, the FIFO should be cleaned up before enabling external
    trigger interrupts. Otherwise, there will be interrupts immediately
    just after enabling external trigger interrupts.

    Signed-off-by: Yangbo Lu
    Signed-off-by: Vladimir Oltean
    Signed-off-by: David S. Miller

    Yangbo Lu
     
  • The tmr_tevent register would update event bits
    no matter tmr_temask bits were set or not. So we
    should get interrupts by tmr_tevent & tmr_temask,
    and clean up interrupts in tmr_tevent before
    enabling them.

    Signed-off-by: Yangbo Lu
    Signed-off-by: David S. Miller

    Yangbo Lu
     

09 Jan, 2019

1 commit


29 Dec, 2018

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here is the big set of char and misc driver patches for 4.21-rc1.

    Lots of different types of driver things in here, as this tree seems
    to be the "collection of various driver subsystems not big enough to
    have their own git tree" lately.

    Anyway, some highlights of the changes in here:

    - binderfs: is it a rule that all driver subsystems will eventually
    grow to have their own filesystem? Binder now has one to handle the
    use of it in containerized systems.

    This was discussed at the Plumbers conference a few months ago and
    knocked into mergable shape very fast by Christian Brauner. Who
    also has signed up to be another binder maintainer, showing a
    distinct lack of good judgement :)

    - binder updates and fixes

    - mei driver updates

    - fpga driver updates and additions

    - thunderbolt driver updates

    - soundwire driver updates

    - extcon driver updates

    - nvmem driver updates

    - hyper-v driver updates

    - coresight driver updates

    - pvpanic driver additions and reworking for more device support

    - lp driver updates. Yes really, it's _finally_ moved to the proper
    parallal port driver model, something I never thought I would see
    happen. Good stuff.

    - other tiny driver updates and fixes.

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'char-misc-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (116 commits)
    MAINTAINERS: add another Android binder maintainer
    intel_th: msu: Fix an off-by-one in attribute store
    stm class: Add a reference to the SyS-T document
    stm class: Fix a module refcount leak in policy creation error path
    char: lp: use new parport device model
    char: lp: properly count the lp devices
    char: lp: use first unused lp number while registering
    char: lp: detach the device when parallel port is removed
    char: lp: introduce list to save port number
    bus: qcom: remove duplicated include from qcom-ebi2.c
    VMCI: Use memdup_user() rather than duplicating its implementation
    char/rtc: Use of_node_name_eq for node name comparisons
    misc: mic: fix a DMA pool free failure
    ptp: fix an IS_ERR() vs NULL check
    genwqe: Fix size check
    binder: implement binderfs
    binder: fix use-after-free due to ksys_close() during fdget()
    bus: fsl-mc: remove duplicated include files
    bus: fsl-mc: explicitly define the fsl_mc_command endianness
    misc: ti-st: make array read_ver_cmd static, shrinks object size
    ...

    Linus Torvalds
     

19 Dec, 2018

1 commit

  • We recently modified pps_register_source() to return error pointers
    instead of NULL but it seems like there was a merge issue and part of
    the commit was lost. Anyway, the ptp_clock_register() function needs to
    be updated to check for IS_ERR() as well.

    Fixes: 3b1ad360acad ("pps: using ERR_PTR instead of NULL while pps_register_source fails")
    Signed-off-by: Dan Carpenter
    Acked-by: Richard Cochran
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     

24 Nov, 2018

1 commit

  • Fix smatch warning:

    drivers/ptp/ptp_clock.c:298 ptp_clock_register() warn:
    passing zero to 'ERR_PTR'

    'err' should be set while device_create_with_groups and
    pps_register_source fails

    Fixes: 85a66e550195 ("ptp: create "pins" together with the rest of attributes")
    Signed-off-by: YueHaibing
    Acked-by: Richard Cochran
    Signed-off-by: David S. Miller

    YueHaibing
     

10 Nov, 2018

3 commits

  • When a driver provides gettimex64(), use it in the PTP_SYS_OFFSET ioctl
    and POSIX clock's gettime() instead of gettime64(). Drivers should
    provide only one of the functions.

    Cc: Richard Cochran
    Cc: Jacob Keller
    Signed-off-by: Miroslav Lichvar
    Signed-off-by: David S. Miller

    Miroslav Lichvar
     
  • The PTP_SYS_OFFSET ioctl, which can be used to measure the offset
    between a PHC and the system clock, includes the total time that the
    driver needs to read the PHC timestamp.

    This typically involves reading of multiple PCI registers (sometimes in
    multiple iterations) and the register that contains the lowest bits of
    the timestamp is not read in the middle between the two readings of the
    system clock. This asymmetry causes the measured offset to have a
    significant error.

    Introduce a new ioctl, driver function, and helper functions, which
    allow the reading of the lowest register to be isolated from the other
    readings in order to reduce the asymmetry. The ioctl returns three
    timestamps for each measurement:
    - system time right before reading the lowest bits of the PHC timestamp
    - PHC time
    - system time immediately after reading the lowest bits of the PHC
    timestamp

    Cc: Richard Cochran
    Cc: Jacob Keller
    Cc: Marcelo Tosatti
    Signed-off-by: Miroslav Lichvar
    Signed-off-by: David S. Miller

    Miroslav Lichvar
     
  • If a gettime64 call fails, return the error and avoid copying data back
    to user.

    Cc: Richard Cochran
    Cc: Jacob Keller
    Signed-off-by: Miroslav Lichvar
    Signed-off-by: David S. Miller

    Miroslav Lichvar