From 842838bb6a08c0c41b0a353af0ff1be5b27bc611 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 9 Aug 2021 13:24:37 +0200 Subject: [PATCH] 5.4-stable patches added patches: perf-x86-amd-don-t-touch-the-amd64_eventsel_hostonly-bit-inside-the-guest.patch soc-ixp4xx-fix-printing-resources.patch soc-ixp4xx-qmgr-fix-invalid-__iomem-access.patch spi-meson-spicc-fix-memory-leak-in-meson_spicc_remove.patch --- ...entsel_hostonly-bit-inside-the-guest.patch | 47 +++++++++++++++ queue-5.4/series | 4 ++ .../soc-ixp4xx-fix-printing-resources.patch | 57 ++++++++++++++++++ ...p4xx-qmgr-fix-invalid-__iomem-access.patch | 60 +++++++++++++++++++ ...ix-memory-leak-in-meson_spicc_remove.patch | 34 +++++++++++ 5 files changed, 202 insertions(+) create mode 100644 queue-5.4/perf-x86-amd-don-t-touch-the-amd64_eventsel_hostonly-bit-inside-the-guest.patch create mode 100644 queue-5.4/soc-ixp4xx-fix-printing-resources.patch create mode 100644 queue-5.4/soc-ixp4xx-qmgr-fix-invalid-__iomem-access.patch create mode 100644 queue-5.4/spi-meson-spicc-fix-memory-leak-in-meson_spicc_remove.patch diff --git a/queue-5.4/perf-x86-amd-don-t-touch-the-amd64_eventsel_hostonly-bit-inside-the-guest.patch b/queue-5.4/perf-x86-amd-don-t-touch-the-amd64_eventsel_hostonly-bit-inside-the-guest.patch new file mode 100644 index 00000000000..301d92edadf --- /dev/null +++ b/queue-5.4/perf-x86-amd-don-t-touch-the-amd64_eventsel_hostonly-bit-inside-the-guest.patch @@ -0,0 +1,47 @@ +From df51fe7ea1c1c2c3bfdb81279712fdd2e4ea6c27 Mon Sep 17 00:00:00 2001 +From: Like Xu +Date: Mon, 2 Aug 2021 15:08:50 +0800 +Subject: perf/x86/amd: Don't touch the AMD64_EVENTSEL_HOSTONLY bit inside the guest + +From: Like Xu + +commit df51fe7ea1c1c2c3bfdb81279712fdd2e4ea6c27 upstream. + +If we use "perf record" in an AMD Milan guest, dmesg reports a #GP +warning from an unchecked MSR access error on MSR_F15H_PERF_CTLx: + + [] unchecked MSR access error: WRMSR to 0xc0010200 (tried to write 0x0000020000110076) at rIP: 0xffffffff8106ddb4 (native_write_msr+0x4/0x20) + [] Call Trace: + [] amd_pmu_disable_event+0x22/0x90 + [] x86_pmu_stop+0x4c/0xa0 + [] x86_pmu_del+0x3a/0x140 + +The AMD64_EVENTSEL_HOSTONLY bit is defined and used on the host, +while the guest perf driver should avoid such use. + +Fixes: 1018faa6cf23 ("perf/x86/kvm: Fix Host-Only/Guest-Only counting with SVM disabled") +Signed-off-by: Like Xu +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Liam Merwick +Tested-by: Kim Phillips +Tested-by: Liam Merwick +Link: https://lkml.kernel.org/r/20210802070850.35295-1-likexu@tencent.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/events/perf_event.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/x86/events/perf_event.h ++++ b/arch/x86/events/perf_event.h +@@ -852,9 +852,10 @@ void x86_pmu_stop(struct perf_event *eve + + static inline void x86_pmu_disable_event(struct perf_event *event) + { ++ u64 disable_mask = __this_cpu_read(cpu_hw_events.perf_ctr_virt_mask); + struct hw_perf_event *hwc = &event->hw; + +- wrmsrl(hwc->config_base, hwc->config); ++ wrmsrl(hwc->config_base, hwc->config & ~disable_mask); + } + + void x86_pmu_enable_event(struct perf_event *event); diff --git a/queue-5.4/series b/queue-5.4/series index 50d46b6dd2b..4ca45274eca 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -71,3 +71,7 @@ kvm-x86-accept-userspace-interrupt-only-if-no-event-is-injected.patch kvm-do-not-leak-memory-for-duplicate-debugfs-directories.patch kvm-x86-mmu-fix-per-cpu-counter-corruption-on-32-bit-builds.patch arm64-vdso-avoid-isb-after-reading-from-cntvct_el0.patch +soc-ixp4xx-fix-printing-resources.patch +spi-meson-spicc-fix-memory-leak-in-meson_spicc_remove.patch +soc-ixp4xx-qmgr-fix-invalid-__iomem-access.patch +perf-x86-amd-don-t-touch-the-amd64_eventsel_hostonly-bit-inside-the-guest.patch diff --git a/queue-5.4/soc-ixp4xx-fix-printing-resources.patch b/queue-5.4/soc-ixp4xx-fix-printing-resources.patch new file mode 100644 index 00000000000..937fa7f8266 --- /dev/null +++ b/queue-5.4/soc-ixp4xx-fix-printing-resources.patch @@ -0,0 +1,57 @@ +From 8861452b2097bb0b5d0081a1c137fb3870b0a31f Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Fri, 8 Nov 2019 09:43:06 +0100 +Subject: soc: ixp4xx: fix printing resources + +From: Arnd Bergmann + +commit 8861452b2097bb0b5d0081a1c137fb3870b0a31f upstream. + +When compile-testing with 64-bit resource_size_t, gcc reports an invalid +printk format string: + +In file included from include/linux/dma-mapping.h:7, + from drivers/soc/ixp4xx/ixp4xx-npe.c:15: +drivers/soc/ixp4xx/ixp4xx-npe.c: In function 'ixp4xx_npe_probe': +drivers/soc/ixp4xx/ixp4xx-npe.c:694:18: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Werror=format=] + dev_info(dev, "NPE%d at 0x%08x-0x%08x not available\n", + +Use the special %pR format string to print the resources. + +Fixes: 0b458d7b10f8 ("soc: ixp4xx: npe: Pass addresses as resources") +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman +--- + drivers/soc/ixp4xx/ixp4xx-npe.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +--- a/drivers/soc/ixp4xx/ixp4xx-npe.c ++++ b/drivers/soc/ixp4xx/ixp4xx-npe.c +@@ -690,8 +690,8 @@ static int ixp4xx_npe_probe(struct platf + + if (!(ixp4xx_read_feature_bits() & + (IXP4XX_FEATURE_RESET_NPEA << i))) { +- dev_info(dev, "NPE%d at 0x%08x-0x%08x not available\n", +- i, res->start, res->end); ++ dev_info(dev, "NPE%d at %pR not available\n", ++ i, res); + continue; /* NPE already disabled or not present */ + } + npe->regs = devm_ioremap_resource(dev, res); +@@ -699,13 +699,12 @@ static int ixp4xx_npe_probe(struct platf + return PTR_ERR(npe->regs); + + if (npe_reset(npe)) { +- dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n", +- i, res->start, res->end); ++ dev_info(dev, "NPE%d at %pR does not reset\n", ++ i, res); + continue; + } + npe->valid = 1; +- dev_info(dev, "NPE%d at 0x%08x-0x%08x registered\n", +- i, res->start, res->end); ++ dev_info(dev, "NPE%d at %pR registered\n", i, res); + found++; + } + diff --git a/queue-5.4/soc-ixp4xx-qmgr-fix-invalid-__iomem-access.patch b/queue-5.4/soc-ixp4xx-qmgr-fix-invalid-__iomem-access.patch new file mode 100644 index 00000000000..eb93d2a1248 --- /dev/null +++ b/queue-5.4/soc-ixp4xx-qmgr-fix-invalid-__iomem-access.patch @@ -0,0 +1,60 @@ +From a8eee86317f11e97990d755d4615c1c0db203d08 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Tue, 3 Aug 2021 10:12:34 +0200 +Subject: soc: ixp4xx/qmgr: fix invalid __iomem access + +From: Arnd Bergmann + +commit a8eee86317f11e97990d755d4615c1c0db203d08 upstream. + +Sparse reports a compile time warning when dereferencing an +__iomem pointer: + +drivers/soc/ixp4xx/ixp4xx-qmgr.c:149:37: warning: dereference of noderef expression +drivers/soc/ixp4xx/ixp4xx-qmgr.c:153:40: warning: dereference of noderef expression +drivers/soc/ixp4xx/ixp4xx-qmgr.c:154:40: warning: dereference of noderef expression +drivers/soc/ixp4xx/ixp4xx-qmgr.c:174:38: warning: dereference of noderef expression +drivers/soc/ixp4xx/ixp4xx-qmgr.c:174:44: warning: dereference of noderef expression + +Use __raw_readl() here for consistency with the rest of the file. +This should really get converted to some proper accessor, as the +__raw functions are not meant to be used in drivers, but the driver +has used these since the start, so for the moment, let's only fix +the warning. + +Reported-by: kernel test robot +Fixes: d4c9e9fc9751 ("IXP42x: Add QMgr support for IXP425 rev. A0 processors.") +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman +--- + drivers/soc/ixp4xx/ixp4xx-qmgr.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/drivers/soc/ixp4xx/ixp4xx-qmgr.c ++++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c +@@ -145,12 +145,12 @@ static irqreturn_t qmgr_irq1_a0(int irq, + /* ACK - it may clear any bits so don't rely on it */ + __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[0]); + +- en_bitmap = qmgr_regs->irqen[0]; ++ en_bitmap = __raw_readl(&qmgr_regs->irqen[0]); + while (en_bitmap) { + i = __fls(en_bitmap); /* number of the last "low" queue */ + en_bitmap &= ~BIT(i); +- src = qmgr_regs->irqsrc[i >> 3]; +- stat = qmgr_regs->stat1[i >> 3]; ++ src = __raw_readl(&qmgr_regs->irqsrc[i >> 3]); ++ stat = __raw_readl(&qmgr_regs->stat1[i >> 3]); + if (src & 4) /* the IRQ condition is inverted */ + stat = ~stat; + if (stat & BIT(src & 3)) { +@@ -170,7 +170,8 @@ static irqreturn_t qmgr_irq2_a0(int irq, + /* ACK - it may clear any bits so don't rely on it */ + __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[1]); + +- req_bitmap = qmgr_regs->irqen[1] & qmgr_regs->statne_h; ++ req_bitmap = __raw_readl(&qmgr_regs->irqen[1]) & ++ __raw_readl(&qmgr_regs->statne_h); + while (req_bitmap) { + i = __fls(req_bitmap); /* number of the last "high" queue */ + req_bitmap &= ~BIT(i); diff --git a/queue-5.4/spi-meson-spicc-fix-memory-leak-in-meson_spicc_remove.patch b/queue-5.4/spi-meson-spicc-fix-memory-leak-in-meson_spicc_remove.patch new file mode 100644 index 00000000000..1fe1c8d25aa --- /dev/null +++ b/queue-5.4/spi-meson-spicc-fix-memory-leak-in-meson_spicc_remove.patch @@ -0,0 +1,34 @@ +From 8311ee2164c5cd1b63a601ea366f540eae89f10e Mon Sep 17 00:00:00 2001 +From: Dongliang Mu +Date: Tue, 20 Jul 2021 18:01:16 +0800 +Subject: spi: meson-spicc: fix memory leak in meson_spicc_remove + +From: Dongliang Mu + +commit 8311ee2164c5cd1b63a601ea366f540eae89f10e upstream. + +In meson_spicc_probe, the error handling code needs to clean up master +by calling spi_master_put, but the remove function does not have this +function call. This will lead to memory leak of spicc->master. + +Reported-by: Dongliang Mu +Fixes: 454fa271bc4e("spi: Add Meson SPICC driver") +Signed-off-by: Dongliang Mu +Link: https://lore.kernel.org/r/20210720100116.1438974-1-mudongliangabcd@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + drivers/spi/spi-meson-spicc.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/spi/spi-meson-spicc.c ++++ b/drivers/spi/spi-meson-spicc.c +@@ -597,6 +597,8 @@ static int meson_spicc_remove(struct pla + + clk_disable_unprepare(spicc->core); + ++ spi_master_put(spicc->master); ++ + return 0; + } + -- 2.47.3