firefly-linux-kernel-4.4.55.git
8 years agousb: dwc_otg: optimized grf and clk operation for rk336x board
Frank Wang [Wed, 2 Mar 2016 03:24:48 +0000 (11:24 +0800)]
usb: dwc_otg: optimized grf and clk operation for rk336x board

Get grf offset form DT and optimize hclk_usb_peri clock process logic.

Change-Id: I136970c7052e5d621fd10e5d2b90f0fdac620067
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
8 years agoARM64: dts: rockchip: rk3366: add initial clock rate for vop
Feng Xiao [Thu, 3 Mar 2016 03:39:57 +0000 (11:39 +0800)]
ARM64: dts: rockchip: rk3366: add initial clock rate for vop

Change-Id: Iac586853a9acc4e396eabc01b31fb6d75dc61fcf
Signed-off-by: Feng Xiao <xf@rock-chips.com>
8 years agoARM64: dts: rockchip: rk3366-tb: add clk_ignore_unused in bootargs
Feng Xiao [Thu, 3 Mar 2016 02:33:49 +0000 (10:33 +0800)]
ARM64: dts: rockchip: rk3366-tb: add clk_ignore_unused in bootargs

Change-Id: I6b4cfd03141264da7368051c8d10f3eefbf27164
Signed-off-by: Feng Xiao <xf@rock-chips.com>
8 years agoARM64: dts: rockchip: rk3366: add initial clock rate for plls
Feng Xiao [Wed, 2 Mar 2016 15:15:31 +0000 (23:15 +0800)]
ARM64: dts: rockchip: rk3366: add initial clock rate for plls

Change-Id: I9ea6bcac10a7b67471613aea3ea41aff44a8fe34
Signed-off-by: Feng Xiao <xf@rock-chips.com>
8 years agoclk: rockchip: rk3366: pll's rate support 480MHz 520MHz 576MHz 750Mhz
Feng Xiao [Wed, 2 Mar 2016 15:04:33 +0000 (23:04 +0800)]
clk: rockchip: rk3366: pll's rate support 480MHz 520MHz 576MHz 750Mhz

Change-Id: I56c75018ffd27a21ac87c2004eb5bd6a3b1e0e3d
Signed-off-by: Feng Xiao <xf@rock-chips.com>
8 years agovideo: rockchip: add win property node for application layer
Huang Jiachai [Mon, 1 Feb 2016 02:02:49 +0000 (10:02 +0800)]
video: rockchip: add win property node for application layer

Change-Id: I2e96d531d8fd1cf9eda665e4912501e4bec4d954
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
8 years agovideo: rockchip: fb: fix update reg kfree data lead to list_del null point
Huang Jiachai [Mon, 29 Feb 2016 02:33:25 +0000 (10:33 +0800)]
video: rockchip: fb: fix update reg kfree data lead to list_del null point

Change-Id: I5a9f3c795cf6f8ecbe9f45a769135fe890525fab
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
(cherry picked from commit fe05c53704fb3b61455dddbae8b5078be0f48a12)

8 years agovideo: rockchip: rk3288: fix extend screen type error
Huang Jiachai [Tue, 23 Feb 2016 10:19:58 +0000 (18:19 +0800)]
video: rockchip: rk3288: fix extend screen type error

Change-Id: Ie1754c8ffa51f01637bf08f2fae443c821d8e09a
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
(cherry picked from commit b6403156107533cf97e6fe326576831af214f47d)

8 years agovideo: rockchip: lcdc: 3368: add support write back
Huang Jiachai [Wed, 27 Jan 2016 11:38:59 +0000 (19:38 +0800)]
video: rockchip: lcdc: 3368: add support write back

Change-Id: Id4ae5fe8e0e3a6ae490bfa31594033a5eeba5233
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
(cherry picked from commit 96c50052a58b38f73432b9bf4156f1a9e6fdd023)

8 years agovideo: rockchip: add vop config for write back function
Huang Jiachai [Wed, 27 Jan 2016 11:38:22 +0000 (19:38 +0800)]
video: rockchip: add vop config for write back function

Change-Id: I8d27bb44fa1e8b30b422f2692a257ac9e0282f5e
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
(cherry picked from commit e853ac5f48c0d6da970def84c465ce319ab6f1a8)

8 years agoUPSTREAM: regulator: core: avoid unused variable warning
Arnd Bergmann [Fri, 20 Nov 2015 14:24:39 +0000 (15:24 +0100)]
UPSTREAM: regulator: core: avoid unused variable warning

The second argument of the mutex_lock_nested() helper is only
evaluated if CONFIG_DEBUG_LOCK_ALLOC is set. Otherwise we
get this build warning for the new regulator_lock_supply
function:

drivers/regulator/core.c: In function 'regulator_lock_supply':
drivers/regulator/core.c:142:6: warning: unused variable 'i' [-Wunused-variable]

To avoid the warning, this restructures the code to make it
both simpler and to move the 'i++' outside of the mutex_lock_nested
call, where it is now always used and the variable is not
flagged as unused.

We had some discussion about changing mutex_lock_nested to an
inline function, which would make the code do the right thing here,
but in the end decided against it, in order to guarantee that
mutex_lock_nested() does not introduced overhead without
CONFIG_DEBUG_LOCK_ALLOC.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 9f01cd4a915 ("regulator: core: introduce function to lock regulators and its supplies")
Link: http://permalink.gmane.org/gmane.linux.kernel/2068900
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit fa731ac7ea04a7d3a5c6d2f568132478c02a83b3)

Change-Id: Id700f411f2bcbe0cd49be332f329cd1b03768868

8 years agoUPSTREAM: clk: rockchip: include downstream muxes into fractional dividers on rk3368
Elaine Zhang [Wed, 24 Feb 2016 00:44:11 +0000 (08:44 +0800)]
UPSTREAM: clk: rockchip: include downstream muxes into fractional dividers on rk3368

During the initial conversion to the newly introduced combined fractional
dividers+muxes the rk3368 clocks were left out, so convert them now.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
(cherry picked from git.kernel.org mmind/linux-rockchip.git v4.6-clk/next
 commit 7af8a26ce7055dd74853ea7c2b9752961e3491da)

Change-Id: I81e408089ff1095d4735072d3ddb15c3564f6970

8 years agoarm64: dts: rockchip: remove unused files
Huang, Tao [Wed, 2 Mar 2016 02:03:17 +0000 (10:03 +0800)]
arm64: dts: rockchip: remove unused files

Change-Id: I5264e3967cd6dfbe776d03bc77d7434656d58772
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
8 years agoARM64: dts: rockchip: rk3399 dtsi fix for upstream
Jianqun Xu [Tue, 1 Mar 2016 04:45:59 +0000 (12:45 +0800)]
ARM64: dts: rockchip: rk3399 dtsi fix for upstream

Fix rk3399.dtsi for upstream, includes:
- remove psci related codes due to no impletement
- rmeove pmu node since wrong content
- add spi 3/4/5
- fix pmucru

Change-Id: I078874c35e66ef8301e40a753a2acbae9f10b852
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
8 years agoARM64: dts: rockchip: rk3366-tb: fix power_key gpio error
David Wu [Tue, 1 Mar 2016 15:04:43 +0000 (23:04 +0800)]
ARM64: dts: rockchip: rk3366-tb: fix power_key gpio error

Change-Id: I698e300b3d34d2bb5e8f1b83f3c6655af7e5d15a
Signed-off-by: David Wu <david.wu@rock-chips.com>
8 years agoclk: rockchip: update dt-binding header for rk3399 sdmmc/sdio
Xing Zheng [Tue, 1 Mar 2016 11:30:18 +0000 (19:30 +0800)]
clk: rockchip: update dt-binding header for rk3399 sdmmc/sdio

Add DRV/SAMPLE clock nodes for SDMMC/SDIO.

Change-Id: Ib23698f3b1b78bb7af42903fff8df34c3b62271f
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
8 years agopinctrl: rk3366: add support for rk3366
David Wu [Mon, 15 Feb 2016 10:29:54 +0000 (18:29 +0800)]
pinctrl: rk3366: add support for rk3366

The drive strength control of rk3366 is very different from others'.
RK3366 soc adds N and P channel drive strength control, and we assume
they are the same value.

Change-Id: I45896f1483cb0a7550789df3bf84a0460cb21527
Signed-off-by: David Wu <david.wu@rock-chips.com>
8 years agovideo: rockchip: fb: fix double free when use devm_kzalloc() buf
Huang Jiachai [Mon, 29 Feb 2016 01:39:24 +0000 (09:39 +0800)]
video: rockchip: fb: fix double free when use devm_kzalloc() buf

Change-Id: I12872a61e2f07da23189cd57e2a355d73b98b005
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
8 years agovideo: rockchip: hdmi: skip operation when suspend or disabled
Zheng Yang [Tue, 1 Mar 2016 06:25:47 +0000 (14:25 +0800)]
video: rockchip: hdmi: skip operation when suspend or disabled

Change-Id: I294d338416a04d751ec5a5771e6b623ba7b69c02
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry picked from commit 0fdde42e0c459c9cc1b315cf2fbb0894d57ec0e4)

8 years agoarm64: dts: rk3366-tb: sheep board default to use mipi screen
Huang Jiachai [Tue, 1 Mar 2016 09:27:54 +0000 (17:27 +0800)]
arm64: dts: rk3366-tb: sheep board default to use mipi screen

Change-Id: I239777aa4f95543be9c5699e459cd7326ccc4f2c
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
8 years agoUPSTREAM: clk: rockchip: add a factor clock type
Heiko Stuebner [Sat, 20 Jun 2015 11:08:57 +0000 (13:08 +0200)]
UPSTREAM: clk: rockchip: add a factor clock type

Add a clock type for fixed factor clocks. This allows us to define fixed
factor clocks where they appear in the clock hierarchy instead of in the
init function.

The additional factor_gate type, finally allows us to model some last
parts of the clock tree correctly.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
(cherry picked from commit 29a30c269aba4223e2a8b443f443d7def1e43fea)

Change-Id: Ie4ec8b9d9199cdbe0be045c2ed4c270029e37949
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
8 years agoclk: rockchip: update dt-binding header for rk3399
Xing Zheng [Tue, 1 Mar 2016 08:21:30 +0000 (16:21 +0800)]
clk: rockchip: update dt-binding header for rk3399

Separate the number of CRU and PMUCRU, and modify the date to 2016.

Change-Id: I235fc8a93640e13fb112f45bb3387542b07e1a87
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
8 years agommc: dw_mmc-rockchip: fix failing to mount partition with "discard"
Shawn Lin [Tue, 1 Mar 2016 07:08:48 +0000 (15:08 +0800)]
mmc: dw_mmc-rockchip: fix failing to mount partition with "discard"

Without MMC_CAP_ERASE support, we fail to mount partition
with "discard" option since mmc_queue_setup_discard is limited
for checking mmc_can_erase. Without doing mmc_queue_setup_discard,
blk_queue_discard fails to test QUEUE_FLAG_DISCARD flag, so we get
the following log from f2fs(actually similar to other file system):

mounting with "discard" option, but the device does not support discard

Change-Id: Iee781795c9c61153644f0dd5b00dfc2cca6cc721
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
8 years agoARM64: dts: rockchip: add rga node for rk3366
Shengqin.Zhang [Wed, 3 Feb 2016 06:55:56 +0000 (14:55 +0800)]
ARM64: dts: rockchip: add rga node for rk3366

Change-Id: Ib1853054a9935eb0d48b5eaf346e9f7e58c688ed
Signed-off-by: Shengqin.Zhang <zsq@rock-chips.com>
8 years agoUPSTREAM: thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399
Caesar Wang [Mon, 15 Feb 2016 07:33:31 +0000 (15:33 +0800)]
UPSTREAM: thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399

As the TRM says, add the tsadc_q_sel to control the temperature-code
sequence since the rk3228/rk3399 need set this bit (1024 - tsadc_q)
as output.

Fixes: commit
b0d7033 "thermal: rockchip: Support the RK3399 SoCs in thermal driver"
7b02a5e "thermal: rockchip: Support the RK3228 SoCs in thermal driver"

Reported-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
(cherry picked from git.kernel.org evalenti/linux-soc-thermal fixes
 commit 7ea38c6c3622bc65279dc6a1fecd28227027fbb5)

Change-Id: I9d39b947e197393688ed58bf079e519e7d5a6d9e

8 years agoUPSTREAM: thermal: rockchip: the rename compatibles for rockchip SoCs
Caesar Wang [Mon, 15 Feb 2016 07:33:30 +0000 (15:33 +0800)]
UPSTREAM: thermal: rockchip: the rename compatibles for rockchip SoCs

This patch renames to be more adapter compatibles since more and more
SoCs are supported in thermal driver.

Reported-by: Huang,Tao <huangtao@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
(cherry picked from git.kernel.org evalenti/linux-soc-thermal fixes
 commit 952418a34f26f252cd0afbca8c33a8506a03cab7)

Change-Id: Ia053d6877a16b36e357bd9b427b323703e5a514b

8 years agoUPSTREAM: phy: core: fix wrong err handle for phy_power_on
Shawn Lin [Thu, 28 Jan 2016 08:14:18 +0000 (16:14 +0800)]
UPSTREAM: phy: core: fix wrong err handle for phy_power_on

If phy_pm_runtime_get_sync failed but we already
enable regulator, current code return directly without
doing regulator_disable. This patch fix this problem
and cleanup err handle of phy_power_on to be more readable.

Fixes: 3be88125d85d ("phy: core: Support regulator ...")
Cc: <stable@vger.kernel.org> # v3.18+
Cc: Roger Quadros <rogerq@ti.com>
Cc: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit b82fcabe212a11698fd4b3e604d2f81d929d22f6)

Change-Id: I1cb5327d624d88a97096eccaa94924b851dcce27

8 years agorockchip: power & pmic: fix compile warning
Elaine Zhang [Fri, 26 Feb 2016 20:19:23 +0000 (04:19 +0800)]
rockchip: power & pmic: fix compile warning

fixed the WARNING: invalid free of devm_ allocated data

Change-Id: I54514cf53a8a0d1f885fd0a17e7f6db7af1d10f9
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
8 years agousb: dwc_otg: support to the latest usb gadget driver.
Frank Wang [Thu, 25 Feb 2016 07:07:33 +0000 (15:07 +0800)]
usb: dwc_otg: support to the latest usb gadget driver.

For gadget driver, usb_ep_caps is a new structrue in usb_ep, and its
attribute will be check in usb_ep_autoconfig method, so we need to do
some initialization work at ep creating.

Meanwhile, the process of android gadget driver have been changed,
correspondingly, udc_start and udc_stop are invoked differently from
before, so dwc_otg_gadget_stop method need to refactor and ajust
the new process.

Change-Id: Id1e20d4c265e0d382b0f36f6e729681f9c94c947
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
8 years agoUPSTREAM: phy: add a driver for the Rockchip SoC internal eMMC PHY
Shawn Lin [Wed, 3 Feb 2016 07:22:22 +0000 (15:22 +0800)]
UPSTREAM: phy: add a driver for the Rockchip SoC internal eMMC PHY

This patch to add a generic PHY driver for ROCKCHIP eMMC PHY.
Access the PHY via registers provided by GRF (general register
files) module.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from git.kernel.org kishon/linux-phy next
 commit 9743f1c935995a55ddd926943ee7b3cfb4718208)

Change-Id: Ia24ccd041392e64efd28868ffccc8da4419bd29f

8 years agoUPSTREAM: Documentation: bindings: add dt documentation for Rockchip eMMC PHY
Shawn Lin [Tue, 5 Jan 2016 01:07:14 +0000 (09:07 +0800)]
UPSTREAM: Documentation: bindings: add dt documentation for Rockchip eMMC PHY

This patch adds a binding that describes the Rockchip eMMC PHYs
found on Rockchip SoCs eMMC interface.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from git.kernel.org kishon/linux-phy next
 commit c9a1ddcac5b95a9dbf3d3f71d3be8b157239cce5)

Change-Id: I6913babddbc70c1ad3ea2234d8afac79190852a4

8 years agovideo: rockchip: tve: fix compile error and warning
Shen Zhenyi [Fri, 26 Feb 2016 09:16:42 +0000 (17:16 +0800)]
video: rockchip: tve: fix compile error and warning

Change-Id: Iacfc54e3f1c01cf3827cbb576d36f64145976bc1
Signed-off-by: Shen Zhenyi <szy@rock-chips.com>
8 years agoARM64: dts: rockchip: add io-domain node for rk3366
David Wu [Fri, 26 Feb 2016 10:14:47 +0000 (18:14 +0800)]
ARM64: dts: rockchip: add io-domain node for rk3366

Change-Id: I774e717fb49a725f143ff21cd7c4969dbe66a2de
Signed-off-by: David Wu <david.wu@rock-chips.com>
8 years agoPOWER: AVS: rockchp: add rk3366 io domain supprot
David Wu [Fri, 26 Feb 2016 10:07:01 +0000 (18:07 +0800)]
POWER: AVS: rockchp: add rk3366 io domain supprot

Change-Id: I64eb48ee7e161306b941a851585c50a1ee0edae2
Signed-off-by: David Wu <david.wu@rock-chips.com>
8 years agovideo: rockchip: hdmi: v1: modify double free to avoid compile warning
xuhuicong [Fri, 26 Feb 2016 08:03:00 +0000 (16:03 +0800)]
video: rockchip: hdmi: v1: modify double free to avoid compile warning

rockchip_hdmiv1.c:375:1-6: WARNING: invalid free of devm_ allocated data

Change-Id: I0ab0b3d8f30a9c106e67f33ae93bc1df1b333fc2
Signed-off-by: xuhuicong <xhc@rock-chips.com>
8 years agoARM64: powerdomain: enable power domain debug config by default
Elaine Zhang [Fri, 26 Feb 2016 07:10:57 +0000 (15:10 +0800)]
ARM64: powerdomain: enable power domain debug config by default

enable PM_ADVANCED_DEBUG by default.
use pd debug get pd tree like this:
cat d/pm_genpd/pm_genpd_summary

Change-Id: I1ca27a7619cc0655c2256918d7b6530b6a637bcf
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
8 years agonet: rfkill: fixed "WARNING: invalid free of devm_ allocated data"
xiaoyao [Fri, 26 Feb 2016 07:25:12 +0000 (15:25 +0800)]
net: rfkill: fixed "WARNING: invalid free of devm_ allocated data"

Change-Id: I3c84a08e9d62d6f16e4f162708584f7fd716066b
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
8 years agoUPSTREAM: phy: rockchip-usb: expose the phy-internal PLLs
Heiko Stuebner [Thu, 19 Nov 2015 21:22:26 +0000 (22:22 +0100)]
UPSTREAM: phy: rockchip-usb: expose the phy-internal PLLs

The USB phys on Rockchip SoCs contain their own internal PLLs to create
the 480MHz needed. Additionally this PLL output is also fed back into the
core clock-controller as possible source for clocks like the GPU or others.

Until now this was modelled incorrectly with a "virtual" factor clock in
the clock controller. The one big caveat is that if we turn off the usb phy
via the siddq signal, all analog components get turned off, including the
PLLs. It is therefore possible that a source clock gets disabled without
the clock driver ever knowing, possibly making the system hang.

Therefore register the phy-plls as real clocks that the clock driver can
then reference again normally, making the clock hirarchy finally reflect
the actual hardware.

The phy-ops get converted to simply turning that new clock on and off
which in turn controls the siddq signal of the phy.

Through this the driver gains handling for platform-specific data, to
handle the phy->clock name association.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit b74fe7c7617fd267c10d53e525984df81a5f317f)

Change-Id: Ie05464a9523af86b602d4801cb9b842f65d08670

8 years agoUPSTREAM: phy: rockchip-usb: add compatible values for rk3066a and rk3188
Heiko Stuebner [Thu, 19 Nov 2015 21:22:25 +0000 (22:22 +0100)]
UPSTREAM: phy: rockchip-usb: add compatible values for rk3066a and rk3188

We need custom handling for these two socs in the driver shortly,
so add the necessary compatible values to binding and driver.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit c2bfc3b88813ab8711317a19f5c9cd74aeaf536c)

Change-Id: I63cf61e12b1f3bb56856accc38949c6cd8c0ce8e

8 years agoUPSTREAM: phy: rockchip-usb: move per-phy init into a separate function
Heiko Stuebner [Thu, 19 Nov 2015 21:22:24 +0000 (22:22 +0100)]
UPSTREAM: phy: rockchip-usb: move per-phy init into a separate function

This unclutters the loop in probe a lot and makes current (and future)
error handling easier to read.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit 97dd9101091bb13b1ca3fe42edacf2bd7cf10924)

Change-Id: I5c2ccfbd42e52b77649f01bca2a86767f27fe32f

8 years agoUPSTREAM: phy: rockchip-usb: introduce a common data-struct for the device
Heiko Stuebner [Thu, 19 Nov 2015 21:22:23 +0000 (22:22 +0100)]
UPSTREAM: phy: rockchip-usb: introduce a common data-struct for the device

This introduces a common struct that holds data belonging to
the umbrella device that contains all the phys and that we
want to use later.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit 5fdbb97dec0ca6106c5595c2db667a7957ad8c0f)

Change-Id: I48dd87b0b39739e0c75d0613e881b2b57e8cb6f2

8 years agoUPSTREAM: phy: rockchip-usb: fix clock get-put mismatch
Heiko Stuebner [Thu, 19 Nov 2015 21:22:22 +0000 (22:22 +0100)]
UPSTREAM: phy: rockchip-usb: fix clock get-put mismatch

Currently the phy driver only gets the optional clock reference but
never puts it again, neither during error handling nor on remove.
Fix that by moving the clk_put to a devm-action that gets called at
the right time when all other devm actions are done.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit 75d390fecf9e69eebca7f15de40d761e33fcfd7b)

Change-Id: I976d5a49448febdb7da5b5c35455c708bfc83899

8 years agokeys: rockchip: use late_initcall for driver init
David Wu [Tue, 23 Feb 2016 12:14:45 +0000 (20:14 +0800)]
keys: rockchip: use late_initcall for driver init

Use late_initcall to ensure saradc driver init bofore
keys driver init.

Change-Id: I34a12cb4d3e28c749d9a8bbf35329185edf7c0c6
Signed-off-by: David Wu <david.wu@rock-chips.com>
8 years agoARM64: dts: add power-management node for rk3366
Xiao Feng [Wed, 3 Feb 2016 10:21:58 +0000 (18:21 +0800)]
ARM64: dts: add power-management node for rk3366

add pd parameters in the dtsi.
support pd for rk3366.

Change-Id: Id8a7c7b84038e4987aea8cb0e9846fbe187af0e9
Signed-off-by: Xiao Feng <xf@rock-chips.com>
8 years agosoc: rockchip: power-domain: Modify power domain driver for rk3366
Xiao Feng [Wed, 3 Feb 2016 09:40:17 +0000 (17:40 +0800)]
soc: rockchip: power-domain: Modify power domain driver for rk3366

This driver is modified to support RK3366 SoC.

Change-Id: If278582e721517a96499be203e3d28573cad880f
Signed-off-by: Xiao Feng <xf@rock-chips.com>
8 years agodt-bindings: add power-domain header for RK3366 SoCs
Xiao Feng [Wed, 3 Feb 2016 09:58:25 +0000 (17:58 +0800)]
dt-bindings: add power-domain header for RK3366 SoCs

According to a description from TRM, add all the power domains.

Change-Id: I65046318da4592b76bfd5ab7c0294e2c5d66d20a
Signed-off-by: Xiao Feng <xf@rock-chips.com>
8 years agodt-bindings: modify document of Rockchip power domains
Xiao Feng [Wed, 24 Feb 2016 08:38:37 +0000 (16:38 +0800)]
dt-bindings: modify document of Rockchip power domains

Modify binding documentation for the power domains
found on Rockchip RK3366 SoCs.

Change-Id: Ib9cd07971303b1205f501a06430811e877870212
Signed-off-by: Xiao Feng <xf@rock-chips.com>
8 years agoARM64: configs: rockchip_defconfig select USB20_HOST and USB20_OTG
Frank Wang [Mon, 22 Feb 2016 08:13:25 +0000 (16:13 +0800)]
ARM64: configs: rockchip_defconfig select USB20_HOST and USB20_OTG

Change-Id: I6eaa1fedeb05d5e50dc8da7eb3109d47715cd5d0
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
8 years agoARM64: dts: add usb2.0 dwc otg configuration for RK3368 sheep board
Frank Wang [Mon, 22 Feb 2016 08:07:45 +0000 (16:07 +0800)]
ARM64: dts: add usb2.0 dwc otg configuration for RK3368 sheep board

Change-Id: I01fd9671f89d9e61e2a59ac2272569ce8ebfd092
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
8 years agoclk: rockchip: rk3366: add sclk_pvtm_pmu
Xiao Feng [Wed, 24 Feb 2016 03:37:34 +0000 (11:37 +0800)]
clk: rockchip: rk3366: add sclk_pvtm_pmu

Change-Id: Id24788b8d7caca776061dd4544ac90443a6be2ad
Signed-off-by: Xiao Feng <xf@rock-chips.com>
8 years agoclk: rockchip: add id for pvtm_pmu on rk3366
Xiao Feng [Wed, 24 Feb 2016 03:36:22 +0000 (11:36 +0800)]
clk: rockchip: add id for pvtm_pmu on rk3366

Change-Id: Iecc20e13134322fc6ed306300b830b9b14dffd97
Signed-off-by: Xiao Feng <xf@rock-chips.com>
8 years agousb: dwc_otg: Ported "drivers/usb/dwc_otg_310" from kernel-3.10
Frank Wang [Wed, 3 Feb 2016 02:44:12 +0000 (10:44 +0800)]
usb: dwc_otg: Ported "drivers/usb/dwc_otg_310" from kernel-3.10

Modified some internal interfaces to support kernel-4.4

Change-Id: I1a87b75f5429874d879437b21cbf85eba4473ee0
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
8 years agoclk: rockchip: update dt-binding header for rk3399
Xing Zheng [Mon, 22 Feb 2016 10:13:20 +0000 (18:13 +0800)]
clk: rockchip: update dt-binding header for rk3399

Because the RK3399 CRU TRM is updating, so we need to maintain a
consistent naming clock IDs.

Change-Id: I1724827f05f4f44b197c14a5d81fec5afc1202b5
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
8 years agoclk: rockchip: rk3366: include downstream muxes into fractional dividers
Xiao Feng [Tue, 23 Feb 2016 01:49:36 +0000 (09:49 +0800)]
clk: rockchip: rk3366: include downstream muxes into fractional dividers

Use the newly introduced possibility to combine the fractional dividers
with their downstream muxes for all fractional dividers on currently
supported RK3366 SoCs.

Change-Id: Idabfe85f269b8f15f85471daa50c3ef988b21297
Signed-off-by: Xiao Feng <xf@rock-chips.com>
8 years agoarm64: configs: rockchip_defconfig: select LCDC_LITE_RK3X
Wenlong Zhuang [Thu, 21 Jan 2016 06:45:37 +0000 (14:45 +0800)]
arm64: configs: rockchip_defconfig: select LCDC_LITE_RK3X

CONFIG_LCDC_LITE_RK3X=y

Change-Id: If326b617341125771a7393a1392755fe9e9a52b4
Signed-off-by: Wenlong Zhuang <daisen.zhuang@rock-chips.com>
8 years agovideo: rockchip: support VOP-LITE controller driver
Wenlong Zhuang [Tue, 29 Dec 2015 06:42:17 +0000 (14:42 +0800)]
video: rockchip: support VOP-LITE controller driver

Rockchip SoC such RK3366 has VOP-LITE controller. This patch
supports VOP-LITE driver base on Rockchip SoC Chip.

Change-Id: I64ea2307609530f7dc0dbe6b1c9b3059d1cf821d
Signed-off-by: Wenlong Zhuang <daisen.zhuang@rock-chips.com>
8 years agoRevert "input: gt9xx: remove tp_register_fb"
Shengfei xu [Fri, 19 Feb 2016 10:01:32 +0000 (18:01 +0800)]
Revert "input: gt9xx: remove tp_register_fb"

This reverts commit dd82161ce5de1b02eb61a4822aa0118b9082fef0.

Change-Id: I277b2e6146509a56b1f7aa5a53dc481cc63cc0df
Signed-off-by: Shengfei xu <xsf@rock-chips.com>
8 years agoInput: gt911: get regulator form dts.
Shengfei xu [Fri, 19 Feb 2016 09:16:22 +0000 (17:16 +0800)]
Input: gt911: get regulator form dts.

Make it possible to specify the supply of a regulator, through the
tp-supply property in dt.

Change-Id: If741bb48280a339fc37e9f53d566fbbb444c31e8
Signed-off-by: Shengfei xu <xsf@rock-chips.com>
8 years agoARM64: dts: rk3366-tb: add simple audio card with rt5640
Sugar Zhang [Fri, 19 Feb 2016 10:42:50 +0000 (18:42 +0800)]
ARM64: dts: rk3366-tb: add simple audio card with rt5640

Change-Id: I1f4f7c3faadf68a2f6f7314fc699296a77732442
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoARM64: dts: rk3366: add i2s node
Sugar Zhang [Fri, 19 Feb 2016 10:30:20 +0000 (18:30 +0800)]
ARM64: dts: rk3366: add i2s node

Change-Id: Ic646cdeaf8b53be81059061ef8c9a7e7f0aca66f
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoARM64: dts: rk3368-tb: fix mistake for rt5640
Sugar Zhang [Fri, 19 Feb 2016 08:13:49 +0000 (16:13 +0800)]
ARM64: dts: rk3368-tb: fix mistake for rt5640

Change-Id: If6a9296bed3d183f660f1584166be76a0456c1b4
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoASoC: rt5640: add mono adc event function
Sugar Zhang [Fri, 19 Feb 2016 08:11:04 +0000 (16:11 +0800)]
ASoC: rt5640: add mono adc event function

Change-Id: I9d992ce28ad8cc7f772cb83ebde6b9c57b412acd
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoARM64: dts: rk3368-tb: add mclk for rt5640 codec
Sugar Zhang [Fri, 19 Feb 2016 05:18:05 +0000 (13:18 +0800)]
ARM64: dts: rk3368-tb: add mclk for rt5640 codec

Change-Id: I692653ed270beb19990f2e2a42be1e8a7859e382
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoASoC: rt5640: add master clock handling for rt5640
Sugar Zhang [Fri, 19 Feb 2016 05:03:19 +0000 (13:03 +0800)]
ASoC: rt5640: add master clock handling for rt5640

enable/disable master clock when codec is active or not.

Change-Id: Ia876abde08138c4f23ed5a1a684f6637c42d5e34
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoASoC: rockchip: i2s: add default values for registers
Sugar Zhang [Fri, 19 Feb 2016 02:10:07 +0000 (10:10 +0800)]
ASoC: rockchip: i2s: add default values for registers

this patch add default values for registers according description from TRM.

Change-Id: I683b30483b9c1db08a202983f7055092db4cad2e
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoARM64: dts: rk3368: Drop unneeded properties for i2s
Sugar Zhang [Thu, 18 Feb 2016 11:34:41 +0000 (19:34 +0800)]
ARM64: dts: rk3368: Drop unneeded properties for i2s

because i2s have no child devices so address-cells and
size-cells properties are not required. remove these from dts.

Change-Id: Iaaeec7907fd565279a01c0051353c7170af0812c
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoinput: gt9xx: remove tp_register_fb
Jianqun Xu [Fri, 19 Feb 2016 00:31:22 +0000 (08:31 +0800)]
input: gt9xx: remove tp_register_fb

Fix the suspend/resume bug.

Change-Id: Ia8a6275f3eed9f13af153138e225343486323afb
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
8 years agoUPSTREAM: clk: rockchip: fix section mismatches with new child-clocks
Heiko Stübner [Sat, 26 Dec 2015 13:07:15 +0000 (14:07 +0100)]
UPSTREAM: clk: rockchip: fix section mismatches with new child-clocks

To model the muxes downstream of fractional dividers we introduced the
child property, allowing to describe a direct child clock.
The first implementation seems to cause section warnings, as the core
clock-tree is marked as initdata while the data pointed to from the
child element is not.

While there may be some way to also set that missing property in the
inline notation I didn't find it, so to actually fix the issue for now
move the sub-definitions into separate declarations that can have
their own __initdata properties.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
(cherry picked from commit 5b73840375e3eebeb7adf957ff64a96abdf4e1a1)

Change-Id: I22c03dea33af24ba5743170325f318432cfd766f

8 years agoUPSTREAM: clk: rockchip: rk3036: include downstream muxes into fractional dividers
Xing Zheng [Tue, 22 Dec 2015 21:28:01 +0000 (22:28 +0100)]
UPSTREAM: clk: rockchip: rk3036: include downstream muxes into fractional dividers

Use the newly introduced possibility to combine the fractional dividers
with their downstream muxes for all fractional dividers on currently
supported RK3036 SoCs.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
(cherry picked from commit b0158bb27c7b6e9843f541c17b24dbd964b76db6)

Change-Id: Ief8f77ec66c8b281d52d1e19dcd50d2f7b663045

8 years agoUPSTREAM: clk: rockchip: Allow the RK3288 SPDIF clocks to change their parent
Sjoerd Simons [Tue, 22 Dec 2015 21:28:02 +0000 (22:28 +0100)]
UPSTREAM: clk: rockchip: Allow the RK3288 SPDIF clocks to change their parent

The clock branches leading to sclk_spdif and sclk_spdif_8ch on RK3288
SoCs only feed those clocks, allow those clocks to change their parents
all the way up the hierarchy.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
(cherry picked from commit 84a8c541664b037a4d1fdc3151466b4ec45c37a5)

Change-Id: Id362013ba195fdb88e4cdbaed2468deaafc04e64

8 years agoUPSTREAM: clk: rockchip: include downstream muxes into fractional dividers
Heiko Stuebner [Tue, 22 Dec 2015 21:28:00 +0000 (22:28 +0100)]
UPSTREAM: clk: rockchip: include downstream muxes into fractional dividers

Use the newly introduced possibility to combine the fractional dividers
with their downstream muxes for all fractional dividers on currently
supported Rockchip SoCs.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
(cherry picked from commit 66746420898984a273ea08fa5926bd1640eaed3e)

Change-Id: I243f17bf622b278ec365755f7fb4da90843107d7

8 years agoUPSTREAM: clk: rockchip: handle mux dependency of fractional dividers
Heiko Stuebner [Tue, 22 Dec 2015 21:27:59 +0000 (22:27 +0100)]
UPSTREAM: clk: rockchip: handle mux dependency of fractional dividers

The fractional dividers of Rockchip SoCs contain an "auto-gating-feature"
that requires the downstream mux to actually point to the fractional
divider and the fractional divider gate to be enabled, for it to really
accept changes to the divider ratio.

The downstream muxes themselfs are not generic enough to include them
directly into the fractional divider, as they have varying sources of
parent clocks including not only clocks related to the fractional
dividers but other clocks as well.

To solve this, allow our clock branches to specify direct child clock-
branches in the new child property, let the fractional divider register
its downstream mux through this and add a clock notifier that temporarily
switches the mux setting when it notices rate changes to the fractional
divider.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
(cherry picked from commit 8ca1ca8f6039f19673fb61552f276b848539dbd6)

Change-Id: Ic538fcf248f1e8a7ac87a45788167855155ca54a

8 years agoUPSTREAM: clk: add flag for clocks that need to be enabled on rate changes
Heiko Stuebner [Tue, 22 Dec 2015 21:27:58 +0000 (22:27 +0100)]
UPSTREAM: clk: add flag for clocks that need to be enabled on rate changes

Some clocks need to be enabled to accept rate changes. This patch adds a
new flag CLK_SET_RATE_UNGATE that lets clk_change_rate enable the clock
before trying to change the rate and disable it again afterwards.
This of course doesn't effect clocks that are already running at that
point, as their refcount will only temporarily increase.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
(cherry picked from commit 2eb8c7104c648ad4bfae1f5333f98c09522149b5)

Change-Id: I4fdabbe7120dd501f350ce2294aa5a6c1827f961

8 years agoUPSTREAM: clk: rockchip: add clock controller for rk3036
Xing Zheng [Thu, 5 Nov 2015 07:33:58 +0000 (15:33 +0800)]
UPSTREAM: clk: rockchip: add clock controller for rk3036

Add the clock tree definition for the new rk3036 SoC.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
(cherry picked from commit 5190c08b29899131a183ea5802b9397918cca1ae)

Change-Id: I0609b405ddb437e2ae9a432f386aa89ad47e7c84

8 years agoUPSTREAM: clk: rockchip: add dt-binding header for rk3036
Xing Zheng [Thu, 5 Nov 2015 07:33:56 +0000 (15:33 +0800)]
UPSTREAM: clk: rockchip: add dt-binding header for rk3036

Add the dt-bindings header for the rk3036, that gets shared between
the clock controller and the clock references in the dts.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
(cherry picked from commit 8b0d55e962137bf92f9342ec78e1d8e5fd1c03be)

Change-Id: I3aca4b58f7f7bcd73faec92d07b88dbccf74d825

8 years agoMerge tag 'v4.4.2'
Huang, Tao [Thu, 18 Feb 2016 08:03:29 +0000 (16:03 +0800)]
Merge tag 'v4.4.2'

This is the 4.4.2 stable release

8 years agoMerge branch 'android-4.4'
Huang, Tao [Thu, 18 Feb 2016 07:18:27 +0000 (15:18 +0800)]
Merge branch 'android-4.4'

* android-4.4: (475 commits)
  android: base-cfg: Add CONFIG_IP_MULTICAST
  android: recommended.cfg: enable taskstats
  ANDROID: android: base-cfg: disable CONFIG_SYSVIPC
  android: configs: base: enable configfs gadget functions
  android: add CONFIG_DEBUG_RODATA to recommended config
  android: configs: remove CONFIG_BATTERY_ANDROID=y
  android: configs: base: enable IPV6
  android: configs: Enable SELinux and its dependencies.
  android: base-cfg: disable ALARM_DEV
  android: base-cfg: turn off /dev/mem and /dev/kmem
  android: base-cfg: enable ARMV8_DEPRECATED and subfeatures
  android: base-cfg: enforce the needed XFRM_MODE_TUNNEL (for VPN)
  android: base-cfg: disable LOGGER
  android: base-cfg: enable DM_VERITY (used for secureboot)
  android: configs: add systrace support to recommended configs
  android: configs: update 3.10 options
  android: configs: Add CONFIG_NETFILTER_XT_TARGET_IDLETIMER
  android: configs: add IPV6 ROUTE INFO
  android: configs: add TIMER_STATS back, helps with sysrq t.
  android: configs: Add HIDRAW to recommended set
  ...

Change-Id: I4580a461d0e2845c6aa430861174c83bb6120bb4

8 years agoarm64: dts: rockchip: add hdmi node on rk3366.dtsi
Zheng Yang [Wed, 17 Feb 2016 07:54:28 +0000 (15:54 +0800)]
arm64: dts: rockchip: add hdmi node on rk3366.dtsi

Change-Id: Ibd0cc2f7642455b3b17f55fbec653466c987a576
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
8 years agovideo: rockchip: hdmi: support rk3366
Zheng Yang [Wed, 17 Feb 2016 07:51:41 +0000 (15:51 +0800)]
video: rockchip: hdmi: support rk3366

Change-Id: I944e9749e559c25651de619c89eead0589c1eb5b
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
8 years agoLinux 4.4.2
Greg Kroah-Hartman [Wed, 17 Feb 2016 20:31:25 +0000 (12:31 -0800)]
Linux 4.4.2

8 years agoHID: multitouch: fix input mode switching on some Elan panels
Benjamin Tissoires [Tue, 1 Dec 2015 11:41:38 +0000 (12:41 +0100)]
HID: multitouch: fix input mode switching on some Elan panels

commit 73e7d63efb4d774883a338997943bfa59e127085 upstream.

as reported by https://bugzilla.kernel.org/show_bug.cgi?id=108481

This bug reports mentions 6d4f5440 ("HID: multitouch: Fetch feature
reports on demand for Win8 devices") as the origin of the problem but this
commit actually masked 2 firmware bugs that are annihilating each other:

The report descriptor declares two features in reports 3 and 5:

0x05, 0x0d,                    // Usage Page (Digitizers)             318
0x09, 0x0e,                    // Usage (Device Configuration)        320
0xa1, 0x01,                    // Collection (Application)            322
0x85, 0x03,                    //  Report ID (3)                      324
0x09, 0x22,                    //  Usage (Finger)                     326
0xa1, 0x00,                    //  Collection (Physical)              328
0x09, 0x52,                    //   Usage (Inputmode)                 330
0x15, 0x00,                    //   Logical Minimum (0)               332
0x25, 0x0a,                    //   Logical Maximum (10)              334
0x75, 0x08,                    //   Report Size (8)                   336
0x95, 0x02,                    //   Report Count (2)                  338
0xb1, 0x02,                    //   Feature (Data,Var,Abs)            340
0xc0,                          //  End Collection                     342
0x09, 0x22,                    //  Usage (Finger)                     343
0xa1, 0x00,                    //  Collection (Physical)              345
0x85, 0x05,                    //   Report ID (5)                     347
0x09, 0x57,                    //   Usage (Surface Switch)            349
0x09, 0x58,                    //   Usage (Button Switch)             351
0x15, 0x00,                    //   Logical Minimum (0)               353
0x75, 0x01,                    //   Report Size (1)                   355
0x95, 0x02,                    //   Report Count (2)                  357
0x25, 0x03,                    //   Logical Maximum (3)               359
0xb1, 0x02,                    //   Feature (Data,Var,Abs)            361
0x95, 0x0e,                    //   Report Count (14)                 363
0xb1, 0x03,                    //   Feature (Cnst,Var,Abs)            365
0xc0,                          //  End Collection                     367

The report ID 3 presents 2 input mode features, while only the first one
is handled by the device. Given that we did not checked if one was
previously assigned, we were dealing with the ignored featured and we
should never have been able to switch this panel into the multitouch mode.

However, the firmware presents an other bugs which allowed 6d4f5440
to counteract the faulty report descriptor. When we request the values
of the feature 5, the firmware answers "03 03 00". The fields are correct
but the report id is wrong. Before 6d4f5440, we retrieved all the features
and injected them in the system. So when we called report 5, we injected
in the system the report 3 with the values "03 00".
Setting the second input mode to 03 in this report changed it to "03 03"
and the touchpad switched to the mt mode. We could have set anything
in the second field because the actual value (the first 03 in this report)
was given by the query of report ID 5.

To sum up: 2 bugs in the firmware were hiding that we were accessing the
wrong feature.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agomm, vmstat: fix wrong WQ sleep when memory reclaim doesn't make any progress
Tetsuo Handa [Fri, 5 Feb 2016 23:36:30 +0000 (15:36 -0800)]
mm, vmstat: fix wrong WQ sleep when memory reclaim doesn't make any progress

commit 564e81a57f9788b1475127012e0fd44e9049e342 upstream.

Jan Stancek has reported that system occasionally hanging after "oom01"
testcase from LTP triggers OOM.  Guessing from a result that there is a
kworker thread doing memory allocation and the values between "Node 0
Normal free:" and "Node 0 Normal:" differs when hanging, vmstat is not
up-to-date for some reason.

According to commit 373ccbe59270 ("mm, vmstat: allow WQ concurrency to
discover memory reclaim doesn't make any progress"), it meant to force
the kworker thread to take a short sleep, but it by error used
schedule_timeout(1).  We missed that schedule_timeout() in state
TASK_RUNNING doesn't do anything.

Fix it by using schedule_timeout_uninterruptible(1) which forces the
kworker thread to take a short sleep in order to make sure that vmstat
is up-to-date.

Fixes: 373ccbe59270 ("mm, vmstat: allow WQ concurrency to discover memory reclaim doesn't make any progress")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Cristopher Lameter <clameter@sgi.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Arkadiusz Miskiewicz <arekm@maven.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agozsmalloc: fix migrate_zspage-zs_free race condition
Junil Lee [Wed, 20 Jan 2016 22:58:18 +0000 (14:58 -0800)]
zsmalloc: fix migrate_zspage-zs_free race condition

commit c102f07ca0b04f2cb49cfc161c83f6239d17f491 upstream.

record_obj() in migrate_zspage() does not preserve handle's
HANDLE_PIN_BIT, set by find_aloced_obj()->trypin_tag(), and implicitly
(accidentally) un-pins the handle, while migrate_zspage() still performs
an explicit unpin_tag() on the that handle.  This additional explicit
unpin_tag() introduces a race condition with zs_free(), which can pin
that handle by this time, so the handle becomes un-pinned.

Schematically, it goes like this:

  CPU0                                        CPU1
  migrate_zspage
    find_alloced_obj
      trypin_tag
        set HANDLE_PIN_BIT                    zs_free()
                                                pin_tag()
  obj_malloc() -- new object, no tag
  record_obj() -- remove HANDLE_PIN_BIT           set HANDLE_PIN_BIT
  unpin_tag()  -- remove zs_free's HANDLE_PIN_BIT

The race condition may result in a NULL pointer dereference:

  Unable to handle kernel NULL pointer dereference at virtual address 00000000
  CPU: 0 PID: 19001 Comm: CookieMonsterCl Tainted:
  PC is at get_zspage_mapping+0x0/0x24
  LR is at obj_free.isra.22+0x64/0x128
  Call trace:
     get_zspage_mapping+0x0/0x24
     zs_free+0x88/0x114
     zram_free_page+0x64/0xcc
     zram_slot_free_notify+0x90/0x108
     swap_entry_free+0x278/0x294
     free_swap_and_cache+0x38/0x11c
     unmap_single_vma+0x480/0x5c8
     unmap_vmas+0x44/0x60
     exit_mmap+0x50/0x110
     mmput+0x58/0xe0
     do_exit+0x320/0x8dc
     do_group_exit+0x44/0xa8
     get_signal+0x538/0x580
     do_signal+0x98/0x4b8
     do_notify_resume+0x14/0x5c

This patch keeps the lock bit in migration path and update value
atomically.

Signed-off-by: Junil Lee <junil0814.lee@lge.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agozram: don't call idr_remove() from zram_remove()
Jerome Marchand [Sat, 16 Jan 2016 00:54:48 +0000 (16:54 -0800)]
zram: don't call idr_remove() from zram_remove()

commit 17ec4cd985780a7e30aa45bb8f272237c12502a4 upstream.

The use of idr_remove() is forbidden in the callback functions of
idr_for_each().  It is therefore unsafe to call idr_remove in
zram_remove().

This patch moves the call to idr_remove() from zram_remove() to
hot_remove_store().  In the detroy_devices() path, idrs are removed by
idr_destroy().  This solves an use-after-free detected by KASan.

[akpm@linux-foundation.org: fix coding stype, per Sergey]
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agozram: try vmalloc() after kmalloc()
Kyeongdon Kim [Thu, 14 Jan 2016 23:22:29 +0000 (15:22 -0800)]
zram: try vmalloc() after kmalloc()

commit d913897abace843bba20249f3190167f7895e9c3 upstream.

When we're using LZ4 multi compression streams for zram swap, we found
out page allocation failure message in system running test.  That was
not only once, but a few(2 - 5 times per test).  Also, some failure
cases were continually occurring to try allocation order 3.

In order to make parallel compression private data, we should call
kzalloc() with order 2/3 in runtime(lzo/lz4).  But if there is no order
2/3 size memory to allocate in that time, page allocation fails.  This
patch makes to use vmalloc() as fallback of kmalloc(), this prevents
page alloc failure warning.

After using this, we never found warning message in running test, also
It could reduce process startup latency about 60-120ms in each case.

For reference a call trace :

    Binder_1: page allocation failure: order:3, mode:0x10c0d0
    CPU: 0 PID: 424 Comm: Binder_1 Tainted: GW 3.10.49-perf-g991d02b-dirty #20
    Call trace:
      dump_backtrace+0x0/0x270
      show_stack+0x10/0x1c
      dump_stack+0x1c/0x28
      warn_alloc_failed+0xfc/0x11c
      __alloc_pages_nodemask+0x724/0x7f0
      __get_free_pages+0x14/0x5c
      kmalloc_order_trace+0x38/0xd8
      zcomp_lz4_create+0x2c/0x38
      zcomp_strm_alloc+0x34/0x78
      zcomp_strm_multi_find+0x124/0x1ec
      zcomp_strm_find+0xc/0x18
      zram_bvec_rw+0x2fc/0x780
      zram_make_request+0x25c/0x2d4
      generic_make_request+0x80/0xbc
      submit_bio+0xa4/0x15c
      __swap_writepage+0x218/0x230
      swap_writepage+0x3c/0x4c
      shrink_page_list+0x51c/0x8d0
      shrink_inactive_list+0x3f8/0x60c
      shrink_lruvec+0x33c/0x4cc
      shrink_zone+0x3c/0x100
      try_to_free_pages+0x2b8/0x54c
      __alloc_pages_nodemask+0x514/0x7f0
      __get_free_pages+0x14/0x5c
      proc_info_read+0x50/0xe4
      vfs_read+0xa0/0x12c
      SyS_read+0x44/0x74
    DMA: 3397*4kB (MC) 26*8kB (RC) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB
         0*512kB 0*1024kB 0*2048kB 0*4096kB = 13796kB

[minchan@kernel.org: change vmalloc gfp and adding comment about gfp]
[sergey.senozhatsky@gmail.com: tweak comments and styles]
Signed-off-by: Kyeongdon Kim <kyeongdon.kim@lge.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agozram/zcomp: use GFP_NOIO to allocate streams
Sergey Senozhatsky [Thu, 14 Jan 2016 23:22:26 +0000 (15:22 -0800)]
zram/zcomp: use GFP_NOIO to allocate streams

commit 3d5fe03a3ea013060ebba2a811aeb0f23f56aefa upstream.

We can end up allocating a new compression stream with GFP_KERNEL from
within the IO path, which may result is nested (recursive) IO
operations.  That can introduce problems if the IO path in question is a
reclaimer, holding some locks that will deadlock nested IOs.

Allocate streams and working memory using GFP_NOIO flag, forbidding
recursive IO and FS operations.

An example:

  inconsistent {IN-RECLAIM_FS-W} -> {RECLAIM_FS-ON-W} usage.
  git/20158 [HC0[0]:SC0[0]:HE1:SE1] takes:
   (jbd2_handle){+.+.?.}, at:  start_this_handle+0x4ca/0x555
  {IN-RECLAIM_FS-W} state was registered at:
     __lock_acquire+0x8da/0x117b
     lock_acquire+0x10c/0x1a7
     start_this_handle+0x52d/0x555
     jbd2__journal_start+0xb4/0x237
     __ext4_journal_start_sb+0x108/0x17e
     ext4_dirty_inode+0x32/0x61
     __mark_inode_dirty+0x16b/0x60c
     iput+0x11e/0x274
     __dentry_kill+0x148/0x1b8
     shrink_dentry_list+0x274/0x44a
     prune_dcache_sb+0x4a/0x55
     super_cache_scan+0xfc/0x176
     shrink_slab.part.14.constprop.25+0x2a2/0x4d3
     shrink_zone+0x74/0x140
     kswapd+0x6b7/0x930
     kthread+0x107/0x10f
     ret_from_fork+0x3f/0x70
  irq event stamp: 138297
  hardirqs last  enabled at (138297):  debug_check_no_locks_freed+0x113/0x12f
  hardirqs last disabled at (138296):  debug_check_no_locks_freed+0x33/0x12f
  softirqs last  enabled at (137818):  __do_softirq+0x2d3/0x3e9
  softirqs last disabled at (137813):  irq_exit+0x41/0x95

               other info that might help us debug this:
   Possible unsafe locking scenario:
         CPU0
         ----
    lock(jbd2_handle);
    <Interrupt>
      lock(jbd2_handle);

                *** DEADLOCK ***
  5 locks held by git/20158:
   #0:  (sb_writers#7){.+.+.+}, at: [<ffffffff81155411>] mnt_want_write+0x24/0x4b
   #1:  (&type->i_mutex_dir_key#2/1){+.+.+.}, at: [<ffffffff81145087>] lock_rename+0xd9/0xe3
   #2:  (&sb->s_type->i_mutex_key#11){+.+.+.}, at: [<ffffffff8114f8e2>] lock_two_nondirectories+0x3f/0x6b
   #3:  (&sb->s_type->i_mutex_key#11/4){+.+.+.}, at: [<ffffffff8114f909>] lock_two_nondirectories+0x66/0x6b
   #4:  (jbd2_handle){+.+.?.}, at: [<ffffffff811e31db>] start_this_handle+0x4ca/0x555

               stack backtrace:
  CPU: 2 PID: 20158 Comm: git Not tainted 4.1.0-rc7-next-20150615-dbg-00016-g8bdf555-dirty #211
  Call Trace:
    dump_stack+0x4c/0x6e
    mark_lock+0x384/0x56d
    mark_held_locks+0x5f/0x76
    lockdep_trace_alloc+0xb2/0xb5
    kmem_cache_alloc_trace+0x32/0x1e2
    zcomp_strm_alloc+0x25/0x73 [zram]
    zcomp_strm_multi_find+0xe7/0x173 [zram]
    zcomp_strm_find+0xc/0xe [zram]
    zram_bvec_rw+0x2ca/0x7e0 [zram]
    zram_make_request+0x1fa/0x301 [zram]
    generic_make_request+0x9c/0xdb
    submit_bio+0xf7/0x120
    ext4_io_submit+0x2e/0x43
    ext4_bio_write_page+0x1b7/0x300
    mpage_submit_page+0x60/0x77
    mpage_map_and_submit_buffers+0x10f/0x21d
    ext4_writepages+0xc8c/0xe1b
    do_writepages+0x23/0x2c
    __filemap_fdatawrite_range+0x84/0x8b
    filemap_flush+0x1c/0x1e
    ext4_alloc_da_blocks+0xb8/0x117
    ext4_rename+0x132/0x6dc
    ? mark_held_locks+0x5f/0x76
    ext4_rename2+0x29/0x2b
    vfs_rename+0x540/0x636
    SyS_renameat2+0x359/0x44d
    SyS_rename+0x1e/0x20
    entry_SYSCALL_64_fastpath+0x12/0x6f

[minchan@kernel.org: add stable mark]
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Kyeongdon Kim <kyeongdon.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agortlwifi: rtl8821ae: Fix 5G failure when EEPROM is incorrectly encoded
Larry Finger [Thu, 21 Jan 2016 03:58:39 +0000 (21:58 -0600)]
rtlwifi: rtl8821ae: Fix 5G failure when EEPROM is incorrectly encoded

commit c72fc9093718a3f8597249863a1bac345ba00859 upstream.

Recently, it has been reported that D-Link DWA-582 cards, which use an
RTL8812AE chip are not able to scan for 5G networks. The problems started
with kernel 4.2, which is the first version that had commit d10101a60372
("rtlwifi: rtl8821ae: Fix problem with regulatory information"). With this
patch, the driver went from setting a default channel plan to using
the value derived from EEPROM.

Bug reports at https://bugzilla.kernel.org/show_bug.cgi?id=111031 and
https://bugzilla.redhat.com/show_bug.cgi?id=1279653 are examples of this
problem.

The problem was solved once I learned that the internal country code was
resulting in a regulatory set with only 2.4 GHz channels. With the RTL8821AE
chips available to me, the country code was such that both 2.4 and 5 GHz
channels are allowed. The fix is to allow both bands even when the EEPROM
is incorrectly encoded.

Fixes: d10101a60372 ("rtlwifi: rtl8821ae: Fix problem with regulatory information")
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: littlesmartguy@gmail.com
Cc: gabe@codehaus.org
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agortlwifi: rtl8821ae: Fix errors in parameter initialization
Larry Finger [Mon, 14 Dec 2015 22:34:33 +0000 (16:34 -0600)]
rtlwifi: rtl8821ae: Fix errors in parameter initialization

commit 78bae1de422a7f6f2b4b61f6a5c379e3d7f96f44 upstream.

This driver failed to copy parameters sw_crypto and disable_watchdog into
the locations actually used by the driver. In addition, msi_support was
initialized three times and one of them used the wrong variable. The
initialization of parameter int_clear was moved so that it is near that
of the rest of the parameters.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: marvell/cesa - fix test in mv_cesa_dev_dma_init()
Boris BREZILLON [Fri, 5 Feb 2016 16:45:48 +0000 (17:45 +0100)]
crypto: marvell/cesa - fix test in mv_cesa_dev_dma_init()

commit 8a3978ad55fb4c0564d285fb2f6cdee2313fce01 upstream.

We are checking twice if dma->cache_pool is not NULL but are never testing
dma->padding_pool value.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: atmel-sha - remove calls of clk_prepare() from atomic contexts
Cyrille Pitchen [Fri, 5 Feb 2016 12:45:13 +0000 (13:45 +0100)]
crypto: atmel-sha - remove calls of clk_prepare() from atomic contexts

commit c033042aa8f69894df37dabcaa0231594834a4e4 upstream.

clk_prepare()/clk_unprepare() must not be called within atomic context.

This patch calls clk_prepare() once for all from atmel_sha_probe() and
clk_unprepare() from atmel_sha_remove().

Then calls of clk_prepare_enable()/clk_disable_unprepare() were replaced
by calls of clk_enable()/clk_disable().

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Reported-by: Matthias Mayr <matthias.mayr@student.kit.edu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: atmel-sha - fix atmel_sha_remove()
Cyrille Pitchen [Fri, 5 Feb 2016 12:45:12 +0000 (13:45 +0100)]
crypto: atmel-sha - fix atmel_sha_remove()

commit d961436c11482e974b702c8324426208f00cd7c4 upstream.

Since atmel_sha_probe() uses devm_xxx functions to allocate resources,
atmel_sha_remove() should no longer explicitly release them.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Fixes: b0e8b3417a62 ("crypto: atmel - use devm_xxx() managed function")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: algif_skcipher - Do not set MAY_BACKLOG on the async path
Herbert Xu [Wed, 3 Feb 2016 13:39:27 +0000 (21:39 +0800)]
crypto: algif_skcipher - Do not set MAY_BACKLOG on the async path

commit dad41997063723eaf5f77bc2015606a5a9bce320 upstream.

The async path cannot use MAY_BACKLOG because it is not meant to
block, which is what MAY_BACKLOG does.  On the other hand, both
the sync and async paths can make use of MAY_SLEEP.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: algif_skcipher - Do not dereference ctx without socket lock
Herbert Xu [Wed, 3 Feb 2016 13:39:26 +0000 (21:39 +0800)]
crypto: algif_skcipher - Do not dereference ctx without socket lock

commit 6454c2b83f719057069777132b13949e4c6b6350 upstream.

Any access to non-constant bits of the private context must be
done under the socket lock, in particular, this includes ctx->req.

This patch moves such accesses under the lock, and fetches the
tfm from the parent socket which is guaranteed to be constant,
rather than from ctx->req.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: algif_skcipher - Do not assume that req is unchanged
Herbert Xu [Wed, 3 Feb 2016 13:39:24 +0000 (21:39 +0800)]
crypto: algif_skcipher - Do not assume that req is unchanged

commit ec69bbfb9902c32a5c1492f2b1b8ad032a66d724 upstream.

The async path in algif_skcipher assumes that the crypto completion
function will be called with the original request.  This is not
necessarily the case.  In fact there is no need for this anyway
since we already embed information into the request with struct
skcipher_async_req.

This patch adds a pointer to that struct and then passes it as
the data to the callback function.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Tadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: user - lock crypto_alg_list on alg dump
Mathias Krause [Mon, 1 Feb 2016 13:27:30 +0000 (14:27 +0100)]
crypto: user - lock crypto_alg_list on alg dump

commit 63e41ebc6630f39422d87f8a4bade1e793f37a01 upstream.

We miss to take the crypto_alg_sem semaphore when traversing the
crypto_alg_list for CRYPTO_MSG_GETALG dumps. This allows a race with
crypto_unregister_alg() removing algorithms from the list while we're
still traversing it, thereby leading to a use-after-free as show below:

[ 3482.071639] general protection fault: 0000 [#1] SMP
[ 3482.075639] Modules linked in: aes_x86_64 glue_helper lrw ablk_helper cryptd gf128mul ipv6 pcspkr serio_raw virtio_net microcode virtio_pci virtio_ring virtio sr_mod cdrom [last unloaded: aesni_intel]
[ 3482.075639] CPU: 1 PID: 11065 Comm: crconf Not tainted 4.3.4-grsec+ #126
[ 3482.075639] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
[ 3482.075639] task: ffff88001cd41a40 ti: ffff88001cd422c8 task.ti: ffff88001cd422c8
[ 3482.075639] RIP: 0010:[<ffffffff93722bd3>]  [<ffffffff93722bd3>] strncpy+0x13/0x30
[ 3482.075639] RSP: 0018:ffff88001f713b60  EFLAGS: 00010202
[ 3482.075639] RAX: ffff88001f6c4430 RBX: ffff88001f6c43a0 RCX: ffff88001f6c4430
[ 3482.075639] RDX: 0000000000000040 RSI: fefefefefefeff16 RDI: ffff88001f6c4430
[ 3482.075639] RBP: ffff88001f713b60 R08: ffff88001f6c4470 R09: ffff88001f6c4480
[ 3482.075639] R10: 0000000000000002 R11: 0000000000000246 R12: ffff88001ce2aa28
[ 3482.075639] R13: ffff880000093700 R14: ffff88001f5e4bf8 R15: 0000000000003b20
[ 3482.075639] FS:  0000033826fa2700(0000) GS:ffff88001e900000(0000) knlGS:0000000000000000
[ 3482.075639] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 3482.075639] CR2: ffffffffff600400 CR3: 00000000139ec000 CR4: 00000000001606f0
[ 3482.075639] Stack:
[ 3482.075639]  ffff88001f713bd8 ffffffff936ccd00 ffff88001e5c4200 ffff880000093700
[ 3482.075639]  ffff88001f713bd0 ffffffff938ef4bf 0000000000000000 0000000000003b20
[ 3482.075639]  ffff88001f5e4bf8 ffff88001f5e4848 0000000000000000 0000000000003b20
[ 3482.075639] Call Trace:
[ 3482.075639]  [<ffffffff936ccd00>] crypto_report_alg+0xc0/0x3e0
[ 3482.075639]  [<ffffffff938ef4bf>] ? __alloc_skb+0x16f/0x300
[ 3482.075639]  [<ffffffff936cd08a>] crypto_dump_report+0x6a/0x90
[ 3482.075639]  [<ffffffff93935707>] netlink_dump+0x147/0x2e0
[ 3482.075639]  [<ffffffff93935f99>] __netlink_dump_start+0x159/0x190
[ 3482.075639]  [<ffffffff936ccb13>] crypto_user_rcv_msg+0xc3/0x130
[ 3482.075639]  [<ffffffff936cd020>] ? crypto_report_alg+0x3e0/0x3e0
[ 3482.075639]  [<ffffffff936cc4b0>] ? alg_test_crc32c+0x120/0x120
[ 3482.075639]  [<ffffffff93933145>] ? __netlink_lookup+0xd5/0x120
[ 3482.075639]  [<ffffffff936cca50>] ? crypto_add_alg+0x1d0/0x1d0
[ 3482.075639]  [<ffffffff93938141>] netlink_rcv_skb+0xe1/0x130
[ 3482.075639]  [<ffffffff936cc4f8>] crypto_netlink_rcv+0x28/0x40
[ 3482.075639]  [<ffffffff939375a8>] netlink_unicast+0x108/0x180
[ 3482.075639]  [<ffffffff93937c21>] netlink_sendmsg+0x541/0x770
[ 3482.075639]  [<ffffffff938e31e1>] sock_sendmsg+0x21/0x40
[ 3482.075639]  [<ffffffff938e4763>] SyS_sendto+0xf3/0x130
[ 3482.075639]  [<ffffffff93444203>] ? bad_area_nosemaphore+0x13/0x20
[ 3482.075639]  [<ffffffff93444470>] ? __do_page_fault+0x80/0x3a0
[ 3482.075639]  [<ffffffff939d80cb>] entry_SYSCALL_64_fastpath+0x12/0x6e
[ 3482.075639] Code: 88 4a ff 75 ed 5d 48 0f ba 2c 24 3f c3 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 85 d2 48 89 f8 48 89 f9 4c 8d 04 17 48 89 e5 74 15 <0f> b6 16 80 fa 01 88 11 48 83 de ff 48 83 c1 01 4c 39 c1 75 eb
[ 3482.075639] RIP  [<ffffffff93722bd3>] strncpy+0x13/0x30

To trigger the race run the following loops simultaneously for a while:
  $ while : ; do modprobe aesni-intel; rmmod aesni-intel; done
  $ while : ; do crconf show all > /dev/null; done

Fix the race by taking the crypto_alg_sem read lock, thereby preventing
crypto_unregister_alg() from modifying the algorithm list during the
dump.

This bug has been detected by the PaX memory sanitize feature.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: PaX Team <pageexec@freemail.hu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoEVM: Use crypto_memneq() for digest comparisons
Ryan Ware [Thu, 11 Feb 2016 23:58:44 +0000 (15:58 -0800)]
EVM: Use crypto_memneq() for digest comparisons

commit 613317bd212c585c20796c10afe5daaa95d4b0a1 upstream.

This patch fixes vulnerability CVE-2016-2085.  The problem exists
because the vm_verify_hmac() function includes a use of memcmp().
Unfortunately, this allows timing side channel attacks; specifically
a MAC forgery complexity drop from 2^128 to 2^12.  This patch changes
the memcmp() to the cryptographically safe crypto_memneq().

Reported-by: Xiaofei Rex Guo <xiaofei.rex.guo@intel.com>
Signed-off-by: Ryan Ware <ware@linux.intel.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: algif_hash - wait for crypto_ahash_init() to complete
Wang, Rui Y [Wed, 27 Jan 2016 09:08:37 +0000 (17:08 +0800)]
crypto: algif_hash - wait for crypto_ahash_init() to complete

commit fe09786178f9df713a4b2dd6b93c0a722346bf5e upstream.

hash_sendmsg/sendpage() need to wait for the completion
of crypto_ahash_init() otherwise it can cause panic.

Signed-off-by: Rui Wang <rui.y.wang@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: shash - Fix has_key setting
Herbert Xu [Tue, 26 Jan 2016 16:16:37 +0000 (00:16 +0800)]
crypto: shash - Fix has_key setting

commit 00420a65fa2beb3206090ead86942484df2275f3 upstream.

The has_key logic is wrong for shash algorithms as they always
have a setkey function.  So we should instead be testing against
shash_no_setkey.

Fixes: a5596d633278 ("crypto: hash - Add crypto_ahash_has_setkey")
Reported-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: chacha20-ssse3 - Align stack pointer to 64 bytes
Eli Cooper [Thu, 21 Jan 2016 16:24:08 +0000 (00:24 +0800)]
crypto: chacha20-ssse3 - Align stack pointer to 64 bytes

commit cbe09bd51bf23b42c3a94c5fb6815e1397c5fc3f upstream.

This aligns the stack pointer in chacha20_4block_xor_ssse3 to 64 bytes.
Fixes general protection faults and potential kernel panics.

Signed-off-by: Eli Cooper <elicooper@gmx.com>
Acked-by: Martin Willi <martin@strongswan.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocrypto: caam - make write transactions bufferable on PPC platforms
Horia Geant? [Tue, 12 Jan 2016 15:59:29 +0000 (17:59 +0200)]
crypto: caam - make write transactions bufferable on PPC platforms

commit e7a7104e432c0db8469ca3568daf4f1d1afe3e73 upstream.

Previous change (see "Fixes" tag) to the MCFGR register
clears AWCACHE[0] ("bufferable" AXI3 attribute) (which is "1" at POR).

This makes all writes non-bufferable, causing a ~ 5% performance drop
for PPC-based platforms.

Rework previous change such that MCFGR[AWCACHE]=4'b0011
(bufferable + cacheable) for all platforms.
Note: For ARM-based platforms, AWCACHE[0] is ignored
by the interconnect IP.

Fixes: f10967495144 ("crypto: caam - fix snooping for write transactions")
Signed-off-by: Horia Geant? <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>