From 5737ad85feed3e33462550f39b216912dde83236 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 30 Jan 2020 19:34:45 +0100 Subject: [PATCH] 5.5-stable patches added patches: kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch power-supply-ingenic-battery-don-t-change-scale-if-there-s-only-one.patch revert-um-enable-config_constructors.patch --- ...-changes-since-last-vcpu_load-on-vhe.patch | 57 ++++++++++ ...n-t-change-scale-if-there-s-only-one.patch | 54 +++++++++ ...revert-um-enable-config_constructors.patch | 103 ++++++++++++++++++ queue-5.5/series | 3 + 4 files changed, 217 insertions(+) create mode 100644 queue-5.5/kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch create mode 100644 queue-5.5/power-supply-ingenic-battery-don-t-change-scale-if-there-s-only-one.patch create mode 100644 queue-5.5/revert-um-enable-config_constructors.patch diff --git a/queue-5.5/kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch b/queue-5.5/kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch new file mode 100644 index 00000000000..1129e63df59 --- /dev/null +++ b/queue-5.5/kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch @@ -0,0 +1,57 @@ +From 4942dc6638b07b5326b6d2faa142635c559e7cd5 Mon Sep 17 00:00:00 2001 +From: Andrew Murray +Date: Fri, 17 Jan 2020 13:43:24 +0000 +Subject: KVM: arm64: Write arch.mdcr_el2 changes since last vcpu_load on VHE + +From: Andrew Murray + +commit 4942dc6638b07b5326b6d2faa142635c559e7cd5 upstream. + +On VHE systems arch.mdcr_el2 is written to mdcr_el2 at vcpu_load time to +set options for self-hosted debug and the performance monitors +extension. + +Unfortunately the value of arch.mdcr_el2 is not calculated until +kvm_arm_setup_debug() in the run loop after the vcpu has been loaded. +This means that the initial brief iterations of the run loop use a zero +value of mdcr_el2 - until the vcpu is preempted. This also results in a +delay between changes to vcpu->guest_debug taking effect. + +Fix this by writing to mdcr_el2 in kvm_arm_setup_debug() on VHE systems +when a change to arch.mdcr_el2 has been detected. + +Fixes: d5a21bcc2995 ("KVM: arm64: Move common VHE/non-VHE trap config in separate functions") +Cc: # 4.17.x- +Suggested-by: James Morse +Acked-by: Will Deacon +Reviewed-by: Marc Zyngier +Signed-off-by: Andrew Murray +Signed-off-by: Catalin Marinas +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm64/kvm/debug.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/arch/arm64/kvm/debug.c ++++ b/arch/arm64/kvm/debug.c +@@ -101,7 +101,7 @@ void kvm_arm_reset_debug_ptr(struct kvm_ + void kvm_arm_setup_debug(struct kvm_vcpu *vcpu) + { + bool trap_debug = !(vcpu->arch.flags & KVM_ARM64_DEBUG_DIRTY); +- unsigned long mdscr; ++ unsigned long mdscr, orig_mdcr_el2 = vcpu->arch.mdcr_el2; + + trace_kvm_arm_setup_debug(vcpu, vcpu->guest_debug); + +@@ -197,6 +197,10 @@ void kvm_arm_setup_debug(struct kvm_vcpu + if (vcpu_read_sys_reg(vcpu, MDSCR_EL1) & (DBG_MDSCR_KDE | DBG_MDSCR_MDE)) + vcpu->arch.flags |= KVM_ARM64_DEBUG_DIRTY; + ++ /* Write mdcr_el2 changes since vcpu_load on VHE systems */ ++ if (has_vhe() && orig_mdcr_el2 != vcpu->arch.mdcr_el2) ++ write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2); ++ + trace_kvm_arm_set_dreg32("MDCR_EL2", vcpu->arch.mdcr_el2); + trace_kvm_arm_set_dreg32("MDSCR_EL1", vcpu_read_sys_reg(vcpu, MDSCR_EL1)); + } diff --git a/queue-5.5/power-supply-ingenic-battery-don-t-change-scale-if-there-s-only-one.patch b/queue-5.5/power-supply-ingenic-battery-don-t-change-scale-if-there-s-only-one.patch new file mode 100644 index 00000000000..1c989b2c9bb --- /dev/null +++ b/queue-5.5/power-supply-ingenic-battery-don-t-change-scale-if-there-s-only-one.patch @@ -0,0 +1,54 @@ +From 86b9182df8bb12610d4d6feac45a69f3ed57bfd2 Mon Sep 17 00:00:00 2001 +From: Paul Cercueil +Date: Sat, 16 Nov 2019 14:56:19 +0100 +Subject: power/supply: ingenic-battery: Don't change scale if there's only one + +From: Paul Cercueil + +commit 86b9182df8bb12610d4d6feac45a69f3ed57bfd2 upstream. + +The ADC in the JZ4740 can work either in high-precision mode with a 2.5V +range, or in low-precision mode with a 7.5V range. The code in place in +this driver will select the proper scale according to the maximum +voltage of the battery. + +The JZ4770 however only has one mode, with a 6.6V range. If only one +scale is available, there's no need to change it (and nothing to change +it to), and trying to do so will fail with -EINVAL. + +Fixes: fb24ccfbe1e0 ("power: supply: add Ingenic JZ47xx battery driver.") + +Signed-off-by: Paul Cercueil +Acked-by: Artur Rojek +Cc: stable@vger.kernel.org +Signed-off-by: Sebastian Reichel +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/power/supply/ingenic-battery.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +--- a/drivers/power/supply/ingenic-battery.c ++++ b/drivers/power/supply/ingenic-battery.c +@@ -100,10 +100,17 @@ static int ingenic_battery_set_scale(str + return -EINVAL; + } + +- return iio_write_channel_attribute(bat->channel, +- scale_raw[best_idx], +- scale_raw[best_idx + 1], +- IIO_CHAN_INFO_SCALE); ++ /* Only set scale if there is more than one (fractional) entry */ ++ if (scale_len > 2) { ++ ret = iio_write_channel_attribute(bat->channel, ++ scale_raw[best_idx], ++ scale_raw[best_idx + 1], ++ IIO_CHAN_INFO_SCALE); ++ if (ret) ++ return ret; ++ } ++ ++ return 0; + } + + static enum power_supply_property ingenic_battery_properties[] = { diff --git a/queue-5.5/revert-um-enable-config_constructors.patch b/queue-5.5/revert-um-enable-config_constructors.patch new file mode 100644 index 00000000000..23a3adfb27c --- /dev/null +++ b/queue-5.5/revert-um-enable-config_constructors.patch @@ -0,0 +1,103 @@ +From 87c9366e17259040a9118e06b6dc8de986e5d3d1 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Wed, 4 Dec 2019 17:43:46 +0100 +Subject: Revert "um: Enable CONFIG_CONSTRUCTORS" + +From: Johannes Berg + +commit 87c9366e17259040a9118e06b6dc8de986e5d3d1 upstream. + +This reverts commit 786b2384bf1c ("um: Enable CONFIG_CONSTRUCTORS"). + +There are two issues with this commit, uncovered by Anton in tests +on some (Debian) systems: + +1) I completely forgot to call any constructors if CONFIG_CONSTRUCTORS + isn't set. Don't recall now if it just wasn't needed on my system, or + if I never tested this case. + +2) With that fixed, it works - with CONFIG_CONSTRUCTORS *unset*. If I + set CONFIG_CONSTRUCTORS, it fails again, which isn't totally + unexpected since whatever wanted to run is likely to have to run + before the kernel init etc. that calls the constructors in this case. + +Basically, some constructors that gcc emits (libc has?) need to run +very early during init; the failure mode otherwise was that the ptrace +fork test already failed: + +---------------------- +$ ./linux mem=512M +Core dump limits : + soft - 0 + hard - NONE +Checking that ptrace can change system call numbers...check_ptrace : child exited with exitcode 6, while expecting 0; status 0x67f +Aborted +---------------------- + +Thinking more about this, it's clear that we simply cannot support +CONFIG_CONSTRUCTORS in UML. All the cases we need now (gcov, kasan) +involve not use of the __attribute__((constructor)), but instead +some constructor code/entry generated by gcc. Therefore, we cannot +distinguish between kernel constructors and system constructors. + +Thus, revert this commit. + +Cc: stable@vger.kernel.org [5.4+] +Fixes: 786b2384bf1c ("um: Enable CONFIG_CONSTRUCTORS") +Reported-by: Anton Ivanov +Signed-off-by: Johannes Berg +Acked-by: Anton Ivanov +Signed-off-by: Greg Kroah-Hartman + +Signed-off-by: Richard Weinberger + +--- + arch/um/include/asm/common.lds.S | 2 +- + arch/um/kernel/dyn.lds.S | 1 + + init/Kconfig | 1 + + kernel/gcov/Kconfig | 2 +- + 4 files changed, 4 insertions(+), 2 deletions(-) + +--- a/arch/um/include/asm/common.lds.S ++++ b/arch/um/include/asm/common.lds.S +@@ -82,8 +82,8 @@ + __preinit_array_end = .; + } + .init_array : { +- /* dummy - we call this ourselves */ + __init_array_start = .; ++ *(.init_array) + __init_array_end = .; + } + .fini_array : { +--- a/arch/um/kernel/dyn.lds.S ++++ b/arch/um/kernel/dyn.lds.S +@@ -103,6 +103,7 @@ SECTIONS + be empty, which isn't pretty. */ + . = ALIGN(32 / 8); + .preinit_array : { *(.preinit_array) } ++ .init_array : { *(.init_array) } + .fini_array : { *(.fini_array) } + .data : { + INIT_TASK_DATA(KERNEL_STACK_SIZE) +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -54,6 +54,7 @@ config CC_DISABLE_WARN_MAYBE_UNINITIALIZ + + config CONSTRUCTORS + bool ++ depends on !UML + + config IRQ_WORK + bool +--- a/kernel/gcov/Kconfig ++++ b/kernel/gcov/Kconfig +@@ -4,7 +4,7 @@ menu "GCOV-based kernel profiling" + config GCOV_KERNEL + bool "Enable gcov-based kernel profiling" + depends on DEBUG_FS +- select CONSTRUCTORS ++ select CONSTRUCTORS if !UML + default n + ---help--- + This option enables gcov-based code profiling (e.g. for code coverage diff --git a/queue-5.5/series b/queue-5.5/series index 0699356f11a..cbdc0f676e9 100644 --- a/queue-5.5/series +++ b/queue-5.5/series @@ -51,3 +51,6 @@ crypto-af_alg-use-bh_lock_sock-in-sk_destruct.patch crypto-vmx-reject-xts-inputs-that-are-too-short.patch crypto-caam-do-not-reset-pointer-size-from-mcfgr-register.patch crypto-pcrypt-fix-user-after-free-on-module-unload.patch +kvm-arm64-write-arch.mdcr_el2-changes-since-last-vcpu_load-on-vhe.patch +revert-um-enable-config_constructors.patch +power-supply-ingenic-battery-don-t-change-scale-if-there-s-only-one.patch -- 2.47.3