From: Greg Kroah-Hartman Date: Mon, 15 Apr 2019 11:10:53 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v4.9.169~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de2fa02c2c5d92e21b936a652dd46444da3a0301;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: alarmtimer-return-correct-remaining-time.patch arm64-dts-rockchip-fix-rk3328-sdmmc0-write-errors.patch drm-i915-gvt-do-not-deliver-a-workload-if-its-creation-fails.patch drm-udl-add-a-release-method-and-delay-modeset-teardown.patch include-linux-bitrev.h-fix-constant-bitrev.patch kvm-svm-fix-potential-get_num_contig_pages-overflow.patch mm-huge_memory.c-fix-modifying-of-page-protection-by-insert_pfn_pmd.patch parisc-also-set-iaoq_b-in-instruction_pointer_set.patch parisc-detect-qemu-earlier-in-boot-process.patch parisc-regs_return_value-should-return-gpr28.patch --- diff --git a/queue-4.19/alarmtimer-return-correct-remaining-time.patch b/queue-4.19/alarmtimer-return-correct-remaining-time.patch new file mode 100644 index 00000000000..35f7c25314d --- /dev/null +++ b/queue-4.19/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.19/arm64-dts-rockchip-fix-rk3328-sdmmc0-write-errors.patch b/queue-4.19/arm64-dts-rockchip-fix-rk3328-sdmmc0-write-errors.patch new file mode 100644 index 00000000000..40e9424b04a --- /dev/null +++ b/queue-4.19/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 +@@ -1356,11 +1356,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 { +@@ -1372,14 +1372,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.19/drm-i915-gvt-do-not-deliver-a-workload-if-its-creation-fails.patch b/queue-4.19/drm-i915-gvt-do-not-deliver-a-workload-if-its-creation-fails.patch new file mode 100644 index 00000000000..d2dc3a86081 --- /dev/null +++ b/queue-4.19/drm-i915-gvt-do-not-deliver-a-workload-if-its-creation-fails.patch @@ -0,0 +1,38 @@ +From dade58ed5af6365ac50ff4259c2a0bf31219e285 Mon Sep 17 00:00:00 2001 +From: Yan Zhao +Date: Wed, 27 Mar 2019 00:54:51 -0400 +Subject: drm/i915/gvt: do not deliver a workload if its creation fails + +From: Yan Zhao + +commit dade58ed5af6365ac50ff4259c2a0bf31219e285 upstream. + +in workload creation routine, if any failure occurs, do not queue this +workload for delivery. if this failure is fatal, enter into failsafe +mode. + +Fixes: 6d76303553ba ("drm/i915/gvt: Move common vGPU workload creation into scheduler.c") +Cc: stable@vger.kernel.org #4.19+ +Cc: zhenyuw@linux.intel.com +Signed-off-by: Yan Zhao +Signed-off-by: Zhenyu Wang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/gvt/scheduler.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/i915/gvt/scheduler.c ++++ b/drivers/gpu/drm/i915/gvt/scheduler.c +@@ -1389,8 +1389,9 @@ intel_vgpu_create_workload(struct intel_ + intel_runtime_pm_put(dev_priv); + } + +- if (ret && (vgpu_is_vm_unhealthy(ret))) { +- enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR); ++ if (ret) { ++ if (vgpu_is_vm_unhealthy(ret)) ++ enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR); + intel_vgpu_destroy_workload(workload); + return ERR_PTR(ret); + } diff --git a/queue-4.19/drm-udl-add-a-release-method-and-delay-modeset-teardown.patch b/queue-4.19/drm-udl-add-a-release-method-and-delay-modeset-teardown.patch new file mode 100644 index 00000000000..eeecf7b8440 --- /dev/null +++ b/queue-4.19/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 +@@ -51,6 +51,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_unlocked = udl_gem_free_object, +--- a/drivers/gpu/drm/udl/udl_drv.h ++++ b/drivers/gpu/drm/udl/udl_drv.h +@@ -104,6 +104,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.19/include-linux-bitrev.h-fix-constant-bitrev.patch b/queue-4.19/include-linux-bitrev.h-fix-constant-bitrev.patch new file mode 100644 index 00000000000..40c00e1896c --- /dev/null +++ b/queue-4.19/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.19/kvm-svm-fix-potential-get_num_contig_pages-overflow.patch b/queue-4.19/kvm-svm-fix-potential-get_num_contig_pages-overflow.patch new file mode 100644 index 00000000000..c21253a277e --- /dev/null +++ b/queue-4.19/kvm-svm-fix-potential-get_num_contig_pages-overflow.patch @@ -0,0 +1,54 @@ +From ede885ecb2cdf8a8dd5367702e3d964ec846a2d5 Mon Sep 17 00:00:00 2001 +From: David Rientjes +Date: Tue, 19 Mar 2019 15:19:56 -0700 +Subject: kvm: svm: fix potential get_num_contig_pages overflow + +From: David Rientjes + +commit ede885ecb2cdf8a8dd5367702e3d964ec846a2d5 upstream. + +get_num_contig_pages() could potentially overflow int so make its type +consistent with its usage. + +Reported-by: Cfir Cohen +Cc: stable@vger.kernel.org +Signed-off-by: David Rientjes +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kvm/svm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/arch/x86/kvm/svm.c ++++ b/arch/x86/kvm/svm.c +@@ -6398,11 +6398,11 @@ e_free: + return ret; + } + +-static int get_num_contig_pages(int idx, struct page **inpages, +- unsigned long npages) ++static unsigned long get_num_contig_pages(unsigned long idx, ++ struct page **inpages, unsigned long npages) + { + unsigned long paddr, next_paddr; +- int i = idx + 1, pages = 1; ++ unsigned long i = idx + 1, pages = 1; + + /* find the number of contiguous pages starting from idx */ + paddr = __sme_page_pa(inpages[idx]); +@@ -6421,12 +6421,12 @@ static int get_num_contig_pages(int idx, + + static int sev_launch_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp) + { +- unsigned long vaddr, vaddr_end, next_vaddr, npages, size; ++ unsigned long vaddr, vaddr_end, next_vaddr, npages, pages, size, i; + struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info; + struct kvm_sev_launch_update_data params; + struct sev_data_launch_update_data *data; + struct page **inpages; +- int i, ret, pages; ++ int ret; + + if (!sev_guest(kvm)) + return -ENOTTY; diff --git a/queue-4.19/mm-huge_memory.c-fix-modifying-of-page-protection-by-insert_pfn_pmd.patch b/queue-4.19/mm-huge_memory.c-fix-modifying-of-page-protection-by-insert_pfn_pmd.patch new file mode 100644 index 00000000000..1b32c442e82 --- /dev/null +++ b/queue-4.19/mm-huge_memory.c-fix-modifying-of-page-protection-by-insert_pfn_pmd.patch @@ -0,0 +1,109 @@ +From c6f3c5ee40c10bb65725047a220570f718507001 Mon Sep 17 00:00:00 2001 +From: "Aneesh Kumar K.V" +Date: Fri, 5 Apr 2019 18:39:10 -0700 +Subject: mm/huge_memory.c: fix modifying of page protection by insert_pfn_pmd() + +From: Aneesh Kumar K.V + +commit c6f3c5ee40c10bb65725047a220570f718507001 upstream. + +With some architectures like ppc64, set_pmd_at() cannot cope with a +situation where there is already some (different) valid entry present. + +Use pmdp_set_access_flags() instead to modify the pfn which is built to +deal with modifying existing PMD entries. + +This is similar to commit cae85cb8add3 ("mm/memory.c: fix modifying of +page protection by insert_pfn()") + +We also do similar update w.r.t insert_pfn_pud eventhough ppc64 don't +support pud pfn entries now. + +Without this patch we also see the below message in kernel log "BUG: +non-zero pgtables_bytes on freeing mm:" + +Link: http://lkml.kernel.org/r/20190402115125.18803-1-aneesh.kumar@linux.ibm.com +Signed-off-by: Aneesh Kumar K.V +Reported-by: Chandan Rajendra +Reviewed-by: Jan Kara +Cc: Dan Williams +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/huge_memory.c | 36 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +--- a/mm/huge_memory.c ++++ b/mm/huge_memory.c +@@ -734,6 +734,21 @@ static void insert_pfn_pmd(struct vm_are + spinlock_t *ptl; + + ptl = pmd_lock(mm, pmd); ++ if (!pmd_none(*pmd)) { ++ if (write) { ++ if (pmd_pfn(*pmd) != pfn_t_to_pfn(pfn)) { ++ WARN_ON_ONCE(!is_huge_zero_pmd(*pmd)); ++ goto out_unlock; ++ } ++ entry = pmd_mkyoung(*pmd); ++ entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); ++ if (pmdp_set_access_flags(vma, addr, pmd, entry, 1)) ++ update_mmu_cache_pmd(vma, addr, pmd); ++ } ++ ++ goto out_unlock; ++ } ++ + entry = pmd_mkhuge(pfn_t_pmd(pfn, prot)); + if (pfn_t_devmap(pfn)) + entry = pmd_mkdevmap(entry); +@@ -745,11 +760,16 @@ static void insert_pfn_pmd(struct vm_are + if (pgtable) { + pgtable_trans_huge_deposit(mm, pmd, pgtable); + mm_inc_nr_ptes(mm); ++ pgtable = NULL; + } + + set_pmd_at(mm, addr, pmd, entry); + update_mmu_cache_pmd(vma, addr, pmd); ++ ++out_unlock: + spin_unlock(ptl); ++ if (pgtable) ++ pte_free(mm, pgtable); + } + + vm_fault_t vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, +@@ -800,6 +820,20 @@ static void insert_pfn_pud(struct vm_are + spinlock_t *ptl; + + ptl = pud_lock(mm, pud); ++ if (!pud_none(*pud)) { ++ if (write) { ++ if (pud_pfn(*pud) != pfn_t_to_pfn(pfn)) { ++ WARN_ON_ONCE(!is_huge_zero_pud(*pud)); ++ goto out_unlock; ++ } ++ entry = pud_mkyoung(*pud); ++ entry = maybe_pud_mkwrite(pud_mkdirty(entry), vma); ++ if (pudp_set_access_flags(vma, addr, pud, entry, 1)) ++ update_mmu_cache_pud(vma, addr, pud); ++ } ++ goto out_unlock; ++ } ++ + entry = pud_mkhuge(pfn_t_pud(pfn, prot)); + if (pfn_t_devmap(pfn)) + entry = pud_mkdevmap(entry); +@@ -809,6 +843,8 @@ static void insert_pfn_pud(struct vm_are + } + set_pud_at(mm, addr, pud, entry); + update_mmu_cache_pud(vma, addr, pud); ++ ++out_unlock: + spin_unlock(ptl); + } + diff --git a/queue-4.19/parisc-also-set-iaoq_b-in-instruction_pointer_set.patch b/queue-4.19/parisc-also-set-iaoq_b-in-instruction_pointer_set.patch new file mode 100644 index 00000000000..e5c7af7e070 --- /dev/null +++ b/queue-4.19/parisc-also-set-iaoq_b-in-instruction_pointer_set.patch @@ -0,0 +1,36 @@ +From f324fa58327791b2696628b31480e7e21c745706 Mon Sep 17 00:00:00 2001 +From: Sven Schnelle +Date: Thu, 4 Apr 2019 18:16:04 +0200 +Subject: parisc: also set iaoq_b in instruction_pointer_set() + +From: Sven Schnelle + +commit f324fa58327791b2696628b31480e7e21c745706 upstream. + +When setting the instruction pointer on PA-RISC we also need +to set the back of the instruction queue to the new offset, otherwise +we will execute on instruction from the new location, and jumping +back to the old location stored in iaoq_b. + +Signed-off-by: Sven Schnelle +Signed-off-by: Helge Deller +Fixes: 75ebedf1d263 ("parisc: Add HAVE_REGS_AND_STACK_ACCESS_API feature") +Cc: stable@vger.kernel.org # 4.19+ +Signed-off-by: Greg Kroah-Hartman + +--- + arch/parisc/include/asm/ptrace.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/parisc/include/asm/ptrace.h ++++ b/arch/parisc/include/asm/ptrace.h +@@ -28,7 +28,8 @@ static inline unsigned long regs_return_ + static inline void instruction_pointer_set(struct pt_regs *regs, + unsigned long val) + { +- regs->iaoq[0] = val; ++ regs->iaoq[0] = val; ++ regs->iaoq[1] = val + 4; + } + + /* Query offset/name of register from its name/offset */ diff --git a/queue-4.19/parisc-detect-qemu-earlier-in-boot-process.patch b/queue-4.19/parisc-detect-qemu-earlier-in-boot-process.patch new file mode 100644 index 00000000000..d6e2399f26c --- /dev/null +++ b/queue-4.19/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 +@@ -210,12 +210,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 +@@ -399,6 +399,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(); + + init_cpu_topology(); diff --git a/queue-4.19/parisc-regs_return_value-should-return-gpr28.patch b/queue-4.19/parisc-regs_return_value-should-return-gpr28.patch new file mode 100644 index 00000000000..449de349b10 --- /dev/null +++ b/queue-4.19/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]; + } + + static inline void instruction_pointer_set(struct pt_regs *regs, diff --git a/queue-4.19/series b/queue-4.19/series index 468233462d7..babdc6c121b 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -51,3 +51,13 @@ alsa-seq-fix-oob-reads-from-strlcpy.patch alsa-hda-realtek-enable-headset-mic-of-acer-travelmate-b114-21-with-alc233.patch alsa-hda-realtek-add-quirk-for-tuxedo-xc-1509.patch alsa-hda-add-two-more-machines-to-the-power_save_blacklist.patch +mm-huge_memory.c-fix-modifying-of-page-protection-by-insert_pfn_pmd.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 +parisc-also-set-iaoq_b-in-instruction_pointer_set.patch +alarmtimer-return-correct-remaining-time.patch +drm-i915-gvt-do-not-deliver-a-workload-if-its-creation-fails.patch +drm-udl-add-a-release-method-and-delay-modeset-teardown.patch +kvm-svm-fix-potential-get_num_contig_pages-overflow.patch +include-linux-bitrev.h-fix-constant-bitrev.patch