From: Greg Kroah-Hartman Date: Sun, 10 Jul 2022 14:23:01 +0000 (+0200) Subject: 5.18-stable patches X-Git-Tag: v4.9.323~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab4f59861b05e7d4aeee5082ecd67f7ad7923de9;p=thirdparty%2Fkernel%2Fstable-queue.git 5.18-stable patches added patches: net-dsa-qca8k-reset-cpu-port-on-mtu-change.patch powerpc-powernv-delay-rng-platform-device-creation-until-later-in-boot.patch --- diff --git a/queue-5.18/net-dsa-qca8k-reset-cpu-port-on-mtu-change.patch b/queue-5.18/net-dsa-qca8k-reset-cpu-port-on-mtu-change.patch new file mode 100644 index 00000000000..b77dbde7ce2 --- /dev/null +++ b/queue-5.18/net-dsa-qca8k-reset-cpu-port-on-mtu-change.patch @@ -0,0 +1,71 @@ +From 386228c694bf1e7a7688e44412cb33500b0ac585 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Tue, 21 Jun 2022 17:11:22 +0200 +Subject: net: dsa: qca8k: reset cpu port on MTU change + +From: Christian Marangi + +commit 386228c694bf1e7a7688e44412cb33500b0ac585 upstream. + +It was discovered that the Documentation lacks of a fundamental detail +on how to correctly change the MAX_FRAME_SIZE of the switch. + +In fact if the MAX_FRAME_SIZE is changed while the cpu port is on, the +switch panics and cease to send any packet. This cause the mgmt ethernet +system to not receive any packet (the slow fallback still works) and +makes the device not reachable. To recover from this a switch reset is +required. + +To correctly handle this, turn off the cpu ports before changing the +MAX_FRAME_SIZE and turn on again after the value is applied. + +Fixes: f58d2598cf70 ("net: dsa: qca8k: implement the port MTU callbacks") +Cc: stable@vger.kernel.org +Signed-off-by: Christian Marangi +Link: https://lore.kernel.org/r/20220621151122.10220-1-ansuelsmth@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/dsa/qca8k.c | 23 +++++++++++++++++++++-- + 1 file changed, 21 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -2372,7 +2372,7 @@ static int + qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) + { + struct qca8k_priv *priv = ds->priv; +- int i, mtu = 0; ++ int ret, i, mtu = 0; + + priv->port_mtu[port] = new_mtu; + +@@ -2380,8 +2380,27 @@ qca8k_port_change_mtu(struct dsa_switch + if (priv->port_mtu[i] > mtu) + mtu = priv->port_mtu[i]; + ++ /* To change the MAX_FRAME_SIZE the cpu ports must be off or ++ * the switch panics. ++ * Turn off both cpu ports before applying the new value to prevent ++ * this. ++ */ ++ if (priv->port_sts[0].enabled) ++ qca8k_port_set_status(priv, 0, 0); ++ ++ if (priv->port_sts[6].enabled) ++ qca8k_port_set_status(priv, 6, 0); ++ + /* Include L2 header / FCS length */ +- return qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, mtu + ETH_HLEN + ETH_FCS_LEN); ++ ret = qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, mtu + ETH_HLEN + ETH_FCS_LEN); ++ ++ if (priv->port_sts[0].enabled) ++ qca8k_port_set_status(priv, 0, 1); ++ ++ if (priv->port_sts[6].enabled) ++ qca8k_port_set_status(priv, 6, 1); ++ ++ return ret; + } + + static int diff --git a/queue-5.18/powerpc-powernv-delay-rng-platform-device-creation-until-later-in-boot.patch b/queue-5.18/powerpc-powernv-delay-rng-platform-device-creation-until-later-in-boot.patch new file mode 100644 index 00000000000..d9c89cbf32d --- /dev/null +++ b/queue-5.18/powerpc-powernv-delay-rng-platform-device-creation-until-later-in-boot.patch @@ -0,0 +1,73 @@ +From 887502826549caa7e4215fd9e628f48f14c0825a Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Thu, 30 Jun 2022 14:16:54 +0200 +Subject: powerpc/powernv: delay rng platform device creation until later in boot + +From: Jason A. Donenfeld + +commit 887502826549caa7e4215fd9e628f48f14c0825a upstream. + +The platform device for the rng must be created much later in boot. +Otherwise it tries to connect to a parent that doesn't yet exist, +resulting in this splat: + + [ 0.000478] kobject: '(null)' ((____ptrval____)): is not initialized, yet kobject_get() is being called. + [ 0.002925] [c000000002a0fb30] [c00000000073b0bc] kobject_get+0x8c/0x100 (unreliable) + [ 0.003071] [c000000002a0fba0] [c00000000087e464] device_add+0xf4/0xb00 + [ 0.003194] [c000000002a0fc80] [c000000000a7f6e4] of_device_add+0x64/0x80 + [ 0.003321] [c000000002a0fcb0] [c000000000a800d0] of_platform_device_create_pdata+0xd0/0x1b0 + [ 0.003476] [c000000002a0fd00] [c00000000201fa44] pnv_get_random_long_early+0x240/0x2e4 + [ 0.003623] [c000000002a0fe20] [c000000002060c38] random_init+0xc0/0x214 + +This patch fixes the issue by doing the platform device creation inside +of machine_subsys_initcall. + +Fixes: f3eac426657d ("powerpc/powernv: wire up rng during setup_arch") +Cc: stable@vger.kernel.org +Reported-by: Sachin Sant +Signed-off-by: Jason A. Donenfeld +Tested-by: Sachin Sant +[mpe: Change "of node" to "platform device" in change log] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20220630121654.1939181-1-Jason@zx2c4.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/platforms/powernv/rng.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +--- a/arch/powerpc/platforms/powernv/rng.c ++++ b/arch/powerpc/platforms/powernv/rng.c +@@ -176,12 +176,8 @@ static int __init pnv_get_random_long_ea + NULL) != pnv_get_random_long_early) + return 0; + +- for_each_compatible_node(dn, NULL, "ibm,power-rng") { +- if (rng_create(dn)) +- continue; +- /* Create devices for hwrng driver */ +- of_platform_device_create(dn, NULL, NULL); +- } ++ for_each_compatible_node(dn, NULL, "ibm,power-rng") ++ rng_create(dn); + + if (!ppc_md.get_random_seed) + return 0; +@@ -205,10 +201,18 @@ void __init pnv_rng_init(void) + + static int __init pnv_rng_late_init(void) + { ++ struct device_node *dn; + unsigned long v; ++ + /* In case it wasn't called during init for some other reason. */ + if (ppc_md.get_random_seed == pnv_get_random_long_early) + pnv_get_random_long_early(&v); ++ ++ if (ppc_md.get_random_seed == powernv_get_random_long) { ++ for_each_compatible_node(dn, NULL, "ibm,power-rng") ++ of_platform_device_create(dn, NULL, NULL); ++ } ++ + return 0; + } + machine_subsys_initcall(powernv, pnv_rng_late_init); diff --git a/queue-5.18/series b/queue-5.18/series index 43345ad22cd..fd0557847da 100644 --- a/queue-5.18/series +++ b/queue-5.18/series @@ -40,3 +40,5 @@ memregion-fix-memregion_free-fallback-definition.patch video-of_display_timing.h-include-errno.h.patch fscache-fix-invalidation-lookup-race.patch fscache-fix-if-condition-in-fscache_wait_on_volume_collision.patch +powerpc-powernv-delay-rng-platform-device-creation-until-later-in-boot.patch +net-dsa-qca8k-reset-cpu-port-on-mtu-change.patch