From: Sasha Levin Date: Wed, 7 May 2025 15:36:17 +0000 (-0400) Subject: Fixes for 5.10 X-Git-Tag: v5.15.182~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=69568a4b16a6a818c076019cc0ce23105dfafc11;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.10 Signed-off-by: Sasha Levin --- diff --git a/queue-5.10/cpufreq-intel_pstate-fold-intel_pstate_max_within_li.patch b/queue-5.10/cpufreq-intel_pstate-fold-intel_pstate_max_within_li.patch new file mode 100644 index 0000000000..a738ab950a --- /dev/null +++ b/queue-5.10/cpufreq-intel_pstate-fold-intel_pstate_max_within_li.patch @@ -0,0 +1,61 @@ +From 491688819a369a1aedb99696452e36f894a5659f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Mar 2024 18:01:58 +0100 +Subject: cpufreq: intel_pstate: Fold intel_pstate_max_within_limits() into + caller + +From: Rafael J. Wysocki + +[ Upstream commit 032c5565eb80edb6f2faeb31939540c897987119 ] + +Fold intel_pstate_max_within_limits() into its only caller. + +No functional impact. + +Signed-off-by: Rafael J. Wysocki +Acked-by: Srinivas Pandruvada +Stable-dep-of: ac4e04d9e378 ("cpufreq: intel_pstate: Unchecked MSR aceess in legacy mode") +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/intel_pstate.c | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 15d65c1458ed1..68747781a4f5c 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -1697,14 +1697,6 @@ static void intel_pstate_set_min_pstate(struct cpudata *cpu) + intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); + } + +-static void intel_pstate_max_within_limits(struct cpudata *cpu) +-{ +- int pstate = max(cpu->pstate.min_pstate, cpu->max_perf_ratio); +- +- update_turbo_state(); +- intel_pstate_set_pstate(cpu, pstate); +-} +- + static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) + { + cpu->pstate.min_pstate = pstate_funcs.get_min(); +@@ -2270,12 +2262,15 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) + intel_pstate_update_perf_limits(cpu, policy->min, policy->max); + + if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) { ++ int pstate = max(cpu->pstate.min_pstate, cpu->max_perf_ratio); ++ + /* + * NOHZ_FULL CPUs need this as the governor callback may not + * be invoked on them. + */ + intel_pstate_clear_update_util_hook(policy->cpu); +- intel_pstate_max_within_limits(cpu); ++ update_turbo_state(); ++ intel_pstate_set_pstate(cpu, pstate); + } else { + intel_pstate_set_update_util_hook(policy->cpu); + } +-- +2.39.5 + diff --git a/queue-5.10/cpufreq-intel_pstate-revise-global-turbo-disable-che.patch b/queue-5.10/cpufreq-intel_pstate-revise-global-turbo-disable-che.patch new file mode 100644 index 0000000000..be9fd1ab96 --- /dev/null +++ b/queue-5.10/cpufreq-intel_pstate-revise-global-turbo-disable-che.patch @@ -0,0 +1,69 @@ +From fed80b566af209cfd2d3445769a4075611c9c582 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Sep 2023 11:02:07 -0700 +Subject: cpufreq: intel_pstate: Revise global turbo disable check + +From: Srinivas Pandruvada + +[ Upstream commit 37b6ddba967c601479bea418a7ac6ff16b6232b7 ] + +Setting global turbo flag based on CPU 0 P-state limits is problematic +as it limits max P-state request on every CPU on the system just based +on its P-state limits. + +There are two cases in which global.turbo_disabled flag is set: +- When the MSR_IA32_MISC_ENABLE_TURBO_DISABLE bit is set to 1 +in the MSR MSR_IA32_MISC_ENABLE. This bit can be only changed by +the system BIOS before power up. +- When the max non turbo P-state is same as max turbo P-state for CPU 0. + +The second check is not a valid to decide global turbo state based on +the CPU 0. CPU 0 max turbo P-state can be same as max non turbo P-state, +but for other CPUs this may not be true. + +There is no guarantee that max P-state limits are same for every CPU. This +is possible that during fusing max P-state for a CPU is constrained. Also +with the Intel Speed Select performance profile, CPU 0 may not be present +in all profiles. In this case the max non turbo and turbo P-state can be +set to the lowest possible P-state by the hardware when switched to +such profile. Since max non turbo and turbo P-state is same, +global.turbo_disabled flag will be set. + +Once global.turbo_disabled is set, any scaling max and min frequency +update for any CPU will result in its max P-state constrained to the max +non turbo P-state. + +Hence remove the check of max non turbo P-state equal to max turbo P-state +of CPU 0 to set global turbo disabled flag. + +Signed-off-by: Srinivas Pandruvada +[ rjw: Subject edit ] +Signed-off-by: Rafael J. Wysocki +Stable-dep-of: ac4e04d9e378 ("cpufreq: intel_pstate: Unchecked MSR aceess in legacy mode") +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/intel_pstate.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 4359ed1d3b7e9..15d65c1458ed1 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -488,13 +488,9 @@ static int intel_pstate_get_cppc_guranteed(int cpu) + static inline void update_turbo_state(void) + { + u64 misc_en; +- struct cpudata *cpu; + +- cpu = all_cpu_data[0]; + rdmsrl(MSR_IA32_MISC_ENABLE, misc_en); +- global.turbo_disabled = +- (misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE || +- cpu->pstate.max_pstate == cpu->pstate.turbo_pstate); ++ global.turbo_disabled = misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE; + } + + static int min_perf_pct_min(void) +-- +2.39.5 + diff --git a/queue-5.10/cpufreq-intel_pstate-unchecked-msr-aceess-in-legacy-.patch b/queue-5.10/cpufreq-intel_pstate-unchecked-msr-aceess-in-legacy-.patch new file mode 100644 index 0000000000..13603f80e5 --- /dev/null +++ b/queue-5.10/cpufreq-intel_pstate-unchecked-msr-aceess-in-legacy-.patch @@ -0,0 +1,65 @@ +From 70a469d8e5b8efbb64fe41df5815428f670c97d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 29 Apr 2025 14:07:11 -0700 +Subject: cpufreq: intel_pstate: Unchecked MSR aceess in legacy mode + +From: Srinivas Pandruvada + +[ Upstream commit ac4e04d9e378f5aa826c2406ad7871ae1b6a6fb9 ] + +When turbo mode is unavailable on a Skylake-X system, executing the +command: + + # echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo + +results in an unchecked MSR access error: + + WRMSR to 0x199 (attempted to write 0x0000000100001300). + +This issue was reproduced on an OEM (Original Equipment Manufacturer) +system and is not a common problem across all Skylake-X systems. + +This error occurs because the MSR 0x199 Turbo Engage Bit (bit 32) is set +when turbo mode is disabled. The issue arises when intel_pstate fails to +detect that turbo mode is disabled. Here intel_pstate relies on +MSR_IA32_MISC_ENABLE bit 38 to determine the status of turbo mode. +However, on this system, bit 38 is not set even when turbo mode is +disabled. + +According to the Intel Software Developer's Manual (SDM), the BIOS sets +this bit during platform initialization to enable or disable +opportunistic processor performance operations. Logically, this bit +should be set in such cases. However, the SDM also specifies that "OS +and applications must use CPUID leaf 06H to detect processors with +opportunistic processor performance operations enabled." + +Therefore, in addition to checking MSR_IA32_MISC_ENABLE bit 38, verify +that CPUID.06H:EAX[1] is 0 to accurately determine if turbo mode is +disabled. + +Fixes: 4521e1a0ce17 ("cpufreq: intel_pstate: Reflect current no_turbo state correctly") +Signed-off-by: Srinivas Pandruvada +Cc: All applicable +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/intel_pstate.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 68747781a4f5c..c0e3488c44047 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -489,6 +489,9 @@ static inline void update_turbo_state(void) + { + u64 misc_en; + ++ if (!cpu_feature_enabled(X86_FEATURE_IDA)) ++ return true; ++ + rdmsrl(MSR_IA32_MISC_ENABLE, misc_en); + global.turbo_disabled = misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE; + } +-- +2.39.5 + diff --git a/queue-5.10/irqchip-gic-v2m-add-const-to-of_device_id.patch b/queue-5.10/irqchip-gic-v2m-add-const-to-of_device_id.patch new file mode 100644 index 0000000000..407df5856a --- /dev/null +++ b/queue-5.10/irqchip-gic-v2m-add-const-to-of_device_id.patch @@ -0,0 +1,36 @@ +From a3431c7aedde20b4c48a9da6386b1d7da01bf709 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Dec 2021 21:24:53 +0800 +Subject: irqchip/gic-v2m: Add const to of_device_id + +From: Xiang wangx + +[ Upstream commit c10f2f8b5d8027c1ea77f777f2d16cb9043a6c09 ] + +struct of_device_id should normally be const. + +Signed-off-by: Xiang wangx +Signed-off-by: Marc Zyngier +Link: https://lore.kernel.org/r/20211209132453.25623-1-wangxiang@cdjrlc.com +Stable-dep-of: 3318dc299b07 ("irqchip/gic-v2m: Prevent use after free of gicv2m_get_fwnode()") +Signed-off-by: Sasha Levin +--- + drivers/irqchip/irq-gic-v2m.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c +index 205a275196074..6a7551fd91a05 100644 +--- a/drivers/irqchip/irq-gic-v2m.c ++++ b/drivers/irqchip/irq-gic-v2m.c +@@ -408,7 +408,7 @@ static int __init gicv2m_init_one(struct fwnode_handle *fwnode, + return ret; + } + +-static struct of_device_id gicv2m_device_id[] = { ++static const struct of_device_id gicv2m_device_id[] = { + { .compatible = "arm,gic-v2m-frame", }, + {}, + }; +-- +2.39.5 + diff --git a/queue-5.10/irqchip-gic-v2m-mark-a-few-functions-__init.patch b/queue-5.10/irqchip-gic-v2m-mark-a-few-functions-__init.patch new file mode 100644 index 0000000000..6b09a52ef5 --- /dev/null +++ b/queue-5.10/irqchip-gic-v2m-mark-a-few-functions-__init.patch @@ -0,0 +1,72 @@ +From 881ba65ae5ca3f46401b6c36665eec2a086a0b9d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Nov 2022 15:39:33 +0100 +Subject: irqchip/gic-v2m: Mark a few functions __init + +From: Thomas Gleixner + +[ Upstream commit d51a15af37ce8cf59e73de51dcdce3c9f4944974 ] + +They are all part of the init sequence. + +Signed-off-by: Thomas Gleixner +Acked-by: Marc Zyngier +Link: https://lore.kernel.org/r/20221121140048.534395323@linutronix.de +Stable-dep-of: 3318dc299b07 ("irqchip/gic-v2m: Prevent use after free of gicv2m_get_fwnode()") +Signed-off-by: Sasha Levin +--- + drivers/irqchip/irq-gic-v2m.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c +index 6a7551fd91a05..0b57ac48e18b6 100644 +--- a/drivers/irqchip/irq-gic-v2m.c ++++ b/drivers/irqchip/irq-gic-v2m.c +@@ -263,7 +263,7 @@ static struct msi_domain_info gicv2m_pmsi_domain_info = { + .chip = &gicv2m_pmsi_irq_chip, + }; + +-static void gicv2m_teardown(void) ++static void __init gicv2m_teardown(void) + { + struct v2m_data *v2m, *tmp; + +@@ -278,7 +278,7 @@ static void gicv2m_teardown(void) + } + } + +-static int gicv2m_allocate_domains(struct irq_domain *parent) ++static __init int gicv2m_allocate_domains(struct irq_domain *parent) + { + struct irq_domain *inner_domain, *pci_domain, *plat_domain; + struct v2m_data *v2m; +@@ -408,7 +408,7 @@ static int __init gicv2m_init_one(struct fwnode_handle *fwnode, + return ret; + } + +-static const struct of_device_id gicv2m_device_id[] = { ++static __initconst struct of_device_id gicv2m_device_id[] = { + { .compatible = "arm,gic-v2m-frame", }, + {}, + }; +@@ -458,7 +458,7 @@ static int __init gicv2m_of_init(struct fwnode_handle *parent_handle, + #ifdef CONFIG_ACPI + static int acpi_num_msi; + +-static struct fwnode_handle *gicv2m_get_fwnode(struct device *dev) ++static __init struct fwnode_handle *gicv2m_get_fwnode(struct device *dev) + { + struct v2m_data *data; + +@@ -473,7 +473,7 @@ static struct fwnode_handle *gicv2m_get_fwnode(struct device *dev) + return data->fwnode; + } + +-static bool acpi_check_amazon_graviton_quirks(void) ++static __init bool acpi_check_amazon_graviton_quirks(void) + { + static struct acpi_table_madt *madt; + acpi_status status; +-- +2.39.5 + diff --git a/queue-5.10/irqchip-gic-v2m-prevent-use-after-free-of-gicv2m_get.patch b/queue-5.10/irqchip-gic-v2m-prevent-use-after-free-of-gicv2m_get.patch new file mode 100644 index 0000000000..8528affacd --- /dev/null +++ b/queue-5.10/irqchip-gic-v2m-prevent-use-after-free-of-gicv2m_get.patch @@ -0,0 +1,51 @@ +From 0697aa8e6ed0a6789bc6d84f6ef0f49b8d5a8fd8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Apr 2025 17:16:16 +0100 +Subject: irqchip/gic-v2m: Prevent use after free of gicv2m_get_fwnode() + +From: Suzuki K Poulose + +[ Upstream commit 3318dc299b072a0511d6dfd8367f3304fb6d9827 ] + +With ACPI in place, gicv2m_get_fwnode() is registered with the pci +subsystem as pci_msi_get_fwnode_cb(), which may get invoked at runtime +during a PCI host bridge probe. But, the call back is wrongly marked as +__init, causing it to be freed, while being registered with the PCI +subsystem and could trigger: + + Unable to handle kernel paging request at virtual address ffff8000816c0400 + gicv2m_get_fwnode+0x0/0x58 (P) + pci_set_bus_msi_domain+0x74/0x88 + pci_register_host_bridge+0x194/0x548 + +This is easily reproducible on a Juno board with ACPI boot. + +Retain the function for later use. + +Fixes: 0644b3daca28 ("irqchip/gic-v2m: acpi: Introducing GICv2m ACPI support") +Signed-off-by: Suzuki K Poulose +Signed-off-by: Thomas Gleixner +Signed-off-by: Ingo Molnar +Reviewed-by: Marc Zyngier +Cc: stable@vger.kernel.org +Signed-off-by: Sasha Levin +--- + drivers/irqchip/irq-gic-v2m.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c +index 0b57ac48e18b6..b17deec1c5d4d 100644 +--- a/drivers/irqchip/irq-gic-v2m.c ++++ b/drivers/irqchip/irq-gic-v2m.c +@@ -458,7 +458,7 @@ static int __init gicv2m_of_init(struct fwnode_handle *parent_handle, + #ifdef CONFIG_ACPI + static int acpi_num_msi; + +-static __init struct fwnode_handle *gicv2m_get_fwnode(struct device *dev) ++static struct fwnode_handle *gicv2m_get_fwnode(struct device *dev) + { + struct v2m_data *data; + +-- +2.39.5 + diff --git a/queue-5.10/net-phy-microchip-force-irq-polling-mode-for-lan88xx.patch b/queue-5.10/net-phy-microchip-force-irq-polling-mode-for-lan88xx.patch new file mode 100644 index 0000000000..57191c82d8 --- /dev/null +++ b/queue-5.10/net-phy-microchip-force-irq-polling-mode-for-lan88xx.patch @@ -0,0 +1,111 @@ +From 45697def1cfe1f5ca3855fc6ed82f42738c375b8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 16 Apr 2025 12:24:13 +0200 +Subject: net: phy: microchip: force IRQ polling mode for lan88xx + +From: Fiona Klute + +[ Upstream commit 30a41ed32d3088cd0d682a13d7f30b23baed7e93 ] + +With lan88xx based devices the lan78xx driver can get stuck in an +interrupt loop while bringing the device up, flooding the kernel log +with messages like the following: + +lan78xx 2-3:1.0 enp1s0u3: kevent 4 may have been dropped + +Removing interrupt support from the lan88xx PHY driver forces the +driver to use polling instead, which avoids the problem. + +The issue has been observed with Raspberry Pi devices at least since +4.14 (see [1], bug report for their downstream kernel), as well as +with Nvidia devices [2] in 2020, where disabling interrupts was the +vendor-suggested workaround (together with the claim that phylib +changes in 4.9 made the interrupt handling in lan78xx incompatible). + +Iperf reports well over 900Mbits/sec per direction with client in +--dualtest mode, so there does not seem to be a significant impact on +throughput (lan88xx device connected via switch to the peer). + +[1] https://github.com/raspberrypi/linux/issues/2447 +[2] https://forums.developer.nvidia.com/t/jetson-xavier-and-lan7800-problem/142134/11 + +Link: https://lore.kernel.org/0901d90d-3f20-4a10-b680-9c978e04ddda@lunn.ch +Fixes: 792aec47d59d ("add microchip LAN88xx phy driver") +Signed-off-by: Fiona Klute +Cc: kernel-list@raspberrypi.com +Cc: stable@vger.kernel.org +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20250416102413.30654-1-fiona.klute@gmx.de +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/phy/microchip.c | 46 +++---------------------------------- + 1 file changed, 3 insertions(+), 43 deletions(-) + +diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c +index 230f2fcf9c46a..7c8bcec0a8fab 100644 +--- a/drivers/net/phy/microchip.c ++++ b/drivers/net/phy/microchip.c +@@ -31,47 +31,6 @@ static int lan88xx_write_page(struct phy_device *phydev, int page) + return __phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS, page); + } + +-static int lan88xx_phy_config_intr(struct phy_device *phydev) +-{ +- int rc; +- +- if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { +- /* unmask all source and clear them before enable */ +- rc = phy_write(phydev, LAN88XX_INT_MASK, 0x7FFF); +- rc = phy_read(phydev, LAN88XX_INT_STS); +- rc = phy_write(phydev, LAN88XX_INT_MASK, +- LAN88XX_INT_MASK_MDINTPIN_EN_ | +- LAN88XX_INT_MASK_LINK_CHANGE_); +- } else { +- rc = phy_write(phydev, LAN88XX_INT_MASK, 0); +- if (rc) +- return rc; +- +- /* Ack interrupts after they have been disabled */ +- rc = phy_read(phydev, LAN88XX_INT_STS); +- } +- +- return rc < 0 ? rc : 0; +-} +- +-static irqreturn_t lan88xx_handle_interrupt(struct phy_device *phydev) +-{ +- int irq_status; +- +- irq_status = phy_read(phydev, LAN88XX_INT_STS); +- if (irq_status < 0) { +- phy_error(phydev); +- return IRQ_NONE; +- } +- +- if (!(irq_status & LAN88XX_INT_STS_LINK_CHANGE_)) +- return IRQ_NONE; +- +- phy_trigger_machine(phydev); +- +- return IRQ_HANDLED; +-} +- + static int lan88xx_suspend(struct phy_device *phydev) + { + struct lan88xx_priv *priv = phydev->priv; +@@ -388,8 +347,9 @@ static struct phy_driver microchip_phy_driver[] = { + .config_aneg = lan88xx_config_aneg, + .link_change_notify = lan88xx_link_change_notify, + +- .config_intr = lan88xx_phy_config_intr, +- .handle_interrupt = lan88xx_handle_interrupt, ++ /* Interrupt handling is broken, do not define related ++ * functions to force polling. ++ */ + + .suspend = lan88xx_suspend, + .resume = genphy_resume, +-- +2.39.5 + diff --git a/queue-5.10/net-phy-microchip-implement-generic-.handle_interrup.patch b/queue-5.10/net-phy-microchip-implement-generic-.handle_interrup.patch new file mode 100644 index 0000000000..a5e502f4b8 --- /dev/null +++ b/queue-5.10/net-phy-microchip-implement-generic-.handle_interrup.patch @@ -0,0 +1,105 @@ +From b785f8862406b8079627a5d6c7d946ee12153ef0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Nov 2020 18:52:11 +0200 +Subject: net: phy: microchip: implement generic .handle_interrupt() callback + +From: Ioana Ciornei + +[ Upstream commit e01a3feb8f69ab620b0016498603cad364f65224 ] + +In an attempt to actually support shared IRQs in phylib, we now move the +responsibility of triggering the phylib state machine or just returning +IRQ_NONE, based on the IRQ status register, to the PHY driver. Having +3 different IRQ handling callbacks (.handle_interrupt(), +.did_interrupt() and .ack_interrupt() ) is confusing so let the PHY +driver implement directly an IRQ handler like any other device driver. +Make this driver follow the new convention. + +Cc: Nisar Sayed +Cc: Yuiko Oshino +Signed-off-by: Ioana Ciornei +Signed-off-by: Jakub Kicinski +Stable-dep-of: 30a41ed32d30 ("net: phy: microchip: force IRQ polling mode for lan88xx") +Signed-off-by: Sasha Levin +--- + drivers/net/phy/microchip.c | 19 +++++++++++++++++++ + drivers/net/phy/microchip_t1.c | 19 +++++++++++++++++++ + 2 files changed, 38 insertions(+) + +diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c +index 375bbd60b38af..a149d0ae58b02 100644 +--- a/drivers/net/phy/microchip.c ++++ b/drivers/net/phy/microchip.c +@@ -56,6 +56,24 @@ static int lan88xx_phy_ack_interrupt(struct phy_device *phydev) + return rc < 0 ? rc : 0; + } + ++static irqreturn_t lan88xx_handle_interrupt(struct phy_device *phydev) ++{ ++ int irq_status; ++ ++ irq_status = phy_read(phydev, LAN88XX_INT_STS); ++ if (irq_status < 0) { ++ phy_error(phydev); ++ return IRQ_NONE; ++ } ++ ++ if (!(irq_status & LAN88XX_INT_STS_LINK_CHANGE_)) ++ return IRQ_NONE; ++ ++ phy_trigger_machine(phydev); ++ ++ return IRQ_HANDLED; ++} ++ + static int lan88xx_suspend(struct phy_device *phydev) + { + struct lan88xx_priv *priv = phydev->priv; +@@ -374,6 +392,7 @@ static struct phy_driver microchip_phy_driver[] = { + + .ack_interrupt = lan88xx_phy_ack_interrupt, + .config_intr = lan88xx_phy_config_intr, ++ .handle_interrupt = lan88xx_handle_interrupt, + + .suspend = lan88xx_suspend, + .resume = genphy_resume, +diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c +index fed3e395f18e1..553b391d1747a 100644 +--- a/drivers/net/phy/microchip_t1.c ++++ b/drivers/net/phy/microchip_t1.c +@@ -203,6 +203,24 @@ static int lan87xx_phy_ack_interrupt(struct phy_device *phydev) + return rc < 0 ? rc : 0; + } + ++static irqreturn_t lan87xx_handle_interrupt(struct phy_device *phydev) ++{ ++ int irq_status; ++ ++ irq_status = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); ++ if (irq_status < 0) { ++ phy_error(phydev); ++ return IRQ_NONE; ++ } ++ ++ if (irq_status == 0) ++ return IRQ_NONE; ++ ++ phy_trigger_machine(phydev); ++ ++ return IRQ_HANDLED; ++} ++ + static int lan87xx_config_init(struct phy_device *phydev) + { + int rc = lan87xx_phy_init(phydev); +@@ -223,6 +241,7 @@ static struct phy_driver microchip_t1_phy_driver[] = { + + .ack_interrupt = lan87xx_phy_ack_interrupt, + .config_intr = lan87xx_phy_config_intr, ++ .handle_interrupt = lan87xx_handle_interrupt, + + .suspend = genphy_suspend, + .resume = genphy_resume, +-- +2.39.5 + diff --git a/queue-5.10/net-phy-microchip-remove-the-use-of-.ack_interrupt.patch b/queue-5.10/net-phy-microchip-remove-the-use-of-.ack_interrupt.patch new file mode 100644 index 0000000000..b8c324c378 --- /dev/null +++ b/queue-5.10/net-phy-microchip-remove-the-use-of-.ack_interrupt.patch @@ -0,0 +1,100 @@ +From bd7b9e93f850909eb8e5f5aa5d9552934af3bd0d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Nov 2020 18:52:12 +0200 +Subject: net: phy: microchip: remove the use of .ack_interrupt() + +From: Ioana Ciornei + +[ Upstream commit cf499391982d877e9313d2adeedcf5f1ffe05d6e ] + +In preparation of removing the .ack_interrupt() callback, we must replace +its occurrences (aka phy_clear_interrupt), from the 2 places where it is +called from (phy_enable_interrupts and phy_disable_interrupts), with +equivalent functionality. + +This means that clearing interrupts now becomes something that the PHY +driver is responsible of doing, before enabling interrupts and after +clearing them. Make this driver follow the new contract. + +Cc: Nisar Sayed +Cc: Yuiko Oshino +Signed-off-by: Ioana Ciornei +Signed-off-by: Jakub Kicinski +Stable-dep-of: 30a41ed32d30 ("net: phy: microchip: force IRQ polling mode for lan88xx") +Signed-off-by: Sasha Levin +--- + drivers/net/phy/microchip.c | 13 +++++-------- + drivers/net/phy/microchip_t1.c | 17 +++++++---------- + 2 files changed, 12 insertions(+), 18 deletions(-) + +diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c +index a149d0ae58b02..230f2fcf9c46a 100644 +--- a/drivers/net/phy/microchip.c ++++ b/drivers/net/phy/microchip.c +@@ -44,14 +44,12 @@ static int lan88xx_phy_config_intr(struct phy_device *phydev) + LAN88XX_INT_MASK_LINK_CHANGE_); + } else { + rc = phy_write(phydev, LAN88XX_INT_MASK, 0); +- } +- +- return rc < 0 ? rc : 0; +-} ++ if (rc) ++ return rc; + +-static int lan88xx_phy_ack_interrupt(struct phy_device *phydev) +-{ +- int rc = phy_read(phydev, LAN88XX_INT_STS); ++ /* Ack interrupts after they have been disabled */ ++ rc = phy_read(phydev, LAN88XX_INT_STS); ++ } + + return rc < 0 ? rc : 0; + } +@@ -390,7 +388,6 @@ static struct phy_driver microchip_phy_driver[] = { + .config_aneg = lan88xx_config_aneg, + .link_change_notify = lan88xx_link_change_notify, + +- .ack_interrupt = lan88xx_phy_ack_interrupt, + .config_intr = lan88xx_phy_config_intr, + .handle_interrupt = lan88xx_handle_interrupt, + +diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c +index 553b391d1747a..4440182243108 100644 +--- a/drivers/net/phy/microchip_t1.c ++++ b/drivers/net/phy/microchip_t1.c +@@ -189,16 +189,14 @@ static int lan87xx_phy_config_intr(struct phy_device *phydev) + rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, 0x7FFF); + rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); + val = LAN87XX_MASK_LINK_UP | LAN87XX_MASK_LINK_DOWN; +- } +- +- rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); +- +- return rc < 0 ? rc : 0; +-} ++ rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); ++ } else { ++ rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); ++ if (rc) ++ return rc; + +-static int lan87xx_phy_ack_interrupt(struct phy_device *phydev) +-{ +- int rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); ++ rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); ++ } + + return rc < 0 ? rc : 0; + } +@@ -239,7 +237,6 @@ static struct phy_driver microchip_t1_phy_driver[] = { + .config_init = lan87xx_config_init, + .config_aneg = genphy_config_aneg, + +- .ack_interrupt = lan87xx_phy_ack_interrupt, + .config_intr = lan87xx_phy_config_intr, + .handle_interrupt = lan87xx_handle_interrupt, + +-- +2.39.5 + diff --git a/queue-5.10/revert-drm-meson-vclk-fix-calculation-of-59.94-fract.patch b/queue-5.10/revert-drm-meson-vclk-fix-calculation-of-59.94-fract.patch new file mode 100644 index 0000000000..d89a2d8ca9 --- /dev/null +++ b/queue-5.10/revert-drm-meson-vclk-fix-calculation-of-59.94-fract.patch @@ -0,0 +1,61 @@ +From fb803b10eaf3d33940d2a9352e1e84c3c6166001 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Apr 2025 22:12:59 +0200 +Subject: Revert "drm/meson: vclk: fix calculation of 59.94 fractional rates" + +From: Christian Hewitt + +[ Upstream commit f37bb5486ea536c1d61df89feeaeff3f84f0b560 ] + +This reverts commit bfbc68e. + +The patch does permit the offending YUV420 @ 59.94 phy_freq and +vclk_freq mode to match in calculations. It also results in all +fractional rates being unavailable for use. This was unintended +and requires the patch to be reverted. + +Fixes: bfbc68e4d869 ("drm/meson: vclk: fix calculation of 59.94 fractional rates") +Cc: stable@vger.kernel.org +Signed-off-by: Christian Hewitt +Signed-off-by: Martin Blumenstingl +Reviewed-by: Neil Armstrong +Link: https://lore.kernel.org/r/20250421201300.778955-2-martin.blumenstingl@googlemail.com +Signed-off-by: Neil Armstrong +Link: https://lore.kernel.org/r/20250421201300.778955-2-martin.blumenstingl@googlemail.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/meson/meson_vclk.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c +index 37127ba40aa97..0eb86943a3588 100644 +--- a/drivers/gpu/drm/meson/meson_vclk.c ++++ b/drivers/gpu/drm/meson/meson_vclk.c +@@ -790,13 +790,13 @@ meson_vclk_vic_supported_freq(struct meson_drm *priv, unsigned int phy_freq, + FREQ_1000_1001(params[i].pixel_freq)); + DRM_DEBUG_DRIVER("i = %d phy_freq = %d alt = %d\n", + i, params[i].phy_freq, +- FREQ_1000_1001(params[i].phy_freq/1000)*1000); ++ FREQ_1000_1001(params[i].phy_freq/10)*10); + /* Match strict frequency */ + if (phy_freq == params[i].phy_freq && + vclk_freq == params[i].vclk_freq) + return MODE_OK; + /* Match 1000/1001 variant */ +- if (phy_freq == (FREQ_1000_1001(params[i].phy_freq/1000)*1000) && ++ if (phy_freq == (FREQ_1000_1001(params[i].phy_freq/10)*10) && + vclk_freq == FREQ_1000_1001(params[i].vclk_freq)) + return MODE_OK; + } +@@ -1070,7 +1070,7 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target, + + for (freq = 0 ; params[freq].pixel_freq ; ++freq) { + if ((phy_freq == params[freq].phy_freq || +- phy_freq == FREQ_1000_1001(params[freq].phy_freq/1000)*1000) && ++ phy_freq == FREQ_1000_1001(params[freq].phy_freq/10)*10) && + (vclk_freq == params[freq].vclk_freq || + vclk_freq == FREQ_1000_1001(params[freq].vclk_freq))) { + if (vclk_freq != params[freq].vclk_freq) +-- +2.39.5 + diff --git a/queue-5.10/serial-msm-configure-correct-working-mode-before-sta.patch b/queue-5.10/serial-msm-configure-correct-working-mode-before-sta.patch new file mode 100644 index 0000000000..b143f0dbcd --- /dev/null +++ b/queue-5.10/serial-msm-configure-correct-working-mode-before-sta.patch @@ -0,0 +1,60 @@ +From 964ad1e439a2da7e7dd136d9bc4930a1bbb55e17 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Apr 2025 19:22:47 +0200 +Subject: serial: msm: Configure correct working mode before starting earlycon + +From: Stephan Gerhold + +[ Upstream commit 7094832b5ac861b0bd7ed8866c93cb15ef619996 ] + +The MSM UART DM controller supports different working modes, e.g. DMA or +the "single-character mode", where all reads/writes operate on a single +character rather than 4 chars (32-bit) at once. When using earlycon, +__msm_console_write() always writes 4 characters at a time, but we don't +know which mode the bootloader was using and we don't set the mode either. + +This causes garbled output if the bootloader was using the single-character +mode, because only every 4th character appears in the serial console, e.g. + + "[ 00oni pi 000xf0[ 00i s 5rm9(l)l s 1 1 SPMTA 7:C 5[ 00A ade k d[ + 00ano:ameoi .Q1B[ 00ac _idaM00080oo'" + +If the bootloader was using the DMA ("DM") mode, output would likely fail +entirely. Later, when the full serial driver probes, the port is +re-initialized and output works as expected. + +Fix this also for earlycon by clearing the DMEN register and +reset+re-enable the transmitter to apply the change. This ensures the +transmitter is in the expected state before writing any output. + +Cc: stable +Fixes: 0efe72963409 ("tty: serial: msm: Add earlycon support") +Signed-off-by: Stephan Gerhold +Reviewed-by: Neil Armstrong +Link: https://lore.kernel.org/r/20250408-msm-serial-earlycon-v1-1-429080127530@linaro.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/msm_serial.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c +index 27023a56f3ac1..ab05d922d97bf 100644 +--- a/drivers/tty/serial/msm_serial.c ++++ b/drivers/tty/serial/msm_serial.c +@@ -1737,6 +1737,12 @@ msm_serial_early_console_setup_dm(struct earlycon_device *device, + if (!device->port.membase) + return -ENODEV; + ++ /* Disable DM / single-character modes */ ++ msm_write(&device->port, 0, UARTDM_DMEN); ++ msm_write(&device->port, MSM_UART_CR_CMD_RESET_RX, MSM_UART_CR); ++ msm_write(&device->port, MSM_UART_CR_CMD_RESET_TX, MSM_UART_CR); ++ msm_write(&device->port, MSM_UART_CR_TX_ENABLE, MSM_UART_CR); ++ + device->con->write = msm_serial_early_write_dm; + return 0; + } +-- +2.39.5 + diff --git a/queue-5.10/series b/queue-5.10/series index 4a636cbc7d..e9667733eb 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -28,3 +28,16 @@ net-lan743x-fix-memleak-issue-when-gso-enabled.patch net-fec-err007885-workaround-for-conventional-tx.patch pci-imx6-skip-controller_id-generation-logic-for-i.mx7d.patch of-module-add-buffer-overflow-check-in-of_modalias.patch +net-phy-microchip-implement-generic-.handle_interrup.patch +net-phy-microchip-remove-the-use-of-.ack_interrupt.patch +net-phy-microchip-force-irq-polling-mode-for-lan88xx.patch +revert-drm-meson-vclk-fix-calculation-of-59.94-fract.patch +irqchip-gic-v2m-add-const-to-of_device_id.patch +irqchip-gic-v2m-mark-a-few-functions-__init.patch +irqchip-gic-v2m-prevent-use-after-free-of-gicv2m_get.patch +usb-chipidea-ci_hdrc_imx-use-dev_err_probe.patch +usb-chipidea-ci_hdrc_imx-implement-usb_phy_init-erro.patch +serial-msm-configure-correct-working-mode-before-sta.patch +cpufreq-intel_pstate-revise-global-turbo-disable-che.patch +cpufreq-intel_pstate-fold-intel_pstate_max_within_li.patch +cpufreq-intel_pstate-unchecked-msr-aceess-in-legacy-.patch diff --git a/queue-5.10/usb-chipidea-ci_hdrc_imx-implement-usb_phy_init-erro.patch b/queue-5.10/usb-chipidea-ci_hdrc_imx-implement-usb_phy_init-erro.patch new file mode 100644 index 0000000000..92ddbfae1b --- /dev/null +++ b/queue-5.10/usb-chipidea-ci_hdrc_imx-implement-usb_phy_init-erro.patch @@ -0,0 +1,74 @@ +From 0483b98a5de581b86059241543c25fb6b5c10b6b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 16 Mar 2025 13:26:56 +0300 +Subject: usb: chipidea: ci_hdrc_imx: implement usb_phy_init() error handling + +From: Fedor Pchelkin + +[ Upstream commit 8c531e0a8c2d82509ad97c6d3a1e6217c7ed136d ] + +usb_phy_init() may return an error code if e.g. its implementation fails +to prepare/enable some clocks. And properly rollback on probe error path +by calling the counterpart usb_phy_shutdown(). + +Found by Linux Verification Center (linuxtesting.org). + +Fixes: be9cae2479f4 ("usb: chipidea: imx: Fix ULPI on imx53") +Cc: stable +Signed-off-by: Fedor Pchelkin +Acked-by: Peter Chen +Link: https://lore.kernel.org/r/20250316102658.490340-4-pchelkin@ispras.ru +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/chipidea/ci_hdrc_imx.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c +index abe162cd729e9..03d883f5a4cc7 100644 +--- a/drivers/usb/chipidea/ci_hdrc_imx.c ++++ b/drivers/usb/chipidea/ci_hdrc_imx.c +@@ -446,7 +446,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) + of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI) { + pdata.flags |= CI_HDRC_OVERRIDE_PHY_CONTROL; + data->override_phy_control = true; +- usb_phy_init(pdata.usb_phy); ++ ret = usb_phy_init(pdata.usb_phy); ++ if (ret) { ++ dev_err(dev, "Failed to init phy\n"); ++ goto err_clk; ++ } + } + + if (pdata.flags & CI_HDRC_SUPPORTS_RUNTIME_PM) +@@ -455,7 +459,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) + ret = imx_usbmisc_init(data->usbmisc_data); + if (ret) { + dev_err(dev, "usbmisc init failed, ret=%d\n", ret); +- goto err_clk; ++ goto phy_shutdown; + } + + data->ci_pdev = ci_hdrc_add_device(dev, +@@ -464,7 +468,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) + if (IS_ERR(data->ci_pdev)) { + ret = PTR_ERR(data->ci_pdev); + dev_err_probe(dev, ret, "ci_hdrc_add_device failed\n"); +- goto err_clk; ++ goto phy_shutdown; + } + + if (data->usbmisc_data) { +@@ -498,6 +502,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) + + disable_device: + ci_hdrc_remove_device(data->ci_pdev); ++phy_shutdown: ++ if (data->override_phy_control) ++ usb_phy_shutdown(data->phy); + err_clk: + imx_disable_unprepare_clks(dev); + disable_hsic_regulator: +-- +2.39.5 + diff --git a/queue-5.10/usb-chipidea-ci_hdrc_imx-use-dev_err_probe.patch b/queue-5.10/usb-chipidea-ci_hdrc_imx-use-dev_err_probe.patch new file mode 100644 index 0000000000..95d4499e3e --- /dev/null +++ b/queue-5.10/usb-chipidea-ci_hdrc_imx-use-dev_err_probe.patch @@ -0,0 +1,71 @@ +From c43419803d06505f441d82884f8a7ef715392cce Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jun 2022 14:05:22 +0200 +Subject: usb: chipidea: ci_hdrc_imx: use dev_err_probe() + +From: Alexander Stein + +[ Upstream commit 18171cfc3c236a1587dcad9adc27c6e781af4438 ] + +Use dev_err_probe() to simplify handling errors in ci_hdrc_imx_probe() + +Acked-by: Peter Chen +Signed-off-by: Alexander Stein +Link: https://lore.kernel.org/r/20220614120522.1469957-1-alexander.stein@ew.tq-group.com +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 8c531e0a8c2d ("usb: chipidea: ci_hdrc_imx: implement usb_phy_init() error handling") +Signed-off-by: Sasha Levin +--- + drivers/usb/chipidea/ci_hdrc_imx.c | 23 +++++++---------------- + 1 file changed, 7 insertions(+), 16 deletions(-) + +diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c +index a54c3cff6c28e..abe162cd729e9 100644 +--- a/drivers/usb/chipidea/ci_hdrc_imx.c ++++ b/drivers/usb/chipidea/ci_hdrc_imx.c +@@ -360,25 +360,18 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) + data->pinctrl = devm_pinctrl_get(dev); + if (PTR_ERR(data->pinctrl) == -ENODEV) + data->pinctrl = NULL; +- else if (IS_ERR(data->pinctrl)) { +- if (PTR_ERR(data->pinctrl) != -EPROBE_DEFER) +- dev_err(dev, "pinctrl get failed, err=%ld\n", +- PTR_ERR(data->pinctrl)); +- return PTR_ERR(data->pinctrl); +- } ++ else if (IS_ERR(data->pinctrl)) ++ return dev_err_probe(dev, PTR_ERR(data->pinctrl), ++ "pinctrl get failed\n"); + + data->hsic_pad_regulator = + devm_regulator_get_optional(dev, "hsic"); + if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) { + /* no pad regualator is needed */ + data->hsic_pad_regulator = NULL; +- } else if (IS_ERR(data->hsic_pad_regulator)) { +- if (PTR_ERR(data->hsic_pad_regulator) != -EPROBE_DEFER) +- dev_err(dev, +- "Get HSIC pad regulator error: %ld\n", +- PTR_ERR(data->hsic_pad_regulator)); +- return PTR_ERR(data->hsic_pad_regulator); +- } ++ } else if (IS_ERR(data->hsic_pad_regulator)) ++ return dev_err_probe(dev, PTR_ERR(data->hsic_pad_regulator), ++ "Get HSIC pad regulator error\n"); + + if (data->hsic_pad_regulator) { + ret = regulator_enable(data->hsic_pad_regulator); +@@ -470,9 +463,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) + &pdata); + if (IS_ERR(data->ci_pdev)) { + ret = PTR_ERR(data->ci_pdev); +- if (ret != -EPROBE_DEFER) +- dev_err(dev, "ci_hdrc_add_device failed, err=%d\n", +- ret); ++ dev_err_probe(dev, ret, "ci_hdrc_add_device failed\n"); + goto err_clk; + } + +-- +2.39.5 +