From: Sasha Levin Date: Mon, 25 Apr 2022 08:25:55 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v4.9.312~46^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f1e6e8ad8bd029fad3c49a809dc156eeaecab5c;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/drm-panel-raspberrypi-touchscreen-avoid-null-deref-i.patch b/queue-4.19/drm-panel-raspberrypi-touchscreen-avoid-null-deref-i.patch new file mode 100644 index 00000000000..405baacb240 --- /dev/null +++ b/queue-4.19/drm-panel-raspberrypi-touchscreen-avoid-null-deref-i.patch @@ -0,0 +1,43 @@ +From 22ed8a923ea9483c1c642eccab2dbf578be30d9c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Apr 2022 18:25:12 +0200 +Subject: drm/panel/raspberrypi-touchscreen: Avoid NULL deref if not + initialised + +From: Dave Stevenson + +[ Upstream commit f92055ae0acb035891e988ce345d6b81a0316423 ] + +If a call to rpi_touchscreen_i2c_write from rpi_touchscreen_probe +fails before mipi_dsi_device_register_full is called, then +in trying to log the error message if uses ts->dsi->dev when +it is still NULL. + +Use ts->i2c->dev instead, which is initialised earlier in probe. + +Fixes: 2f733d6194bd ("drm/panel: Add support for the Raspberry Pi 7" Touchscreen.") +Signed-off-by: Dave Stevenson +Signed-off-by: Stefan Wahren +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20220415162513.42190-2-stefan.wahren@i2se.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +index 06bd03915973..2073e0e43e2f 100644 +--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c ++++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +@@ -233,7 +233,7 @@ static void rpi_touchscreen_i2c_write(struct rpi_touchscreen *ts, + + ret = i2c_smbus_write_byte_data(ts->i2c, reg, val); + if (ret) +- dev_err(&ts->dsi->dev, "I2C write failed: %d\n", ret); ++ dev_err(&ts->i2c->dev, "I2C write failed: %d\n", ret); + } + + static int rpi_touchscreen_write(struct rpi_touchscreen *ts, u16 reg, u32 val) +-- +2.35.1 + diff --git a/queue-4.19/drm-panel-raspberrypi-touchscreen-initialise-the-bri.patch b/queue-4.19/drm-panel-raspberrypi-touchscreen-initialise-the-bri.patch new file mode 100644 index 00000000000..71c9973a567 --- /dev/null +++ b/queue-4.19/drm-panel-raspberrypi-touchscreen-initialise-the-bri.patch @@ -0,0 +1,63 @@ +From 8cb666405811457d67ae6578f096ab92d99879b9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Apr 2022 18:25:13 +0200 +Subject: drm/panel/raspberrypi-touchscreen: Initialise the bridge in prepare + +From: Dave Stevenson + +[ Upstream commit 5f18c0782b99e26121efa93d20b76c19e17aa1dd ] + +The panel has a prepare call which is before video starts, and an +enable call which is after. +The Toshiba bridge should be configured before video, so move +the relevant power and initialisation calls to prepare. + +Fixes: 2f733d6194bd ("drm/panel: Add support for the Raspberry Pi 7" Touchscreen.") +Signed-off-by: Dave Stevenson +Signed-off-by: Stefan Wahren +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20220415162513.42190-3-stefan.wahren@i2se.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +index 2073e0e43e2f..f57eec47ef6a 100644 +--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c ++++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +@@ -269,7 +269,7 @@ static int rpi_touchscreen_noop(struct drm_panel *panel) + return 0; + } + +-static int rpi_touchscreen_enable(struct drm_panel *panel) ++static int rpi_touchscreen_prepare(struct drm_panel *panel) + { + struct rpi_touchscreen *ts = panel_to_ts(panel); + int i; +@@ -299,6 +299,13 @@ static int rpi_touchscreen_enable(struct drm_panel *panel) + rpi_touchscreen_write(ts, DSI_STARTDSI, 0x01); + msleep(100); + ++ return 0; ++} ++ ++static int rpi_touchscreen_enable(struct drm_panel *panel) ++{ ++ struct rpi_touchscreen *ts = panel_to_ts(panel); ++ + /* Turn on the backlight. */ + rpi_touchscreen_i2c_write(ts, REG_PWM, 255); + +@@ -353,7 +360,7 @@ static int rpi_touchscreen_get_modes(struct drm_panel *panel) + static const struct drm_panel_funcs rpi_touchscreen_funcs = { + .disable = rpi_touchscreen_disable, + .unprepare = rpi_touchscreen_noop, +- .prepare = rpi_touchscreen_noop, ++ .prepare = rpi_touchscreen_prepare, + .enable = rpi_touchscreen_enable, + .get_modes = rpi_touchscreen_get_modes, + }; +-- +2.35.1 + diff --git a/queue-4.19/powerpc-perf-fix-power9-event-alternatives.patch b/queue-4.19/powerpc-perf-fix-power9-event-alternatives.patch new file mode 100644 index 00000000000..2391ce675e3 --- /dev/null +++ b/queue-4.19/powerpc-perf-fix-power9-event-alternatives.patch @@ -0,0 +1,90 @@ +From f9ea4123bed085bbfe6078c87466f5319f665463 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Apr 2022 17:18:27 +0530 +Subject: powerpc/perf: Fix power9 event alternatives + +From: Athira Rajeev + +[ Upstream commit 0dcad700bb2776e3886fe0a645a4bf13b1e747cd ] + +When scheduling a group of events, there are constraint checks done to +make sure all events can go in a group. Example, one of the criteria is +that events in a group cannot use the same PMC. But platform specific +PMU supports alternative event for some of the event codes. During +perf_event_open(), if any event group doesn't match constraint check +criteria, further lookup is done to find alternative event. + +By current design, the array of alternatives events in PMU code is +expected to be sorted by column 0. This is because in +find_alternative() the return criteria is based on event code +comparison. ie. "event < ev_alt[i][0])". This optimisation is there +since find_alternative() can be called multiple times. In power9 PMU +code, the alternative event array is not sorted properly and hence there +is breakage in finding alternative events. + +To work with existing logic, fix the alternative event array to be +sorted by column 0 for power9-pmu.c + +Results: + +With alternative events, multiplexing can be avoided. That is, for +example, in power9 PM_LD_MISS_L1 (0x3e054) has alternative event, +PM_LD_MISS_L1_ALT (0x400f0). This is an identical event which can be +programmed in a different PMC. + +Before: + + # perf stat -e r3e054,r300fc + + Performance counter stats for 'system wide': + + 1057860 r3e054 (50.21%) + 379 r300fc (49.79%) + + 0.944329741 seconds time elapsed + +Since both the events are using PMC3 in this case, they are +multiplexed here. + +After: + + # perf stat -e r3e054,r300fc + + Performance counter stats for 'system wide': + + 1006948 r3e054 + 182 r300fc + +Fixes: 91e0bd1e6251 ("powerpc/perf: Add PM_LD_MISS_L1 and PM_BR_2PATH to power9 event list") +Signed-off-by: Athira Rajeev +Reviewed-by: Madhavan Srinivasan +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20220419114828.89843-1-atrajeev@linux.vnet.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/perf/power9-pmu.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/powerpc/perf/power9-pmu.c b/arch/powerpc/perf/power9-pmu.c +index c07b1615ee39..1aa083db77f1 100644 +--- a/arch/powerpc/perf/power9-pmu.c ++++ b/arch/powerpc/perf/power9-pmu.c +@@ -143,11 +143,11 @@ int p9_dd22_bl_ev[] = { + + /* Table of alternatives, sorted by column 0 */ + static const unsigned int power9_event_alternatives[][MAX_ALT] = { +- { PM_INST_DISP, PM_INST_DISP_ALT }, +- { PM_RUN_CYC_ALT, PM_RUN_CYC }, +- { PM_RUN_INST_CMPL_ALT, PM_RUN_INST_CMPL }, +- { PM_LD_MISS_L1, PM_LD_MISS_L1_ALT }, + { PM_BR_2PATH, PM_BR_2PATH_ALT }, ++ { PM_INST_DISP, PM_INST_DISP_ALT }, ++ { PM_RUN_CYC_ALT, PM_RUN_CYC }, ++ { PM_LD_MISS_L1, PM_LD_MISS_L1_ALT }, ++ { PM_RUN_INST_CMPL_ALT, PM_RUN_INST_CMPL }, + }; + + static int power9_get_alternatives(u64 event, unsigned int flags, u64 alt[]) +-- +2.35.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 56ef477284d..9a855707290 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -26,3 +26,6 @@ dpaa_eth-fix-missing-of_node_put-in-dpaa_get_ts_info.patch drm-msm-mdp5-check-the-return-of-kzalloc.patch net-macb-restart-tx-only-if-queue-pointer-is-lagging.patch stat-fix-inconsistency-between-struct-stat-and-struc.patch +drm-panel-raspberrypi-touchscreen-avoid-null-deref-i.patch +drm-panel-raspberrypi-touchscreen-initialise-the-bri.patch +powerpc-perf-fix-power9-event-alternatives.patch