From 7f85a771e93889cabb96cc9351cfe0a9f5fb4377 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 2 Oct 2023 07:02:50 -0400 Subject: [PATCH] Fixes for 6.5 Signed-off-by: Sasha Levin --- ...-do-not-use-wait-event-interruptible.patch | 67 ++++++ ...pu-use-cached-buffers-for-fw-loading.patch | 101 ++++++++ ...fix-bandgap-thermal-cells-addressing.patch | 89 ++++++++ ...motorola-mapphone-fix-abe_clkctrl-wa.patch | 56 +++++ ...s-imx-add-imx8mm-prt8mm.dtb-to-build.patch | 34 +++ ...rm64-dts-imx8mm-evk-fix-hdmi-3d-node.patch | 112 +++++++++ ...x8mp-beacon-kit-fix-audio_pll2-clock.patch | 50 ++++ .../arm64-dts-imx8mp-fix-sdma2-3-clocks.patch | 61 +++++ ...sysc-fix-missing-am35xx-soc-matching.patch | 83 +++++++ ...sysc_quirk_swsup_sidle_act-handling-.patch | 85 +++++++ ...fsleep-instead-of-usleep_range-in-sy.patch | 49 ++++ ...lk-si521xx-fix-regmap-write-accessor.patch | 65 ++++++ ...xx-use-regcache_flat-instead-of-none.patch | 40 ++++ ...-thm_parents-incorrect-configuration.patch | 38 ++++ ...ix-error-return-case-for-recalc_rate.patch | 40 ++++ ...-don-t-set-the-memory-region-attribu.patch | 65 ++++++ ...i-fixup-perf-power-cost-microwatt-su.patch | 50 ++++ ..._scmi-harden-perf-domain-info-access.patch | 215 ++++++++++++++++++ ...-fix-an-error-handling-path-in-imx_d.patch | 37 +++ ...rd-add-can_sleep-flag-for-pmic-eic-c.patch | 39 ++++ ...7xx-fix-callback-completion-ordering.patch | 77 +++++++ ...time-pm-in-busyness-worker-only-if-a.patch | 122 ++++++++++ ...sv4-read-results-when-rq_splice_ok-i.patch | 63 +++++ ...ly-core-fix-use-after-free-in-uevent.patch | 101 ++++++++ ...370-fix-missing-error-code-in-mt6370.patch | 40 ++++ ...-supply-rk817-fix-node-refcount-leak.patch | 64 ++++++ ...er-supply-rt9467-fix-rt9467_run_aicl.patch | 42 ++++ ...1002-fix-error-code-in-ucs1002_get_p.patch | 39 ++++ ...cktrace-fix-arch_stack_walk_reliable.patch | 75 ++++++ ...c-fix-emit_tests-to-work-with-run_ks.patch | 97 ++++++++ queue-6.5/series | 37 +++ ...-ocotp-clock-for-imx8mm-before-readi.patch | 65 ++++++ ...b-use-the-calculated-number-of-areas.patch | 46 ++++ ...ault-definition-for-xchal_have_div32.patch | 45 ++++ .../xtensa-boot-don-t-add-include-dirs.patch | 43 ++++ ...nsa-boot-lib-fix-function-prototypes.patch | 52 +++++ ...sa-iss-network-make-functions-static.patch | 53 +++++ ...umulsidi3-fix-conditional-expression.patch | 49 ++++ 38 files changed, 2486 insertions(+) create mode 100644 queue-6.5/accel-ivpu-do-not-use-wait-event-interruptible.patch create mode 100644 queue-6.5/accel-ivpu-use-cached-buffers-for-fw-loading.patch create mode 100644 queue-6.5/arm-dts-ti-omap-fix-bandgap-thermal-cells-addressing.patch create mode 100644 queue-6.5/arm-dts-ti-omap-motorola-mapphone-fix-abe_clkctrl-wa.patch create mode 100644 queue-6.5/arm64-dts-imx-add-imx8mm-prt8mm.dtb-to-build.patch create mode 100644 queue-6.5/arm64-dts-imx8mm-evk-fix-hdmi-3d-node.patch create mode 100644 queue-6.5/arm64-dts-imx8mp-beacon-kit-fix-audio_pll2-clock.patch create mode 100644 queue-6.5/arm64-dts-imx8mp-fix-sdma2-3-clocks.patch create mode 100644 queue-6.5/bus-ti-sysc-fix-missing-am35xx-soc-matching.patch create mode 100644 queue-6.5/bus-ti-sysc-fix-sysc_quirk_swsup_sidle_act-handling-.patch create mode 100644 queue-6.5/bus-ti-sysc-use-fsleep-instead-of-usleep_range-in-sy.patch create mode 100644 queue-6.5/clk-si521xx-fix-regmap-write-accessor.patch create mode 100644 queue-6.5/clk-si521xx-use-regcache_flat-instead-of-none.patch create mode 100644 queue-6.5/clk-sprd-fix-thm_parents-incorrect-configuration.patch create mode 100644 queue-6.5/clk-tegra-fix-error-return-case-for-recalc_rate.patch create mode 100644 queue-6.5/firmware-arm_ffa-don-t-set-the-memory-region-attribu.patch create mode 100644 queue-6.5/firmware-arm_scmi-fixup-perf-power-cost-microwatt-su.patch create mode 100644 queue-6.5/firmware-arm_scmi-harden-perf-domain-info-access.patch create mode 100644 queue-6.5/firmware-imx-dsp-fix-an-error-handling-path-in-imx_d.patch create mode 100644 queue-6.5/gpio-pmic-eic-sprd-add-can_sleep-flag-for-pmic-eic-c.patch create mode 100644 queue-6.5/i2c-npcm7xx-fix-callback-completion-ordering.patch create mode 100644 queue-6.5/i915-guc-get-runtime-pm-in-busyness-worker-only-if-a.patch create mode 100644 queue-6.5/nfsd-fix-zero-nfsv4-read-results-when-rq_splice_ok-i.patch create mode 100644 queue-6.5/power-supply-core-fix-use-after-free-in-uevent.patch create mode 100644 queue-6.5/power-supply-mt6370-fix-missing-error-code-in-mt6370.patch create mode 100644 queue-6.5/power-supply-rk817-fix-node-refcount-leak.patch create mode 100644 queue-6.5/power-supply-rt9467-fix-rt9467_run_aicl.patch create mode 100644 queue-6.5/power-supply-ucs1002-fix-error-code-in-ucs1002_get_p.patch create mode 100644 queue-6.5/powerpc-stacktrace-fix-arch_stack_walk_reliable.patch create mode 100644 queue-6.5/selftests-powerpc-fix-emit_tests-to-work-with-run_ks.patch create mode 100644 queue-6.5/soc-imx8m-enable-ocotp-clock-for-imx8mm-before-readi.patch create mode 100644 queue-6.5/swiotlb-use-the-calculated-number-of-areas.patch create mode 100644 queue-6.5/xtensa-add-default-definition-for-xchal_have_div32.patch create mode 100644 queue-6.5/xtensa-boot-don-t-add-include-dirs.patch create mode 100644 queue-6.5/xtensa-boot-lib-fix-function-prototypes.patch create mode 100644 queue-6.5/xtensa-iss-network-make-functions-static.patch create mode 100644 queue-6.5/xtensa-umulsidi3-fix-conditional-expression.patch diff --git a/queue-6.5/accel-ivpu-do-not-use-wait-event-interruptible.patch b/queue-6.5/accel-ivpu-do-not-use-wait-event-interruptible.patch new file mode 100644 index 00000000000..66d11e34b44 --- /dev/null +++ b/queue-6.5/accel-ivpu-do-not-use-wait-event-interruptible.patch @@ -0,0 +1,67 @@ +From 9c4d78586692f7050720d4e63a5fff792e040578 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Sep 2023 14:11:32 +0200 +Subject: accel/ivpu: Do not use wait event interruptible + +From: Stanislaw Gruszka + +[ Upstream commit b0873eead1d1eadf13b5c80ad5d8f88b91e4910a ] + +If we receive signal when waiting for IPC message response in +ivpu_ipc_receive() we return error and continue to operate. +Then the driver can send another IPC messages and re-use occupied +slot of the message still processed by the firmware. This can result +in corrupting firmware memory and following FW crash with messages: + +[ 3698.569719] intel_vpu 0000:00:0b.0: [drm] ivpu_ipc_send_receive_internal(): IPC receive failed: type 0x1103, ret -512 +[ 3698.569747] intel_vpu 0000:00:0b.0: [drm] ivpu_jsm_unregister_db(): Failed to unregister doorbell 3: -512 +[ 3698.569756] intel_vpu 0000:00:0b.0: [drm] ivpu_ipc_tx_prepare(): IPC message vpu:0x88980000 not released by firmware +[ 3698.569763] intel_vpu 0000:00:0b.0: [drm] ivpu_ipc_tx_prepare(): JSM message vpu:0x88980040 not released by firmware +[ 3698.570234] intel_vpu 0000:00:0b.0: [drm] ivpu_ipc_send_receive_internal(): IPC receive failed: type 0x110e, ret -512 +[ 3698.570318] intel_vpu 0000:00:0b.0: [drm] *ERROR* ivpu_mmu_dump_event(): MMU EVTQ: 0x10 (Translation fault) SSID: 0 SID: 3, e[2] 00000000, e[3] 00000208, in addr: 0x88988000, fetch addr: 0x0 + +To fix the issue don't use interruptible variant of wait event to +allow firmware to finish IPC processing. + +Fixes: 5d7422cfb498 ("accel/ivpu: Add IPC driver and JSM messages") +Reviewed-by: Karol Wachowski +Reviewed-by: Jeffrey Hugo +Signed-off-by: Stanislaw Gruszka +Link: https://patchwork.freedesktop.org/patch/msgid/20230925121137.872158-2-stanislaw.gruszka@linux.intel.com +Signed-off-by: Sasha Levin +--- + drivers/accel/ivpu/ivpu_ipc.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/drivers/accel/ivpu/ivpu_ipc.c b/drivers/accel/ivpu/ivpu_ipc.c +index fa0af59e39ab6..295c0d7b50398 100644 +--- a/drivers/accel/ivpu/ivpu_ipc.c ++++ b/drivers/accel/ivpu/ivpu_ipc.c +@@ -209,10 +209,10 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, + struct ivpu_ipc_rx_msg *rx_msg; + int wait_ret, ret = 0; + +- wait_ret = wait_event_interruptible_timeout(cons->rx_msg_wq, +- (IS_KTHREAD() && kthread_should_stop()) || +- !list_empty(&cons->rx_msg_list), +- msecs_to_jiffies(timeout_ms)); ++ wait_ret = wait_event_timeout(cons->rx_msg_wq, ++ (IS_KTHREAD() && kthread_should_stop()) || ++ !list_empty(&cons->rx_msg_list), ++ msecs_to_jiffies(timeout_ms)); + + if (IS_KTHREAD() && kthread_should_stop()) + return -EINTR; +@@ -220,9 +220,6 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, + if (wait_ret == 0) + return -ETIMEDOUT; + +- if (wait_ret < 0) +- return -ERESTARTSYS; +- + spin_lock_irq(&cons->rx_msg_lock); + rx_msg = list_first_entry_or_null(&cons->rx_msg_list, struct ivpu_ipc_rx_msg, link); + if (!rx_msg) { +-- +2.40.1 + diff --git a/queue-6.5/accel-ivpu-use-cached-buffers-for-fw-loading.patch b/queue-6.5/accel-ivpu-use-cached-buffers-for-fw-loading.patch new file mode 100644 index 00000000000..7b17c04dd5e --- /dev/null +++ b/queue-6.5/accel-ivpu-use-cached-buffers-for-fw-loading.patch @@ -0,0 +1,101 @@ +From d53162f7ce5305511d121711bfb875accbfb833d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 Sep 2023 14:09:43 +0200 +Subject: accel/ivpu: Use cached buffers for FW loading + +From: Karol Wachowski + +[ Upstream commit 645d694559cab36fe6a57c717efcfa27d9321396 ] + +Create buffers with cache coherency on the CPU side (write-back) while +disabling snooping on the VPU side. These buffers require an explicit +cache flush after each CPU-side modification. + +Configuring pages as write-combined may introduce significant delays, +potentially taking hundreds of milliseconds for 64 MB buffers. + +Added internal DRM_IVPU_BO_NOSNOOP mask which disables snooping on the +VPU side. Allocate FW runtime memory buffer (64 MB) as cached with +snooping-disabled. + +This fixes random long FW loading times and boot params memory +corruption on warmboot (due to missed wmb). + +Fixes: 02d5b0aacd05 ("accel/ivpu: Implement firmware parsing and booting") +Signed-off-by: Karol Wachowski +Reviewed-by: Stanislaw Gruszka +Reviewed-by: Jeffrey Hugo +Signed-off-by: Stanislaw Gruszka +Link: https://patchwork.freedesktop.org/patch/msgid/20230926120943.GD846747@linux.intel.com +Signed-off-by: Sasha Levin +--- + drivers/accel/ivpu/ivpu_fw.c | 8 +++++--- + drivers/accel/ivpu/ivpu_gem.h | 5 +++++ + 2 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c +index f58951a0d81b1..93c69aaa6218d 100644 +--- a/drivers/accel/ivpu/ivpu_fw.c ++++ b/drivers/accel/ivpu/ivpu_fw.c +@@ -195,7 +195,8 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev) + if (ret) + return ret; + +- fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size, DRM_IVPU_BO_WC); ++ fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size, ++ DRM_IVPU_BO_CACHED | DRM_IVPU_BO_NOSNOOP); + if (!fw->mem) { + ivpu_err(vdev, "Failed to allocate firmware runtime memory\n"); + return -ENOMEM; +@@ -272,7 +273,7 @@ int ivpu_fw_load(struct ivpu_device *vdev) + memset(start, 0, size); + } + +- wmb(); /* Flush WC buffers after writing fw->mem */ ++ clflush_cache_range(fw->mem->kvaddr, fw->mem->base.size); + + return 0; + } +@@ -374,6 +375,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params + if (!ivpu_fw_is_cold_boot(vdev)) { + boot_params->save_restore_ret_address = 0; + vdev->pm->is_warmboot = true; ++ clflush_cache_range(vdev->fw->mem->kvaddr, SZ_4K); + return; + } + +@@ -428,7 +430,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params + boot_params->punit_telemetry_sram_size = ivpu_hw_reg_telemetry_size_get(vdev); + boot_params->vpu_telemetry_enable = ivpu_hw_reg_telemetry_enable_get(vdev); + +- wmb(); /* Flush WC buffers after writing bootparams */ ++ clflush_cache_range(vdev->fw->mem->kvaddr, SZ_4K); + + ivpu_fw_boot_params_print(vdev, boot_params); + } +diff --git a/drivers/accel/ivpu/ivpu_gem.h b/drivers/accel/ivpu/ivpu_gem.h +index 6b0ceda5f2537..f4130586ff1b2 100644 +--- a/drivers/accel/ivpu/ivpu_gem.h ++++ b/drivers/accel/ivpu/ivpu_gem.h +@@ -8,6 +8,8 @@ + #include + #include + ++#define DRM_IVPU_BO_NOSNOOP 0x10000000 ++ + struct dma_buf; + struct ivpu_bo_ops; + struct ivpu_file_priv; +@@ -83,6 +85,9 @@ static inline u32 ivpu_bo_cache_mode(struct ivpu_bo *bo) + + static inline bool ivpu_bo_is_snooped(struct ivpu_bo *bo) + { ++ if (bo->flags & DRM_IVPU_BO_NOSNOOP) ++ return false; ++ + return ivpu_bo_cache_mode(bo) == DRM_IVPU_BO_CACHED; + } + +-- +2.40.1 + diff --git a/queue-6.5/arm-dts-ti-omap-fix-bandgap-thermal-cells-addressing.patch b/queue-6.5/arm-dts-ti-omap-fix-bandgap-thermal-cells-addressing.patch new file mode 100644 index 00000000000..16d270b16d7 --- /dev/null +++ b/queue-6.5/arm-dts-ti-omap-fix-bandgap-thermal-cells-addressing.patch @@ -0,0 +1,89 @@ +From c28681d39b976f754f4e0219d8bb5b1467e22000 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Sep 2023 07:07:38 +0300 +Subject: ARM: dts: ti: omap: Fix bandgap thermal cells addressing for omap3/4 + +From: Tony Lindgren + +[ Upstream commit 6469b2feade8fd82d224dd3734e146536f3e9f0e ] + +Fix "thermal_sys: cpu_thermal: Failed to read thermal-sensors cells: -2" +error on boot for omap3/4. This is caused by wrong addressing in the dts +for bandgap sensor for single sensor instances. + +Note that omap4-cpu-thermal.dtsi is shared across omap4/5 and dra7, so +we can't just change the addressing in omap4-cpu-thermal.dtsi. + +Cc: Ivaylo Dimitrov +Cc: Carl Philipp Klemm +Cc: Merlijn Wajer +Cc: Pavel Machek +Reviewed-by: Sebastian Reichel +Fixes: a761d517bbb1 ("ARM: dts: omap3: Add cpu_thermal zone") +Fixes: 0bbf6c54d100 ("arm: dts: add omap4 CPU thermal data") +Signed-off-by: Tony Lindgren +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/ti/omap/omap3-cpu-thermal.dtsi | 3 +-- + arch/arm/boot/dts/ti/omap/omap4-cpu-thermal.dtsi | 5 ++++- + arch/arm/boot/dts/ti/omap/omap443x.dtsi | 1 + + arch/arm/boot/dts/ti/omap/omap4460.dtsi | 1 + + 4 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/ti/omap/omap3-cpu-thermal.dtsi b/arch/arm/boot/dts/ti/omap/omap3-cpu-thermal.dtsi +index 0da759f8e2c2d..7dd2340bc5e45 100644 +--- a/arch/arm/boot/dts/ti/omap/omap3-cpu-thermal.dtsi ++++ b/arch/arm/boot/dts/ti/omap/omap3-cpu-thermal.dtsi +@@ -12,8 +12,7 @@ cpu_thermal: cpu-thermal { + polling-delay = <1000>; /* milliseconds */ + coefficients = <0 20000>; + +- /* sensor ID */ +- thermal-sensors = <&bandgap 0>; ++ thermal-sensors = <&bandgap>; + + cpu_trips: trips { + cpu_alert0: cpu_alert { +diff --git a/arch/arm/boot/dts/ti/omap/omap4-cpu-thermal.dtsi b/arch/arm/boot/dts/ti/omap/omap4-cpu-thermal.dtsi +index 801b4f10350c1..d484ec1e4fd86 100644 +--- a/arch/arm/boot/dts/ti/omap/omap4-cpu-thermal.dtsi ++++ b/arch/arm/boot/dts/ti/omap/omap4-cpu-thermal.dtsi +@@ -12,7 +12,10 @@ cpu_thermal: cpu_thermal { + polling-delay-passive = <250>; /* milliseconds */ + polling-delay = <1000>; /* milliseconds */ + +- /* sensor ID */ ++ /* ++ * See 44xx files for single sensor addressing, omap5 and dra7 need ++ * also sensor ID for addressing. ++ */ + thermal-sensors = <&bandgap 0>; + + cpu_trips: trips { +diff --git a/arch/arm/boot/dts/ti/omap/omap443x.dtsi b/arch/arm/boot/dts/ti/omap/omap443x.dtsi +index 238aceb799f89..2104170fe2cd7 100644 +--- a/arch/arm/boot/dts/ti/omap/omap443x.dtsi ++++ b/arch/arm/boot/dts/ti/omap/omap443x.dtsi +@@ -69,6 +69,7 @@ + }; + + &cpu_thermal { ++ thermal-sensors = <&bandgap>; + coefficients = <0 20000>; + }; + +diff --git a/arch/arm/boot/dts/ti/omap/omap4460.dtsi b/arch/arm/boot/dts/ti/omap/omap4460.dtsi +index 1b27a862ae810..a6764750d4476 100644 +--- a/arch/arm/boot/dts/ti/omap/omap4460.dtsi ++++ b/arch/arm/boot/dts/ti/omap/omap4460.dtsi +@@ -79,6 +79,7 @@ + }; + + &cpu_thermal { ++ thermal-sensors = <&bandgap>; + coefficients = <348 (-9301)>; + }; + +-- +2.40.1 + diff --git a/queue-6.5/arm-dts-ti-omap-motorola-mapphone-fix-abe_clkctrl-wa.patch b/queue-6.5/arm-dts-ti-omap-motorola-mapphone-fix-abe_clkctrl-wa.patch new file mode 100644 index 00000000000..22fd8c69e05 --- /dev/null +++ b/queue-6.5/arm-dts-ti-omap-motorola-mapphone-fix-abe_clkctrl-wa.patch @@ -0,0 +1,56 @@ +From 391f92f1f3fe3cd4f0ef6360772d82d1770eaeb9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Sep 2023 07:07:38 +0300 +Subject: ARM: dts: ti: omap: motorola-mapphone: Fix abe_clkctrl warning on + boot + +From: Tony Lindgren + +[ Upstream commit ac08bda1569b06b7a62c7b4dd00d4c3b28ceaaec ] + +Commit 0840242e8875 ("ARM: dts: Configure clock parent for pwm vibra") +attempted to fix the PWM settings but ended up causin an additional clock +reparenting error: + +clk: failed to reparent abe-clkctrl:0060:24 to sys_clkin_ck: -22 + +Only timer9 is in the PER domain and can use the sys_clkin_ck clock source. +For timer8, the there is no sys_clkin_ck available as it's in the ABE +domain, instead it should use syc_clk_div_ck. However, for power +management, we want to use the always on sys_32k_ck instead. + +Cc: Ivaylo Dimitrov +Cc: Carl Philipp Klemm +Cc: Merlijn Wajer +Cc: Pavel Machek +Reviewed-by: Sebastian Reichel +Fixes: 0840242e8875 ("ARM: dts: Configure clock parent for pwm vibra") +Depends-on: 61978617e905 ("ARM: dts: Add minimal support for Droid Bionic xt875") +Signed-off-by: Tony Lindgren +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/ti/omap/motorola-mapphone-common.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/ti/omap/motorola-mapphone-common.dtsi b/arch/arm/boot/dts/ti/omap/motorola-mapphone-common.dtsi +index 091ba310053eb..d69f0f4b4990d 100644 +--- a/arch/arm/boot/dts/ti/omap/motorola-mapphone-common.dtsi ++++ b/arch/arm/boot/dts/ti/omap/motorola-mapphone-common.dtsi +@@ -614,12 +614,12 @@ + /* Configure pwm clock source for timers 8 & 9 */ + &timer8 { + assigned-clocks = <&abe_clkctrl OMAP4_TIMER8_CLKCTRL 24>; +- assigned-clock-parents = <&sys_clkin_ck>; ++ assigned-clock-parents = <&sys_32k_ck>; + }; + + &timer9 { + assigned-clocks = <&l4_per_clkctrl OMAP4_TIMER9_CLKCTRL 24>; +- assigned-clock-parents = <&sys_clkin_ck>; ++ assigned-clock-parents = <&sys_32k_ck>; + }; + + /* +-- +2.40.1 + diff --git a/queue-6.5/arm64-dts-imx-add-imx8mm-prt8mm.dtb-to-build.patch b/queue-6.5/arm64-dts-imx-add-imx8mm-prt8mm.dtb-to-build.patch new file mode 100644 index 00000000000..9417928d41c --- /dev/null +++ b/queue-6.5/arm64-dts-imx-add-imx8mm-prt8mm.dtb-to-build.patch @@ -0,0 +1,34 @@ +From df003f1931dccd205e5397e81c56933b4d9473eb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Sep 2023 16:45:37 -0500 +Subject: arm64: dts: imx: Add imx8mm-prt8mm.dtb to build + +From: Rob Herring + +[ Upstream commit f09752eaf0e8f8befc26b44c4d3e15633e56d16a ] + +imx8mm-prt8mm.dts was not getting built. Add it to the build. + +Fixes: 58497d7a13ed ("arm64: dts: imx: add Protonic PRT8MM board") +Signed-off-by: Rob Herring +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/freescale/Makefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/freescale/Makefile b/arch/arm64/boot/dts/freescale/Makefile +index a750be13ace89..cf32922c97619 100644 +--- a/arch/arm64/boot/dts/freescale/Makefile ++++ b/arch/arm64/boot/dts/freescale/Makefile +@@ -66,6 +66,7 @@ dtb-$(CONFIG_ARCH_MXC) += imx8mm-mx8menlo.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-nitrogen-r2.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-phg.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-phyboard-polis-rdk.dtb ++dtb-$(CONFIG_ARCH_MXC) += imx8mm-prt8mm.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-tqma8mqml-mba8mx.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-var-som-symphony.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw71xx-0x.dtb +-- +2.40.1 + diff --git a/queue-6.5/arm64-dts-imx8mm-evk-fix-hdmi-3d-node.patch b/queue-6.5/arm64-dts-imx8mm-evk-fix-hdmi-3d-node.patch new file mode 100644 index 00000000000..3fc1db24104 --- /dev/null +++ b/queue-6.5/arm64-dts-imx8mm-evk-fix-hdmi-3d-node.patch @@ -0,0 +1,112 @@ +From c25afcfaf796dc1a39ce218509561c110f1539d7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Aug 2023 16:11:47 +0800 +Subject: arm64: dts: imx8mm-evk: Fix hdmi@3d node + +From: Liu Ying + +[ Upstream commit efa97aed071e0607b15ee08ddb1b7d775b664352 ] + +The hdmi@3d node's compatible string is "adi,adv7535" instead of +"adi,adv7533" or "adi,adv751*". + +Fix the hdmi@3d node by means of: +* Use default register addresses for "cec", "edid" and "packet", because + there is no need to use a non-default address map. +* Add missing interrupt related properties. +* Drop "adi,input-*" properties which are only valid for adv751*. +* Add VDDEXT_3V3 fixed regulator +* Add "*-supply" properties, since most are required. +* Fix label names - s/adv7533/adv7535/. + +Fixes: a27335b3f1e0 ("arm64: dts: imx8mm-evk: Add HDMI support") +Signed-off-by: Liu Ying +Tested-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi | 32 ++++++++++++------- + 1 file changed, 20 insertions(+), 12 deletions(-) + +diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi +index df8e808ac4739..6752c30274369 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi ++++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi +@@ -26,7 +26,7 @@ + + port { + hdmi_connector_in: endpoint { +- remote-endpoint = <&adv7533_out>; ++ remote-endpoint = <&adv7535_out>; + }; + }; + }; +@@ -72,6 +72,13 @@ + enable-active-high; + }; + ++ reg_vddext_3v3: regulator-vddext-3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "VDDEXT_3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm1 0 5000000 0>; +@@ -317,15 +324,16 @@ + + hdmi@3d { + compatible = "adi,adv7535"; +- reg = <0x3d>, <0x3c>, <0x3e>, <0x3f>; +- reg-names = "main", "cec", "edid", "packet"; ++ reg = <0x3d>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <9 IRQ_TYPE_EDGE_FALLING>; + adi,dsi-lanes = <4>; +- +- adi,input-depth = <8>; +- adi,input-colorspace = "rgb"; +- adi,input-clock = "1x"; +- adi,input-style = <1>; +- adi,input-justification = "evenly"; ++ avdd-supply = <&buck5_reg>; ++ dvdd-supply = <&buck5_reg>; ++ pvdd-supply = <&buck5_reg>; ++ a2vdd-supply = <&buck5_reg>; ++ v3p3-supply = <®_vddext_3v3>; ++ v1p2-supply = <&buck5_reg>; + + ports { + #address-cells = <1>; +@@ -334,7 +342,7 @@ + port@0 { + reg = <0>; + +- adv7533_in: endpoint { ++ adv7535_in: endpoint { + remote-endpoint = <&dsi_out>; + }; + }; +@@ -342,7 +350,7 @@ + port@1 { + reg = <1>; + +- adv7533_out: endpoint { ++ adv7535_out: endpoint { + remote-endpoint = <&hdmi_connector_in>; + }; + }; +@@ -408,7 +416,7 @@ + reg = <1>; + + dsi_out: endpoint { +- remote-endpoint = <&adv7533_in>; ++ remote-endpoint = <&adv7535_in>; + data-lanes = <1 2 3 4>; + }; + }; +-- +2.40.1 + diff --git a/queue-6.5/arm64-dts-imx8mp-beacon-kit-fix-audio_pll2-clock.patch b/queue-6.5/arm64-dts-imx8mp-beacon-kit-fix-audio_pll2-clock.patch new file mode 100644 index 00000000000..7c9584ec986 --- /dev/null +++ b/queue-6.5/arm64-dts-imx8mp-beacon-kit-fix-audio_pll2-clock.patch @@ -0,0 +1,50 @@ +From bf5ddaa421236c85afadbbf77cc7adb3dd6c7447 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 19 Aug 2023 05:50:02 -0500 +Subject: arm64: dts: imx8mp-beacon-kit: Fix audio_pll2 clock + +From: Adam Ford + +[ Upstream commit 161af16c18f3e10d81870328928e5fff3a7d47bb ] + +Commit 16c984524862 ("arm64: dts: imx8mp: don't initialize audio clocks +from CCM node") removed the Audio clocks from the main clock node, because +the intent is to force people to setup the audio PLL clocks per board +instead of having a common set of rates since not all boards may use +the various audio PLL clocks for audio devices. + +This resulted in an incorrect clock rate when attempting to playback +audio, since the AUDIO_PLL2 wasn't set any longer. Fix this by +setting the AUDIO_PLL2 rate inside the SAI3 node since it's the SAI3 +that needs it. + +Fixes: 16c984524862 ("arm64: dts: imx8mp: don't initialize audio clocks from CCM node") +Signed-off-by: Adam Ford +Reviewed-by: Lucas Stach +Reviewed-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts b/arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts +index 06e91297fb163..acd265d8b58ed 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts ++++ b/arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts +@@ -381,9 +381,10 @@ + &sai3 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sai3>; +- assigned-clocks = <&clk IMX8MP_CLK_SAI3>; ++ assigned-clocks = <&clk IMX8MP_CLK_SAI3>, ++ <&clk IMX8MP_AUDIO_PLL2> ; + assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL2_OUT>; +- assigned-clock-rates = <12288000>; ++ assigned-clock-rates = <12288000>, <361267200>; + fsl,sai-mclk-direction-output; + status = "okay"; + }; +-- +2.40.1 + diff --git a/queue-6.5/arm64-dts-imx8mp-fix-sdma2-3-clocks.patch b/queue-6.5/arm64-dts-imx8mp-fix-sdma2-3-clocks.patch new file mode 100644 index 00000000000..25d7654be57 --- /dev/null +++ b/queue-6.5/arm64-dts-imx8mp-fix-sdma2-3-clocks.patch @@ -0,0 +1,61 @@ +From 5568c7f229e2652a573c7942d503902e7f4051bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 19 Aug 2023 05:50:01 -0500 +Subject: arm64: dts: imx8mp: Fix SDMA2/3 clocks + +From: Adam Ford + +[ Upstream commit b739681b3f8b2a7a684a71ddd048b9b6b5400011 ] + +Commit 16c984524862 ("arm64: dts: imx8mp: don't initialize audio clocks +from CCM node") removed the Audio clocks from the main clock node, because +the intent is to force people to setup the audio PLL clocks per board +instead of having a common set of rates, since not all boards may use +the various audio PLL clocks in the same way. + +Unfortunately, with this parenting removed, the SDMA2 and SDMA3 +clocks were slowed to 24MHz because the SDMA2/3 clocks are controlled +via the audio_blk_ctrl which is clocked from IMX8MP_CLK_AUDIO_ROOT, +and that clock is enabled by pgc_audio. + +Per the TRM, "The SDMA2/3 target frequency is 400MHz IPG and 400MHz +AHB, always 1:1 mode, to make sure there is enough throughput for all +the audio use cases." + +Instead of cluttering the clock node, place the clock rate and parent +information into the pgc_audio node. + +With the parenting and clock rates restored for IMX8MP_CLK_AUDIO_AHB, +and IMX8MP_CLK_AUDIO_AXI_SRC, it appears the SDMA2 and SDMA3 run at +400MHz again. + +Fixes: 16c984524862 ("arm64: dts: imx8mp: don't initialize audio clocks from CCM node") +Signed-off-by: Adam Ford +Reviewed-by: Lucas Stach +Reviewed-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/freescale/imx8mp.dtsi | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi +index cc406bb338feb..587265395a9b4 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi ++++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi +@@ -794,6 +794,12 @@ + reg = ; + clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>, + <&clk IMX8MP_CLK_AUDIO_AXI>; ++ assigned-clocks = <&clk IMX8MP_CLK_AUDIO_AHB>, ++ <&clk IMX8MP_CLK_AUDIO_AXI_SRC>; ++ assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>, ++ <&clk IMX8MP_SYS_PLL1_800M>; ++ assigned-clock-rates = <400000000>, ++ <600000000>; + }; + + pgc_gpu2d: power-domain@6 { +-- +2.40.1 + diff --git a/queue-6.5/bus-ti-sysc-fix-missing-am35xx-soc-matching.patch b/queue-6.5/bus-ti-sysc-fix-missing-am35xx-soc-matching.patch new file mode 100644 index 00000000000..eae4ae66b7e --- /dev/null +++ b/queue-6.5/bus-ti-sysc-fix-missing-am35xx-soc-matching.patch @@ -0,0 +1,83 @@ +From c5ba98170a53b317e8fead98e0f7735b0506a9ad Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Sep 2023 18:34:42 -0500 +Subject: bus: ti-sysc: Fix missing AM35xx SoC matching + +From: Adam Ford + +[ Upstream commit 11729caa520950e17cd81bc43ffc477c46cf791e ] + +Commit feaa8baee82a ("bus: ti-sysc: Implement SoC revision handling") +created a list of SoC types searching for strings based on names +and wildcards which associates the SoC to different families. + +The OMAP34xx and OMAP35xx are treated as SOC_3430 while +OMAP36xx and OMAP37xx are treated as SOC_3630, but the AM35xx +isn't listed. + +The AM35xx is mostly an OMAP3430, and a later commit a12315d6d270 +("bus: ti-sysc: Make omap3 gpt12 quirk handling SoC specific") looks +for the SOC type and behaves in a certain way if it's SOC_3430. + +This caused a regression on the AM3517 causing it to return two +errors: + + ti-sysc: probe of 48318000.target-module failed with error -16 + ti-sysc: probe of 49032000.target-module failed with error -16 + +Fix this by treating the creating SOC_AM35 and inserting it between +the SOC_3430 and SOC_3630. If it is treaed the same way as the +SOC_3430 when checking the status of sysc_check_active_timer, +the error conditions will disappear. + +Fixes: a12315d6d270 ("bus: ti-sysc: Make omap3 gpt12 quirk handling SoC specific") +Fixes: feaa8baee82a ("bus: ti-sysc: Implement SoC revision handling") +Signed-off-by: Adam Ford +Message-ID: <20230906233442.270835-1-aford173@gmail.com> +Signed-off-by: Tony Lindgren +Signed-off-by: Sasha Levin +--- + drivers/bus/ti-sysc.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c +index 76116a9f6f87e..00ee7cc8248af 100644 +--- a/drivers/bus/ti-sysc.c ++++ b/drivers/bus/ti-sysc.c +@@ -38,6 +38,7 @@ enum sysc_soc { + SOC_2420, + SOC_2430, + SOC_3430, ++ SOC_AM35, + SOC_3630, + SOC_4430, + SOC_4460, +@@ -1861,7 +1862,7 @@ static void sysc_pre_reset_quirk_dss(struct sysc *ddata) + dev_warn(ddata->dev, "%s: timed out %08x !+ %08x\n", + __func__, val, irq_mask); + +- if (sysc_soc->soc == SOC_3430) { ++ if (sysc_soc->soc == SOC_3430 || sysc_soc->soc == SOC_AM35) { + /* Clear DSS_SDI_CONTROL */ + sysc_write(ddata, 0x44, 0); + +@@ -3023,6 +3024,7 @@ static void ti_sysc_idle(struct work_struct *work) + static const struct soc_device_attribute sysc_soc_match[] = { + SOC_FLAG("OMAP242*", SOC_2420), + SOC_FLAG("OMAP243*", SOC_2430), ++ SOC_FLAG("AM35*", SOC_AM35), + SOC_FLAG("OMAP3[45]*", SOC_3430), + SOC_FLAG("OMAP3[67]*", SOC_3630), + SOC_FLAG("OMAP443*", SOC_4430), +@@ -3227,7 +3229,7 @@ static int sysc_check_active_timer(struct sysc *ddata) + * can be dropped if we stop supporting old beagleboard revisions + * A to B4 at some point. + */ +- if (sysc_soc->soc == SOC_3430) ++ if (sysc_soc->soc == SOC_3430 || sysc_soc->soc == SOC_AM35) + error = -ENXIO; + else + error = -EBUSY; +-- +2.40.1 + diff --git a/queue-6.5/bus-ti-sysc-fix-sysc_quirk_swsup_sidle_act-handling-.patch b/queue-6.5/bus-ti-sysc-fix-sysc_quirk_swsup_sidle_act-handling-.patch new file mode 100644 index 00000000000..e6ff3855b71 --- /dev/null +++ b/queue-6.5/bus-ti-sysc-fix-sysc_quirk_swsup_sidle_act-handling-.patch @@ -0,0 +1,85 @@ +From 0dc8836faccd8697cc09fa50427433f6b34f8dba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Sep 2023 08:53:28 +0300 +Subject: bus: ti-sysc: Fix SYSC_QUIRK_SWSUP_SIDLE_ACT handling for uart + wake-up + +From: Tony Lindgren + +[ Upstream commit e5deb8f76e64d94ccef715e75ebafffd0c312d80 ] + +The uarts should be tagged with SYSC_QUIRK_SWSUP_SIDLE instead of +SYSC_QUIRK_SWSUP_SIDLE_ACT. The difference is that SYSC_QUIRK_SWSUP_SIDLE +is used to force idle target modules rather than block idle during usage. + +The SYSC_QUIRK_SWSUP_SIDLE_ACT should disable autoidle and wake-up when +a target module is active, and configure autoidle and wake-up when a +target module is inactive. We are missing configuring the target module +on sysc_disable_module(), and missing toggling of the wake-up bit. + +Let's fix the issue to allow uart wake-up to work. + +Fixes: fb685f1c190e ("bus: ti-sysc: Handle swsup idle mode quirks") +Tested-by: Dhruva Gole +Tested-by: Kevin Hilman +Signed-off-by: Tony Lindgren +Signed-off-by: Sasha Levin +--- + drivers/bus/ti-sysc.c | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c +index 00ee7cc8248af..27c5bae85adc2 100644 +--- a/drivers/bus/ti-sysc.c ++++ b/drivers/bus/ti-sysc.c +@@ -1097,6 +1097,11 @@ static int sysc_enable_module(struct device *dev) + if (ddata->cfg.quirks & (SYSC_QUIRK_SWSUP_SIDLE | + SYSC_QUIRK_SWSUP_SIDLE_ACT)) { + best_mode = SYSC_IDLE_NO; ++ ++ /* Clear WAKEUP */ ++ if (regbits->enwkup_shift >= 0 && ++ ddata->cfg.sysc_val & BIT(regbits->enwkup_shift)) ++ reg &= ~BIT(regbits->enwkup_shift); + } else { + best_mode = fls(ddata->cfg.sidlemodes) - 1; + if (best_mode > SYSC_IDLE_MASK) { +@@ -1224,6 +1229,13 @@ static int sysc_disable_module(struct device *dev) + } + } + ++ if (ddata->cfg.quirks & SYSC_QUIRK_SWSUP_SIDLE_ACT) { ++ /* Set WAKEUP */ ++ if (regbits->enwkup_shift >= 0 && ++ ddata->cfg.sysc_val & BIT(regbits->enwkup_shift)) ++ reg |= BIT(regbits->enwkup_shift); ++ } ++ + reg &= ~(SYSC_IDLE_MASK << regbits->sidle_shift); + reg |= best_mode << regbits->sidle_shift; + if (regbits->autoidle_shift >= 0 && +@@ -1518,16 +1530,16 @@ struct sysc_revision_quirk { + static const struct sysc_revision_quirk sysc_revision_quirks[] = { + /* These drivers need to be fixed to not use pm_runtime_irq_safe() */ + SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000046, 0xffffffff, +- SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), ++ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), + SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff, +- SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), ++ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), + /* Uarts on omap4 and later */ + SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffff00ff, +- SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), ++ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), + SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47422e03, 0xffffffff, +- SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), ++ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), + SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47424e03, 0xffffffff, +- SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), ++ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), + + /* Quirks that need to be set based on the module address */ + SYSC_QUIRK("mcpdm", 0x40132000, 0, 0x10, -ENODEV, 0x50000800, 0xffffffff, +-- +2.40.1 + diff --git a/queue-6.5/bus-ti-sysc-use-fsleep-instead-of-usleep_range-in-sy.patch b/queue-6.5/bus-ti-sysc-use-fsleep-instead-of-usleep_range-in-sy.patch new file mode 100644 index 00000000000..56b11636821 --- /dev/null +++ b/queue-6.5/bus-ti-sysc-use-fsleep-instead-of-usleep_range-in-sy.patch @@ -0,0 +1,49 @@ +From c7ee1816ed5150fcbd0d2492eabde1fe8d5fdd9c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Aug 2023 16:24:18 +0200 +Subject: bus: ti-sysc: Use fsleep() instead of usleep_range() in sysc_reset() + +From: Julien Panis + +[ Upstream commit d929b2b7464f95ec01e47f560b1e687482ba8929 ] + +The am335x-evm started producing boot errors because of subtle timing +changes: + +Unhandled fault: external abort on non-linefetch (0x1008) at 0xf03c1010 +... +sysc_reset from sysc_probe+0xf60/0x1514 +sysc_probe from platform_probe+0x5c/0xbc +... + +The fix consists in using the appropriate sleep function in sysc reset. +For flexible sleeping, fsleep is recommended. Here, sysc delay parameter +can take any value in [0 - 255] us range. As a result, fsleep() should +be used, calling udelay() for a sysc delay lower than 10 us. + +Signed-off-by: Julien Panis +Fixes: e709ed70d122 ("bus: ti-sysc: Fix missing reset delay handling") +Message-ID: <20230821-fix-ti-sysc-reset-v1-1-5a0a5d8fae55@baylibre.com> +Signed-off-by: Tony Lindgren +Signed-off-by: Sasha Levin +--- + drivers/bus/ti-sysc.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c +index 9766dbf607f97..76116a9f6f87e 100644 +--- a/drivers/bus/ti-sysc.c ++++ b/drivers/bus/ti-sysc.c +@@ -2149,8 +2149,7 @@ static int sysc_reset(struct sysc *ddata) + } + + if (ddata->cfg.srst_udelay) +- usleep_range(ddata->cfg.srst_udelay, +- ddata->cfg.srst_udelay * 2); ++ fsleep(ddata->cfg.srst_udelay); + + if (ddata->post_reset_quirk) + ddata->post_reset_quirk(ddata); +-- +2.40.1 + diff --git a/queue-6.5/clk-si521xx-fix-regmap-write-accessor.patch b/queue-6.5/clk-si521xx-fix-regmap-write-accessor.patch new file mode 100644 index 00000000000..0b27eddac10 --- /dev/null +++ b/queue-6.5/clk-si521xx-fix-regmap-write-accessor.patch @@ -0,0 +1,65 @@ +From afd97867f8dea1cd89320fc136fb3a09b4649732 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 31 Aug 2023 20:16:56 +0200 +Subject: clk: si521xx: Fix regmap write accessor + +From: Marek Vasut + +[ Upstream commit 83df5bf010eb5ccc11ce95f2d076515ec216c99c ] + +Rework the write operation such that the Byte Count register is written with +a single raw i2c write outside of regmap using transfer which does specify +the number of bytes to be transfered, one in this case, and which makes the +expected subsequent write transfer look like address+register+data, and then +make use of this method. Without this change, the Byte Count register write +in probe() would succeed as it would provide the byte count as part of its +write payload, but any subsequent writes would fail due to this Byte Count +register programming. Such failing writes happens e.g. during resume, when +restoring the regmap content. + +Fixes: edc12763a3a2 ("clk: si521xx: Clock driver for Skyworks Si521xx I2C PCIe clock generators") +Signed-off-by: Marek Vasut +Link: https://lore.kernel.org/r/20230831181656.154750-2-marex@denx.de +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/clk-si521xx.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/clk/clk-si521xx.c b/drivers/clk/clk-si521xx.c +index 0b9e2edbbe67c..ef4ba467e747b 100644 +--- a/drivers/clk/clk-si521xx.c ++++ b/drivers/clk/clk-si521xx.c +@@ -96,7 +96,7 @@ static int si521xx_regmap_i2c_write(void *context, unsigned int reg, + unsigned int val) + { + struct i2c_client *i2c = context; +- const u8 data[3] = { reg, 1, val }; ++ const u8 data[2] = { reg, val }; + const int count = ARRAY_SIZE(data); + int ret; + +@@ -281,9 +281,10 @@ static int si521xx_probe(struct i2c_client *client) + { + const u16 chip_info = (u16)(uintptr_t)device_get_match_data(&client->dev); + const struct clk_parent_data clk_parent_data = { .index = 0 }; +- struct si521xx *si; ++ const u8 data[3] = { SI521XX_REG_BC, 1, 1 }; + unsigned char name[6] = "DIFF0"; + struct clk_init_data init = {}; ++ struct si521xx *si; + int i, ret; + + if (!chip_info) +@@ -308,7 +309,7 @@ static int si521xx_probe(struct i2c_client *client) + "Failed to allocate register map\n"); + + /* Always read back 1 Byte via I2C */ +- ret = regmap_write(si->regmap, SI521XX_REG_BC, 1); ++ ret = i2c_master_send(client, data, ARRAY_SIZE(data)); + if (ret < 0) + return ret; + +-- +2.40.1 + diff --git a/queue-6.5/clk-si521xx-use-regcache_flat-instead-of-none.patch b/queue-6.5/clk-si521xx-use-regcache_flat-instead-of-none.patch new file mode 100644 index 00000000000..e524005068b --- /dev/null +++ b/queue-6.5/clk-si521xx-use-regcache_flat-instead-of-none.patch @@ -0,0 +1,40 @@ +From f0fa93e82b7cc7d9dfe4616e656f897607ef6e55 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 31 Aug 2023 20:16:55 +0200 +Subject: clk: si521xx: Use REGCACHE_FLAT instead of NONE + +From: Marek Vasut + +[ Upstream commit f03a562450eef35b785a814005ed164a89dfb2db ] + +In order to reload registers into the clock generator on resume using +regcache_sync(), it is necessary to select one of the regcache types +which are not NONE. Since this device has some 7 registers, use the +simplest one, FLAT. The regcache code complains about REGCACHE_NONE +being selected and generates a WARNING, this fixes that warning. + +Fixes: edc12763a3a2 ("clk: si521xx: Clock driver for Skyworks Si521xx I2C PCIe clock generators") +Signed-off-by: Marek Vasut +Link: https://lore.kernel.org/r/20230831181656.154750-1-marex@denx.de +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/clk-si521xx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/clk/clk-si521xx.c b/drivers/clk/clk-si521xx.c +index 4eaf1b53f06bd..0b9e2edbbe67c 100644 +--- a/drivers/clk/clk-si521xx.c ++++ b/drivers/clk/clk-si521xx.c +@@ -146,7 +146,7 @@ static int si521xx_regmap_i2c_read(void *context, unsigned int reg, + static const struct regmap_config si521xx_regmap_config = { + .reg_bits = 8, + .val_bits = 8, +- .cache_type = REGCACHE_NONE, ++ .cache_type = REGCACHE_FLAT, + .max_register = SI521XX_REG_DA, + .rd_table = &si521xx_readable_table, + .wr_table = &si521xx_writeable_table, +-- +2.40.1 + diff --git a/queue-6.5/clk-sprd-fix-thm_parents-incorrect-configuration.patch b/queue-6.5/clk-sprd-fix-thm_parents-incorrect-configuration.patch new file mode 100644 index 00000000000..469100fc8e8 --- /dev/null +++ b/queue-6.5/clk-sprd-fix-thm_parents-incorrect-configuration.patch @@ -0,0 +1,38 @@ +From 3936d7d3226cc937166c1cf500a81259a91b73ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 24 Aug 2023 17:26:24 +0800 +Subject: clk: sprd: Fix thm_parents incorrect configuration + +From: Zhifeng Tang + +[ Upstream commit b7b20cfe6f849c2682c5f7d3f50ede6321a5d04c ] + +The thm*_clk have two clock sources 32k and 250k,excluding 32m. + +Fixes: af3bd36573e3 ("clk: sprd: Add clocks support for UMS512") +Signed-off-by: Zhifeng Tang +Acked-by: Chunyan Zhang +Reviewed-by: Baolin Wang +Link: https://lore.kernel.org/r/20230824092624.20020-1-zhifeng.tang@unisoc.com +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/sprd/ums512-clk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/clk/sprd/ums512-clk.c b/drivers/clk/sprd/ums512-clk.c +index fc25bdd85e4ea..f43bb10bd5ae2 100644 +--- a/drivers/clk/sprd/ums512-clk.c ++++ b/drivers/clk/sprd/ums512-clk.c +@@ -800,7 +800,7 @@ static SPRD_MUX_CLK_DATA(uart1_clk, "uart1-clk", uart_parents, + 0x250, 0, 3, UMS512_MUX_FLAG); + + static const struct clk_parent_data thm_parents[] = { +- { .fw_name = "ext-32m" }, ++ { .fw_name = "ext-32k" }, + { .hw = &clk_250k.hw }, + }; + static SPRD_MUX_CLK_DATA(thm0_clk, "thm0-clk", thm_parents, +-- +2.40.1 + diff --git a/queue-6.5/clk-tegra-fix-error-return-case-for-recalc_rate.patch b/queue-6.5/clk-tegra-fix-error-return-case-for-recalc_rate.patch new file mode 100644 index 00000000000..06de855daf7 --- /dev/null +++ b/queue-6.5/clk-tegra-fix-error-return-case-for-recalc_rate.patch @@ -0,0 +1,40 @@ +From f71d71d6dfb871ecb5efc1ee1ce3290557561dfe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Sep 2023 14:29:50 +0300 +Subject: clk: tegra: fix error return case for recalc_rate + +From: Timo Alho + +[ Upstream commit a47b44fbb13f5e7a981b4515dcddc93a321ae89c ] + +tegra-bpmp clocks driver makes implicit conversion of signed error +code to unsigned value in recalc_rate operation. The behavior for +recalc_rate, according to it's specification, should be that "If the +driver cannot figure out a rate for this clock, it must return 0." + +Fixes: ca6f2796eef7 ("clk: tegra: Add BPMP clock driver") +Signed-off-by: Timo Alho +Signed-off-by: Mikko Perttunen +Link: https://lore.kernel.org/r/20230912112951.2330497-1-cyndis@kapsi.fi +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/tegra/clk-bpmp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c +index a9f3fb448de62..7bfba0afd7783 100644 +--- a/drivers/clk/tegra/clk-bpmp.c ++++ b/drivers/clk/tegra/clk-bpmp.c +@@ -159,7 +159,7 @@ static unsigned long tegra_bpmp_clk_recalc_rate(struct clk_hw *hw, + + err = tegra_bpmp_clk_transfer(clk->bpmp, &msg); + if (err < 0) +- return err; ++ return 0; + + return response.rate; + } +-- +2.40.1 + diff --git a/queue-6.5/firmware-arm_ffa-don-t-set-the-memory-region-attribu.patch b/queue-6.5/firmware-arm_ffa-don-t-set-the-memory-region-attribu.patch new file mode 100644 index 00000000000..721b5bd2f01 --- /dev/null +++ b/queue-6.5/firmware-arm_ffa-don-t-set-the-memory-region-attribu.patch @@ -0,0 +1,65 @@ +From a6c97aa1c86ca7ed8fdf31a186bf774d7e5e50b5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Sep 2023 18:41:01 +0100 +Subject: firmware: arm_ffa: Don't set the memory region attributes for + MEM_LEND + +From: Sudeep Holla + +[ Upstream commit 9dda1178479aa0a73fe0eaabfe2d9a1c603cfeed ] + +As per the FF-A specification: section "Usage of other memory region +attributes", in a transaction to donate memory or lend memory to a single +borrower, if the receiver is a PE or Proxy endpoint, the owner must not +specify the attributes and the relayer will return INVALID_PARAMETERS +if the attributes are set. + +Let us not set the memory region attributes for MEM_LEND. + +Fixes: 82a8daaecfd9 ("firmware: arm_ffa: Add support for MEM_LEND") +Reported-by: Joao Alves +Reported-by: Olivier Deprez +Link: https://lore.kernel.org/r/20230919-ffa_v1-1_notif-v2-13-6f3a3ca3923c@arm.com +Signed-off-by: Sudeep Holla +Signed-off-by: Sasha Levin +--- + drivers/firmware/arm_ffa/driver.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c +index 2109cd178ff70..121f4fc903cd5 100644 +--- a/drivers/firmware/arm_ffa/driver.c ++++ b/drivers/firmware/arm_ffa/driver.c +@@ -397,6 +397,19 @@ static u32 ffa_get_num_pages_sg(struct scatterlist *sg) + return num_pages; + } + ++static u8 ffa_memory_attributes_get(u32 func_id) ++{ ++ /* ++ * For the memory lend or donate operation, if the receiver is a PE or ++ * a proxy endpoint, the owner/sender must not specify the attributes ++ */ ++ if (func_id == FFA_FN_NATIVE(MEM_LEND) || ++ func_id == FFA_MEM_LEND) ++ return 0; ++ ++ return FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK | FFA_MEM_INNER_SHAREABLE; ++} ++ + static int + ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, + struct ffa_mem_ops_args *args) +@@ -413,8 +426,7 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, + mem_region->tag = args->tag; + mem_region->flags = args->flags; + mem_region->sender_id = drv_info->vm_id; +- mem_region->attributes = FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK | +- FFA_MEM_INNER_SHAREABLE; ++ mem_region->attributes = ffa_memory_attributes_get(func_id); + ep_mem_access = &mem_region->ep_mem_access[0]; + + for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) { +-- +2.40.1 + diff --git a/queue-6.5/firmware-arm_scmi-fixup-perf-power-cost-microwatt-su.patch b/queue-6.5/firmware-arm_scmi-fixup-perf-power-cost-microwatt-su.patch new file mode 100644 index 00000000000..8257265332b --- /dev/null +++ b/queue-6.5/firmware-arm_scmi-fixup-perf-power-cost-microwatt-su.patch @@ -0,0 +1,50 @@ +From d310c5457d7c0133431050a54bdb91f447afa8da Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 12 Aug 2023 02:18:18 +0530 +Subject: firmware: arm_scmi: Fixup perf power-cost/microwatt support + +From: Sibi Sankar + +[ Upstream commit c3638b851bc1ca0022dca9d6ca4beaa6ef03a216 ] + +The perf power scale value would currently be reported as bogowatts if the +platform firmware supports microwatt power scale and meets the perf major +version requirements. Fix this by populating version information in the +driver private data before the call to protocol attributes is made. + +CC: Chandra Sekhar Lingutla +Fixes: 3630cd8130ce ("firmware: arm_scmi: Add SCMI v3.1 perf power-cost in microwatts") +Signed-off-by: Sibi Sankar +Reviewed-by: Cristian Marussi +Link: https://lore.kernel.org/r/20230811204818.30928-1-quic_sibis@quicinc.com +Signed-off-by: Sudeep Holla +Signed-off-by: Sasha Levin +--- + drivers/firmware/arm_scmi/perf.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c +index 43dd242ecc49c..431bda9165c3d 100644 +--- a/drivers/firmware/arm_scmi/perf.c ++++ b/drivers/firmware/arm_scmi/perf.c +@@ -858,6 +858,8 @@ static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph) + if (!pinfo) + return -ENOMEM; + ++ pinfo->version = version; ++ + ret = scmi_perf_attributes_get(ph, pinfo); + if (ret) + return ret; +@@ -877,8 +879,6 @@ static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph) + scmi_perf_domain_init_fc(ph, domain, &dom->fc_info); + } + +- pinfo->version = version; +- + return ph->set_priv(ph, pinfo); + } + +-- +2.40.1 + diff --git a/queue-6.5/firmware-arm_scmi-harden-perf-domain-info-access.patch b/queue-6.5/firmware-arm_scmi-harden-perf-domain-info-access.patch new file mode 100644 index 00000000000..cf9a72d1e6b --- /dev/null +++ b/queue-6.5/firmware-arm_scmi-harden-perf-domain-info-access.patch @@ -0,0 +1,215 @@ +From 26f42b7059a2ff1cccaa7dac627e0d97f05402fc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Jul 2023 17:12:45 +0100 +Subject: firmware: arm_scmi: Harden perf domain info access + +From: Cristian Marussi + +[ Upstream commit 3da82112355bba263597fcbb24d275fc57e69e7e ] + +Harden internal accesses to domain info in the SCMI perf protocol. + +Signed-off-by: Cristian Marussi +Link: https://lore.kernel.org/r/20230717161246.1761777-2-cristian.marussi@arm.com +Signed-off-by: Sudeep Holla +Stable-dep-of: c3638b851bc1 ("firmware: arm_scmi: Fixup perf power-cost/microwatt support") +Signed-off-by: Sasha Levin +--- + drivers/firmware/arm_scmi/perf.c | 89 +++++++++++++++++++++++--------- + 1 file changed, 64 insertions(+), 25 deletions(-) + +diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c +index ecf5c4de851b7..43dd242ecc49c 100644 +--- a/drivers/firmware/arm_scmi/perf.c ++++ b/drivers/firmware/arm_scmi/perf.c +@@ -139,7 +139,7 @@ struct perf_dom_info { + + struct scmi_perf_info { + u32 version; +- int num_domains; ++ u16 num_domains; + enum scmi_power_scale power_scale; + u64 stats_addr; + u32 stats_size; +@@ -356,11 +356,26 @@ static int scmi_perf_mb_limits_set(const struct scmi_protocol_handle *ph, + return ret; + } + ++static inline struct perf_dom_info * ++scmi_perf_domain_lookup(const struct scmi_protocol_handle *ph, u32 domain) ++{ ++ struct scmi_perf_info *pi = ph->get_priv(ph); ++ ++ if (domain >= pi->num_domains) ++ return ERR_PTR(-EINVAL); ++ ++ return pi->dom_info + domain; ++} ++ + static int scmi_perf_limits_set(const struct scmi_protocol_handle *ph, + u32 domain, u32 max_perf, u32 min_perf) + { + struct scmi_perf_info *pi = ph->get_priv(ph); +- struct perf_dom_info *dom = pi->dom_info + domain; ++ struct perf_dom_info *dom; ++ ++ dom = scmi_perf_domain_lookup(ph, domain); ++ if (IS_ERR(dom)) ++ return PTR_ERR(dom); + + if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf) + return -EINVAL; +@@ -408,8 +423,11 @@ static int scmi_perf_mb_limits_get(const struct scmi_protocol_handle *ph, + static int scmi_perf_limits_get(const struct scmi_protocol_handle *ph, + u32 domain, u32 *max_perf, u32 *min_perf) + { +- struct scmi_perf_info *pi = ph->get_priv(ph); +- struct perf_dom_info *dom = pi->dom_info + domain; ++ struct perf_dom_info *dom; ++ ++ dom = scmi_perf_domain_lookup(ph, domain); ++ if (IS_ERR(dom)) ++ return PTR_ERR(dom); + + if (dom->fc_info && dom->fc_info[PERF_FC_LIMIT].get_addr) { + struct scmi_fc_info *fci = &dom->fc_info[PERF_FC_LIMIT]; +@@ -449,8 +467,11 @@ static int scmi_perf_mb_level_set(const struct scmi_protocol_handle *ph, + static int scmi_perf_level_set(const struct scmi_protocol_handle *ph, + u32 domain, u32 level, bool poll) + { +- struct scmi_perf_info *pi = ph->get_priv(ph); +- struct perf_dom_info *dom = pi->dom_info + domain; ++ struct perf_dom_info *dom; ++ ++ dom = scmi_perf_domain_lookup(ph, domain); ++ if (IS_ERR(dom)) ++ return PTR_ERR(dom); + + if (dom->fc_info && dom->fc_info[PERF_FC_LEVEL].set_addr) { + struct scmi_fc_info *fci = &dom->fc_info[PERF_FC_LEVEL]; +@@ -490,8 +511,11 @@ static int scmi_perf_mb_level_get(const struct scmi_protocol_handle *ph, + static int scmi_perf_level_get(const struct scmi_protocol_handle *ph, + u32 domain, u32 *level, bool poll) + { +- struct scmi_perf_info *pi = ph->get_priv(ph); +- struct perf_dom_info *dom = pi->dom_info + domain; ++ struct perf_dom_info *dom; ++ ++ dom = scmi_perf_domain_lookup(ph, domain); ++ if (IS_ERR(dom)) ++ return PTR_ERR(dom); + + if (dom->fc_info && dom->fc_info[PERF_FC_LEVEL].get_addr) { + *level = ioread32(dom->fc_info[PERF_FC_LEVEL].get_addr); +@@ -574,13 +598,14 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph, + unsigned long freq; + struct scmi_opp *opp; + struct perf_dom_info *dom; +- struct scmi_perf_info *pi = ph->get_priv(ph); + + domain = scmi_dev_domain_id(dev); + if (domain < 0) +- return domain; ++ return -EINVAL; + +- dom = pi->dom_info + domain; ++ dom = scmi_perf_domain_lookup(ph, domain); ++ if (IS_ERR(dom)) ++ return PTR_ERR(dom); + + for (opp = dom->opp, idx = 0; idx < dom->opp_count; idx++, opp++) { + freq = opp->perf * dom->mult_factor; +@@ -603,14 +628,17 @@ static int + scmi_dvfs_transition_latency_get(const struct scmi_protocol_handle *ph, + struct device *dev) + { ++ int domain; + struct perf_dom_info *dom; +- struct scmi_perf_info *pi = ph->get_priv(ph); +- int domain = scmi_dev_domain_id(dev); + ++ domain = scmi_dev_domain_id(dev); + if (domain < 0) +- return domain; ++ return -EINVAL; ++ ++ dom = scmi_perf_domain_lookup(ph, domain); ++ if (IS_ERR(dom)) ++ return PTR_ERR(dom); + +- dom = pi->dom_info + domain; + /* uS to nS */ + return dom->opp[dom->opp_count - 1].trans_latency_us * 1000; + } +@@ -618,8 +646,11 @@ scmi_dvfs_transition_latency_get(const struct scmi_protocol_handle *ph, + static int scmi_dvfs_freq_set(const struct scmi_protocol_handle *ph, u32 domain, + unsigned long freq, bool poll) + { +- struct scmi_perf_info *pi = ph->get_priv(ph); +- struct perf_dom_info *dom = pi->dom_info + domain; ++ struct perf_dom_info *dom; ++ ++ dom = scmi_perf_domain_lookup(ph, domain); ++ if (IS_ERR(dom)) ++ return PTR_ERR(dom); + + return scmi_perf_level_set(ph, domain, freq / dom->mult_factor, poll); + } +@@ -630,11 +661,14 @@ static int scmi_dvfs_freq_get(const struct scmi_protocol_handle *ph, u32 domain, + int ret; + u32 level; + struct scmi_perf_info *pi = ph->get_priv(ph); +- struct perf_dom_info *dom = pi->dom_info + domain; + + ret = scmi_perf_level_get(ph, domain, &level, poll); +- if (!ret) ++ if (!ret) { ++ struct perf_dom_info *dom = pi->dom_info + domain; ++ ++ /* Note domain is validated implicitly by scmi_perf_level_get */ + *freq = level * dom->mult_factor; ++ } + + return ret; + } +@@ -643,15 +677,14 @@ static int scmi_dvfs_est_power_get(const struct scmi_protocol_handle *ph, + u32 domain, unsigned long *freq, + unsigned long *power) + { +- struct scmi_perf_info *pi = ph->get_priv(ph); + struct perf_dom_info *dom; + unsigned long opp_freq; + int idx, ret = -EINVAL; + struct scmi_opp *opp; + +- dom = pi->dom_info + domain; +- if (!dom) +- return -EIO; ++ dom = scmi_perf_domain_lookup(ph, domain); ++ if (IS_ERR(dom)) ++ return PTR_ERR(dom); + + for (opp = dom->opp, idx = 0; idx < dom->opp_count; idx++, opp++) { + opp_freq = opp->perf * dom->mult_factor; +@@ -670,10 +703,16 @@ static int scmi_dvfs_est_power_get(const struct scmi_protocol_handle *ph, + static bool scmi_fast_switch_possible(const struct scmi_protocol_handle *ph, + struct device *dev) + { ++ int domain; + struct perf_dom_info *dom; +- struct scmi_perf_info *pi = ph->get_priv(ph); + +- dom = pi->dom_info + scmi_dev_domain_id(dev); ++ domain = scmi_dev_domain_id(dev); ++ if (domain < 0) ++ return false; ++ ++ dom = scmi_perf_domain_lookup(ph, domain); ++ if (IS_ERR(dom)) ++ return false; + + return dom->fc_info && dom->fc_info[PERF_FC_LEVEL].set_addr; + } +-- +2.40.1 + diff --git a/queue-6.5/firmware-imx-dsp-fix-an-error-handling-path-in-imx_d.patch b/queue-6.5/firmware-imx-dsp-fix-an-error-handling-path-in-imx_d.patch new file mode 100644 index 00000000000..c719b10771b --- /dev/null +++ b/queue-6.5/firmware-imx-dsp-fix-an-error-handling-path-in-imx_d.patch @@ -0,0 +1,37 @@ +From 1ec1cb32662f8e099d0a9cc323c6c98ba3289443 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 15 Jan 2023 19:13:46 +0100 +Subject: firmware: imx-dsp: Fix an error handling path in + imx_dsp_setup_channels() + +From: Christophe JAILLET + +[ Upstream commit e527adfb9b7d9d05a4577c116519e59a2bda4b05 ] + +If mbox_request_channel_byname() fails, the memory allocated a few lines +above still need to be freed before going to the error handling path. + +Fixes: 046326989a18 ("firmware: imx: Save channel name for further use") +Signed-off-by: Christophe JAILLET +Reviewed-by: Daniel Baluta +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + drivers/firmware/imx/imx-dsp.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c +index a6c06d7476c32..1f410809d3ee4 100644 +--- a/drivers/firmware/imx/imx-dsp.c ++++ b/drivers/firmware/imx/imx-dsp.c +@@ -115,6 +115,7 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) + dsp_chan->idx = i % 2; + dsp_chan->ch = mbox_request_channel_byname(cl, chan_name); + if (IS_ERR(dsp_chan->ch)) { ++ kfree(dsp_chan->name); + ret = PTR_ERR(dsp_chan->ch); + if (ret != -EPROBE_DEFER) + dev_err(dev, "Failed to request mbox chan %s ret %d\n", +-- +2.40.1 + diff --git a/queue-6.5/gpio-pmic-eic-sprd-add-can_sleep-flag-for-pmic-eic-c.patch b/queue-6.5/gpio-pmic-eic-sprd-add-can_sleep-flag-for-pmic-eic-c.patch new file mode 100644 index 00000000000..4876e2e6f09 --- /dev/null +++ b/queue-6.5/gpio-pmic-eic-sprd-add-can_sleep-flag-for-pmic-eic-c.patch @@ -0,0 +1,39 @@ +From 1f282315b842ed02b34a998545c1930e7cf9d271 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Sep 2023 20:25:27 +0800 +Subject: gpio: pmic-eic-sprd: Add can_sleep flag for PMIC EIC chip + +From: Wenhua Lin + +[ Upstream commit 26d9e5640d2130ee16df7b1fb6a908f460ab004c ] + +The drivers uses a mutex and I2C bus access in its PMIC EIC chip +get implementation. This means these functions can sleep and the PMIC EIC +chip should set the can_sleep property to true. + +This will ensure that a warning is printed when trying to get the +value from a context that potentially can't sleep. + +Fixes: 348f3cde84ab ("gpio: Add Spreadtrum PMIC EIC driver support") +Signed-off-by: Wenhua Lin +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-pmic-eic-sprd.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpio/gpio-pmic-eic-sprd.c b/drivers/gpio/gpio-pmic-eic-sprd.c +index c3e4d90f6b183..36f6cfc224c2d 100644 +--- a/drivers/gpio/gpio-pmic-eic-sprd.c ++++ b/drivers/gpio/gpio-pmic-eic-sprd.c +@@ -352,6 +352,7 @@ static int sprd_pmic_eic_probe(struct platform_device *pdev) + pmic_eic->chip.set_config = sprd_pmic_eic_set_config; + pmic_eic->chip.set = sprd_pmic_eic_set; + pmic_eic->chip.get = sprd_pmic_eic_get; ++ pmic_eic->chip.can_sleep = true; + + irq = &pmic_eic->chip.irq; + gpio_irq_chip_set_chip(irq, &pmic_eic_irq_chip); +-- +2.40.1 + diff --git a/queue-6.5/i2c-npcm7xx-fix-callback-completion-ordering.patch b/queue-6.5/i2c-npcm7xx-fix-callback-completion-ordering.patch new file mode 100644 index 00000000000..80a70b10c5a --- /dev/null +++ b/queue-6.5/i2c-npcm7xx-fix-callback-completion-ordering.patch @@ -0,0 +1,77 @@ +From e78db24b8fed05f9a86458cffef564116cbba8c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 23 Sep 2023 18:02:14 -0700 +Subject: i2c: npcm7xx: Fix callback completion ordering + +From: William A. Kennington III + +[ Upstream commit 92e73d807b68b2214fcafca4e130b5300a9d4b3c ] + +Sometimes, our completions race with new master transfers and override +the bus->operation and bus->master_or_slave variables. This causes +transactions to timeout and kernel crashes less frequently. + +To remedy this, we re-order all completions to the very end of the +function. + +Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver") +Signed-off-by: William A. Kennington III +Reviewed-by: Tali Perry +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-npcm7xx.c | 17 +++++++---------- + 1 file changed, 7 insertions(+), 10 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c +index 53b65ffb6a647..bf9dbab52d228 100644 +--- a/drivers/i2c/busses/i2c-npcm7xx.c ++++ b/drivers/i2c/busses/i2c-npcm7xx.c +@@ -695,6 +695,7 @@ static void npcm_i2c_callback(struct npcm_i2c *bus, + { + struct i2c_msg *msgs; + int msgs_num; ++ bool do_complete = false; + + msgs = bus->msgs; + msgs_num = bus->msgs_num; +@@ -723,23 +724,17 @@ static void npcm_i2c_callback(struct npcm_i2c *bus, + msgs[1].flags & I2C_M_RD) + msgs[1].len = info; + } +- if (completion_done(&bus->cmd_complete) == false) +- complete(&bus->cmd_complete); +- break; +- ++ do_complete = true; ++ break; + case I2C_NACK_IND: + /* MASTER transmit got a NACK before tx all bytes */ + bus->cmd_err = -ENXIO; +- if (bus->master_or_slave == I2C_MASTER) +- complete(&bus->cmd_complete); +- ++ do_complete = true; + break; + case I2C_BUS_ERR_IND: + /* Bus error */ + bus->cmd_err = -EAGAIN; +- if (bus->master_or_slave == I2C_MASTER) +- complete(&bus->cmd_complete); +- ++ do_complete = true; + break; + case I2C_WAKE_UP_IND: + /* I2C wake up */ +@@ -753,6 +748,8 @@ static void npcm_i2c_callback(struct npcm_i2c *bus, + if (bus->slave) + bus->master_or_slave = I2C_SLAVE; + #endif ++ if (do_complete) ++ complete(&bus->cmd_complete); + } + + static u8 npcm_i2c_fifo_usage(struct npcm_i2c *bus) +-- +2.40.1 + diff --git a/queue-6.5/i915-guc-get-runtime-pm-in-busyness-worker-only-if-a.patch b/queue-6.5/i915-guc-get-runtime-pm-in-busyness-worker-only-if-a.patch new file mode 100644 index 00000000000..26cb07d6022 --- /dev/null +++ b/queue-6.5/i915-guc-get-runtime-pm-in-busyness-worker-only-if-a.patch @@ -0,0 +1,122 @@ +From 923ee020bd2e67fcc106afd0c34c060bbda6ef17 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Sep 2023 12:21:17 -0700 +Subject: i915/guc: Get runtime pm in busyness worker only if already active + +From: Umesh Nerlige Ramappa + +[ Upstream commit 907ef0398c938be8232b77c61cfcf50fbfd95554 ] + +Ideally the busyness worker should take a gt pm wakeref because the +worker only needs to be active while gt is awake. However, the gt_park +path cancels the worker synchronously and this complicates the flow if +the worker is also running at the same time. The cancel waits for the +worker and when the worker releases the wakeref, that would call gt_park +and would lead to a deadlock. + +The resolution is to take the global pm wakeref if runtime pm is already +active. If not, we don't need to update the busyness stats as the stats +would already be updated when the gt was parked. + +Note: +- We do not requeue the worker if we cannot take a reference to runtime + pm since intel_guc_busyness_unpark would requeue the worker in the + resume path. + +- If the gt was parked longer than time taken for GT timestamp to roll + over, we ignore those rollovers since we don't care about tracking the + exact GT time. We only care about roll overs when the gt is active and + running workloads. + +- There is a window of time between gt_park and runtime suspend, where + the worker may run. This is acceptable since the worker will not find + any new data to update busyness. + +v2: (Daniele) +- Edit commit message and code comment +- Use runtime pm in the worker +- Put runtime pm after enabling the worker +- Use Link tag and add Fixes tag + +v3: (Daniele) +- Reword commit and comments and add details + +Link: https://gitlab.freedesktop.org/drm/intel/-/issues/7077 +Fixes: 77cdd054dd2c ("drm/i915/pmu: Connect engine busyness stats from GuC to pmu") +Signed-off-by: Umesh Nerlige Ramappa +Reviewed-by: Daniele Ceraolo Spurio +Link: https://patchwork.freedesktop.org/patch/msgid/20230925192117.2497058-1-umesh.nerlige.ramappa@intel.com +(cherry picked from commit e2f99b79d4c594cdf7ab449e338d4947f5ea8903) +Signed-off-by: Rodrigo Vivi +Signed-off-by: Sasha Levin +--- + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 38 +++++++++++++++++-- + 1 file changed, 35 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +index b5b7f2fe8c78e..dc7b40e06e38a 100644 +--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c ++++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +@@ -1432,6 +1432,36 @@ static void guc_timestamp_ping(struct work_struct *wrk) + unsigned long index; + int srcu, ret; + ++ /* ++ * Ideally the busyness worker should take a gt pm wakeref because the ++ * worker only needs to be active while gt is awake. However, the ++ * gt_park path cancels the worker synchronously and this complicates ++ * the flow if the worker is also running at the same time. The cancel ++ * waits for the worker and when the worker releases the wakeref, that ++ * would call gt_park and would lead to a deadlock. ++ * ++ * The resolution is to take the global pm wakeref if runtime pm is ++ * already active. If not, we don't need to update the busyness stats as ++ * the stats would already be updated when the gt was parked. ++ * ++ * Note: ++ * - We do not requeue the worker if we cannot take a reference to runtime ++ * pm since intel_guc_busyness_unpark would requeue the worker in the ++ * resume path. ++ * ++ * - If the gt was parked longer than time taken for GT timestamp to roll ++ * over, we ignore those rollovers since we don't care about tracking ++ * the exact GT time. We only care about roll overs when the gt is ++ * active and running workloads. ++ * ++ * - There is a window of time between gt_park and runtime suspend, ++ * where the worker may run. This is acceptable since the worker will ++ * not find any new data to update busyness. ++ */ ++ wakeref = intel_runtime_pm_get_if_active(>->i915->runtime_pm); ++ if (!wakeref) ++ return; ++ + /* + * Synchronize with gt reset to make sure the worker does not + * corrupt the engine/guc stats. NB: can't actually block waiting +@@ -1440,10 +1470,9 @@ static void guc_timestamp_ping(struct work_struct *wrk) + */ + ret = intel_gt_reset_trylock(gt, &srcu); + if (ret) +- return; ++ goto err_trylock; + +- with_intel_runtime_pm(>->i915->runtime_pm, wakeref) +- __update_guc_busyness_stats(guc); ++ __update_guc_busyness_stats(guc); + + /* adjust context stats for overflow */ + xa_for_each(&guc->context_lookup, index, ce) +@@ -1452,6 +1481,9 @@ static void guc_timestamp_ping(struct work_struct *wrk) + intel_gt_reset_unlock(gt, srcu); + + guc_enable_busyness_worker(guc); ++ ++err_trylock: ++ intel_runtime_pm_put(>->i915->runtime_pm, wakeref); + } + + static int guc_action_enable_usage_stats(struct intel_guc *guc) +-- +2.40.1 + diff --git a/queue-6.5/nfsd-fix-zero-nfsv4-read-results-when-rq_splice_ok-i.patch b/queue-6.5/nfsd-fix-zero-nfsv4-read-results-when-rq_splice_ok-i.patch new file mode 100644 index 00000000000..358868e19c0 --- /dev/null +++ b/queue-6.5/nfsd-fix-zero-nfsv4-read-results-when-rq_splice_ok-i.patch @@ -0,0 +1,63 @@ +From b955bdb23060b2b19008f57526783d60aed3837e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Sep 2023 13:16:48 -0400 +Subject: NFSD: Fix zero NFSv4 READ results when RQ_SPLICE_OK is not set +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Chuck Lever + +[ Upstream commit 0d32a6bbb8e7bf503855f2990f1ccce0922db87b ] + +nfsd4_encode_readv() uses xdr->buf->page_len as a starting point for +the nfsd_iter_read() sink buffer -- page_len is going to be offset +by the parts of the COMPOUND that have already been encoded into +xdr->buf->pages. + +However, that value must be captured /before/ +xdr_reserve_space_vec() advances page_len by the expected size of +the read payload. Otherwise, the whole front part of the first +page of the payload in the reply will be uninitialized. + +Mantas hit this because sec=krb5i forces RQ_SPLICE_OK off, which +invokes the readv part of the nfsd4_encode_read() path. Also, +older Linux NFS clients appear to send shorter READ requests +for files smaller than a page, whereas newer clients just send +page-sized requests and let the server send as many bytes as +are in the file. + +Reported-by: Mantas Mikulėnas +Closes: https://lore.kernel.org/linux-nfs/f1d0b234-e650-0f6e-0f5d-126b3d51d1eb@gmail.com/ +Fixes: 703d75215555 ("NFSD: Hoist rq_vec preparation into nfsd_read() [step two]") +Signed-off-by: Chuck Lever +Signed-off-by: Sasha Levin +--- + fs/nfsd/nfs4xdr.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c +index be72628b13376..d2588f4ac42be 100644 +--- a/fs/nfsd/nfs4xdr.c ++++ b/fs/nfsd/nfs4xdr.c +@@ -4105,6 +4105,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, + struct file *file, unsigned long maxcount) + { + struct xdr_stream *xdr = resp->xdr; ++ unsigned int base = xdr->buf->page_len & ~PAGE_MASK; + unsigned int starting_len = xdr->buf->len; + __be32 zero = xdr_zero; + __be32 nfserr; +@@ -4113,8 +4114,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, + return nfserr_resource; + + nfserr = nfsd_iter_read(resp->rqstp, read->rd_fhp, file, +- read->rd_offset, &maxcount, +- xdr->buf->page_len & ~PAGE_MASK, ++ read->rd_offset, &maxcount, base, + &read->rd_eof); + read->rd_length = maxcount; + if (nfserr) +-- +2.40.1 + diff --git a/queue-6.5/power-supply-core-fix-use-after-free-in-uevent.patch b/queue-6.5/power-supply-core-fix-use-after-free-in-uevent.patch new file mode 100644 index 00000000000..017a16a8200 --- /dev/null +++ b/queue-6.5/power-supply-core-fix-use-after-free-in-uevent.patch @@ -0,0 +1,101 @@ +From bb67ef295dc44a10c03eed1f801e83f3c9967ceb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Sep 2023 14:08:29 +0200 +Subject: power: supply: core: fix use after free in uevent + +From: Sebastian Reichel + +[ Upstream commit 3dc0bab23dba53f315c9a7b4a679e0a6d46f7c6e ] + +power_supply_uevent() which is called to emit a udev event on device +deletion attempts to use the power_supply_battery_info structure, +which is device-managed and has been freed before this point. + +Fix this by not generating all battery/charger properties when the +device is about to be removed. This also avoids generating errors +when trying to access the hardware in hot-unplug scenarios. + +================================================================== + BUG: KASAN: slab-use-after-free in power_supply_battery_info_has_prop (power_supply_core.c:872) + Read of size 4 at addr 0000000062e59028 by task python3/27 + + Call Trace: + power_supply_battery_info_has_prop (power_supply_core.c:872) + power_supply_uevent (power_supply_sysfs.c:504) + dev_uevent (drivers/base/core.c:2590) + kobject_uevent_env (lib/kobject_uevent.c:558) + kobject_uevent (lib/kobject_uevent.c:643) + device_del (drivers/base/core.c:3266 drivers/base/core.c:3831) + device_unregister (drivers/base/core.c:3730 drivers/base/core.c:3854) + power_supply_unregister (power_supply_core.c:1608) + devm_power_supply_release (power_supply_core.c:1515) + release_nodes (drivers/base/devres.c:506) + devres_release_group (drivers/base/devres.c:669) + i2c_device_remove (drivers/i2c/i2c-core-base.c:629) + device_remove (drivers/base/dd.c:570) + device_release_driver_internal (drivers/base/dd.c:1274 drivers/base/dd.c:1295) + device_driver_detach (drivers/base/dd.c:1332) + unbind_store (drivers/base/bus.c:247) + ... + + Allocated by task 27: + devm_kmalloc (drivers/base/devres.c:119 drivers/base/devres.c:829) + power_supply_get_battery_info (include/linux/device.h:316 power_supply_core.c:626) + __power_supply_register (power_supply_core.c:1408) + devm_power_supply_register (power_supply_core.c:1544) + bq256xx_probe (bq256xx_charger.c:1539 bq256xx_charger.c:1727) bq256xx_charger + i2c_device_probe (drivers/i2c/i2c-core-base.c:584) + really_probe (drivers/base/dd.c:579 drivers/base/dd.c:658) + __driver_probe_device (drivers/base/dd.c:800) + device_driver_attach (drivers/base/dd.c:1128) + bind_store (drivers/base/bus.c:273) + ... + + Freed by task 27: + kfree (mm/slab_common.c:1073) + release_nodes (drivers/base/devres.c:503) + devres_release_all (drivers/base/devres.c:536) + device_del (drivers/base/core.c:3829) + device_unregister (drivers/base/core.c:3730 drivers/base/core.c:3854) + power_supply_unregister (power_supply_core.c:1608) + devm_power_supply_release (power_supply_core.c:1515) + release_nodes (drivers/base/devres.c:506) + devres_release_group (drivers/base/devres.c:669) + i2c_device_remove (drivers/i2c/i2c-core-base.c:629) + device_remove (drivers/base/dd.c:570) + device_release_driver_internal (drivers/base/dd.c:1274 drivers/base/dd.c:1295) + device_driver_detach (drivers/base/dd.c:1332) + unbind_store (drivers/base/bus.c:247) + ... + ================================================================== + +Reported-by: Vincent Whitchurch +Fixes: 27a2195efa8d ("power: supply: core: auto-exposure of simple-battery data") +Tested-by: Vincent Whitchurch +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/power_supply_sysfs.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c +index 06e5b6b0e255c..d483a81560ab0 100644 +--- a/drivers/power/supply/power_supply_sysfs.c ++++ b/drivers/power/supply/power_supply_sysfs.c +@@ -482,6 +482,13 @@ int power_supply_uevent(const struct device *dev, struct kobj_uevent_env *env) + if (ret) + return ret; + ++ /* ++ * Kernel generates KOBJ_REMOVE uevent in device removal path, after ++ * resources have been freed. Exit early to avoid use-after-free. ++ */ ++ if (psy->removing) ++ return 0; ++ + prop_buf = (char *)get_zeroed_page(GFP_KERNEL); + if (!prop_buf) + return -ENOMEM; +-- +2.40.1 + diff --git a/queue-6.5/power-supply-mt6370-fix-missing-error-code-in-mt6370.patch b/queue-6.5/power-supply-mt6370-fix-missing-error-code-in-mt6370.patch new file mode 100644 index 00000000000..f324a03d823 --- /dev/null +++ b/queue-6.5/power-supply-mt6370-fix-missing-error-code-in-mt6370.patch @@ -0,0 +1,40 @@ +From 073ea7023f3652ac8c52a60668916e0bc641b463 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Sep 2023 01:48:15 -0700 +Subject: power: supply: mt6370: Fix missing error code in + mt6370_chg_toggle_cfo() + +From: Harshit Mogalapalli + +[ Upstream commit 779873ec81306d2c40c459fa7c91a5d40655510d ] + +When mt6370_chg_field_get() suceeds, ret is set to zero and returning +zero when flash led is still in strobe mode looks incorrect. + +Fixes: 233cb8a47d65 ("power: supply: mt6370: Add MediaTek MT6370 charger driver") +Signed-off-by: Harshit Mogalapalli +Reviewed-by: AngeloGioacchino Del Regno +Reviewed-by: ChiaEn Wu +Link: https://lore.kernel.org/r/20230906084815.2827930-1-harshit.m.mogalapalli@oracle.com +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/mt6370-charger.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/power/supply/mt6370-charger.c b/drivers/power/supply/mt6370-charger.c +index f27dae5043f5b..a9641bd3d8cf8 100644 +--- a/drivers/power/supply/mt6370-charger.c ++++ b/drivers/power/supply/mt6370-charger.c +@@ -324,7 +324,7 @@ static int mt6370_chg_toggle_cfo(struct mt6370_priv *priv) + + if (fl_strobe) { + dev_err(priv->dev, "Flash led is still in strobe mode\n"); +- return ret; ++ return -EINVAL; + } + + /* cfo off */ +-- +2.40.1 + diff --git a/queue-6.5/power-supply-rk817-fix-node-refcount-leak.patch b/queue-6.5/power-supply-rk817-fix-node-refcount-leak.patch new file mode 100644 index 00000000000..cdebcb7d564 --- /dev/null +++ b/queue-6.5/power-supply-rk817-fix-node-refcount-leak.patch @@ -0,0 +1,64 @@ +From 4a16451c6e029c45815870bf638320df4f2cfa1d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Sep 2023 09:56:44 -0500 +Subject: power: supply: rk817: Fix node refcount leak + +From: Chris Morgan + +[ Upstream commit 488ef44c068e79752dba8eda0b75f524f111a695 ] + +Dan Carpenter reports that the Smatch static checker warning has found +that there is another refcount leak in the probe function. While +of_node_put() was added in one of the return paths, it should in +fact be added for ALL return paths that return an error and at driver +removal time. + +Fixes: 54c03bfd094f ("power: supply: Fix refcount leak in rk817_charger_probe") +Reported-by: Dan Carpenter +Closes: https://lore.kernel.org/linux-pm/dc0bb0f8-212d-4be7-be69-becd2a3f9a80@kili.mountain/ +Signed-off-by: Chris Morgan +Link: https://lore.kernel.org/r/20230920145644.57964-1-macroalpha82@gmail.com +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/rk817_charger.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/drivers/power/supply/rk817_charger.c b/drivers/power/supply/rk817_charger.c +index 8328bcea1a299..242e158824222 100644 +--- a/drivers/power/supply/rk817_charger.c ++++ b/drivers/power/supply/rk817_charger.c +@@ -1045,6 +1045,13 @@ static void rk817_charging_monitor(struct work_struct *work) + queue_delayed_work(system_wq, &charger->work, msecs_to_jiffies(8000)); + } + ++static void rk817_cleanup_node(void *data) ++{ ++ struct device_node *node = data; ++ ++ of_node_put(node); ++} ++ + static int rk817_charger_probe(struct platform_device *pdev) + { + struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent); +@@ -1061,11 +1068,13 @@ static int rk817_charger_probe(struct platform_device *pdev) + if (!node) + return -ENODEV; + ++ ret = devm_add_action_or_reset(&pdev->dev, rk817_cleanup_node, node); ++ if (ret) ++ return ret; ++ + charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); +- if (!charger) { +- of_node_put(node); ++ if (!charger) + return -ENOMEM; +- } + + charger->rk808 = rk808; + +-- +2.40.1 + diff --git a/queue-6.5/power-supply-rt9467-fix-rt9467_run_aicl.patch b/queue-6.5/power-supply-rt9467-fix-rt9467_run_aicl.patch new file mode 100644 index 00000000000..1ba913d36cb --- /dev/null +++ b/queue-6.5/power-supply-rt9467-fix-rt9467_run_aicl.patch @@ -0,0 +1,42 @@ +From 101ed70fb6caabbb5f310f828b0844ed423c2025 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Feb 2023 13:43:04 +0100 +Subject: power: supply: rt9467: Fix rt9467_run_aicl() + +From: Christophe JAILLET + +[ Upstream commit cba320408d631422fef0ad8407954fb9d6f8f650 ] + +It is spurious to bail-out on a wait_for_completion_timeout() call that +does NOT timeout. + +Reverse the logic to return -ETIMEDOUT instead, in case of tiemout. + +Fixes: 6f7f70e3a8dd ("power: supply: rt9467: Add Richtek RT9467 charger driver") +Signed-off-by: Christophe JAILLET +Reviewed-by: ChiYuan Huang +Link: https://lore.kernel.org/r/2ed01020fa8a135c36dbaa871095ded47d926507.1676464968.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/rt9467-charger.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/power/supply/rt9467-charger.c b/drivers/power/supply/rt9467-charger.c +index 683adb18253dd..fdfdc83ab0458 100644 +--- a/drivers/power/supply/rt9467-charger.c ++++ b/drivers/power/supply/rt9467-charger.c +@@ -598,8 +598,8 @@ static int rt9467_run_aicl(struct rt9467_chg_data *data) + + reinit_completion(&data->aicl_done); + ret = wait_for_completion_timeout(&data->aicl_done, msecs_to_jiffies(3500)); +- if (ret) +- return ret; ++ if (ret == 0) ++ return -ETIMEDOUT; + + ret = rt9467_get_value_from_ranges(data, F_IAICR, RT9467_RANGE_IAICR, &aicr_get); + if (ret) { +-- +2.40.1 + diff --git a/queue-6.5/power-supply-ucs1002-fix-error-code-in-ucs1002_get_p.patch b/queue-6.5/power-supply-ucs1002-fix-error-code-in-ucs1002_get_p.patch new file mode 100644 index 00000000000..d30690c98d7 --- /dev/null +++ b/queue-6.5/power-supply-ucs1002-fix-error-code-in-ucs1002_get_p.patch @@ -0,0 +1,39 @@ +From 374cf1354c288d01ff5baf583cff1fb9ef8f9896 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Jun 2023 12:44:17 +0300 +Subject: power: supply: ucs1002: fix error code in ucs1002_get_property() + +From: Dan Carpenter + +[ Upstream commit e35059949daa83f8dadf710d0f829ab3c3a72fe2 ] + +This function is supposed to return 0 for success instead of returning +the val->intval. This makes it the same as the other case statements +in this function. + +Fixes: 81196e2e57fc ("power: supply: ucs1002: fix some health status issues") +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/687f64a4-4c6e-4536-8204-98ad1df934e5@moroto.mountain +Signed-off-by: Sebastian Reichel +Signed-off-by: Sasha Levin +--- + drivers/power/supply/ucs1002_power.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/power/supply/ucs1002_power.c b/drivers/power/supply/ucs1002_power.c +index 954feba6600b8..7970843a4f480 100644 +--- a/drivers/power/supply/ucs1002_power.c ++++ b/drivers/power/supply/ucs1002_power.c +@@ -384,7 +384,8 @@ static int ucs1002_get_property(struct power_supply *psy, + case POWER_SUPPLY_PROP_USB_TYPE: + return ucs1002_get_usb_type(info, val); + case POWER_SUPPLY_PROP_HEALTH: +- return val->intval = info->health; ++ val->intval = info->health; ++ return 0; + case POWER_SUPPLY_PROP_PRESENT: + val->intval = info->present; + return 0; +-- +2.40.1 + diff --git a/queue-6.5/powerpc-stacktrace-fix-arch_stack_walk_reliable.patch b/queue-6.5/powerpc-stacktrace-fix-arch_stack_walk_reliable.patch new file mode 100644 index 00000000000..2f2d9fb3b2a --- /dev/null +++ b/queue-6.5/powerpc-stacktrace-fix-arch_stack_walk_reliable.patch @@ -0,0 +1,75 @@ +From e6e46a2532b63884f671f3c21425dfdfab76dc2f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 22 Sep 2023 09:24:41 +1000 +Subject: powerpc/stacktrace: Fix arch_stack_walk_reliable() + +From: Michael Ellerman + +[ Upstream commit c5cc3ca707bc916a3f326364751a41f25040aef3 ] + +The changes to copy_thread() made in commit eed7c420aac7 ("powerpc: +copy_thread differentiate kthreads and user mode threads") inadvertently +broke arch_stack_walk_reliable() because it has knowledge of the stack +layout. + +Fix it by changing the condition to match the new logic in +copy_thread(). The changes make the comments about the stack layout +incorrect, rather than rephrasing them just refer the reader to +copy_thread(). + +Also the comment about the stack backchain is no longer true, since +commit edbd0387f324 ("powerpc: copy_thread add a back chain to the +switch stack frame"), so remove that as well. + +Fixes: eed7c420aac7 ("powerpc: copy_thread differentiate kthreads and user mode threads") +Reported-by: Joe Lawrence +Reviewed-by: Petr Mladek +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20230921232441.1181843-1-mpe@ellerman.id.au +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/stacktrace.c | 27 +++++---------------------- + 1 file changed, 5 insertions(+), 22 deletions(-) + +diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c +index b15f15dcacb5c..e6a958a5da276 100644 +--- a/arch/powerpc/kernel/stacktrace.c ++++ b/arch/powerpc/kernel/stacktrace.c +@@ -73,29 +73,12 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum + bool firstframe; + + stack_end = stack_page + THREAD_SIZE; +- if (!is_idle_task(task)) { +- /* +- * For user tasks, this is the SP value loaded on +- * kernel entry, see "PACAKSAVE(r13)" in _switch() and +- * system_call_common(). +- * +- * Likewise for non-swapper kernel threads, +- * this also happens to be the top of the stack +- * as setup by copy_thread(). +- * +- * Note that stack backlinks are not properly setup by +- * copy_thread() and thus, a forked task() will have +- * an unreliable stack trace until it's been +- * _switch()'ed to for the first time. +- */ +- stack_end -= STACK_USER_INT_FRAME_SIZE; +- } else { +- /* +- * idle tasks have a custom stack layout, +- * c.f. cpu_idle_thread_init(). +- */ ++ ++ // See copy_thread() for details. ++ if (task->flags & PF_KTHREAD) + stack_end -= STACK_FRAME_MIN_SIZE; +- } ++ else ++ stack_end -= STACK_USER_INT_FRAME_SIZE; + + if (task == current) + sp = current_stack_frame(); +-- +2.40.1 + diff --git a/queue-6.5/selftests-powerpc-fix-emit_tests-to-work-with-run_ks.patch b/queue-6.5/selftests-powerpc-fix-emit_tests-to-work-with-run_ks.patch new file mode 100644 index 00000000000..ab411b1607c --- /dev/null +++ b/queue-6.5/selftests-powerpc-fix-emit_tests-to-work-with-run_ks.patch @@ -0,0 +1,97 @@ +From fb0bcbe72fe8d14d2c650481b7b751b02a240be6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Sep 2023 17:26:10 +1000 +Subject: selftests/powerpc: Fix emit_tests to work with run_kselftest.sh + +From: Michael Ellerman + +[ Upstream commit 58b33e78a31782ffe25d404d5eba9a45fe636e27 ] + +In order to use run_kselftest.sh the list of tests must be emitted to +populate kselftest-list.txt. + +The powerpc Makefile is written to use EMIT_TESTS. But support for +EMIT_TESTS was dropped in commit d4e59a536f50 ("selftests: Use runner.sh +for emit targets"). Although prior to that commit a548de0fe8e1 +("selftests: lib.mk: add test execute bit check to EMIT_TESTS") had +already broken run_kselftest.sh for powerpc due to the executable check +using the wrong path. + +It can be fixed by replacing the EMIT_TESTS definitions with actual +emit_tests rules in the powerpc Makefiles. This makes run_kselftest.sh +able to run powerpc tests: + + $ cd linux + $ export ARCH=powerpc + $ export CROSS_COMPILE=powerpc64le-linux-gnu- + $ make headers + $ make -j -C tools/testing/selftests install + $ grep -c "^powerpc" tools/testing/selftests/kselftest_install/kselftest-list.txt + 182 + +Fixes: d4e59a536f50 ("selftests: Use runner.sh for emit targets") +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20230921072623.828772-1-mpe@ellerman.id.au +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/powerpc/Makefile | 7 +++---- + tools/testing/selftests/powerpc/pmu/Makefile | 11 ++++++----- + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile +index 49f2ad1793fd9..7ea42fa02eabd 100644 +--- a/tools/testing/selftests/powerpc/Makefile ++++ b/tools/testing/selftests/powerpc/Makefile +@@ -59,12 +59,11 @@ override define INSTALL_RULE + done; + endef + +-override define EMIT_TESTS ++emit_tests: + +@for TARGET in $(SUB_DIRS); do \ + BUILD_TARGET=$(OUTPUT)/$$TARGET; \ +- $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests;\ ++ $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET $@;\ + done; +-endef + + override define CLEAN + +@for TARGET in $(SUB_DIRS); do \ +@@ -77,4 +76,4 @@ endef + tags: + find . -name '*.c' -o -name '*.h' | xargs ctags + +-.PHONY: tags $(SUB_DIRS) ++.PHONY: tags $(SUB_DIRS) emit_tests +diff --git a/tools/testing/selftests/powerpc/pmu/Makefile b/tools/testing/selftests/powerpc/pmu/Makefile +index 2b95e44d20ff9..a284fa874a9f1 100644 +--- a/tools/testing/selftests/powerpc/pmu/Makefile ++++ b/tools/testing/selftests/powerpc/pmu/Makefile +@@ -30,13 +30,14 @@ override define RUN_TESTS + +TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests + endef + +-DEFAULT_EMIT_TESTS := $(EMIT_TESTS) +-override define EMIT_TESTS +- $(DEFAULT_EMIT_TESTS) ++emit_tests: ++ for TEST in $(TEST_GEN_PROGS); do \ ++ BASENAME_TEST=`basename $$TEST`; \ ++ echo "$(COLLECTION):$$BASENAME_TEST"; \ ++ done + +TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests + +TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests + +TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests +-endef + + DEFAULT_INSTALL_RULE := $(INSTALL_RULE) + override define INSTALL_RULE +@@ -64,4 +65,4 @@ sampling_tests: + event_code_tests: + TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all + +-.PHONY: all run_tests ebb sampling_tests event_code_tests ++.PHONY: all run_tests ebb sampling_tests event_code_tests emit_tests +-- +2.40.1 + diff --git a/queue-6.5/series b/queue-6.5/series index 7704050d7e0..3a2adb3c934 100644 --- a/queue-6.5/series +++ b/queue-6.5/series @@ -118,3 +118,40 @@ btrfs-reset-destination-buffer-when-read_extent_buff.patch vfio-mdev-fix-a-null-ptr-deref-bug-for-mdev_unregist.patch mips-alchemy-only-build-mmc-support-helpers-if-au1xm.patch spi-spi-gxp-bug-correct-spi-write-return-value.patch +bus-ti-sysc-use-fsleep-instead-of-usleep_range-in-sy.patch +bus-ti-sysc-fix-missing-am35xx-soc-matching.patch +firmware-arm_scmi-harden-perf-domain-info-access.patch +firmware-arm_scmi-fixup-perf-power-cost-microwatt-su.patch +power-supply-mt6370-fix-missing-error-code-in-mt6370.patch +clk-sprd-fix-thm_parents-incorrect-configuration.patch +clk-si521xx-use-regcache_flat-instead-of-none.patch +clk-si521xx-fix-regmap-write-accessor.patch +clk-tegra-fix-error-return-case-for-recalc_rate.patch +arm-dts-ti-omap-fix-bandgap-thermal-cells-addressing.patch +arm-dts-ti-omap-motorola-mapphone-fix-abe_clkctrl-wa.patch +bus-ti-sysc-fix-sysc_quirk_swsup_sidle_act-handling-.patch +swiotlb-use-the-calculated-number-of-areas.patch +power-supply-ucs1002-fix-error-code-in-ucs1002_get_p.patch +power-supply-rt9467-fix-rt9467_run_aicl.patch +power-supply-core-fix-use-after-free-in-uevent.patch +firmware-imx-dsp-fix-an-error-handling-path-in-imx_d.patch +xtensa-add-default-definition-for-xchal_have_div32.patch +xtensa-iss-network-make-functions-static.patch +xtensa-boot-don-t-add-include-dirs.patch +xtensa-umulsidi3-fix-conditional-expression.patch +xtensa-boot-lib-fix-function-prototypes.patch +power-supply-rk817-fix-node-refcount-leak.patch +powerpc-stacktrace-fix-arch_stack_walk_reliable.patch +selftests-powerpc-fix-emit_tests-to-work-with-run_ks.patch +arm64-dts-imx8mp-fix-sdma2-3-clocks.patch +arm64-dts-imx8mp-beacon-kit-fix-audio_pll2-clock.patch +soc-imx8m-enable-ocotp-clock-for-imx8mm-before-readi.patch +arm64-dts-imx8mm-evk-fix-hdmi-3d-node.patch +arm64-dts-imx-add-imx8mm-prt8mm.dtb-to-build.patch +firmware-arm_ffa-don-t-set-the-memory-region-attribu.patch +i915-guc-get-runtime-pm-in-busyness-worker-only-if-a.patch +accel-ivpu-do-not-use-wait-event-interruptible.patch +accel-ivpu-use-cached-buffers-for-fw-loading.patch +gpio-pmic-eic-sprd-add-can_sleep-flag-for-pmic-eic-c.patch +i2c-npcm7xx-fix-callback-completion-ordering.patch +nfsd-fix-zero-nfsv4-read-results-when-rq_splice_ok-i.patch diff --git a/queue-6.5/soc-imx8m-enable-ocotp-clock-for-imx8mm-before-readi.patch b/queue-6.5/soc-imx8m-enable-ocotp-clock-for-imx8mm-before-readi.patch new file mode 100644 index 00000000000..ab5112f6b09 --- /dev/null +++ b/queue-6.5/soc-imx8m-enable-ocotp-clock-for-imx8mm-before-readi.patch @@ -0,0 +1,65 @@ +From 868ef11c8fd600fd7bbf09d3d4b80d8aa4dd5b9e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Aug 2023 01:57:00 +0000 +Subject: soc: imx8m: Enable OCOTP clock for imx8mm before reading registers + +From: Nathan Rossi + +[ Upstream commit 9d1e8275a28f51599d754ce661c91e0a689c0234 ] + +Commit 836fb30949d9 ("soc: imx8m: Enable OCOTP clock before reading the +register") added configuration to enable the OCOTP clock before +attempting to read from the associated registers. + +This same kexec issue is present with the imx8m SoCs that use the +imx8mm_soc_uid function (e.g. imx8mp). This requires the imx8mm_soc_uid +function to configure the OCOTP clock before accessing the associated +registers. This change implements the same clock enable functionality +that is present in the imx8mq_soc_revision function for the +imx8mm_soc_uid function. + +Signed-off-by: Nathan Rossi +Reviewed-by: Fabio Estevam +Fixes: 836fb30949d9 ("soc: imx8m: Enable OCOTP clock before reading the register") +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + drivers/soc/imx/soc-imx8m.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c +index 1dcd243df5677..ec87d9d878f30 100644 +--- a/drivers/soc/imx/soc-imx8m.c ++++ b/drivers/soc/imx/soc-imx8m.c +@@ -100,6 +100,7 @@ static void __init imx8mm_soc_uid(void) + { + void __iomem *ocotp_base; + struct device_node *np; ++ struct clk *clk; + u32 offset = of_machine_is_compatible("fsl,imx8mp") ? + IMX8MP_OCOTP_UID_OFFSET : 0; + +@@ -109,11 +110,20 @@ static void __init imx8mm_soc_uid(void) + + ocotp_base = of_iomap(np, 0); + WARN_ON(!ocotp_base); ++ clk = of_clk_get_by_name(np, NULL); ++ if (IS_ERR(clk)) { ++ WARN_ON(IS_ERR(clk)); ++ return; ++ } ++ ++ clk_prepare_enable(clk); + + soc_uid = readl_relaxed(ocotp_base + OCOTP_UID_HIGH + offset); + soc_uid <<= 32; + soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW + offset); + ++ clk_disable_unprepare(clk); ++ clk_put(clk); + iounmap(ocotp_base); + of_node_put(np); + } +-- +2.40.1 + diff --git a/queue-6.5/swiotlb-use-the-calculated-number-of-areas.patch b/queue-6.5/swiotlb-use-the-calculated-number-of-areas.patch new file mode 100644 index 00000000000..71e8d7450d5 --- /dev/null +++ b/queue-6.5/swiotlb-use-the-calculated-number-of-areas.patch @@ -0,0 +1,46 @@ +From 49f909313373d35ed6f6ed37220f4cdca16f825e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Sep 2023 11:32:51 +0100 +Subject: swiotlb: use the calculated number of areas + +From: Ross Lagerwall + +[ Upstream commit a6a241764f69c62d23fc6960920cc662ae4069e9 ] + +Commit 8ac04063354a ("swiotlb: reduce the number of areas to match +actual memory pool size") calculated the reduced number of areas in +swiotlb_init_remap() but didn't actually use the value. Replace usage of +default_nareas accordingly. + +Fixes: 8ac04063354a ("swiotlb: reduce the number of areas to match actual memory pool size") +Signed-off-by: Ross Lagerwall +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + kernel/dma/swiotlb.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c +index 2b83e3ad9dca1..aa0a4a220719a 100644 +--- a/kernel/dma/swiotlb.c ++++ b/kernel/dma/swiotlb.c +@@ -350,14 +350,14 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags, + } + + mem->areas = memblock_alloc(array_size(sizeof(struct io_tlb_area), +- default_nareas), SMP_CACHE_BYTES); ++ nareas), SMP_CACHE_BYTES); + if (!mem->areas) { + pr_warn("%s: Failed to allocate mem->areas.\n", __func__); + return; + } + + swiotlb_init_io_tlb_mem(mem, __pa(tlb), nslabs, flags, false, +- default_nareas); ++ nareas); + + if (flags & SWIOTLB_VERBOSE) + swiotlb_print_info(); +-- +2.40.1 + diff --git a/queue-6.5/xtensa-add-default-definition-for-xchal_have_div32.patch b/queue-6.5/xtensa-add-default-definition-for-xchal_have_div32.patch new file mode 100644 index 00000000000..1bfac22314a --- /dev/null +++ b/queue-6.5/xtensa-add-default-definition-for-xchal_have_div32.patch @@ -0,0 +1,45 @@ +From 2d8ae5ea73f3d45072239ffcc0f659a6d31e8c79 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Sep 2023 04:15:22 -0700 +Subject: xtensa: add default definition for XCHAL_HAVE_DIV32 + +From: Max Filippov + +[ Upstream commit 494e87ffa0159b3f879694a9231089707792a44d ] + +When variant FSF is set, XCHAL_HAVE_DIV32 is not defined. Add default +definition for that macro to prevent build warnings: + +arch/xtensa/lib/divsi3.S:9:5: warning: "XCHAL_HAVE_DIV32" is not defined, evaluates to 0 [-Wundef] + 9 | #if XCHAL_HAVE_DIV32 +arch/xtensa/lib/modsi3.S:9:5: warning: "XCHAL_HAVE_DIV32" is not defined, evaluates to 0 [-Wundef] + 9 | #if XCHAL_HAVE_DIV32 + +Fixes: 173d6681380a ("xtensa: remove extra header files") +Suggested-by: Randy Dunlap +Signed-off-by: Max Filippov +Reported-by: kernel test robot +Closes: lore.kernel.org/r/202309150556.t0yCdv3g-lkp@intel.com +Signed-off-by: Sasha Levin +--- + arch/xtensa/include/asm/core.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/xtensa/include/asm/core.h b/arch/xtensa/include/asm/core.h +index 3f5ffae89b580..6f02f6f21890f 100644 +--- a/arch/xtensa/include/asm/core.h ++++ b/arch/xtensa/include/asm/core.h +@@ -6,6 +6,10 @@ + + #include + ++#ifndef XCHAL_HAVE_DIV32 ++#define XCHAL_HAVE_DIV32 0 ++#endif ++ + #ifndef XCHAL_HAVE_EXCLUSIVE + #define XCHAL_HAVE_EXCLUSIVE 0 + #endif +-- +2.40.1 + diff --git a/queue-6.5/xtensa-boot-don-t-add-include-dirs.patch b/queue-6.5/xtensa-boot-don-t-add-include-dirs.patch new file mode 100644 index 00000000000..48b13f4f748 --- /dev/null +++ b/queue-6.5/xtensa-boot-don-t-add-include-dirs.patch @@ -0,0 +1,43 @@ +From 4eeef6f7a40b8aba56e5b4829dfbda8afb30c5c5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Sep 2023 22:21:37 -0700 +Subject: xtensa: boot: don't add include-dirs + +From: Randy Dunlap + +[ Upstream commit 54d3d7d363823782c3444ddc41bb8cf1edc80514 ] + +Drop the -I options to prevent build warnings since there +is not boot/include directory: + +cc1: warning: arch/xtensa/boot/include: No such file or directory [-Wmissing-include-dirs] + +Fixes: 437374e9a950 ("restore arch/{ppc/xtensa}/boot cflags") +Fixes: 4bedea945451 ("xtensa: Architecture support for Tensilica Xtensa Part 2") +Signed-off-by: Randy Dunlap +Cc: Chris Zankel +Cc: Max Filippov +Message-Id: <20230920052139.10570-15-rdunlap@infradead.org> +Signed-off-by: Max Filippov +Signed-off-by: Sasha Levin +--- + arch/xtensa/boot/Makefile | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile +index a65b7a9ebff28..d8b0fadf429a9 100644 +--- a/arch/xtensa/boot/Makefile ++++ b/arch/xtensa/boot/Makefile +@@ -9,8 +9,7 @@ + + + # KBUILD_CFLAGS used when building rest of boot (takes effect recursively) +-KBUILD_CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include +-HOSTFLAGS += -Iarch/$(ARCH)/boot/include ++KBUILD_CFLAGS += -fno-builtin + + subdir-y := lib + targets += vmlinux.bin vmlinux.bin.gz +-- +2.40.1 + diff --git a/queue-6.5/xtensa-boot-lib-fix-function-prototypes.patch b/queue-6.5/xtensa-boot-lib-fix-function-prototypes.patch new file mode 100644 index 00000000000..a8530e207bb --- /dev/null +++ b/queue-6.5/xtensa-boot-lib-fix-function-prototypes.patch @@ -0,0 +1,52 @@ +From 05dc7cea51a72827524266d93e1f800f667ab507 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Sep 2023 04:41:09 -0700 +Subject: xtensa: boot/lib: fix function prototypes + +From: Max Filippov + +[ Upstream commit f54d02c8f2cc4b46ba2a3bd8252a6750453b6f2b ] + +Add function prototype for gunzip() to the boot library code and make +exit() and zalloc() static. + +arch/xtensa/boot/lib/zmem.c:8:6: warning: no previous prototype for 'exit' [-Wmissing-prototypes] + 8 | void exit (void) +arch/xtensa/boot/lib/zmem.c:13:7: warning: no previous prototype for 'zalloc' [-Wmissing-prototypes] + 13 | void *zalloc(unsigned size) +arch/xtensa/boot/lib/zmem.c:35:6: warning: no previous prototype for 'gunzip' [-Wmissing-prototypes] + 35 | void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp) + +Fixes: 4bedea945451 ("xtensa: Architecture support for Tensilica Xtensa Part 2") +Fixes: e7d163f76665 ("xtensa: Removed local copy of zlib and fixed O= support") +Suggested-by: Randy Dunlap +Signed-off-by: Max Filippov +Signed-off-by: Sasha Levin +--- + arch/xtensa/boot/lib/zmem.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/xtensa/boot/lib/zmem.c b/arch/xtensa/boot/lib/zmem.c +index e3ecd743c5153..b89189355122a 100644 +--- a/arch/xtensa/boot/lib/zmem.c ++++ b/arch/xtensa/boot/lib/zmem.c +@@ -4,13 +4,14 @@ + /* bits taken from ppc */ + + extern void *avail_ram, *end_avail; ++void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp); + +-void exit (void) ++static void exit(void) + { + for (;;); + } + +-void *zalloc(unsigned size) ++static void *zalloc(unsigned int size) + { + void *p = avail_ram; + +-- +2.40.1 + diff --git a/queue-6.5/xtensa-iss-network-make-functions-static.patch b/queue-6.5/xtensa-iss-network-make-functions-static.patch new file mode 100644 index 00000000000..ffb41c1cd78 --- /dev/null +++ b/queue-6.5/xtensa-iss-network-make-functions-static.patch @@ -0,0 +1,53 @@ +From 82ede7c0a09758ea99e3096eebdb9f666a383471 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Sep 2023 22:21:36 -0700 +Subject: xtensa: iss/network: make functions static + +From: Randy Dunlap + +[ Upstream commit 1b59efeb59851277266318f4e0132aa61ce3455e ] + +Make 2 functions static to prevent build warnings: + +arch/xtensa/platforms/iss/network.c:204:16: warning: no previous prototype for 'tuntap_protocol' [-Wmissing-prototypes] + 204 | unsigned short tuntap_protocol(struct sk_buff *skb) +arch/xtensa/platforms/iss/network.c:444:6: warning: no previous prototype for 'iss_net_user_timer_expire' [-Wmissing-prototypes] + 444 | void iss_net_user_timer_expire(struct timer_list *unused) + +Fixes: 7282bee78798 ("xtensa: Architecture support for Tensilica Xtensa Part 8") +Fixes: d8479a21a98b ("xtensa: Convert timers to use timer_setup()") +Signed-off-by: Randy Dunlap +Cc: Chris Zankel +Cc: Max Filippov +Message-Id: <20230920052139.10570-14-rdunlap@infradead.org> +Signed-off-by: Max Filippov +Signed-off-by: Sasha Levin +--- + arch/xtensa/platforms/iss/network.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c +index 85c82cd42188a..e89f27f2bb18d 100644 +--- a/arch/xtensa/platforms/iss/network.c ++++ b/arch/xtensa/platforms/iss/network.c +@@ -201,7 +201,7 @@ static int tuntap_write(struct iss_net_private *lp, struct sk_buff **skb) + return simc_write(lp->tp.info.tuntap.fd, (*skb)->data, (*skb)->len); + } + +-unsigned short tuntap_protocol(struct sk_buff *skb) ++static unsigned short tuntap_protocol(struct sk_buff *skb) + { + return eth_type_trans(skb, skb->dev); + } +@@ -441,7 +441,7 @@ static int iss_net_change_mtu(struct net_device *dev, int new_mtu) + return -EINVAL; + } + +-void iss_net_user_timer_expire(struct timer_list *unused) ++static void iss_net_user_timer_expire(struct timer_list *unused) + { + } + +-- +2.40.1 + diff --git a/queue-6.5/xtensa-umulsidi3-fix-conditional-expression.patch b/queue-6.5/xtensa-umulsidi3-fix-conditional-expression.patch new file mode 100644 index 00000000000..b07713571f9 --- /dev/null +++ b/queue-6.5/xtensa-umulsidi3-fix-conditional-expression.patch @@ -0,0 +1,49 @@ +From dbd6353a3972ac5dbdd7ef4f928837a0932724ce Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Sep 2023 22:21:38 -0700 +Subject: xtensa: umulsidi3: fix conditional expression + +From: Randy Dunlap + +[ Upstream commit 9aecda97ec3deecbfa7670877c8ddfd3d0fc87c4 ] + +Even when a variant has one or more of these defines set to 1, the +multiplier code paths are not used. Change the expression so that the +correct code paths are used. + +arch/xtensa/lib/umulsidi3.S:44:38: warning: "XCHAL_NO_MUL" is not defined, evaluates to 0 [-Wundef] + 44 | #if defined(__XTENSA_CALL0_ABI__) && XCHAL_NO_MUL +arch/xtensa/lib/umulsidi3.S:145:38: warning: "XCHAL_NO_MUL" is not defined, evaluates to 0 [-Wundef] + 145 | #if defined(__XTENSA_CALL0_ABI__) && XCHAL_NO_MUL +arch/xtensa/lib/umulsidi3.S:159:5: warning: "XCHAL_NO_MUL" is not defined, evaluates to 0 [-Wundef] + 159 | #if XCHAL_NO_MUL + +Fixes: 8939c58d68f9 ("xtensa: add __umulsidi3 helper") +Signed-off-by: Randy Dunlap +Cc: Chris Zankel +Cc: Max Filippov +Message-Id: <20230920052139.10570-16-rdunlap@infradead.org> +Signed-off-by: Max Filippov +Signed-off-by: Sasha Levin +--- + arch/xtensa/lib/umulsidi3.S | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/arch/xtensa/lib/umulsidi3.S b/arch/xtensa/lib/umulsidi3.S +index 8c7a94a0c5d07..5da501b578136 100644 +--- a/arch/xtensa/lib/umulsidi3.S ++++ b/arch/xtensa/lib/umulsidi3.S +@@ -3,7 +3,9 @@ + #include + #include + +-#if !XCHAL_HAVE_MUL16 && !XCHAL_HAVE_MUL32 && !XCHAL_HAVE_MAC16 ++#if XCHAL_HAVE_MUL16 || XCHAL_HAVE_MUL32 || XCHAL_HAVE_MAC16 ++#define XCHAL_NO_MUL 0 ++#else + #define XCHAL_NO_MUL 1 + #endif + +-- +2.40.1 + -- 2.47.3