]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.4
authorSasha Levin <sashal@kernel.org>
Mon, 22 Nov 2021 01:54:52 +0000 (20:54 -0500)
committerSasha Levin <sashal@kernel.org>
Mon, 22 Nov 2021 01:54:52 +0000 (20:54 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.4/kvm-ppc-book3s-hv-use-global_toc-for-kvmppc_h_set_da.patch [new file with mode: 0644]
queue-5.4/perf-x86-intel-uncore-fix-filter_tid-mask-for-cha-ev.patch [new file with mode: 0644]
queue-5.4/perf-x86-intel-uncore-fix-iio-event-constraints-for-.patch [new file with mode: 0644]
queue-5.4/s390-kexec-fix-return-code-handling.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/kvm-ppc-book3s-hv-use-global_toc-for-kvmppc_h_set_da.patch b/queue-5.4/kvm-ppc-book3s-hv-use-global_toc-for-kvmppc_h_set_da.patch
new file mode 100644 (file)
index 0000000..50581d7
--- /dev/null
@@ -0,0 +1,64 @@
+From 640babc6b55e1b48cd3920ce1c1f74b540c01590 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 24 Sep 2021 01:10:31 +1000
+Subject: KVM: PPC: Book3S HV: Use GLOBAL_TOC for kvmppc_h_set_dabr/xdabr()
+
+From: Michael Ellerman <mpe@ellerman.id.au>
+
+[ Upstream commit dae581864609d36fb58855fd59880b4941ce9d14 ]
+
+kvmppc_h_set_dabr(), and kvmppc_h_set_xdabr() which jumps into
+it, need to use _GLOBAL_TOC to setup the kernel TOC pointer, because
+kvmppc_h_set_dabr() uses LOAD_REG_ADDR() to load dawr_force_enable.
+
+When called from hcall_try_real_mode() we have the kernel TOC in r2,
+established near the start of kvmppc_interrupt_hv(), so there is no
+issue.
+
+But they can also be called from kvmppc_pseries_do_hcall() which is
+module code, so the access ends up happening with the kvm-hv module's
+r2, which will not point at dawr_force_enable and could even cause a
+fault.
+
+With the current code layout and compilers we haven't observed a fault
+in practice, the load hits somewhere in kvm-hv.ko and silently returns
+some bogus value.
+
+Note that we we expect p8/p9 guests to use the DAWR, but SLOF uses
+h_set_dabr() to test if sc1 works correctly, see SLOF's
+lib/libhvcall/brokensc1.c.
+
+Fixes: c1fe190c0672 ("powerpc: Add force enable of DAWR on P9 option")
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Reviewed-by: Daniel Axtens <dja@axtens.net>
+Link: https://lore.kernel.org/r/20210923151031.72408-1-mpe@ellerman.id.au
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+index f9c7326672b95..c9c6619564ffa 100644
+--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
++++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+@@ -2535,7 +2535,7 @@ hcall_real_table:
+       .globl  hcall_real_table_end
+ hcall_real_table_end:
+-_GLOBAL(kvmppc_h_set_xdabr)
++_GLOBAL_TOC(kvmppc_h_set_xdabr)
+ EXPORT_SYMBOL_GPL(kvmppc_h_set_xdabr)
+       andi.   r0, r5, DABRX_USER | DABRX_KERNEL
+       beq     6f
+@@ -2545,7 +2545,7 @@ EXPORT_SYMBOL_GPL(kvmppc_h_set_xdabr)
+ 6:    li      r3, H_PARAMETER
+       blr
+-_GLOBAL(kvmppc_h_set_dabr)
++_GLOBAL_TOC(kvmppc_h_set_dabr)
+ EXPORT_SYMBOL_GPL(kvmppc_h_set_dabr)
+       li      r5, DABRX_USER | DABRX_KERNEL
+ 3:
+-- 
+2.33.0
+
diff --git a/queue-5.4/perf-x86-intel-uncore-fix-filter_tid-mask-for-cha-ev.patch b/queue-5.4/perf-x86-intel-uncore-fix-filter_tid-mask-for-cha-ev.patch
new file mode 100644 (file)
index 0000000..b37c411
--- /dev/null
@@ -0,0 +1,41 @@
+From ee1f9b035baaa415a36a671f8ad9681ae45c72ba Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 15 Nov 2021 12:03:32 +0300
+Subject: perf/x86/intel/uncore: Fix filter_tid mask for CHA events on Skylake
+ Server
+
+From: Alexander Antonov <alexander.antonov@linux.intel.com>
+
+[ Upstream commit e324234e0aa881b7841c7c713306403e12b069ff ]
+
+According Uncore Reference Manual: any of the CHA events may be filtered
+by Thread/Core-ID by using tid modifier in CHA Filter 0 Register.
+Update skx_cha_hw_config() to follow Uncore Guide.
+
+Fixes: cd34cd97b7b4 ("perf/x86/intel/uncore: Add Skylake server uncore support")
+Signed-off-by: Alexander Antonov <alexander.antonov@linux.intel.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
+Link: https://lore.kernel.org/r/20211115090334.3789-2-alexander.antonov@linux.intel.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/events/intel/uncore_snbep.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
+index 9096a1693942d..b2cc97f7c2a5c 100644
+--- a/arch/x86/events/intel/uncore_snbep.c
++++ b/arch/x86/events/intel/uncore_snbep.c
+@@ -3479,6 +3479,9 @@ static int skx_cha_hw_config(struct intel_uncore_box *box, struct perf_event *ev
+       struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
+       struct extra_reg *er;
+       int idx = 0;
++      /* Any of the CHA events may be filtered by Thread/Core-ID.*/
++      if (event->hw.config & SNBEP_CBO_PMON_CTL_TID_EN)
++              idx = SKX_CHA_MSR_PMON_BOX_FILTER_TID;
+       for (er = skx_uncore_cha_extra_regs; er->msr; er++) {
+               if (er->event != (event->hw.config & er->config_mask))
+-- 
+2.33.0
+
diff --git a/queue-5.4/perf-x86-intel-uncore-fix-iio-event-constraints-for-.patch b/queue-5.4/perf-x86-intel-uncore-fix-iio-event-constraints-for-.patch
new file mode 100644 (file)
index 0000000..87e261f
--- /dev/null
@@ -0,0 +1,38 @@
+From 48a7d40deaafaf4b54008c34ae864e871dd4ecc4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 15 Nov 2021 12:03:33 +0300
+Subject: perf/x86/intel/uncore: Fix IIO event constraints for Skylake Server
+
+From: Alexander Antonov <alexander.antonov@linux.intel.com>
+
+[ Upstream commit 3866ae319c846a612109c008f43cba80b8c15e86 ]
+
+According to the latest uncore document, COMP_BUF_OCCUPANCY (0xd5) event
+can be collected on 2-3 counters. Update uncore IIO event constraints for
+Skylake Server.
+
+Fixes: cd34cd97b7b4 ("perf/x86/intel/uncore: Add Skylake server uncore support")
+Signed-off-by: Alexander Antonov <alexander.antonov@linux.intel.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
+Link: https://lore.kernel.org/r/20211115090334.3789-3-alexander.antonov@linux.intel.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/events/intel/uncore_snbep.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
+index b2cc97f7c2a5c..0f61f46e6086f 100644
+--- a/arch/x86/events/intel/uncore_snbep.c
++++ b/arch/x86/events/intel/uncore_snbep.c
+@@ -3549,6 +3549,7 @@ static struct event_constraint skx_uncore_iio_constraints[] = {
+       UNCORE_EVENT_CONSTRAINT(0xc0, 0xc),
+       UNCORE_EVENT_CONSTRAINT(0xc5, 0xc),
+       UNCORE_EVENT_CONSTRAINT(0xd4, 0xc),
++      UNCORE_EVENT_CONSTRAINT(0xd5, 0xc),
+       EVENT_CONSTRAINT_END
+ };
+-- 
+2.33.0
+
diff --git a/queue-5.4/s390-kexec-fix-return-code-handling.patch b/queue-5.4/s390-kexec-fix-return-code-handling.patch
new file mode 100644 (file)
index 0000000..0083853
--- /dev/null
@@ -0,0 +1,80 @@
+From 2f06062940cf83ed6c2aeeb9e0c5138f08b486a9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 16 Nov 2021 11:06:38 +0100
+Subject: s390/kexec: fix return code handling
+
+From: Heiko Carstens <hca@linux.ibm.com>
+
+[ Upstream commit 20c76e242e7025bd355619ba67beb243ba1a1e95 ]
+
+kexec_file_add_ipl_report ignores that ipl_report_finish may fail and
+can return an error pointer instead of a valid pointer.
+Fix this and simplify by returning NULL in case of an error and let
+the only caller handle this case.
+
+Fixes: 99feaa717e55 ("s390/kexec_file: Create ipl report and pass to next kernel")
+Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/s390/kernel/ipl.c                | 3 ++-
+ arch/s390/kernel/machine_kexec_file.c | 8 +++++++-
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
+index 6837affc19e81..7795cdee6427d 100644
+--- a/arch/s390/kernel/ipl.c
++++ b/arch/s390/kernel/ipl.c
+@@ -1783,7 +1783,7 @@ void *ipl_report_finish(struct ipl_report *report)
+       buf = vzalloc(report->size);
+       if (!buf)
+-              return ERR_PTR(-ENOMEM);
++              goto out;
+       ptr = buf;
+       memcpy(ptr, report->ipib, report->ipib->hdr.len);
+@@ -1822,6 +1822,7 @@ void *ipl_report_finish(struct ipl_report *report)
+       }
+       BUG_ON(ptr > buf + report->size);
++out:
+       return buf;
+ }
+diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c
+index f9e4baa64b675..c1090f0b1f6a6 100644
+--- a/arch/s390/kernel/machine_kexec_file.c
++++ b/arch/s390/kernel/machine_kexec_file.c
+@@ -170,6 +170,7 @@ static int kexec_file_add_ipl_report(struct kimage *image,
+       struct kexec_buf buf;
+       unsigned long addr;
+       void *ptr, *end;
++      int ret;
+       buf.image = image;
+@@ -199,7 +200,10 @@ static int kexec_file_add_ipl_report(struct kimage *image,
+               ptr += len;
+       }
++      ret = -ENOMEM;
+       buf.buffer = ipl_report_finish(data->report);
++      if (!buf.buffer)
++              goto out;
+       buf.bufsz = data->report->size;
+       buf.memsz = buf.bufsz;
+@@ -209,7 +213,9 @@ static int kexec_file_add_ipl_report(struct kimage *image,
+               data->kernel_buf + offsetof(struct lowcore, ipl_parmblock_ptr);
+       *lc_ipl_parmblock_ptr = (__u32)buf.mem;
+-      return kexec_add_buffer(&buf);
++      ret = kexec_add_buffer(&buf);
++out:
++      return ret;
+ }
+ void *kexec_file_add_components(struct kimage *image,
+-- 
+2.33.0
+
index 3c7aae0e6841a11c331d1eb7f60951577869cd9a..6250e3b8bf1de1504208268be115f49dc65b2af4 100644 (file)
@@ -69,3 +69,7 @@ nfc-reorganize-the-functions-in-nci_request.patch
 drm-nouveau-hdmigv100.c-fix-corrupted-hdmi-vendor-in.patch
 nfc-reorder-the-logic-in-nfc_-un-register_device.patch
 perf-bench-fix-two-memory-leaks-detected-with-asan.patch
+kvm-ppc-book3s-hv-use-global_toc-for-kvmppc_h_set_da.patch
+perf-x86-intel-uncore-fix-filter_tid-mask-for-cha-ev.patch
+perf-x86-intel-uncore-fix-iio-event-constraints-for-.patch
+s390-kexec-fix-return-code-handling.patch