1. 17 Jan, 2019 40 commits
    • David Herrmann's avatar
      net: introduce SO_BINDTOIFINDEX sockopt · f5dd3d0c
      David Herrmann authored
      This introduces a new generic SOL_SOCKET-level socket option called
      SO_BINDTOIFINDEX. It behaves similar to SO_BINDTODEVICE, but takes a
      network interface index as argument, rather than the network interface
      name.
      
      User-space often refers to network-interfaces via their index, but has
      to temporarily resolve it to a name for a call into SO_BINDTODEVICE.
      This might pose problems when the network-device is renamed
      asynchronously by other parts of the system. When this happens, the
      SO_BINDTODEVICE might either fail, or worse, it might bind to the wrong
      device.
      
      In most cases user-space only ever operates on devices which they
      either manage themselves, or otherwise have a guarantee that the device
      name will not change (e.g., devices that are UP cannot be renamed).
      However, particularly in libraries this guarantee is non-obvious and it
      would be nice if that race-condition would simply not exist. It would
      make it easier for those libraries to operate even in situations where
      the device-name might change under the hood.
      
      A real use-case that we recently hit is trying to start the network
      stack early in the initrd but make it survive into the real system.
      Existing distributions rename network-interfaces during the transition
      from initrd into the real system. This, obviously, cannot affect
      devices that are up and running (unless you also consider moving them
      between network-namespaces). However, the network manager now has to
      make sure its management engine for dormant devices will not run in
      parallel to these renames. Particularly, when you offload operations
      like DHCP into separate processes, these might setup their sockets
      early, and thus have to resolve the device-name possibly running into
      this race-condition.
      
      By avoiding a call to resolve the device-name, we no longer depend on
      the name and can run network setup of dormant devices in parallel to
      the transition off the initrd. The SO_BINDTOIFINDEX ioctl plugs this
      race.
      Reviewed-by: default avatarTom Gundersen <teg@jklm.no>
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f5dd3d0c
    • Anand Moon's avatar
      ARM: dts: meson8b: odroidc1: Fix usb phy regulator power failed warning · 8d8ca5af
      Anand Moon authored
      Override the dr_mode from "host" to "peripheral" for dwc2
      usb_phy0->usb0 initialization of OTG Micro-B type.
      Changes fix the below warning for phy poweron failed --> -22
      
      This fix the initialization of c9040000.usb phy.
      
      [    1.639706] phy phy-c1108800.phy.0: USB ID detect failed!
      [    1.643850] phy phy-c1108800.phy.0: phy poweron failed --> -22
      [    1.649706] ------------[ cut here ]------------
      [    1.654273] WARNING: CPU: 0 PID: 29 at drivers/regulator/core.c:2054 _regulator_put.part.8+0xf8/0xfc
      [    1.663400] Modules linked in:
      [    1.666439] CPU: 0 PID: 29 Comm: kworker/0:1 Not tainted 4.20.0-xc1ml #11
      [    1.673192] Hardware name: Amlogic Meson platform
      [    1.677894] Workqueue: events deferred_probe_work_func
      [    1.683027] [<c0312204>] (unwind_backtrace) from [<c030cb8c>] (show_stack+0x10/0x14)
      [    1.690746] [<c030cb8c>] (show_stack) from [<c0e223b8>] (dump_stack+0x8c/0xa0)
      [    1.697953] [<c0e223b8>] (dump_stack) from [<c0346334>] (__warn.part.3+0xbc/0xd8)
      [    1.705418] [<c0346334>] (__warn.part.3) from [<c03464b0>] (warn_slowpath_null+0x44/0x4c)
      [    1.713579] [<c03464b0>] (warn_slowpath_null) from [<c07df6b8>] (_regulator_put.part.8+0xf8/0xfc)
      [    1.722437] [<c07df6b8>] (_regulator_put.part.8) from [<c07df6e4>] (regulator_put+0x28/0x38)
      [    1.730859] [<c07df6e4>] (regulator_put) from [<c07df71c>] (regulator_bulk_free+0x28/0x38)
      [    1.739112] [<c07df71c>] (regulator_bulk_free) from [<c0943858>] (release_nodes+0x1bc/0x200)
      [    1.747537] [<c0943858>] (release_nodes) from [<c093f82c>] (really_probe+0x110/0x2cc)
      [    1.755350] [<c093f82c>] (really_probe) from [<c093fb4c>] (driver_probe_device+0x60/0x16c)
      [    1.763599] [<c093fb4c>] (driver_probe_device) from [<c093dcd4>] (bus_for_each_drv+0x80/0xc4)
      [    1.772110] [<c093dcd4>] (bus_for_each_drv) from [<c093f6ac>] (__device_attach+0xd0/0x138)
      [    1.780359] [<c093f6ac>] (__device_attach) from [<c093eae4>] (bus_probe_device+0x84/0x8c)
      [    1.788522] [<c093eae4>] (bus_probe_device) from [<c093ef80>] (deferred_probe_work_func+0x60/0x8c)
      [    1.797470] [<c093ef80>] (deferred_probe_work_func) from [<c035fdb8>] (process_one_work+0x218/0x504)
      [    1.806585] [<c035fdb8>] (process_one_work) from [<c0360ea8>] (worker_thread+0x2a8/0x5bc)
      [    1.814748] [<c0360ea8>] (worker_thread) from [<c0365a18>] (kthread+0x14c/0x154)
      [    1.822128] [<c0365a18>] (kthread) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
      [    1.829331] Exception stack(0xee0ebfb0 to 0xee0ebff8)
      [    1.834369] bfa0:                                     00000000 00000000 00000000 00000000
      [    1.842534] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [    1.850695] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
      [    1.857311] ---[ end trace e28bbc26874282a4 ]---
      [    1.861984] ------------[ cut here ]------------
      [    1.866524] WARNING: CPU: 0 PID: 29 at drivers/regulator/core.c:2054 _regulator_put.part.8+0xf8/0xfc
      [    1.875629] Modules linked in:
      [    1.878658] CPU: 0 PID: 29 Comm: kworker/0:1 Tainted: GW         4.20.0-xc1ml #11
      [    1.886817] Hardware name: Amlogic Meson platform
      [    1.891513] Workqueue: events deferred_probe_work_func
      [    1.896641] [<c0312204>] (unwind_backtrace) from [<c030cb8c>] (show_stack+0x10/0x14)
      [    1.904366] [<c030cb8c>] (show_stack) from [<c0e223b8>] (dump_stack+0x8c/0xa0)
      [    1.911573] [<c0e223b8>] (dump_stack) from [<c0346334>] (__warn.part.3+0xbc/0xd8)
      [    1.919041] [<c0346334>] (__warn.part.3) from [<c03464b0>] (warn_slowpath_null+0x44/0x4c)
      [    1.927203] [<c03464b0>] (warn_slowpath_null) from [<c07df6b8>] (_regulator_put.part.8+0xf8/0xfc)
      [    1.936060] [<c07df6b8>] (_regulator_put.part.8) from [<c07df6e4>] (regulator_put+0x28/0x38)
      [    1.944483] [<c07df6e4>] (regulator_put) from [<c07df71c>] (regulator_bulk_free+0x28/0x38)
      [    1.952734] [<c07df71c>] (regulator_bulk_free) from [<c0943858>] (release_nodes+0x1bc/0x200)
      [    1.961159] [<c0943858>] (release_nodes) from [<c093f82c>] (really_probe+0x110/0x2cc)
      [    1.968974] [<c093f82c>] (really_probe) from [<c093fb4c>] (driver_probe_device+0x60/0x16c)
      [    1.977224] [<c093fb4c>] (driver_probe_device) from [<c093dcd4>] (bus_for_each_drv+0x80/0xc4)
      [    1.985734] [<c093dcd4>] (bus_for_each_drv) from [<c093f6ac>] (__device_attach+0xd0/0x138)
      [    1.993984] [<c093f6ac>] (__device_attach) from [<c093eae4>] (bus_probe_device+0x84/0x8c)
      [    2.002147] [<c093eae4>] (bus_probe_device) from [<c093ef80>] (deferred_probe_work_func+0x60/0x8c)
      [    2.011092] [<c093ef80>] (deferred_probe_work_func) from [<c035fdb8>] (process_one_work+0x218/0x504)
      [    2.020209] [<c035fdb8>] (process_one_work) from [<c0360ea8>] (worker_thread+0x2a8/0x5bc)
      [    2.028371] [<c0360ea8>] (worker_thread) from [<c0365a18>] (kthread+0x14c/0x154)
      [    2.035752] [<c0365a18>] (kthread) from [<c03010e8>] (ret_from_fork+0x14/0x2c)
      [    2.042955] Exception stack(0xee0ebfb0 to 0xee0ebff8)
      [    2.047993] bfa0:                                     00000000 00000000 00000000 00000000
      [    2.056158] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [    2.064320] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
      [    2.070934] ---[ end trace e28bbc26874282a5 ]---
      
      Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Neil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: default avatarAnand Moon <linux.amoon@gmail.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      8d8ca5af
    • Anand Moon's avatar
      ARM: dts: meson8b: odroidc1: Enable usb phy node · dbe62121
      Anand Moon authored
      Add missing vbus-supply link to phy controller for usb_phy0
      and usb_phy1 nodes, this changes fixed the power issue
      on usb ports usb, changes help fix usb reset warning.
      
      [  821.991470] usb 1-1.2: reset high-speed USB device number 3 using dwc2
      [  825.243385] usb 1-1.2: reset high-speed USB device number 3 using dwc2
      [  828.151310] usb 1-1.2: reset high-speed USB device number 3 using dwc2
      [  830.991241] usb 1-1.2: reset high-speed USB device number 3 using dwc2
      
      Fixes: 2eb79a4d (ARM: dts: meson: enabling the USB Host controller on Odroid-C1/C1+ board)
      Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Neil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: default avatarAnand Moon <linux.amoon@gmail.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      dbe62121
    • Jerome Brunet's avatar
      arm64: dts: meson: fix g12a buses · 2efbeb55
      Jerome Brunet authored
      periph and hiu bus addresses/size are wrong.
      cbus, aobus and apb just don't exist in the memory map so remove them.
      
      Fixes: 9c8c52f7 ("arm64: dts: meson-g12a: add initial g12a s905d2 SoC DT support")
      Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      2efbeb55
    • Anand Moon's avatar
      ARM64: dts: meson-gxbb-odroidc2: Fix usb phy reset warning · 2839b54d
      Anand Moon authored
      Add missing vin-supply node 5.0V regulator setting to power
      to usb ports, changes help fix the usb reset warning.
      
      [  795.380156] usb 1-1.2: reset high-speed USB device number 3 using dwc2
      [  798.356073] usb 1-1.2: reset high-speed USB device number 3 using dwc2
      [  801.331999] usb 1-1.2: reset high-speed USB device number 3 using dwc2
      [  804.307919] usb 1-1.2: reset high-speed USB device number 3 using dwc2
      [  807.283844] usb 1-1.2: reset high-speed USB device number 3 using dwc2
      
      Fixes: 5a0803bd (ARM64: dts: meson-gxbb-odroidc2: Enable USB Nodes)
      Tested-by: default avatarKevin Hilman <khilman@baylibre.com>
      Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Neil Armstrong <narmstrong@baylibre.com>
      Reviewed-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: default avatarAnand Moon <linux.amoon@gmail.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      2839b54d
    • Anand Moon's avatar
      ARM64: dts: meson-gxbb-odroidc2: Fix usb phy regulator power failed warning · f01d1f47
      Anand Moon authored
      Override the dr_mode from "host" to "peripheral" for dwc2
      usb_phy0->usb0 initilization of OTG Micro-B type.
      Changes fix the below warning for phy poweron failed --> -22
      
      Changes fix the initialization of c9000000.usb phy
      
      [    1.203900] phy phy-c0000000.phy.0: USB ID detect failed!
      [    1.208048] phy phy-c0000000.phy.0: phy poweron failed --> -22
      [    1.213877] WARNING: CPU: 1 PID: 44 at drivers/regulator/core.c:2054 _regulator_put.part.11+0xf0/0xf8
      [    1.222953] Modules linked in:
      [    1.225976] CPU: 1 PID: 44 Comm: kworker/1:1 Not tainted 5.0.0-rc1-xc2ml #3
      [    1.232872] Hardware name: Hardkernel ODROID-C2 (DT)
      [    1.237794] Workqueue: events deferred_probe_work_func
      [    1.242878] pstate: 80000005 (Nzcv daif -PAN -UAO)
      [    1.247623] pc : _regulator_put.part.11+0xf0/0xf8
      [    1.252280] lr : regulator_put+0x34/0x48
      [    1.256159] sp : ffff00001176bb00
      [    1.259437] x29: ffff00001176bb00 x28: 0000000000000000
      [    1.264698] x27: ffff80007f31beb8 x26: ffff000010eeb7e0
      [    1.269959] x25: 0000000000000000 x24: 0000000000000009
      [    1.275220] x23: ffff00001176bbc8 x22: ffff80007ed9d500
      [    1.280482] x21: ffff0000111bd6c8 x20: ffff80007ed9d700
      [    1.285743] x19: ffff80007ed9d700 x18: 000000000000006f
      [    1.291004] x17: 0000000000000000 x16: 0000000000000000
      [    1.296265] x15: 0000000000000400 x14: 0000000000000400
      [    1.301527] x13: ff00000000000000 x12: ffffffffffffffff
      [    1.306788] x11: 0000000000000038 x10: 0000000000000040
      [    1.312049] x9 : ffff0000111d58b0 x8 : ffff0000111d58a8
      [    1.317310] x7 : ffff80007ed9db00 x6 : ffff80007ec21b00
      [    1.322571] x5 : ffff80007f400248 x4 : ffff80007fba9b00
      [    1.327833] x3 : ffff0000112d9eb8 x2 : ffff80007ec21b00
      [    1.333094] x1 : 0000000000000000 x0 : 0000000000000001
      [    1.338356] Call trace:
      [    1.340773]  _regulator_put.part.11+0xf0/0xf8
      [    1.345085]  regulator_put+0x34/0x48
      [    1.348621]  regulator_bulk_free+0x30/0x50
      [    1.352675]  devm_regulator_bulk_release+0x18/0x20
      [    1.357421]  release_nodes+0x1b0/0x220
      [    1.361127]  devres_release_all+0x34/0x50
      [    1.365094]  really_probe+0xec/0x290
      [    1.368630]  driver_probe_device+0x54/0xe8
      [    1.372684]  __device_attach_driver+0xb8/0xe8
      [    1.376997]  bus_for_each_drv+0x78/0xc8
      [    1.380792]  __device_attach+0xd4/0x130
      [    1.384587]  device_initial_probe+0x10/0x18
      [    1.388727]  bus_probe_device+0x90/0x98
      [    1.392522]  deferred_probe_work_func+0x6c/0xa0
      [    1.397010]  process_one_work+0x1e0/0x318
      [    1.400975]  worker_thread+0x228/0x428
      [    1.404684]  kthread+0x124/0x128
      [    1.407876]  ret_from_fork+0x10/0x18
      [    1.411410] ---[ end trace de5fd1b262c1f56a ]---
      [    1.416055] WARNING: CPU: 1 PID: 44 at drivers/regulator/core.c:2054 _regulator_put.part.11+0xf0/0xf8
      [    1.425123] Modules linked in:
      [    1.428144] CPU: 1 PID: 44 Comm: kworker/1:1 Tainted: GW 5.0.0-rc1-xc2ml #3
      [    1.436422] Hardware name: Hardkernel ODROID-C2 (DT)
      [    1.441340] Workqueue: events deferred_probe_work_func
      
      Fixes: 5a0803bd ("ARM64: dts: meson-gxbb-odroidc2: Enable USB Nodes")
      Tested-by: default avatarKevin Hilman <khilman@baylibre.com>
      Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Neil Armstrong <narmstrong@baylibre.com>
      Reviewed-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: default avatarAnand Moon <linux.amoon@gmail.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      f01d1f47
    • Eugeniy Paltsev's avatar
      ARCv2: lib: memeset: fix doing prefetchw outside of buffer · 51769fab
      Eugeniy Paltsev authored
      ARCv2 optimized memset uses PREFETCHW instruction for prefetching the
      next cache line but doesn't ensure that the line is not past the end of
      the buffer. PRETECHW changes the line ownership and marks it dirty,
      which can cause issues in SMP config when next line was already owned by
      other core. Fix the issue by avoiding the PREFETCHW
      
      Some more details:
      
      The current code has 3 logical loops (ignroing the unaligned part)
        (a) Big loop for doing aligned 64 bytes per iteration with PREALLOC
        (b) Loop for 32 x 2 bytes with PREFETCHW
        (c) any left over bytes
      
      loop (a) was already eliding the last 64 bytes, so PREALLOC was
      safe. The fix was removing PREFETCW from (b).
      
      Another potential issue (applicable to configs with 32 or 128 byte L1
      cache line) is that PREALLOC assumes 64 byte cache line and may not do
      the right thing specially for 32b. While it would be easy to adapt,
      there are no known configs with those lie sizes, so for now, just
      compile out PREALLOC in such cases.
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Cc: stable@vger.kernel.org #4.4+
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      [vgupta: rewrote changelog, used asm .macro vs. "C" macro]
      51769fab
    • Vineet Gupta's avatar
      ARC: mm: do_page_fault fixes #1: relinquish mmap_sem if signal arrives while handle_mm_fault · ce3e02e8
      Vineet Gupta authored
      do_page_fault() forgot to relinquish mmap_sem if a signal came while
      handling handle_mm_fault() - due to say a ctl+c or oom etc.
      This would later cause a deadlock by acquiring it twice.
      
      This came to light when running libc testsuite tst-tls3-malloc test but
      is likely also the cause for prior seen LTP failures. Using lockdep
      clearly showed what the issue was.
      
      | # while true; do ./tst-tls3-malloc ; done
      | Didn't expect signal from child: got `Segmentation fault'
      | ^C
      | ============================================
      | WARNING: possible recursive locking detected
      | 4.17.0+ #25 Not tainted
      | --------------------------------------------
      | tst-tls3-malloc/510 is trying to acquire lock:
      | 606c7728 (&mm->mmap_sem){++++}, at: __might_fault+0x28/0x5c
      |
      |but task is already holding lock:
      |606c7728 (&mm->mmap_sem){++++}, at: do_page_fault+0x9c/0x2a0
      |
      | other info that might help us debug this:
      |  Possible unsafe locking scenario:
      |
      |       CPU0
      |       ----
      |  lock(&mm->mmap_sem);
      |  lock(&mm->mmap_sem);
      |
      | *** DEADLOCK ***
      |
      
      ------------------------------------------------------------
      What the change does is not obvious (note to myself)
      
      prior code was
      
      | do_page_fault
      |
      |   down_read()		<-- lock taken
      |   handle_mm_fault	<-- signal pending as this runs
      |   if fatal_signal_pending
      |       if VM_FAULT_ERROR
      |           up_read
      |       if user_mode
      |          return	<-- lock still held, this was the BUG
      
      New code
      
      | do_page_fault
      |
      |   down_read()		<-- lock taken
      |   handle_mm_fault	<-- signal pending as this runs
      |   if fatal_signal_pending
      |       if VM_FAULT_RETRY
      |          return       <-- not same case as above, but still OK since
      |                           core mm already relinq lock for FAULT_RETRY
      |    ...
      |
      |   < Now falls through for bug case above >
      |
      |   up_read()		<-- lock relinquished
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      ce3e02e8
    • Vineet Gupta's avatar
      ARC: show_regs: lockdep: re-enable preemption · d9b827dd
      Vineet Gupta authored
      signal handling core calls show_regs() with preemption disabled which
      on ARC takes mmap_sem for mm/vma access, causing lockdep splat.
      
      | [ARCLinux]# ./segv-null-ptr
      | potentially unexpected fatal signal 11.
      | BUG: sleeping function called from invalid context at kernel/fork.c:1011
      | in_atomic(): 1, irqs_disabled(): 0, pid: 70, name: segv-null-ptr
      | no locks held by segv-null-ptr/70.
      | CPU: 0 PID: 70 Comm: segv-null-ptr Not tainted 4.18.0+ #69
      |
      | Stack Trace:
      |  arc_unwind_core+0xcc/0x100
      |  ___might_sleep+0x17a/0x190
      |  mmput+0x16/0xb8
      |  show_regs+0x52/0x310
      |  get_signal+0x5ee/0x610
      |  do_signal+0x2c/0x218
      |  resume_user_mode_begin+0x90/0xd8
      
      Workaround by re-enabling preemption temporarily.
      
      Note that the preemption disabling in core code around show_regs()
      was introduced by commit 3a9f84d3 ("signals, debug: fix BUG: using
      smp_processor_id() in preemptible code in print_fatal_signal()")
      
      to silence a differnt lockdep seen on x86 bakc in 2009.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      d9b827dd
    • Vineet Gupta's avatar
      ARC: show_regs: lockdep: avoid page allocator... · 374b21c8
      Vineet Gupta authored
      and use smaller/on-stack buffer instead
      
      The motivation for this change was lockdep splat like below.
      
      | potentially unexpected fatal signal 11.
      | BUG: sleeping function called from invalid context at ../mm/page_alloc.c:4317
      | in_atomic(): 1, irqs_disabled(): 0, pid: 57, name: segv
      | no locks held by segv/57.
      | Preemption disabled at:
      | [<8182f17e>] get_signal+0x4a6/0x7c4
      | CPU: 0 PID: 57 Comm: segv Not tainted 4.17.0+ #23
      |
      | Stack Trace:
      |  arc_unwind_core.constprop.1+0xd0/0xf4
      |  __might_sleep+0x1f6/0x234
      |  __get_free_pages+0x174/0xca0
      |  show_regs+0x22/0x330
      |  get_signal+0x4ac/0x7c4     # print_fatal_signals() -> preempt_disable()
      |  do_signal+0x30/0x224
      |  resume_user_mode_begin+0x90/0xd8
      
      So signal handling core calls show_regs() with preemption disabled but
      an ensuing GFP_KERNEL page allocator call is flagged by lockdep.
      
      We could have switched to GFP_NOWAIT, but turns out that is not enough
      anways and eliding page allocator call leads to less code and
      instruction traces to sift thru when debugging pesky crashes.
      
      FWIW, this patch doesn't cure the lockdep splat (which next patch does).
      Reviewed-by: default avatarWilliam Kucharski <william.kucharski@oracle.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      374b21c8
    • Eugeniy Paltsev's avatar
      ARC: perf: avoid kernel killing where it is possible · df7ae555
      Eugeniy Paltsev authored
      No, not gonna die tonight.
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      df7ae555
    • Eugeniy Paltsev's avatar
      ARC: perf: move HW events mapping to separate function · 139559af
      Eugeniy Paltsev authored
      Move HW events mapping to separate function to make code more readable.
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      139559af
    • Eugeniy Paltsev's avatar
      ARC: perf: introduce Kernel PMU events support · 94af2961
      Eugeniy Paltsev authored
      Export all available ARC architected hardware events as
      kernel PMU events to make non-generic events accessible.
      
      ARC PMU HW allow us to read the list of all available
      events names. So we generate kernel PMU event list
      dynamically in arc_pmu_device_probe() using
      human-readable events names we got from HW instead of
      using pre-defined events list.
      
      -------------------------->8--------------------------
      $ perf list
        [snip]
        arc_pmu/bdata64/                  [Kernel PMU event]
        arc_pmu/bdcstall/                 [Kernel PMU event]
        arc_pmu/bdslot/                   [Kernel PMU event]
        arc_pmu/bfbmp/                    [Kernel PMU event]
        arc_pmu/bfirqex/                  [Kernel PMU event]
        arc_pmu/bflgstal/                 [Kernel PMU event]
        arc_pmu/bflush/                   [Kernel PMU event]
      -------------------------->8--------------------------
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      94af2961
    • Eugeniy Paltsev's avatar
      ARC: perf: trivial code cleanup · 6fab3baa
      Eugeniy Paltsev authored
      * Use BIT(), lower_32_bits(), upper_32_bits() macroses,
        fix code style violations.
      * Use u32, u64, s64 instead of uint32_t, uint64_t, int64_t
      * Fix description comment as this code doesn't belong only to
        ARC700 anymore.
      * Use SPDX License Identifier.
      * Remove useless ifdefs. ifdef around 'arc_pmu_match' structure
        declaration is useless as we refer to 'arc_pmu_match' in
        several places which aren't guarded with ifdef. Nevertheless
        'ARC' option selects 'OF' unconditionally so we can simply
        get rid of this ifdef.
      Acked-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      6fab3baa
    • Eugeniy Paltsev's avatar
      ARC: perf: map generic branches to correct hardware condition · 3fb13c41
      Eugeniy Paltsev authored
      So far we've mapped branches to "ijmp" which also counts conditional
      branches NOT taken. This makes us different from other architectures
      such as ARM which seem to be counting only taken branches.
      
      So use "ijmptak" hardware condition which only counts (all jump
      instructions that are taken)
      
      'ijmptak' event is available on both ARCompact and ARCv2 ISA based
      cores.
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      [vgupta: reworked changelog]
      3fb13c41
    • Eugeniy Paltsev's avatar
      ARC: adjust memblock_reserve of kernel memory · 8bfa90f9
      Eugeniy Paltsev authored
      In setup_arch_memory we reserve the memory area wherein the kernel
      is located. Current implementation may reserve more memory than
      it actually required in case of CONFIG_LINUX_LINK_BASE is not
      equal to CONFIG_LINUX_RAM_BASE. This happens because we calculate
      start of the reserved region relatively to the CONFIG_LINUX_RAM_BASE
      and end of the region relatively to the CONFIG_LINUX_RAM_BASE.
      
      For example in case of HSDK board we wasted 256MiB of physical memory:
      ------------------->8------------------------------
      Memory: 770416K/1048576K available (5496K kernel code,
          240K rwdata, 1064K rodata, 2200K init, 275K bss,
          278160K reserved, 0K cma-reserved)
      ------------------->8------------------------------
      
      Fix that.
      
      Fixes: 9ed68785f7f2b2b ("ARC: mm: Decouple RAM base address from kernel link addr")
      Cc: stable@vger.kernel.org	#4.14+
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      8bfa90f9
    • Jerome Brunet's avatar
      arm64: dts: meson-axg: add efuse device · 9ab2d15c
      Jerome Brunet authored
      Add efuse to the AXG family
      Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      9ab2d15c
    • Jerome Brunet's avatar
      arm64: dts: meson: s400: fix emmc maximum rate · ec01fb69
      Jerome Brunet authored
      Limiting the HS200 rate on the s400 was just a way to mask that the
      tuning setting were not correct. This seems to have been fixed with
      the recent MMC driver update. We can now use HS200 at full speed.
      Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      ec01fb69
    • Jerome Brunet's avatar
      arm64: dts: meson: s400: enable sdr104 on sdio · 5ca872c5
      Jerome Brunet authored
      The bcm wifi/bt device on SDIO support SDR104 and it seems to work
      well following the recent mmc driver update, so enable this
      ultra high speed mode
      Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      5ca872c5
    • Maxime Jourdan's avatar
      arm64: dts: meson-gx: add support for simplefb · 03b37035
      Maxime Jourdan authored
      SimpleFB allows transferring a framebuffer from the firmware/bootloader
      to the kernel, while making sure the related clocks and power supplies
      stay enabled.
      
      Add nodes for CVBS and HDMI Simple Framebuffers.
      Signed-off-by: default avatarMaxime Jourdan <mjourdan@baylibre.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      03b37035
    • Florian Fainelli's avatar
      ARM: orion5x: Include platform_data/dsa.h · e5f02a31
      Florian Fainelli authored
      Now that we have split the DSA platform data structures from the main
      net/dsa.h header file, include only the relevant header file.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e5f02a31
    • Maxime Jourdan's avatar
      arm64: dts: meson-gx: Add canvas provider node to the vpu · cf342879
      Maxime Jourdan authored
      Allows the vpu driver to optionally use a canvas provider node.
      Signed-off-by: default avatarMaxime Jourdan <mjourdan@baylibre.com>
      Acked-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
      cf342879
    • Masahiro Yamada's avatar
      openrisc: remove unneeded code in arch/openrisc/Makefile · 1b504a7b
      Masahiro Yamada authored
       - LDFLAGS_vmlinux is cleared by the top Makefile
      
       - 'all: vmlinux' is specified by the top Makefile
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      1b504a7b
    • Masahiro Yamada's avatar
      nds32: remove unneeded code in arch/nds32/Makefile · 558ee616
      Masahiro Yamada authored
       - scripts/Kbuild.include already defined 'comma'
      
       - The top Makefile has 'PHONY += FORCE'
      
       - include/asm-*/ was moved to arch/*/include/asm/ a decade ago
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      558ee616
    • Robin Murphy's avatar
      arm64: dts: rockchip: 'Fix' nanopi4 uSD card detect · 10f595ee
      Robin Murphy authored
      For whatever reason, the sdmmc_dectn function isn't working properly
      as-is, and microSD insertion and removal goes unnoticed. Using the pin
      as a GPIO interrupt instead is rather noisy without any debouncing, but
      is good enough to make it useful until someone feels inclined to figure
      out how the vendor kernel/firmware gets the dedicated function to work
      with no obvious difference in the pinmux/GRF configuration. Let's also
      take the opportunity to tweak the node name so that all related pins
      end up grouped together in the compiled DTB.
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      10f595ee
    • Robin Murphy's avatar
      arm64: dts: rockchip: Add NanoPC-T4 IR receiver · 95658e21
      Robin Murphy authored
      In common with most Rockchip reference designs, NanoPC-T4 has a passive
      IR receiver connected to PWM3. In lieu of a specialised driver for
      PWM-based IR pulse measurement, running the pin as a GPIO with the basic
      driver works perfectly well.
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      95658e21
    • Robin Murphy's avatar
      arm64: dts: rockchip: Refine nanopi4 differences · c62ffaf5
      Robin Murphy authored
      The nanopi4 boards differ primarily in their power trees, with the main
      5V and 3.3V rails having very different topologies on the smaller USB-C
      powered boards vs. the 12V-powered T4, as well as minor variation in
      other regulators related to various external connectors.
      
      Additionally, the recovery key is only present on the T4 - ADC_IN1 is
      simply pulled high and not exposed on the other boards - and the lowest
      common denominator for MMC speed is actually HS200 according to the
      vendor DTs.
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      c62ffaf5
    • Robin Murphy's avatar
      arm64: dts: rockchip: Add DT for NanoPi M4 · 1a6e7411
      Robin Murphy authored
      There are a number of subtle differences between the nanopi4 variants,
      and where they disagree, the common DTSI currently follows the details
      of NanoPi M4. In order to improve matters even more, let's add a
      separate DTS for the M4 to which we can start splitting things out
      appropriately. The third variant, NanoPi NEO4, is a lot closer to the M4
      than either is to the larger T4, so arguably could get away with just
      sharing the M4 DT for now (plus I have neither of the smaller boards to
      actually test with).
      
      CC: Rob Herring <robh+dt@kernel.org>
      CC: Mark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      1a6e7411
    • Geert Uytterhoeven's avatar
      arm64: dts: renesas: r8a77990: Enable DMA for SCIF2 · c66a5bd9
      Geert Uytterhoeven authored
      SCIF2 on R-Car E3 can be used with both DMAC1 and DMAC2.
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      c66a5bd9
    • Geert Uytterhoeven's avatar
      arm64: dts: renesas: r8a77965: Enable DMA for SCIF2 · 05c8478a
      Geert Uytterhoeven authored
      SCIF2 on R-Car M3-N can be used with both DMAC1 and DMAC2.
      
      Fixes: 0ea5b2fd ("arm64: dts: renesas: r8a77965: Add SCIF device nodes")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      05c8478a
    • Geert Uytterhoeven's avatar
      arm64: dts: renesas: r8a7796: Enable DMA for SCIF2 · 97f26702
      Geert Uytterhoeven authored
      SCIF2 on R-Car M3-W can be used with both DMAC1 and DMAC2.
      
      Fixes: dbcae5ea ("arm64: dts: r8a7796: Enable SCIF DMA")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      97f26702
    • Geert Uytterhoeven's avatar
      arm64: dts: renesas: r8a774c0: Enable DMA for SCIF2 · 77d7050e
      Geert Uytterhoeven authored
      SCIF2 on RZ/G2E can be used with both DMAC1 and DMAC2.
      
      Fixes: 1b24f9e8 ("arm64: dts: renesas: r8a774c0: Add SCIF and HSCIF nodes")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      77d7050e
    • Geert Uytterhoeven's avatar
      arm64: dts: renesas: r8a774a1: Enable DMA for SCIF2 · 2bb7b675
      Geert Uytterhoeven authored
      SCIF2 on RZ/G2M can be used with both DMAC1 and DMAC2.
      
      Fixes: 3a3933a4 ("arm64: dts: renesas: r8a774a1: Add SCIF and HSCIF nodes")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      2bb7b675
    • Ulrich Hecht's avatar
      ARM: dts: r8a7778: Add HSCIF0/1 support · adbb78e1
      Ulrich Hecht authored
      Add HSCIF0/1 clocks and device nodes, based on Rev. 1.00 of the R-Car
      M1A datasheet.
      Signed-off-by: default avatarUlrich Hecht <ulrich.hecht+renesas@gmail.com>
      [geert: Squashed two patches]
      [geert: Correct HSCIF1 module clock index]
      [geert: Correct reg properties for non-LPAE]
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      adbb78e1
    • Alban Bedel's avatar
      spi: ath79: Enable support for compile test · b172fd0c
      Alban Bedel authored
      To allow building this driver in compile test we need to remove all
      dependency on headers from arch/mips/include. To allow this we
      explicitly define all the registers locally instead of using
      ar71xx_regs.h and we move the platform data struct definition to
      include/linux/platform_data/spi-ath79.h.
      Signed-off-by: default avatarAlban Bedel <albeu@free.fr>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      b172fd0c
    • Vijay Khemka's avatar
      ARM: dts: aspeed: tiogapass: Add sensors · 1a5ebcd4
      Vijay Khemka authored
      Added ADC and other sensor devices present in the Facebook Tiogapass
      machine.
      Signed-off-by: default avatarVijay Khemka <vijaykhemka@fb.com>
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      1a5ebcd4
    • Vijay Khemka's avatar
      ARM: dts: aspeed: tiogapass: Enable KCS · e7b66ba2
      Vijay Khemka authored
      Tiogapass uses two KCS channels.
      Signed-off-by: default avatarVijay Khemka <vijaykhemka@fb.com>
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      e7b66ba2
    • Vijay Khemka's avatar
      ARM: dts: aspeed: Add KCS support for LPC BMC · 9e9a6ad1
      Vijay Khemka authored
      This adds the description of the four Keyboard Controller Style (KCS)
      IPMI communication channels present in the ASPEED BMC. They are disabled
      by default.
      Signed-off-by: default avatarVijay Khemka <vijaykhemka@fb.com>
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      9e9a6ad1
    • Mark Walton's avatar
      ARM: dts: aspeed: Add #interrupt-cells property to gpio controllers · 8b880293
      Mark Walton authored
      Allows the GPIO controller to be used as an interrupt parent.
      
      of_irq_find_parent() skips interrupt controller nodes that do
      not have the #interrupt-cells property.
      Signed-off-by: default avatarMark Walton <mark.walton@serialtek.com>
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      8b880293
    • Joel Stanley's avatar
      80baf890