firefly-linux-kernel-4.4.55.git
7 years agoARM: dts: rk3229: add cpu-supply property for cpu node in evb board
Finley Xiao [Thu, 11 May 2017 08:08:30 +0000 (16:08 +0800)]
ARM: dts: rk3229: add cpu-supply property for cpu node in evb board

This patch adds the cpu-supply property so that cpu can do dvfs

Change-Id: I6cfc1c8e467652ad9b748c6a9980b00006181910
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoARM: dts: rk3229: add cpu-supply property for cpu node in echo-v1 board
Finley Xiao [Thu, 11 May 2017 03:37:31 +0000 (11:37 +0800)]
ARM: dts: rk3229: add cpu-supply property for cpu node in echo-v1 board

This patch adds the cpu-supply property so that cpu can do dvfs

Change-Id: I5edff7fabd1de23407e8fcb7d70e3b0eeee2ee0e
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoARM: dts: rk3229: add a new cpu opp table
Finley Xiao [Thu, 11 May 2017 06:49:37 +0000 (14:49 +0800)]
ARM: dts: rk3229: add a new cpu opp table

This patch adds some new frequencies for rk3229 boards

Change-Id: Ie35efc3f04350bcfd1eae31a72adfc9166bef781
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoARM: dts: rk322x: add operating-points-v2 property for cpu
Finley Xiao [Thu, 11 May 2017 03:27:09 +0000 (11:27 +0800)]
ARM: dts: rk322x: add operating-points-v2 property for cpu

This patch adds a new opp table for cpu

Change-Id: I59384ab8ab649ca4672adf64c52f16da76777ce4
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoclk: rockchip: rk3228: add 1464000000 into cpuclk rate table
Finley Xiao [Thu, 11 May 2017 03:14:13 +0000 (11:14 +0800)]
clk: rockchip: rk3228: add 1464000000 into cpuclk rate table

This patch adds 1464000000Hz for armclk

Change-Id: I3e4c18acf13036b778f18fe166ae47682a97feeb
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agodt-bindings: rockchip: vop: add gamma_table range
Mark Yao [Thu, 11 May 2017 07:04:27 +0000 (15:04 +0800)]
dt-bindings: rockchip: vop: add gamma_table range

Change-Id: Iafbff319d33c9436963572e05911ccfe676a4852
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoFROMLIST: drm: Pass CRTC ID in userspace vblank events
Ander Conselvan de Oliveira [Tue, 4 Apr 2017 16:52:21 +0000 (17:52 +0100)]
FROMLIST: drm: Pass CRTC ID in userspace vblank events

With the atomic API, it is possible that a single commit affects
multiple crtcs. If the user requests an event with that commit, one
event will be sent for each CRTC, but it is not possible to distinguish
which crtc an event is for in user space. To solve this, the reserved
field in struct drm_vblank_event is repurposed to include the crtc_id
which the event is for.

The DRM_CAP_CRTC_IN_VBLANK_EVENT is added to allow userspace to query if
the crtc field will be set properly.

[daniels: Rebased, using Maarten's forward-port.]

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Maarten Lankhorst <maarten.lankhorst@intel.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
(am from https://patchwork.kernel.org/patch/9662099/)

Change-Id: Ibe6949782e5df5363d4eaa3e98b3ff413239cf26
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agomfd: fusb302: ignored the timeout if vdm got the message.
zain wang [Wed, 10 May 2017 03:21:30 +0000 (11:21 +0800)]
mfd: fusb302: ignored the timeout if vdm got the message.

The PD spec define the source should ensure that a message requesting
a response is responded within 30ms(tSenderResponse). But if the
message responded is received close to 30ms, we may hit the case:

tcpm_get_message(); //get the data and close to 30ms
... takes about 600us, meanwhile the 30ms timer came.
auto_vdm_machine
vdm_send... //we get the message, but timeout.

So, let's ignored the timeout if we get the message.

Change-Id: I64ced1bd2d32d8ef996dcec27cf35c3e333386f8
Signed-off-by: zain wang <wzz@rock-chips.com>
7 years agoarm: dts: rockchip: add gamma table support for rk322x
Mark Yao [Thu, 11 May 2017 06:57:06 +0000 (14:57 +0800)]
arm: dts: rockchip: add gamma table support for rk322x

Change-Id: I9aa8af01bd989ff244153d53c8b9b8ca06d3f834
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm: dts: rockchip: add gamma table support for rk3288
Mark Yao [Thu, 11 May 2017 06:56:57 +0000 (14:56 +0800)]
arm: dts: rockchip: add gamma table support for rk3288

Change-Id: Idb4cd93b8a696925ac56b98c1619999949e6fd84
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: dts: rockchip: add gamma table support for rk3368
Mark Yao [Thu, 11 May 2017 06:56:43 +0000 (14:56 +0800)]
arm64: dts: rockchip: add gamma table support for rk3368

Change-Id: Ia0390aa0ffe99a2c2b6ba82ecd83610683d49eac
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: dts: rockchip: add gamma table support for rk3399
Mark Yao [Thu, 11 May 2017 06:14:49 +0000 (14:14 +0800)]
arm64: dts: rockchip: add gamma table support for rk3399

Rk3399 vopb's gamma table size is 1024, vopl's gamma
table size is 256

Change-Id: Iea9cd70f82dfa9c9c8ae53a24c8153eebb981e7a
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: add support for gamma table
Mark Yao [Mon, 27 Apr 2015 18:39:35 +0000 (11:39 -0700)]
drm/rockchip: add support for gamma table

Introduce support for rockchip gamma table,

Rockchip have two version gamma table design:
The old version design was introduced by Dominik Behr's gamma patch
(https://chromium-review.googlesource.com/272209):
 Gamma table has to be uploaded when the LUT is disabled which only takes
 effect at the end of a frame, therefore actual hardware updates is done
 from a worker and can take more than one frame.

In order to solve gamma table switch issues, after rk3399,
H/W add a gamma table update mechanism, can update without lut disable.

And gamma table's size also has two version:
  one is 10 bit per component, 1024 entries,
  the other one is 8 bit per component, 256 entries

Change-Id: I8145d1c42a28d57f11e95d24be2341011360334d
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoPM / devfreq: rockchip_dmc: avoid waiting for vop line flag indefinitely
Finley Xiao [Tue, 9 May 2017 13:53:37 +0000 (21:53 +0800)]
PM / devfreq: rockchip_dmc: avoid waiting for vop line flag indefinitely

It may disable vop_crtc when scaling frequency, in this case,
devfreq thread will wait for vop line flag indefinitely, the
system will crash.

Change-Id: I7043b285c329ff23e2fc9c5b5f3a165c37ef6378
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agodrm/rockchip: vop: export rockchip_drm_register_notifier_to_dmc
Finley Xiao [Tue, 9 May 2017 13:34:24 +0000 (21:34 +0800)]
drm/rockchip: vop: export rockchip_drm_register_notifier_to_dmc

This function registers a notifier to dmc devfreq, devfreq thread will
lock the mutex of vop when scaling frequency, so vop_crtc will not be
disabled when it is waiting for line flag.

Change-Id: I886e5dc5d36a0f14f35662cec3423a2c5550a7a6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agodrm/rockchip: vop: add vop enable/disable mutex lock
Finley Xiao [Tue, 9 May 2017 13:31:31 +0000 (21:31 +0800)]
drm/rockchip: vop: add vop enable/disable mutex lock

It may disable vop_crtc when waiting for line flag, in this case,
we would not get line flag any more. So the lock should be added
to prevent rockchip_wait_line_flag() from vop_crtc_disable();

Change-Id: I312fd46e64006bf69e3c57f54513230b90866e21
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agocamera: rockchip: camsys driver v0.0x21.0xf
zhangyunlong [Tue, 9 May 2017 03:41:19 +0000 (11:41 +0800)]
camera: rockchip: camsys driver v0.0x21.0xf

add reference count for marvin

Change-Id: Ic410da2524a8972d782ccfdcb121e1727b02e9d8
Signed-off-by: zhangyunlong <dalon.zhang@rock-chips.com>
7 years agocamera: rockchip: fix some compiled errors and warn
xcq [Thu, 20 Apr 2017 08:27:16 +0000 (16:27 +0800)]
camera: rockchip: fix some compiled errors and warn

fix spin_unlock error use and some potential problems.

Change-Id: I860c225f2acb5e28827ad3f6b702b0dc7828bb0f
Signed-off-by: xcq <shawn.xu@rock-chips.com>
7 years agoARM: rockchip_defconfig: default to enable rockchip dmc
Tang Yun ping [Sat, 6 May 2017 03:22:30 +0000 (11:22 +0800)]
ARM: rockchip_defconfig: default to enable rockchip dmc

Change-Id: Ia52708079d41379d0c530b08d6a3a6bf109ee98c
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
7 years agoPM / devfreq: rockchip_dmc: add support for rk3288
Tang Yun ping [Tue, 11 Apr 2017 08:14:47 +0000 (16:14 +0800)]
PM / devfreq: rockchip_dmc: add support for rk3288

This adds the necessary data for handling dmcfreq on the rk3288.

Change-Id: I042222f899d03ec1832ac47b48db8c6c46c3b0d3
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
7 years agoPM / devfreq: event: add support for rk3288 dfi
Tang Yun ping [Wed, 12 Apr 2017 08:24:16 +0000 (16:24 +0800)]
PM / devfreq: event: add support for rk3288 dfi

This adds the necessary data for handling dfi on the rk3288.
Access the dfi via registers provided by GRF (general register
files) module.

Change-Id: Ic7241af3c20a269ab362055dea04d260e01c50de
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
7 years agoclk: rockchip: support setting ddr clock via SIP Version 2 APIs
Tang Yun ping [Thu, 4 May 2017 12:49:58 +0000 (20:49 +0800)]
clk: rockchip: support setting ddr clock via SIP Version 2 APIs

1. Add support setting ddr clock via SIP Version 2 APIs
2. RK3288 using SIP Vision 2.

Change-Id: I935e43b1885a96650dc86e3eb6d79de6795062a9
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
7 years agosip: rockchip: fix bus about make kernel failure
Tang Yun ping [Mon, 8 May 2017 11:30:56 +0000 (19:30 +0800)]
sip: rockchip: fix bus about make kernel failure

When undefine "CONFIG_ROCKCHIP_SIP", define an empty sip function
to avoid make kernel failure.

Change-Id: Id6bcf1cec1c11f09511852e015631d14279ca8bc
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
7 years agodrm: add drm_device_get_by_name support
Mark Yao [Fri, 5 May 2017 07:24:43 +0000 (15:24 +0800)]
drm: add drm_device_get_by_name support

Change-Id: Ifbd0f403ca2302e9329a16d7b69db5ee056cadf7
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoRevert "fiq debugger: add resume for debug uart"
Huibin Hong [Thu, 27 Apr 2017 01:13:53 +0000 (09:13 +0800)]
Revert "fiq debugger: add resume for debug uart"

This reverts commit 0e7d751d6c004970348bdacb6961e06e7775cb92.

If enable no console suspend, it will do resume when printing log,
which causes problem. Remove resume of kernel, and add resume of
trust firmware or other power management code.

Change-Id: I3e8e704140134a6aad5c0eb2f14fde36fb108ad3
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
7 years agoarm: dts: add vdd_arm and vdd_log regulator for rk3229-evb
Frank Wang [Wed, 10 May 2017 03:23:49 +0000 (11:23 +0800)]
arm: dts: add vdd_arm and vdd_log regulator for rk3229-evb

Change-Id: I1a0bbee3e5b9a43f2a79285c04497ec598697404
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoarm64: dts: rk3368-android: revert to use uart2 for debug
Xu Jianqun [Wed, 10 May 2017 01:21:04 +0000 (09:21 +0800)]
arm64: dts: rk3368-android: revert to use uart2 for debug

Change-Id: I5e6c88e185a2ad39b082ad4b989589cd46ecb874
Signed-off-by: Xu Jianqun <jay.xu@rock-chips.com>
7 years agonet: stmmac: The netif_device_attach() should be called after napi_enable()
David Wu [Fri, 28 Apr 2017 09:41:43 +0000 (17:41 +0800)]
net: stmmac: The netif_device_attach() should be called after napi_enable()

If the netif_device_attach() is called earlier, the state of dev_queue is
waked, txtimer might be modified, and the txtimer is added at same time.
It might make run_timer_softirq crashed, because the timer is be detached
twice together.

Change-Id: I31dde4e940bddcc36372ca1f4a8313c0389d4e6b
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoarm: dts: simplified rk3229 board configs.
Frank Wang [Tue, 2 May 2017 08:42:38 +0000 (16:42 +0800)]
arm: dts: simplified rk3229 board configs.

Move EMMC and UART configs from every board DTS to a DTSI file.

Change-Id: If2fd49b9243b879ae89e172f55903eedfd4f3981
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoarm: dts: add watchdog and uart2 related for rk322x SoC
Frank Wang [Mon, 8 May 2017 07:23:40 +0000 (15:23 +0800)]
arm: dts: add watchdog and uart2 related for rk322x SoC

Add another GPIO sets for UART2 since the old ones are conflict
with SDMMC, also add watchdog support.

Change-Id: Ib0f1472b9a7760e15e1b83e103f65f43e3642643
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoARM: dts: rockchip: remove dev_mode from rk3288
Randy Li [Tue, 25 Apr 2017 03:08:03 +0000 (11:08 +0800)]
ARM: dts: rockchip: remove dev_mode from rk3288

Since there is no combo device at RK3288, no need to
use this property anymore.

Change-Id: I56434161c4167fc048e4956e97b29617367e28f6
Signed-off-by: Randy Li <randy.li@rock-chips.com>
7 years agoclk: rockchip: rk3288: always enable gpll_ddr for ddrc.
Tang Yun ping [Mon, 8 May 2017 01:36:10 +0000 (09:36 +0800)]
clk: rockchip: rk3288: always enable gpll_ddr for ddrc.

When ddr frequency scanning, need to switch to gpll for saving
times.

Change-Id: Ibb7e4ed1fa4babaf65e1d98c8a0891766cea63de
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
7 years agosip: rockchip: add SHARE_PAGE_TYPE_DDR for ddr frequency scanning.
Tang Yun ping [Thu, 4 May 2017 12:38:28 +0000 (20:38 +0800)]
sip: rockchip: add SHARE_PAGE_TYPE_DDR for ddr frequency scanning.

Change-Id: I7b9c81912e15bf2cea6739a051e5f466ba759d77
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
7 years agophy: rockchip-inno-usb2: increase otg sm work first schedule time
William Wu [Fri, 5 May 2017 10:16:32 +0000 (18:16 +0800)]
phy: rockchip-inno-usb2: increase otg sm work first schedule time

In rockchip inno usb2 phy driver, we use otg_sm_work to
dynamically manage power consumption for phy otg-port.
If the otg-port works as peripheral mode and doesn't
communicate with usb host, we will suspend phy.

But once suspend phy, the phy no longer has any internal
clock running, include the utmi_clk which supplied for
usb controller. So if we suspend phy before usb controller
init, it will cause usb controller fail to initialize.

Specifically, without this pathch, the observed order is:
 1. unplug usb cable
 2. start system, do dwc2 controller probe
 3. dwc2_lowlevel_hw_enable()
    - phy_init()
     - rockchip_usb2phy_init()
      - schedule otg_sm_work after 2s
        put phy in suspend, and close utmi_clk
 4. dwc2_hsotg_udc_start() - fail to initialize the usb core

Generally, dwc2_hsotg_udc_start() can be called within 5s
after start system on rockchip platform, so we increase the
the first schedule delay time to 6s for otg_sm_work afer usb
controller calls phy_init(), this can make sure that the usb
controller completes initialization before phy enter suspend.

Change-Id: I40a7f6b24620e49a1273cb9c5051d62efb62810d
Signed-off-by: William Wu <william.wu@rock-chips.com>
7 years agomailbox: rk3368: fix error setting if mbox_msg is null
Xu Jianqun [Thu, 4 May 2017 03:16:52 +0000 (11:16 +0800)]
mailbox: rk3368: fix error setting if mbox_msg is null

Fix the error dump:

[19252.682822] Unable to handle kernel NULL pointer dereference at
virtual address 00000020
[19252.682834] pgd = ffffff800935d000
[19252.682844] [00000020] *pgd=0000000077ffe003, *pud=0000000077ffe003,
*pmd=0000000000000000
[19252.682852] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[19252.682863] Modules linked in: pvrsrvkm(O)
[19252.682872] CPU: 1 PID: 59 Comm: irq/32-ff6b0000 Tainted: G        W
O    4.4.55 #34
[19252.682875] Hardware name: Rockchip rk3368 p9 board (DT)
[19252.682880] task: ffffffc074cf8c40 ti: ffffffc074d04000 task.ti:
ffffffc074d04000
[19252.682894] PC is at mbox_chan_received_data+0xc/0x20
[19252.682901] LR is at rk3368_mbox_isr+0xb0/0xd0

Change-Id: I1873d6a7e7d1390d2c2c44a77c120d1a02614fdc
Signed-off-by: Xu Jianqun <jay.xu@rock-chips.com>
7 years agophy: rockchip-inno-usb2: add a delay after phy resume
William Wu [Fri, 5 May 2017 09:51:41 +0000 (17:51 +0800)]
phy: rockchip-inno-usb2: add a delay after phy resume

When resume phy, it need about 1.5 ~ 2ms to wait for
utmi_clk which used for USB controller to become stable.

Change-Id: I319a28069b4b3381f22cc34567226f341e948bd4
Signed-off-by: William Wu <william.wu@rock-chips.com>
7 years agoARM64: dts: rk3368-android: enable fiq mode
Huibin Hong [Thu, 4 May 2017 13:36:27 +0000 (21:36 +0800)]
ARM64: dts: rk3368-android: enable fiq mode

If this patch is used, dedicated trust firmwart is necessary.

Change-Id: I72ca3b1b722c4076f589341e40efcbeeb5a07a58
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
7 years agork_fiq_debugger: remove "read signal irq from dts directly"
Huibin Hong [Thu, 4 May 2017 13:33:37 +0000 (21:33 +0800)]
rk_fiq_debugger: remove "read signal irq from dts directly"

Change-Id: I1f531ce2f58b33d5501f8446ad393e7ac4f27ef0
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
7 years agoarm: dts: rk322x-android: enable usb otg controller and its phy
William Wu [Fri, 5 May 2017 09:41:00 +0000 (17:41 +0800)]
arm: dts: rk322x-android: enable usb otg controller and its phy

Change-Id: Ie03c7fe388360b0285d2a6eb0a455f5ed28e74c4
Signed-off-by: William Wu <william.wu@rock-chips.com>
7 years agophy: rockchip-inno-usb2: add otg-port support for rk322x SoC
William Wu [Fri, 5 May 2017 09:36:35 +0000 (17:36 +0800)]
phy: rockchip-inno-usb2: add otg-port support for rk322x SoC

This patch adds USB 2.0 PHY otg-port configuration for rk322x
SoC, this otg-port can be used for USB 2.0 OTG interface.

Change-Id: I7f2e362292edb45078a16d1a9665e3bdccc54814
Signed-off-by: William Wu <william.wu@rock-chips.com>
7 years agoarm: dts: rockchip: add u2phy otg-port and dwc2 ctrl nodes for rk322x SoC
William Wu [Fri, 5 May 2017 09:29:56 +0000 (17:29 +0800)]
arm: dts: rockchip: add u2phy otg-port and dwc2 ctrl nodes for rk322x SoC

This patch adds dwc2 controller and its phy nodes for rk322x SoC.

Change-Id: I29779baf92c28154ad342e234e8a5582984b8a12
Signed-off-by: William Wu <william.wu@rock-chips.com>
7 years agoARM: dts: rk322x: add vop display node
Mark Yao [Wed, 3 May 2017 08:25:50 +0000 (16:25 +0800)]
ARM: dts: rk322x: add vop display node

Change-Id: Ic26431540260c758b6872020c36a41efdb2d82f2
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoOP-TEE: use sema_init instead of __SEMAPHORE_INITIALIZER
Huang, Tao [Sat, 6 May 2017 05:45:41 +0000 (13:45 +0800)]
OP-TEE: use sema_init instead of __SEMAPHORE_INITIALIZER

Fix lockdep warning:
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU:rk3288:/ $  0 PID: 234 Comm: tee-supplicant Not tainted 4.4.64 #51
Hardware name: Rockchip (Device Tree)
[<c0110018>] (unwind_backtrace) from [<c010c048>] (show_stack+0x10/0x14)
[<c010c048>] (show_stack) from [<c04194a8>] (dump_stack+0x9c/0xd4)
[<c04194a8>] (dump_stack) from [<c018321c>] (__lock_acquire+0x638/0x1c10)
[<c018321c>] (__lock_acquire) from [<c01850ec>] (lock_acquire+0x1d0/0x29c)
[<c01850ec>] (lock_acquire) from [<c0bc0f3c>] (_raw_spin_lock_irqsave+0x50/0x64)
[<c0bc0f3c>] (_raw_spin_lock_irqsave) from [<c017e148>] (down_interruptible+0xc/0x48)
[<c017e148>] (down_interruptible) from [<c03cd72c>] (tee_supp_read+0x74/0x154)
[<c03cd72c>] (tee_supp_read) from [<c025d638>] (__vfs_read+0x2c/0xf0)
[<c025d638>] (__vfs_read) from [<c025de30>] (vfs_read+0x84/0x134)
[<c025de30>] (vfs_read) from [<c025e720>] (SyS_read+0x4c/0xa4)
[<c025e720>] (SyS_read) from [<c01072c0>] (ret_fast_syscall+0x0/0x1c)

Change-Id: I09335112bed6efb30e60a22b471d4467eecaf520
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable MODVERSIONS
Huang, Tao [Sat, 6 May 2017 09:52:33 +0000 (17:52 +0800)]
arm64: rockchip_defconfig: enable MODVERSIONS

353a964727cf ("ANDROID: android-base.cfg: add CONFIG_MODULES option")

Change-Id: I8e85dfd6c7fedf797066e5e707eba7595dc2c123
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable CONFIG_IKCONFIG
Huang, Tao [Sat, 6 May 2017 09:52:00 +0000 (17:52 +0800)]
arm64: rockchip_defconfig: enable CONFIG_IKCONFIG

6286b142aeb2 ("ANDROID: android-base.cfg: add CONFIG_IKCONFIG option")

Change-Id: I68b0dc00a68a3eb885eb32d8c82b326067a438dc
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: disable CONFIG_USELIB
Huang, Tao [Sat, 6 May 2017 09:51:02 +0000 (17:51 +0800)]
arm64: rockchip_defconfig: disable CONFIG_USELIB

1c634ee26be1 ("config: disable CONFIG_USELIB and CONFIG_FHANDLE")

Change-Id: I1518e974427572d941b982db3896eb72822872f8
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: rename UID_CPUTIME to UID_SYS_STATS
Huang, Tao [Sat, 6 May 2017 09:50:17 +0000 (17:50 +0800)]
arm64: rockchip_defconfig: rename UID_CPUTIME to UID_SYS_STATS

2ea16502ca00 ("ANDROID: uid_sys_stats: rename uid_cputime.c to uid_sys_stats.c")

Change-Id: I11ad23129722f87111a5c6f3881b4bdcc5626f66
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable ARM64_SW_TTBR0_PAN
Huang, Tao [Sat, 6 May 2017 09:56:21 +0000 (17:56 +0800)]
arm64: rockchip_defconfig: enable ARM64_SW_TTBR0_PAN

536bf705c5fd ("ANDROID: configs: CONFIG_ARM64_SW_TTBR0_PAN=y")

Change-Id: I49f562d81d8f354dfbeb545618bc6c907256d60b
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoARM: rockchip_defconfig: enable MODVERSIONS
Huang, Tao [Sat, 6 May 2017 09:29:27 +0000 (17:29 +0800)]
ARM: rockchip_defconfig: enable MODVERSIONS

353a964727cf ("ANDROID: android-base.cfg: add CONFIG_MODULES option")

Change-Id: Ia85709d1dc711f1ed8632e6299f121b4e6fbedc2
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoARM: rockchip_defconfig: enable CONFIG_IKCONFIG
Huang, Tao [Sat, 6 May 2017 09:28:01 +0000 (17:28 +0800)]
ARM: rockchip_defconfig: enable CONFIG_IKCONFIG

6286b142aeb2 ("ANDROID: android-base.cfg: add CONFIG_IKCONFIG option")

Change-Id: I4d0369b990f9f9d707b672c6959e668307be700b
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoARM: rockchip_defconfig: disable CONFIG_USELIB
Huang, Tao [Sat, 6 May 2017 09:26:09 +0000 (17:26 +0800)]
ARM: rockchip_defconfig: disable CONFIG_USELIB

1c634ee26be1 ("config: disable CONFIG_USELIB and CONFIG_FHANDLE")

Change-Id: I617db2524c604e732d9d3f4eae0b8566efd82e98
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoARM: rockchip_defconfig: rename UID_CPUTIME to UID_SYS_STATS
Huang, Tao [Sat, 6 May 2017 09:23:51 +0000 (17:23 +0800)]
ARM: rockchip_defconfig: rename UID_CPUTIME to UID_SYS_STATS

2ea16502ca00 ("ANDROID: uid_sys_stats: rename uid_cputime.c to uid_sys_stats.c")

Change-Id: I345f44e510cb0168e9816f7d9adecf5772cdb092
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoMerge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
Huang, Tao [Sat, 6 May 2017 06:23:00 +0000 (14:23 +0800)]
Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux-linaro-stable.git

* linux-linaro-lsk-v4.4-android: (521 commits)
  Linux 4.4.66
  ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram
  ARCv2: save r30 on kernel entry as gcc uses it for code-gen
  nfsd: check for oversized NFSv2/v3 arguments
  Input: i8042 - add Clevo P650RS to the i8042 reset list
  p9_client_readdir() fix
  MIPS: Avoid BUG warning in arch_check_elf
  MIPS: KGDB: Use kernel context for sleeping threads
  ALSA: seq: Don't break snd_use_lock_sync() loop by timeout
  ALSA: firewire-lib: fix inappropriate assignment between signed/unsigned type
  ipv6: check raw payload size correctly in ioctl
  ipv6: check skb->protocol before lookup for nexthop
  macvlan: Fix device ref leak when purging bc_queue
  ip6mr: fix notification device destruction
  netpoll: Check for skb->queue_mapping
  net: ipv6: RTF_PCPU should not be settable from userspace
  dp83640: don't recieve time stamps twice
  tcp: clear saved_syn in tcp_disconnect()
  sctp: listen on the sock only when it's state is listening or closed
  net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given
  ...

Conflicts:
drivers/usb/dwc3/gadget.c
include/linux/usb/quirks.h

Change-Id: I490f766b9a530b10da3107e20709538e4536a99d

7 years agoARM: rockchip_defconfig: update by savedefconfig
Huang, Tao [Sat, 6 May 2017 06:20:20 +0000 (14:20 +0800)]
ARM: rockchip_defconfig: update by savedefconfig

Change-Id: I96ee84cfa4b40b10f5fb273044a81b22f20f4efb
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: update by savedefconfig
Huang, Tao [Sat, 6 May 2017 06:17:39 +0000 (14:17 +0800)]
arm64: rockchip_defconfig: update by savedefconfig

Change-Id: I4aa6538762060d62da3da56065abee4d42134da2
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agocamera: rockchip: camsys driver disable debug
Xu Jianqun [Thu, 4 May 2017 07:09:06 +0000 (15:09 +0800)]
camera: rockchip: camsys driver disable debug

Change-Id: I1a4b3d1ab0e96bbc4ff482b8f3a3f8aa98b4529d
Signed-off-by: Xu Jianqun <jay.xu@rock-chips.com>
7 years agoarm64: dts: rk3368: add rockchip-suspend node
XiaoDong Huang [Fri, 5 May 2017 01:14:58 +0000 (09:14 +0800)]
arm64: dts: rk3368: add rockchip-suspend node

Change-Id: I68f8068c795e87ffa3cbea4b23ba5df56a70218d
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
7 years agosoc: rockchip: support rk3368 pm config
XiaoDong Huang [Wed, 26 Apr 2017 11:06:08 +0000 (19:06 +0800)]
soc: rockchip: support rk3368 pm config

Change-Id: I69e823d397a411c1b1395563870fca6485dfb936
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
7 years agoarm: dts: assigned host vbus regulator for rk3229-evb board
Frank Wang [Thu, 4 May 2017 07:20:14 +0000 (15:20 +0800)]
arm: dts: assigned host vbus regulator for rk3229-evb board

Change-Id: I86608300c600db0ece0120ce3fba0f541953910e
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoarm: dts: assigned host vbus regulator for rk3229-echo-v10 board
Frank Wang [Thu, 4 May 2017 07:16:32 +0000 (15:16 +0800)]
arm: dts: assigned host vbus regulator for rk3229-echo-v10 board

Change-Id: Ia4cd6a915750d933886b217d2c4818d4f66d31c9
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoarm: dts: enable all usb phy and usb host for rk322x SoC
Frank Wang [Thu, 4 May 2017 10:58:16 +0000 (18:58 +0800)]
arm: dts: enable all usb phy and usb host for rk322x SoC

Change-Id: Ia69914348eee190aea0cd0f1a380a4ce569f1cdf
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoarm: dts: add usb-phy and usb2.0 host nodes for rk322x SoC
Frank Wang [Thu, 4 May 2017 06:35:36 +0000 (14:35 +0800)]
arm: dts: add usb-phy and usb2.0 host nodes for rk322x SoC

This patch adds usb2.0 host and usb-phy related nodes for rk322x SoC.

Change-Id: Ib1c5375f81c8d7b55608b1b1793c27be012a8c6e
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agophy: rockchip-inno-usb2: add host-port support for rk322x SoC
Frank Wang [Thu, 4 May 2017 06:11:34 +0000 (14:11 +0800)]
phy: rockchip-inno-usb2: add host-port support for rk322x SoC

This adds support host-port on rk322x SoC and amend phy Documentation.

Change-Id: I440adc10e25c98cbe220275fecd12774c08d24d1
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agovideo: rockchip: vpu: support VDPU at RK3328
Randy Li [Wed, 12 Apr 2017 05:41:41 +0000 (13:41 +0800)]
video: rockchip: vpu: support VDPU at RK3328

The VDPU at RK3328 is a standalone decoder IP without
encoder. Also there is the other AVS+ decoder IP,
working as the combo IP.

I introduce the following commit from develop-3.10,
commit ee2f9f6912fb ("rk322xh/vcodec: bugfix, avoid combo device overwrite irq status")
commit 568dabeb12ef ("rockchip/vcodec: bugfix, inconsistence power on/off operation")

The following patches have not been introduced,
it would effect RKV device:
commit b8a2ce7e5b60 ("rockchip/vcodec: disable power-save optimization for hw defeat")
commit 046faf9ba20a ("rk322xh/vcodec: bugfix, probe failed when ion cma heap undefined")
commit beaeb230cbf2 ("rk322xh/vcodec: revise for rk322xh feature")

Change-Id: Ifc14daa84b692f8fcfbd4f6690ed66dd56bbbe29
Signed-off-by: Randy Li <randy.li@rock-chips.com>
7 years agovideo: rockchip: vpu: add avs decoder table
Randy Li [Mon, 17 Apr 2017 02:22:13 +0000 (10:22 +0800)]
video: rockchip: vpu: add avs decoder table

This table would be used for both AVS and AVS+ decoder.

Change-Id: I9557a3d170943a3b544d97b6c63f02679bd7b532
Signed-off-by: Randy Li <randy.li@rock-chips.com>
7 years agovideo: rockchip: vpu: only use the dev_mode for combo
Randy Li [Tue, 25 Apr 2017 03:06:06 +0000 (11:06 +0800)]
video: rockchip: vpu: only use the dev_mode for combo

The most of device can get this its running type from the
compatible. This property becomes unnecessary.

Change-Id: I40ec41b130fac2cadd47d92332d27c58a8c2c9f7
Signed-off-by: Randy Li <randy.li@rock-chips.com>
7 years agoPM / devfreq: rockchip_dmc: add mutex lock for pmu register
Finley Xiao [Tue, 2 May 2017 12:30:13 +0000 (20:30 +0800)]
PM / devfreq: rockchip_dmc: add mutex lock for pmu register

As dmc may also assess register PMU_BUS_IDLE_REQ, we should prevent
pd driver and dmc driver assessing this register at the same time.

Change-Id: I546033536c87dcf497774cbc6c8f36a3e651ff07
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agosoc: rockchip: power-domain: export rockchip_pm_register_notify_to_dmc
Finley Xiao [Tue, 2 May 2017 07:15:26 +0000 (15:15 +0800)]
soc: rockchip: power-domain: export rockchip_pm_register_notify_to_dmc

This function registers a notifier to dmc devfreq, it will lock the mutex
of pmu when scaling frequency, so that pd driver and dmc driver will not
assess register PMU_BUS_IDLE_REQ at the same time.

Change-Id: I0ba96599d9050d11924d032146e6b4d415629614
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agodmaengine: pl330: fix error message to dev_err_ratelimited
Xu Jianqun [Thu, 4 May 2017 03:57:33 +0000 (11:57 +0800)]
dmaengine: pl330: fix error message to dev_err_ratelimited

Change-Id: I4d1191f5b7d330c2786eaac42213b4d255b05db8
Signed-off-by: Xu Jianqun <jay.xu@rock-chips.com>
7 years agoARM64: dts: rk3368-p9: enable route mipi
Zorro Liu [Thu, 4 May 2017 03:10:45 +0000 (11:10 +0800)]
ARM64: dts: rk3368-p9: enable route mipi

Change-Id: Ib93918524c173bce1283b0001e0f8ca91594dc6f
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
7 years agoPM / devfreq: rockchip_dmc: set polling_ms to 50
Finley Xiao [Tue, 2 May 2017 12:13:18 +0000 (20:13 +0800)]
PM / devfreq: rockchip_dmc: set polling_ms to 50

In order to scaling frequency more timely, reduce the polling_ms.

Change-Id: Icbee5552396fa0552fb514d92ea77687228c3e28
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoPM / devfreq: rockchip_dmc: add support for rk3368
Finley Xiao [Tue, 2 May 2017 11:56:03 +0000 (19:56 +0800)]
PM / devfreq: rockchip_dmc: add support for rk3368

This adds the necessary data for handling dmcfreq on the rk3368.

Change-Id: Ie202cbaa3b27e52b22a5efc57c6e108fbd03a20a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoMerge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Alex Shi [Thu, 4 May 2017 04:01:39 +0000 (12:01 +0800)]
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android

7 years ago Merge tag 'v4.4.66' into linux-linaro-lsk-v4.4
Alex Shi [Thu, 4 May 2017 04:01:37 +0000 (12:01 +0800)]
 Merge tag 'v4.4.66' into linux-linaro-lsk-v4.4

 This is the 4.4.66 stable release

7 years agoPM / devfreq: rockchip_dmc: separate the initialized code of dram
Finley Xiao [Tue, 2 May 2017 09:31:30 +0000 (17:31 +0800)]
PM / devfreq: rockchip_dmc: separate the initialized code of dram

It will be easy to compatible with more rockchip platforms,
if move the initialized code of dram into a separated function.

Change-Id: Iad8738b2c0995712723a8e3e84f12ae6b9b2aa91
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agocamera: rockchip: camsys_drv: 0.0x21.0xe
dalong.zhang [Tue, 2 May 2017 13:58:55 +0000 (21:58 +0800)]
camera: rockchip: camsys_drv: 0.0x21.0xe

1) correct mipiphy_hsfreqrange of 3368.
2) add csi-phy timing setting for 3368.

Change-Id: Ia5203dcd8f01bc8989d5bb41a1b2af71bb91f607
Signed-off-by: dalong.zhang <dalon.zhang@rock-chips.com>
7 years agoarm64: dts: rockchip: fix uart3 pinctrl error of rk3368
Zorro Liu [Thu, 4 May 2017 01:25:09 +0000 (09:25 +0800)]
arm64: dts: rockchip: fix uart3 pinctrl error of rk3368

Change-Id: Ie62fd4c6cf1a9c38a1793c9ccd0085c91f38f438
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
7 years agodrm/rockchip: rga: use DMA_BIDIRECTIONAL
Jacob Chen [Tue, 2 May 2017 03:25:31 +0000 (11:25 +0800)]
drm/rockchip: rga: use DMA_BIDIRECTIONAL

In some cases, we need to read data from RGA
and DMA_TO_DEVICE are not a proper flag
So change to DMA_BIDIRECTIONAL

Change-Id: I9d421e8a15f948fcb6643addab558803247ea161
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoarm: dts: rk3288: remove assinged parent for NPLL/GPLL
Xu Jianqun [Thu, 4 May 2017 01:08:30 +0000 (09:08 +0800)]
arm: dts: rk3288: remove assinged parent for NPLL/GPLL

Change-Id: I6ab7dff4d886a776677331f370d9632363abaa87
Signed-off-by: Xu Jianqun <jay.xu@rock-chips.com>
7 years agoarm: dts: add the basic dt file for rk3229-echo-v10
Frank Wang [Tue, 25 Apr 2017 09:19:11 +0000 (17:19 +0800)]
arm: dts: add the basic dt file for rk3229-echo-v10

Initial support for rk3229-echo board.

Change-Id: I7587d333f296f66727bf1c686911cfca2f3c5619
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoarm: dts: add android dtsi for rk322x SoC
Frank Wang [Tue, 2 May 2017 09:28:35 +0000 (17:28 +0800)]
arm: dts: add android dtsi for rk322x SoC

Change-Id: I400ab97db9d333d53474978bb339ce2ed8a99ed4
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoclk: rockchip: rk3228: fix up the clk cpu setting
Elaine Zhang [Thu, 27 Apr 2017 07:24:46 +0000 (15:24 +0800)]
clk: rockchip: rk3228: fix up the clk cpu setting

support more cpu freq
add armcore div setting

Change-Id: I46ab974da763bab2e887377848be1d9049a1568f
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoarm: dts: rk3228: add some assigned-clocks
Elaine Zhang [Thu, 27 Apr 2017 06:40:57 +0000 (14:40 +0800)]
arm: dts: rk3228: add some assigned-clocks

Change-Id: I257bbfe5ccea74245a6fe3269a896ab968a34c4f
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoclk: rockchip: rk3228: Perfect clock description
Elaine Zhang [Thu, 27 Apr 2017 06:37:34 +0000 (14:37 +0800)]
clk: rockchip: rk3228: Perfect clock description

1 Add some necessary clk ID.
2 some clks add CLK_IGNORE_UNUSED flag
3 add some critical clk

Change-Id: If52699b4d5f430413b06084b7d21fb1afd4539dd
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoclk: rockchip: rk3288: add ddrc clock support
Finley Xiao [Thu, 6 Apr 2017 03:40:01 +0000 (11:40 +0800)]
clk: rockchip: rk3288: add ddrc clock support

Add a ddrc clock into clk branches, so we can do ddr frequency
scaling on rk3288 platform in future.

Change-Id: Ia6c93e5ce82fa30475eddf051bc9ea2512b0cc07
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoclk: rockchip: add SCLK_DDRCLK id for rk3288 ddrc
Finley Xiao [Thu, 6 Apr 2017 03:33:40 +0000 (11:33 +0800)]
clk: rockchip: add SCLK_DDRCLK id for rk3288 ddrc

Add the needed id for the ddr clock.

Change-Id: I9578decd2348a35a6e9c4cc3527375d4d02a2af6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoarm64: dts: rockchip: Rename OPP nodes as opp-<opp-hz>
Finley Xiao [Wed, 3 May 2017 03:35:50 +0000 (11:35 +0800)]
arm64: dts: rockchip: Rename OPP nodes as opp-<opp-hz>

Compiling the DT file with W=1, DTC warns like follows:

Warning (unit_address_vs_reg): Node /opp_table0/opp@1000000000 has a
unit name, but no reg property

Fix this by replacing '@' with '-' as the OPP nodes will never have a
"reg" property.

Change-Id: I5748be7888db149633c3980c3f5e9715cd256a52
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoARM: dts: rk3288: Rename OPP nodes as opp-<opp-hz>
Finley Xiao [Wed, 3 May 2017 03:34:18 +0000 (11:34 +0800)]
ARM: dts: rk3288: Rename OPP nodes as opp-<opp-hz>

Compiling the DT file with W=1, DTC warns like follows:

Warning (unit_address_vs_reg): Node /opp_table0/opp@1000000000 has a
unit name, but no reg property

Fix this by replacing '@' with '-' as the OPP nodes will never have a
"reg" property.

Change-Id: Id239f49618a818ad87bb77e99f52b52a5ee2dbc6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
7 years agoLinux 4.4.66
Greg Kroah-Hartman [Wed, 3 May 2017 04:20:09 +0000 (21:20 -0700)]
Linux 4.4.66

7 years agoftrace/x86: Fix triple fault with graph tracing and suspend-to-ram
Josh Poimboeuf [Thu, 13 Apr 2017 22:53:55 +0000 (17:53 -0500)]
ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram

commit 34a477e5297cbaa6ecc6e17c042a866e1cbe80d6 upstream.

On x86-32, with CONFIG_FIRMWARE and multiple CPUs, if you enable function
graph tracing and then suspend to RAM, it will triple fault and reboot when
it resumes.

The first fault happens when booting a secondary CPU:

startup_32_smp()
  load_ucode_ap()
    prepare_ftrace_return()
      ftrace_graph_is_dead()
        (accesses 'kill_ftrace_graph')

The early head_32.S code calls into load_ucode_ap(), which has an an
ftrace hook, so it calls prepare_ftrace_return(), which calls
ftrace_graph_is_dead(), which tries to access the global
'kill_ftrace_graph' variable with a virtual address, causing a fault
because the CPU is still in real mode.

The fix is to add a check in prepare_ftrace_return() to make sure it's
running in protected mode before continuing.  The check makes sure the
stack pointer is a virtual kernel address.  It's a bit of a hack, but
it's not very intrusive and it works well enough.

For reference, here are a few other (more difficult) ways this could
have potentially been fixed:

- Move startup_32_smp()'s call to load_ucode_ap() down to *after* paging
  is enabled.  (No idea what that would break.)

- Track down load_ucode_ap()'s entire callee tree and mark all the
  functions 'notrace'.  (Probably not realistic.)

- Pause graph tracing in ftrace_suspend_notifier_call() or bringup_cpu()
  or __cpu_up(), and ensure that the pause facility can be queried from
  real mode.

Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>
Cc: linux-acpi@vger.kernel.org
Cc: Borislav Petkov <bp@alien8.de>
Cc: Len Brown <lenb@kernel.org>
Link: http://lkml.kernel.org/r/5c1272269a580660703ed2eccf44308e790c7a98.1492123841.git.jpoimboe@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoARCv2: save r30 on kernel entry as gcc uses it for code-gen
Vineet Gupta [Mon, 9 Jan 2017 03:45:48 +0000 (19:45 -0800)]
ARCv2: save r30 on kernel entry as gcc uses it for code-gen

commit ecd43afdbe72017aefe48080631eb625e177ef4d upstream.

This is not exposed to userspace debugers yet, which can be done
independently as a seperate patch !

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agonfsd: check for oversized NFSv2/v3 arguments
J. Bruce Fields [Fri, 21 Apr 2017 20:10:18 +0000 (16:10 -0400)]
nfsd: check for oversized NFSv2/v3 arguments

commit e6838a29ecb484c97e4efef9429643b9851fba6e upstream.

A client can append random data to the end of an NFSv2 or NFSv3 RPC call
without our complaining; we'll just stop parsing at the end of the
expected data and ignore the rest.

Encoded arguments and replies are stored together in an array of pages,
and if a call is too large it could leave inadequate space for the
reply.  This is normally OK because NFS RPC's typically have either
short arguments and long replies (like READ) or long arguments and short
replies (like WRITE).  But a client that sends an incorrectly long reply
can violate those assumptions.  This was observed to cause crashes.

Also, several operations increment rq_next_page in the decode routine
before checking the argument size, which can leave rq_next_page pointing
well past the end of the page array, causing trouble later in
svc_free_pages.

So, following a suggestion from Neil Brown, add a central check to
enforce our expectation that no NFSv2/v3 call has both a large call and
a large reply.

As followup we may also want to rewrite the encoding routines to check
more carefully that they aren't running off the end of the page array.

We may also consider rejecting calls that have any extra garbage
appended.  That would be safer, and within our rights by spec, but given
the age of our server and the NFS protocol, and the fact that we've
never enforced this before, we may need to balance that against the
possibility of breaking some oddball client.

Reported-by: Tuomas Haanpää <thaan@synopsys.com>
Reported-by: Ari Kauppi <ari@synopsys.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoInput: i8042 - add Clevo P650RS to the i8042 reset list
Dmitry Torokhov [Thu, 13 Apr 2017 22:36:31 +0000 (15:36 -0700)]
Input: i8042 - add Clevo P650RS to the i8042 reset list

commit 7c5bb4ac2b76d2a09256aec8a7d584bf3e2b0466 upstream.

Clevo P650RS and other similar devices require i8042 to be reset in order
to detect Synaptics touchpad.

Reported-by: Paweł Bylica <chfast@gmail.com>
Tested-by: Ed Bordin <edbordin@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=190301
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agop9_client_readdir() fix
Al Viro [Fri, 14 Apr 2017 21:22:18 +0000 (17:22 -0400)]
p9_client_readdir() fix

commit 71d6ad08379304128e4bdfaf0b4185d54375423e upstream.

Don't assume that server is sane and won't return more data than
asked for.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMIPS: Avoid BUG warning in arch_check_elf
James Cowgill [Tue, 11 Apr 2017 12:51:07 +0000 (13:51 +0100)]
MIPS: Avoid BUG warning in arch_check_elf

commit c46f59e90226fa5bfcc83650edebe84ae47d454b upstream.

arch_check_elf contains a usage of current_cpu_data that will call
smp_processor_id() with preemption enabled and therefore triggers a
"BUG: using smp_processor_id() in preemptible" warning when an fpxx
executable is loaded.

As a follow-up to commit b244614a60ab ("MIPS: Avoid a BUG warning during
prctl(PR_SET_FP_MODE, ...)"), apply the same fix to arch_check_elf by
using raw_current_cpu_data instead. The rationale quoted from the previous
commit:

"It is assumed throughout the kernel that if any CPU has an FPU, then
all CPUs would have an FPU as well, so it is safe to perform the check
with preemption enabled - change the code to use raw_ variant of the
check to avoid the warning."

Fixes: 46490b572544 ("MIPS: kernel: elf: Improve the overall ABI and FPU mode checks")
Signed-off-by: James Cowgill <James.Cowgill@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15951/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMIPS: KGDB: Use kernel context for sleeping threads
James Hogan [Thu, 30 Mar 2017 15:06:02 +0000 (16:06 +0100)]
MIPS: KGDB: Use kernel context for sleeping threads

commit 162b270c664dca2e0944308e92f9fcc887151a72 upstream.

KGDB is a kernel debug stub and it can't be used to debug userland as it
can only safely access kernel memory.

On MIPS however KGDB has always got the register state of sleeping
processes from the userland register context at the beginning of the
kernel stack. This is meaningless for kernel threads (which never enter
userland), and for user threads it prevents the user seeing what it is
doing while in the kernel:

(gdb) info threads
  Id   Target Id         Frame
  ...
  3    Thread 2 (kthreadd) 0x0000000000000000 in ?? ()
  2    Thread 1 (init)   0x000000007705c4b4 in ?? ()
  1    Thread -2 (shadowCPU0) 0xffffffff8012524c in arch_kgdb_breakpoint () at arch/mips/kernel/kgdb.c:201

Get the register state instead from the (partial) kernel register
context stored in the task's thread_struct for resume() to restore. All
threads now correctly appear to be in context_switch():

(gdb) info threads
  Id   Target Id         Frame
  ...
  3    Thread 2 (kthreadd) context_switch (rq=<optimized out>, cookie=..., next=<optimized out>, prev=0x0) at kernel/sched/core.c:2903
  2    Thread 1 (init)   context_switch (rq=<optimized out>, cookie=..., next=<optimized out>, prev=0x0) at kernel/sched/core.c:2903
  1    Thread -2 (shadowCPU0) 0xffffffff8012524c in arch_kgdb_breakpoint () at arch/mips/kernel/kgdb.c:201

Call clobbered registers which aren't saved and exception registers
(BadVAddr & Cause) which can't be easily determined without stack
unwinding are reported as 0. The PC is taken from the return address,
such that the state presented matches that found immediately after
returning from resume().

Fixes: 8854700115ec ("[MIPS] kgdb: add arch support for the kernel's kgdb core")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15829/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoALSA: seq: Don't break snd_use_lock_sync() loop by timeout
Takashi Iwai [Sun, 9 Apr 2017 08:41:27 +0000 (10:41 +0200)]
ALSA: seq: Don't break snd_use_lock_sync() loop by timeout

commit 4e7655fd4f47c23e5249ea260dc802f909a64611 upstream.

The snd_use_lock_sync() (thus its implementation
snd_use_lock_sync_helper()) has the 5 seconds timeout to break out of
the sync loop.  It was introduced from the beginning, just to be
"safer", in terms of avoiding the stupid bugs.

However, as Ben Hutchings suggested, this timeout rather introduces a
potential leak or use-after-free that was apparently fixed by the
commit 2d7d54002e39 ("ALSA: seq: Fix race during FIFO resize"):
for example, snd_seq_fifo_event_in() -> snd_seq_event_dup() ->
copy_from_user() could block for a long time, and snd_use_lock_sync()
goes timeout and still leaves the cell at releasing the pool.

For fixing such a problem, we remove the break by the timeout while
still keeping the warning.

Suggested-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoALSA: firewire-lib: fix inappropriate assignment between signed/unsigned type
Takashi Sakamoto [Fri, 14 Apr 2017 03:43:01 +0000 (12:43 +0900)]
ALSA: firewire-lib: fix inappropriate assignment between signed/unsigned type

commit dfb00a56935186171abb5280b3407c3f910011f1 upstream.

An abstraction of asynchronous transaction for transmission of MIDI
messages was introduced in Linux v4.4. Each driver can utilize this
abstraction to transfer MIDI messages via fixed-length payload of
transaction to a certain unit address. Filling payload of the transaction
is done by callback. In this callback, each driver can return negative
error code, however current implementation assigns the return value to
unsigned variable.

This commit changes type of the variable to fix the bug.

Reported-by: Julia Lawall <Julia.Lawall@lip6.fr>
Fixes: 585d7cba5e1f ("ALSA: firewire-lib: add helper functions for asynchronous transactions to transfer MIDI messages")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoipv6: check raw payload size correctly in ioctl
Jamie Bainbridge [Wed, 26 Apr 2017 00:43:27 +0000 (10:43 +1000)]
ipv6: check raw payload size correctly in ioctl

[ Upstream commit 105f5528b9bbaa08b526d3405a5bcd2ff0c953c8 ]

In situations where an skb is paged, the transport header pointer and
tail pointer can be the same because the skb contents are in frags.

This results in ioctl(SIOCINQ/FIONREAD) incorrectly returning a
length of 0 when the length to receive is actually greater than zero.

skb->len is already correctly set in ip6_input_finish() with
pskb_pull(), so use skb->len as it always returns the correct result
for both linear and paged data.

Signed-off-by: Jamie Bainbridge <jbainbri@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoipv6: check skb->protocol before lookup for nexthop
WANG Cong [Tue, 25 Apr 2017 21:37:15 +0000 (14:37 -0700)]
ipv6: check skb->protocol before lookup for nexthop

[ Upstream commit 199ab00f3cdb6f154ea93fa76fd80192861a821d ]

Andrey reported a out-of-bound access in ip6_tnl_xmit(), this
is because we use an ipv4 dst in ip6_tnl_xmit() and cast an IPv4
neigh key as an IPv6 address:

        neigh = dst_neigh_lookup(skb_dst(skb),
                                 &ipv6_hdr(skb)->daddr);
        if (!neigh)
                goto tx_err_link_failure;

        addr6 = (struct in6_addr *)&neigh->primary_key; // <=== HERE
        addr_type = ipv6_addr_type(addr6);

        if (addr_type == IPV6_ADDR_ANY)
                addr6 = &ipv6_hdr(skb)->daddr;

        memcpy(&fl6->daddr, addr6, sizeof(fl6->daddr));

Also the network header of the skb at this point should be still IPv4
for 4in6 tunnels, we shold not just use it as IPv6 header.

This patch fixes it by checking if skb->protocol is ETH_P_IPV6: if it
is, we are safe to do the nexthop lookup using skb_dst() and
ipv6_hdr(skb)->daddr; if not (aka IPv4), we have no clue about which
dest address we can pick here, we have to rely on callers to fill it
from tunnel config, so just fall to ip6_route_output() to make the
decision.

Fixes: ea3dc9601bda ("ip6_tunnel: Add support for wildcard tunnel endpoints.")
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>