firefly-linux-kernel-4.4.55.git
5 years agoarm64: dts: rk3399-android-next: add iommu_enabled property in vpu&rkvdec node
Jung Zhao [Fri, 9 Dec 2016 13:11:25 +0000 (21:11 +0800)]
arm64: dts: rk3399-android-next: add iommu_enabled property in vpu&rkvdec node

camera will query this property, this is historical issue!!!

Change-Id: Ida221e9f5781dcc5562cad69e2ac437290b946bb
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>
5 years agovideo: rockchip: fb: add dataspace for hdr
Huang Jiachai [Thu, 20 Oct 2016 08:23:05 +0000 (16:23 +0800)]
video: rockchip: fb: add dataspace for hdr

Change-Id: I65fb95a550d6afecf6b45f65afbd24047e8d5097
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: Setup rk3288 ethernet0 alias for u-boot
Jacob Chen [Fri, 9 Dec 2016 06:43:36 +0000 (14:43 +0800)]
UPSTREAM: ARM: dts: rockchip: Setup rk3288 ethernet0 alias for u-boot

Add an ethernet0 alias for the RK3288 mac interface so
that u-boot can find the device-node and fill in the mac address on
boards that support a wired network interface.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Change-Id: Ie8c4e0d90b62278485446f614fce0c95145432d9
(cherry picked from commit 85ef8d611f4b0216bc4f96487a0408d5c887f6f9)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: add interrupt for Wake-on-Lan on RK3288
Jacob Chen [Fri, 9 Dec 2016 06:43:22 +0000 (14:43 +0800)]
UPSTREAM: ARM: dts: rockchip: add interrupt for Wake-on-Lan on RK3288

In order to use Wake-on-Lan on RK3288 integrated MAC, we need to wake-up
the CPU on the PMT interrupt when the MAC and the PHY are in low power mode.
Adding the interrupt declaration.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Change-Id: Iec2637cc0448b6d93b895ca8f4176bab0a1f2dfb
(cherry picked from commit d5bfbeb80973010dc87c82dc56f66e99c3e8c4da)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: drop unneeded properties from mipi node
Jacob Chen [Fri, 9 Dec 2016 06:43:07 +0000 (14:43 +0800)]
UPSTREAM: ARM: dts: rockchip: drop unneeded properties from mipi node

The mipi controller node does contain an unused reg property as well as
unnecessary #address-cells and #size-cells properties for subnodes
not using addresses, so remove those to also make dtc happy.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Rob Herring <robh@kernel.org>
Change-Id: I48166c93f7746fa88fe2b35c3a040048926cadf7
(cherry picked from commit 6b241fcccb42ab96b3cdca7066cebd0f5cdd44e0)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: add mipi_dsi to VIO power domain on rk3288
Jacob Chen [Fri, 9 Dec 2016 06:42:53 +0000 (14:42 +0800)]
UPSTREAM: ARM: dts: rockchip: add mipi_dsi to VIO power domain on rk3288

The MIPI controllers are part of the VIO power domain so add the
necessary property to indicate this for the controller we support.

Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Change-Id: I1d51ba1b91dcacb4dfbd6a23d3e609cb66b9426e
 (cherry picked from commit 1946a201b3963b78a9e2123aedbdd11c4c4849dd)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: add channels properties for i2s
Jacob Chen [Fri, 9 Dec 2016 06:42:36 +0000 (14:42 +0800)]
UPSTREAM: ARM: dts: rockchip: add channels properties for i2s

add playback and capture properties to compatible various chips.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Change-Id: I7bc186f631212b0b2f3355aa2e371c52a0a99ede
 (cherry picked from commit e241657de0ced9b40cad126f461b23a8d6c1b563)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: move the rk3288 thermal data into rk3288.dtsi
Jacob Chen [Fri, 9 Dec 2016 06:42:21 +0000 (14:42 +0800)]
UPSTREAM: ARM: dts: rockchip: move the rk3288 thermal data into rk3288.dtsi

In order to be standard to manage for rockchip SoCs,  move the thermal
data into rk3288 dtsi, we needn't to add a new file for thermal.

Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Change-Id: I2b11b46d1cfb9b70882d1062dedc5b8ff1bd5adf
(cherry picked from commit f87305fa00b1d0633d2dc5fd7fb4995bed6a59e8)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: fix rk3288 power-domain unit names
Jacob Chen [Fri, 9 Dec 2016 06:42:03 +0000 (14:42 +0800)]
UPSTREAM: ARM: dts: rockchip: fix rk3288 power-domain unit names

The power-domain sub-nodes do have reg properties, but so far are
missing the expected unit names. So add the missing ones.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Rob Herring <robh@kernel.org>
Change-Id: I03d82afdc2f170c7ecce9685e15b418ca5d30d5a
(cherry picked from commit 95cface95b6a6a8de6e95de2c8a25a64fd0f3558)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: fix missing usbphy unit-names
Jacob Chen [Fri, 9 Dec 2016 06:41:36 +0000 (14:41 +0800)]
UPSTREAM: ARM: dts: rockchip: fix missing usbphy unit-names

The usbphy subnodes do have a reg property but no unitname, add them.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Rob Herring <robh@kernel.org>
Change-Id: I5b48e289b332397ab7c383b839b875aeefa9f114
 (cherry picked from commit a8f0fa2764626d2dd808cfbe1a160f2939a36c88)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: phy: rockchip-usb: should be a child device of the GRF
Jacob Chen [Fri, 9 Dec 2016 06:41:10 +0000 (14:41 +0800)]
UPSTREAM: phy: rockchip-usb: should be a child device of the GRF

The usb-phy is fully enclosed in the general register files (GRF).
Therefore as seen from the device-tree it shouldn't be a separate
platform-device but instead a sub-device of the GRF - using the
simply-mfd mechanism.

As the usb-phy is part of the kernel for some releases now, we keep
the old (and now deprecated) binding for compatibility purposes.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Change-Id: I747a18fba361d6c6f161b6572e43955e18593a34
 (cherry picked from commit a0da445aabe49c31093ecf3930f531e3c63e0b83)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: phy: rockchip-dp: should be a child device of the GRF
Jacob Chen [Fri, 9 Dec 2016 06:40:51 +0000 (14:40 +0800)]
UPSTREAM: phy: rockchip-dp: should be a child device of the GRF

The displayport-phy is fully enclosed in the general register files (GRF).
Therefore as seen from the device-tree it shouldn't be a separate platform-
device but instead a sub-device of the GRF - using the simply-mfd mechanism.

The driver entered the kernel in the current merge-window, so we can still
adapt the binding without needing a fallback, as the binding hasn't been
released with a full kernel yet.

While the edp phy is fully part of the GRF, it doesn't have any separate
register set there, so doesn't get any register-area assigned.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Change-Id: I44a857051be195386fc888b2c713bedc948d5c95
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
 (cherry picked from commit 0311c76e4722b8d6e5fa47eaee63c6552bcc74f5)

5 years agoUPSTREAM: PM / AVS: rockchip-io: make io-domains a child of the GRF
Jacob Chen [Fri, 9 Dec 2016 06:40:33 +0000 (14:40 +0800)]
UPSTREAM: PM / AVS: rockchip-io: make io-domains a child of the GRF

IO-domain handling is part of the general register files, so should live
under the grf directly. This change allows the grf to be a simple-mfd and
the io-domains fetching the syscon regmap from that parent-node.

The old binding is of course preserved, though deprecated.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Change-Id: I562e293fc96283edc868771851f15dba0e80d3bc
(cherry picked from commit bc19b9a81da009fd1d797d756d41b518ac7e5f14)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: arm: dts: rockchip: add reset node for the exist saradc SoCs
Jacob Chen [Fri, 9 Dec 2016 06:40:18 +0000 (14:40 +0800)]
UPSTREAM: arm: dts: rockchip: add reset node for the exist saradc SoCs

SARADC controller needs to be reset before programming it, otherwise
it will not function properly.

Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Change-Id: Iaafd41b163ebd853278baea5c1c10dc82c54792b
 (cherry picked from commit 3d4267a5a3a4b7619b80ad1839d8b3bedd8b7a8d)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: move rk3288 usbphy under the GRF node
Jacob Chen [Fri, 9 Dec 2016 06:40:03 +0000 (14:40 +0800)]
UPSTREAM: ARM: dts: rockchip: move rk3288 usbphy under the GRF node

The rk3288 usbphy is completely enclosed in the general register files
and the updated binding allows it to be a subnode of the GRF now.
So move the node appropriately.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Change-Id: I85ca27786da0cd388ef6b4fddb11747761a579a3
(cherry picked from commit 546a3521f251462128d877e48fb3544c74976ce4)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: move rk3288 io-domain nodes to the grf
Jacob Chen [Fri, 9 Dec 2016 06:39:47 +0000 (14:39 +0800)]
UPSTREAM: ARM: dts: rockchip: move rk3288 io-domain nodes to the grf

io-voltage control is actually part of the grf, so move the node under the
newly available grf simple-mfd.

To minimize duplicate code, the core node and compatible property
gets placed in the core rk3288.dtsi while the individual boards
now only need to enable it and add the necessary supply properties.
cherry picked from commit 4b91545072ad7ca1963d2a89c8b42fc2eb561484)

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Conflicts:
arch/arm/boot/dts/rk3288-miqi.dts
arch/arm/boot/dts/rk3288-rock2-som.dtsi

Change-Id: I4f5ecc16524c52e8ac6f04cf8b9cdc0e1b7d937f
 (cherry picked from commit 3445b2fae55f1a232e6e4843f4f74de074d8c07f)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: move rk3288 edp phy under the GRF
Jacob Chen [Fri, 9 Dec 2016 06:39:34 +0000 (14:39 +0800)]
UPSTREAM: ARM: dts: rockchip: move rk3288 edp phy under the GRF

The edp-phy control is a part of the General Register Files and
with a recent patch in 4.6 the phy driver can now also handle this
correctly, so move the dts node under the GRF as well.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Change-Id: I6be6270739520f758dbe388cdbd50896c1d7d6f1
(cherry picked from commit 4b91545072ad7ca1963d2a89c8b42fc2eb561484)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: ARM: dts: rockchip: make rk3288-grf a simple-mfd
Jacob Chen [Fri, 9 Dec 2016 06:39:20 +0000 (14:39 +0800)]
UPSTREAM: ARM: dts: rockchip: make rk3288-grf a simple-mfd

Similar to the pmu, the general register files contain a lot of different
setting bits grouped into general registers, but also some somewhat special
entities like the controls for some phy-blocks or the io-voltage control.
To be able to move these blocks under the grf node where they actually
belong, make it a simple-mfd.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Change-Id: I2c7f9d6f4411ea05520515a45acbaa689814c872
(cherry picked from commit 6e38e6b26e590b21247c1dd5238be35e7b056ef9)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoarm64: dts: rk3399: enabled rkvdec and vpu on android next board
wlq [Fri, 9 Dec 2016 07:55:41 +0000 (15:55 +0800)]
arm64: dts: rk3399: enabled rkvdec and vpu on android next board

Change-Id: I418b1065de8e078f1cf25f24889ca78006a98a4e
Signed-off-by: huang zufang <hzf@rock-chips.com>
Signed-off-by: zhangjun <jung.zhao@rock-chips.com>
Signed-off-by: liangqing wu <wlq@rock-chips.com>
5 years agovideo: rockchip: rkvdec: add drm&ion allocator support
Randy Li [Mon, 31 Oct 2016 08:58:28 +0000 (16:58 +0800)]
video: rockchip: rkvdec: add drm&ion allocator support

Now vpu driver support both drm and ion allocator. And have
test on rk3399-mid(drm android 7.1), rk3399-mid(ion android
6.0), rk3288(linux mini arm) platform.

Change-Id: I0096c3928849b1f11a62378675f4559b4f101445
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoARM64: dts: rockchip: add rkvpu & vpu node in rk3399 android next dtsi
Jung Zhao [Thu, 8 Dec 2016 06:43:24 +0000 (14:43 +0800)]
ARM64: dts: rockchip: add rkvpu & vpu node in rk3399 android next dtsi

Change-Id: I8151e5dbc428c6a0eb2bcdba5edb193ca304249c
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>
5 years agoarm64: dts: rockchip: add allocator type inside vpu & rkvdec for rk3399-android
Jung Zhao [Thu, 8 Dec 2016 06:39:26 +0000 (14:39 +0800)]
arm64: dts: rockchip: add allocator type inside vpu & rkvdec for rk3399-android

Change-Id: Idecb0b1f360173955531fed0eac32407eeb33366
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>
5 years agodrm/rockchip: fb: allow big framebuffer
Mark Yao [Fri, 9 Dec 2016 07:07:54 +0000 (15:07 +0800)]
drm/rockchip: fb: allow big framebuffer

Change-Id: I2893ebbd616b79dfa6a1fcd1b98576097cbe4cb3
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agodrm/rockchip: add dither config for connected panel
Huang Jiachai [Thu, 8 Dec 2016 13:03:54 +0000 (21:03 +0800)]
drm/rockchip: add dither config for connected panel

Change-Id: Ia57d2ab75718d0a7a8b386a7d50e2e23011baeb2
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
5 years agodrm/rockchip: fix iommu_map_sg check
Mark Yao [Fri, 9 Dec 2016 01:03:10 +0000 (09:03 +0800)]
drm/rockchip: fix iommu_map_sg check

The return value of iommu_map_sg is size_t, it's unsigned

Change-Id: Ib06f61c020510673bc513e1a8fde6fd3980a7ca3
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agodrm/rockchip: fix iommu page fault when use boot logo
Mark Yao [Thu, 8 Dec 2016 09:00:30 +0000 (17:00 +0800)]
drm/rockchip: fix iommu page fault when use boot logo

Since (cacb6f5 FROMLIST: drm/rockchip: Use common IOMMU API to attach
devices), rockchip drm use common IOMMU API, the boot logo buffer
mapping need change to new api.

Change-Id: Ifa2c886e05d2de65de53a868458c56859519a0f2
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agopower: reset: reboot-mode: treat unrecognized reboot mode as normal mode
Andy Yan [Thu, 8 Dec 2016 08:58:07 +0000 (16:58 +0800)]
power: reset: reboot-mode: treat unrecognized reboot mode as normal mode

Some bootloader will check the reboot mode to take different action, so
we treat unrecognized reboot mode as normal mode to prevent the system
run into abnormal case.

Change-Id: I88063a5b41e4e645443229fa490b2b55db5ccf27
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
5 years agovideo/rockchip: rga2 support dma fd
Zikim,Wei [Wed, 7 Dec 2016 02:21:48 +0000 (10:21 +0800)]
video/rockchip: rga2 support dma fd

in drm mode ion is not support dma fd, in order
to support drm fd rga driver need fix, and user
also need set the buf type by the macro

Change-Id: I3d0eaf7fbefda5aaf715772649d972b9a9d5c06d
Signed-off-by: Zikim,Wei <wzq@rock-chips.com>
5 years agoARM: dts: rk3288: add isp node
Jacob Chen [Thu, 8 Dec 2016 04:34:16 +0000 (12:34 +0800)]
ARM: dts: rk3288: add isp node

Change-Id: Iadb1bb9afae66a935b0498986c3ee83a0fb487c9
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoclk: rockchip: rk3288: export isp and cif clk
Jacob Chen [Thu, 8 Dec 2016 04:31:06 +0000 (12:31 +0800)]
clk: rockchip: rk3288: export isp and cif clk

Change-Id: I2d9e46383f94cbd8023ad042f3921364c191f852
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agousb: dwc3: gadget: change detemination method of connect status
Meng Dongyang [Fri, 2 Dec 2016 10:27:09 +0000 (18:27 +0800)]
usb: dwc3: gadget: change detemination method of connect status

In current code, the connect status will be set to connected state when
reset interrupt occur and change to disconnected state in disconnect
interrupt.

But the usb charger may bring about reset signal in accident if we
connect and disconnect quickly. In this case, the dwc3 controller will
change link state and set to connect status, yet not change to
disconnected state when disconnect. So the dwc3 controller suspend
fail and result in a mistake when quick reconnect.

This patch set connect status to connected state when transfer complete
to make sure that usb is connect to PC exactly.

Change-Id: I8e5894d2e08b88bb5434222100d8f5c91c9f1a9d
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
5 years agousb: dwc3-rockchip: delay suspend until gadget finish transfer
Meng Dongyang [Thu, 24 Nov 2016 07:59:40 +0000 (15:59 +0800)]
usb: dwc3-rockchip: delay suspend until gadget finish transfer

DWC3 controller still need to read or write memory after dwc3
rockchip receive disconnect notify, the dwc3 controller will not
suspend immediately and the clock is still enabled even if we put
dwc_rockchip sync. So if we reconnect to PC quickly, the transer
will start before dwc3 rockchip receive connect notify and the dwc3
controller will reset during normal transer which result in the gadget
function break.

In order to suspend dwc3 controller and disable clock when transfer
finish immediately, this patch wait for usage_count of dwc3 controller
change to 1 and disconnect interrupt occur then suspend dwc3 controller
and disable clock, make the dwc3 continue transfer after dwc3 rockchip
receive connect notify, otherwise do not reset and get or put dwc3
controller if timeout.

Change-Id: If65344557d77370e9b6cf4bfea84175c37f00057
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
5 years agophy: rockchip-inno-usb2: set floating charger type as DCP
William Wu [Thu, 8 Dec 2016 03:00:45 +0000 (11:00 +0800)]
phy: rockchip-inno-usb2: set floating charger type as DCP

Floating charger is a kind of special USB charger that
dp/dm not shorted, which is incompatible with BC1.2 spec.

However, we need to support this floating charger, and
consider that the max charge current of floating charger
is the same as standard USB charger (dp/dm is shorted),
so we set the charger type as DCP for floating charger.

Change-Id: Ifaca7269a3d4660ac095c59776d7e935fe6126df
Signed-off-by: William Wu <wulf@rock-chips.com>
5 years agodrivers: video: rockchip: hdmi: modify RAYKEN5.46 pixclock
wjh [Thu, 8 Dec 2016 07:57:16 +0000 (15:57 +0800)]
drivers: video: rockchip: hdmi: modify RAYKEN5.46 pixclock

Change-Id: Ic2e003d6da16939a95a1c3e844d72b9566aefa4b
Signed-off-by: wjh <wjh@rock-chips.com>
5 years agoinput: touchscreen: fix tp gslxxxx irq number bug
Bin Yang [Wed, 7 Dec 2016 02:53:08 +0000 (10:53 +0800)]
input: touchscreen: fix tp gslxxxx irq number bug

gslxxxx wrong irq number with the same vopb, may cause vopb abnormal.

ts->irq is gpio number, gslxxxx irq number is ts->client->irq
ts->client->irq = gpio_to_irq(ts->irq)

Change-Id: Ic1f6a46437a2a185f3218d3f0406deeddd9d670a
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
5 years agoarm: configs: enable dsi for rockchip linux
Jacob Chen [Thu, 27 Oct 2016 09:44:54 +0000 (17:44 +0800)]
arm: configs: enable dsi for rockchip linux

Change-Id: I9c8673adbf858b27e0d1bc06c629030a33f6c982
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
5 years agoUPSTREAM: phy: rockchip-inno-usb2: fix uninitialized tmout variable
Arnd Bergmann [Wed, 16 Nov 2016 14:22:38 +0000 (15:22 +0100)]
UPSTREAM: phy: rockchip-inno-usb2: fix uninitialized tmout variable

The newly added OTG support has an obvious uninitialized variable
access that gcc warns about:

drivers/phy/phy-rockchip-inno-usb2.c: In function 'rockchip_chg_detect_work':
drivers/phy/phy-rockchip-inno-usb2.c:717:7: error: 'tmout' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This replaces the use of the uninitialized variable with what
the value was in the previous USB_CHG_STATE_WAIT_FOR_DCD
state.

Change-Id: Ibeed4872e1168e135a332a0978d85a4e48083267
Fixes: 0c42fe48fd23 ("phy: rockchip-inno-usb2: support otg-port for rk3399")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: William Wu <wulf@rock-chips.com>
(cherry picked from git.kernel.org kishon/linux-phy next
 commit dd796e921ea571624fcd8685f214fdfd4406101f)

5 years agousb: rockchip-inno-usb2: pull down dp/dm for rk3399 u2phy otg-port
Meng Dongyang [Tue, 6 Dec 2016 09:06:40 +0000 (17:06 +0800)]
usb: rockchip-inno-usb2: pull down dp/dm for rk3399 u2phy otg-port

The linestate change interrupt may occur during suspend if port is
not connected. This patch pull down dp/dm when suspend.

Change-Id: I31e992727ea63efbda4ecec7ad3af02626eceb44
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
5 years agoARM64: dts: rk3399: adjust idle-cost-data of EAS with idle state
Chen Liang [Thu, 8 Dec 2016 03:40:13 +0000 (11:40 +0800)]
ARM64: dts: rk3399: adjust idle-cost-data of EAS with idle state

Change-Id: I994371c6a3c2aa99ffd666047a1707754ac96290
Signed-off-by: Chen Liang <cl@rock-chips.com>
5 years agoFROMLIST: usb: dwc2: assert phy reset when waking up in rk3288 platform
Jacob Chen [Wed, 7 Dec 2016 09:29:06 +0000 (17:29 +0800)]
FROMLIST: usb: dwc2: assert phy reset when waking up in rk3288 platform

On the rk3288 USB host-only port (the one that's not the OTG-enabled
port) the PHY can get into a bad state when a wakeup is asserted (not
just a wakeup from full system suspend but also a wakeup from
autosuspend).

We can get the PHY out of its bad state by asserting its "port reset",
but unfortunately that seems to assert a reset onto the USB bus so it
could confuse things if we don't actually deenumerate / reenumerate the
device.

We can also get the PHY out of its bad state by fully resetting it using
the reset from the CRU (clock reset unit) in chip, which does a more full
reset.  The CRU-based reset appears to actually cause devices on the bus
to be removed and reinserted, which fixes the problem (albeit in a hacky
way).

It's unfortunate that we need to do a full re-enumeration of devices at
wakeup time, but this is better than alternative of letting the bus get
wedged.

Change-Id: I3120a38a7f646a9d244f04bd2dcfef7474a4a6d1
Signed-off-by: Randy Li <ayaka@soulik.info>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(am from https://mail-archive.com/linux-kernel@vger.kernel.org/msg1254059.html)

5 years agoFROMLIST: phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup
Jacob Chen [Wed, 7 Dec 2016 08:37:42 +0000 (16:37 +0800)]
FROMLIST: phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup

It is a hardware bug in RK3288, the only way to solve it is to
reset the phy.

Change-Id: Iad8f52b623df3c4460dc321bb55e9c3111455590
Signed-off-by: Randy Li <ayaka@soulik.info>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
 (am from https://patchwork.kernel.org/patch/9324163/)

5 years agoFROMLIST: ARM: dts: rockchip: Point rk3288 dwc2 usb at the full PHY reset
Jacob Chen [Wed, 7 Dec 2016 08:34:39 +0000 (16:34 +0800)]
FROMLIST: ARM: dts: rockchip: Point rk3288 dwc2 usb at the full PHY reset

The "host1" port (AKA the dwc2 port that isn't the OTG port) on rk3288
has a hardware errata that causes everything to get confused when we get
a remote wakeup.  We'll use the reset that's in the CRU to reset the
port when it's in a bad state.

Note that we add the reset to both dwc2 controllers even though only one
has the errata in case we find some other use for this reset that's
unrelated to the current hardware errata.  Only the host port gets the
quirk property, though.

Change-Id: I472d33fb1db8b1a6b0c4fcea9ab31fd85b61af40
Signed-off-by: Randy Li <ayaka@soulik.info>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9324169/)

5 years agoarm64: dts: rk3399: add a opp-suspend property for cpu opp table
Finley Xiao [Wed, 30 Nov 2016 03:43:26 +0000 (11:43 +0800)]
arm64: dts: rk3399: add a opp-suspend property for cpu opp table

The opp who contains a opp-suspend property will be configured
during suspend or reboot.

Change-Id: I6b2eede43216435f568db6959127a6e84c8cd4c8
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
5 years agocpufreq: dt: change frequency to a specific value when cpufreq exits
Finley Xiao [Tue, 29 Nov 2016 12:23:13 +0000 (20:23 +0800)]
cpufreq: dt: change frequency to a specific value when cpufreq exits

Sometimes all cpus of big cluster are closed and its frequency
keep a high value, in order to reduce power and reset normally,
set frequency to a specific value after close all the cpus.

Change-Id: I88bce25812d1b0ff3f78a898cb161642a65cc523
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
5 years agoarm64: dts: rockchip: rk3399: add dp default mode for rk3399 box discrete vr
Luo wei [Mon, 5 Dec 2016 07:22:16 +0000 (15:22 +0800)]
arm64: dts: rockchip: rk3399: add dp default mode for rk3399 box discrete vr

Change-Id: If1af58e1654786ece68ed24c115ebca78462f62d
Signed-off-by: Luo wei <lw@rock-chips.com>
5 years agosoc: rockchip: power-domain: export idle request
Caesar Wang [Fri, 18 Nov 2016 08:24:20 +0000 (16:24 +0800)]
soc: rockchip: power-domain: export idle request

We need to put the power status of HEVC IP into IDLE unless
we can't reset that IP or the SoC would crash down.
rockchip_pmu_idle_request(dev, true)---> enter idle
rockchip_pmu_idle_request(dev, false)---> exit idle

Change-Id: I76733efd2de4f7ee183c1b6bd1545d60038ee31b
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoCHROMIUM: drm/rockchip: Respect page offset in IOMMU mmap
Ørjan Eide [Mon, 5 Sep 2016 11:49:12 +0000 (13:49 +0200)]
CHROMIUM: drm/rockchip: Respect page offset in IOMMU mmap

When mapping buffers through the PRIME DMA-buf mmap path we might be
given an offset which has to be respected. The DRM GEM mmap path already
takes care of zeroing out the fake mmap offset, so we can just make the
IOMMU mmap implementation always respect the offset.

BUG=chrome-os-partner:56615
TEST=graphics_GLBench

Change-Id: Iec83e720b24ddd35a92f3df8312015bc5af798f0
Signed-off-by: rjan Eide <orjan.eide@arm.com>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/386477
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoCHROMIUM: drm/rockchip: Respect page offset for PRIME mmap calls
Ørjan Eide [Mon, 5 Sep 2016 11:49:12 +0000 (13:49 +0200)]
CHROMIUM: drm/rockchip: Respect page offset for PRIME mmap calls

When mapping external DMA-bufs through the PRIME mmap call, we might be
given an offset which has to be respected. However for the internal DRM
GEM mmap path, we have to ignore the fake mmap offset used to identify
the buffer only. Currently the code always zeroes out vma->vm_pgoff,
which breaks the former.

This patch fixes the problem by moving the vm_pgoff assignment to a
function that is used only for GEM mmap path, so that the PRIME path
retains the original offset.

BUG=chrome-os-partner:56615
TEST=graphics_GLBench

Change-Id: Iec6e996707b0fe7e95a019423a944d98c80beaab
Signed-off-by: rjan Eide <orjan.eide@arm.com>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/381332
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoCHROMIUM: drm/rockchip: Call drm_gem_object_release() to destroy GEM base
Tomasz Figa [Wed, 14 Sep 2016 11:50:29 +0000 (20:50 +0900)]
CHROMIUM: drm/rockchip: Call drm_gem_object_release() to destroy GEM base

When converting the driver to use shmem-backed GEMs for IOMMU-enabled
systems, we forgot to add calls to drm_gem_object_release(), which gave
us a quite nice memory leak. This patch adds the missing calls.

Fixes: f11d5f0 ("FROMLIST: drm/rockchip: Do not use DMA mapping API if
attached to IOMMU domain")

BUG=chrome-os-partner:57158
TEST=while true; do backlight_dbus_tool --set --percent=0 && sleep 8 &&
 backlight_dbus_tool --set --percent=100 && sleep 3 ; done

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/385456
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Conflicts:
drivers/gpu/drm/rockchip/rockchip_drm_gem.c

Change-Id: I3c7b21ed22cfb38f512150f76fced3b0cc2b296d
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoCHROMIUM: drm/rockchip: Fix the call to drm_gem_put_pages()
Tomasz Figa [Thu, 8 Sep 2016 09:52:00 +0000 (18:52 +0900)]
CHROMIUM: drm/rockchip: Fix the call to drm_gem_put_pages()

When freeing the buffer we don't have any means of determining if the
buffer was read or written, so we must assume both and pass true for
both arguments of drm_gem_put_pages(). Let's fix the code which
currently passes false.

BUG=chrome-os-partner:56378
TEST=while true; do backlight_dbus_tool --set --percent=0 && sleep 8 &&
 backlight_dbus_tool --set --percent=100 && sleep 3 ; done

Change-Id: I7da2fd81e7e728e0ef242837b70819c4a3aee7bf
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/382934
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoFROMLIST: drm/rockchip: Use common IOMMU API to attach devices
Shunqian Zheng [Tue, 21 Jun 2016 04:34:40 +0000 (13:34 +0900)]
FROMLIST: drm/rockchip: Use common IOMMU API to attach devices

Rockchip DRM used the arm special API, arm_iommu_*(), to attach
iommu for ARM32 SoCs. This patch convert to common iommu API
so it would support ARM64 like RK3399.

Since previous patch added support for direct IOMMU address space
management, there is no need to use DMA API anymore and this patch wires
things to use the new method.

Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
(am from https://patchwork.kernel.org/patch/9196389/)

BUG=chrome-os-partner:53565
TEST=boot to ui on Gru

Reviewed-on: https://chromium-review.googlesource.com/349521
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Conflicts:
drivers/gpu/drm/rockchip/rockchip_drm_drv.c

Change-Id: Ide4ce9f74fd431f0b7cd480e38b683f833733b40
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoUPSTREAM: drm/rockchip: support non-iommu buffer path
Mark Yao [Tue, 19 Apr 2016 02:13:27 +0000 (10:13 +0800)]
UPSTREAM: drm/rockchip: support non-iommu buffer path

Some rockchip vop not support iommu, need use non-iommu
buffer for it. And if we get iommu issues, we can compare
the issues with non-iommu path, that would help the debug.

Conflicts:
drivers/gpu/drm/rockchip/rockchip_drm_drv.c

Change-Id: I843f087281300359b07faac1de156cd648325b45
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
(cherry picked from commit 2d90d477430d3a20df74f2d11c21378e64e1d508)

5 years agoUPSTREAM: drm/rockchip: don't leak iommu mapping
John Keeping [Tue, 5 Apr 2016 13:50:32 +0000 (14:50 +0100)]
UPSTREAM: drm/rockchip: don't leak iommu mapping

arm_iommu_attach_device() takes its own reference to the mapping we give
it.  Since we do not keep a reference to the mapping ourselves, we must
release it before returning.

Also fix the error path, which fails to release the mapping if it has
called arm_iommu_detach_device() since that clears archdata.mapping.

Conflicts:
drivers/gpu/drm/rockchip/rockchip_drm_drv.c

Change-Id: Ia20334afbce08ece5a3238a7b0786547ec0cafb2
Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
(cherry picked from commit 69b007968e7519cf1e44920f4578054c9e0fbdc3)

5 years agoUPSTREAM: drm/rockchip: remove redundant statement
John Keeping [Tue, 5 Apr 2016 13:50:31 +0000 (14:50 +0100)]
UPSTREAM: drm/rockchip: remove redundant statement

The call to arm_iommu_detach_device() on the previous line sets
dev->archdata.mapping to NULL so this call is always a no-op.

Change-Id: I09b41c284c61885fb4b989a64839e96bcc316aa6
Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
(cherry picked from commit aa1ac27f48de0ed94d5a104e15b5ab62b5deb236)

5 years agoCHROMIUM: rockchip: support prime import sg table
Haixia Shi [Fri, 29 Jan 2016 00:23:04 +0000 (16:23 -0800)]
CHROMIUM: rockchip: support prime import sg table

The prime fd to handle ioctl was not used with rockchip before. Support
was added in order to pass graphics_Gbm and to support potential uses
within Chrome OS (e.g. zero-copy video decode, camera).

Difference from kernel 3.14 implementation:
- prime_import_sg_table passes dma-buf as argument instead of size
- need to handle import sg_table for both DMA and IOMMU paths

TEST=test_that graphics_Gbm on kevin
BUG=chrome-os-partner:56526

Reviewed-on: https://chromium-review.googlesource.com/381991
Tested-by: Haixia Shi <hshi@chromium.org>
Commit-Queue: Haixia Shi <hshi@chromium.org>
Trybot-Ready: Haixia Shi <hshi@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Conflicts:
drivers/gpu/drm/rockchip/rockchip_drm_gem.c

Change-Id: I7aae5b0e227de61ac17adf98996152da8db097d2
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoFROMLIST: drm/rockchip: Do not use DMA mapping API if attached to IOMMU domain
Tomasz Figa [Tue, 21 Jun 2016 04:34:39 +0000 (13:34 +0900)]
FROMLIST: drm/rockchip: Do not use DMA mapping API if attached to IOMMU domain

The API is not suitable for subsystems consisting of multiple devices
and requires severe hacks to use it. To mitigate this, this patch
implements allocation and address space management locally by using
helpers provided by DRM framework, like other DRM drivers do, e.g.
Tegra.

This patch should not introduce any functional changes until the driver
is made to attach subdevices into an IOMMU domain with the generic IOMMU
API, which will happen in following patch. Based heavily on GEM
implementation of Tegra DRM driver.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9196387/)

BUG=chrome-os-partner:53565
TEST=boot to ui on Gru

Reviewed-on: https://chromium-review.googlesource.com/353591
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Conflicts:
drivers/gpu/drm/rockchip/rockchip_drm_drv.h
drivers/gpu/drm/rockchip/rockchip_drm_gem.c
drivers/gpu/drm/rockchip/rockchip_drm_gem.h

Change-Id: I599b2551e8e8000024894426e4e19d7543af3b0a
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoRevert "drm/rockchip: rewrite IOMMU support code"
Jeffy Chen [Fri, 18 Nov 2016 13:04:59 +0000 (21:04 +0800)]
Revert "drm/rockchip: rewrite IOMMU support code"

This reverts commit b435f1a281e8a9ff1f1013318a1147949e55130a.

Conflicts:
drivers/gpu/drm/rockchip/Kconfig
drivers/gpu/drm/rockchip/rockchip_drm_drv.h

Change-Id: I15d2d598514c2878a574219fe2268ee8d530d6e2
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoRevert "drm/rockchip: gem: import dma_buf to gem"
Jeffy Chen [Fri, 18 Nov 2016 13:17:31 +0000 (21:17 +0800)]
Revert "drm/rockchip: gem: import dma_buf to gem"

This reverts commit a05932da07ecc0a214bd24322ffbcec79be5d5e0.

Change-Id: I91f9efb690fe4f82b5bf34debca6f7612bbd9e4e
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agovideo: build rockchip video driver modules independently
Randy Li [Mon, 31 Oct 2016 08:28:42 +0000 (16:28 +0800)]
video: build rockchip video driver modules independently

There is not need to force the video driver dependency in parent
tree.

Also there would be too many entries in a menu, I create a submenu
for them.

Change-Id: Id3bd54fa6274b1311ff6b20f95ffeb0d1851d9f9
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoARM: dts: rockchip: switch to vpu-service in asus miniarm
Randy Li [Thu, 24 Nov 2016 02:23:17 +0000 (10:23 +0800)]
ARM: dts: rockchip: switch to vpu-service in asus miniarm

We decide to offer the video support in old way.

Change-Id: I0b30f7b2b559596ee124b8558cd54e0ff090ab79
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoARM: dts: rockchip: rk3288 hevc using same clk freqs as android
Randy Li [Wed, 30 Nov 2016 03:21:51 +0000 (11:21 +0800)]
ARM: dts: rockchip: rk3288 hevc using same clk freqs as android

If you meet a performance issue, I would suggest you to set
500MHZ for ACLK_HEVC at rk3288. It could solve the decoding quite
slow for some video resources.

Change-Id: Iedc2bc90fb13ae89d204dc6b5f5d897acae6812d
Signed-off-by: Randy Li <randy.li@rock-chips.com>
5 years agoMerge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
Huang, Tao [Tue, 6 Dec 2016 12:58:56 +0000 (20:58 +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: (61 commits)
  Linux 4.4.36
  scsi: mpt3sas: Unblock device after controller reset
  flow_dissect: call init_default_flow_dissectors() earlier
  mei: fix return value on disconnection
  mei: me: fix place for kaby point device ids.
  mei: me: disable driver on SPT SPS firmware
  drm/radeon: Ensure vblank interrupt is enabled on DPMS transition to on
  mpi: Fix NULL ptr dereference in mpi_powm() [ver #3]
  parisc: Also flush data TLB in flush_icache_page_asm
  parisc: Fix race in pci-dma.c
  parisc: Fix races in parisc_setup_cache_timing()
  NFSv4.x: hide array-bounds warning
  apparmor: fix change_hat not finding hat after policy replacement
  cfg80211: limit scan results cache size
  tile: avoid using clocksource_cyc2ns with absolute cycle count
  scsi: mpt3sas: Fix secure erase premature termination
  Fix USB CB/CBI storage devices with CONFIG_VMAP_STACK=y
  USB: serial: ftdi_sio: add support for TI CC3200 LaunchPad
  USB: serial: cp210x: add ID for the Zone DPMX
  usb: chipidea: move the lock initialization to core file
  ...

5 years agoUPSTREAM: iommu/dma: Implement scatterlist segment merging
Robin Murphy [Mon, 11 Apr 2016 11:32:31 +0000 (12:32 +0100)]
UPSTREAM: iommu/dma: Implement scatterlist segment merging

Stop wasting IOVA space by over-aligning scatterlist segments for a
theoretical worst-case segment boundary mask, and instead take the real
limits into account to merge consecutive segments wherever appropriate,
so our callers can benefit from getting back nicely simplified lists.

This also represents the last piece of functionality wanted by users of
the current arch/arm implementation, thus brings us a small step closer
to converting that over to the common code.

Change-Id: Ie583142efece02dfa6678d5e8607b5bc7266f50c
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
(cherry picked from commit 809eac54cdd62c67afea1e17080e681dfa33dc09)

5 years agocamera: rockchip: camsys driver v0.0x21.8
dalong.zhang [Mon, 5 Dec 2016 10:10:09 +0000 (18:10 +0800)]
camera: rockchip: camsys driver v0.0x21.8

Change-Id: Ib0fed5df3edfe4dae042999e71c50d67a490f88e
Signed-off-by: dalong.zhang <dalon.zhang@rock-chips.com>
5 years agoARM64: dts: rk3399: sapphire: add uboot logo support for android next
Mark Yao [Tue, 6 Dec 2016 10:18:08 +0000 (18:18 +0800)]
ARM64: dts: rk3399: sapphire: add uboot logo support for android next

Change-Id: If206ba4d67f3609e56fe0bfe1f4063e0616ba50a
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoARM: dts: rockchip: rk3288: add qos node
Elaine Zhang [Mon, 5 Dec 2016 07:27:59 +0000 (15:27 +0800)]
ARM: dts: rockchip: rk3288: add qos node

when pd power on/off, the qos regs need to save and restore.

Change-Id: Idd6854022fb25538e82238f25a650a687e918a56
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
5 years agoMerge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Alex Shi [Tue, 6 Dec 2016 05:01:29 +0000 (13:01 +0800)]
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android

Conflicts:
keep low scan freq in android in net/wireless/scan.c

5 years agoarm64: dts: rk3399-sapphire-excavator-linux: add fiq_debugger node
Zorro Liu [Mon, 5 Dec 2016 01:55:29 +0000 (09:55 +0800)]
arm64: dts: rk3399-sapphire-excavator-linux: add fiq_debugger node

Change-Id: I6d2c97a06a7c252eec47ab3b1e686b1799780171
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
5 years agohid: rkvr: add 0x110 key event used for touchpad
Luo wei [Mon, 5 Dec 2016 06:25:54 +0000 (14:25 +0800)]
hid: rkvr: add 0x110 key event used for touchpad

Change-Id: I8a57bbddcf1115414c1567aa05c4c19ecb1ce02c
Signed-off-by: Luo wei <lw@rock-chips.com>
5 years agoarm64: dts: rockchip: enable isp node for rk3399-mid-818-android-next
Bin Yang [Mon, 5 Dec 2016 02:21:56 +0000 (10:21 +0800)]
arm64: dts: rockchip: enable isp node for rk3399-mid-818-android-next

Change-Id: Ic6d489ab7a65cf9ec3c7d03b00541f946cb57b84
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
5 years agoarm64: dts: rockchip: Add RK3399 Excavator dts for drm
Bin Yang [Thu, 1 Dec 2016 01:25:19 +0000 (09:25 +0800)]
arm64: dts: rockchip: Add RK3399 Excavator dts for drm

Change-Id: I8da4f4bc4a903e4e3702f6e5dbedb72cd5ee627f
Signed-off-by: Cody Xie <xkd@rock-chips.com>
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
5 years agoUPSTREAM: PCI: rockchip: Indent an if statement
Dan Carpenter [Wed, 12 Oct 2016 10:54:09 +0000 (13:54 +0300)]
UPSTREAM: PCI: rockchip: Indent an if statement

The if statement wasn't intended.  Add a tab.

Change-Id: I33e4fce2cc2052dc45c3c7a2617586cdd6a6b664
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
(cherry picked from commit 08015ee0ff8a221bdc9ee66cfcc7e3379e9bcd28)

5 years ago Merge tag 'v4.4.36' into linux-linaro-lsk-v4.4
Alex Shi [Mon, 5 Dec 2016 04:01:22 +0000 (12:01 +0800)]
 Merge tag 'v4.4.36' into linux-linaro-lsk-v4.4

 This is the 4.4.36 stable release

5 years agoMerge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
Huang, Tao [Fri, 2 Dec 2016 12:27:31 +0000 (20:27 +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: (315 commits)
  Linux 4.4.35
  netfilter: nft_dynset: fix element timeout for HZ != 1000
  IB/cm: Mark stale CM id's whenever the mad agent was unregistered
  IB/uverbs: Fix leak of XRC target QPs
  IB/core: Avoid unsigned int overflow in sg_alloc_table
  IB/mlx5: Fix fatal error dispatching
  IB/mlx5: Use cache line size to select CQE stride
  IB/mlx4: Fix create CQ error flow
  IB/mlx4: Check gid_index return value
  PM / sleep: don't suspend parent when async child suspend_{noirq, late} fails
  PM / sleep: fix device reference leak in test_suspend
  uwb: fix device reference leaks
  mfd: core: Fix device reference leak in mfd_clone_cell
  iwlwifi: pcie: fix SPLC structure parsing
  rtc: omap: Fix selecting external osc
  clk: mmp: mmp2: fix return value check in mmp2_clk_init()
  clk: mmp: pxa168: fix return value check in pxa168_clk_init()
  clk: mmp: pxa910: fix return value check in pxa910_clk_init()
  drm/amdgpu: Attach exclusive fence to prime exported bo's. (v5)
  crypto: caam - do not register AES-XTS mode on LP units
  ...

Change-Id: Ic14c01a22a5e8a0356d6c0ef6bcca7bc6cad6b4b

5 years agoRevert "FROMLIST: PM / sleep: don't suspend parent when async child suspend_{noirq...
Huang, Tao [Fri, 2 Dec 2016 11:53:55 +0000 (19:53 +0800)]
Revert "FROMLIST: PM / sleep: don't suspend parent when async child suspend_{noirq,late} fails"

This reverts commit 11b2dcefd88e8ae01a11c6df55d91206ac226c52.
Fixed by 04c0800c73b2 ("PM / sleep: don't suspend parent when
async child suspend_{noirq, late} fails").

5 years agorockchip/vcodec: drop needless devm_clk_put
Huang, Tao [Fri, 2 Dec 2016 08:18:33 +0000 (16:18 +0800)]
rockchip/vcodec: drop needless devm_clk_put

Also make sure clk is NULL if get failed.

Change-Id: I102175a108c6e7a91948d82cce97c1a1d88a071e
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
5 years agoARM64: dts: rk3399-android-next: default use vopb for primary display
Mark Yao [Fri, 2 Dec 2016 11:09:58 +0000 (19:09 +0800)]
ARM64: dts: rk3399-android-next: default use vopb for primary display

Change-Id: I2655905aa3f63e19c8367701af36f462d399d2f3
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agodrm/rockchip: vop: skip config timing on vblank
Mark Yao [Fri, 2 Dec 2016 09:34:53 +0000 (17:34 +0800)]
drm/rockchip: vop: skip config timing on vblank

Change-Id: I7aace5e26f6c9889c9e216f7b7233ec7e5530776
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agodrm/rockchip: vop: fix display logo flash with line flag
Mark Yao [Fri, 2 Dec 2016 03:27:13 +0000 (11:27 +0800)]
drm/rockchip: vop: fix display logo flash with line flag

Use standy with dsp_hold intr would effect display timing,
Some display controller can't not allow this, such as edp,
edp panel would flash with it.

Use line flag instead it seems good.

Change-Id: Iecf818c0dbd5a7833e6cec0da60fe3e693b3dc9d
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoCHROMIUM: drm/rockchip: Clear interrupt status bits before enabling
Tomasz Figa [Thu, 8 Sep 2016 06:32:54 +0000 (15:32 +0900)]
CHROMIUM: drm/rockchip: Clear interrupt status bits before enabling

The enable register only masks the raw status bits to signal CPU
interrupt only for enabled interrupts. The status bits are activated
regardless of the enable register. This means that we might have an old
interrupt event queued, which we are not interested in. To avoid getting
a spurious interrupt signalled, we have to clear the old bit before we
update the enable register.

BUG=chrome-os-partner:56378
BUG=chrome-os-partner:56580
TEST=while true; do backlight_dbus_tool --set --percent=0 && sleep 8 && backlight_dbus_tool --set --percent=100 && sleep 3 ; done

Change-Id: I1b8286097f3ba102663ee3a7566fd96492e12d26
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/382973
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoFROMLIST: drm/rockchip: vop: export line flag function
Yakir Yang [Thu, 2 Jun 2016 12:16:22 +0000 (20:16 +0800)]
FROMLIST: drm/rockchip: vop: export line flag function

VOP have integrated a hardware counter which indicate the exact display
line that vop is scanning. And if we're interested in a specific line,
we can set the line number to vop line_flag register, and then vop would
generate a line_flag interrupt for it.

For example eDP PSR function is interested in the vertical blanking
period, then driver could set the line number to zero.

This patch have exported a symbol that allow other driver to listen the
line flag event with given timeout limit:
- rockchip_drm_wait_line_flag()

BUG=chrome-os-partner:54785
TEST=Success to call rockchip_drm_wait_line_flag()

Change-Id: Id7605bada87c8ead0e549d4ff113ee49d29ad126
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9231675/)
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/349084
Commit-Ready: Sean Paul <seanpaul@google.com>
Tested-by: Sean Paul <seanpaul@google.com>
Reviewed-by: Sean Paul <seanpaul@google.com>
5 years agodrm/rockchip: add loader protect ops to drm connector
Mark Yao [Thu, 1 Dec 2016 02:25:49 +0000 (10:25 +0800)]
drm/rockchip: add loader protect ops to drm connector

Change-Id: Iae26ac5c994727b98db045ae00c62d641f31c4b1
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoLinux 4.4.36
Greg Kroah-Hartman [Fri, 2 Dec 2016 08:09:18 +0000 (09:09 +0100)]
Linux 4.4.36

5 years agoscsi: mpt3sas: Unblock device after controller reset
Suganath Prabu S [Thu, 17 Nov 2016 10:45:58 +0000 (16:15 +0530)]
scsi: mpt3sas: Unblock device after controller reset

commit 7ff723ad0f87feba43dda45fdae71206063dd7d4 upstream.

While issuing any ATA passthrough command to firmware the driver will
block the device. But it will unblock the device only if the I/O
completes through the ISR path. If a controller reset occurs before
command completion the device will remain in blocked state.

Make sure we unblock the device following a controller reset if an ATA
passthrough command was queued.

[mkp: clarified patch description]

Fixes: ac6c2a93bd07 ("mpt3sas: Fix for SATA drive in blocked state, after diag reset")
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoflow_dissect: call init_default_flow_dissectors() earlier
Eric Dumazet [Tue, 22 Nov 2016 19:17:30 +0000 (11:17 -0800)]
flow_dissect: call init_default_flow_dissectors() earlier

commit c9b8af1330198ae241cd545e1f040019010d44d9 upstream.

Andre Noll reported panics after my recent fix (commit 34fad54c2537
"net: __skb_flow_dissect() must cap its return value")

After some more headaches, Alexander root caused the problem to
init_default_flow_dissectors() being called too late, in case
a network driver like IGB is not a module and receives DHCP message
very early.

Fix is to call init_default_flow_dissectors() much earlier,
as it is a core infrastructure and does not depend on another
kernel service.

Fixes: 06635a35d13d4 ("flow_dissect: use programable dissector in skb_flow_dissect and friends")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andre Noll <maan@tuebingen.mpg.de>
Diagnosed-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agomei: fix return value on disconnection
Tomas Winkler [Wed, 22 Jun 2016 21:25:31 +0000 (00:25 +0300)]
mei: fix return value on disconnection

commit 2d4d5481e2d6f93b25fcfb13a9f20bbfbf54266a upstream.

Correct errno on client disconnection is -ENODEV not -EBUSY

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agomei: me: fix place for kaby point device ids.
Tomas Winkler [Tue, 29 Nov 2016 12:44:45 +0000 (14:44 +0200)]
mei: me: fix place for kaby point device ids.

This is fix of the backported patch only, it places
KBL DIDs on correct place to easy on backporting of
further DIDs.

Fixes: 5c99f32c461c ('mei: me: add kaby point device ids')
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agomei: me: disable driver on SPT SPS firmware
Tomas Winkler [Wed, 20 Jul 2016 07:24:02 +0000 (10:24 +0300)]
mei: me: disable driver on SPT SPS firmware

commit 8c57cac1457f3125a5d13dc03635c0708c61bff0 upstream.

Sunrise Point PCH with SPS Firmware doesn't expose working
MEI interface, we need to quirk it out.
The SPS Firmware is identifiable only on the first PCI function
of the device.

Tested-by: Sujith Pandel <sujith_pandel@dell.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodrm/radeon: Ensure vblank interrupt is enabled on DPMS transition to on
Michel Dänzer [Tue, 29 Nov 2016 09:40:20 +0000 (18:40 +0900)]
drm/radeon: Ensure vblank interrupt is enabled on DPMS transition to on

NOTE: This patch only applies to 4.5.y or older kernels. With newer
kernels, this problem cannot happen because the driver now uses
drm_crtc_vblank_on/off instead of drm_vblank_pre/post_modeset[0]. I
consider this patch safer for older kernels than backporting the API
change, because drm_crtc_vblank_on/off had various issues in older
kernels, and I'm not sure all fixes for those have been backported to
all stable branches where this patch could be applied.

    ---------------------

Fixes the vblank interrupt being disabled when it should be on, which
can cause at least the following symptoms:

* Hangs when running 'xset dpms force off' in a GNOME session with
  gnome-shell using DRI2.
* RandR 1.4 slave outputs freezing with garbage displayed using
  xf86-video-ati 7.8.0 or newer.

[0] See upstream commit:

commit 777e3cbc791f131806d9bf24b3325637c7fc228d
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Jan 21 11:08:57 2016 +0100

    drm/radeon: Switch to drm_vblank_on/off

Reported-and-Tested-by: Max Staudt <mstaudt@suse.de>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
5 years agompi: Fix NULL ptr dereference in mpi_powm() [ver #3]
Andrey Ryabinin [Thu, 24 Nov 2016 13:23:10 +0000 (13:23 +0000)]
mpi: Fix NULL ptr dereference in mpi_powm() [ver #3]

commit f5527fffff3f002b0a6b376163613b82f69de073 upstream.

This fixes CVE-2016-8650.

If mpi_powm() is given a zero exponent, it wants to immediately return
either 1 or 0, depending on the modulus.  However, if the result was
initalised with zero limb space, no limbs space is allocated and a
NULL-pointer exception ensues.

Fix this by allocating a minimal amount of limb space for the result when
the 0-exponent case when the result is 1 and not touching the limb space
when the result is 0.

This affects the use of RSA keys and X.509 certificates that carry them.

BUG: unable to handle kernel NULL pointer dereference at           (null)
IP: [<ffffffff8138ce5d>] mpi_powm+0x32/0x7e6
PGD 0
Oops: 0002 [#1] SMP
Modules linked in:
CPU: 3 PID: 3014 Comm: keyctl Not tainted 4.9.0-rc6-fscache+ #278
Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
task: ffff8804011944c0 task.stack: ffff880401294000
RIP: 0010:[<ffffffff8138ce5d>]  [<ffffffff8138ce5d>] mpi_powm+0x32/0x7e6
RSP: 0018:ffff880401297ad8  EFLAGS: 00010212
RAX: 0000000000000000 RBX: ffff88040868bec0 RCX: ffff88040868bba0
RDX: ffff88040868b260 RSI: ffff88040868bec0 RDI: ffff88040868bee0
RBP: ffff880401297ba8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000047 R11: ffffffff8183b210 R12: 0000000000000000
R13: ffff8804087c7600 R14: 000000000000001f R15: ffff880401297c50
FS:  00007f7a7918c700(0000) GS:ffff88041fb80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000401250000 CR4: 00000000001406e0
Stack:
 ffff88040868bec0 0000000000000020 ffff880401297b00 ffffffff81376cd4
 0000000000000100 ffff880401297b10 ffffffff81376d12 ffff880401297b30
 ffffffff81376f37 0000000000000100 0000000000000000 ffff880401297ba8
Call Trace:
 [<ffffffff81376cd4>] ? __sg_page_iter_next+0x43/0x66
 [<ffffffff81376d12>] ? sg_miter_get_next_page+0x1b/0x5d
 [<ffffffff81376f37>] ? sg_miter_next+0x17/0xbd
 [<ffffffff8138ba3a>] ? mpi_read_raw_from_sgl+0xf2/0x146
 [<ffffffff8132a95c>] rsa_verify+0x9d/0xee
 [<ffffffff8132acca>] ? pkcs1pad_sg_set_buf+0x2e/0xbb
 [<ffffffff8132af40>] pkcs1pad_verify+0xc0/0xe1
 [<ffffffff8133cb5e>] public_key_verify_signature+0x1b0/0x228
 [<ffffffff8133d974>] x509_check_for_self_signed+0xa1/0xc4
 [<ffffffff8133cdde>] x509_cert_parse+0x167/0x1a1
 [<ffffffff8133d609>] x509_key_preparse+0x21/0x1a1
 [<ffffffff8133c3d7>] asymmetric_key_preparse+0x34/0x61
 [<ffffffff812fc9f3>] key_create_or_update+0x145/0x399
 [<ffffffff812fe227>] SyS_add_key+0x154/0x19e
 [<ffffffff81001c2b>] do_syscall_64+0x80/0x191
 [<ffffffff816825e4>] entry_SYSCALL64_slow_path+0x25/0x25
Code: 56 41 55 41 54 53 48 81 ec a8 00 00 00 44 8b 71 04 8b 42 04 4c 8b 67 18 45 85 f6 89 45 80 0f 84 b4 06 00 00 85 c0 75 2f 41 ff ce <49> c7 04 24 01 00 00 00 b0 01 75 0b 48 8b 41 18 48 83 38 01 0f
RIP  [<ffffffff8138ce5d>] mpi_powm+0x32/0x7e6
 RSP <ffff880401297ad8>
CR2: 0000000000000000
---[ end trace d82015255d4a5d8d ]---

Basically, this is a backport of a libgcrypt patch:

http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=patch;h=6e1adb05d290aeeb1c230c763970695f4a538526

Fixes: cdec9cb5167a ("crypto: GnuPG based MPI lib - source files (part 1)")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
cc: linux-ima-devel@lists.sourceforge.net
Signed-off-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoparisc: Also flush data TLB in flush_icache_page_asm
John David Anglin [Fri, 25 Nov 2016 01:18:14 +0000 (20:18 -0500)]
parisc: Also flush data TLB in flush_icache_page_asm

commit 5035b230e7b67ac12691ed3b5495bbb617027b68 upstream.

This is the second issue I noticed in reviewing the parisc TLB code.

The fic instruction may use either the instruction or data TLB in
flushing the instruction cache.  Thus, on machines with a split TLB, we
should also flush the data TLB after setting up the temporary alias
registers.

Although this has no functional impact, I changed the pdtlb and pitlb
instructions to consistently use the index register %r0.  These
instructions do not support integer displacements.

Tested on rp3440 and c8000.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoparisc: Fix race in pci-dma.c
John David Anglin [Fri, 25 Nov 2016 01:06:32 +0000 (20:06 -0500)]
parisc: Fix race in pci-dma.c

commit c0452fb9fb8f49c7d68ab9fa0ad092016be7b45f upstream.

We are still troubled by occasional random segmentation faults and
memory memory corruption on SMP machines.  The causes quite a few
package builds to fail on the Debian buildd machines for parisc.  When
gcc-6 failed to build three times in a row, I looked again at the TLB
related code.  I found a couple of issues.  This is the first.

In general, we need to ensure page table updates and corresponding TLB
purges are atomic.  The attached patch fixes an instance in pci-dma.c
where the page table update was not guarded by the TLB lock.

Tested on rp3440 and c8000.  So far, no further random segmentation
faults have been observed.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoparisc: Fix races in parisc_setup_cache_timing()
John David Anglin [Mon, 21 Nov 2016 02:12:36 +0000 (21:12 -0500)]
parisc: Fix races in parisc_setup_cache_timing()

commit 741dc7bf1c7c7d93b853bb55efe77baa27e1b0a9 upstream.

Helge reported to me the following startup crash:

[    0.000000] Linux version 4.8.0-1-parisc64-smp (debian-kernel@lists.debian.org) (gcc version 5.4.1 20161019 (GCC) ) #1 SMP Debian 4.8.7-1 (2016-11-13)
[    0.000000] The 64-bit Kernel has started...
[    0.000000] Kernel default page size is 4 KB. Huge pages enabled with 1 MB physical and 2 MB virtual size.
[    0.000000] Determining PDC firmware type: System Map.
[    0.000000] model 9000/785/J5000
[    0.000000] Total Memory: 2048 MB
[    0.000000] Memory: 2018528K/2097152K available (9272K kernel code, 3053K rwdata, 1319K rodata, 1024K init, 840K bss, 78624K reserved, 0K cma-reserved)
[    0.000000] virtual kernel memory layout:
[    0.000000]     vmalloc : 0x0000000000008000 - 0x000000003f000000   (1007 MB)
[    0.000000]     memory  : 0x0000000040000000 - 0x00000000c0000000   (2048 MB)
[    0.000000]       .init : 0x0000000040100000 - 0x0000000040200000   (1024 kB)
[    0.000000]       .data : 0x0000000040b0e000 - 0x0000000040f533e0   (4372 kB)
[    0.000000]       .text : 0x0000000040200000 - 0x0000000040b0e000   (9272 kB)
[    0.768910] Brought up 1 CPUs
[    0.992465] NET: Registered protocol family 16
[    2.429981] Releasing cpu 1 now, hpa=fffffffffffa2000
[    2.635751] CPU(s): 2 out of 2 PA8500 (PCX-W) at 440.000000 MHz online
[    2.726692] Setting cache flush threshold to 1024 kB
[    2.729932] Not-handled unaligned insn 0x43ffff80
[    2.798114] Setting TLB flush threshold to 140 kB
[    2.928039] Unaligned handler failed, ret = -1
[    3.000419]       _______________________________
[    3.000419]      < Your System ate a SPARC! Gah! >
[    3.000419]       -------------------------------
[    3.000419]              \   ^__^
[    3.000419]                  (__)\       )\/\
[    3.000419]                   U  ||----w |
[    3.000419]                      ||     ||
[    9.340055] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.8.0-1-parisc64-smp #1 Debian 4.8.7-1
[    9.448082] task: 00000000bfd48060 task.stack: 00000000bfd50000
[    9.528040]
[   10.760029] IASQ: 0000000000000000 0000000000000000 IAOQ: 000000004025d154 000000004025d158
[   10.868052]  IIR: 43ffff80    ISR: 0000000000340000  IOR: 000001ff54150960
[   10.960029]  CPU:        1   CR30: 00000000bfd50000 CR31: 0000000011111111
[   11.052057]  ORIG_R28: 000000004021e3b4
[   11.100045]  IAOQ[0]: irq_exit+0x94/0x120
[   11.152062]  IAOQ[1]: irq_exit+0x98/0x120
[   11.208031]  RP(r2): irq_exit+0xb8/0x120
[   11.256074] Backtrace:
[   11.288067]  [<00000000402cd944>] cpu_startup_entry+0x1e4/0x598
[   11.368058]  [<0000000040109528>] smp_callin+0x2c0/0x2f0
[   11.436308]  [<00000000402b53fc>] update_curr+0x18c/0x2d0
[   11.508055]  [<00000000402b73b8>] dequeue_entity+0x2c0/0x1030
[   11.584040]  [<00000000402b3cc0>] set_next_entity+0x80/0xd30
[   11.660069]  [<00000000402c1594>] pick_next_task_fair+0x614/0x720
[   11.740085]  [<000000004020dd34>] __schedule+0x394/0xa60
[   11.808054]  [<000000004020e488>] schedule+0x88/0x118
[   11.876039]  [<0000000040283d3c>] rescuer_thread+0x4d4/0x5b0
[   11.948090]  [<000000004028fc4c>] kthread+0x1ec/0x248
[   12.016053]  [<0000000040205020>] end_fault_vector+0x20/0xc0
[   12.092239]  [<00000000402050c0>] _switch_to_ret+0x0/0xf40
[   12.164044]
[   12.184036] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.8.0-1-parisc64-smp #1 Debian 4.8.7-1
[   12.244040] Backtrace:
[   12.244040]  [<000000004021c480>] show_stack+0x68/0x80
[   12.244040]  [<00000000406f332c>] dump_stack+0xec/0x168
[   12.244040]  [<000000004021c74c>] die_if_kernel+0x25c/0x430
[   12.244040]  [<000000004022d320>] handle_unaligned+0xb48/0xb50
[   12.244040]
[   12.632066] ---[ end trace 9ca05a7215c7bbb2 ]---
[   12.692036] Kernel panic - not syncing: Attempted to kill the idle task!

We have the insn 0x43ffff80 in IIR but from IAOQ we should have:
   4025d150:   0f f3 20 df     ldd,s r19(r31),r31
   4025d154:   0f 9f 00 9c     ldw r31(ret0),ret0
   4025d158:   bf 80 20 58     cmpb,*<> r0,ret0,4025d18c <irq_exit+0xcc>

Cpu0 has just completed running parisc_setup_cache_timing:

[    2.429981] Releasing cpu 1 now, hpa=fffffffffffa2000
[    2.635751] CPU(s): 2 out of 2 PA8500 (PCX-W) at 440.000000 MHz online
[    2.726692] Setting cache flush threshold to 1024 kB
[    2.729932] Not-handled unaligned insn 0x43ffff80
[    2.798114] Setting TLB flush threshold to 140 kB
[    2.928039] Unaligned handler failed, ret = -1

From the backtrace, cpu1 is in smp_callin:

void __init smp_callin(void)
{
       int slave_id = cpu_now_booting;

       smp_cpu_init(slave_id);
       preempt_disable();

       flush_cache_all_local(); /* start with known state */
       flush_tlb_all_local(NULL);

       local_irq_enable();  /* Interrupts have been off until now */

       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);

So, it has just flushed its caches and the TLB. It would seem either the
flushes in parisc_setup_cache_timing or smp_callin have corrupted kernel
memory.

The attached patch reworks parisc_setup_cache_timing to remove the races
in setting the cache and TLB flush thresholds. It also corrects the
number of bytes flushed in the TLB calculation.

The patch flushes the cache and TLB on cpu0 before starting the
secondary processors so that they are started from a known state.

Tested with a few reboots on c8000.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoNFSv4.x: hide array-bounds warning
Arnd Bergmann [Tue, 22 Nov 2016 20:50:52 +0000 (21:50 +0100)]
NFSv4.x: hide array-bounds warning

commit d55b352b01bc78fbc3d1bb650140668b87e58bf9 upstream.

A correct bugfix introduced a harmless warning that shows up with gcc-7:

fs/nfs/callback.c: In function 'nfs_callback_up':
fs/nfs/callback.c:214:14: error: array subscript is outside array bounds [-Werror=array-bounds]

What happens here is that the 'minorversion == 0' check tells the
compiler that we assume minorversion can be something other than 0,
but when CONFIG_NFS_V4_1 is disabled that would be invalid and
result in an out-of-bounds access.

The added check for IS_ENABLED(CONFIG_NFS_V4_1) tells gcc that this
really can't happen, which makes the code slightly smaller and also
avoids the warning.

The bugfix that introduced the warning is marked for stable backports,
we want this one backported to the same releases.

Fixes: 98b0f80c2396 ("NFSv4.x: Fix a refcount leak in nfs_callback_up_net")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoapparmor: fix change_hat not finding hat after policy replacement
John Johansen [Thu, 1 Sep 2016 04:10:06 +0000 (21:10 -0700)]
apparmor: fix change_hat not finding hat after policy replacement

commit 3d40658c977769ce2138f286cf131537bf68bdfe upstream.

After a policy replacement, the task cred may be out of date and need
to be updated. However change_hat is using the stale profiles from
the out of date cred resulting in either: a stale profile being applied
or, incorrect failure when searching for a hat profile as it has been
migrated to the new parent profile.

Fixes: 01e2b670aa898a39259bc85c78e3d74820f4d3b6 (failure to find hat)
Fixes: 898127c34ec03291c86f4ff3856d79e9e18952bc (stale policy being applied)
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1000287
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocfg80211: limit scan results cache size
Johannes Berg [Tue, 15 Nov 2016 11:05:11 +0000 (12:05 +0100)]
cfg80211: limit scan results cache size

commit 9853a55ef1bb66d7411136046060bbfb69c714fa upstream.

It's possible to make scanning consume almost arbitrary amounts
of memory, e.g. by sending beacon frames with random BSSIDs at
high rates while somebody is scanning.

Limit the number of BSS table entries we're willing to cache to
1000, limiting maximum memory usage to maybe 4-5MB, but lower
in practice - that would be the case for having both full-sized
beacon and probe response frames for each entry; this seems not
possible in practice, so a limit of 1000 entries will likely be
closer to 0.5 MB.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agotile: avoid using clocksource_cyc2ns with absolute cycle count
Chris Metcalf [Wed, 16 Nov 2016 16:18:05 +0000 (11:18 -0500)]
tile: avoid using clocksource_cyc2ns with absolute cycle count

commit e658a6f14d7c0243205f035979d0ecf6c12a036f upstream.

For large values of "mult" and long uptimes, the intermediate
result of "cycles * mult" can overflow 64 bits.  For example,
the tile platform calls clocksource_cyc2ns with a 1.2 GHz clock;
we have mult = 853, and after 208.5 days, we overflow 64 bits.

Since clocksource_cyc2ns() is intended to be used for relative
cycle counts, not absolute cycle counts, performance is more
importance than accepting a wider range of cycle values.  So,
just use mult_frac() directly in tile's sched_clock().

Commit 4cecf6d401a0 ("sched, x86: Avoid unnecessary overflow
in sched_clock") by Salman Qazi results in essentially the same
generated code for x86 as this change does for tile.  In fact,
a follow-on change by Salman introduced mult_frac() and switched
to using it, so the C code was largely identical at that point too.

Peter Zijlstra then added mul_u64_u32_shr() and switched x86
to use it.  This is, in principle, better; by optimizing the
64x64->64 multiplies to be 32x32->64 multiplies we can potentially
save some time.  However, the compiler piplines the 64x64->64
multiplies pretty well, and the conditional branch in the generic
mul_u64_u32_shr() causes some bubbles in execution, with the
result that it's pretty much a wash.  If tilegx provided its own
implementation of mul_u64_u32_shr() without the conditional branch,
we could potentially save 3 cycles, but that seems like small gain
for a fair amount of additional build scaffolding; no other platform
currently provides a mul_u64_u32_shr() override, and tile doesn't
currently have an <asm/div64.h> header to put the override in.

Additionally, gcc currently has an optimization bug that prevents
it from recognizing the opportunity to use a 32x32->64 multiply,
and so the result would be no better than the existing mult_frac()
until such time as the compiler is fixed.

For now, just using mult_frac() seems like the right answer.

Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoscsi: mpt3sas: Fix secure erase premature termination
Andrey Grodzovsky [Thu, 10 Nov 2016 14:35:27 +0000 (09:35 -0500)]
scsi: mpt3sas: Fix secure erase premature termination

commit 18f6084a989ba1b38702f9af37a2e4049a924be6 upstream.

This is a work around for a bug with LSI Fusion MPT SAS2 when perfoming
secure erase. Due to the very long time the operation takes, commands
issued during the erase will time out and will trigger execution of the
abort hook. Even though the abort hook is called for the specific
command which timed out, this leads to entire device halt
(scsi_state terminated) and premature termination of the secure erase.

Set device state to busy while ATA passthrough commands are in progress.

[mkp: hand applied to 4.9/scsi-fixes, tweaked patch description]

Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Cc: <linux-scsi@vger.kernel.org>
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Chaitra P B <chaitra.basappa@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Cc: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoFix USB CB/CBI storage devices with CONFIG_VMAP_STACK=y
Petr Vandrovec [Thu, 10 Nov 2016 21:57:14 +0000 (13:57 -0800)]
Fix USB CB/CBI storage devices with CONFIG_VMAP_STACK=y

commit 2ce9d2272b98743b911196c49e7af5841381c206 upstream.

Some code (all error handling) submits CDBs that are allocated
on the stack.  This breaks with CB/CBI code that tries to create
URB directly from SCSI command buffer - which happens to be in
vmalloced memory with vmalloced kernel stacks.

Let's make copy of the command in usb_stor_CB_transport.

Signed-off-by: Petr Vandrovec <petr@vandrovec.name>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoUSB: serial: ftdi_sio: add support for TI CC3200 LaunchPad
Doug Brown [Sat, 5 Nov 2016 04:18:20 +0000 (21:18 -0700)]
USB: serial: ftdi_sio: add support for TI CC3200 LaunchPad

commit 9bfef729a3d11f04d12788d749a3ce6b47645734 upstream.

This patch adds support for the TI CC3200 LaunchPad board, which uses a
custom USB vendor ID and product ID. Channel A is used for JTAG, and
channel B is used for a UART.

Signed-off-by: Doug Brown <doug@schmorgal.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>