From 92e07fd041832e63b3512b2a10523a20e286ebb9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 15 Apr 2019 13:29:09 +0200 Subject: [PATCH] 4.14-stable patches added patches: alarmtimer-return-correct-remaining-time.patch arm64-dts-rockchip-fix-rk3328-sdmmc0-write-errors.patch drm-udl-add-a-release-method-and-delay-modeset-teardown.patch include-linux-bitrev.h-fix-constant-bitrev.patch parisc-detect-qemu-earlier-in-boot-process.patch parisc-regs_return_value-should-return-gpr28.patch --- ...mtimer-return-correct-remaining-time.patch | 38 ++++++ ...kchip-fix-rk3328-sdmmc0-write-errors.patch | 68 ++++++++++ ...se-method-and-delay-modeset-teardown.patch | 65 +++++++++ ...e-linux-bitrev.h-fix-constant-bitrev.patch | 126 ++++++++++++++++++ ...-detect-qemu-earlier-in-boot-process.patch | 55 ++++++++ ...egs_return_value-should-return-gpr28.patch | 33 +++++ queue-4.14/series | 6 + 7 files changed, 391 insertions(+) create mode 100644 queue-4.14/alarmtimer-return-correct-remaining-time.patch create mode 100644 queue-4.14/arm64-dts-rockchip-fix-rk3328-sdmmc0-write-errors.patch create mode 100644 queue-4.14/drm-udl-add-a-release-method-and-delay-modeset-teardown.patch create mode 100644 queue-4.14/include-linux-bitrev.h-fix-constant-bitrev.patch create mode 100644 queue-4.14/parisc-detect-qemu-earlier-in-boot-process.patch create mode 100644 queue-4.14/parisc-regs_return_value-should-return-gpr28.patch diff --git a/queue-4.14/alarmtimer-return-correct-remaining-time.patch b/queue-4.14/alarmtimer-return-correct-remaining-time.patch new file mode 100644 index 00000000000..35f7c25314d --- /dev/null +++ b/queue-4.14/alarmtimer-return-correct-remaining-time.patch @@ -0,0 +1,38 @@ +From 07d7e12091f4ab869cc6a4bb276399057e73b0b3 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Sun, 7 Apr 2019 21:15:42 -0700 +Subject: alarmtimer: Return correct remaining time + +From: Andrei Vagin + +commit 07d7e12091f4ab869cc6a4bb276399057e73b0b3 upstream. + +To calculate a remaining time, it's required to subtract the current time +from the expiration time. In alarm_timer_remaining() the arguments of +ktime_sub are swapped. + +Fixes: d653d8457c76 ("alarmtimer: Implement remaining callback") +Signed-off-by: Andrei Vagin +Signed-off-by: Thomas Gleixner +Reviewed-by: Mukesh Ojha +Cc: Stephen Boyd +Cc: John Stultz +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20190408041542.26338-1-avagin@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/time/alarmtimer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/time/alarmtimer.c ++++ b/kernel/time/alarmtimer.c +@@ -597,7 +597,7 @@ static ktime_t alarm_timer_remaining(str + { + struct alarm *alarm = &timr->it.alarm.alarmtimer; + +- return ktime_sub(now, alarm->node.expires); ++ return ktime_sub(alarm->node.expires, now); + } + + /** diff --git a/queue-4.14/arm64-dts-rockchip-fix-rk3328-sdmmc0-write-errors.patch b/queue-4.14/arm64-dts-rockchip-fix-rk3328-sdmmc0-write-errors.patch new file mode 100644 index 00000000000..73389fc999a --- /dev/null +++ b/queue-4.14/arm64-dts-rockchip-fix-rk3328-sdmmc0-write-errors.patch @@ -0,0 +1,68 @@ +From 09f91381fa5de1d44bc323d8bf345f5d57b3d9b5 Mon Sep 17 00:00:00 2001 +From: Peter Geis +Date: Wed, 13 Mar 2019 19:02:30 +0000 +Subject: arm64: dts: rockchip: fix rk3328 sdmmc0 write errors + +From: Peter Geis + +commit 09f91381fa5de1d44bc323d8bf345f5d57b3d9b5 upstream. + +Various rk3328 based boards experience occasional sdmmc0 write errors. +This is due to the rk3328.dtsi tx drive levels being set to 4ma, vs +8ma per the rk3328 datasheet default settings. + +Fix this by setting the tx signal pins to 8ma. +Inspiration from tonymac32's patch, +https://github.com/ayufan-rock64/linux-kernel/commit/dc1212b347e0da17c5460bcc0a56b07d02bac3f8 + +Fixes issues on the rk3328-roc-cc and the rk3328-rock64 (as per the +above commit message). + +Tested on the rk3328-roc-cc board. + +Fixes: 52e02d377a72 ("arm64: dts: rockchip: add core dtsi file for RK3328 SoCs") +Cc: stable@vger.kernel.org +Signed-off-by: Peter Geis +Signed-off-by: Heiko Stuebner +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm64/boot/dts/rockchip/rk3328.dtsi | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -1333,11 +1333,11 @@ + + sdmmc0 { + sdmmc0_clk: sdmmc0-clk { +- rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_4ma>; ++ rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_8ma>; + }; + + sdmmc0_cmd: sdmmc0-cmd { +- rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_4ma>; ++ rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_8ma>; + }; + + sdmmc0_dectn: sdmmc0-dectn { +@@ -1349,14 +1349,14 @@ + }; + + sdmmc0_bus1: sdmmc0-bus1 { +- rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_4ma>; ++ rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_8ma>; + }; + + sdmmc0_bus4: sdmmc0-bus4 { +- rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_4ma>, +- <1 RK_PA1 1 &pcfg_pull_up_4ma>, +- <1 RK_PA2 1 &pcfg_pull_up_4ma>, +- <1 RK_PA3 1 &pcfg_pull_up_4ma>; ++ rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_8ma>, ++ <1 RK_PA1 1 &pcfg_pull_up_8ma>, ++ <1 RK_PA2 1 &pcfg_pull_up_8ma>, ++ <1 RK_PA3 1 &pcfg_pull_up_8ma>; + }; + + sdmmc0_gpio: sdmmc0-gpio { diff --git a/queue-4.14/drm-udl-add-a-release-method-and-delay-modeset-teardown.patch b/queue-4.14/drm-udl-add-a-release-method-and-delay-modeset-teardown.patch new file mode 100644 index 00000000000..67ae01d2e02 --- /dev/null +++ b/queue-4.14/drm-udl-add-a-release-method-and-delay-modeset-teardown.patch @@ -0,0 +1,65 @@ +From 9b39b013037fbfa8d4b999345d9e904d8a336fc2 Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Fri, 5 Apr 2019 13:17:13 +1000 +Subject: drm/udl: add a release method and delay modeset teardown + +From: Dave Airlie + +commit 9b39b013037fbfa8d4b999345d9e904d8a336fc2 upstream. + +If we unplug a udl device, the usb callback with deinit the +mode_config struct, however userspace will still have an open +file descriptor and a framebuffer on that device. When userspace +closes the fd, we'll oops because it'll try and look stuff up +in the object idr which we've destroyed. + +This punts destroying the mode objects until release time instead. + +Cc: stable@vger.kernel.org +Reviewed-by: Daniel Vetter +Signed-off-by: Dave Airlie +Link: https://patchwork.freedesktop.org/patch/msgid/20190405031715.5959-2-airlied@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/udl/udl_drv.c | 1 + + drivers/gpu/drm/udl/udl_drv.h | 1 + + drivers/gpu/drm/udl/udl_main.c | 8 +++++++- + 3 files changed, 9 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/udl/udl_drv.c ++++ b/drivers/gpu/drm/udl/udl_drv.c +@@ -47,6 +47,7 @@ static struct drm_driver driver = { + .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME, + .load = udl_driver_load, + .unload = udl_driver_unload, ++ .release = udl_driver_release, + + /* gem hooks */ + .gem_free_object = udl_gem_free_object, +--- a/drivers/gpu/drm/udl/udl_drv.h ++++ b/drivers/gpu/drm/udl/udl_drv.h +@@ -101,6 +101,7 @@ void udl_urb_completion(struct urb *urb) + + int udl_driver_load(struct drm_device *dev, unsigned long flags); + void udl_driver_unload(struct drm_device *dev); ++void udl_driver_release(struct drm_device *dev); + + int udl_fbdev_init(struct drm_device *dev); + void udl_fbdev_cleanup(struct drm_device *dev); +--- a/drivers/gpu/drm/udl/udl_main.c ++++ b/drivers/gpu/drm/udl/udl_main.c +@@ -378,6 +378,12 @@ void udl_driver_unload(struct drm_device + udl_free_urb_list(dev); + + udl_fbdev_cleanup(dev); +- udl_modeset_cleanup(dev); + kfree(udl); + } ++ ++void udl_driver_release(struct drm_device *dev) ++{ ++ udl_modeset_cleanup(dev); ++ drm_dev_fini(dev); ++ kfree(dev); ++} diff --git a/queue-4.14/include-linux-bitrev.h-fix-constant-bitrev.patch b/queue-4.14/include-linux-bitrev.h-fix-constant-bitrev.patch new file mode 100644 index 00000000000..40c00e1896c --- /dev/null +++ b/queue-4.14/include-linux-bitrev.h-fix-constant-bitrev.patch @@ -0,0 +1,126 @@ +From 6147e136ff5071609b54f18982dea87706288e21 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Fri, 5 Apr 2019 18:38:53 -0700 +Subject: include/linux/bitrev.h: fix constant bitrev + +From: Arnd Bergmann + +commit 6147e136ff5071609b54f18982dea87706288e21 upstream. + +clang points out with hundreds of warnings that the bitrev macros have a +problem with constant input: + + drivers/hwmon/sht15.c:187:11: error: variable '__x' is uninitialized when used within its own initialization + [-Werror,-Wuninitialized] + u8 crc = bitrev8(data->val_status & 0x0F); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + include/linux/bitrev.h:102:21: note: expanded from macro 'bitrev8' + __constant_bitrev8(__x) : \ + ~~~~~~~~~~~~~~~~~~~^~~~ + include/linux/bitrev.h:67:11: note: expanded from macro '__constant_bitrev8' + u8 __x = x; \ + ~~~ ^ + +Both the bitrev and the __constant_bitrev macros use an internal +variable named __x, which goes horribly wrong when passing one to the +other. + +The obvious fix is to rename one of the variables, so this adds an extra +'_'. + +It seems we got away with this because + + - there are only a few drivers using bitrev macros + + - usually there are no constant arguments to those + + - when they are constant, they tend to be either 0 or (unsigned)-1 + (drivers/isdn/i4l/isdnhdlc.o, drivers/iio/amplifiers/ad8366.c) and + give the correct result by pure chance. + +In fact, the only driver that I could find that gets different results +with this is drivers/net/wan/slic_ds26522.c, which in turn is a driver +for fairly rare hardware (adding the maintainer to Cc for testing). + +Link: http://lkml.kernel.org/r/20190322140503.123580-1-arnd@arndb.de +Fixes: 556d2f055bf6 ("ARM: 8187/1: add CONFIG_HAVE_ARCH_BITREVERSE to support rbit instruction") +Signed-off-by: Arnd Bergmann +Reviewed-by: Nick Desaulniers +Cc: Zhao Qiang +Cc: Yalin Wang +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/bitrev.h | 46 +++++++++++++++++++++++----------------------- + 1 file changed, 23 insertions(+), 23 deletions(-) + +--- a/include/linux/bitrev.h ++++ b/include/linux/bitrev.h +@@ -34,41 +34,41 @@ static inline u32 __bitrev32(u32 x) + + #define __constant_bitrev32(x) \ + ({ \ +- u32 __x = x; \ +- __x = (__x >> 16) | (__x << 16); \ +- __x = ((__x & (u32)0xFF00FF00UL) >> 8) | ((__x & (u32)0x00FF00FFUL) << 8); \ +- __x = ((__x & (u32)0xF0F0F0F0UL) >> 4) | ((__x & (u32)0x0F0F0F0FUL) << 4); \ +- __x = ((__x & (u32)0xCCCCCCCCUL) >> 2) | ((__x & (u32)0x33333333UL) << 2); \ +- __x = ((__x & (u32)0xAAAAAAAAUL) >> 1) | ((__x & (u32)0x55555555UL) << 1); \ +- __x; \ ++ u32 ___x = x; \ ++ ___x = (___x >> 16) | (___x << 16); \ ++ ___x = ((___x & (u32)0xFF00FF00UL) >> 8) | ((___x & (u32)0x00FF00FFUL) << 8); \ ++ ___x = ((___x & (u32)0xF0F0F0F0UL) >> 4) | ((___x & (u32)0x0F0F0F0FUL) << 4); \ ++ ___x = ((___x & (u32)0xCCCCCCCCUL) >> 2) | ((___x & (u32)0x33333333UL) << 2); \ ++ ___x = ((___x & (u32)0xAAAAAAAAUL) >> 1) | ((___x & (u32)0x55555555UL) << 1); \ ++ ___x; \ + }) + + #define __constant_bitrev16(x) \ + ({ \ +- u16 __x = x; \ +- __x = (__x >> 8) | (__x << 8); \ +- __x = ((__x & (u16)0xF0F0U) >> 4) | ((__x & (u16)0x0F0FU) << 4); \ +- __x = ((__x & (u16)0xCCCCU) >> 2) | ((__x & (u16)0x3333U) << 2); \ +- __x = ((__x & (u16)0xAAAAU) >> 1) | ((__x & (u16)0x5555U) << 1); \ +- __x; \ ++ u16 ___x = x; \ ++ ___x = (___x >> 8) | (___x << 8); \ ++ ___x = ((___x & (u16)0xF0F0U) >> 4) | ((___x & (u16)0x0F0FU) << 4); \ ++ ___x = ((___x & (u16)0xCCCCU) >> 2) | ((___x & (u16)0x3333U) << 2); \ ++ ___x = ((___x & (u16)0xAAAAU) >> 1) | ((___x & (u16)0x5555U) << 1); \ ++ ___x; \ + }) + + #define __constant_bitrev8x4(x) \ + ({ \ +- u32 __x = x; \ +- __x = ((__x & (u32)0xF0F0F0F0UL) >> 4) | ((__x & (u32)0x0F0F0F0FUL) << 4); \ +- __x = ((__x & (u32)0xCCCCCCCCUL) >> 2) | ((__x & (u32)0x33333333UL) << 2); \ +- __x = ((__x & (u32)0xAAAAAAAAUL) >> 1) | ((__x & (u32)0x55555555UL) << 1); \ +- __x; \ ++ u32 ___x = x; \ ++ ___x = ((___x & (u32)0xF0F0F0F0UL) >> 4) | ((___x & (u32)0x0F0F0F0FUL) << 4); \ ++ ___x = ((___x & (u32)0xCCCCCCCCUL) >> 2) | ((___x & (u32)0x33333333UL) << 2); \ ++ ___x = ((___x & (u32)0xAAAAAAAAUL) >> 1) | ((___x & (u32)0x55555555UL) << 1); \ ++ ___x; \ + }) + + #define __constant_bitrev8(x) \ + ({ \ +- u8 __x = x; \ +- __x = (__x >> 4) | (__x << 4); \ +- __x = ((__x & (u8)0xCCU) >> 2) | ((__x & (u8)0x33U) << 2); \ +- __x = ((__x & (u8)0xAAU) >> 1) | ((__x & (u8)0x55U) << 1); \ +- __x; \ ++ u8 ___x = x; \ ++ ___x = (___x >> 4) | (___x << 4); \ ++ ___x = ((___x & (u8)0xCCU) >> 2) | ((___x & (u8)0x33U) << 2); \ ++ ___x = ((___x & (u8)0xAAU) >> 1) | ((___x & (u8)0x55U) << 1); \ ++ ___x; \ + }) + + #define bitrev32(x) \ diff --git a/queue-4.14/parisc-detect-qemu-earlier-in-boot-process.patch b/queue-4.14/parisc-detect-qemu-earlier-in-boot-process.patch new file mode 100644 index 00000000000..f8352951ed0 --- /dev/null +++ b/queue-4.14/parisc-detect-qemu-earlier-in-boot-process.patch @@ -0,0 +1,55 @@ +From d006e95b5561f708d0385e9677ffe2c46f2ae345 Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Tue, 2 Apr 2019 12:13:27 +0200 +Subject: parisc: Detect QEMU earlier in boot process + +From: Helge Deller + +commit d006e95b5561f708d0385e9677ffe2c46f2ae345 upstream. + +While adding LASI support to QEMU, I noticed that the QEMU detection in +the kernel happens much too late. For example, when a LASI chip is found +by the kernel, it registers the LASI LED driver as well. But when we +run on QEMU it makes sense to avoid spending unnecessary CPU cycles, so +we need to access the running_on_QEMU flag earlier than before. + +This patch now makes the QEMU detection the fist task of the Linux +kernel by moving it to where the kernel enters the C-coding. + +Fixes: 310d82784fb4 ("parisc: qemu idle sleep support") +Signed-off-by: Helge Deller +Cc: stable@vger.kernel.org # v4.14+ +Signed-off-by: Greg Kroah-Hartman + +--- + arch/parisc/kernel/process.c | 6 ------ + arch/parisc/kernel/setup.c | 3 +++ + 2 files changed, 3 insertions(+), 6 deletions(-) + +--- a/arch/parisc/kernel/process.c ++++ b/arch/parisc/kernel/process.c +@@ -209,12 +209,6 @@ void __cpuidle arch_cpu_idle(void) + + static int __init parisc_idle_init(void) + { +- const char *marker; +- +- /* check QEMU/SeaBIOS marker in PAGE0 */ +- marker = (char *) &PAGE0->pad0; +- running_on_qemu = (memcmp(marker, "SeaBIOS", 8) == 0); +- + if (!running_on_qemu) + cpu_idle_poll_ctrl(1); + +--- a/arch/parisc/kernel/setup.c ++++ b/arch/parisc/kernel/setup.c +@@ -406,6 +406,9 @@ void __init start_parisc(void) + int ret, cpunum; + struct pdc_coproc_cfg coproc_cfg; + ++ /* check QEMU/SeaBIOS marker in PAGE0 */ ++ running_on_qemu = (memcmp(&PAGE0->pad0, "SeaBIOS", 8) == 0); ++ + cpunum = smp_processor_id(); + + set_firmware_width_unlocked(); diff --git a/queue-4.14/parisc-regs_return_value-should-return-gpr28.patch b/queue-4.14/parisc-regs_return_value-should-return-gpr28.patch new file mode 100644 index 00000000000..9b5a3e311f4 --- /dev/null +++ b/queue-4.14/parisc-regs_return_value-should-return-gpr28.patch @@ -0,0 +1,33 @@ +From 45efd871bf0a47648f119d1b41467f70484de5bc Mon Sep 17 00:00:00 2001 +From: Sven Schnelle +Date: Thu, 4 Apr 2019 18:16:03 +0200 +Subject: parisc: regs_return_value() should return gpr28 + +From: Sven Schnelle + +commit 45efd871bf0a47648f119d1b41467f70484de5bc upstream. + +While working on kretprobes for PA-RISC I was wondering while the +kprobes sanity test always fails on kretprobes. This is caused by +returning gpr20 instead of gpr28. + +Signed-off-by: Sven Schnelle +Signed-off-by: Helge Deller +Cc: stable@vger.kernel.org # 4.14+ +Signed-off-by: Greg Kroah-Hartman + +--- + arch/parisc/include/asm/ptrace.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/parisc/include/asm/ptrace.h ++++ b/arch/parisc/include/asm/ptrace.h +@@ -22,7 +22,7 @@ unsigned long profile_pc(struct pt_regs + + static inline unsigned long regs_return_value(struct pt_regs *regs) + { +- return regs->gr[20]; ++ return regs->gr[28]; + } + + #endif diff --git a/queue-4.14/series b/queue-4.14/series index 7d15832df48..5959ccb9cd5 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -36,3 +36,9 @@ net-ethtool-not-call-vzalloc-for-zero-sized-memory-request.patch alsa-seq-fix-oob-reads-from-strlcpy.patch ip6_tunnel-match-to-arphrd_tunnel6-for-dev-type.patch hv_netvsc-fix-unwanted-wakeup-after-tx_disable.patch +arm64-dts-rockchip-fix-rk3328-sdmmc0-write-errors.patch +parisc-detect-qemu-earlier-in-boot-process.patch +parisc-regs_return_value-should-return-gpr28.patch +alarmtimer-return-correct-remaining-time.patch +drm-udl-add-a-release-method-and-delay-modeset-teardown.patch +include-linux-bitrev.h-fix-constant-bitrev.patch -- 2.47.2