platform/kernel/linux-amlogic.git
7 years agodefconfig: meson32: enable net configs
Ao Xu [Thu, 27 Apr 2017 07:06:52 +0000 (15:06 +0800)]
defconfig: meson32: enable net configs

PD#141217: enable net configs
+CONFIG_PACKET=y
+CONFIG_PACKET_DIAG=y
+CONFIG_UNIX=y
+CONFIG_UNIX_DIAG=y
+CONFIG_XFRM_USER=y
+CONFIG_NET_KEY=y
+CONFIG_NET_KEY_MIGRATE=y
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_ADVANCED_ROUTER=y
+CONFIG_IP_MULTIPLE_TABLES=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_IP_PNP_RARP=y
+CONFIG_NET_IPIP=y
+CONFIG_SYN_COOKIES=y
+CONFIG_INET_ESP=y
+CONFIG_IPV6_ROUTER_PREF=y
+CONFIG_IPV6_ROUTE_INFO=y
+CONFIG_IPV6_OPTIMISTIC_DAD=y
+CONFIG_INET6_AH=y
+CONFIG_INET6_ESP=y
+CONFIG_INET6_IPCOMP=y
+CONFIG_IPV6_MIP6=y
+CONFIG_IPV6_TUNNEL=y
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_NETFILTER=y
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_CONNTRACK_EVENTS=y
+CONFIG_NF_CT_PROTO_DCCP=y
+CONFIG_NF_CT_PROTO_SCTP=y
+CONFIG_NF_CT_PROTO_UDPLITE=y
+CONFIG_NF_CONNTRACK_AMANDA=y
+CONFIG_NF_CONNTRACK_FTP=y
+CONFIG_NF_CONNTRACK_H323=y
+CONFIG_NF_CONNTRACK_NETBIOS_NS=y
+CONFIG_NF_CONNTRACK_PPTP=y
+CONFIG_NF_CONNTRACK_SANE=y
+CONFIG_NF_CONNTRACK_TFTP=y
+CONFIG_NF_CT_NETLINK=y
+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
+CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y
+CONFIG_NETFILTER_XT_TARGET_MARK=y
+CONFIG_NETFILTER_XT_TARGET_NFLOG=y
+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
+CONFIG_NETFILTER_XT_TARGET_TPROXY=y
+CONFIG_NETFILTER_XT_TARGET_TRACE=y
+CONFIG_NETFILTER_XT_MATCH_COMMENT=y
+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=y
+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_HELPER=y
+CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
+CONFIG_NETFILTER_XT_MATCH_LENGTH=y
+CONFIG_NETFILTER_XT_MATCH_LIMIT=y
+CONFIG_NETFILTER_XT_MATCH_MAC=y
+CONFIG_NETFILTER_XT_MATCH_POLICY=y
+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA=y
+CONFIG_NETFILTER_XT_MATCH_SOCKET=y
+CONFIG_NETFILTER_XT_MATCH_STATE=y
+CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
+CONFIG_NETFILTER_XT_MATCH_STRING=y
+CONFIG_NETFILTER_XT_MATCH_TIME=y
+CONFIG_NETFILTER_XT_MATCH_U32=y
+CONFIG_NF_CONNTRACK_IPV4=y
+CONFIG_NF_NAT_IPV4=y
+CONFIG_IP_NF_IPTABLES=y
+CONFIG_IP_NF_MATCH_AH=y
+CONFIG_IP_NF_MATCH_ECN=y
+CONFIG_IP_NF_MATCH_TTL=y
+CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_TARGET_REJECT=y
+CONFIG_IP_NF_MANGLE=y
+CONFIG_IP_NF_RAW=y
+CONFIG_IP_NF_ARPTABLES=y
+CONFIG_IP_NF_ARPFILTER=y
+CONFIG_IP_NF_ARP_MANGLE=y
+CONFIG_NF_CONNTRACK_IPV6=y
+CONFIG_NF_NAT_IPV6=y
+CONFIG_IP6_NF_IPTABLES=y
+CONFIG_IP6_NF_FILTER=y
+CONFIG_IP6_NF_TARGET_REJECT=y
+CONFIG_IP6_NF_MANGLE=y
+CONFIG_IP6_NF_RAW=y
+CONFIG_L2TP=y
+CONFIG_L2TP_DEBUGFS=y
+CONFIG_L2TP_V3=y
+CONFIG_L2TP_IP=y
+CONFIG_L2TP_ETH=y
+CONFIG_BRIDGE=y
+# CONFIG_BRIDGE_IGMP_SNOOPING is not set
+CONFIG_PHONET=y
+CONFIG_NET_SCHED=y
+CONFIG_NET_SCH_HTB=y
+CONFIG_NET_SCH_INGRESS=y
+CONFIG_NET_CLS_U32=y
+CONFIG_NET_EMATCH=y
+CONFIG_NET_EMATCH_U32=y
+CONFIG_NET_CLS_ACT=y
+CONFIG_NET_ACT_POLICE=y
+CONFIG_NET_ACT_GACT=y
+CONFIG_NET_ACT_MIRRED=y

Change-Id: I1ec756db193d335b363ea2a8adfcb458fa73c213
Signed-off-by: Ao Xu <ao.xu@amlogic.com>
7 years agonand: fix wait ready condition for samsung slc.
Yonghui Yu [Wed, 19 Apr 2017 02:47:50 +0000 (10:47 +0800)]
nand: fix wait ready condition for samsung slc.

PD#142961: only status[7] of samsung indicate the R/B status, as others
using status[6:7].

Change-Id: I6b6030c868f81e250b4c96629025c1aeeb7b7d65
Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
7 years agosaradc: add interface to switch input voltage for ch7
Xingyu Chen [Wed, 26 Apr 2017 15:04:23 +0000 (23:04 +0800)]
saradc: add interface to switch input voltage for ch7

PD#138714: add interface to switch input voltage for ch7

add /sys/class/saradc/ch7_mux

Change-Id: I5e1ef3666f76ff38fa2f1878c06dad5108be67e0
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
7 years agocompiler: solve section mismatch warning during compiling
Jiamin Ma [Thu, 27 Apr 2017 04:28:24 +0000 (12:28 +0800)]
compiler: solve section mismatch warning during compiling

PD#141217: compiler: solve section mismatch warning during compiling

Change-Id: Ifde0e48a08b61bf19cbe763f6accaf7cb9b53bc5
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
7 years agoremote: report wakeup event after system resume
Xingyu Chen [Wed, 26 Apr 2017 09:24:42 +0000 (17:24 +0800)]
remote: report wakeup event after system resume

PD#138714: report wakeup event after system resume

Change-Id: Ie51f6594a7e27c207dee48e82538343888f781cc
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
7 years agoPM / sleep: Re-implement legacy early_suspend.
Qiufang Dai [Wed, 26 Apr 2017 08:06:03 +0000 (16:06 +0800)]
PM / sleep: Re-implement legacy early_suspend.

PD#138714: Re-implement legacy early_suspend for Amlogic driver.

1. re-implement early_suspend mechanism for legacy early_suspend driver code.
   The early_suspend/late_resume can be trigger via cmd:
   echo 1/0 > /sys/power/eary_suspend_trigger

2. Register wakeup source and report wakeup event for Remoute KEY_POWER

Change-Id: I07ba9861aa0c0c1126238e84248948f7707e9ae2
Signed-off-by: Qiufang Dai <qiufang.dai@amlogic.com>
7 years agoaudio: config audio for m8b
Xing Wang [Wed, 26 Apr 2017 12:24:13 +0000 (20:24 +0800)]
audio: config audio for m8b

PD#141217: audio: config audio for m8b

Change-Id: If837cf19bf3da0e54830fefd2267fd14445ca6f1
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
7 years agoaudio: fix pcm bclk
Xing Wang [Mon, 24 Apr 2017 12:45:30 +0000 (20:45 +0800)]
audio: fix pcm bclk

PD#141217: fix pcm bclk following sample rate, pcm format and slot number

Change-Id: I4e1547c6c7c133a46a8c8b9a9d595adb7aa2771c
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
7 years agodts: add axg dts file
Yun Cai [Sun, 9 Apr 2017 07:32:17 +0000 (15:32 +0800)]
dts: add axg dts file

PD#142470: add dts for axg pxp

Change-Id: I0d5c77368b0583fcfa046f4c01ac936704e96434
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agobt: add bt support
Larson Jiang [Wed, 26 Apr 2017 08:05:30 +0000 (16:05 +0800)]
bt: add bt support

PD#138714: initial add bt support for gxl and m8b

Change-Id: Ia243a220ec87ff7bb6242f21e8372b90a4f6456b
Signed-off-by: Larson Jiang <larson.jiang@amlogic.com>
7 years agodefconfig: meson32: enable CONFIG_DEBUG_INFO
Jianxin Pan [Wed, 26 Apr 2017 05:53:33 +0000 (13:53 +0800)]
defconfig: meson32: enable CONFIG_DEBUG_INFO

PD#141217: enable CONFIG_DEBUG_INFO to add -g to KBUILD_CFLAGS

Change-Id: I4fa030ec02729d58ff5076c3ccf1e6c50385c1a5
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
7 years agoclk: add clock measure for m8b
Yun Cai [Mon, 24 Apr 2017 03:10:10 +0000 (11:10 +0800)]
clk: add clock measure for m8b

PD#141217: clkmsr support m8baby

Change-Id: Id7e471353f235a6b8f69d46ed0250afe4479990d
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agoclk: m8b add clks for mpll/media/gpu/misc/store/test
Yun Cai [Thu, 6 Apr 2017 01:59:22 +0000 (09:59 +0800)]
clk: m8b add clks for mpll/media/gpu/misc/store/test

PD#141217: add mpll/media/gpu/misc/store/test clks for meson8b

Change-Id: I95268d46395d78419d311f1b9a5add9c593da810
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agoi2c: modify i2c config on gxl&gxm.
Xuhua Zhang [Tue, 25 Apr 2017 08:11:32 +0000 (16:11 +0800)]
i2c: modify i2c config on gxl&gxm.

PD#138714: fix i2c error on gxl/gxm

Change-Id: Ic1e8685b4cf853749808707266d0cec98db99496
Signed-off-by: Xuhua Zhang <xuhua.zhang@amlogic.com>
7 years agoremote: add remote driver to meson8b
Zan Peng [Mon, 24 Apr 2017 08:54:06 +0000 (16:54 +0800)]
remote: add remote driver to meson8b

PD#141217: enable remote driver for meson8b

Change-Id: I0c09ce5a71fdc34eb010d03efd35be683c8d224c
Signed-off-by: Zan Peng <zan.peng@amlogic.com>
7 years agopwm: update pwm driver
Jian Hu [Mon, 24 Apr 2017 03:26:40 +0000 (11:26 +0800)]
pwm: update pwm driver

PD#138714: update pwm driver

update driver for gxtvbb/gxl/gxm/txl dts parse error

Change-Id: I673e791f1ec46aba2a1916cafeb01526dd90505d
Signed-off-by: Jian Hu <jian.hu@amlogic.com>
7 years agodts: add gxl skt dts
Yun Cai [Mon, 17 Apr 2017 07:48:17 +0000 (15:48 +0800)]
dts: add gxl skt dts

PD#138714: add gxl_skt.dts

Change-Id: I0ca48f72267eed4f7f4dc2264c7e88483744740f
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agodts: fix i2c pinmux for gxl
Frank Chen [Thu, 20 Apr 2017 15:02:31 +0000 (23:02 +0800)]
dts: fix i2c pinmux for gxl

PD#138714: fix i2c pinmux

Change-Id: I8956c0910a643ecddea72b6585445d14810850f7
Signed-off-by: Frank Chen <frank.chen@amlogic.com>
7 years agovout: remove FB config for axis sysfs node
Evoke Zhang [Fri, 21 Apr 2017 06:31:00 +0000 (14:31 +0800)]
vout: remove FB config for axis sysfs node

PD#138714: remove FB config for axis sysfs node

Change-Id: I2f8c657ef46d184062bb2b09fbc0f2a1ba0770e1
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
7 years agoMerge branch 'android-4.9' into amlogic-4.9-dev
Victor Wan [Fri, 21 Apr 2017 07:25:31 +0000 (15:25 +0800)]
Merge branch 'android-4.9' into amlogic-4.9-dev

 Conflicts:
fs/ext4/inode.c

7 years agoamvecm: add amvecm driver
MingLiang Dong [Thu, 20 Apr 2017 12:37:42 +0000 (20:37 +0800)]
amvecm: add amvecm driver

PD#138714: add amvecm driver

Change-Id: Ieb0be7a4b02b7a8daa549544a97ee23e0daeb6da
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
7 years agohdmitx: update vmode_is_supported function to avoid invalid mode setting
Evoke Zhang [Thu, 20 Apr 2017 09:22:28 +0000 (17:22 +0800)]
hdmitx: update vmode_is_supported function to avoid invalid mode setting

PD#138714: update vmode_is_supported function to avoid invalid mode setting,
adjust hdmitx probe before vout serve.
also add NULL pointer protection in vout serve API.

Change-Id: I0815dfe35fa00ae8805d0ab6a9ae7b189a1b2af5
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
7 years agoMerge "osd: free uboot logo memory when kernel loaded" into amlogic-4.9-dev
Jianxin Pan [Fri, 21 Apr 2017 05:17:10 +0000 (22:17 -0700)]
Merge "osd: free uboot logo memory when kernel loaded" into amlogic-4.9-dev

7 years agoosd: free uboot logo memory when kernel loaded
Pengcheng Chen [Thu, 20 Apr 2017 07:29:21 +0000 (15:29 +0800)]
osd: free uboot logo memory when kernel loaded

PD#139665: free uboot logo memory when kernel loaded

Change-Id: I78c46946f3a06078a41491196a79f72e56cdc795
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
7 years agoANDROID: uid_sys_stats: reduce update_io_stats overhead
Jin Qian [Fri, 14 Apr 2017 00:07:58 +0000 (17:07 -0700)]
ANDROID: uid_sys_stats: reduce update_io_stats overhead

Replaced read_lock with rcu_read_lock to reduce time that preemption
is disabled.

Added a function to update io stats for specific uid and moved
hash table lookup, user_namespace out of loops.

Bug: 37319300
Change-Id: I2b81b5cd3b6399b40d08c3c14b42cad044556970
Signed-off-by: Jin Qian <jinqian@google.com>
7 years agoANDROID: usb: gadget: fix MTP enumeration issue under super speed mode
Jiebing Li [Tue, 10 Mar 2015 03:24:00 +0000 (11:24 +0800)]
ANDROID: usb: gadget: fix MTP enumeration issue under super speed mode

MTP function doesn't show as a drive in Windows when the device
is connected to PC's USB3 port, because device fails to respond
ACK to BULK OUT transfer request.

This patch modifies MTP OUT request length as multiple of MaxPacketSize
per databook requirement in order to fix this issue.

Patchset: mtp

Change-Id: I090d7880ff00c499dc5ba7fd644b1fe7cd87fcb5
Signed-off-by: Jiebing Li <jiebing.li@intel.com>
Signed-off-by: Wang, Yu <yu.y.wang@intel.com>
Signed-off-by: Russ Weight <russell.h.weight@intel.com>
7 years agoRevert "Android: sdcardfs: Don't do d_add for lower fs"
Daniel Rosenberg [Thu, 20 Apr 2017 19:15:01 +0000 (12:15 -0700)]
Revert "Android: sdcardfs: Don't do d_add for lower fs"

This reverts commit ab16e2fd5e8966ade74206c716a1335493586575.

This change caused issues for sdcardfs on top of vfat

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I34918eed57a8b566c58f8083de12a93a12ba5857

7 years agomedia: the regs r/w are removed in the module_init.
Nanxin Qin [Fri, 14 Apr 2017 09:31:59 +0000 (17:31 +0800)]
media: the regs r/w are removed in the module_init.

PD#138714: fixed the crash when the os booting

Change-Id: I0ffd67b9b85d06db9ffdae83a0cbc4c9bc8f6594
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
7 years agodefconfig: meson64: enable CONFIG_EXTCON
Jianxin Pan [Thu, 20 Apr 2017 06:14:03 +0000 (14:14 +0800)]
defconfig: meson64: enable CONFIG_EXTCON

PD#138714: enable CONFIG_EXTCON

Change-Id: Id4c4d118458578ea4b95516e811750bc4aeeb83f
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
7 years agotimer: enable percpu local timer for m8b
Jianxin Pan [Wed, 19 Apr 2017 09:48:18 +0000 (17:48 +0800)]
timer: enable percpu local timer for m8b

PD#141217: enable  percpu local timer for m8b
1. TimerA ~ TimerD for CPU0 ~ CPU3
2. TimerE is clock source
3. TimerE is delay source
4. hrtimer is enabled

Change-Id: I79b0b73f5ab5ec4d2321faa8ea5cba25e28550b2
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
7 years agodts: fix spdif_in and i2c_c_1 dtsi error
Peipeng Zhao [Thu, 20 Apr 2017 07:46:51 +0000 (15:46 +0800)]
dts: fix spdif_in and i2c_c_1 dtsi error

PD#138714: fix dts and pinctrl define error

1.fix i2c_c_1 dts and pinctrl define error
2.add spdif in dts and pinctrl funtion

Change-Id: I78809a0f183a55e3a90a17cc326e37fd2c8b7983
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
7 years agodts: disable useless devices
Frank Chen [Thu, 20 Apr 2017 03:27:57 +0000 (11:27 +0800)]
dts: disable useless devices

PD#138714: disable useless devices on p400 and p401

Change-Id: I7f0d2f4b59cae56814b3a91ceacf4aaac6058e16
Signed-off-by: Frank Chen <frank.chen@amlogic.com>
7 years agoAndroid: sdcardfs: Don't complain in fixup_lower_ownership
Daniel Rosenberg [Wed, 19 Apr 2017 05:49:38 +0000 (22:49 -0700)]
Android: sdcardfs: Don't complain in fixup_lower_ownership

Not all filesystems support changing the owner of a file.
We shouldn't complain if it doesn't happen.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 37488099
Change-Id: I403e44ab7230f176e6df82f6adb4e5c82ce57f33

7 years agoAndroid: sdcardfs: Don't do d_add for lower fs
Daniel Rosenberg [Wed, 19 Apr 2017 05:25:15 +0000 (22:25 -0700)]
Android: sdcardfs: Don't do d_add for lower fs

For file based encryption, ext4 explicitly does not
create negative dentries for encrypted files. If you
force one over it, the decrypted file will be hidden
until the cache is cleared. Instead, just fail out.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 37231161
Change-Id: Id2a9708dfa75e1c22f89915c529789caadd2ca4b

7 years agoANDROID: sdcardfs: ->iget fixes
Daniel Rosenberg [Tue, 18 Apr 2017 19:45:48 +0000 (12:45 -0700)]
ANDROID: sdcardfs: ->iget fixes

Adapted from wrapfs
commit 8c49eaa0sb9c ("Wrapfs: ->iget fixes")

Change where we igrab/iput to ensure we always hold a valid lower_inode.
Return ENOMEM (not EACCES) if iget5_locked returns NULL.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 35766959

Change-Id: Id8d4e0c0cbc685a0a77685ce73c923e9a3ddc094

7 years agoAndroid: sdcardfs: Change cache GID value
Daniel Rosenberg [Tue, 18 Apr 2017 00:11:38 +0000 (17:11 -0700)]
Android: sdcardfs: Change cache GID value

Change-Id: Ieb955dd26493da26a458bc20fbbe75bca32b094f
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 37193650

7 years agonand: fix mtd0 erase operation
Yonghui Yu [Mon, 17 Apr 2017 07:34:50 +0000 (15:34 +0800)]
nand: fix mtd0 erase operation

PD#138714: add erase interface for mtd0(bootloader)

Change-Id: I5d6de9013d9f2c83a218d29e390df58430eeea58
Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
7 years agoaudio: add i2s capture function and fix pinctrl error
Peipeng Zhao [Wed, 19 Apr 2017 06:34:27 +0000 (14:34 +0800)]
audio: add i2s capture function and fix pinctrl error

PD#138714: fix i2s in error

1. add aml_i2s_copy_capture for 8 channels
2. fix i2s pinctrl define error
3. add 8channel mic board d601 function on P400/P401 dts

Change-Id: I7b289e9926bded95f2a4e9a24b756363a94ba8dd
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
7 years agodefconfig: meson32: enable some debug configs
Jianxin Pan [Tue, 18 Apr 2017 07:19:56 +0000 (15:19 +0800)]
defconfig: meson32: enable some debug configs

PD#141217: enable configs:
+CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
+CONFIG_WQ_WATCHDOG=y
+CONFIG_PANIC_ON_RT_THROTTLING=y
+CONFIG_SCHEDSTATS=y
+CONFIG_SCHED_STACK_END_CHECK=y
+CONFIG_TIMER_STATS=y
+CONFIG_DEBUG_ATOMIC_SLEEP=y

Change-Id: Ia3ba9b790e103d4de21d2b92bc2fd4f76f3ebffc
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
7 years agodefconfig: meson64: enable some kernel hacking and sync savedefconfig
Jianxin Pan [Tue, 18 Apr 2017 06:22:23 +0000 (14:22 +0800)]
defconfig: meson64: enable some kernel hacking and sync savedefconfig

PD#138714: enable configs and sync savedefconfig
+CONFIG_LOCKUP_DETECTOR=y
+CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
+CONFIG_WQ_WATCHDOG=y
+CONFIG_PANIC_ON_RT_THROTTLING=y
+CONFIG_SCHED_STACK_END_CHECK=y
+CONFIG_DEBUG_ATOMIC_SLEEP=y

Change-Id: I5f697a5ebb3444c6136d9e8d91da48910da8cfcf
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
7 years agoosd: fix used kzalloc caused sleep in osd_rdma_irq
Pengcheng Chen [Tue, 18 Apr 2017 09:42:50 +0000 (17:42 +0800)]
osd: fix used kzalloc caused sleep in osd_rdma_irq

PD#138714: fix risk of sleep in atomic

Change-Id: I0af741c0837904e89cb18552fe0242745e53182a
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
7 years agoMerge 4.9.23 into android-4.9
Greg Kroah-Hartman [Tue, 18 Apr 2017 07:31:20 +0000 (09:31 +0200)]
Merge 4.9.23 into android-4.9

Changes in 4.9.23:
drm/i915/gen9: Increase PCODE request timeout to 50ms
drm/i915: Nuke debug messages from the pipe update critical section
drm/i915: Avoid tweaking evaluation thresholds on Baytrail v3
drm/i915: Only enable hotplug interrupts if the display interrupts are enabled
drm/i915: Drop support for I915_EXEC_CONSTANTS_* execbuf parameters.
drm/i915: Stop using RP_DOWN_EI on Baytrail
drm/i915: Avoid rcu_barrier() from reclaim paths (shrinker)
orangefs: fix memory leak of string 'new' on exit path
orangefs: Dan Carpenter influenced cleanups...
orangefs: fix buffer size mis-match between kernel space and user space.
i2c: bcm2835: Fix hang for writing messages larger than 16 bytes
rt2x00usb: fix anchor initialization
rt2x00usb: do not anchor rx and tx urb's
rt2x00: Fix incorrect usage of CONFIG_RT2X00_LIB_USB
mtd: bcm47xxpart: fix parsing first block after aligned TRX
MIPS: Introduce irq_stack
MIPS: Stack unwinding while on IRQ stack
MIPS: Only change $28 to thread_info if coming from user mode
MIPS: Switch to the irq_stack in interrupts
MIPS: Select HAVE_IRQ_EXIT_ON_IRQ_STACK
MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch
crypto: caam - fix RNG deinstantiation error checking
crypto: caam - fix invalid dereference in caam_rsa_init_tfm()
Revert "drm/i915/execlists: Reset RING registers upon resume"
net/packet: fix overflow in check for priv area size
blk-mq: Avoid memory reclaim when remapping queues
usb: hub: Wait for connection to be reestablished after port reset
net/mlx4_en: Fix bad WQE issue
net/mlx4_core: Fix racy CQ (Completion Queue) free
net/mlx4_core: Fix when to save some qp context flags for dynamic VST to VGT transitions
dma-buf: add support for compat ioctl
Linux 4.9.23

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
7 years agodts: fix Q200 ion_share_dma_buf_fd failed issue
Pengcheng Chen [Tue, 18 Apr 2017 03:13:41 +0000 (11:13 +0800)]
dts: fix Q200 ion_share_dma_buf_fd failed issue

PD#138714: fix Q200 ion_share_dma_buf_fd failed issue

Change-Id: I9feed9d3190e5c5fb8f39c2c92f93bee94037291
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
7 years agoLinux 4.9.23 v4.9.23
Greg Kroah-Hartman [Tue, 18 Apr 2017 05:12:30 +0000 (07:12 +0200)]
Linux 4.9.23

7 years agodma-buf: add support for compat ioctl
Marek Szyprowski [Tue, 21 Feb 2017 13:21:01 +0000 (14:21 +0100)]
dma-buf: add support for compat ioctl

commit 888022c0473d079bff9b47fb50434b1f20f8f37f upstream.

Add compat ioctl support to dma-buf. This lets one to use DMA_BUF_IOCTL_SYNC
ioctl from 32bit application on 64bit kernel. Data structures for both 32
and 64bit modes are same, so there is no need for additional translation
layer.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1487683261-2655-1-git-send-email-m.szyprowski@samsung.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agonet/mlx4_core: Fix when to save some qp context flags for dynamic VST to VGT transitions
Jack Morgenstein [Mon, 16 Jan 2017 16:31:38 +0000 (18:31 +0200)]
net/mlx4_core: Fix when to save some qp context flags for dynamic VST to VGT transitions

commit 7c3945bc2073554bb2ecf983e073dee686679c53 upstream.

Save the qp context flags byte containing the flag disabling vlan stripping
in the RESET to INIT qp transition, rather than in the INIT to RTR
transition. Per the firmware spec, the flags in this byte are active
in the RESET to INIT transition.

As a result of saving the flags in the incorrect qp transition, when
switching dynamically from VGT to VST and back to VGT, the vlan
remained stripped (as is required for VST) and did not return to
not-stripped (as is required for VGT).

Fixes: f0f829bf42cd ("net/mlx4_core: Add immediate activate for VGT->VST->VGT")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agonet/mlx4_core: Fix racy CQ (Completion Queue) free
Jack Morgenstein [Mon, 16 Jan 2017 16:31:37 +0000 (18:31 +0200)]
net/mlx4_core: Fix racy CQ (Completion Queue) free

commit 291c566a28910614ce42d0ffe82196eddd6346f4 upstream.

In function mlx4_cq_completion() and mlx4_cq_event(), the
radix_tree_lookup requires a rcu_read_lock.
This is mandatory: if another core frees the CQ, it could
run the radix_tree_node_rcu_free() call_rcu() callback while
its being used by the radix tree lookup function.

Additionally, in function mlx4_cq_event(), since we are adding
the rcu lock around the radix-tree lookup, we no longer need to take
the spinlock. Also, the synchronize_irq() call for the async event
eliminates the need for incrementing the cq reference count in
mlx4_cq_event().

Other changes:
1. In function mlx4_cq_free(), replace spin_lock_irq with spin_lock:
   we no longer take this spinlock in the interrupt context.
   The spinlock here, therefore, simply protects against different
   threads simultaneously invoking mlx4_cq_free() for different cq's.

2. In function mlx4_cq_free(), we move the radix tree delete to before
   the synchronize_irq() calls. This guarantees that we will not
   access this cq during any subsequent interrupts, and therefore can
   safely free the CQ after the synchronize_irq calls. The rcu_read_lock
   in the interrupt handlers only needs to protect against corrupting the
   radix tree; the interrupt handlers may access the cq outside the
   rcu_read_lock due to the synchronize_irq calls which protect against
   premature freeing of the cq.

3. In function mlx4_cq_event(), we change the mlx_warn message to mlx4_dbg.

4. We leave the cq reference count mechanism in place, because it is
   still needed for the cq completion tasklet mechanism.

Fixes: 6d90aa5cf17b ("net/mlx4_core: Make sure there are no pending async events when freeing CQ")
Fixes: 225c7b1feef1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agonet/mlx4_en: Fix bad WQE issue
Eugenia Emantayev [Thu, 29 Dec 2016 16:37:10 +0000 (18:37 +0200)]
net/mlx4_en: Fix bad WQE issue

commit 6496bbf0ec481966ef9ffe5b6660d8d1b55c60cc upstream.

Single send WQE in RX buffer should be stamped with software
ownership in order to prevent the flow of QP in error in FW
once UPDATE_QP is called.

Fixes: 9f519f68cfff ('mlx4_en: Not using Shared Receive Queues')
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agousb: hub: Wait for connection to be reestablished after port reset
Guenter Roeck [Thu, 1 Dec 2016 21:49:59 +0000 (13:49 -0800)]
usb: hub: Wait for connection to be reestablished after port reset

commit 22547c4cc4fe20698a6a85a55b8788859134b8e4 upstream.

On a system with a defective USB device connected to an USB hub,
an endless sequence of port connect events was observed. The sequence
of events as observed is as follows:

- Port reports connected event (port status=USB_PORT_STAT_CONNECTION).
- Event handler debounces port and resets it by calling hub_port_reset().
- hub_port_reset() calls hub_port_wait_reset() to wait for the reset
  to complete.
- The reset completes, but USB_PORT_STAT_CONNECTION is not immediately
  set in the port status register.
- hub_port_wait_reset() returns -ENOTCONN.
- Port initialization sequence is aborted.
- A few milliseconds later, the port again reports a connected event,
  and the sequence repeats.

This continues either forever or, randomly, stops if the connection
is already re-established when the port status is read. It results in
a high rate of udev events. This in turn destabilizes userspace since
the above sequence holds the device mutex pretty much continuously
and prevents userspace from actually reading the device status.

To prevent the problem from happening, let's wait for the connection
to be re-established after a port reset. If the device was actually
disconnected, the code will still return an error, but it will do so
only after the long reset timeout.

Cc: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoblk-mq: Avoid memory reclaim when remapping queues
Gabriel Krisman Bertazi [Tue, 6 Dec 2016 15:31:44 +0000 (13:31 -0200)]
blk-mq: Avoid memory reclaim when remapping queues

commit 36e1f3d107867b25c616c2fd294f5a1c9d4e5d09 upstream.

While stressing memory and IO at the same time we changed SMT settings,
we were able to consistently trigger deadlocks in the mm system, which
froze the entire machine.

I think that under memory stress conditions, the large allocations
performed by blk_mq_init_rq_map may trigger a reclaim, which stalls
waiting on the block layer remmaping completion, thus deadlocking the
system.  The trace below was collected after the machine stalled,
waiting for the hotplug event completion.

The simplest fix for this is to make allocations in this path
non-reclaimable, with GFP_NOIO.  With this patch, We couldn't hit the
issue anymore.

This should apply on top of Jens's for-next branch cleanly.

Changes since v1:
  - Use GFP_NOIO instead of GFP_NOWAIT.

 Call Trace:
[c000000f0160aaf0] [c000000f0160ab50] 0xc000000f0160ab50 (unreliable)
[c000000f0160acc0] [c000000000016624] __switch_to+0x2e4/0x430
[c000000f0160ad20] [c000000000b1a880] __schedule+0x310/0x9b0
[c000000f0160ae00] [c000000000b1af68] schedule+0x48/0xc0
[c000000f0160ae30] [c000000000b1b4b0] schedule_preempt_disabled+0x20/0x30
[c000000f0160ae50] [c000000000b1d4fc] __mutex_lock_slowpath+0xec/0x1f0
[c000000f0160aed0] [c000000000b1d678] mutex_lock+0x78/0xa0
[c000000f0160af00] [d000000019413cac] xfs_reclaim_inodes_ag+0x33c/0x380 [xfs]
[c000000f0160b0b0] [d000000019415164] xfs_reclaim_inodes_nr+0x54/0x70 [xfs]
[c000000f0160b0f0] [d0000000194297f8] xfs_fs_free_cached_objects+0x38/0x60 [xfs]
[c000000f0160b120] [c0000000003172c8] super_cache_scan+0x1f8/0x210
[c000000f0160b190] [c00000000026301c] shrink_slab.part.13+0x21c/0x4c0
[c000000f0160b2d0] [c000000000268088] shrink_zone+0x2d8/0x3c0
[c000000f0160b380] [c00000000026834c] do_try_to_free_pages+0x1dc/0x520
[c000000f0160b450] [c00000000026876c] try_to_free_pages+0xdc/0x250
[c000000f0160b4e0] [c000000000251978] __alloc_pages_nodemask+0x868/0x10d0
[c000000f0160b6f0] [c000000000567030] blk_mq_init_rq_map+0x160/0x380
[c000000f0160b7a0] [c00000000056758c] blk_mq_map_swqueue+0x33c/0x360
[c000000f0160b820] [c000000000567904] blk_mq_queue_reinit+0x64/0xb0
[c000000f0160b850] [c00000000056a16c] blk_mq_queue_reinit_notify+0x19c/0x250
[c000000f0160b8a0] [c0000000000f5d38] notifier_call_chain+0x98/0x100
[c000000f0160b8f0] [c0000000000c5fb0] __cpu_notify+0x70/0xe0
[c000000f0160b930] [c0000000000c63c4] notify_prepare+0x44/0xb0
[c000000f0160b9b0] [c0000000000c52f4] cpuhp_invoke_callback+0x84/0x250
[c000000f0160ba10] [c0000000000c570c] cpuhp_up_callbacks+0x5c/0x120
[c000000f0160ba60] [c0000000000c7cb8] _cpu_up+0xf8/0x1d0
[c000000f0160bac0] [c0000000000c7eb0] do_cpu_up+0x120/0x150
[c000000f0160bb40] [c0000000006fe024] cpu_subsys_online+0x64/0xe0
[c000000f0160bb90] [c0000000006f5124] device_online+0xb4/0x120
[c000000f0160bbd0] [c0000000006f5244] online_store+0xb4/0xc0
[c000000f0160bc20] [c0000000006f0a68] dev_attr_store+0x68/0xa0
[c000000f0160bc60] [c0000000003ccc30] sysfs_kf_write+0x80/0xb0
[c000000f0160bca0] [c0000000003cbabc] kernfs_fop_write+0x17c/0x250
[c000000f0160bcf0] [c00000000030fe6c] __vfs_write+0x6c/0x1e0
[c000000f0160bd90] [c000000000311490] vfs_write+0xd0/0x270
[c000000f0160bde0] [c0000000003131fc] SyS_write+0x6c/0x110
[c000000f0160be30] [c000000000009204] system_call+0x38/0xec

Signed-off-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Cc: Brian King <brking@linux.vnet.ibm.com>
Cc: Douglas Miller <dougmill@linux.vnet.ibm.com>
Cc: linux-block@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agonet/packet: fix overflow in check for priv area size
Andrey Konovalov [Wed, 29 Mar 2017 14:11:20 +0000 (16:11 +0200)]
net/packet: fix overflow in check for priv area size

commit 2b6867c2ce76c596676bec7d2d525af525fdc6e2 upstream.

Subtracting tp_sizeof_priv from tp_block_size and casting to int
to check whether one is less then the other doesn't always work
(both of them are unsigned ints).

Compare them as is instead.

Also cast tp_sizeof_priv to u64 before using BLK_PLUS_PRIV, as
it can overflow inside BLK_PLUS_PRIV otherwise.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoRevert "drm/i915/execlists: Reset RING registers upon resume"
Greg Kroah-Hartman [Wed, 12 Apr 2017 13:49:39 +0000 (15:49 +0200)]
Revert "drm/i915/execlists: Reset RING registers upon resume"

This reverts commit f2a0409a08502d64fbe3990354dff5902b08d2fb which is
commit bafb2f7d4755bf1571bd5e9a03b97f3fc4fe69ae upstream.

It was reported to have problems.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Eric Blau <eblau1@gmail.com>
Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
7 years agocrypto: caam - fix invalid dereference in caam_rsa_init_tfm()
Horia Geantă [Mon, 3 Apr 2017 15:30:07 +0000 (18:30 +0300)]
crypto: caam - fix invalid dereference in caam_rsa_init_tfm()

commit 33fa46d7b310e06d2cb2ab5417c100af120bfb65 upstream.

In case caam_jr_alloc() fails, ctx->dev carries the error code,
thus accessing it with dev_err() is incorrect.

Fixes: 8c419778ab57e ("crypto: caam - add support for RSA algorithm")
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>
7 years agocrypto: caam - fix RNG deinstantiation error checking
Horia Geantă [Wed, 5 Apr 2017 08:41:03 +0000 (11:41 +0300)]
crypto: caam - fix RNG deinstantiation error checking

commit 40c98cb57cdbc377456116ad4582c89e329721b0 upstream.

RNG instantiation was previously fixed by
commit 62743a4145bb9 ("crypto: caam - fix RNG init descriptor ret. code checking")
while deinstantiation was not addressed.

Since the descriptors used are similar, in the sense that they both end
with a JUMP HALT command, checking for errors should be similar too,
i.e. status code 7000_0000h should be considered successful.

Fixes: 1005bccd7a4a6 ("crypto: caam - enable instantiation of all RNG4 state handles")
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>
7 years agoMIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch
Matt Redfearn [Wed, 25 Jan 2017 17:00:25 +0000 (17:00 +0000)]
MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch

commit c25f8064c1d5731a2ce5664def890140dcdd3e5c upstream.

Commit dda45f701c9d ("MIPS: Switch to the irq_stack in interrupts")
changed both the normal and vectored interrupt handlers. Unfortunately
the vectored version, "except_vec_vi_handler", was incorrectly modified
to unconditionally jal to plat_irq_dispatch, rather than doing a jalr to
the vectored handler that has been set up. This is ok for many platforms
which set the vectored handler to plat_irq_dispatch anyway, but will
cause problems with platforms that use other handlers.

Fixes: dda45f701c9d ("MIPS: Switch to the irq_stack in interrupts")
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15110/
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMIPS: Select HAVE_IRQ_EXIT_ON_IRQ_STACK
Matt Redfearn [Mon, 19 Dec 2016 14:21:00 +0000 (14:21 +0000)]
MIPS: Select HAVE_IRQ_EXIT_ON_IRQ_STACK

commit 3cc3434fd6307d06b53b98ce83e76bf9807689b9 upstream.

Since do_IRQ is now invoked on a separate IRQ stack, we select
HAVE_IRQ_EXIT_ON_IRQ_STACK so that softirq's may be invoked directly
from irq_exit(), rather than requiring do_softirq_own_stack.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Acked-by: Jason A. Donenfeld <jason@zx2c4.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14744/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMIPS: Switch to the irq_stack in interrupts
Matt Redfearn [Mon, 19 Dec 2016 14:20:59 +0000 (14:20 +0000)]
MIPS: Switch to the irq_stack in interrupts

commit dda45f701c9d7ad4ac0bb446e3a96f6df9a468d9 upstream.

When enterring interrupt context via handle_int or except_vec_vi, switch
to the irq_stack of the current CPU if it is not already in use.

The current stack pointer is masked with the thread size and compared to
the base or the irq stack. If it does not match then the stack pointer
is set to the top of that stack, otherwise this is a nested irq being
handled on the irq stack so the stack pointer should be left as it was.

The in-use stack pointer is placed in the callee saved register s1. It
will be saved to the stack when plat_irq_dispatch is invoked and can be
restored once control returns here.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Acked-by: Jason A. Donenfeld <jason@zx2c4.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14743/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMIPS: Only change $28 to thread_info if coming from user mode
Matt Redfearn [Mon, 19 Dec 2016 14:20:58 +0000 (14:20 +0000)]
MIPS: Only change $28 to thread_info if coming from user mode

commit 510d86362a27577f5ee23f46cfb354ad49731e61 upstream.

The SAVE_SOME macro is used to save the execution context on all
exceptions.
If an exception occurs while executing user code, the stack is switched
to the kernel's stack for the current task, and register $28 is switched
to point to the current_thread_info, which is at the bottom of the stack
region.
If the exception occurs while executing kernel code, the stack is left,
and this change ensures that register $28 is not updated. This is the
correct behaviour when the kernel can be executing on the separate irq
stack, because the thread_info will not be at the base of it.

With this change, register $28 is only switched to it's kernel
conventional usage of the currrent thread info pointer at the point at
which execution enters kernel space. Doing it on every exception was
redundant, but OK without an IRQ stack, but will be erroneous once that
is introduced.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Acked-by: Jason A. Donenfeld <jason@zx2c4.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14742/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMIPS: Stack unwinding while on IRQ stack
Matt Redfearn [Mon, 19 Dec 2016 14:20:57 +0000 (14:20 +0000)]
MIPS: Stack unwinding while on IRQ stack

commit d42d8d106b0275b027c1e8992c42aecf933436ea upstream.

Within unwind stack, check if the stack pointer being unwound is within
the CPU's irq_stack and if so use that page rather than the task's stack
page.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Acked-by: Jason A. Donenfeld <jason@zx2c4.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Adam Buchbinder <adam.buchbinder@gmail.com>
Cc: Maciej W. Rozycki <macro@imgtec.com>
Cc: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14741/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMIPS: Introduce irq_stack
Matt Redfearn [Mon, 19 Dec 2016 14:20:56 +0000 (14:20 +0000)]
MIPS: Introduce irq_stack

commit fe8bd18ffea5327344d4ec2bf11f47951212abd0 upstream.

Allocate a per-cpu irq stack for use within interrupt handlers.

Also add a utility function on_irq_stack to determine if a given stack
pointer is within the irq stack for that cpu.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Acked-by: Jason A. Donenfeld <jason@zx2c4.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Aaron Tomlin <atomlin@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14740/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomtd: bcm47xxpart: fix parsing first block after aligned TRX
Rafał Miłecki [Sun, 20 Nov 2016 15:09:30 +0000 (16:09 +0100)]
mtd: bcm47xxpart: fix parsing first block after aligned TRX

commit bd5d21310133921021d78995ad6346f908483124 upstream.

After parsing TRX we should skip to the first block placed behind it.
Our code was working only with TRX with length not aligned to the
blocksize. In other cases (length aligned) it was missing the block
places right after TRX.

This fixes calculation and simplifies the comment.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agort2x00: Fix incorrect usage of CONFIG_RT2X00_LIB_USB
Vishal Thanki [Wed, 16 Nov 2016 16:01:54 +0000 (17:01 +0100)]
rt2x00: Fix incorrect usage of CONFIG_RT2X00_LIB_USB

commit a083c8fd277b4122c804f18ec8c84165f345c71c upstream.

In device removal routine, usage of "#ifdef CONFIG_RT2X00_LIB_USB"
will not cover the case when it is configured as module. This will
omit the entire if-block which does cleanup of URBs and cancellation
of pending work. Changing the #ifdef to #if IS_ENABLED() to fix it.

Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agort2x00usb: do not anchor rx and tx urb's
Stanislaw Gruszka [Wed, 8 Feb 2017 11:18:09 +0000 (12:18 +0100)]
rt2x00usb: do not anchor rx and tx urb's

commit 93c7018ec16bb83399dd4db61c361a6d6aba0d5a upstream.

We might kill TX or RX urb during rt2x00usb_flush_entry(), what can
cause anchor list corruption like shown below:

[ 2074.035633] WARNING: CPU: 2 PID: 14480 at lib/list_debug.c:33 __list_add+0xac/0xc0
[ 2074.035634] list_add corruption. prev->next should be next (ffff88020f362c28), but was dead000000000100. (prev=ffff8801d161bb70).
<snip>
[ 2074.035670] Call Trace:
[ 2074.035672]  [<ffffffff813bde47>] dump_stack+0x63/0x8c
[ 2074.035674]  [<ffffffff810a2231>] __warn+0xd1/0xf0
[ 2074.035676]  [<ffffffff810a22af>] warn_slowpath_fmt+0x5f/0x80
[ 2074.035678]  [<ffffffffa073855d>] ? rt2x00usb_register_write_lock+0x3d/0x60 [rt2800usb]
[ 2074.035679]  [<ffffffff813dbe4c>] __list_add+0xac/0xc0
[ 2074.035681]  [<ffffffff81591c6c>] usb_anchor_urb+0x4c/0xa0
[ 2074.035683]  [<ffffffffa07322af>] rt2x00usb_kick_rx_entry+0xaf/0x100 [rt2x00usb]
[ 2074.035684]  [<ffffffffa0732322>] rt2x00usb_clear_entry+0x22/0x30 [rt2x00usb]

To fix do not anchor TX and RX urb's, it is not needed as during
shutdown we kill those urbs in rt2x00usb_free_entries().

Cc: Vishal Thanki <vishalthanki@gmail.com>
Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agort2x00usb: fix anchor initialization
Stanislaw Gruszka [Wed, 8 Feb 2017 11:18:10 +0000 (12:18 +0100)]
rt2x00usb: fix anchor initialization

commit 0488a6121dfe6cbd44de15ea3627913b7549a1e9 upstream.

If device fail to initialize we can OOPS in rt2x00lib_remove_dev(), due
to using uninitialized usb_anchor structure:

[  855.435820] ieee80211 phy3: rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x1000 with error -19
[  855.435826] ieee80211 phy3: rt2800_probe_rt: Error - Invalid RT chipset 0x0000, rev 0000 detected
[  855.435829] ieee80211 phy3: rt2x00lib_probe_dev: Error - Failed to allocate device
[  855.435845] BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
[  855.435900] IP: _raw_spin_lock_irq+0xd/0x30
[  855.435926] PGD 0
[  855.435953] Oops: 0002 [#1] SMP
<snip>
[  855.437011] Call Trace:
[  855.437029]  ? usb_kill_anchored_urbs+0x27/0xc0
[  855.437061]  rt2x00lib_remove_dev+0x190/0x1c0 [rt2x00lib]
[  855.437097]  rt2x00lib_probe_dev+0x246/0x7a0 [rt2x00lib]
[  855.437149]  ? ieee80211_roc_setup+0x9e/0xd0 [mac80211]
[  855.437183]  ? __kmalloc+0x1af/0x1f0
[  855.437207]  ? rt2x00usb_probe+0x13d/0xc50 [rt2x00usb]
[  855.437240]  rt2x00usb_probe+0x155/0xc50 [rt2x00usb]
[  855.437273]  rt2800usb_probe+0x15/0x20 [rt2800usb]
[  855.437304]  usb_probe_interface+0x159/0x2d0
[  855.437333]  driver_probe_device+0x2bb/0x460

Patch changes initialization sequence to fix the problem.

Cc: Vishal Thanki <vishalthanki@gmail.com>
Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Cc: Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoi2c: bcm2835: Fix hang for writing messages larger than 16 bytes
Noralf Trønnes [Mon, 3 Oct 2016 20:06:08 +0000 (22:06 +0200)]
i2c: bcm2835: Fix hang for writing messages larger than 16 bytes

commit e2474541032db65d02bf88b6a8c2f954654b443f upstream.

Writing messages larger than the FIFO size results in a hang, rendering
the machine unusable. This is because the RXD status flag is set on the
first interrupt which results in bcm2835_drain_rxfifo() stealing bytes
from the buffer. The controller continues to trigger interrupts waiting
for the missing bytes, but bcm2835_fill_txfifo() has none to give.
In this situation wait_for_completion_timeout() apparently is unable to
stop the madness.

The BCM2835 ARM Peripherals datasheet has this to say about the flags:
  TXD: is set when the FIFO has space for at least one byte of data.
  RXD: is set when the FIFO contains at least one byte of data.
  TXW: is set during a write transfer and the FIFO is less than full.
  RXR: is set during a read transfer and the FIFO is or more full.

Implementing the logic from the downstream i2c-bcm2708 driver solved
the hang problem.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoorangefs: fix buffer size mis-match between kernel space and user space.
Mike Marshall [Tue, 7 Feb 2017 17:41:02 +0000 (12:41 -0500)]
orangefs: fix buffer size mis-match between kernel space and user space.

commit eb68d0324dc4d88ab0d6159bdcd98c247a3a8954 upstream.

The deamon through which the kernel module communicates with the userspace
part of Orangefs, the "client-core", sends initialization data to the
kernel module with ioctl. The initialization data was built by the
client-core in a 2k buffer and copy_from_user'd into a 1k buffer
in the kernel module. When more than 1k of initialization data needed
to be sent, some was lost, reducing the usability of the control by which
debug levels are set. This patch sets the kernel side buffer to 2K to
match the userspace side...

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoorangefs: Dan Carpenter influenced cleanups...
Mike Marshall [Thu, 9 Feb 2017 19:38:50 +0000 (14:38 -0500)]
orangefs: Dan Carpenter influenced cleanups...

commit 05973c2efb40122f2a9ecde2d065f7ea5068d024 upstream.

This patch is simlar to one Dan Carpenter sent me, cleans
up some return codes and whitespace errors. There was one
place where he thought inserting an error message into
the ring buffer might be too chatty, I hope I convinced him
othewise. As a consolation <g> I changed a truly chatty
error message in another location into a debug message,
system-admins had already yelled at me about that one...

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoorangefs: fix memory leak of string 'new' on exit path
Colin Ian King [Fri, 2 Dec 2016 15:18:06 +0000 (15:18 +0000)]
orangefs: fix memory leak of string 'new' on exit path

commit 4defb5f912a0ba60e07e91a4b62634814cd99b7f upstream.

allocates string 'new' is not free'd on the exit path when
cdm_element_count <= 0. Fix this by kfree'ing it.

Fixes CoverityScan CID#1375923 "Resource Leak"

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/i915: Avoid rcu_barrier() from reclaim paths (shrinker)
Chris Wilson [Tue, 21 Mar 2017 14:45:31 +0000 (14:45 +0000)]
drm/i915: Avoid rcu_barrier() from reclaim paths (shrinker)

commit 3d3d18f086cdda72ee18a454db70ca72c6e3246c upstream.

The rcu_barrier() takes the cpu_hotplug mutex which itself is not
reclaim-safe, and so rcu_barrier() is illegal from inside the shrinker.

[  309.661373] =========================================================
[  309.661376] [ INFO: possible irq lock inversion dependency detected ]
[  309.661380] 4.11.0-rc1-CI-CI_DRM_2333+ #1 Tainted: G        W
[  309.661383] ---------------------------------------------------------
[  309.661386] gem_exec_gttfil/6435 just changed the state of lock:
[  309.661389]  (rcu_preempt_state.barrier_mutex){+.+.-.}, at: [<ffffffff81100731>] _rcu_barrier+0x31/0x160
[  309.661399] but this lock took another, RECLAIM_FS-unsafe lock in the past:
[  309.661402]  (cpu_hotplug.lock){+.+.+.}
[  309.661404]

               and interrupts could create inverse lock ordering between them.

[  309.661410]
               other info that might help us debug this:
[  309.661414]  Possible interrupt unsafe locking scenario:

[  309.661417]        CPU0                    CPU1
[  309.661419]        ----                    ----
[  309.661421]   lock(cpu_hotplug.lock);
[  309.661425]                                local_irq_disable();
[  309.661432]                                lock(rcu_preempt_state.barrier_mutex);
[  309.661441]                                lock(cpu_hotplug.lock);
[  309.661446]   <Interrupt>
[  309.661448]     lock(rcu_preempt_state.barrier_mutex);
[  309.661453]
                *** DEADLOCK ***

[  309.661460] 4 locks held by gem_exec_gttfil/6435:
[  309.661464]  #0:  (sb_writers#10){.+.+.+}, at: [<ffffffff8120d83d>] vfs_write+0x17d/0x1f0
[  309.661475]  #1:  (debugfs_srcu){......}, at: [<ffffffff81320491>] debugfs_use_file_start+0x41/0xa0
[  309.661486]  #2:  (&attr->mutex){+.+.+.}, at: [<ffffffff8123a3e7>] simple_attr_write+0x37/0xe0
[  309.661495]  #3:  (&dev->struct_mutex){+.+.+.}, at: [<ffffffffa0091b4a>] i915_drop_caches_set+0x3a/0x150 [i915]
[  309.661540]
               the shortest dependencies between 2nd lock and 1st lock:
[  309.661547]  -> (cpu_hotplug.lock){+.+.+.} ops: 829 {
[  309.661553]     HARDIRQ-ON-W at:
[  309.661560]                       __lock_acquire+0x5e5/0x1b50
[  309.661565]                       lock_acquire+0xc9/0x220
[  309.661572]                       __mutex_lock+0x6e/0x990
[  309.661576]                       mutex_lock_nested+0x16/0x20
[  309.661583]                       get_online_cpus+0x61/0x80
[  309.661590]                       kmem_cache_create+0x25/0x1d0
[  309.661596]                       debug_objects_mem_init+0x30/0x249
[  309.661602]                       start_kernel+0x341/0x3fe
[  309.661607]                       x86_64_start_reservations+0x2a/0x2c
[  309.661612]                       x86_64_start_kernel+0x173/0x186
[  309.661619]                       verify_cpu+0x0/0xfc
[  309.661622]     SOFTIRQ-ON-W at:
[  309.661627]                       __lock_acquire+0x611/0x1b50
[  309.661632]                       lock_acquire+0xc9/0x220
[  309.661636]                       __mutex_lock+0x6e/0x990
[  309.661641]                       mutex_lock_nested+0x16/0x20
[  309.661646]                       get_online_cpus+0x61/0x80
[  309.661650]                       kmem_cache_create+0x25/0x1d0
[  309.661655]                       debug_objects_mem_init+0x30/0x249
[  309.661660]                       start_kernel+0x341/0x3fe
[  309.661664]                       x86_64_start_reservations+0x2a/0x2c
[  309.661669]                       x86_64_start_kernel+0x173/0x186
[  309.661674]                       verify_cpu+0x0/0xfc
[  309.661677]     RECLAIM_FS-ON-W at:
[  309.661682]                          mark_held_locks+0x6f/0xa0
[  309.661687]                          lockdep_trace_alloc+0xb3/0x100
[  309.661693]                          kmem_cache_alloc_trace+0x31/0x2e0
[  309.661699]                          __smpboot_create_thread.part.1+0x27/0xe0
[  309.661704]                          smpboot_create_threads+0x61/0x90
[  309.661709]                          cpuhp_invoke_callback+0x9c/0x8a0
[  309.661713]                          cpuhp_up_callbacks+0x31/0xb0
[  309.661718]                          _cpu_up+0x7a/0xc0
[  309.661723]                          do_cpu_up+0x5f/0x80
[  309.661727]                          cpu_up+0xe/0x10
[  309.661734]                          smp_init+0x71/0xb3
[  309.661738]                          kernel_init_freeable+0x94/0x19e
[  309.661743]                          kernel_init+0x9/0xf0
[  309.661748]                          ret_from_fork+0x2e/0x40
[  309.661752]     INITIAL USE at:
[  309.661757]                      __lock_acquire+0x234/0x1b50
[  309.661761]                      lock_acquire+0xc9/0x220
[  309.661766]                      __mutex_lock+0x6e/0x990
[  309.661771]                      mutex_lock_nested+0x16/0x20
[  309.661775]                      get_online_cpus+0x61/0x80
[  309.661780]                      __cpuhp_setup_state+0x44/0x170
[  309.661785]                      page_alloc_init+0x23/0x3a
[  309.661790]                      start_kernel+0x124/0x3fe
[  309.661794]                      x86_64_start_reservations+0x2a/0x2c
[  309.661799]                      x86_64_start_kernel+0x173/0x186
[  309.661804]                      verify_cpu+0x0/0xfc
[  309.661807]   }
[  309.661813]   ... key      at: [<ffffffff81e37690>] cpu_hotplug+0xb0/0x100
[  309.661817]   ... acquired at:
[  309.661821]    lock_acquire+0xc9/0x220
[  309.661825]    __mutex_lock+0x6e/0x990
[  309.661829]    mutex_lock_nested+0x16/0x20
[  309.661833]    get_online_cpus+0x61/0x80
[  309.661837]    _rcu_barrier+0x9f/0x160
[  309.661841]    rcu_barrier+0x10/0x20
[  309.661847]    netdev_run_todo+0x5f/0x310
[  309.661852]    rtnl_unlock+0x9/0x10
[  309.661856]    default_device_exit_batch+0x133/0x150
[  309.661862]    ops_exit_list.isra.0+0x4d/0x60
[  309.661866]    cleanup_net+0x1d8/0x2c0
[  309.661872]    process_one_work+0x1f4/0x6d0
[  309.661876]    worker_thread+0x49/0x4a0
[  309.661881]    kthread+0x107/0x140
[  309.661884]    ret_from_fork+0x2e/0x40

[  309.661890] -> (rcu_preempt_state.barrier_mutex){+.+.-.} ops: 179 {
[  309.661896]    HARDIRQ-ON-W at:
[  309.661901]                     __lock_acquire+0x5e5/0x1b50
[  309.661905]                     lock_acquire+0xc9/0x220
[  309.661910]                     __mutex_lock+0x6e/0x990
[  309.661914]                     mutex_lock_nested+0x16/0x20
[  309.661919]                     _rcu_barrier+0x31/0x160
[  309.661923]                     rcu_barrier+0x10/0x20
[  309.661928]                     netdev_run_todo+0x5f/0x310
[  309.661932]                     rtnl_unlock+0x9/0x10
[  309.661936]                     default_device_exit_batch+0x133/0x150
[  309.661941]                     ops_exit_list.isra.0+0x4d/0x60
[  309.661946]                     cleanup_net+0x1d8/0x2c0
[  309.661951]                     process_one_work+0x1f4/0x6d0
[  309.661955]                     worker_thread+0x49/0x4a0
[  309.661960]                     kthread+0x107/0x140
[  309.661964]                     ret_from_fork+0x2e/0x40
[  309.661968]    SOFTIRQ-ON-W at:
[  309.661972]                     __lock_acquire+0x611/0x1b50
[  309.661977]                     lock_acquire+0xc9/0x220
[  309.661981]                     __mutex_lock+0x6e/0x990
[  309.661986]                     mutex_lock_nested+0x16/0x20
[  309.661990]                     _rcu_barrier+0x31/0x160
[  309.661995]                     rcu_barrier+0x10/0x20
[  309.661999]                     netdev_run_todo+0x5f/0x310
[  309.662003]                     rtnl_unlock+0x9/0x10
[  309.662008]                     default_device_exit_batch+0x133/0x150
[  309.662013]                     ops_exit_list.isra.0+0x4d/0x60
[  309.662017]                     cleanup_net+0x1d8/0x2c0
[  309.662022]                     process_one_work+0x1f4/0x6d0
[  309.662027]                     worker_thread+0x49/0x4a0
[  309.662031]                     kthread+0x107/0x140
[  309.662035]                     ret_from_fork+0x2e/0x40
[  309.662039]    IN-RECLAIM_FS-W at:
[  309.662043]                        __lock_acquire+0x638/0x1b50
[  309.662048]                        lock_acquire+0xc9/0x220
[  309.662053]                        __mutex_lock+0x6e/0x990
[  309.662058]                        mutex_lock_nested+0x16/0x20
[  309.662062]                        _rcu_barrier+0x31/0x160
[  309.662067]                        rcu_barrier+0x10/0x20
[  309.662089]                        i915_gem_shrink_all+0x33/0x40 [i915]
[  309.662109]                        i915_drop_caches_set+0x141/0x150 [i915]
[  309.662114]                        simple_attr_write+0xc7/0xe0
[  309.662119]                        full_proxy_write+0x4f/0x70
[  309.662124]                        __vfs_write+0x23/0x120
[  309.662128]                        vfs_write+0xc6/0x1f0
[  309.662133]                        SyS_write+0x44/0xb0
[  309.662138]                        entry_SYSCALL_64_fastpath+0x1c/0xb1
[  309.662142]    INITIAL USE at:
[  309.662147]                    __lock_acquire+0x234/0x1b50
[  309.662151]                    lock_acquire+0xc9/0x220
[  309.662156]                    __mutex_lock+0x6e/0x990
[  309.662160]                    mutex_lock_nested+0x16/0x20
[  309.662165]                    _rcu_barrier+0x31/0x160
[  309.662169]                    rcu_barrier+0x10/0x20
[  309.662174]                    netdev_run_todo+0x5f/0x310
[  309.662178]                    rtnl_unlock+0x9/0x10
[  309.662183]                    default_device_exit_batch+0x133/0x150
[  309.662188]                    ops_exit_list.isra.0+0x4d/0x60
[  309.662192]                    cleanup_net+0x1d8/0x2c0
[  309.662197]                    process_one_work+0x1f4/0x6d0
[  309.662202]                    worker_thread+0x49/0x4a0
[  309.662206]                    kthread+0x107/0x140
[  309.662210]                    ret_from_fork+0x2e/0x40
[  309.662214]  }
[  309.662220]  ... key      at: [<ffffffff81e4e1c8>] rcu_preempt_state+0x508/0x780
[  309.662225]  ... acquired at:
[  309.662229]    check_usage_forwards+0x12b/0x130
[  309.662233]    mark_lock+0x360/0x6f0
[  309.662237]    __lock_acquire+0x638/0x1b50
[  309.662241]    lock_acquire+0xc9/0x220
[  309.662245]    __mutex_lock+0x6e/0x990
[  309.662249]    mutex_lock_nested+0x16/0x20
[  309.662253]    _rcu_barrier+0x31/0x160
[  309.662257]    rcu_barrier+0x10/0x20
[  309.662279]    i915_gem_shrink_all+0x33/0x40 [i915]
[  309.662298]    i915_drop_caches_set+0x141/0x150 [i915]
[  309.662303]    simple_attr_write+0xc7/0xe0
[  309.662307]    full_proxy_write+0x4f/0x70
[  309.662311]    __vfs_write+0x23/0x120
[  309.662315]    vfs_write+0xc6/0x1f0
[  309.662319]    SyS_write+0x44/0xb0
[  309.662323]    entry_SYSCALL_64_fastpath+0x1c/0xb1

[  309.662329]
               stack backtrace:
[  309.662335] CPU: 1 PID: 6435 Comm: gem_exec_gttfil Tainted: G        W       4.11.0-rc1-CI-CI_DRM_2333+ #1
[  309.662342] Hardware name: Hewlett-Packard HP Compaq 8100 Elite SFF PC/304Ah, BIOS 786H1 v01.13 07/14/2011
[  309.662348] Call Trace:
[  309.662354]  dump_stack+0x67/0x92
[  309.662359]  print_irq_inversion_bug.part.19+0x1a4/0x1b0
[  309.662365]  check_usage_forwards+0x12b/0x130
[  309.662369]  mark_lock+0x360/0x6f0
[  309.662374]  ? print_shortest_lock_dependencies+0x1a0/0x1a0
[  309.662379]  __lock_acquire+0x638/0x1b50
[  309.662383]  ? __mutex_unlock_slowpath+0x3e/0x2e0
[  309.662388]  ? trace_hardirqs_on+0xd/0x10
[  309.662392]  ? _rcu_barrier+0x31/0x160
[  309.662396]  lock_acquire+0xc9/0x220
[  309.662400]  ? _rcu_barrier+0x31/0x160
[  309.662404]  ? _rcu_barrier+0x31/0x160
[  309.662409]  __mutex_lock+0x6e/0x990
[  309.662412]  ? _rcu_barrier+0x31/0x160
[  309.662416]  ? _rcu_barrier+0x31/0x160
[  309.662421]  ? synchronize_rcu_expedited+0x35/0xb0
[  309.662426]  ? _raw_spin_unlock_irqrestore+0x52/0x60
[  309.662434]  mutex_lock_nested+0x16/0x20
[  309.662438]  _rcu_barrier+0x31/0x160
[  309.662442]  rcu_barrier+0x10/0x20
[  309.662464]  i915_gem_shrink_all+0x33/0x40 [i915]
[  309.662484]  i915_drop_caches_set+0x141/0x150 [i915]
[  309.662489]  simple_attr_write+0xc7/0xe0
[  309.662494]  full_proxy_write+0x4f/0x70
[  309.662498]  __vfs_write+0x23/0x120
[  309.662503]  ? rcu_read_lock_sched_held+0x75/0x80
[  309.662507]  ? rcu_sync_lockdep_assert+0x2a/0x50
[  309.662512]  ? __sb_start_write+0x102/0x210
[  309.662516]  ? vfs_write+0x17d/0x1f0
[  309.662520]  vfs_write+0xc6/0x1f0
[  309.662524]  ? trace_hardirqs_on_caller+0xe7/0x200
[  309.662529]  SyS_write+0x44/0xb0
[  309.662533]  entry_SYSCALL_64_fastpath+0x1c/0xb1
[  309.662537] RIP: 0033:0x7f507eac24a0
[  309.662541] RSP: 002b:00007fffda8720e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[  309.662548] RAX: ffffffffffffffda RBX: ffffffff81482bd3 RCX: 00007f507eac24a0
[  309.662552] RDX: 0000000000000005 RSI: 00007fffda8720f0 RDI: 0000000000000005
[  309.662557] RBP: ffffc9000048bf88 R08: 0000000000000000 R09: 000000000000002c
[  309.662561] R10: 0000000000000014 R11: 0000000000000246 R12: 00007fffda872230
[  309.662566] R13: 00007fffda872228 R14: 0000000000000201 R15: 00007fffda8720f0
[  309.662572]  ? __this_cpu_preempt_check+0x13/0x20

Fixes: 0eafec6d3244 ("drm/i915: Enable lockless lookup of request tracking via RCU")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100192
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170314115019.18127-1-chris@chris-wilson.co.uk
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit bd784b7cc41af7a19cfb705fa6d800e511c4ab02)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170321144531.12344-1-chris@chris-wilson.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/i915: Stop using RP_DOWN_EI on Baytrail
Chris Wilson [Mon, 13 Mar 2017 17:06:17 +0000 (17:06 +0000)]
drm/i915: Stop using RP_DOWN_EI on Baytrail

commit 8f68d591d4765b2e1ce9d916ac7bc5583285c4ad upstream.

On Baytrail, we manually calculate busyness over the evaluation interval
to avoid issues with miscaluations with RC6 enabled. However, it turns
out that the DOWN_EI interrupt generator is completely bust - it
operates in two modes, continuous or never. Neither of which are
conducive to good behaviour. Stop unmask the DOWN_EI interrupt and just
compute everything from the UP_EI which does seem to correspond to the
desired interval.

v2: Fixup gen6_rps_pm_mask() as well
v3: Inline vlv_c0_above() to combine the now identical elapsed
calculation for up/down and simplify the threshold testing

Fixes: 43cf3bf084ba ("drm/i915: Improved w/a for rps on Baytrail")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170309211232.28878-1-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170313170617.31564-1-chris@chris-wilson.co.uk
(cherry picked from commit e0e8c7cb6eb68e9256de2d8cbeb481d3701c05ac)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/i915: Drop support for I915_EXEC_CONSTANTS_* execbuf parameters.
Kenneth Graunke [Mon, 13 Mar 2017 17:04:33 +0000 (17:04 +0000)]
drm/i915: Drop support for I915_EXEC_CONSTANTS_* execbuf parameters.

commit 0f5418e564ac6452b9086295646e602a9addc4bf upstream.

This patch makes the I915_PARAM_HAS_EXEC_CONSTANTS getparam return 0
(indicating the optional feature is not supported), and makes execbuf
always return -EINVAL if the flags are used.

Apparently, no userspace ever shipped which used this optional feature:
I checked the git history of Mesa, xf86-video-intel, libva, and Beignet,
and there were zero commits showing a use of these flags.  Kernel commit
72bfa19c8deb4 apparently introduced the feature prematurely.  According
to Chris, the intention was to use this in cairo-drm, but "the use was
broken for gen6", so I don't think it ever happened.

'relative_constants_mode' has always been tracked per-device, but this
has actually been wrong ever since hardware contexts were introduced, as
the INSTPM register is saved (and automatically restored) as part of the
render ring context. The software per-device value could therefore get
out of sync with the hardware per-context value.  This meant that using
them is actually unsafe: a client which tried to use them could damage
the state of other clients, causing the GPU to interpret their BO
offsets as absolute pointers, leading to bogus memory reads.

These flags were also never ported to execlist mode, making them no-ops
on Gen9+ (which requires execlists), and Gen8 in the default mode.

On Gen8+, userspace can write these registers directly, achieving the
same effect.  On Gen6-7.5, it likely makes sense to extend the command
parser to support them.  I don't think anyone wants this on Gen4-5.

Based on a patch by Dave Gordon.

v3: Return -ENODEV for the getparam, as this is what we do for other
    obsolete features.  Suggested by Chris Wilson.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92448
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170215093446.21291-1-kenneth@whitecape.org
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170313170433.26843-1-chris@chris-wilson.co.uk
(cherry picked from commit ef0f411f51475f4eebf9fc1b19a85be698af19ff)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/i915: Only enable hotplug interrupts if the display interrupts are enabled
Chris Wilson [Mon, 13 Mar 2017 17:02:31 +0000 (17:02 +0000)]
drm/i915: Only enable hotplug interrupts if the display interrupts are enabled

commit 35a3abfd198e6c69a6644784bb09a2d951fc6b21 upstream.

In order to prevent accessing the hpd registers outside of the display
power wells, we should refrain from writing to the registers before the
display interrupts are enabled.

[    4.740136] WARNING: CPU: 1 PID: 221 at drivers/gpu/drm/i915/intel_uncore.c:795 __unclaimed_reg_debug+0x44/0x50 [i915]
[    4.740155] Unclaimed read from register 0x1e1110
[    4.740168] Modules linked in: i915(+) intel_gtt drm_kms_helper prime_numbers
[    4.740190] CPU: 1 PID: 221 Comm: systemd-udevd Not tainted 4.10.0-rc6+ #384
[    4.740203] Hardware name:                  /        , BIOS PYBSWCEL.86A.0027.2015.0507.1758 05/07/2015
[    4.740220] Call Trace:
[    4.740236]  dump_stack+0x4d/0x6f
[    4.740251]  __warn+0xc1/0xe0
[    4.740265]  warn_slowpath_fmt+0x4a/0x50
[    4.740281]  ? insert_work+0x77/0xc0
[    4.740355]  ? fwtable_write32+0x90/0x130 [i915]
[    4.740431]  __unclaimed_reg_debug+0x44/0x50 [i915]
[    4.740507]  fwtable_read32+0xd8/0x130 [i915]
[    4.740575]  i915_hpd_irq_setup+0xa5/0x100 [i915]
[    4.740649]  intel_hpd_init+0x68/0x80 [i915]
[    4.740716]  i915_driver_load+0xe19/0x1380 [i915]
[    4.740784]  i915_pci_probe+0x32/0x90 [i915]
[    4.740799]  pci_device_probe+0x8b/0xf0
[    4.740815]  driver_probe_device+0x2b6/0x450
[    4.740828]  __driver_attach+0xda/0xe0
[    4.740841]  ? driver_probe_device+0x450/0x450
[    4.740853]  bus_for_each_dev+0x5b/0x90
[    4.740865]  driver_attach+0x19/0x20
[    4.740878]  bus_add_driver+0x166/0x260
[    4.740892]  driver_register+0x5b/0xd0
[    4.740906]  ? 0xffffffffa0166000
[    4.740920]  __pci_register_driver+0x47/0x50
[    4.740985]  i915_init+0x5c/0x5e [i915]
[    4.740999]  do_one_initcall+0x3e/0x160
[    4.741015]  ? __vunmap+0x7c/0xc0
[    4.741029]  ? kmem_cache_alloc+0xcf/0x120
[    4.741045]  do_init_module+0x55/0x1c4
[    4.741060]  load_module+0x1f3f/0x25b0
[    4.741073]  ? __symbol_put+0x40/0x40
[    4.741086]  ? kernel_read_file+0x100/0x190
[    4.741100]  SYSC_finit_module+0xbc/0xf0
[    4.741112]  SyS_finit_module+0x9/0x10
[    4.741125]  entry_SYSCALL_64_fastpath+0x17/0x98
[    4.741135] RIP: 0033:0x7f8559a140f9
[    4.741145] RSP: 002b:00007fff7509a3e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[    4.741161] RAX: ffffffffffffffda RBX: 00007f855aba02d1 RCX: 00007f8559a140f9
[    4.741172] RDX: 0000000000000000 RSI: 000055b6db0914f0 RDI: 0000000000000011
[    4.741183] RBP: 0000000000020000 R08: 0000000000000000 R09: 000000000000000e
[    4.741193] R10: 0000000000000011 R11: 0000000000000246 R12: 000055b6db0854d0
[    4.741204] R13: 000055b6db091150 R14: 0000000000000000 R15: 000055b6db035924

v2: Set dev_priv->display_irqs_enabled to true for all platforms other
than vlv/chv that manually control the display power domain.

Fixes: 19625e85c6ec ("drm/i915: Enable polling when we don't have hpd")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97798
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lyude <cpaul@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Hans de Goede <jwrdegoede@fedoraproject.org>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170215131547.5064-1-chris@chris-wilson.co.uk
Link: http://patchwork.freedesktop.org/patch/msgid/20170313170231.18633-1-chris@chris-wilson.co.uk
(cherry picked from commit 262fd485ac6b476479f41f00bb104f6a1766ae66)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/i915: Avoid tweaking evaluation thresholds on Baytrail v3
Mika Kuoppala [Wed, 15 Feb 2017 13:52:59 +0000 (15:52 +0200)]
drm/i915: Avoid tweaking evaluation thresholds on Baytrail v3

commit 34dc8993eef63681b062871413a9484008a2a78f upstream.

Certain Baytrails, namely the 4 cpu core variants, have been
plaqued by spurious system hangs, mostly occurring with light loads.

Multiple bisects by various people point to a commit which changes the
reclocking strategy for Baytrail to follow its bigger brethen:
commit 8fb55197e64d ("drm/i915: Agressive downclocking on Baytrail")

There is also a review comment attached to this commit from Deepak S
on avoiding punit access on Cherryview and thus it was excluded on
common reclocking path. By taking the same approach and omitting
the punit access by not tweaking the thresholds when the hardware
has been asked to move into different frequency, considerable gains
in stability have been observed.

With J1900 box, light render/video load would end up in system hang
in usually less than 12 hours. With this patch applied, the cumulative
uptime has now been 34 days without issues. To provoke system hang,
light loads on both render and bsd engines in parallel have been used:
glxgears >/dev/null 2>/dev/null &
mpv --vo=vaapi --hwdec=vaapi --loop=inf vid.mp4

So far, author has not witnessed system hang with above load
and this patch applied. Reports from the tenacious people at
kernel bugzilla are also promising.

Considering that the punit access frequency with this patch is
considerably less, there is a possibility that this will push
the, still unknown, root cause past the triggering point on most loads.

But as we now can reliably reproduce the hang independently,
we can reduce the pain that users are having and use a
static thresholds until a root cause is found.

v3: don't break debugfs and simplification (Chris Wilson)

References: https://bugzilla.kernel.org/show_bug.cgi?id=109051
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: fritsch@xbmc.org
Cc: miku@iki.fi
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
CC: Michal Feix <michal@feix.cz>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Deepak S <deepak.s@linux.intel.com>
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487166779-26945-1-git-send-email-mika.kuoppala@intel.com
(cherry picked from commit 6067a27d1f0184596d51decbac1c1fdc4acb012f)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/i915: Nuke debug messages from the pipe update critical section
Ville Syrjälä [Tue, 7 Mar 2017 20:54:19 +0000 (22:54 +0200)]
drm/i915: Nuke debug messages from the pipe update critical section

commit edd06b8353772dca7afcd4640dafa83b521edd55 upstream.

printks are slow so we should not be doing them from the vblank evade
critical section. These could explain why we sometimes seem to
blow past our 100 usec deadline.

The problem has been there ever since commit bfd16b2a23dc ("drm/i915:
Make updating pipe without modeset atomic.") but it may not have
been readily visible until commit e1edbd44e23b ("drm/i915: Complain
if we take too long under vblank evasion.") increased our chances
of noticing it.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: bfd16b2a23dc ("drm/i915: Make updating pipe without modeset atomic.")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170307205419.19447-1-ville.syrjala@linux.intel.com
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
(cherry picked from commit c3f8ad57a01a31397e5a0349a226a32f35ddc19c)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrm/i915/gen9: Increase PCODE request timeout to 50ms
Imre Deak [Fri, 24 Feb 2017 14:32:10 +0000 (16:32 +0200)]
drm/i915/gen9: Increase PCODE request timeout to 50ms

commit d253371c4c2f5fc2d884ef25f64decd7549aff5a upstream.

After
commit 2c7d0602c815277f7cb7c932b091288710d8aba7
Author: Imre Deak <imre.deak@intel.com>
Date:   Mon Dec 5 18:27:37 2016 +0200

    drm/i915/gen9: Fix PCODE polling during CDCLK change notification

there is still one report of the CDCLK-change request timing out on a
KBL machine, see the Reference link. On that machine the maximum time
the request took to succeed was 34ms, so increase the timeout to 50ms.

v2:
- Change timeout from 100 to 50 ms to maintain the current 50 ms limit
  for atomic waits in the driver. (Chris, Tvrtko)

Reference: https://bugs.freedesktop.org/show_bug.cgi?id=99345
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1487946730-17162-1-git-send-email-imre.deak@intel.com
(cherry picked from commit 0129936ddda26afd5d9d207c4e86b2425952579f)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoUPSTREAM: char: lack of bool string made CONFIG_DEVPORT always on
Max Bires [Tue, 3 Jan 2017 16:18:07 +0000 (08:18 -0800)]
UPSTREAM: char: lack of bool string made CONFIG_DEVPORT always on

(cherry pick from commit f2cfa58b136e4b06a9b9db7af5ef62fbb5992f62)

Without a bool string present, using "# CONFIG_DEVPORT is not set" in
defconfig files would not actually unset devport. This esnured that
/dev/port was always on, but there are reasons a user may wish to
disable it (smaller kernel, attack surface reduction) if it's not being
used. Adding a message here in order to make this user visible.

Signed-off-by: Max Bires <jbires@google.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 37210310
Bug: 36604779
Change-Id: Ib1e947526f6c6f7cdf6389923287631056f32c36

7 years agoUPSTREAM: net: socket: Make unnecessarily global sockfs_setattr() static
Tobias Klauser [Tue, 10 Jan 2017 08:30:51 +0000 (09:30 +0100)]
UPSTREAM: net: socket: Make unnecessarily global sockfs_setattr() static

Make sockfs_setattr() static as it is not used outside of net/socket.c

This fixes the following GCC warning:
net/socket.c:534:5: warning: no previous prototype for ‘sockfs_setattr’ [-Wmissing-prototypes]

Fixes: 86741ec25462 ("net: core: Add a UID field to struct sock.")
Cc: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Fixes: android-4.9 commitID 81a159106e15d2a0f746368387ef486c9d2fed07
       ("UPSTREAM: net: core: Add a UID field to struct sock.")
(cherry picked from commit dc647ec88e029307e60e6bf9988056605f11051a)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
7 years agoUPSTREAM: net: ipv4: Don't crash if passing a null sk to ip_do_redirect.
Lorenzo Colitti [Thu, 22 Dec 2016 15:33:57 +0000 (00:33 +0900)]
UPSTREAM: net: ipv4: Don't crash if passing a null sk to ip_do_redirect.

Commit e2d118a1cb5e ("net: inet: Support UID-based routing in IP
protocols.") made ip_do_redirect call sock_net(sk) to determine
the network namespace of the passed-in socket. This crashes if sk
is NULL.

Fix this by getting the network namespace from the skb instead.

Fixes: e2d118a1cb5e ("net: inet: Support UID-based routing in IP protocols.")
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Fixes: android-4.9 commitID 5044292c361587d89bcbec50da260f5ad18c8bd1
       ("UPSTREAM: net: inet: Support UID-based routing in IP protocols.")
(cherry picked from commit 7d99569460eae28b187d574aec930a4cf8b90441)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
7 years agouart: enable uart clk
Yun Cai [Wed, 12 Apr 2017 08:26:31 +0000 (16:26 +0800)]
uart: enable uart clk

PD#138714: enable uart clk and add uart A/B/C/AO_B in gxl/gxm dtsi

Change-Id: I5660762063122849cfc272514463b7af60c67079
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agoMerge "thermal: add thermal driver support for m8b" into amlogic-4.9-dev
Jianxin Pan [Fri, 14 Apr 2017 10:51:17 +0000 (03:51 -0700)]
Merge "thermal: add thermal driver support for m8b" into amlogic-4.9-dev

7 years agothermal: add thermal driver support for m8b
Tao Zeng [Fri, 14 Apr 2017 07:19:43 +0000 (15:19 +0800)]
thermal: add thermal driver support for m8b

PD#141217: proting thermal drivers for m8b

1. add dts and config for m8b;
2. add driver files for m8b

Change-Id: Ice060dab0513a6b18122c7abd319915057cac4ac
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
7 years agoPD#138714: vout: add tvout mode monitor for box
Evoke Zhang [Wed, 12 Apr 2017 06:07:31 +0000 (14:07 +0800)]
PD#138714: vout: add tvout mode monitor for box

add sysfs node /sys/class/display/mode_flag,
change mode_flag to 0 to stop monitor tvout mode.

Change-Id: Ibb3ab599c94e0beece83895605f9cc779b6dc09a
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
7 years agodts: update parameters of gpio irq for gxm
Xingyu Chen [Fri, 14 Apr 2017 08:41:39 +0000 (16:41 +0800)]
dts: update parameters of gpio irq for gxm

PD#138714: dts: update parameters of gpio irq for gxm

Change-Id: Ib5b21eadf1a12dad78db9a08fd6cc72ef21c8527
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
7 years agoefuse: support m8baby
Yun Cai [Mon, 10 Apr 2017 01:55:44 +0000 (09:55 +0800)]
efuse: support m8baby

PD#141217: initialize m8baby efuse

Change-Id: I1b88e61f952ea0431a635238770a80e221868b64
Signed-off-by: Yun Cai <yun.cai@amlogic.com>
7 years agocec: add cec drivers for m8baby
Tao Zeng [Mon, 27 Mar 2017 06:27:58 +0000 (14:27 +0800)]
cec: add cec drivers for m8baby

PD#141217: initial add cec drivers for m8baby

1. update dts config for m200;
2. update KConfig and Makefiles for compile cec drivers;
3. add driver files to support cec driver on m8baby

Change-Id: I8e96839542360e625c47c5c31f4ddd45b3b93bc7
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
7 years agodvfs: add dvfs support for m8baby
Tao Zeng [Thu, 6 Apr 2017 09:20:47 +0000 (17:20 +0800)]
dvfs: add dvfs support for m8baby

PD#141217: add dvfs drivers for m8baby

1. add dts and Kconfig/Makefile support for dvfs drivers;
2. add source code of drivers

Change-Id: I2735b31d602d0aaa4118738ebf96f88d72369628
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
7 years agocpufreq: add cpufreq drivers for m8baby
Tao Zeng [Wed, 5 Apr 2017 08:30:09 +0000 (16:30 +0800)]
cpufreq: add cpufreq drivers for m8baby

PD#141217: porting cpufreq drivers for m8baby

1. add driver source code files of cpufreq;
2. update dts and Make files;

Change-Id: I905f62ec7f89ae3f1ea06de988d23d4ef009a477
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
7 years agosaradc: add sar adc driver support for m8b
Xingyu Chen [Wed, 12 Apr 2017 11:35:52 +0000 (19:35 +0800)]
saradc: add sar adc driver support for m8b

PD#141217: add sar adc driver support for m8b

Change-Id: If0c43fe2c938d776e15d8dda03523626c6613e9f
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
7 years agodts: add m400 dts
Peipeng Zhao [Mon, 10 Apr 2017 12:07:29 +0000 (20:07 +0800)]
dts: add m400 dts

PD#141217: add m400 dts
m400 is A111 development board with SLC Nand

Change-Id: I47a3528df70f656c7d631d9c35cbca87dc702f97
Signed-off-by: Peipeng Zhao <peipeng.zhao@amlogic.com>
7 years agoosd: osd logo optimize
Pengcheng Chen [Fri, 14 Apr 2017 03:41:11 +0000 (11:41 +0800)]
osd: osd logo optimize

PD#138714: osd logo optimize
1.move logo module,merge it into osd driver
2.fix remove get_logo_vmode() api caused video.c compile error

Change-Id: I8c90c0313fbf5661082627f7a37b3e465ba594da
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
7 years agohdmitx: add VPP_POSTBLEND_H_SIZE config
Evoke Zhang [Fri, 14 Apr 2017 02:48:19 +0000 (10:48 +0800)]
hdmitx: add VPP_POSTBLEND_H_SIZE config

PD#138714: add VPP_POSTBLEND_H_SIZE config

Change-Id: I8e203690b12cae712c7c18f2fd601fc6d3fe0d40
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
7 years agoUPSTREAM: net/packet: fix overflow in check for priv area size
Andrey Konovalov [Wed, 29 Mar 2017 14:11:20 +0000 (16:11 +0200)]
UPSTREAM: net/packet: fix overflow in check for priv area size

Subtracting tp_sizeof_priv from tp_block_size and casting to int
to check whether one is less then the other doesn't always work
(both of them are unsigned ints).

Compare them as is instead.

Also cast tp_sizeof_priv to u64 before using BLK_PLUS_PRIV, as
it can overflow inside BLK_PLUS_PRIV otherwise.

Bug: 36725304
Upstream commit: 2b6867c2ce76c596676bec7d2d525af525fdc6e2
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Change-Id: I46bfbaf5f4a5d80f10ddce731a3030f191de4b28

7 years agoosd: fix osd display error for logo module not loaded
Pengcheng Chen [Thu, 13 Apr 2017 10:34:35 +0000 (18:34 +0800)]
osd: fix osd display error for logo module not loaded

PD#138714: fix osd display error for logo module not loaded

Change-Id: Ie33d76d344b47175acdbb232fd8c7265a0800450
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
7 years agoaudio: adjust pcm bclk for 24/32bit
Xing Wang [Thu, 13 Apr 2017 12:07:33 +0000 (20:07 +0800)]
audio: adjust pcm bclk for 24/32bit

PD#141217: fix pcm 24/32bit support

Change-Id: I3aae169645ec237079a17c89ce4f5361962a3e62
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
7 years agopwm: add support for m8b
Jian Hu [Thu, 13 Apr 2017 02:29:31 +0000 (10:29 +0800)]
pwm: add support for m8b

PD#141217: add pwm support for m8b
1.add support for m8b
2.add pwm driver support for txlx

verified on m8b

Change-Id: Id6980f090062d05315ca03a7248e4d318181c76c
Signed-off-by: Jian Hu <jian.hu@amlogic.com>
7 years agoi2c: add i2c support on m8b
Xuhua Zhang [Wed, 12 Apr 2017 07:35:32 +0000 (15:35 +0800)]
i2c: add i2c support on m8b

PD#141217: add i2c support on m8b.
add i2c ao~d support.

Change-Id: Ibc46745d99b172186255fc3f47be42e04480c9a9
Signed-off-by: Jian Hu <jian.hu@amlogic.com>
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
7 years agohotplug: add cpu hotplug support for m8b
Jianxin Pan [Wed, 12 Apr 2017 09:03:53 +0000 (17:03 +0800)]
hotplug: add cpu hotplug support for m8b

PD#141217: add cpu hotplug support for m8b
1) enable CONFIG_AMLOGIC_CPU_HOTPLUG
2) clusterID of M8b is 2

Change-Id: I8f6dc6ced430364beb5eb82f20cb7034eb714eb0
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
7 years agocpu_version: add cpu version for m8b
Jianxin Pan [Wed, 12 Apr 2017 13:54:08 +0000 (21:54 +0800)]
cpu_version: add cpu version for m8b

PD#141217: add cpu version for m8b

Change-Id: I2d2fd64e5d27aa7c7887bc34adab058fc1a82e44
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
7 years agoMerge 4.9.22 into android-4.9
Greg Kroah-Hartman [Wed, 12 Apr 2017 10:57:51 +0000 (12:57 +0200)]
Merge 4.9.22 into android-4.9

Changes in 4.9.22:
ppdev: check before attaching port
ppdev: fix registering same device name
drm/vmwgfx: Type-check lookups of fence objects
drm/vmwgfx: NULL pointer dereference in vmw_surface_define_ioctl()
drm/vmwgfx: avoid calling vzalloc with a 0 size in vmw_get_cap_3d_ioctl()
drm/ttm, drm/vmwgfx: Relax permission checking when opening surfaces
drm/vmwgfx: Remove getparam error message
drm/vmwgfx: fix integer overflow in vmw_surface_define_ioctl()
sysfs: be careful of error returns from ops->show()
staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
arm/arm64: KVM: Take mmap_sem in stage2_unmap_vm
arm/arm64: KVM: Take mmap_sem in kvm_arch_prepare_memory_region
kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd
iio: bmg160: reset chip when probing
arm64: mm: unaligned access by user-land should be received as SIGBUS
cfg80211: check rdev resume callback only for registered wiphy
Reset TreeId to zero on SMB2 TREE_CONNECT
mm/page_alloc.c: fix print order in show_free_areas()
ptrace: fix PTRACE_LISTEN race corrupting task->state
dm verity fec: limit error correction recursion
dm verity fec: fix bufio leaks
ACPI / gpio: do not fall back to parsing _CRS when we get a deferral
Kbuild: use cc-disable-warning consistently for maybe-uninitialized
orangefs: move features validation to fix filesystem hang
xfs: Honor FALLOC_FL_KEEP_SIZE when punching ends of files
ring-buffer: Fix return value check in test_ringbuffer()
mac80211: unconditionally start new netdev queues with iTXQ support
brcmfmac: use local iftype avoiding use-after-free of virtual interface
metag/usercopy: Drop unused macros
metag/usercopy: Fix alignment error checking
metag/usercopy: Add early abort to copy_to_user
metag/usercopy: Zero rest of buffer from copy_from_user
metag/usercopy: Set flags before ADDZ
metag/usercopy: Fix src fixup in from user rapf loops
metag/usercopy: Add missing fixups
powerpc: Disable HFSCR[TM] if TM is not supported
powerpc/mm: Add missing global TLB invalidate if cxl is active
powerpc/64: Fix flush_(d|i)cache_range() called from modules
powerpc: Don't try to fix up misaligned load-with-reservation instructions
powerpc/crypto/crc32c-vpmsum: Fix missing preempt_disable()
dm raid: fix NULL pointer dereference for raid1 without bitmap
nios2: reserve boot memory for device tree
xtensa: make __pa work with uncached KSEG addresses
s390/decompressor: fix initrd corruption caused by bss clear
s390/uaccess: get_user() should zero on failure (again)
MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels
MIPS: ralink: Fix typos in rt3883 pinctrl
MIPS: End spinlocks with .insn
MIPS: Lantiq: fix missing xbar kernel panic
MIPS: Check TLB before handle_ri_rdhwr() for Loongson-3
MIPS: Add MIPS_CPU_FTLB for Loongson-3A R2
MIPS: Flush wrong invalid FTLB entry for huge page
MIPS: c-r4k: Fix Loongson-3's vcache/scache waysize calculation
Documentation: stable-kernel-rules: fix stable-tag format
mm/mempolicy.c: fix error handling in set_mempolicy and mbind.
random: use chacha20 for get_random_int/long
drm/sun4i: tcon: Move SoC specific quirks to a DT matched data structure
drm/sun4i: Add compatible strings for A31/A31s display pipelines
drm/sun4i: Add compatible string for A31/A31s TCON (timing controller)
clk: lpc32xx: add a quirk for PWM and MS clock dividers
HID: usbhid: Add quirks for Mayflash/Dragonrise GameCube and PS3 adapters
HID: i2c-hid: add a simple quirk to fix device defects
usb: dwc3: gadget: delay unmap of bounced requests
ASoC: Intel: bytct_rt5640: change default capture settings
arm64: dts: hisi: fix hip06 sas am-max-trans quirk
net/mlx4_core: Use device ID defines
clocksource/drivers/arm_arch_timer: Don't assume clock runs in suspend
scsi: ufs: introduce UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk
HID: sensor-hub add quirk for Microsoft Surface 3
HID: sensor-hub: add quirk for Microchip MM7150
HID: multitouch: enable the Surface 3 Type Cover to report multitouch data
HID: multitouch: do not retrieve all reports for all devices
mmc: sdhci-msm: Enable few quirks
scsi: ufs: ensure that host pa_tactivate is higher than device
svcauth_gss: Close connection when dropping an incoming message
x86/intel_idle: Add CPU model 0x4a (Atom Z34xx series)
arm64: PCI: Manage controller-specific data on per-controller basis
arm64: PCI: Add local struct device pointers
PCI: thunder-pem: Factor out resource lookup
scsi: ufs: add quirk to increase host PA_SaveConfigTime
ALSA: usb-audio: add implicit fb quirk for Axe-Fx II
PCI: Expand "VPD access disabled" quirk message
ALSA: usb-audio: Add native DSD support for TEAC 501/503 DAC
platform/x86: acer-wmi: Only supports AMW0_GUID1 on acer family
nvme: simplify stripe quirk
ACPI / sysfs: Provide quirk mechanism to prevent GPE flooding
HID: usbhid: Add quirk for the Futaba TOSD-5711BB VFD
HID: usbhid: Add quirk for Mayflash/Dragonrise DolphinBar.
drm/edid: constify edid quirk list
drm/i915: fix INTEL_BDW_IDS definition
drm/i915: more .is_mobile cleanups for BDW
drm/i915: actually drive the BDW reserved IDs
ASoC: Intel: bytcr_rt5640: quirks for Insyde devices
scsi: ufs: introduce a new ufshcd_statea UFSHCD_STATE_EH_SCHEDULED
scsi: ufs: issue link starup 2 times if device isn't active
usb: chipidea: msm: Rely on core to override AHBBURST
serial: 8250_omap: Add OMAP_DMA_TX_KICK quirk for AM437x
Input: gpio_keys - add support for GPIO descriptors
ARM: davinci: PM: support da8xx DT platforms
usb: xhci: add quirk flag for broken PED bits
usb: host: xhci-plat: enable BROKEN_PED quirk if platform requested
usb: dwc3: host: pass quirk-broken-port-ped property for known broken revisions
drm/mga: remove device_is_agp callback
ARM: dts: STiH407-family: set snps,dis_u3_susphy_quirk
PCI: Add ACS quirk for Intel Union Point
sata: ahci-da850: implement a workaround for the softreset quirk
ACPI / button: Change default behavior to lid_init_state=open
ASoC: rt5670: Add missing 10EC5072 ACPI ID
ASoC: codecs: rt5670: add quirk for Lenovo Thinkpad 10
ASoC: Intel: Baytrail: add quirk for Lenovo Thinkpad 10
ASoC: Intel: cht_bsw_rt5645: harden ACPI device detection
ASoC: Intel: cht_bsw_rt5645: add Baytrail MCLK support
ACPI: save NVS memory for Lenovo G50-45
ASoC: sun4i-i2s: Add quirks to handle a31 compatible
HID: wacom: don't apply generic settings to old devices
arm: kernel: Add SMC structure parameter
firmware: qcom: scm: Fix interrupted SCM calls
drm/msm/adreno: move function declarations to header file
ARM: smccc: Update HVC comment to describe new quirk parameter
PCI: Add Broadcom Northstar2 PAXC quirk for device class and MPSS
PCI: Disable MSI for HiSilicon Hip06/Hip07 Root Ports
mmc: sdhci-of-esdhc: remove default broken-cd for ARM
PCI: Sort the list of devices with D3 delay quirk by ID
PCI: Add ACS quirk for Qualcomm QDF2400 and QDF2432
watchdog: s3c2410: Fix infinite interrupt in soft mode
platform/x86: asus-wmi: Set specified XUSB2PR value for X550LB
platform/x86: asus-wmi: Detect quirk_no_rfkill from the DSDT
x86/reboot/quirks: Add ASUS EeeBook X205TA reboot quirk
x86/reboot/quirks: Add ASUS EeeBook X205TA/W reboot quirk
usb-storage: Add ignore-residue quirk for Initio INIC-3619
x86/reboot/quirks: Fix typo in ASUS EeeBook X205TA reboot quirk
Linux 4.9.22

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
7 years agoLinux 4.9.22 v4.9.22
Greg Kroah-Hartman [Wed, 12 Apr 2017 10:41:42 +0000 (12:41 +0200)]
Linux 4.9.22