From: Sasha Levin Date: Wed, 15 Mar 2023 01:48:18 +0000 (-0400) Subject: Fixes for 6.1 X-Git-Tag: v4.14.310~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f8237f909e803f25cea1eee2f8c5f0f346f52608;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.1 Signed-off-by: Sasha Levin --- diff --git a/queue-6.1/alpha-fix-r_alpha_literal-reloc-for-large-modules.patch b/queue-6.1/alpha-fix-r_alpha_literal-reloc-for-large-modules.patch new file mode 100644 index 00000000000..533593f422a --- /dev/null +++ b/queue-6.1/alpha-fix-r_alpha_literal-reloc-for-large-modules.patch @@ -0,0 +1,55 @@ +From 4f560e875bdf3b57d8aadf62b4512702c3119bc9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 27 Aug 2022 02:49:39 -0400 +Subject: alpha: fix R_ALPHA_LITERAL reloc for large modules + +From: Edward Humes + +[ Upstream commit b6b17a8b3ecd878d98d5472a9023ede9e669ca72 ] + +Previously, R_ALPHA_LITERAL relocations would overflow for large kernel +modules. + +This was because the Alpha's apply_relocate_add was relying on the kernel's +module loader to have sorted the GOT towards the very end of the module as it +was mapped into memory in order to correctly assign the global pointer. While +this behavior would mostly work fine for small kernel modules, this approach +would overflow on kernel modules with large GOT's since the global pointer +would be very far away from the GOT, and thus, certain entries would be out of +range. + +This patch fixes this by instead using the Tru64 behavior of assigning the +global pointer to be 32KB away from the start of the GOT. The change made +in this patch won't work for multi-GOT kernel modules as it makes the +assumption the module only has one GOT located at the beginning of .got, +although for the vast majority kernel modules, this should be fine. Of the +kernel modules that would previously result in a relocation error, none of +them, even modules like nouveau, have even come close to filling up a single +GOT, and they've all worked fine under this patch. + +Signed-off-by: Edward Humes +Signed-off-by: Matt Turner +Signed-off-by: Sasha Levin +--- + arch/alpha/kernel/module.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c +index 5b60c248de9ea..cbefa5a773846 100644 +--- a/arch/alpha/kernel/module.c ++++ b/arch/alpha/kernel/module.c +@@ -146,10 +146,8 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab, + base = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr; + symtab = (Elf64_Sym *)sechdrs[symindex].sh_addr; + +- /* The small sections were sorted to the end of the segment. +- The following should definitely cover them. */ +- gp = (u64)me->core_layout.base + me->core_layout.size - 0x8000; + got = sechdrs[me->arch.gotsecindex].sh_addr; ++ gp = got + 0x8000; + + for (i = 0; i < n; i++) { + unsigned long r_sym = ELF64_R_SYM (rela[i].r_info); +-- +2.39.2 + diff --git a/queue-6.1/clk-qcom-mmcc-apq8084-remove-spdm-clocks.patch b/queue-6.1/clk-qcom-mmcc-apq8084-remove-spdm-clocks.patch new file mode 100644 index 00000000000..7f7573e12f0 --- /dev/null +++ b/queue-6.1/clk-qcom-mmcc-apq8084-remove-spdm-clocks.patch @@ -0,0 +1,315 @@ +From 2afdca4b124d5e436c550327e60b950350064462 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Jan 2023 08:04:00 +0200 +Subject: clk: qcom: mmcc-apq8084: remove spdm clocks + +From: Dmitry Baryshkov + +[ Upstream commit 7b347f4b677b6d84687e67d82b6b17c6f55ea2b4 ] + +SPDM is used for debug/profiling and does not have any other +functionality. These clocks can safely be removed. + +Suggested-by: Stephen Boyd +Suggested-by: Georgi Djakov +Reviewed-by: Konrad Dybcio +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Bjorn Andersson +Link: https://lore.kernel.org/r/20230111060402.1168726-11-dmitry.baryshkov@linaro.org +Signed-off-by: Sasha Levin +--- + drivers/clk/qcom/mmcc-apq8084.c | 271 -------------------------------- + 1 file changed, 271 deletions(-) + +diff --git a/drivers/clk/qcom/mmcc-apq8084.c b/drivers/clk/qcom/mmcc-apq8084.c +index e9f9713591558..025e21793b3c4 100644 +--- a/drivers/clk/qcom/mmcc-apq8084.c ++++ b/drivers/clk/qcom/mmcc-apq8084.c +@@ -2364,262 +2364,6 @@ static struct clk_branch mmss_rbcpr_clk = { + }, + }; + +-static struct clk_branch mmss_spdm_ahb_clk = { +- .halt_reg = 0x0230, +- .clkr = { +- .enable_reg = 0x0230, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_ahb_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_ahb_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_axi_clk = { +- .halt_reg = 0x0210, +- .clkr = { +- .enable_reg = 0x0210, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_axi_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_axi_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_csi0_clk = { +- .halt_reg = 0x023c, +- .clkr = { +- .enable_reg = 0x023c, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_csi0_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_csi0_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_gfx3d_clk = { +- .halt_reg = 0x022c, +- .clkr = { +- .enable_reg = 0x022c, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_gfx3d_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_gfx3d_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_jpeg0_clk = { +- .halt_reg = 0x0204, +- .clkr = { +- .enable_reg = 0x0204, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_jpeg0_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_jpeg0_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_jpeg1_clk = { +- .halt_reg = 0x0208, +- .clkr = { +- .enable_reg = 0x0208, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_jpeg1_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_jpeg1_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_jpeg2_clk = { +- .halt_reg = 0x0224, +- .clkr = { +- .enable_reg = 0x0224, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_jpeg2_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_jpeg2_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_mdp_clk = { +- .halt_reg = 0x020c, +- .clkr = { +- .enable_reg = 0x020c, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_mdp_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_mdp_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_pclk0_clk = { +- .halt_reg = 0x0234, +- .clkr = { +- .enable_reg = 0x0234, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_pclk0_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_pclk0_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_pclk1_clk = { +- .halt_reg = 0x0228, +- .clkr = { +- .enable_reg = 0x0228, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_pclk1_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_pclk1_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_vcodec0_clk = { +- .halt_reg = 0x0214, +- .clkr = { +- .enable_reg = 0x0214, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_vcodec0_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_vcodec0_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_vfe0_clk = { +- .halt_reg = 0x0218, +- .clkr = { +- .enable_reg = 0x0218, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_vfe0_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_vfe0_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_vfe1_clk = { +- .halt_reg = 0x021c, +- .clkr = { +- .enable_reg = 0x021c, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_vfe1_clk", +- .parent_names = (const char *[]){ +- "mmss_spdm_vfe1_div_clk", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_rm_axi_clk = { +- .halt_reg = 0x0304, +- .clkr = { +- .enable_reg = 0x0304, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_rm_axi_clk", +- .parent_names = (const char *[]){ +- "mmss_axi_clk_src", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +-static struct clk_branch mmss_spdm_rm_ocmemnoc_clk = { +- .halt_reg = 0x0308, +- .clkr = { +- .enable_reg = 0x0308, +- .enable_mask = BIT(0), +- .hw.init = &(struct clk_init_data){ +- .name = "mmss_spdm_rm_ocmemnoc_clk", +- .parent_names = (const char *[]){ +- "ocmemnoc_clk_src", +- }, +- .num_parents = 1, +- .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_branch2_ops, +- }, +- }, +-}; +- +- + static struct clk_branch mmss_misc_ahb_clk = { + .halt_reg = 0x502c, + .clkr = { +@@ -3252,21 +2996,6 @@ static struct clk_regmap *mmcc_apq8084_clocks[] = { + [MDSS_VSYNC_CLK] = &mdss_vsync_clk.clkr, + [MMSS_RBCPR_AHB_CLK] = &mmss_rbcpr_ahb_clk.clkr, + [MMSS_RBCPR_CLK] = &mmss_rbcpr_clk.clkr, +- [MMSS_SPDM_AHB_CLK] = &mmss_spdm_ahb_clk.clkr, +- [MMSS_SPDM_AXI_CLK] = &mmss_spdm_axi_clk.clkr, +- [MMSS_SPDM_CSI0_CLK] = &mmss_spdm_csi0_clk.clkr, +- [MMSS_SPDM_GFX3D_CLK] = &mmss_spdm_gfx3d_clk.clkr, +- [MMSS_SPDM_JPEG0_CLK] = &mmss_spdm_jpeg0_clk.clkr, +- [MMSS_SPDM_JPEG1_CLK] = &mmss_spdm_jpeg1_clk.clkr, +- [MMSS_SPDM_JPEG2_CLK] = &mmss_spdm_jpeg2_clk.clkr, +- [MMSS_SPDM_MDP_CLK] = &mmss_spdm_mdp_clk.clkr, +- [MMSS_SPDM_PCLK0_CLK] = &mmss_spdm_pclk0_clk.clkr, +- [MMSS_SPDM_PCLK1_CLK] = &mmss_spdm_pclk1_clk.clkr, +- [MMSS_SPDM_VCODEC0_CLK] = &mmss_spdm_vcodec0_clk.clkr, +- [MMSS_SPDM_VFE0_CLK] = &mmss_spdm_vfe0_clk.clkr, +- [MMSS_SPDM_VFE1_CLK] = &mmss_spdm_vfe1_clk.clkr, +- [MMSS_SPDM_RM_AXI_CLK] = &mmss_spdm_rm_axi_clk.clkr, +- [MMSS_SPDM_RM_OCMEMNOC_CLK] = &mmss_spdm_rm_ocmemnoc_clk.clkr, + [MMSS_MISC_AHB_CLK] = &mmss_misc_ahb_clk.clkr, + [MMSS_MMSSNOC_AHB_CLK] = &mmss_mmssnoc_ahb_clk.clkr, + [MMSS_MMSSNOC_BTO_AHB_CLK] = &mmss_mmssnoc_bto_ahb_clk.clkr, +-- +2.39.2 + diff --git a/queue-6.1/clk-renesas-rcar-gen3-disable-r-car-h3-es1.patch b/queue-6.1/clk-renesas-rcar-gen3-disable-r-car-h3-es1.patch new file mode 100644 index 00000000000..9e1ab0285d0 --- /dev/null +++ b/queue-6.1/clk-renesas-rcar-gen3-disable-r-car-h3-es1.patch @@ -0,0 +1,369 @@ +From 891d653b1a47cac48da86dd42f7f101619312343 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Feb 2023 10:23:31 +0100 +Subject: clk: renesas: rcar-gen3: Disable R-Car H3 ES1.* + +From: Wolfram Sang + +[ Upstream commit b1dec4e78599a2ce5bf8557056cd6dd72e1096b0 ] + +R-Car H3 ES1.* was only available to an internal development group and +needed a lot of quirks and workarounds. These become a maintenance +burden now, so our development group decided to remove upstream support +for this SoC. Public users only have ES2 onwards. + +In addition to the ES1 specific removals, a check for it was added +preventing the machine to boot further. It may otherwise inherit wrong +clock settings from ES2 which could damage the hardware. + +Signed-off-by: Wolfram Sang +Reviewed-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/20230202092332.2504-1-wsa+renesas@sang-engineering.com +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Sasha Levin +--- + drivers/clk/renesas/Kconfig | 2 +- + drivers/clk/renesas/r8a7795-cpg-mssr.c | 126 ++----------------------- + drivers/clk/renesas/rcar-gen3-cpg.c | 17 +--- + drivers/clk/renesas/renesas-cpg-mssr.c | 27 ------ + drivers/clk/renesas/renesas-cpg-mssr.h | 14 --- + 5 files changed, 13 insertions(+), 173 deletions(-) + +diff --git a/drivers/clk/renesas/Kconfig b/drivers/clk/renesas/Kconfig +index cacaf9b87d264..37632a0659d82 100644 +--- a/drivers/clk/renesas/Kconfig ++++ b/drivers/clk/renesas/Kconfig +@@ -22,7 +22,7 @@ config CLK_RENESAS + select CLK_R8A7791 if ARCH_R8A7791 || ARCH_R8A7793 + select CLK_R8A7792 if ARCH_R8A7792 + select CLK_R8A7794 if ARCH_R8A7794 +- select CLK_R8A7795 if ARCH_R8A77950 || ARCH_R8A77951 ++ select CLK_R8A7795 if ARCH_R8A77951 + select CLK_R8A77960 if ARCH_R8A77960 + select CLK_R8A77961 if ARCH_R8A77961 + select CLK_R8A77965 if ARCH_R8A77965 +diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c +index 301475c74f500..7a585a777d387 100644 +--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c ++++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c +@@ -128,7 +128,6 @@ static struct cpg_core_clk r8a7795_core_clks[] __initdata = { + }; + + static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = { +- DEF_MOD("fdp1-2", 117, R8A7795_CLK_S2D1), /* ES1.x */ + DEF_MOD("fdp1-1", 118, R8A7795_CLK_S0D1), + DEF_MOD("fdp1-0", 119, R8A7795_CLK_S0D1), + DEF_MOD("tmu4", 121, R8A7795_CLK_S0D6), +@@ -162,7 +161,6 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = { + DEF_MOD("pcie1", 318, R8A7795_CLK_S3D1), + DEF_MOD("pcie0", 319, R8A7795_CLK_S3D1), + DEF_MOD("usb-dmac30", 326, R8A7795_CLK_S3D1), +- DEF_MOD("usb3-if1", 327, R8A7795_CLK_S3D1), /* ES1.x */ + DEF_MOD("usb3-if0", 328, R8A7795_CLK_S3D1), + DEF_MOD("usb-dmac31", 329, R8A7795_CLK_S3D1), + DEF_MOD("usb-dmac0", 330, R8A7795_CLK_S3D1), +@@ -187,28 +185,21 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = { + DEF_MOD("hscif0", 520, R8A7795_CLK_S3D1), + DEF_MOD("thermal", 522, R8A7795_CLK_CP), + DEF_MOD("pwm", 523, R8A7795_CLK_S0D12), +- DEF_MOD("fcpvd3", 600, R8A7795_CLK_S2D1), /* ES1.x */ + DEF_MOD("fcpvd2", 601, R8A7795_CLK_S0D2), + DEF_MOD("fcpvd1", 602, R8A7795_CLK_S0D2), + DEF_MOD("fcpvd0", 603, R8A7795_CLK_S0D2), + DEF_MOD("fcpvb1", 606, R8A7795_CLK_S0D1), + DEF_MOD("fcpvb0", 607, R8A7795_CLK_S0D1), +- DEF_MOD("fcpvi2", 609, R8A7795_CLK_S2D1), /* ES1.x */ + DEF_MOD("fcpvi1", 610, R8A7795_CLK_S0D1), + DEF_MOD("fcpvi0", 611, R8A7795_CLK_S0D1), +- DEF_MOD("fcpf2", 613, R8A7795_CLK_S2D1), /* ES1.x */ + DEF_MOD("fcpf1", 614, R8A7795_CLK_S0D1), + DEF_MOD("fcpf0", 615, R8A7795_CLK_S0D1), +- DEF_MOD("fcpci1", 616, R8A7795_CLK_S2D1), /* ES1.x */ +- DEF_MOD("fcpci0", 617, R8A7795_CLK_S2D1), /* ES1.x */ + DEF_MOD("fcpcs", 619, R8A7795_CLK_S0D1), +- DEF_MOD("vspd3", 620, R8A7795_CLK_S2D1), /* ES1.x */ + DEF_MOD("vspd2", 621, R8A7795_CLK_S0D2), + DEF_MOD("vspd1", 622, R8A7795_CLK_S0D2), + DEF_MOD("vspd0", 623, R8A7795_CLK_S0D2), + DEF_MOD("vspbc", 624, R8A7795_CLK_S0D1), + DEF_MOD("vspbd", 626, R8A7795_CLK_S0D1), +- DEF_MOD("vspi2", 629, R8A7795_CLK_S2D1), /* ES1.x */ + DEF_MOD("vspi1", 630, R8A7795_CLK_S0D1), + DEF_MOD("vspi0", 631, R8A7795_CLK_S0D1), + DEF_MOD("ehci3", 700, R8A7795_CLK_S3D2), +@@ -221,7 +212,6 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = { + DEF_MOD("cmm2", 709, R8A7795_CLK_S2D1), + DEF_MOD("cmm1", 710, R8A7795_CLK_S2D1), + DEF_MOD("cmm0", 711, R8A7795_CLK_S2D1), +- DEF_MOD("csi21", 713, R8A7795_CLK_CSI0), /* ES1.x */ + DEF_MOD("csi20", 714, R8A7795_CLK_CSI0), + DEF_MOD("csi41", 715, R8A7795_CLK_CSI0), + DEF_MOD("csi40", 716, R8A7795_CLK_CSI0), +@@ -350,103 +340,26 @@ static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = { + { 2, 192, 1, 192, 1, 32, }, + }; + +-static const struct soc_device_attribute r8a7795es1[] __initconst = { ++static const struct soc_device_attribute r8a7795_denylist[] __initconst = { + { .soc_id = "r8a7795", .revision = "ES1.*" }, + { /* sentinel */ } + }; + +- +- /* +- * Fixups for R-Car H3 ES1.x +- */ +- +-static const unsigned int r8a7795es1_mod_nullify[] __initconst = { +- MOD_CLK_ID(326), /* USB-DMAC3-0 */ +- MOD_CLK_ID(329), /* USB-DMAC3-1 */ +- MOD_CLK_ID(700), /* EHCI/OHCI3 */ +- MOD_CLK_ID(705), /* HS-USB-IF3 */ +- +-}; +- +-static const struct mssr_mod_reparent r8a7795es1_mod_reparent[] __initconst = { +- { MOD_CLK_ID(118), R8A7795_CLK_S2D1 }, /* FDP1-1 */ +- { MOD_CLK_ID(119), R8A7795_CLK_S2D1 }, /* FDP1-0 */ +- { MOD_CLK_ID(121), R8A7795_CLK_S3D2 }, /* TMU4 */ +- { MOD_CLK_ID(217), R8A7795_CLK_S3D1 }, /* SYS-DMAC2 */ +- { MOD_CLK_ID(218), R8A7795_CLK_S3D1 }, /* SYS-DMAC1 */ +- { MOD_CLK_ID(219), R8A7795_CLK_S3D1 }, /* SYS-DMAC0 */ +- { MOD_CLK_ID(408), R8A7795_CLK_S3D1 }, /* INTC-AP */ +- { MOD_CLK_ID(501), R8A7795_CLK_S3D1 }, /* AUDMAC1 */ +- { MOD_CLK_ID(502), R8A7795_CLK_S3D1 }, /* AUDMAC0 */ +- { MOD_CLK_ID(523), R8A7795_CLK_S3D4 }, /* PWM */ +- { MOD_CLK_ID(601), R8A7795_CLK_S2D1 }, /* FCPVD2 */ +- { MOD_CLK_ID(602), R8A7795_CLK_S2D1 }, /* FCPVD1 */ +- { MOD_CLK_ID(603), R8A7795_CLK_S2D1 }, /* FCPVD0 */ +- { MOD_CLK_ID(606), R8A7795_CLK_S2D1 }, /* FCPVB1 */ +- { MOD_CLK_ID(607), R8A7795_CLK_S2D1 }, /* FCPVB0 */ +- { MOD_CLK_ID(610), R8A7795_CLK_S2D1 }, /* FCPVI1 */ +- { MOD_CLK_ID(611), R8A7795_CLK_S2D1 }, /* FCPVI0 */ +- { MOD_CLK_ID(614), R8A7795_CLK_S2D1 }, /* FCPF1 */ +- { MOD_CLK_ID(615), R8A7795_CLK_S2D1 }, /* FCPF0 */ +- { MOD_CLK_ID(619), R8A7795_CLK_S2D1 }, /* FCPCS */ +- { MOD_CLK_ID(621), R8A7795_CLK_S2D1 }, /* VSPD2 */ +- { MOD_CLK_ID(622), R8A7795_CLK_S2D1 }, /* VSPD1 */ +- { MOD_CLK_ID(623), R8A7795_CLK_S2D1 }, /* VSPD0 */ +- { MOD_CLK_ID(624), R8A7795_CLK_S2D1 }, /* VSPBC */ +- { MOD_CLK_ID(626), R8A7795_CLK_S2D1 }, /* VSPBD */ +- { MOD_CLK_ID(630), R8A7795_CLK_S2D1 }, /* VSPI1 */ +- { MOD_CLK_ID(631), R8A7795_CLK_S2D1 }, /* VSPI0 */ +- { MOD_CLK_ID(804), R8A7795_CLK_S2D1 }, /* VIN7 */ +- { MOD_CLK_ID(805), R8A7795_CLK_S2D1 }, /* VIN6 */ +- { MOD_CLK_ID(806), R8A7795_CLK_S2D1 }, /* VIN5 */ +- { MOD_CLK_ID(807), R8A7795_CLK_S2D1 }, /* VIN4 */ +- { MOD_CLK_ID(808), R8A7795_CLK_S2D1 }, /* VIN3 */ +- { MOD_CLK_ID(809), R8A7795_CLK_S2D1 }, /* VIN2 */ +- { MOD_CLK_ID(810), R8A7795_CLK_S2D1 }, /* VIN1 */ +- { MOD_CLK_ID(811), R8A7795_CLK_S2D1 }, /* VIN0 */ +- { MOD_CLK_ID(812), R8A7795_CLK_S3D2 }, /* EAVB-IF */ +- { MOD_CLK_ID(820), R8A7795_CLK_S2D1 }, /* IMR3 */ +- { MOD_CLK_ID(821), R8A7795_CLK_S2D1 }, /* IMR2 */ +- { MOD_CLK_ID(822), R8A7795_CLK_S2D1 }, /* IMR1 */ +- { MOD_CLK_ID(823), R8A7795_CLK_S2D1 }, /* IMR0 */ +- { MOD_CLK_ID(905), R8A7795_CLK_CP }, /* GPIO7 */ +- { MOD_CLK_ID(906), R8A7795_CLK_CP }, /* GPIO6 */ +- { MOD_CLK_ID(907), R8A7795_CLK_CP }, /* GPIO5 */ +- { MOD_CLK_ID(908), R8A7795_CLK_CP }, /* GPIO4 */ +- { MOD_CLK_ID(909), R8A7795_CLK_CP }, /* GPIO3 */ +- { MOD_CLK_ID(910), R8A7795_CLK_CP }, /* GPIO2 */ +- { MOD_CLK_ID(911), R8A7795_CLK_CP }, /* GPIO1 */ +- { MOD_CLK_ID(912), R8A7795_CLK_CP }, /* GPIO0 */ +- { MOD_CLK_ID(918), R8A7795_CLK_S3D2 }, /* I2C6 */ +- { MOD_CLK_ID(919), R8A7795_CLK_S3D2 }, /* I2C5 */ +- { MOD_CLK_ID(927), R8A7795_CLK_S3D2 }, /* I2C4 */ +- { MOD_CLK_ID(928), R8A7795_CLK_S3D2 }, /* I2C3 */ +-}; +- +- +- /* +- * Fixups for R-Car H3 ES2.x +- */ +- +-static const unsigned int r8a7795es2_mod_nullify[] __initconst = { +- MOD_CLK_ID(117), /* FDP1-2 */ +- MOD_CLK_ID(327), /* USB3-IF1 */ +- MOD_CLK_ID(600), /* FCPVD3 */ +- MOD_CLK_ID(609), /* FCPVI2 */ +- MOD_CLK_ID(613), /* FCPF2 */ +- MOD_CLK_ID(616), /* FCPCI1 */ +- MOD_CLK_ID(617), /* FCPCI0 */ +- MOD_CLK_ID(620), /* VSPD3 */ +- MOD_CLK_ID(629), /* VSPI2 */ +- MOD_CLK_ID(713), /* CSI21 */ +-}; +- + static int __init r8a7795_cpg_mssr_init(struct device *dev) + { + const struct rcar_gen3_cpg_pll_config *cpg_pll_config; + u32 cpg_mode; + int error; + ++ /* ++ * We panic here to ensure removed SoCs and clk updates are always in ++ * sync to avoid overclocking damages. The panic can only be seen with ++ * commandline args 'earlycon keep_bootcon'. But these SoCs were for ++ * developers only anyhow. ++ */ ++ if (soc_device_match(r8a7795_denylist)) ++ panic("SoC not supported anymore!\n"); ++ + error = rcar_rst_read_mode_pins(&cpg_mode); + if (error) + return error; +@@ -457,25 +370,6 @@ static int __init r8a7795_cpg_mssr_init(struct device *dev) + return -EINVAL; + } + +- if (soc_device_match(r8a7795es1)) { +- cpg_core_nullify_range(r8a7795_core_clks, +- ARRAY_SIZE(r8a7795_core_clks), +- R8A7795_CLK_S0D2, R8A7795_CLK_S0D12); +- mssr_mod_nullify(r8a7795_mod_clks, +- ARRAY_SIZE(r8a7795_mod_clks), +- r8a7795es1_mod_nullify, +- ARRAY_SIZE(r8a7795es1_mod_nullify)); +- mssr_mod_reparent(r8a7795_mod_clks, +- ARRAY_SIZE(r8a7795_mod_clks), +- r8a7795es1_mod_reparent, +- ARRAY_SIZE(r8a7795es1_mod_reparent)); +- } else { +- mssr_mod_nullify(r8a7795_mod_clks, +- ARRAY_SIZE(r8a7795_mod_clks), +- r8a7795es2_mod_nullify, +- ARRAY_SIZE(r8a7795es2_mod_nullify)); +- } +- + return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR, cpg_mode); + } + +diff --git a/drivers/clk/renesas/rcar-gen3-cpg.c b/drivers/clk/renesas/rcar-gen3-cpg.c +index e668f23c75e7d..b3ef62fa612e3 100644 +--- a/drivers/clk/renesas/rcar-gen3-cpg.c ++++ b/drivers/clk/renesas/rcar-gen3-cpg.c +@@ -310,19 +310,10 @@ static unsigned int cpg_clk_extalr __initdata; + static u32 cpg_mode __initdata; + static u32 cpg_quirks __initdata; + +-#define PLL_ERRATA BIT(0) /* Missing PLL0/2/4 post-divider */ + #define RCKCR_CKSEL BIT(1) /* Manual RCLK parent selection */ + + + static const struct soc_device_attribute cpg_quirks_match[] __initconst = { +- { +- .soc_id = "r8a7795", .revision = "ES1.0", +- .data = (void *)(PLL_ERRATA | RCKCR_CKSEL), +- }, +- { +- .soc_id = "r8a7795", .revision = "ES1.*", +- .data = (void *)(RCKCR_CKSEL), +- }, + { + .soc_id = "r8a7796", .revision = "ES1.0", + .data = (void *)(RCKCR_CKSEL), +@@ -355,9 +346,8 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev, + * multiplier when cpufreq changes between normal and boost + * modes. + */ +- mult = (cpg_quirks & PLL_ERRATA) ? 4 : 2; + return cpg_pll_clk_register(core->name, __clk_get_name(parent), +- base, mult, CPG_PLL0CR, 0); ++ base, 2, CPG_PLL0CR, 0); + + case CLK_TYPE_GEN3_PLL1: + mult = cpg_pll_config->pll1_mult; +@@ -370,9 +360,8 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev, + * multiplier when cpufreq changes between normal and boost + * modes. + */ +- mult = (cpg_quirks & PLL_ERRATA) ? 4 : 2; + return cpg_pll_clk_register(core->name, __clk_get_name(parent), +- base, mult, CPG_PLL2CR, 2); ++ base, 2, CPG_PLL2CR, 2); + + case CLK_TYPE_GEN3_PLL3: + mult = cpg_pll_config->pll3_mult; +@@ -388,8 +377,6 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev, + */ + value = readl(base + CPG_PLL4CR); + mult = (((value >> 24) & 0x7f) + 1) * 2; +- if (cpg_quirks & PLL_ERRATA) +- mult *= 2; + break; + + case CLK_TYPE_GEN3_SDH: +diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c +index 1a0cdf001b2f2..523fd45231571 100644 +--- a/drivers/clk/renesas/renesas-cpg-mssr.c ++++ b/drivers/clk/renesas/renesas-cpg-mssr.c +@@ -1113,19 +1113,6 @@ static int __init cpg_mssr_init(void) + + subsys_initcall(cpg_mssr_init); + +-void __init cpg_core_nullify_range(struct cpg_core_clk *core_clks, +- unsigned int num_core_clks, +- unsigned int first_clk, +- unsigned int last_clk) +-{ +- unsigned int i; +- +- for (i = 0; i < num_core_clks; i++) +- if (core_clks[i].id >= first_clk && +- core_clks[i].id <= last_clk) +- core_clks[i].name = NULL; +-} +- + void __init mssr_mod_nullify(struct mssr_mod_clk *mod_clks, + unsigned int num_mod_clks, + const unsigned int *clks, unsigned int n) +@@ -1139,19 +1126,5 @@ void __init mssr_mod_nullify(struct mssr_mod_clk *mod_clks, + } + } + +-void __init mssr_mod_reparent(struct mssr_mod_clk *mod_clks, +- unsigned int num_mod_clks, +- const struct mssr_mod_reparent *clks, +- unsigned int n) +-{ +- unsigned int i, j; +- +- for (i = 0, j = 0; i < num_mod_clks && j < n; i++) +- if (mod_clks[i].id == clks[j].clk) { +- mod_clks[i].parent = clks[j].parent; +- j++; +- } +-} +- + MODULE_DESCRIPTION("Renesas CPG/MSSR Driver"); + MODULE_LICENSE("GPL v2"); +diff --git a/drivers/clk/renesas/renesas-cpg-mssr.h b/drivers/clk/renesas/renesas-cpg-mssr.h +index 1c3c057d17f53..80c5b462924ac 100644 +--- a/drivers/clk/renesas/renesas-cpg-mssr.h ++++ b/drivers/clk/renesas/renesas-cpg-mssr.h +@@ -187,21 +187,7 @@ void __init cpg_mssr_early_init(struct device_node *np, + /* + * Helpers for fixing up clock tables depending on SoC revision + */ +- +-struct mssr_mod_reparent { +- unsigned int clk, parent; +-}; +- +- +-extern void cpg_core_nullify_range(struct cpg_core_clk *core_clks, +- unsigned int num_core_clks, +- unsigned int first_clk, +- unsigned int last_clk); + extern void mssr_mod_nullify(struct mssr_mod_clk *mod_clks, + unsigned int num_mod_clks, + const unsigned int *clks, unsigned int n); +-extern void mssr_mod_reparent(struct mssr_mod_clk *mod_clks, +- unsigned int num_mod_clks, +- const struct mssr_mod_reparent *clks, +- unsigned int n); + #endif +-- +2.39.2 + diff --git a/queue-6.1/macintosh-windfarm-use-unsigned-type-for-1-bit-bitfi.patch b/queue-6.1/macintosh-windfarm-use-unsigned-type-for-1-bit-bitfi.patch new file mode 100644 index 00000000000..fc61cc9cc9a --- /dev/null +++ b/queue-6.1/macintosh-windfarm-use-unsigned-type-for-1-bit-bitfi.patch @@ -0,0 +1,68 @@ +From 124cc430cfa9ee6c189c9c633e4585879c2b75d6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Feb 2023 10:12:12 -0700 +Subject: macintosh: windfarm: Use unsigned type for 1-bit bitfields + +From: Nathan Chancellor + +[ Upstream commit 748ea32d2dbd813d3bd958117bde5191182f909a ] + +Clang warns: + + drivers/macintosh/windfarm_lm75_sensor.c:63:14: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] + lm->inited = 1; + ^ ~ + + drivers/macintosh/windfarm_smu_sensors.c:356:19: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] + pow->fake_volts = 1; + ^ ~ + drivers/macintosh/windfarm_smu_sensors.c:368:18: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] + pow->quadratic = 1; + ^ ~ + +There is no bug here since no code checks the actual value of these +fields, just whether or not they are zero (boolean context), but this +can be easily fixed by switching to an unsigned type. + +Signed-off-by: Nathan Chancellor +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20230215-windfarm-wsingle-bit-bitfield-constant-conversion-v1-1-26415072e855@kernel.org +Signed-off-by: Sasha Levin +--- + drivers/macintosh/windfarm_lm75_sensor.c | 4 ++-- + drivers/macintosh/windfarm_smu_sensors.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c +index 204661c8e918f..9dd80837a759a 100644 +--- a/drivers/macintosh/windfarm_lm75_sensor.c ++++ b/drivers/macintosh/windfarm_lm75_sensor.c +@@ -33,8 +33,8 @@ + #endif + + struct wf_lm75_sensor { +- int ds1775 : 1; +- int inited : 1; ++ unsigned int ds1775 : 1; ++ unsigned int inited : 1; + struct i2c_client *i2c; + struct wf_sensor sens; + }; +diff --git a/drivers/macintosh/windfarm_smu_sensors.c b/drivers/macintosh/windfarm_smu_sensors.c +index 00c6fe25fcba0..2bdb73b34d291 100644 +--- a/drivers/macintosh/windfarm_smu_sensors.c ++++ b/drivers/macintosh/windfarm_smu_sensors.c +@@ -274,8 +274,8 @@ struct smu_cpu_power_sensor { + struct list_head link; + struct wf_sensor *volts; + struct wf_sensor *amps; +- int fake_volts : 1; +- int quadratic : 1; ++ unsigned int fake_volts : 1; ++ unsigned int quadratic : 1; + struct wf_sensor sens; + }; + #define to_smu_cpu_power(c) container_of(c, struct smu_cpu_power_sensor, sens) +-- +2.39.2 + diff --git a/queue-6.1/media-ov5640-fix-analogue-gain-control.patch b/queue-6.1/media-ov5640-fix-analogue-gain-control.patch new file mode 100644 index 00000000000..70fe88b93dd --- /dev/null +++ b/queue-6.1/media-ov5640-fix-analogue-gain-control.patch @@ -0,0 +1,93 @@ +From 310db0ad3125cc57dd9e5eae3b51dd4462d5a4f0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 28 Nov 2022 09:02:01 +0100 +Subject: media: ov5640: Fix analogue gain control + +From: Paul Elder + +[ Upstream commit afa4805799c1d332980ad23339fdb07b5e0cf7e0 ] + +Gain control is badly documented in publicly available (including +leaked) documentation. + +There is an AGC pre-gain in register 0x3a13, expressed as a 6-bit value +(plus an enable bit in bit 6). The driver hardcodes it to 0x43, which +one application note states is equal to x1.047. The documentation also +states that 0x40 is equel to x1.000. The pre-gain thus seems to be +expressed as in 1/64 increments, and thus ranges from x1.00 to x1.984. +What the pre-gain does is however unspecified. + +There is then an AGC gain limit, in registers 0x3a18 and 0x3a19, +expressed as a 10-bit "real gain format" value. One application note +sets it to 0x00f8 and states it is equal to x15.5, so it appears to be +expressed in 1/16 increments, up to x63.9375. + +The manual gain is stored in registers 0x350a and 0x350b, also as a +10-bit "real gain format" value. It is documented in the application +note as a Q6.4 values, up to x63.9375. + +One version of the datasheet indicates that the sensor supports a +digital gain: + + The OV5640 supports 1/2/4 digital gain. Normally, the gain is + controlled automatically by the automatic gain control (AGC) block. + +It isn't clear how that would be controlled manually. + +There appears to be no indication regarding whether the gain controlled +through registers 0x350a and 0x350b is an analogue gain only or also +includes digital gain. The words "real gain" don't necessarily mean +"combined analogue and digital gains". Some OmniVision sensors (such as +the OV8858) are documented as supoprting different formats for the gain +values, selectable through a register bit, and they are called "real +gain format" and "sensor gain format". For that sensor, we have (one of) +the gain registers documented as + + 0x3503[2]=0, gain[7:0] is real gain format, where low 4 bits are + fraction bits, for example, 0x10 is 1x gain, 0x28 is 2.5x gain + + If 0x3503[2]=1, gain[7:0] is sensor gain format, gain[7:4] is coarse + gain, 00000: 1x, 00001: 2x, 00011: 4x, 00111: 8x, gain[7] is 1, + gain[3:0] is fine gain. For example, 0x10 is 1x gain, 0x30 is 2x gain, + 0x70 is 4x gain + +(The second part of the text makes little sense) + +"Real gain" may thus refer to the combination of the coarse and fine +analogue gains as a single value. + +The OV5640 0x350a and 0x350b registers thus appear to control analogue +gain. The driver incorrectly uses V4L2_CID_GAIN as V4L2 has a specific +control for analogue gain, V4L2_CID_ANALOGUE_GAIN. Use it. + +If registers 0x350a and 0x350b are later found to control digital gain +as well, the driver could then restrict the range of the analogue gain +control value to lower than x64 and add a separate digital gain control. + +Signed-off-by: Paul Elder +Signed-off-by: Laurent Pinchart +Reviewed-by: Jacopo Mondi +Reviewed-by: Jai Luthra +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/i2c/ov5640.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c +index 873087e180561..267f514023e72 100644 +--- a/drivers/media/i2c/ov5640.c ++++ b/drivers/media/i2c/ov5640.c +@@ -3482,7 +3482,7 @@ static int ov5640_init_controls(struct ov5640_dev *sensor) + /* Auto/manual gain */ + ctrls->auto_gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_AUTOGAIN, + 0, 1, 1, 1); +- ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_GAIN, ++ ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_ANALOGUE_GAIN, + 0, 1023, 1, 0); + + ctrls->saturation = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_SATURATION, +-- +2.39.2 + diff --git a/queue-6.1/media-rc-gpio-ir-recv-add-remove-function.patch b/queue-6.1/media-rc-gpio-ir-recv-add-remove-function.patch new file mode 100644 index 00000000000..c9f5aebfa61 --- /dev/null +++ b/queue-6.1/media-rc-gpio-ir-recv-add-remove-function.patch @@ -0,0 +1,142 @@ +From d2ed4c0af6bad7de5671431177a44935cbce7c9b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Jan 2023 10:39:21 +0100 +Subject: media: rc: gpio-ir-recv: add remove function + +From: Li Jun + +[ Upstream commit 30040818b338b8ebc956ce0ebd198f8d593586a6 ] + +In case runtime PM is enabled, do runtime PM clean up to remove +cpu latency qos request, otherwise driver removal may have below +kernel dump: + +[ 19.463299] Unable to handle kernel NULL pointer dereference at +virtual address 0000000000000048 +[ 19.472161] Mem abort info: +[ 19.474985] ESR = 0x0000000096000004 +[ 19.478754] EC = 0x25: DABT (current EL), IL = 32 bits +[ 19.484081] SET = 0, FnV = 0 +[ 19.487149] EA = 0, S1PTW = 0 +[ 19.490361] FSC = 0x04: level 0 translation fault +[ 19.495256] Data abort info: +[ 19.498149] ISV = 0, ISS = 0x00000004 +[ 19.501997] CM = 0, WnR = 0 +[ 19.504977] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000049f81000 +[ 19.511432] [0000000000000048] pgd=0000000000000000, +p4d=0000000000000000 +[ 19.518245] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP +[ 19.524520] Modules linked in: gpio_ir_recv(+) rc_core [last +unloaded: rc_core] +[ 19.531845] CPU: 0 PID: 445 Comm: insmod Not tainted +6.2.0-rc1-00028-g2c397a46d47c #72 +[ 19.531854] Hardware name: FSL i.MX8MM EVK board (DT) +[ 19.531859] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS +BTYPE=--) +[ 19.551777] pc : cpu_latency_qos_remove_request+0x20/0x110 +[ 19.557277] lr : gpio_ir_recv_runtime_suspend+0x18/0x30 +[gpio_ir_recv] +[ 19.557294] sp : ffff800008ce3740 +[ 19.557297] x29: ffff800008ce3740 x28: 0000000000000000 x27: +ffff800008ce3d50 +[ 19.574270] x26: ffffc7e3e9cea100 x25: 00000000000f4240 x24: +ffffc7e3f9ef0e30 +[ 19.574284] x23: 0000000000000000 x22: ffff0061803820f4 x21: +0000000000000008 +[ 19.574296] x20: ffffc7e3fa75df30 x19: 0000000000000020 x18: +ffffffffffffffff +[ 19.588570] x17: 0000000000000000 x16: ffffc7e3f9efab70 x15: +ffffffffffffffff +[ 19.595712] x14: ffff800008ce37b8 x13: ffff800008ce37aa x12: +0000000000000001 +[ 19.602853] x11: 0000000000000001 x10: ffffcbe3ec0dff87 x9 : +0000000000000008 +[ 19.609991] x8 : 0101010101010101 x7 : 0000000000000000 x6 : +000000000f0bfe9f +[ 19.624261] x5 : 00ffffffffffffff x4 : 0025ab8e00000000 x3 : +ffff006180382010 +[ 19.631405] x2 : ffffc7e3e9ce8030 x1 : ffffc7e3fc3eb810 x0 : +0000000000000020 +[ 19.638548] Call trace: +[ 19.640995] cpu_latency_qos_remove_request+0x20/0x110 +[ 19.646142] gpio_ir_recv_runtime_suspend+0x18/0x30 [gpio_ir_recv] +[ 19.652339] pm_generic_runtime_suspend+0x2c/0x44 +[ 19.657055] __rpm_callback+0x48/0x1dc +[ 19.660807] rpm_callback+0x6c/0x80 +[ 19.664301] rpm_suspend+0x10c/0x640 +[ 19.667880] rpm_idle+0x250/0x2d0 +[ 19.671198] update_autosuspend+0x38/0xe0 +[ 19.675213] pm_runtime_set_autosuspend_delay+0x40/0x60 +[ 19.680442] gpio_ir_recv_probe+0x1b4/0x21c [gpio_ir_recv] +[ 19.685941] platform_probe+0x68/0xc0 +[ 19.689610] really_probe+0xc0/0x3dc +[ 19.693189] __driver_probe_device+0x7c/0x190 +[ 19.697550] driver_probe_device+0x3c/0x110 +[ 19.701739] __driver_attach+0xf4/0x200 +[ 19.705578] bus_for_each_dev+0x70/0xd0 +[ 19.709417] driver_attach+0x24/0x30 +[ 19.712998] bus_add_driver+0x17c/0x240 +[ 19.716834] driver_register+0x78/0x130 +[ 19.720676] __platform_driver_register+0x28/0x34 +[ 19.725386] gpio_ir_recv_driver_init+0x20/0x1000 [gpio_ir_recv] +[ 19.731404] do_one_initcall+0x44/0x2ac +[ 19.735243] do_init_module+0x48/0x1d0 +[ 19.739003] load_module+0x19fc/0x2034 +[ 19.742759] __do_sys_finit_module+0xac/0x12c +[ 19.747124] __arm64_sys_finit_module+0x20/0x30 +[ 19.751664] invoke_syscall+0x48/0x114 +[ 19.755420] el0_svc_common.constprop.0+0xcc/0xec +[ 19.760132] do_el0_svc+0x38/0xb0 +[ 19.763456] el0_svc+0x2c/0x84 +[ 19.766516] el0t_64_sync_handler+0xf4/0x120 +[ 19.770789] el0t_64_sync+0x190/0x194 +[ 19.774460] Code: 910003fd a90153f3 aa0003f3 91204021 (f9401400) +[ 19.780556] ---[ end trace 0000000000000000 ]--- + +Signed-off-by: Li Jun +Signed-off-by: Sean Young +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/rc/gpio-ir-recv.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c +index 22e524b69806a..a56c844d7f816 100644 +--- a/drivers/media/rc/gpio-ir-recv.c ++++ b/drivers/media/rc/gpio-ir-recv.c +@@ -130,6 +130,23 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) + "gpio-ir-recv-irq", gpio_dev); + } + ++static int gpio_ir_recv_remove(struct platform_device *pdev) ++{ ++ struct gpio_rc_dev *gpio_dev = platform_get_drvdata(pdev); ++ struct device *pmdev = gpio_dev->pmdev; ++ ++ if (pmdev) { ++ pm_runtime_get_sync(pmdev); ++ cpu_latency_qos_remove_request(&gpio_dev->qos); ++ ++ pm_runtime_disable(pmdev); ++ pm_runtime_put_noidle(pmdev); ++ pm_runtime_set_suspended(pmdev); ++ } ++ ++ return 0; ++} ++ + #ifdef CONFIG_PM + static int gpio_ir_recv_suspend(struct device *dev) + { +@@ -189,6 +206,7 @@ MODULE_DEVICE_TABLE(of, gpio_ir_recv_of_match); + + static struct platform_driver gpio_ir_recv_driver = { + .probe = gpio_ir_recv_probe, ++ .remove = gpio_ir_recv_remove, + .driver = { + .name = KBUILD_MODNAME, + .of_match_table = of_match_ptr(gpio_ir_recv_of_match), +-- +2.39.2 + diff --git a/queue-6.1/mips-fix-a-compilation-issue.patch b/queue-6.1/mips-fix-a-compilation-issue.patch new file mode 100644 index 00000000000..7de529e2c02 --- /dev/null +++ b/queue-6.1/mips-fix-a-compilation-issue.patch @@ -0,0 +1,41 @@ +From bd6158fdf447dcdf36fb5cf0c96a1905350bbefe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Jan 2023 16:59:12 +0800 +Subject: MIPS: Fix a compilation issue +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: xurui + +[ Upstream commit 109d587a4b4d7ccca2200ab1f808f43ae23e2585 ] + +arch/mips/include/asm/mach-rc32434/pci.h:377: +cc1: error: result of ‘-117440512 << 16’ requires 44 bits to represent, but ‘int’ only has 32 bits [-Werror=shift-overflow=] + +All bits in KORINA_STAT are already at the correct position, so there is +no addtional shift needed. + +Signed-off-by: xurui +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/include/asm/mach-rc32434/pci.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/mips/include/asm/mach-rc32434/pci.h b/arch/mips/include/asm/mach-rc32434/pci.h +index 9a6eefd127571..3eb767c8a4eec 100644 +--- a/arch/mips/include/asm/mach-rc32434/pci.h ++++ b/arch/mips/include/asm/mach-rc32434/pci.h +@@ -374,7 +374,7 @@ struct pci_msu { + PCI_CFG04_STAT_SSE | \ + PCI_CFG04_STAT_PE) + +-#define KORINA_CNFG1 ((KORINA_STAT<<16)|KORINA_CMD) ++#define KORINA_CNFG1 (KORINA_STAT | KORINA_CMD) + + #define KORINA_REVID 0 + #define KORINA_CLASS_CODE 0 +-- +2.39.2 + diff --git a/queue-6.1/pci-add-solidrun-vendor-id.patch b/queue-6.1/pci-add-solidrun-vendor-id.patch new file mode 100644 index 00000000000..5ed3c14f285 --- /dev/null +++ b/queue-6.1/pci-add-solidrun-vendor-id.patch @@ -0,0 +1,39 @@ +From e55d9c6ec06a1d3c5584d120a9010373445bb274 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Jan 2023 18:56:36 +0200 +Subject: PCI: Add SolidRun vendor ID + +From: Alvaro Karsz + +[ Upstream commit db6c4dee4c104f50ed163af71c53bfdb878a8318 ] + +Add SolidRun vendor ID to pci_ids.h + +The vendor ID is used in 2 different source files, the SNET vDPA driver +and PCI quirks. + +Signed-off-by: Alvaro Karsz +Acked-by: Bjorn Helgaas +Message-Id: <20230110165638.123745-2-alvaro.karsz@solid-run.com> +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + include/linux/pci_ids.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h +index bc8f484cdcf3b..45c3d62e616d8 100644 +--- a/include/linux/pci_ids.h ++++ b/include/linux/pci_ids.h +@@ -3094,6 +3094,8 @@ + + #define PCI_VENDOR_ID_3COM_2 0xa727 + ++#define PCI_VENDOR_ID_SOLIDRUN 0xd063 ++ + #define PCI_VENDOR_ID_DIGIUM 0xd161 + #define PCI_DEVICE_ID_DIGIUM_HFC4S 0xb410 + +-- +2.39.2 + diff --git a/queue-6.1/pci-avoid-flr-for-solidrun-snet-dpu-rev-1.patch b/queue-6.1/pci-avoid-flr-for-solidrun-snet-dpu-rev-1.patch new file mode 100644 index 00000000000..131f2770b5e --- /dev/null +++ b/queue-6.1/pci-avoid-flr-for-solidrun-snet-dpu-rev-1.patch @@ -0,0 +1,48 @@ +From 552c77701cabcd36e6927832fe6f82b495f572f1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Jan 2023 18:56:37 +0200 +Subject: PCI: Avoid FLR for SolidRun SNET DPU rev 1 + +From: Alvaro Karsz + +[ Upstream commit d089d69cc1f824936eeaa4fa172f8fa1a0949eaa ] + +This patch fixes a FLR bug on the SNET DPU rev 1 by setting the +PCI_DEV_FLAGS_NO_FLR_RESET flag. + +As there is a quirk to avoid FLR (quirk_no_flr), I added a new quirk +to check the rev ID before calling to quirk_no_flr. + +Without this patch, a SNET DPU rev 1 may hang when FLR is applied. + +Signed-off-by: Alvaro Karsz +Acked-by: Bjorn Helgaas +Message-Id: <20230110165638.123745-3-alvaro.karsz@solid-run.com> +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/pci/quirks.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index 494fa46f57671..44cab813bf951 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -5366,6 +5366,14 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x7901, quirk_no_flr); + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1502, quirk_no_flr); + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1503, quirk_no_flr); + ++/* FLR may cause the SolidRun SNET DPU (rev 0x1) to hang */ ++static void quirk_no_flr_snet(struct pci_dev *dev) ++{ ++ if (dev->revision == 0x1) ++ quirk_no_flr(dev); ++} ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLIDRUN, 0x1000, quirk_no_flr_snet); ++ + static void quirk_no_ext_tags(struct pci_dev *pdev) + { + struct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus); +-- +2.39.2 + diff --git a/queue-6.1/powerpc-64-don-t-recurse-irq-replay.patch b/queue-6.1/powerpc-64-don-t-recurse-irq-replay.patch new file mode 100644 index 00000000000..a02e7b6a512 --- /dev/null +++ b/queue-6.1/powerpc-64-don-t-recurse-irq-replay.patch @@ -0,0 +1,259 @@ +From 89039c165833755e33d426a116d1bb31b7e0383f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 21 Jan 2023 20:26:18 +1000 +Subject: powerpc/64: Don't recurse irq replay + +From: Nicholas Piggin + +[ Upstream commit 5746ca131e2496ccd5bb4d7a0244d6c38070cbf5 ] + +Interrupt handlers called by soft-pending irq replay code can run +softirqs, softirq replay enables and disables local irqs, which allows +interrupts to come in including soft-masked interrupts, and it can +cause pending irqs to be replayed again. That makes the soft irq replay +state machine and possible races more complicated and fragile than it +needs to be. + +Use irq_enter/irq_exit around irq replay to prevent softirqs running +while interrupts are being replayed. Softirqs will now be run at the +irq_exit() call after all the irq replaying is done. This prevents irqs +being replayed while irqs are being replayed, and should hopefully make +things simpler and easier to think about and debug. + +A new PACA_IRQ_REPLAYING is added to prevent asynchronous interrupt +handlers hard-enabling EE while pending irqs are being replayed, because +that causes new pending irqs to arrive which is also a complexity. This +means pending irqs won't be profiled quite so well because perf irqs +can't be taken. + +Signed-off-by: Nicholas Piggin +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20230121102618.2824429-1-npiggin@gmail.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/include/asm/hw_irq.h | 6 +- + arch/powerpc/kernel/irq_64.c | 101 +++++++++++++++++++----------- + 2 files changed, 70 insertions(+), 37 deletions(-) + +diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h +index eb6d094083fd6..317659fdeacf2 100644 +--- a/arch/powerpc/include/asm/hw_irq.h ++++ b/arch/powerpc/include/asm/hw_irq.h +@@ -36,15 +36,17 @@ + #define PACA_IRQ_DEC 0x08 /* Or FIT */ + #define PACA_IRQ_HMI 0x10 + #define PACA_IRQ_PMI 0x20 ++#define PACA_IRQ_REPLAYING 0x40 + + /* + * Some soft-masked interrupts must be hard masked until they are replayed + * (e.g., because the soft-masked handler does not clear the exception). ++ * Interrupt replay itself must remain hard masked too. + */ + #ifdef CONFIG_PPC_BOOK3S +-#define PACA_IRQ_MUST_HARD_MASK (PACA_IRQ_EE|PACA_IRQ_PMI) ++#define PACA_IRQ_MUST_HARD_MASK (PACA_IRQ_EE|PACA_IRQ_PMI|PACA_IRQ_REPLAYING) + #else +-#define PACA_IRQ_MUST_HARD_MASK (PACA_IRQ_EE) ++#define PACA_IRQ_MUST_HARD_MASK (PACA_IRQ_EE|PACA_IRQ_REPLAYING) + #endif + + #endif /* CONFIG_PPC64 */ +diff --git a/arch/powerpc/kernel/irq_64.c b/arch/powerpc/kernel/irq_64.c +index eb2b380e52a0d..9dc0ad3c533a8 100644 +--- a/arch/powerpc/kernel/irq_64.c ++++ b/arch/powerpc/kernel/irq_64.c +@@ -70,22 +70,19 @@ int distribute_irqs = 1; + + static inline void next_interrupt(struct pt_regs *regs) + { +- /* +- * Softirq processing can enable/disable irqs, which will leave +- * MSR[EE] enabled and the soft mask set to IRQS_DISABLED. Fix +- * this up. +- */ +- if (!(local_paca->irq_happened & PACA_IRQ_HARD_DIS)) +- hard_irq_disable(); +- else +- irq_soft_mask_set(IRQS_ALL_DISABLED); ++ if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) { ++ WARN_ON(!(local_paca->irq_happened & PACA_IRQ_HARD_DIS)); ++ WARN_ON(irq_soft_mask_return() != IRQS_ALL_DISABLED); ++ } + + /* + * We are responding to the next interrupt, so interrupt-off + * latencies should be reset here. + */ ++ lockdep_hardirq_exit(); + trace_hardirqs_on(); + trace_hardirqs_off(); ++ lockdep_hardirq_enter(); + } + + static inline bool irq_happened_test_and_clear(u8 irq) +@@ -97,22 +94,11 @@ static inline bool irq_happened_test_and_clear(u8 irq) + return false; + } + +-void replay_soft_interrupts(void) ++static void __replay_soft_interrupts(void) + { + struct pt_regs regs; + + /* +- * Be careful here, calling these interrupt handlers can cause +- * softirqs to be raised, which they may run when calling irq_exit, +- * which will cause local_irq_enable() to be run, which can then +- * recurse into this function. Don't keep any state across +- * interrupt handler calls which may change underneath us. +- * +- * Softirqs can not be disabled over replay to stop this recursion +- * because interrupts taken in idle code may require RCU softirq +- * to run in the irq RCU tracking context. This is a hard problem +- * to fix without changes to the softirq or idle layer. +- * + * We use local_paca rather than get_paca() to avoid all the + * debug_smp_processor_id() business in this low level function. + */ +@@ -120,13 +106,20 @@ void replay_soft_interrupts(void) + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) { + WARN_ON_ONCE(mfmsr() & MSR_EE); + WARN_ON(!(local_paca->irq_happened & PACA_IRQ_HARD_DIS)); ++ WARN_ON(local_paca->irq_happened & PACA_IRQ_REPLAYING); + } + ++ /* ++ * PACA_IRQ_REPLAYING prevents interrupt handlers from enabling ++ * MSR[EE] to get PMIs, which can result in more IRQs becoming ++ * pending. ++ */ ++ local_paca->irq_happened |= PACA_IRQ_REPLAYING; ++ + ppc_save_regs(®s); + regs.softe = IRQS_ENABLED; + regs.msr |= MSR_EE; + +-again: + /* + * Force the delivery of pending soft-disabled interrupts on PS3. + * Any HV call will have this side effect. +@@ -175,13 +168,14 @@ void replay_soft_interrupts(void) + next_interrupt(®s); + } + +- /* +- * Softirq processing can enable and disable interrupts, which can +- * result in new irqs becoming pending. Must keep looping until we +- * have cleared out all pending interrupts. +- */ +- if (local_paca->irq_happened & ~PACA_IRQ_HARD_DIS) +- goto again; ++ local_paca->irq_happened &= ~PACA_IRQ_REPLAYING; ++} ++ ++void replay_soft_interrupts(void) ++{ ++ irq_enter(); /* See comment in arch_local_irq_restore */ ++ __replay_soft_interrupts(); ++ irq_exit(); + } + + #if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_KUAP) +@@ -200,13 +194,13 @@ static inline void replay_soft_interrupts_irqrestore(void) + if (kuap_state != AMR_KUAP_BLOCKED) + set_kuap(AMR_KUAP_BLOCKED); + +- replay_soft_interrupts(); ++ __replay_soft_interrupts(); + + if (kuap_state != AMR_KUAP_BLOCKED) + set_kuap(kuap_state); + } + #else +-#define replay_soft_interrupts_irqrestore() replay_soft_interrupts() ++#define replay_soft_interrupts_irqrestore() __replay_soft_interrupts() + #endif + + notrace void arch_local_irq_restore(unsigned long mask) +@@ -219,9 +213,13 @@ notrace void arch_local_irq_restore(unsigned long mask) + return; + } + +- if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) +- WARN_ON_ONCE(in_nmi() || in_hardirq()); ++ if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) { ++ WARN_ON_ONCE(in_nmi()); ++ WARN_ON_ONCE(in_hardirq()); ++ WARN_ON_ONCE(local_paca->irq_happened & PACA_IRQ_REPLAYING); ++ } + ++again: + /* + * After the stb, interrupts are unmasked and there are no interrupts + * pending replay. The restart sequence makes this atomic with +@@ -248,6 +246,12 @@ notrace void arch_local_irq_restore(unsigned long mask) + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) + WARN_ON_ONCE(!(mfmsr() & MSR_EE)); + ++ /* ++ * If we came here from the replay below, we might have a preempt ++ * pending (due to preempt_enable_no_resched()). Have to check now. ++ */ ++ preempt_check_resched(); ++ + return; + + happened: +@@ -261,6 +265,7 @@ notrace void arch_local_irq_restore(unsigned long mask) + irq_soft_mask_set(IRQS_ENABLED); + local_paca->irq_happened = 0; + __hard_irq_enable(); ++ preempt_check_resched(); + return; + } + +@@ -296,12 +301,38 @@ notrace void arch_local_irq_restore(unsigned long mask) + irq_soft_mask_set(IRQS_ALL_DISABLED); + trace_hardirqs_off(); + ++ /* ++ * Now enter interrupt context. The interrupt handlers themselves ++ * also call irq_enter/exit (which is okay, they can nest). But call ++ * it here now to hold off softirqs until the below irq_exit(). If ++ * we allowed replayed handlers to run softirqs, that enables irqs, ++ * which must replay interrupts, which recurses in here and makes ++ * things more complicated. The recursion is limited to 2, and it can ++ * be made to work, but it's complicated. ++ * ++ * local_bh_disable can not be used here because interrupts taken in ++ * idle are not in the right context (RCU, tick, etc) to run softirqs ++ * so irq_enter must be called. ++ */ ++ irq_enter(); ++ + replay_soft_interrupts_irqrestore(); + ++ irq_exit(); ++ ++ if (unlikely(local_paca->irq_happened != PACA_IRQ_HARD_DIS)) { ++ /* ++ * The softirq processing in irq_exit() may enable interrupts ++ * temporarily, which can result in MSR[EE] being enabled and ++ * more irqs becoming pending. Go around again if that happens. ++ */ ++ trace_hardirqs_on(); ++ preempt_enable_no_resched(); ++ goto again; ++ } ++ + trace_hardirqs_on(); + irq_soft_mask_set(IRQS_ENABLED); +- if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) +- WARN_ON(local_paca->irq_happened != PACA_IRQ_HARD_DIS); + local_paca->irq_happened = 0; + __hard_irq_enable(); + preempt_enable(); +-- +2.39.2 + diff --git a/queue-6.1/powerpc-64-fix-task_cpu-in-early-boot-when-booting-n.patch b/queue-6.1/powerpc-64-fix-task_cpu-in-early-boot-when-booting-n.patch new file mode 100644 index 00000000000..a1eb81048bc --- /dev/null +++ b/queue-6.1/powerpc-64-fix-task_cpu-in-early-boot-when-booting-n.patch @@ -0,0 +1,60 @@ +From 25a79a5199e1332eab0c9e63969ce0a2c26fc4ab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Dec 2022 21:59:28 +1000 +Subject: powerpc/64: Fix task_cpu in early boot when booting non-zero cpuid + +From: Nicholas Piggin + +[ Upstream commit 9fa24404f5044967753a6cd3e5e36f57686bec6e ] + +powerpc/64 can boot on a non-zero SMP processor id. Initially, the boot +CPU is said to be "assumed to be 0" until early_init_devtree() discovers +the id from the device tree. That is not a good description because the +assumption can be wrong and that has to be handled, the better +description is that 0 is used as a placeholder, and things are fixed +after the real id is discovered. + +smp_processor_id() is set to the boot cpuid, but task_cpu(current) is +not, which causes the smp_processor_id() == task_cpu(current) invariant +to be broken until init_idle() in sched_init(). + +This is quite fragile and could lead to subtle bugs in future. One bug +is that validate_sp_size uses task_cpu() to get the process stack, so +any stack trace from the booting CPU between early_init_devtree() +and sched_init() will have problems. Early on paca_ptrs[0] will be +poisoned, so that can cause machine checks dereferencing that memory +in real mode. Later, validating the current stack pointer against the +idle task of a different secondary will probably cause no stack trace +to be printed. + +Fix this by setting thread_info->cpu right after smp_processor_id() is +set to the boot cpuid. + +Signed-off-by: Nicholas Piggin +[mpe: Fix SMP=n build as reported by sfr] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20221216115930.2667772-3-npiggin@gmail.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/setup_64.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c +index a0dee7354fe6b..a43865e0fb4bf 100644 +--- a/arch/powerpc/kernel/setup_64.c ++++ b/arch/powerpc/kernel/setup_64.c +@@ -396,6 +396,11 @@ void __init early_setup(unsigned long dt_ptr) + } + fixup_boot_paca(paca_ptrs[boot_cpuid]); + setup_paca(paca_ptrs[boot_cpuid]); /* install the paca into registers */ ++ // smp_processor_id() now reports boot_cpuid ++ ++#ifdef CONFIG_SMP ++ task_thread_info(current)->cpu = boot_cpuid; // fix task_cpu(current) ++#endif + + /* + * Configure exception handlers. This include setting up trampolines +-- +2.39.2 + diff --git a/queue-6.1/powerpc-64-move-paca-allocation-to-early_setup.patch b/queue-6.1/powerpc-64-move-paca-allocation-to-early_setup.patch new file mode 100644 index 00000000000..a1032fab0aa --- /dev/null +++ b/queue-6.1/powerpc-64-move-paca-allocation-to-early_setup.patch @@ -0,0 +1,160 @@ +From 64d3e428f32c43f01bf1bf41cc29091ce5216b03 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Dec 2022 21:59:29 +1000 +Subject: powerpc/64: Move paca allocation to early_setup() + +From: Nicholas Piggin + +[ Upstream commit dc222fa7737212fe0da513e5b8937c156d02225d ] + +The early paca and boot cpuid dance is complicated and currently does +not quite work as expected for boot cpuid != 0 cases. + +early_init_devtree() currently allocates the paca_ptrs and boot cpuid +paca, but until that returns and early_setup() calls setup_paca(), this +thread is currently still executing with smp_processor_id() == 0. + +One problem this causes is the paca_ptrs[smp_processor_id()] pointer is +poisoned, so valid_emergency_stack() (any backtrace) and any similar +users will crash. + +Another is that the hardware id which is set here will not be returned +by get_hard_smp_processor_id(smp_processor_id()), but it would work +correctly for boot_cpuid == 0, which could lead to difficult to +reproduce or find bugs. The hard id does not seem to be used by the rest +of early_init_devtree(), it just looks like all this code might have +been put here to allocate somewhere to store boot CPU hardware id while +scanning the devtree. + +Rearrange things so the hwid is put in a global variable like +boot_cpuid, and do all the paca allocation and boot paca setup in the +64-bit early_setup() after we have everything ready to go. + +The paca_ptrs[0] re-poisoning code in early_setup does not seem to have +ever worked, because paca_ptrs[0] was never not-poisoned when boot_cpuid +is not 0. + +Signed-off-by: Nicholas Piggin +[mpe: Fix build error on 32-bit] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20221216115930.2667772-4-npiggin@gmail.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/include/asm/paca.h | 1 - + arch/powerpc/include/asm/smp.h | 1 + + arch/powerpc/kernel/prom.c | 12 +++--------- + arch/powerpc/kernel/setup-common.c | 4 ++++ + arch/powerpc/kernel/setup_64.c | 11 +++++------ + 5 files changed, 13 insertions(+), 16 deletions(-) + +diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h +index 09f1790d0ae16..0ab3511a47d77 100644 +--- a/arch/powerpc/include/asm/paca.h ++++ b/arch/powerpc/include/asm/paca.h +@@ -295,7 +295,6 @@ extern void free_unused_pacas(void); + + #else /* CONFIG_PPC64 */ + +-static inline void allocate_paca_ptrs(void) { } + static inline void allocate_paca(int cpu) { } + static inline void free_unused_pacas(void) { } + +diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h +index f63505d74932b..6c6cb53d70458 100644 +--- a/arch/powerpc/include/asm/smp.h ++++ b/arch/powerpc/include/asm/smp.h +@@ -26,6 +26,7 @@ + #include + + extern int boot_cpuid; ++extern int boot_cpu_hwid; /* PPC64 only */ + extern int spinning_secondaries; + extern u32 *cpu_to_phys_id; + extern bool coregroup_enabled; +diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c +index 1eed87d954ba8..8537c354c560b 100644 +--- a/arch/powerpc/kernel/prom.c ++++ b/arch/powerpc/kernel/prom.c +@@ -366,8 +366,8 @@ static int __init early_init_dt_scan_cpus(unsigned long node, + be32_to_cpu(intserv[found_thread])); + boot_cpuid = found; + +- // Pass the boot CPU's hard CPU id back to our caller +- *((u32 *)data) = be32_to_cpu(intserv[found_thread]); ++ if (IS_ENABLED(CONFIG_PPC64)) ++ boot_cpu_hwid = be32_to_cpu(intserv[found_thread]); + + /* + * PAPR defines "logical" PVR values for cpus that +@@ -751,7 +751,6 @@ static inline void save_fscr_to_task(void) {} + + void __init early_init_devtree(void *params) + { +- u32 boot_cpu_hwid; + phys_addr_t limit; + + DBG(" -> early_init_devtree(%px)\n", params); +@@ -847,7 +846,7 @@ void __init early_init_devtree(void *params) + /* Retrieve CPU related informations from the flat tree + * (altivec support, boot CPU ID, ...) + */ +- of_scan_flat_dt(early_init_dt_scan_cpus, &boot_cpu_hwid); ++ of_scan_flat_dt(early_init_dt_scan_cpus, NULL); + if (boot_cpuid < 0) { + printk("Failed to identify boot CPU !\n"); + BUG(); +@@ -864,11 +863,6 @@ void __init early_init_devtree(void *params) + + mmu_early_init_devtree(); + +- // NB. paca is not installed until later in early_setup() +- allocate_paca_ptrs(); +- allocate_paca(boot_cpuid); +- set_hard_smp_processor_id(boot_cpuid, boot_cpu_hwid); +- + #ifdef CONFIG_PPC_POWERNV + /* Scan and build the list of machine check recoverable ranges */ + of_scan_flat_dt(early_init_dt_scan_recoverable_ranges, NULL); +diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c +index 6d041993a45dc..efb301a4987ca 100644 +--- a/arch/powerpc/kernel/setup-common.c ++++ b/arch/powerpc/kernel/setup-common.c +@@ -86,6 +86,10 @@ EXPORT_SYMBOL(machine_id); + int boot_cpuid = -1; + EXPORT_SYMBOL_GPL(boot_cpuid); + ++#ifdef CONFIG_PPC64 ++int boot_cpu_hwid = -1; ++#endif ++ + /* + * These are used in binfmt_elf.c to put aux entries on the stack + * for each elf executable being started. +diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c +index a43865e0fb4bf..b2e0d3ce4261c 100644 +--- a/arch/powerpc/kernel/setup_64.c ++++ b/arch/powerpc/kernel/setup_64.c +@@ -385,15 +385,14 @@ void __init early_setup(unsigned long dt_ptr) + /* + * Do early initialization using the flattened device + * tree, such as retrieving the physical memory map or +- * calculating/retrieving the hash table size. ++ * calculating/retrieving the hash table size, discover ++ * boot_cpuid and boot_cpu_hwid. + */ + early_init_devtree(__va(dt_ptr)); + +- /* Now we know the logical id of our boot cpu, setup the paca. */ +- if (boot_cpuid != 0) { +- /* Poison paca_ptrs[0] again if it's not the boot cpu */ +- memset(&paca_ptrs[0], 0x88, sizeof(paca_ptrs[0])); +- } ++ allocate_paca_ptrs(); ++ allocate_paca(boot_cpuid); ++ set_hard_smp_processor_id(boot_cpuid, boot_cpu_hwid); + fixup_boot_paca(paca_ptrs[boot_cpuid]); + setup_paca(paca_ptrs[boot_cpuid]); /* install the paca into registers */ + // smp_processor_id() now reports boot_cpuid +-- +2.39.2 + diff --git a/queue-6.1/powerpc-bpf-32-only-set-a-stack-frame-when-necessary.patch b/queue-6.1/powerpc-bpf-32-only-set-a-stack-frame-when-necessary.patch new file mode 100644 index 00000000000..80b640054db --- /dev/null +++ b/queue-6.1/powerpc-bpf-32-only-set-a-stack-frame-when-necessary.patch @@ -0,0 +1,80 @@ +From 2f96e88c6d7730169a67b23cafabf8a0c8599f1d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Feb 2023 11:04:25 +0100 +Subject: powerpc/bpf/32: Only set a stack frame when necessary + +From: Christophe Leroy + +[ Upstream commit d084dcf256bc4565b4b1af9b00297ac7b51c7049 ] + +Until now a stack frame was set at all time due to the need +to keep tail call counter in the stack. + +But since commit 89d21e259a94 ("powerpc/bpf/32: Fix Oops on tail call +tests") the tail call counter is passed via register r4. It is therefore +not necessary anymore to have a stack frame for that. + +Just like PPC64, implement bpf_has_stack_frame() and only sets the frame +when needed. + +The difference with PPC64 is that PPC32 doesn't have a redzone, so +the stack is required as soon as non volatile registers are used or +when tail call count is set up. + +Signed-off-by: Christophe Leroy +[mpe: Fix commit reference in change log] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/62d7b654a3cfe73d998697cb29bbc5ffd89bfdb1.1675245773.git.christophe.leroy@csgroup.eu +Signed-off-by: Sasha Levin +--- + arch/powerpc/net/bpf_jit_comp32.c | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c +index a379b0ce19ffa..8643b2c8b76ef 100644 +--- a/arch/powerpc/net/bpf_jit_comp32.c ++++ b/arch/powerpc/net/bpf_jit_comp32.c +@@ -79,6 +79,20 @@ static int bpf_jit_stack_offsetof(struct codegen_context *ctx, int reg) + #define SEEN_NVREG_FULL_MASK 0x0003ffff /* Non volatile registers r14-r31 */ + #define SEEN_NVREG_TEMP_MASK 0x00001e01 /* BPF_REG_5, BPF_REG_AX, TMP_REG */ + ++static inline bool bpf_has_stack_frame(struct codegen_context *ctx) ++{ ++ /* ++ * We only need a stack frame if: ++ * - we call other functions (kernel helpers), or ++ * - we use non volatile registers, or ++ * - we use tail call counter ++ * - the bpf program uses its stack area ++ * The latter condition is deduced from the usage of BPF_REG_FP ++ */ ++ return ctx->seen & (SEEN_FUNC | SEEN_TAILCALL | SEEN_NVREG_FULL_MASK) || ++ bpf_is_seen_register(ctx, bpf_to_ppc(BPF_REG_FP)); ++} ++ + void bpf_jit_realloc_regs(struct codegen_context *ctx) + { + unsigned int nvreg_mask; +@@ -118,7 +132,8 @@ void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx) + + #define BPF_TAILCALL_PROLOGUE_SIZE 4 + +- EMIT(PPC_RAW_STWU(_R1, _R1, -BPF_PPC_STACKFRAME(ctx))); ++ if (bpf_has_stack_frame(ctx)) ++ EMIT(PPC_RAW_STWU(_R1, _R1, -BPF_PPC_STACKFRAME(ctx))); + + if (ctx->seen & SEEN_TAILCALL) + EMIT(PPC_RAW_STW(_R4, _R1, bpf_jit_stack_offsetof(ctx, BPF_PPC_TC))); +@@ -171,7 +186,8 @@ static void bpf_jit_emit_common_epilogue(u32 *image, struct codegen_context *ctx + EMIT(PPC_RAW_LWZ(_R0, _R1, BPF_PPC_STACKFRAME(ctx) + PPC_LR_STKOFF)); + + /* Tear down our stack frame */ +- EMIT(PPC_RAW_ADDI(_R1, _R1, BPF_PPC_STACKFRAME(ctx))); ++ if (bpf_has_stack_frame(ctx)) ++ EMIT(PPC_RAW_ADDI(_R1, _R1, BPF_PPC_STACKFRAME(ctx))); + + if (ctx->seen & SEEN_FUNC) + EMIT(PPC_RAW_MTLR(_R0)); +-- +2.39.2 + diff --git a/queue-6.1/powerpc-check-irq-instead-of-irq-no_irq-and-remove-n.patch b/queue-6.1/powerpc-check-irq-instead-of-irq-no_irq-and-remove-n.patch new file mode 100644 index 00000000000..518b54bcd5f --- /dev/null +++ b/queue-6.1/powerpc-check-irq-instead-of-irq-no_irq-and-remove-n.patch @@ -0,0 +1,72 @@ +From fd83218773c97b3d8a4b8b978fb9e9fe790a13d0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Jan 2023 13:26:46 +0100 +Subject: powerpc: Check !irq instead of irq == NO_IRQ and remove NO_IRQ + +From: Christophe Leroy + +[ Upstream commit bab537805a10bdbf55b31324ba4a9599e0651e5e ] + +NO_IRQ is a relic from the old days. It is not used anymore in core +functions. By the way, function irq_of_parse_and_map() returns value 0 +on error. + +In some drivers, NO_IRQ is erroneously used to check the return of +irq_of_parse_and_map(). + +It is not a real bug today because the only architectures using the +drivers being fixed by this patch define NO_IRQ as 0, but there are +architectures which define NO_IRQ as -1. If one day those +architectures start using the non fixed drivers, there will be a +problem. + +Long time ago Linus advocated for not using NO_IRQ, see +https://lore.kernel.org/all/Pine.LNX.4.64.0511211150040.13959@g5.osdl.org + +He re-iterated the same view recently in +https://lore.kernel.org/all/CAHk-=wg2Pkb9kbfbstbB91AJA2SF6cySbsgHG-iQMq56j3VTcA@mail.gmail.com + +So test !irq instead of tesing irq == NO_IRQ. + +All other usage of NO_IRQ for powerpc were removed in previous cycles so +the time has come to remove NO_IRQ completely for powerpc. + +Signed-off-by: Christophe Leroy +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/4b8d4f96140af01dec3a3330924dda8b2451c316.1674476798.git.christophe.leroy@csgroup.eu +Signed-off-by: Sasha Levin +--- + arch/powerpc/include/asm/irq.h | 3 --- + arch/powerpc/platforms/44x/fsp2.c | 2 +- + 2 files changed, 1 insertion(+), 4 deletions(-) + +diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h +index 5c1516a5ba8f6..deadd2149426a 100644 +--- a/arch/powerpc/include/asm/irq.h ++++ b/arch/powerpc/include/asm/irq.h +@@ -16,9 +16,6 @@ + + extern atomic_t ppc_n_lost_interrupts; + +-/* This number is used when no interrupt has been assigned */ +-#define NO_IRQ (0) +- + /* Total number of virq in the platform */ + #define NR_IRQS CONFIG_NR_IRQS + +diff --git a/arch/powerpc/platforms/44x/fsp2.c b/arch/powerpc/platforms/44x/fsp2.c +index e2e4f6d8150d6..56d91dbef5770 100644 +--- a/arch/powerpc/platforms/44x/fsp2.c ++++ b/arch/powerpc/platforms/44x/fsp2.c +@@ -205,7 +205,7 @@ static void __init node_irq_request(const char *compat, irq_handler_t errirq_han + + for_each_compatible_node(np, NULL, compat) { + irq = irq_of_parse_and_map(np, 0); +- if (irq == NO_IRQ) { ++ if (!irq) { + pr_err("device tree node %pOFn is missing a interrupt", + np); + of_node_put(np); +-- +2.39.2 + diff --git a/queue-6.1/powerpc-iommu-fix-memory-leak-with-using-debugfs_loo.patch b/queue-6.1/powerpc-iommu-fix-memory-leak-with-using-debugfs_loo.patch new file mode 100644 index 00000000000..2820d3496c6 --- /dev/null +++ b/queue-6.1/powerpc-iommu-fix-memory-leak-with-using-debugfs_loo.patch @@ -0,0 +1,42 @@ +From 4b79d56b016eae9710b5748c5ccd08d5c9b83a63 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Feb 2023 15:19:19 +0100 +Subject: powerpc/iommu: fix memory leak with using debugfs_lookup() + +From: Greg Kroah-Hartman + +[ Upstream commit b505063910c134778202dfad9332dfcecb76bab3 ] + +When calling debugfs_lookup() the result must have dput() called on it, +otherwise the memory will leak over time. To make things simpler, just +call debugfs_lookup_and_remove() instead which handles all of the logic +at once. + +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20230202141919.2298821-1-gregkh@linuxfoundation.org +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/iommu.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c +index caebe1431596e..ee95937bdaf14 100644 +--- a/arch/powerpc/kernel/iommu.c ++++ b/arch/powerpc/kernel/iommu.c +@@ -67,11 +67,9 @@ static void iommu_debugfs_add(struct iommu_table *tbl) + static void iommu_debugfs_del(struct iommu_table *tbl) + { + char name[10]; +- struct dentry *liobn_entry; + + sprintf(name, "%08lx", tbl->it_index); +- liobn_entry = debugfs_lookup(name, iommu_debugfs_dir); +- debugfs_remove(liobn_entry); ++ debugfs_lookup_and_remove(name, iommu_debugfs_dir); + } + #else + static void iommu_debugfs_add(struct iommu_table *tbl){} +-- +2.39.2 + diff --git a/queue-6.1/powerpc-kcsan-exclude-udelay-to-prevent-recursive-in.patch b/queue-6.1/powerpc-kcsan-exclude-udelay-to-prevent-recursive-in.patch new file mode 100644 index 00000000000..72c5f6980af --- /dev/null +++ b/queue-6.1/powerpc-kcsan-exclude-udelay-to-prevent-recursive-in.patch @@ -0,0 +1,49 @@ +From 0ae2b06ba53e9dcda146c2e7e8372366b1cc0858 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Feb 2023 13:17:58 +1100 +Subject: powerpc/kcsan: Exclude udelay to prevent recursive instrumentation + +From: Rohan McLure + +[ Upstream commit 2a7ce82dc46c591c9244057d89a6591c9639b9b9 ] + +In order for KCSAN to increase its likelihood of observing a data race, +it sets a watchpoint on memory accesses and stalls, allowing for +detection of conflicting accesses by other kernel threads or interrupts. + +Stalls are implemented by injecting a call to udelay in instrumented code. +To prevent recursive instrumentation, exclude udelay from being instrumented. + +Signed-off-by: Rohan McLure +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20230206021801.105268-3-rmclure@linux.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/time.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c +index f157552d79b38..285159e65a3ba 100644 +--- a/arch/powerpc/kernel/time.c ++++ b/arch/powerpc/kernel/time.c +@@ -374,7 +374,7 @@ void vtime_flush(struct task_struct *tsk) + #define calc_cputime_factors() + #endif + +-void __delay(unsigned long loops) ++void __no_kcsan __delay(unsigned long loops) + { + unsigned long start; + +@@ -395,7 +395,7 @@ void __delay(unsigned long loops) + } + EXPORT_SYMBOL(__delay); + +-void udelay(unsigned long usecs) ++void __no_kcsan udelay(unsigned long usecs) + { + __delay(tb_ticks_per_usec * usecs); + } +-- +2.39.2 + diff --git a/queue-6.1/scripts-handle-brokenpipeerror-for-python-scripts.patch b/queue-6.1/scripts-handle-brokenpipeerror-for-python-scripts.patch new file mode 100644 index 00000000000..8a5f29b4bd5 --- /dev/null +++ b/queue-6.1/scripts-handle-brokenpipeerror-for-python-scripts.patch @@ -0,0 +1,196 @@ +From fa84b491e467a8b6bab70f2e44de4263be45abab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Jan 2023 11:30:06 +0900 +Subject: scripts: handle BrokenPipeError for python scripts +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Masahiro Yamada + +[ Upstream commit 87c7ee67deb7fce9951a5f9d80641138694aad17 ] + +In the follow-up of commit fb3041d61f68 ("kbuild: fix SIGPIPE error +message for AR=gcc-ar and AR=llvm-ar"), Kees Cook pointed out that +tools should _not_ catch their own SIGPIPEs [1] [2]. + +Based on his feedback, LLVM was fixed [3]. + +However, Python's default behavior is to show noisy bracktrace when +SIGPIPE is sent. So, scripts written in Python are basically in the +same situation as the buggy llvm tools. + +Example: + + $ make -s allnoconfig + $ make -s allmodconfig + $ scripts/diffconfig .config.old .config | head -n1 + -ALIX n + Traceback (most recent call last): + File "/home/masahiro/linux/scripts/diffconfig", line 132, in + main() + File "/home/masahiro/linux/scripts/diffconfig", line 130, in main + print_config("+", config, None, b[config]) + File "/home/masahiro/linux/scripts/diffconfig", line 64, in print_config + print("+%s %s" % (config, new_value)) + BrokenPipeError: [Errno 32] Broken pipe + +Python documentation [4] notes how to make scripts die immediately and +silently: + + """ + Piping output of your program to tools like head(1) will cause a + SIGPIPE signal to be sent to your process when the receiver of its + standard output closes early. This results in an exception like + BrokenPipeError: [Errno 32] Broken pipe. To handle this case, + wrap your entry point to catch this exception as follows: + + import os + import sys + + def main(): + try: + # simulate large output (your code replaces this loop) + for x in range(10000): + print("y") + # flush output here to force SIGPIPE to be triggered + # while inside this try block. + sys.stdout.flush() + except BrokenPipeError: + # Python flushes standard streams on exit; redirect remaining output + # to devnull to avoid another BrokenPipeError at shutdown + devnull = os.open(os.devnull, os.O_WRONLY) + os.dup2(devnull, sys.stdout.fileno()) + sys.exit(1) # Python exits with error code 1 on EPIPE + + if __name__ == '__main__': + main() + + Do not set SIGPIPE’s disposition to SIG_DFL in order to avoid + BrokenPipeError. Doing that would cause your program to exit + unexpectedly whenever any socket connection is interrupted while + your program is still writing to it. + """ + +Currently, tools/perf/scripts/python/intel-pt-events.py seems to be the +only script that fixes the issue that way. + +tools/perf/scripts/python/compaction-times.py uses another approach +signal.signal(signal.SIGPIPE, signal.SIG_DFL) but the Python +documentation clearly says "Don't do it". + +I cannot fix all Python scripts since there are so many. +I fixed some in the scripts/ directory. + +[1]: https://lore.kernel.org/all/202211161056.1B9611A@keescook/ +[2]: https://github.com/llvm/llvm-project/issues/59037 +[3]: https://github.com/llvm/llvm-project/commit/4787efa38066adb51e2c049499d25b3610c0877b +[4]: https://docs.python.org/3/library/signal.html#note-on-sigpipe + +Signed-off-by: Masahiro Yamada +Reviewed-by: Nick Desaulniers +Reviewed-by: Nicolas Schier +Signed-off-by: Sasha Levin +--- + scripts/checkkconfigsymbols.py | 13 ++++++++++++- + scripts/clang-tools/run-clang-tools.py | 21 ++++++++++++++------- + scripts/diffconfig | 16 ++++++++++++++-- + 3 files changed, 40 insertions(+), 10 deletions(-) + +diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py +index 217d21abc86e8..36c920e713137 100755 +--- a/scripts/checkkconfigsymbols.py ++++ b/scripts/checkkconfigsymbols.py +@@ -115,7 +115,7 @@ def parse_options(): + return args + + +-def main(): ++def print_undefined_symbols(): + """Main function of this module.""" + args = parse_options() + +@@ -467,5 +467,16 @@ def parse_kconfig_file(kfile): + return defined, references + + ++def main(): ++ try: ++ print_undefined_symbols() ++ except BrokenPipeError: ++ # Python flushes standard streams on exit; redirect remaining output ++ # to devnull to avoid another BrokenPipeError at shutdown ++ devnull = os.open(os.devnull, os.O_WRONLY) ++ os.dup2(devnull, sys.stdout.fileno()) ++ sys.exit(1) # Python exits with error code 1 on EPIPE ++ ++ + if __name__ == "__main__": + main() +diff --git a/scripts/clang-tools/run-clang-tools.py b/scripts/clang-tools/run-clang-tools.py +index 56f2ec8f0f40a..3266708a86586 100755 +--- a/scripts/clang-tools/run-clang-tools.py ++++ b/scripts/clang-tools/run-clang-tools.py +@@ -61,14 +61,21 @@ def run_analysis(entry): + + + def main(): +- args = parse_arguments() ++ try: ++ args = parse_arguments() + +- lock = multiprocessing.Lock() +- pool = multiprocessing.Pool(initializer=init, initargs=(lock, args)) +- # Read JSON data into the datastore variable +- with open(args.path, "r") as f: +- datastore = json.load(f) +- pool.map(run_analysis, datastore) ++ lock = multiprocessing.Lock() ++ pool = multiprocessing.Pool(initializer=init, initargs=(lock, args)) ++ # Read JSON data into the datastore variable ++ with open(args.path, "r") as f: ++ datastore = json.load(f) ++ pool.map(run_analysis, datastore) ++ except BrokenPipeError: ++ # Python flushes standard streams on exit; redirect remaining output ++ # to devnull to avoid another BrokenPipeError at shutdown ++ devnull = os.open(os.devnull, os.O_WRONLY) ++ os.dup2(devnull, sys.stdout.fileno()) ++ sys.exit(1) # Python exits with error code 1 on EPIPE + + + if __name__ == "__main__": +diff --git a/scripts/diffconfig b/scripts/diffconfig +index d5da5fa05d1d3..43f0f3d273ae7 100755 +--- a/scripts/diffconfig ++++ b/scripts/diffconfig +@@ -65,7 +65,7 @@ def print_config(op, config, value, new_value): + else: + print(" %s %s -> %s" % (config, value, new_value)) + +-def main(): ++def show_diff(): + global merge_style + + # parse command line args +@@ -129,4 +129,16 @@ def main(): + for config in new: + print_config("+", config, None, b[config]) + +-main() ++def main(): ++ try: ++ show_diff() ++ except BrokenPipeError: ++ # Python flushes standard streams on exit; redirect remaining output ++ # to devnull to avoid another BrokenPipeError at shutdown ++ devnull = os.open(os.devnull, os.O_WRONLY) ++ os.dup2(devnull, sys.stdout.fileno()) ++ sys.exit(1) # Python exits with error code 1 on EPIPE ++ ++ ++if __name__ == '__main__': ++ main() +-- +2.39.2 + diff --git a/queue-6.1/series b/queue-6.1/series index ca5f29d9d62..c82c39fa86a 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -119,3 +119,20 @@ adreno-shutdown-the-gpu-properly.patch drm-msm-adreno-fix-runtime-pm-imbalance-at-unbind.patch watch_queue-fix-ioc_watch_queue_set_size-alloc-error.patch tpm-eventlog-don-t-abort-tpm_read_log-on-faulty-acpi.patch +clk-qcom-mmcc-apq8084-remove-spdm-clocks.patch +mips-fix-a-compilation-issue.patch +powerpc-check-irq-instead-of-irq-no_irq-and-remove-n.patch +powerpc-64-don-t-recurse-irq-replay.patch +powerpc-iommu-fix-memory-leak-with-using-debugfs_loo.patch +clk-renesas-rcar-gen3-disable-r-car-h3-es1.patch +powerpc-bpf-32-only-set-a-stack-frame-when-necessary.patch +powerpc-64-fix-task_cpu-in-early-boot-when-booting-n.patch +powerpc-64-move-paca-allocation-to-early_setup.patch +powerpc-kcsan-exclude-udelay-to-prevent-recursive-in.patch +alpha-fix-r_alpha_literal-reloc-for-large-modules.patch +macintosh-windfarm-use-unsigned-type-for-1-bit-bitfi.patch +pci-add-solidrun-vendor-id.patch +pci-avoid-flr-for-solidrun-snet-dpu-rev-1.patch +scripts-handle-brokenpipeerror-for-python-scripts.patch +media-ov5640-fix-analogue-gain-control.patch +media-rc-gpio-ir-recv-add-remove-function.patch