From: Sasha Levin Date: Sun, 3 Dec 2023 20:07:04 +0000 (-0500) Subject: Fixes for 5.10 X-Git-Tag: v4.14.332~23^2~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5e5c99b47b787ba7a078269d6ca612a57a62891f;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.10 Signed-off-by: Sasha Levin --- diff --git a/queue-5.10/asoc-intel-move-soc_intel_is_foo-helpers-to-a-generi.patch b/queue-5.10/asoc-intel-move-soc_intel_is_foo-helpers-to-a-generi.patch new file mode 100644 index 00000000000..7af7a710a77 --- /dev/null +++ b/queue-5.10/asoc-intel-move-soc_intel_is_foo-helpers-to-a-generi.patch @@ -0,0 +1,176 @@ +From 731c9b646fe89fd67b775a578d18089401af2302 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Oct 2021 16:33:22 +0200 +Subject: ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header + +From: Hans de Goede + +[ Upstream commit cd45c9bf8b43cd387e167cf166ae5c517f56d658 ] + +The soc_intel_is_foo() helpers from +sound/soc/intel/common/soc-intel-quirks.h are useful outside of the +sound subsystem too. + +Move these to include/linux/platform_data/x86/soc.h, so that +other code can use them too. + +Suggested-by: Andy Shevchenko +Reviewed-by: Andy Shevchenko +Acked-by: Mark Brown +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20211018143324.296961-2-hdegoede@redhat.com +Stable-dep-of: 7dd692217b86 ("ASoC: SOF: sof-pci-dev: Fix community key quirk detection") +Signed-off-by: Sasha Levin +--- + include/linux/platform_data/x86/soc.h | 65 +++++++++++++++++++++++ + sound/soc/intel/common/soc-intel-quirks.h | 51 ++---------------- + 2 files changed, 68 insertions(+), 48 deletions(-) + create mode 100644 include/linux/platform_data/x86/soc.h + +diff --git a/include/linux/platform_data/x86/soc.h b/include/linux/platform_data/x86/soc.h +new file mode 100644 +index 0000000000000..da05f425587a0 +--- /dev/null ++++ b/include/linux/platform_data/x86/soc.h +@@ -0,0 +1,65 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * Helpers for Intel SoC model detection ++ * ++ * Copyright (c) 2019, Intel Corporation. ++ */ ++ ++#ifndef __PLATFORM_DATA_X86_SOC_H ++#define __PLATFORM_DATA_X86_SOC_H ++ ++#if IS_ENABLED(CONFIG_X86) ++ ++#include ++#include ++ ++#define SOC_INTEL_IS_CPU(soc, type) \ ++static inline bool soc_intel_is_##soc(void) \ ++{ \ ++ static const struct x86_cpu_id soc##_cpu_ids[] = { \ ++ X86_MATCH_INTEL_FAM6_MODEL(type, NULL), \ ++ {} \ ++ }; \ ++ const struct x86_cpu_id *id; \ ++ \ ++ id = x86_match_cpu(soc##_cpu_ids); \ ++ if (id) \ ++ return true; \ ++ return false; \ ++} ++ ++SOC_INTEL_IS_CPU(byt, ATOM_SILVERMONT); ++SOC_INTEL_IS_CPU(cht, ATOM_AIRMONT); ++SOC_INTEL_IS_CPU(apl, ATOM_GOLDMONT); ++SOC_INTEL_IS_CPU(glk, ATOM_GOLDMONT_PLUS); ++SOC_INTEL_IS_CPU(cml, KABYLAKE_L); ++ ++#else /* IS_ENABLED(CONFIG_X86) */ ++ ++static inline bool soc_intel_is_byt(void) ++{ ++ return false; ++} ++ ++static inline bool soc_intel_is_cht(void) ++{ ++ return false; ++} ++ ++static inline bool soc_intel_is_apl(void) ++{ ++ return false; ++} ++ ++static inline bool soc_intel_is_glk(void) ++{ ++ return false; ++} ++ ++static inline bool soc_intel_is_cml(void) ++{ ++ return false; ++} ++#endif /* IS_ENABLED(CONFIG_X86) */ ++ ++#endif /* __PLATFORM_DATA_X86_SOC_H */ +diff --git a/sound/soc/intel/common/soc-intel-quirks.h b/sound/soc/intel/common/soc-intel-quirks.h +index a93987ab7f4d7..de4e550c5b34d 100644 +--- a/sound/soc/intel/common/soc-intel-quirks.h ++++ b/sound/soc/intel/common/soc-intel-quirks.h +@@ -9,34 +9,13 @@ + #ifndef _SND_SOC_INTEL_QUIRKS_H + #define _SND_SOC_INTEL_QUIRKS_H + ++#include ++ + #if IS_ENABLED(CONFIG_X86) + + #include +-#include +-#include + #include + +-#define SOC_INTEL_IS_CPU(soc, type) \ +-static inline bool soc_intel_is_##soc(void) \ +-{ \ +- static const struct x86_cpu_id soc##_cpu_ids[] = { \ +- X86_MATCH_INTEL_FAM6_MODEL(type, NULL), \ +- {} \ +- }; \ +- const struct x86_cpu_id *id; \ +- \ +- id = x86_match_cpu(soc##_cpu_ids); \ +- if (id) \ +- return true; \ +- return false; \ +-} +- +-SOC_INTEL_IS_CPU(byt, ATOM_SILVERMONT); +-SOC_INTEL_IS_CPU(cht, ATOM_AIRMONT); +-SOC_INTEL_IS_CPU(apl, ATOM_GOLDMONT); +-SOC_INTEL_IS_CPU(glk, ATOM_GOLDMONT_PLUS); +-SOC_INTEL_IS_CPU(cml, KABYLAKE_L); +- + static inline bool soc_intel_is_byt_cr(struct platform_device *pdev) + { + /* +@@ -114,30 +93,6 @@ static inline bool soc_intel_is_byt_cr(struct platform_device *pdev) + return false; + } + +-static inline bool soc_intel_is_byt(void) +-{ +- return false; +-} +- +-static inline bool soc_intel_is_cht(void) +-{ +- return false; +-} +- +-static inline bool soc_intel_is_apl(void) +-{ +- return false; +-} +- +-static inline bool soc_intel_is_glk(void) +-{ +- return false; +-} +- +-static inline bool soc_intel_is_cml(void) +-{ +- return false; +-} + #endif + +- #endif /* _SND_SOC_INTEL_QUIRKS_H */ ++#endif /* _SND_SOC_INTEL_QUIRKS_H */ +-- +2.42.0 + diff --git a/queue-5.10/asoc-sof-sof-pci-dev-add-parameter-to-override-topol.patch b/queue-5.10/asoc-sof-sof-pci-dev-add-parameter-to-override-topol.patch new file mode 100644 index 00000000000..72c274fb569 --- /dev/null +++ b/queue-5.10/asoc-sof-sof-pci-dev-add-parameter-to-override-topol.patch @@ -0,0 +1,92 @@ +From 6b6304026c53158240be3e8b3d2243c5df505d81 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Apr 2022 13:48:08 -0500 +Subject: ASoC: SOF: sof-pci-dev: add parameter to override topology filename +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pierre-Louis Bossart + +[ Upstream commit 772627acfeb0e670ede534b7d5502dae9668d3ee ] + +The existing 'tplg_path' module parameter can be used to load +alternate firmware files, be it for development or to handle +OEM-specific or board-specific releases. However the topology filename +is either hard-coded in machine descriptors or modified by specific +DMI-quirks. + +For additional flexibility, this patch adds the 'tplg_filename' module +parameter to override topology names. + +To avoid any confusion between DMI- and parameter-override, a variable +rename is added. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Ranjani Sridharan +Reviewed-by: Daniel Baluta +Reviewed-by: Paul Olaru +Reviewed-by: Péter Ujfalusi +Link: https://lore.kernel.org/r/20220414184817.362215-7-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Stable-dep-of: 7dd692217b86 ("ASoC: SOF: sof-pci-dev: Fix community key quirk detection") +Signed-off-by: Sasha Levin +--- + sound/soc/sof/sof-pci-dev.c | 25 ++++++++++++++++++++----- + 1 file changed, 20 insertions(+), 5 deletions(-) + +diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c +index 571dc679ff7c1..966bf28403475 100644 +--- a/sound/soc/sof/sof-pci-dev.c ++++ b/sound/soc/sof/sof-pci-dev.c +@@ -31,17 +31,21 @@ static char *tplg_path; + module_param(tplg_path, charp, 0444); + MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology."); + ++static char *tplg_filename; ++module_param(tplg_filename, charp, 0444); ++MODULE_PARM_DESC(tplg_filename, "alternate filename for SOF topology."); ++ + static int sof_pci_debug; + module_param_named(sof_pci_debug, sof_pci_debug, int, 0444); + MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)"); + +-static const char *sof_override_tplg_name; ++static const char *sof_dmi_override_tplg_name; + + #define SOF_PCI_DISABLE_PM_RUNTIME BIT(0) + + static int sof_tplg_cb(const struct dmi_system_id *id) + { +- sof_override_tplg_name = id->driver_data; ++ sof_dmi_override_tplg_name = id->driver_data; + return 1; + } + +@@ -391,9 +395,20 @@ static int sof_pci_probe(struct pci_dev *pci, + sof_pdata->tplg_filename_prefix = + sof_pdata->desc->default_tplg_path; + +- dmi_check_system(sof_tplg_table); +- if (sof_override_tplg_name) +- sof_pdata->tplg_filename = sof_override_tplg_name; ++ /* ++ * the topology filename will be provided in the machine descriptor, unless ++ * it is overridden by a module parameter or DMI quirk. ++ */ ++ if (tplg_filename) { ++ sof_pdata->tplg_filename = tplg_filename; ++ ++ dev_dbg(dev, "Module parameter used, changed tplg filename to %s\n", ++ sof_pdata->tplg_filename); ++ } else { ++ dmi_check_system(sof_tplg_table); ++ if (sof_dmi_override_tplg_name) ++ sof_pdata->tplg_filename = sof_dmi_override_tplg_name; ++ } + + #if IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE) + /* set callback to enable runtime_pm */ +-- +2.42.0 + diff --git a/queue-5.10/asoc-sof-sof-pci-dev-don-t-use-the-community-key-on-.patch b/queue-5.10/asoc-sof-sof-pci-dev-don-t-use-the-community-key-on-.patch new file mode 100644 index 00000000000..e13007589fd --- /dev/null +++ b/queue-5.10/asoc-sof-sof-pci-dev-don-t-use-the-community-key-on-.patch @@ -0,0 +1,99 @@ +From 721a2856b06dfa518f3082061c1338abc555ce5f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Apr 2022 11:33:55 -0500 +Subject: ASoC: SOF: sof-pci-dev: don't use the community key on APL + Chromebooks + +From: Pierre-Louis Bossart + +[ Upstream commit d81e4ba5ef1c1033b6c720b22fc99feeb71e71a0 ] + +As suggested by MrChromebox, the SOF driver can be used with the SOF +firmware binary signed with the production key. This patch adds an +additional check for the ApolloLake SoC before modifying the default +firmware path. + +Note that ApolloLake Chromebooks officially ship with the Skylake +driver, so to use SOF the users have to explicitly opt-in with +'options intel-dspcfg dsp_driver=3'. There is no plan to change the +default selection. + +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Bard Liao +Reviewed-by: Ranjani Sridharan +Link: https://lore.kernel.org/r/20220421163358.319489-2-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Stable-dep-of: 7dd692217b86 ("ASoC: SOF: sof-pci-dev: Fix community key quirk detection") +Signed-off-by: Sasha Levin +--- + sound/soc/sof/sof-pci-dev.c | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c +index 966bf28403475..42e1a62789bc6 100644 +--- a/sound/soc/sof/sof-pci-dev.c ++++ b/sound/soc/sof/sof-pci-dev.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -40,6 +41,7 @@ module_param_named(sof_pci_debug, sof_pci_debug, int, 0444); + MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)"); + + static const char *sof_dmi_override_tplg_name; ++static bool sof_dmi_use_community_key; + + #define SOF_PCI_DISABLE_PM_RUNTIME BIT(0) + +@@ -61,15 +63,35 @@ static const struct dmi_system_id sof_tplg_table[] = { + {} + }; + ++/* all Up boards use the community key */ ++static int up_use_community_key(const struct dmi_system_id *id) ++{ ++ sof_dmi_use_community_key = true; ++ return 1; ++} ++ ++/* ++ * For ApolloLake Chromebooks we want to force the use of the Intel production key. ++ * All newer platforms use the community key ++ */ ++static int chromebook_use_community_key(const struct dmi_system_id *id) ++{ ++ if (!soc_intel_is_apl()) ++ sof_dmi_use_community_key = true; ++ return 1; ++} ++ + static const struct dmi_system_id community_key_platforms[] = { + { + .ident = "Up boards", ++ .callback = up_use_community_key, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "AAEON"), + } + }, + { + .ident = "Google Chromebooks", ++ .callback = chromebook_use_community_key, + .matches = { + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), + } +@@ -375,7 +397,7 @@ static int sof_pci_probe(struct pci_dev *pci, + "Module parameter used, changed fw path to %s\n", + sof_pdata->fw_filename_prefix); + +- } else if (dmi_check_system(community_key_platforms)) { ++ } else if (dmi_check_system(community_key_platforms) && sof_dmi_use_community_key) { + sof_pdata->fw_filename_prefix = + devm_kasprintf(dev, GFP_KERNEL, "%s/%s", + sof_pdata->desc->default_fw_path, +-- +2.42.0 + diff --git a/queue-5.10/asoc-sof-sof-pci-dev-fix-community-key-quirk-detecti.patch b/queue-5.10/asoc-sof-sof-pci-dev-fix-community-key-quirk-detecti.patch new file mode 100644 index 00000000000..79a5f80d667 --- /dev/null +++ b/queue-5.10/asoc-sof-sof-pci-dev-fix-community-key-quirk-detecti.patch @@ -0,0 +1,47 @@ +From c40a6a117de1041feac2cbc79a947cecaa127dab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Oct 2023 14:59:53 -0600 +Subject: ASoC: SOF: sof-pci-dev: Fix community key quirk detection + +From: Mark Hasemeyer + +[ Upstream commit 7dd692217b861a8292ff8ac2c9d4458538fd6b96 ] + +Some Chromebooks do not populate the product family DMI value resulting +in firmware load failures. + +Add another quirk detection entry that looks for "Google" in the BIOS +version. Theoretically, PRODUCT_FAMILY could be replaced with +BIOS_VERSION, but it is left as a quirk to be conservative. + +Cc: stable@vger.kernel.org +Signed-off-by: Mark Hasemeyer +Acked-by: Curtis Malainey +Link: https://lore.kernel.org/r/20231020145953.v1.1.Iaf5702dc3f8af0fd2f81a22ba2da1a5e15b3604c@changeid +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/sof/sof-pci-dev.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c +index 42e1a62789bc6..ade292a61ed6d 100644 +--- a/sound/soc/sof/sof-pci-dev.c ++++ b/sound/soc/sof/sof-pci-dev.c +@@ -96,6 +96,13 @@ static const struct dmi_system_id community_key_platforms[] = { + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), + } + }, ++ { ++ .ident = "Google firmware", ++ .callback = chromebook_use_community_key, ++ .matches = { ++ DMI_MATCH(DMI_BIOS_VERSION, "Google"), ++ } ++ }, + {}, + }; + +-- +2.42.0 + diff --git a/queue-5.10/asoc-sof-sof-pci-dev-use-community-key-on-all-up-boa.patch b/queue-5.10/asoc-sof-sof-pci-dev-use-community-key-on-all-up-boa.patch new file mode 100644 index 00000000000..04b6362398b --- /dev/null +++ b/queue-5.10/asoc-sof-sof-pci-dev-use-community-key-on-all-up-boa.patch @@ -0,0 +1,61 @@ +From 39738482b037cd75689bb056be01edc1b4601ea3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 19 Nov 2021 17:13:27 -0600 +Subject: ASoC: SOF: sof-pci-dev: use community key on all Up boards +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pierre-Louis Bossart + +[ Upstream commit 405e52f412b85b581899f5e1b82d25a7c8959d89 ] + +There are already 3 versions of the Up boards with support for the SOF +community key (ApolloLake, WhiskyLake, TigerLake). Rather than +continue to add quirks for each version, let's add a wildcard. + +For WHL and TGL, the authentication supports both the SOF community +key and the firmware signed with the Intel production key. Given two +choices, the community key is the preferred option to allow developers +to sign their own firmware. The firmware signed with production key +can still be selected if needed with a kernel module +option (snd-sof-pci.fw_path="intel/sof") + +Tested-by: Péter Ujfalusi +Signed-off-by: Pierre-Louis Bossart +Reviewed-by: Bard Liao +Reviewed-by: Péter Ujfalusi +Link: https://lore.kernel.org/r/20211119231327.211946-1-pierre-louis.bossart@linux.intel.com +Signed-off-by: Mark Brown +Stable-dep-of: 7dd692217b86 ("ASoC: SOF: sof-pci-dev: Fix community key quirk detection") +Signed-off-by: Sasha Levin +--- + sound/soc/sof/sof-pci-dev.c | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c +index fe9feaab6a0ac..571dc679ff7c1 100644 +--- a/sound/soc/sof/sof-pci-dev.c ++++ b/sound/soc/sof/sof-pci-dev.c +@@ -59,17 +59,9 @@ static const struct dmi_system_id sof_tplg_table[] = { + + static const struct dmi_system_id community_key_platforms[] = { + { +- .ident = "Up Squared", ++ .ident = "Up boards", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "AAEON"), +- DMI_MATCH(DMI_BOARD_NAME, "UP-APL01"), +- } +- }, +- { +- .ident = "Up Extreme", +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "AAEON"), +- DMI_MATCH(DMI_BOARD_NAME, "UP-WHL01"), + } + }, + { +-- +2.42.0 + diff --git a/queue-5.10/cpufreq-imx6q-don-t-disable-792-mhz-opp-unnecessaril.patch b/queue-5.10/cpufreq-imx6q-don-t-disable-792-mhz-opp-unnecessaril.patch new file mode 100644 index 00000000000..c6b657d0536 --- /dev/null +++ b/queue-5.10/cpufreq-imx6q-don-t-disable-792-mhz-opp-unnecessaril.patch @@ -0,0 +1,49 @@ +From 413b02b850d301dc7b160ed8f42421f81515194a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Nov 2023 14:41:13 +0100 +Subject: cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily + +From: Christoph Niedermaier + +[ Upstream commit 2e4e0984c7d696cc74cf2fd7e7f62997f0e9ebe6 ] + +For a 900MHz i.MX6ULL CPU the 792MHz OPP is disabled. There is no +convincing reason to disable this OPP. If a CPU can run at 900MHz, +it should also be able to cope with 792MHz. Looking at the voltage +level of 792MHz in [1] (page 24, table 10. "Operating Ranges") the +current defined OPP is above the minimum. So the voltage level +shouldn't be a problem. However in [2] (page 24, table 10. +"Operating Ranges"), it is not mentioned that 792MHz OPP isn't +allowed. Change it to only disable 792MHz OPP for i.MX6ULL types +below 792 MHz. + +[1] https://www.nxp.com/docs/en/data-sheet/IMX6ULLIEC.pdf +[2] https://www.nxp.com/docs/en/data-sheet/IMX6ULLCEC.pdf + +Fixes: 0aa9abd4c212 ("cpufreq: imx6q: check speed grades for i.MX6ULL") +Signed-off-by: Christoph Niedermaier +Reviewed-by: Marek Vasut +Reviewed-by: Fabio Estevam +[ Viresh: Edited subject ] +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/imx6q-cpufreq.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c +index cc874d0c4395a..00f7ad7466680 100644 +--- a/drivers/cpufreq/imx6q-cpufreq.c ++++ b/drivers/cpufreq/imx6q-cpufreq.c +@@ -327,7 +327,7 @@ static int imx6ul_opp_check_speed_grading(struct device *dev) + imx6x_disable_freq_in_opp(dev, 696000000); + + if (of_machine_is_compatible("fsl,imx6ull")) { +- if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ) ++ if (val < OCOTP_CFG3_6ULL_SPEED_792MHZ) + imx6x_disable_freq_in_opp(dev, 792000000); + + if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ) +-- +2.42.0 + diff --git a/queue-5.10/cpufreq-imx6q-don-t-warn-for-disabling-a-non-existin.patch b/queue-5.10/cpufreq-imx6q-don-t-warn-for-disabling-a-non-existin.patch new file mode 100644 index 00000000000..b3d8181f4c1 --- /dev/null +++ b/queue-5.10/cpufreq-imx6q-don-t-warn-for-disabling-a-non-existin.patch @@ -0,0 +1,93 @@ +From 1788fe8a3dd76c407d9459fec0bdd5c16a389081 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 May 2023 17:07:11 +0200 +Subject: cpufreq: imx6q: don't warn for disabling a non-existing frequency + +From: Christoph Niedermaier + +[ Upstream commit 11a3b0ac33d95aa84be426e801f800997262a225 ] + +It is confusing if a warning is given for disabling a non-existent +frequency of the operating performance points (OPP). In this case +the function dev_pm_opp_disable() returns -ENODEV. Check the return +value and avoid the output of a warning in this case. Avoid code +duplication by using a separate function. + +Signed-off-by: Christoph Niedermaier +[ Viresh : Updated commit subject ] +Signed-off-by: Viresh Kumar +Stable-dep-of: 2e4e0984c7d6 ("cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily") +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/imx6q-cpufreq.c | 30 ++++++++++++++++-------------- + 1 file changed, 16 insertions(+), 14 deletions(-) + +diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c +index 5bf5fc759881f..cc874d0c4395a 100644 +--- a/drivers/cpufreq/imx6q-cpufreq.c ++++ b/drivers/cpufreq/imx6q-cpufreq.c +@@ -209,6 +209,14 @@ static struct cpufreq_driver imx6q_cpufreq_driver = { + .suspend = cpufreq_generic_suspend, + }; + ++static void imx6x_disable_freq_in_opp(struct device *dev, unsigned long freq) ++{ ++ int ret = dev_pm_opp_disable(dev, freq); ++ ++ if (ret < 0 && ret != -ENODEV) ++ dev_warn(dev, "failed to disable %ldMHz OPP\n", freq / 1000000); ++} ++ + #define OCOTP_CFG3 0x440 + #define OCOTP_CFG3_SPEED_SHIFT 16 + #define OCOTP_CFG3_SPEED_1P2GHZ 0x3 +@@ -254,17 +262,15 @@ static int imx6q_opp_check_speed_grading(struct device *dev) + val &= 0x3; + + if (val < OCOTP_CFG3_SPEED_996MHZ) +- if (dev_pm_opp_disable(dev, 996000000)) +- dev_warn(dev, "failed to disable 996MHz OPP\n"); ++ imx6x_disable_freq_in_opp(dev, 996000000); + + if (of_machine_is_compatible("fsl,imx6q") || + of_machine_is_compatible("fsl,imx6qp")) { + if (val != OCOTP_CFG3_SPEED_852MHZ) +- if (dev_pm_opp_disable(dev, 852000000)) +- dev_warn(dev, "failed to disable 852MHz OPP\n"); ++ imx6x_disable_freq_in_opp(dev, 852000000); ++ + if (val != OCOTP_CFG3_SPEED_1P2GHZ) +- if (dev_pm_opp_disable(dev, 1200000000)) +- dev_warn(dev, "failed to disable 1.2GHz OPP\n"); ++ imx6x_disable_freq_in_opp(dev, 1200000000); + } + + return 0; +@@ -316,20 +322,16 @@ static int imx6ul_opp_check_speed_grading(struct device *dev) + val >>= OCOTP_CFG3_SPEED_SHIFT; + val &= 0x3; + +- if (of_machine_is_compatible("fsl,imx6ul")) { ++ if (of_machine_is_compatible("fsl,imx6ul")) + if (val != OCOTP_CFG3_6UL_SPEED_696MHZ) +- if (dev_pm_opp_disable(dev, 696000000)) +- dev_warn(dev, "failed to disable 696MHz OPP\n"); +- } ++ imx6x_disable_freq_in_opp(dev, 696000000); + + if (of_machine_is_compatible("fsl,imx6ull")) { + if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ) +- if (dev_pm_opp_disable(dev, 792000000)) +- dev_warn(dev, "failed to disable 792MHz OPP\n"); ++ imx6x_disable_freq_in_opp(dev, 792000000); + + if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ) +- if (dev_pm_opp_disable(dev, 900000000)) +- dev_warn(dev, "failed to disable 900MHz OPP\n"); ++ imx6x_disable_freq_in_opp(dev, 900000000); + } + + return ret; +-- +2.42.0 + diff --git a/queue-5.10/dpaa2-eth-increase-the-needed-headroom-to-account-fo.patch b/queue-5.10/dpaa2-eth-increase-the-needed-headroom-to-account-fo.patch new file mode 100644 index 00000000000..932a4ae4dd4 --- /dev/null +++ b/queue-5.10/dpaa2-eth-increase-the-needed-headroom-to-account-fo.patch @@ -0,0 +1,85 @@ +From fac72f70970b6d2fb10dbaf8e3a700290acea802 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Nov 2023 12:28:04 +0200 +Subject: dpaa2-eth: increase the needed headroom to account for alignment + +From: Ioana Ciornei + +[ Upstream commit f422abe3f23d483cf01f386819f26fb3fe0dbb2b ] + +Increase the needed headroom to account for a 64 byte alignment +restriction which, with this patch, we make mandatory on the Tx path. +The case in which the amount of headroom needed is not available is +already handled by the driver which instead sends a S/G frame with the +first buffer only holding the SW and HW annotation areas. + +Without this patch, we can empirically see data corruption happening +between Tx and Tx confirmation which sometimes leads to the SW +annotation area being overwritten. + +Since this is an old IP where the hardware team cannot help to +understand the underlying behavior, we make the Tx alignment mandatory +for all frames to avoid the crash on Tx conf. Also, remove the comment +that suggested that this is just an optimization. + +This patch also sets the needed_headroom net device field to the usual +value that the driver would need on the Tx path: + - 64 bytes for the software annotation area + - 64 bytes to account for a 64 byte aligned buffer address + +Fixes: 6e2387e8f19e ("staging: fsl-dpaa2/eth: Add Freescale DPAA2 Ethernet driver") +Closes: https://lore.kernel.org/netdev/aa784d0c-85eb-4e5d-968b-c8f74fa86be6@gin.de/ +Signed-off-by: Ioana Ciornei +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 8 ++++---- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +index 35401202523ef..07ba0438f9655 100644 +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -928,14 +928,12 @@ static int dpaa2_eth_build_single_fd(struct dpaa2_eth_priv *priv, + dma_addr_t addr; + + buffer_start = skb->data - dpaa2_eth_needed_headroom(skb); +- +- /* If there's enough room to align the FD address, do it. +- * It will help hardware optimize accesses. +- */ + aligned_start = PTR_ALIGN(buffer_start - DPAA2_ETH_TX_BUF_ALIGN, + DPAA2_ETH_TX_BUF_ALIGN); + if (aligned_start >= skb->head) + buffer_start = aligned_start; ++ else ++ return -ENOMEM; + + /* Store a backpointer to the skb at the beginning of the buffer + * (in the private data area) such that we can release it +@@ -4337,6 +4335,8 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev) + if (err) + goto err_dl_port_add; + ++ net_dev->needed_headroom = DPAA2_ETH_SWA_SIZE + DPAA2_ETH_TX_BUF_ALIGN; ++ + err = register_netdev(net_dev); + if (err < 0) { + dev_err(dev, "register_netdev() failed\n"); +diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +index d236b8695c39c..2825f53e7e9b1 100644 +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +@@ -664,7 +664,7 @@ static inline bool dpaa2_eth_rx_pause_enabled(u64 link_options) + + static inline unsigned int dpaa2_eth_needed_headroom(struct sk_buff *skb) + { +- unsigned int headroom = DPAA2_ETH_SWA_SIZE; ++ unsigned int headroom = DPAA2_ETH_SWA_SIZE + DPAA2_ETH_TX_BUF_ALIGN; + + /* If we don't have an skb (e.g. XDP buffer), we only need space for + * the software annotation area +-- +2.42.0 + diff --git a/queue-5.10/driver-core-move-the-removable-attribute-from-usb-to.patch b/queue-5.10/driver-core-move-the-removable-attribute-from-usb-to.patch new file mode 100644 index 00000000000..ee819ad06ca --- /dev/null +++ b/queue-5.10/driver-core-move-the-removable-attribute-from-usb-to.patch @@ -0,0 +1,347 @@ +From 80981a7c4ba8cf69220c92266f52bfdfc172a1cf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 May 2021 10:18:11 -0700 +Subject: driver core: Move the "removable" attribute from USB to core + +From: Rajat Jain + +[ Upstream commit 70f400d4d957c2453c8689552ff212bc59f88938 ] + +Move the "removable" attribute from USB to core in order to allow it to be +supported by other subsystem / buses. Individual buses that want to support +this attribute can populate the removable property of the device while +enumerating it with the 3 possible values - + - "unknown" + - "fixed" + - "removable" +Leaving the field unchanged (i.e. "not supported") would mean that the +attribute would not show up in sysfs for that device. The UAPI (location, +symantics etc) for the attribute remains unchanged. + +Move the "removable" attribute from USB to the device core so it can be +used by other subsystems / buses. + +By default, devices do not have a "removable" attribute in sysfs. + +If a subsystem or bus driver wants to support a "removable" attribute, it +should call device_set_removable() before calling device_register() or +device_add(), e.g.: + + device_set_removable(dev, DEVICE_REMOVABLE); + device_register(dev); + +The possible values and the resulting sysfs attribute contents are: + + DEVICE_REMOVABLE_UNKNOWN -> "unknown" + DEVICE_REMOVABLE -> "removable" + DEVICE_FIXED -> "fixed" + +Convert the USB "removable" attribute to use this new device core +functionality. There should be no user-visible change in the location or +semantics of attribute for USB devices. + +Reviewed-by: Bjorn Helgaas +Signed-off-by: Rajat Jain +Link: https://lore.kernel.org/r/20210524171812.18095-1-rajatja@google.com +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 432e664e7c98 ("drm/amdgpu: don't use ATRM for external devices") +Signed-off-by: Sasha Levin +--- + Documentation/ABI/testing/sysfs-bus-usb | 11 ------ + .../ABI/testing/sysfs-devices-removable | 17 +++++++++ + drivers/base/core.c | 28 ++++++++++++++ + drivers/usb/core/hub.c | 13 ++++--- + drivers/usb/core/sysfs.c | 24 ------------ + include/linux/device.h | 37 +++++++++++++++++++ + include/linux/usb.h | 7 ---- + 7 files changed, 89 insertions(+), 48 deletions(-) + create mode 100644 Documentation/ABI/testing/sysfs-devices-removable + +diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb +index bf2c1968525f0..73eb23bc1f343 100644 +--- a/Documentation/ABI/testing/sysfs-bus-usb ++++ b/Documentation/ABI/testing/sysfs-bus-usb +@@ -154,17 +154,6 @@ Description: + files hold a string value (enable or disable) indicating whether + or not USB3 hardware LPM U1 or U2 is enabled for the device. + +-What: /sys/bus/usb/devices/.../removable +-Date: February 2012 +-Contact: Matthew Garrett +-Description: +- Some information about whether a given USB device is +- physically fixed to the platform can be inferred from a +- combination of hub descriptor bits and platform-specific data +- such as ACPI. This file will read either "removable" or +- "fixed" if the information is available, and "unknown" +- otherwise. +- + What: /sys/bus/usb/devices/.../ltm_capable + Date: July 2012 + Contact: Sarah Sharp +diff --git a/Documentation/ABI/testing/sysfs-devices-removable b/Documentation/ABI/testing/sysfs-devices-removable +new file mode 100644 +index 0000000000000..acf7766e800bd +--- /dev/null ++++ b/Documentation/ABI/testing/sysfs-devices-removable +@@ -0,0 +1,17 @@ ++What: /sys/devices/.../removable ++Date: May 2021 ++Contact: Rajat Jain ++Description: ++ Information about whether a given device can be removed from the ++ platform by the user. This is determined by its subsystem in a ++ bus / platform-specific way. This attribute is only present for ++ devices that can support determining such information: ++ ++ "removable": device can be removed from the platform by the user ++ "fixed": device is fixed to the platform / cannot be removed ++ by the user. ++ "unknown": The information is unavailable / cannot be deduced. ++ ++ Currently this is only supported by USB (which infers the ++ information from a combination of hub descriptor bits and ++ platform-specific data such as ACPI). +diff --git a/drivers/base/core.c b/drivers/base/core.c +index cb859febd03cf..d98cab88c38af 100644 +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -2053,6 +2053,25 @@ static ssize_t online_store(struct device *dev, struct device_attribute *attr, + } + static DEVICE_ATTR_RW(online); + ++static ssize_t removable_show(struct device *dev, struct device_attribute *attr, ++ char *buf) ++{ ++ const char *loc; ++ ++ switch (dev->removable) { ++ case DEVICE_REMOVABLE: ++ loc = "removable"; ++ break; ++ case DEVICE_FIXED: ++ loc = "fixed"; ++ break; ++ default: ++ loc = "unknown"; ++ } ++ return sysfs_emit(buf, "%s\n", loc); ++} ++static DEVICE_ATTR_RO(removable); ++ + int device_add_groups(struct device *dev, const struct attribute_group **groups) + { + return sysfs_create_groups(&dev->kobj, groups); +@@ -2230,8 +2249,16 @@ static int device_add_attrs(struct device *dev) + goto err_remove_dev_online; + } + ++ if (dev_removable_is_valid(dev)) { ++ error = device_create_file(dev, &dev_attr_removable); ++ if (error) ++ goto err_remove_dev_waiting_for_supplier; ++ } ++ + return 0; + ++ err_remove_dev_waiting_for_supplier: ++ device_remove_file(dev, &dev_attr_waiting_for_supplier); + err_remove_dev_online: + device_remove_file(dev, &dev_attr_online); + err_remove_dev_groups: +@@ -2251,6 +2278,7 @@ static void device_remove_attrs(struct device *dev) + struct class *class = dev->class; + const struct device_type *type = dev->type; + ++ device_remove_file(dev, &dev_attr_removable); + device_remove_file(dev, &dev_attr_waiting_for_supplier); + device_remove_file(dev, &dev_attr_online); + device_remove_groups(dev, dev->groups); +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index cfcd4f2ffffaa..331f41c6cc75e 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -2450,6 +2450,8 @@ static void set_usb_port_removable(struct usb_device *udev) + u16 wHubCharacteristics; + bool removable = true; + ++ dev_set_removable(&udev->dev, DEVICE_REMOVABLE_UNKNOWN); ++ + if (!hdev) + return; + +@@ -2461,11 +2463,11 @@ static void set_usb_port_removable(struct usb_device *udev) + */ + switch (hub->ports[udev->portnum - 1]->connect_type) { + case USB_PORT_CONNECT_TYPE_HOT_PLUG: +- udev->removable = USB_DEVICE_REMOVABLE; ++ dev_set_removable(&udev->dev, DEVICE_REMOVABLE); + return; + case USB_PORT_CONNECT_TYPE_HARD_WIRED: + case USB_PORT_NOT_USED: +- udev->removable = USB_DEVICE_FIXED; ++ dev_set_removable(&udev->dev, DEVICE_FIXED); + return; + default: + break; +@@ -2490,9 +2492,9 @@ static void set_usb_port_removable(struct usb_device *udev) + } + + if (removable) +- udev->removable = USB_DEVICE_REMOVABLE; ++ dev_set_removable(&udev->dev, DEVICE_REMOVABLE); + else +- udev->removable = USB_DEVICE_FIXED; ++ dev_set_removable(&udev->dev, DEVICE_FIXED); + + } + +@@ -2564,8 +2566,7 @@ int usb_new_device(struct usb_device *udev) + device_enable_async_suspend(&udev->dev); + + /* check whether the hub or firmware marks this port as non-removable */ +- if (udev->parent) +- set_usb_port_removable(udev); ++ set_usb_port_removable(udev); + + /* Register the device. The device driver is responsible + * for configuring the device and invoking the add-device +diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c +index a2ca38e25e0c3..35ce8b87e9396 100644 +--- a/drivers/usb/core/sysfs.c ++++ b/drivers/usb/core/sysfs.c +@@ -298,29 +298,6 @@ static ssize_t urbnum_show(struct device *dev, struct device_attribute *attr, + } + static DEVICE_ATTR_RO(urbnum); + +-static ssize_t removable_show(struct device *dev, struct device_attribute *attr, +- char *buf) +-{ +- struct usb_device *udev; +- char *state; +- +- udev = to_usb_device(dev); +- +- switch (udev->removable) { +- case USB_DEVICE_REMOVABLE: +- state = "removable"; +- break; +- case USB_DEVICE_FIXED: +- state = "fixed"; +- break; +- default: +- state = "unknown"; +- } +- +- return sprintf(buf, "%s\n", state); +-} +-static DEVICE_ATTR_RO(removable); +- + static ssize_t ltm_capable_show(struct device *dev, + struct device_attribute *attr, char *buf) + { +@@ -825,7 +802,6 @@ static struct attribute *dev_attrs[] = { + &dev_attr_avoid_reset_quirk.attr, + &dev_attr_authorized.attr, + &dev_attr_remove.attr, +- &dev_attr_removable.attr, + &dev_attr_ltm_capable.attr, + #ifdef CONFIG_OF + &dev_attr_devspec.attr, +diff --git a/include/linux/device.h b/include/linux/device.h +index 4f7e0c85e11fa..6394c4b70a090 100644 +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -348,6 +348,22 @@ enum dl_dev_state { + DL_DEV_UNBINDING, + }; + ++/** ++ * enum device_removable - Whether the device is removable. The criteria for a ++ * device to be classified as removable is determined by its subsystem or bus. ++ * @DEVICE_REMOVABLE_NOT_SUPPORTED: This attribute is not supported for this ++ * device (default). ++ * @DEVICE_REMOVABLE_UNKNOWN: Device location is Unknown. ++ * @DEVICE_FIXED: Device is not removable by the user. ++ * @DEVICE_REMOVABLE: Device is removable by the user. ++ */ ++enum device_removable { ++ DEVICE_REMOVABLE_NOT_SUPPORTED = 0, /* must be 0 */ ++ DEVICE_REMOVABLE_UNKNOWN, ++ DEVICE_FIXED, ++ DEVICE_REMOVABLE, ++}; ++ + /** + * struct dev_links_info - Device data related to device links. + * @suppliers: List of links to supplier devices. +@@ -435,6 +451,9 @@ struct dev_links_info { + * device (i.e. the bus driver that discovered the device). + * @iommu_group: IOMMU group the device belongs to. + * @iommu: Per device generic IOMMU runtime data ++ * @removable: Whether the device can be removed from the system. This ++ * should be set by the subsystem / bus driver that discovered ++ * the device. + * + * @offline_disabled: If set, the device is permanently online. + * @offline: Set after successful invocation of bus type's .offline(). +@@ -546,6 +565,8 @@ struct device { + struct iommu_group *iommu_group; + struct dev_iommu *iommu; + ++ enum device_removable removable; ++ + bool offline_disabled:1; + bool offline:1; + bool of_node_reused:1; +@@ -781,6 +802,22 @@ static inline bool dev_has_sync_state(struct device *dev) + return false; + } + ++static inline void dev_set_removable(struct device *dev, ++ enum device_removable removable) ++{ ++ dev->removable = removable; ++} ++ ++static inline bool dev_is_removable(struct device *dev) ++{ ++ return dev->removable == DEVICE_REMOVABLE; ++} ++ ++static inline bool dev_removable_is_valid(struct device *dev) ++{ ++ return dev->removable != DEVICE_REMOVABLE_NOT_SUPPORTED; ++} ++ + /* + * High level routines for use by the bus drivers + */ +diff --git a/include/linux/usb.h b/include/linux/usb.h +index 8bc1119afc317..e02cf70ca52f6 100644 +--- a/include/linux/usb.h ++++ b/include/linux/usb.h +@@ -478,12 +478,6 @@ struct usb_dev_state; + + struct usb_tt; + +-enum usb_device_removable { +- USB_DEVICE_REMOVABLE_UNKNOWN = 0, +- USB_DEVICE_REMOVABLE, +- USB_DEVICE_FIXED, +-}; +- + enum usb_port_connect_type { + USB_PORT_CONNECT_TYPE_UNKNOWN = 0, + USB_PORT_CONNECT_TYPE_HOT_PLUG, +@@ -710,7 +704,6 @@ struct usb_device { + #endif + struct wusb_dev *wusb_dev; + int slot_id; +- enum usb_device_removable removable; + struct usb2_lpm_parameters l1_params; + struct usb3_lpm_parameters u1_params; + struct usb3_lpm_parameters u2_params; +-- +2.42.0 + diff --git a/queue-5.10/drm-amdgpu-don-t-use-atrm-for-external-devices.patch b/queue-5.10/drm-amdgpu-don-t-use-atrm-for-external-devices.patch new file mode 100644 index 00000000000..0552b838ecb --- /dev/null +++ b/queue-5.10/drm-amdgpu-don-t-use-atrm-for-external-devices.patch @@ -0,0 +1,53 @@ +From 1d415ce4137f881e7e6b90a8c773919987dd15a4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Oct 2023 15:40:01 -0400 +Subject: drm/amdgpu: don't use ATRM for external devices + +From: Alex Deucher + +[ Upstream commit 432e664e7c98c243fab4c3c95bd463bea3aeed28 ] + +The ATRM ACPI method is for fetching the dGPU vbios rom +image on laptops and all-in-one systems. It should not be +used for external add in cards. If the dGPU is thunderbolt +connected, don't try ATRM. + +v2: pci_is_thunderbolt_attached only works for Intel. Use + pdev->external_facing instead. +v3: dev_is_removable() seems to be what we want + +Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2925 +Reviewed-by: Mario Limonciello +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +index 4b568ee932435..02a73b9e08d7d 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +@@ -29,6 +29,7 @@ + #include "amdgpu.h" + #include "atom.h" + ++#include + #include + #include + #include +@@ -285,6 +286,10 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev) + if (adev->flags & AMD_IS_APU) + return false; + ++ /* ATRM is for on-platform devices only */ ++ if (dev_is_removable(&adev->pdev->dev)) ++ return false; ++ + while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { + dhandle = ACPI_HANDLE(&pdev->dev); + if (!dhandle) +-- +2.42.0 + diff --git a/queue-5.10/ext4-improve-write-performance-with-disabled-delallo.patch b/queue-5.10/ext4-improve-write-performance-with-disabled-delallo.patch new file mode 100644 index 00000000000..eb352fe43c0 --- /dev/null +++ b/queue-5.10/ext4-improve-write-performance-with-disabled-delallo.patch @@ -0,0 +1,47 @@ +From 5660cc0ca1a19b62ddee69191ffcb7d81606873d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 May 2022 13:14:02 +0200 +Subject: ext4: improve write performance with disabled delalloc + +From: Jan Kara + +[ Upstream commit 8d5459c11f548131ce48b2fbf45cccc5c382558f ] + +When delayed allocation is disabled (either through mount option or +because we are running low on free space), ext4_write_begin() allocates +blocks with EXT4_GET_BLOCKS_IO_CREATE_EXT flag. With this flag extent +merging is disabled and since ext4_write_begin() is called for each page +separately, we end up with a *lot* of 1 block extents in the extent tree +and following writeback is writing 1 block at a time which results in +very poor write throughput (4 MB/s instead of 200 MB/s). These days when +ext4_get_block_unwritten() is used only by ext4_write_begin(), +ext4_page_mkwrite() and inline data conversion, we can safely allow +extent merging to happen from these paths since following writeback will +happen on different boundaries anyway. So use +EXT4_GET_BLOCKS_CREATE_UNRIT_EXT instead which restores the performance. + +Signed-off-by: Jan Kara +Link: https://lore.kernel.org/r/20220520111402.4252-1-jack@suse.cz +Signed-off-by: Theodore Ts'o +Stable-dep-of: 2cd8bdb5efc1 ("ext4: mark buffer new if it is unwritten to avoid stale data exposure") +Signed-off-by: Sasha Levin +--- + fs/ext4/inode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index 365c4d3a434ab..045f0efb696ad 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -821,7 +821,7 @@ int ext4_get_block_unwritten(struct inode *inode, sector_t iblock, + ext4_debug("ext4_get_block_unwritten: inode %lu, create flag %d\n", + inode->i_ino, create); + return _ext4_get_block(inode, iblock, bh_result, +- EXT4_GET_BLOCKS_IO_CREATE_EXT); ++ EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT); + } + + /* Maximum number of blocks we map for direct IO at once. */ +-- +2.42.0 + diff --git a/queue-5.10/ext4-mark-buffer-new-if-it-is-unwritten-to-avoid-sta.patch b/queue-5.10/ext4-mark-buffer-new-if-it-is-unwritten-to-avoid-sta.patch new file mode 100644 index 00000000000..3e29dfce9a8 --- /dev/null +++ b/queue-5.10/ext4-mark-buffer-new-if-it-is-unwritten-to-avoid-sta.patch @@ -0,0 +1,145 @@ +From 831c8dbe1e4536ee9a7fbd5ab606712832f6eda9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Sep 2023 16:15:50 +0530 +Subject: ext4: mark buffer new if it is unwritten to avoid stale data exposure + +From: Ojaswin Mujoo + +[ Upstream commit 2cd8bdb5efc1e0d5b11a4b7ba6b922fd2736a87f ] + +** Short Version ** + +In ext4 with dioread_nolock, we could have a scenario where the bh returned by +get_blocks (ext4_get_block_unwritten()) in __block_write_begin_int() has +UNWRITTEN and MAPPED flag set. Since such a bh does not have NEW flag set we +never zero out the range of bh that is not under write, causing whatever stale +data is present in the folio at that time to be written out to disk. To fix this +mark the buffer as new, in case it is unwritten, in ext4_get_block_unwritten(). + +** Long Version ** + +The issue mentioned above was resulting in two different bugs: + +1. On block size < page size case in ext4, generic/269 was reliably +failing with dioread_nolock. The state of the write was as follows: + + * The write was extending i_size. + * The last block of the file was fallocated and had an unwritten extent + * We were near ENOSPC and hence we were switching to non-delayed alloc + allocation. + +In this case, the back trace that triggers the bug is as follows: + + ext4_da_write_begin() + /* switch to nodelalloc due to low space */ + ext4_write_begin() + ext4_should_dioread_nolock() // true since mount flags still have delalloc + __block_write_begin(..., ext4_get_block_unwritten) + __block_write_begin_int() + for(each buffer head in page) { + /* first iteration, this is bh1 which contains i_size */ + if (!buffer_mapped) + get_block() /* returns bh with only UNWRITTEN and MAPPED */ + /* second iteration, bh2 */ + if (!buffer_mapped) + get_block() /* we fail here, could be ENOSPC */ + } + if (err) + /* + * this would zero out all new buffers and mark them uptodate. + * Since bh1 was never marked new, we skip it here which causes + * the bug later. + */ + folio_zero_new_buffers(); + /* ext4_wrte_begin() error handling */ + ext4_truncate_failed_write() + ext4_truncate() + ext4_block_truncate_page() + __ext4_block_zero_page_range() + if(!buffer_uptodate()) + ext4_read_bh_lock() + ext4_read_bh() -> ... ext4_submit_bh_wbc() + BUG_ON(buffer_unwritten(bh)); /* !!! */ + +2. The second issue is stale data exposure with page size >= blocksize +with dioread_nolock. The conditions needed for it to happen are same as +the previous issue ie dioread_nolock around ENOSPC condition. The issue +is also similar where in __block_write_begin_int() when we call +ext4_get_block_unwritten() on the buffer_head and the underlying extent +is unwritten, we get an unwritten and mapped buffer head. Since it is +not new, we never zero out the partial range which is not under write, +thus writing stale data to disk. This can be easily observed with the +following reproducer: + + fallocate -l 4k testfile + xfs_io -c "pwrite 2k 2k" testfile + # hexdump output will have stale data in from byte 0 to 2k in testfile + hexdump -C testfile + +NOTE: To trigger this, we need dioread_nolock enabled and write happening via +ext4_write_begin(), which is usually used when we have -o nodealloc. Since +dioread_nolock is disabled with nodelalloc, the only alternate way to call +ext4_write_begin() is to ensure that delayed alloc switches to nodelalloc ie +ext4_da_write_begin() calls ext4_write_begin(). This will usually happen when +ext4 is almost full like the way generic/269 was triggering it in Issue 1 above. +This might make the issue harder to hit. Hence, for reliable replication, I used +the below patch to temporarily allow dioread_nolock with nodelalloc and then +mount the disk with -o nodealloc,dioread_nolock. With this you can hit the stale +data issue 100% of times: + +@@ -508,8 +508,8 @@ static inline int ext4_should_dioread_nolock(struct inode *inode) + if (ext4_should_journal_data(inode)) + return 0; + /* temporary fix to prevent generic/422 test failures */ +- if (!test_opt(inode->i_sb, DELALLOC)) +- return 0; ++ // if (!test_opt(inode->i_sb, DELALLOC)) ++ // return 0; + return 1; + } + +After applying this patch to mark buffer as NEW, both the above issues are +fixed. + +Signed-off-by: Ojaswin Mujoo +Cc: stable@kernel.org +Reviewed-by: Jan Kara +Reviewed-by: "Ritesh Harjani (IBM)" +Link: https://lore.kernel.org/r/d0ed09d70a9733fbb5349c5c7b125caac186ecdf.1695033645.git.ojaswin@linux.ibm.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/inode.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index 045f0efb696ad..61739f62e2b3c 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -818,10 +818,22 @@ int ext4_get_block(struct inode *inode, sector_t iblock, + int ext4_get_block_unwritten(struct inode *inode, sector_t iblock, + struct buffer_head *bh_result, int create) + { ++ int ret = 0; ++ + ext4_debug("ext4_get_block_unwritten: inode %lu, create flag %d\n", + inode->i_ino, create); +- return _ext4_get_block(inode, iblock, bh_result, ++ ret = _ext4_get_block(inode, iblock, bh_result, + EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT); ++ ++ /* ++ * If the buffer is marked unwritten, mark it as new to make sure it is ++ * zeroed out correctly in case of partial writes. Otherwise, there is ++ * a chance of stale data getting exposed. ++ */ ++ if (ret == 0 && buffer_unwritten(bh_result)) ++ set_buffer_new(bh_result); ++ ++ return ret; + } + + /* Maximum number of blocks we map for direct IO at once. */ +-- +2.42.0 + diff --git a/queue-5.10/ext4-properly-sync-file-size-update-after-o_sync-dir.patch b/queue-5.10/ext4-properly-sync-file-size-update-after-o_sync-dir.patch new file mode 100644 index 00000000000..dc74dcefa40 --- /dev/null +++ b/queue-5.10/ext4-properly-sync-file-size-update-after-o_sync-dir.patch @@ -0,0 +1,246 @@ +From 84133ca398f3d3a0563b2b47a0c0d86191848b2b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Oct 2023 14:13:50 +0200 +Subject: ext4: properly sync file size update after O_SYNC direct IO + +From: Jan Kara + +[ Upstream commit 91562895f8030cb9a0470b1db49de79346a69f91 ] + +Gao Xiang has reported that on ext4 O_SYNC direct IO does not properly +sync file size update and thus if we crash at unfortunate moment, the +file can have smaller size although O_SYNC IO has reported successful +completion. The problem happens because update of on-disk inode size is +handled in ext4_dio_write_iter() *after* iomap_dio_rw() (and thus +dio_complete() in particular) has returned and generic_file_sync() gets +called by dio_complete(). Fix the problem by handling on-disk inode size +update directly in our ->end_io completion handler. + +References: https://lore.kernel.org/all/02d18236-26ef-09b0-90ad-030c4fe3ee20@linux.alibaba.com +Reported-by: Gao Xiang +CC: stable@vger.kernel.org +Fixes: 378f32bab371 ("ext4: introduce direct I/O write using iomap infrastructure") +Signed-off-by: Jan Kara +Tested-by: Joseph Qi +Reviewed-by: "Ritesh Harjani (IBM)" +Link: https://lore.kernel.org/r/20231013121350.26872-1-jack@suse.cz +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/file.c | 153 +++++++++++++++++++++---------------------------- + 1 file changed, 65 insertions(+), 88 deletions(-) + +diff --git a/fs/ext4/file.c b/fs/ext4/file.c +index f42cc1fe0ba1d..15f45499f491a 100644 +--- a/fs/ext4/file.c ++++ b/fs/ext4/file.c +@@ -280,80 +280,38 @@ static ssize_t ext4_buffered_write_iter(struct kiocb *iocb, + } + + static ssize_t ext4_handle_inode_extension(struct inode *inode, loff_t offset, +- ssize_t written, size_t count) ++ ssize_t count) + { + handle_t *handle; +- bool truncate = false; +- u8 blkbits = inode->i_blkbits; +- ext4_lblk_t written_blk, end_blk; +- int ret; +- +- /* +- * Note that EXT4_I(inode)->i_disksize can get extended up to +- * inode->i_size while the I/O was running due to writeback of delalloc +- * blocks. But, the code in ext4_iomap_alloc() is careful to use +- * zeroed/unwritten extents if this is possible; thus we won't leave +- * uninitialized blocks in a file even if we didn't succeed in writing +- * as much as we intended. +- */ +- WARN_ON_ONCE(i_size_read(inode) < EXT4_I(inode)->i_disksize); +- if (offset + count <= EXT4_I(inode)->i_disksize) { +- /* +- * We need to ensure that the inode is removed from the orphan +- * list if it has been added prematurely, due to writeback of +- * delalloc blocks. +- */ +- if (!list_empty(&EXT4_I(inode)->i_orphan) && inode->i_nlink) { +- handle = ext4_journal_start(inode, EXT4_HT_INODE, 2); +- +- if (IS_ERR(handle)) { +- ext4_orphan_del(NULL, inode); +- return PTR_ERR(handle); +- } +- +- ext4_orphan_del(handle, inode); +- ext4_journal_stop(handle); +- } +- +- return written; +- } +- +- if (written < 0) +- goto truncate; + ++ lockdep_assert_held_write(&inode->i_rwsem); + handle = ext4_journal_start(inode, EXT4_HT_INODE, 2); +- if (IS_ERR(handle)) { +- written = PTR_ERR(handle); +- goto truncate; +- } ++ if (IS_ERR(handle)) ++ return PTR_ERR(handle); + +- if (ext4_update_inode_size(inode, offset + written)) { +- ret = ext4_mark_inode_dirty(handle, inode); ++ if (ext4_update_inode_size(inode, offset + count)) { ++ int ret = ext4_mark_inode_dirty(handle, inode); + if (unlikely(ret)) { +- written = ret; + ext4_journal_stop(handle); +- goto truncate; ++ return ret; + } + } + +- /* +- * We may need to truncate allocated but not written blocks beyond EOF. +- */ +- written_blk = ALIGN(offset + written, 1 << blkbits); +- end_blk = ALIGN(offset + count, 1 << blkbits); +- if (written_blk < end_blk && ext4_can_truncate(inode)) +- truncate = true; +- +- /* +- * Remove the inode from the orphan list if it has been extended and +- * everything went OK. +- */ +- if (!truncate && inode->i_nlink) ++ if (inode->i_nlink) + ext4_orphan_del(handle, inode); + ext4_journal_stop(handle); + +- if (truncate) { +-truncate: ++ return count; ++} ++ ++/* ++ * Clean up the inode after DIO or DAX extending write has completed and the ++ * inode size has been updated using ext4_handle_inode_extension(). ++ */ ++static void ext4_inode_extension_cleanup(struct inode *inode, ssize_t count) ++{ ++ lockdep_assert_held_write(&inode->i_rwsem); ++ if (count < 0) { + ext4_truncate_failed_write(inode); + /* + * If the truncate operation failed early, then the inode may +@@ -362,9 +320,28 @@ static ssize_t ext4_handle_inode_extension(struct inode *inode, loff_t offset, + */ + if (inode->i_nlink) + ext4_orphan_del(NULL, inode); ++ return; + } ++ /* ++ * If i_disksize got extended due to writeback of delalloc blocks while ++ * the DIO was running we could fail to cleanup the orphan list in ++ * ext4_handle_inode_extension(). Do it now. ++ */ ++ if (!list_empty(&EXT4_I(inode)->i_orphan) && inode->i_nlink) { ++ handle_t *handle = ext4_journal_start(inode, EXT4_HT_INODE, 2); + +- return written; ++ if (IS_ERR(handle)) { ++ /* ++ * The write has successfully completed. Not much to ++ * do with the error here so just cleanup the orphan ++ * list and hope for the best. ++ */ ++ ext4_orphan_del(NULL, inode); ++ return; ++ } ++ ext4_orphan_del(handle, inode); ++ ext4_journal_stop(handle); ++ } + } + + static int ext4_dio_write_end_io(struct kiocb *iocb, ssize_t size, +@@ -373,31 +350,22 @@ static int ext4_dio_write_end_io(struct kiocb *iocb, ssize_t size, + loff_t pos = iocb->ki_pos; + struct inode *inode = file_inode(iocb->ki_filp); + ++ if (!error && size && flags & IOMAP_DIO_UNWRITTEN) ++ error = ext4_convert_unwritten_extents(NULL, inode, pos, size); + if (error) + return error; +- +- if (size && flags & IOMAP_DIO_UNWRITTEN) { +- error = ext4_convert_unwritten_extents(NULL, inode, pos, size); +- if (error < 0) +- return error; +- } + /* +- * If we are extending the file, we have to update i_size here before +- * page cache gets invalidated in iomap_dio_rw(). Otherwise racing +- * buffered reads could zero out too much from page cache pages. Update +- * of on-disk size will happen later in ext4_dio_write_iter() where +- * we have enough information to also perform orphan list handling etc. +- * Note that we perform all extending writes synchronously under +- * i_rwsem held exclusively so i_size update is safe here in that case. +- * If the write was not extending, we cannot see pos > i_size here +- * because operations reducing i_size like truncate wait for all +- * outstanding DIO before updating i_size. ++ * Note that EXT4_I(inode)->i_disksize can get extended up to ++ * inode->i_size while the I/O was running due to writeback of delalloc ++ * blocks. But the code in ext4_iomap_alloc() is careful to use ++ * zeroed/unwritten extents if this is possible; thus we won't leave ++ * uninitialized blocks in a file even if we didn't succeed in writing ++ * as much as we intended. + */ +- pos += size; +- if (pos > i_size_read(inode)) +- i_size_write(inode, pos); +- +- return 0; ++ WARN_ON_ONCE(i_size_read(inode) < READ_ONCE(EXT4_I(inode)->i_disksize)); ++ if (pos + size <= READ_ONCE(EXT4_I(inode)->i_disksize)) ++ return size; ++ return ext4_handle_inode_extension(inode, pos, size); + } + + static const struct iomap_dio_ops ext4_dio_write_ops = { +@@ -572,9 +540,16 @@ static ssize_t ext4_dio_write_iter(struct kiocb *iocb, struct iov_iter *from) + is_sync_kiocb(iocb) || unaligned_io || extend); + if (ret == -ENOTBLK) + ret = 0; +- +- if (extend) +- ret = ext4_handle_inode_extension(inode, offset, ret, count); ++ if (extend) { ++ /* ++ * We always perform extending DIO write synchronously so by ++ * now the IO is completed and ext4_handle_inode_extension() ++ * was called. Cleanup the inode in case of error or race with ++ * writeback of delalloc blocks. ++ */ ++ WARN_ON_ONCE(ret == -EIOCBQUEUED); ++ ext4_inode_extension_cleanup(inode, ret); ++ } + + out: + if (ilock_shared) +@@ -655,8 +630,10 @@ ext4_dax_write_iter(struct kiocb *iocb, struct iov_iter *from) + + ret = dax_iomap_rw(iocb, from, &ext4_iomap_ops); + +- if (extend) +- ret = ext4_handle_inode_extension(inode, offset, ret, count); ++ if (extend) { ++ ret = ext4_handle_inode_extension(inode, offset, ret); ++ ext4_inode_extension_cleanup(inode, ret); ++ } + out: + inode_unlock(inode); + if (ret > 0) +-- +2.42.0 + diff --git a/queue-5.10/fbdev-stifb-make-the-sti-next-font-pointer-a-32-bit-.patch b/queue-5.10/fbdev-stifb-make-the-sti-next-font-pointer-a-32-bit-.patch new file mode 100644 index 00000000000..7a42a7376c9 --- /dev/null +++ b/queue-5.10/fbdev-stifb-make-the-sti-next-font-pointer-a-32-bit-.patch @@ -0,0 +1,39 @@ +From 2f7bfb723ec393326e45853f60599d5544961aa7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Oct 2023 13:36:48 +0200 +Subject: fbdev: stifb: Make the STI next font pointer a 32-bit signed offset + +From: Helge Deller + +[ Upstream commit 8a32aa17c1cd48df1ddaa78e45abcb8c7a2220d6 ] + +The pointer to the next STI font is actually a signed 32-bit +offset. With this change the 64-bit kernel will correctly subract +the (signed 32-bit) offset instead of adding a (unsigned 32-bit) +offset. It has no effect on 32-bit kernels. + +This fixes the stifb driver with a 64-bit kernel on qemu. + +Signed-off-by: Helge Deller +Cc: stable@vger.kernel.org +Signed-off-by: Sasha Levin +--- + drivers/video/fbdev/sticore.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/video/fbdev/sticore.h b/drivers/video/fbdev/sticore.h +index 0ebdd28a0b813..d83ab3ded5f3d 100644 +--- a/drivers/video/fbdev/sticore.h ++++ b/drivers/video/fbdev/sticore.h +@@ -231,7 +231,7 @@ struct sti_rom_font { + u8 height; + u8 font_type; /* language type */ + u8 bytes_per_char; +- u32 next_font; ++ s32 next_font; /* note: signed int */ + u8 underline_height; + u8 underline_pos; + u8 res008[2]; +-- +2.42.0 + diff --git a/queue-5.10/fs-add-ctime-accessors-infrastructure.patch b/queue-5.10/fs-add-ctime-accessors-infrastructure.patch new file mode 100644 index 00000000000..664b54ac589 --- /dev/null +++ b/queue-5.10/fs-add-ctime-accessors-infrastructure.patch @@ -0,0 +1,116 @@ +From c7bcf954a607e18c6c671c2623cba67676b32437 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 Jul 2023 14:58:10 -0400 +Subject: fs: add ctime accessors infrastructure + +From: Jeff Layton + +[ Upstream commit 9b6304c1d53745c300b86f202d0dcff395e2d2db ] + +struct timespec64 has unused bits in the tv_nsec field that can be used +for other purposes. In future patches, we're going to change how the +inode->i_ctime is accessed in certain inodes in order to make use of +them. In order to do that safely though, we'll need to eradicate raw +accesses of the inode->i_ctime field from the kernel. + +Add new accessor functions for the ctime that we use to replace them. + +Reviewed-by: Jan Kara +Reviewed-by: Luis Chamberlain +Signed-off-by: Jeff Layton +Reviewed-by: Damien Le Moal +Message-Id: <20230705185812.579118-2-jlayton@kernel.org> +Signed-off-by: Christian Brauner +Stable-dep-of: 5923d6686a10 ("smb3: fix caching of ctime on setxattr") +Signed-off-by: Sasha Levin +--- + fs/inode.c | 16 ++++++++++++++++ + include/linux/fs.h | 45 ++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 60 insertions(+), 1 deletion(-) + +diff --git a/fs/inode.c b/fs/inode.c +index 311237e8d3595..5c7139aa2bda7 100644 +--- a/fs/inode.c ++++ b/fs/inode.c +@@ -2392,6 +2392,22 @@ int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa, + } + EXPORT_SYMBOL(vfs_ioc_fssetxattr_check); + ++/** ++ * inode_set_ctime_current - set the ctime to current_time ++ * @inode: inode ++ * ++ * Set the inode->i_ctime to the current value for the inode. Returns ++ * the current value that was assigned to i_ctime. ++ */ ++struct timespec64 inode_set_ctime_current(struct inode *inode) ++{ ++ struct timespec64 now = current_time(inode); ++ ++ inode_set_ctime(inode, now.tv_sec, now.tv_nsec); ++ return now; ++} ++EXPORT_SYMBOL(inode_set_ctime_current); ++ + /** + * in_group_or_capable - check whether caller is CAP_FSETID privileged + * @inode: inode to check +diff --git a/include/linux/fs.h b/include/linux/fs.h +index f9e25d0a7b9c8..82316863c71fd 100644 +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -1580,7 +1580,50 @@ static inline void i_gid_write(struct inode *inode, gid_t gid) + inode->i_gid = make_kgid(inode->i_sb->s_user_ns, gid); + } + +-extern struct timespec64 current_time(struct inode *inode); ++struct timespec64 current_time(struct inode *inode); ++struct timespec64 inode_set_ctime_current(struct inode *inode); ++ ++/** ++ * inode_get_ctime - fetch the current ctime from the inode ++ * @inode: inode from which to fetch ctime ++ * ++ * Grab the current ctime from the inode and return it. ++ */ ++static inline struct timespec64 inode_get_ctime(const struct inode *inode) ++{ ++ return inode->i_ctime; ++} ++ ++/** ++ * inode_set_ctime_to_ts - set the ctime in the inode ++ * @inode: inode in which to set the ctime ++ * @ts: value to set in the ctime field ++ * ++ * Set the ctime in @inode to @ts ++ */ ++static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode, ++ struct timespec64 ts) ++{ ++ inode->i_ctime = ts; ++ return ts; ++} ++ ++/** ++ * inode_set_ctime - set the ctime in the inode ++ * @inode: inode in which to set the ctime ++ * @sec: tv_sec value to set ++ * @nsec: tv_nsec value to set ++ * ++ * Set the ctime in @inode to { @sec, @nsec } ++ */ ++static inline struct timespec64 inode_set_ctime(struct inode *inode, ++ time64_t sec, long nsec) ++{ ++ struct timespec64 ts = { .tv_sec = sec, ++ .tv_nsec = nsec }; ++ ++ return inode_set_ctime_to_ts(inode, ts); ++} + + /* + * Snapshotting support. +-- +2.42.0 + diff --git a/queue-5.10/hv_netvsc-fix-race-of-netvsc-and-vf-register_netdevi.patch b/queue-5.10/hv_netvsc-fix-race-of-netvsc-and-vf-register_netdevi.patch new file mode 100644 index 00000000000..40255f6d447 --- /dev/null +++ b/queue-5.10/hv_netvsc-fix-race-of-netvsc-and-vf-register_netdevi.patch @@ -0,0 +1,89 @@ +From e82b6406bf473a932e4cbf0719ff1d2bc74acdb1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 19 Nov 2023 08:23:41 -0800 +Subject: hv_netvsc: fix race of netvsc and VF register_netdevice + +From: Haiyang Zhang + +[ Upstream commit d30fb712e52964f2cf9a9c14cf67078394044837 ] + +The rtnl lock also needs to be held before rndis_filter_device_add() +which advertises nvsp_2_vsc_capability / sriov bit, and triggers +VF NIC offering and registering. If VF NIC finished register_netdev() +earlier it may cause name based config failure. + +To fix this issue, move the call to rtnl_lock() before +rndis_filter_device_add(), so VF will be registered later than netvsc +/ synthetic NIC, and gets a name numbered (ethX) after netvsc. + +Cc: stable@vger.kernel.org +Fixes: e04e7a7bbd4b ("hv_netvsc: Fix a deadlock by getting rtnl lock earlier in netvsc_probe()") +Reported-by: Dexuan Cui +Signed-off-by: Haiyang Zhang +Reviewed-by: Wojciech Drewek +Reviewed-by: Simon Horman +Reviewed-by: Dexuan Cui +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/hyperv/netvsc_drv.c | 25 +++++++++++++++---------- + 1 file changed, 15 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c +index 2104d57fb6576..790bf750281ad 100644 +--- a/drivers/net/hyperv/netvsc_drv.c ++++ b/drivers/net/hyperv/netvsc_drv.c +@@ -2528,15 +2528,6 @@ static int netvsc_probe(struct hv_device *dev, + goto devinfo_failed; + } + +- nvdev = rndis_filter_device_add(dev, device_info); +- if (IS_ERR(nvdev)) { +- ret = PTR_ERR(nvdev); +- netdev_err(net, "unable to add netvsc device (ret %d)\n", ret); +- goto rndis_failed; +- } +- +- memcpy(net->dev_addr, device_info->mac_adr, ETH_ALEN); +- + /* We must get rtnl lock before scheduling nvdev->subchan_work, + * otherwise netvsc_subchan_work() can get rtnl lock first and wait + * all subchannels to show up, but that may not happen because +@@ -2544,9 +2535,23 @@ static int netvsc_probe(struct hv_device *dev, + * -> ... -> device_add() -> ... -> __device_attach() can't get + * the device lock, so all the subchannels can't be processed -- + * finally netvsc_subchan_work() hangs forever. ++ * ++ * The rtnl lock also needs to be held before rndis_filter_device_add() ++ * which advertises nvsp_2_vsc_capability / sriov bit, and triggers ++ * VF NIC offering and registering. If VF NIC finished register_netdev() ++ * earlier it may cause name based config failure. + */ + rtnl_lock(); + ++ nvdev = rndis_filter_device_add(dev, device_info); ++ if (IS_ERR(nvdev)) { ++ ret = PTR_ERR(nvdev); ++ netdev_err(net, "unable to add netvsc device (ret %d)\n", ret); ++ goto rndis_failed; ++ } ++ ++ memcpy(net->dev_addr, device_info->mac_adr, ETH_ALEN); ++ + if (nvdev->num_chn > 1) + schedule_work(&nvdev->subchan_work); + +@@ -2580,9 +2585,9 @@ static int netvsc_probe(struct hv_device *dev, + return 0; + + register_failed: +- rtnl_unlock(); + rndis_filter_device_remove(dev, nvdev); + rndis_failed: ++ rtnl_unlock(); + netvsc_devinfo_put(device_info); + devinfo_failed: + free_percpu(net_device_ctx->vf_stats); +-- +2.42.0 + diff --git a/queue-5.10/ima-annotate-iint-mutex-to-avoid-lockdep-false-posit.patch b/queue-5.10/ima-annotate-iint-mutex-to-avoid-lockdep-false-posit.patch new file mode 100644 index 00000000000..4fc573e6f82 --- /dev/null +++ b/queue-5.10/ima-annotate-iint-mutex-to-avoid-lockdep-false-posit.patch @@ -0,0 +1,117 @@ +From ce2376ed0aaf2cb18bd22d46899c7760edcc4304 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Oct 2023 14:15:58 +0300 +Subject: ima: annotate iint mutex to avoid lockdep false positive warnings + +From: Amir Goldstein + +[ Upstream commit e044374a8a0a99e46f4e6d6751d3042b6d9cc12e ] + +It is not clear that IMA should be nested at all, but as long is it +measures files both on overlayfs and on underlying fs, we need to +annotate the iint mutex to avoid lockdep false positives related to +IMA + overlayfs, same as overlayfs annotates the inode mutex. + +Reported-and-tested-by: syzbot+b42fe626038981fb7bfa@syzkaller.appspotmail.com +Signed-off-by: Amir Goldstein +Cc: stable@vger.kernel.org +Signed-off-by: Mimi Zohar +Signed-off-by: Sasha Levin +--- + security/integrity/iint.c | 48 ++++++++++++++++++++++++++++++--------- + 1 file changed, 37 insertions(+), 11 deletions(-) + +diff --git a/security/integrity/iint.c b/security/integrity/iint.c +index 9ed2d5bfbed5e..b6e33ac70aef5 100644 +--- a/security/integrity/iint.c ++++ b/security/integrity/iint.c +@@ -66,9 +66,32 @@ struct integrity_iint_cache *integrity_iint_find(struct inode *inode) + return iint; + } + +-static void iint_free(struct integrity_iint_cache *iint) ++#define IMA_MAX_NESTING (FILESYSTEM_MAX_STACK_DEPTH+1) ++ ++/* ++ * It is not clear that IMA should be nested at all, but as long is it measures ++ * files both on overlayfs and on underlying fs, we need to annotate the iint ++ * mutex to avoid lockdep false positives related to IMA + overlayfs. ++ * See ovl_lockdep_annotate_inode_mutex_key() for more details. ++ */ ++static inline void iint_lockdep_annotate(struct integrity_iint_cache *iint, ++ struct inode *inode) ++{ ++#ifdef CONFIG_LOCKDEP ++ static struct lock_class_key iint_mutex_key[IMA_MAX_NESTING]; ++ ++ int depth = inode->i_sb->s_stack_depth; ++ ++ if (WARN_ON_ONCE(depth < 0 || depth >= IMA_MAX_NESTING)) ++ depth = 0; ++ ++ lockdep_set_class(&iint->mutex, &iint_mutex_key[depth]); ++#endif ++} ++ ++static void iint_init_always(struct integrity_iint_cache *iint, ++ struct inode *inode) + { +- kfree(iint->ima_hash); + iint->ima_hash = NULL; + iint->version = 0; + iint->flags = 0UL; +@@ -80,6 +103,14 @@ static void iint_free(struct integrity_iint_cache *iint) + iint->ima_creds_status = INTEGRITY_UNKNOWN; + iint->evm_status = INTEGRITY_UNKNOWN; + iint->measured_pcrs = 0; ++ mutex_init(&iint->mutex); ++ iint_lockdep_annotate(iint, inode); ++} ++ ++static void iint_free(struct integrity_iint_cache *iint) ++{ ++ kfree(iint->ima_hash); ++ mutex_destroy(&iint->mutex); + kmem_cache_free(iint_cache, iint); + } + +@@ -112,6 +143,8 @@ struct integrity_iint_cache *integrity_inode_get(struct inode *inode) + if (!iint) + return NULL; + ++ iint_init_always(iint, inode); ++ + write_lock(&integrity_iint_lock); + + p = &integrity_iint_tree.rb_node; +@@ -161,25 +194,18 @@ void integrity_inode_free(struct inode *inode) + iint_free(iint); + } + +-static void init_once(void *foo) ++static void iint_init_once(void *foo) + { + struct integrity_iint_cache *iint = foo; + + memset(iint, 0, sizeof(*iint)); +- iint->ima_file_status = INTEGRITY_UNKNOWN; +- iint->ima_mmap_status = INTEGRITY_UNKNOWN; +- iint->ima_bprm_status = INTEGRITY_UNKNOWN; +- iint->ima_read_status = INTEGRITY_UNKNOWN; +- iint->ima_creds_status = INTEGRITY_UNKNOWN; +- iint->evm_status = INTEGRITY_UNKNOWN; +- mutex_init(&iint->mutex); + } + + static int __init integrity_iintcache_init(void) + { + iint_cache = + kmem_cache_create("iint_cache", sizeof(struct integrity_iint_cache), +- 0, SLAB_PANIC, init_once); ++ 0, SLAB_PANIC, iint_init_once); + return 0; + } + DEFINE_LSM(integrity) = { +-- +2.42.0 + diff --git a/queue-5.10/ipv4-igmp-fix-refcnt-uaf-issue-when-receiving-igmp-q.patch b/queue-5.10/ipv4-igmp-fix-refcnt-uaf-issue-when-receiving-igmp-q.patch new file mode 100644 index 00000000000..96f764efab1 --- /dev/null +++ b/queue-5.10/ipv4-igmp-fix-refcnt-uaf-issue-when-receiving-igmp-q.patch @@ -0,0 +1,114 @@ +From 7cac1501805389ff61a6ae49ada58948a0565b2b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Nov 2023 15:13:14 +0800 +Subject: ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet + +From: Zhengchao Shao + +[ Upstream commit e2b706c691905fe78468c361aaabc719d0a496f1 ] + +When I perform the following test operations: +1.ip link add br0 type bridge +2.brctl addif br0 eth0 +3.ip addr add 239.0.0.1/32 dev eth0 +4.ip addr add 239.0.0.1/32 dev br0 +5.ip addr add 224.0.0.1/32 dev br0 +6.while ((1)) + do + ifconfig br0 up + ifconfig br0 down + done +7.send IGMPv2 query packets to port eth0 continuously. For example, +./mausezahn ethX -c 0 "01 00 5e 00 00 01 00 72 19 88 aa 02 08 00 45 00 00 +1c 00 01 00 00 01 02 0e 7f c0 a8 0a b7 e0 00 00 01 11 64 ee 9b 00 00 00 00" + +The preceding tests may trigger the refcnt uaf issue of the mc list. The +stack is as follows: + refcount_t: addition on 0; use-after-free. + WARNING: CPU: 21 PID: 144 at lib/refcount.c:25 refcount_warn_saturate (lib/refcount.c:25) + CPU: 21 PID: 144 Comm: ksoftirqd/21 Kdump: loaded Not tainted 6.7.0-rc1-next-20231117-dirty #80 + Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 + RIP: 0010:refcount_warn_saturate (lib/refcount.c:25) + RSP: 0018:ffffb68f00657910 EFLAGS: 00010286 + RAX: 0000000000000000 RBX: ffff8a00c3bf96c0 RCX: ffff8a07b6160908 + RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff8a07b6160900 + RBP: ffff8a00cba36862 R08: 0000000000000000 R09: 00000000ffff7fff + R10: ffffb68f006577c0 R11: ffffffffb0fdcdc8 R12: ffff8a00c3bf9680 + R13: ffff8a00c3bf96f0 R14: 0000000000000000 R15: ffff8a00d8766e00 + FS: 0000000000000000(0000) GS:ffff8a07b6140000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 000055f10b520b28 CR3: 000000039741a000 CR4: 00000000000006f0 + Call Trace: + + igmp_heard_query (net/ipv4/igmp.c:1068) + igmp_rcv (net/ipv4/igmp.c:1132) + ip_protocol_deliver_rcu (net/ipv4/ip_input.c:205) + ip_local_deliver_finish (net/ipv4/ip_input.c:234) + __netif_receive_skb_one_core (net/core/dev.c:5529) + netif_receive_skb_internal (net/core/dev.c:5729) + netif_receive_skb (net/core/dev.c:5788) + br_handle_frame_finish (net/bridge/br_input.c:216) + nf_hook_bridge_pre (net/bridge/br_input.c:294) + __netif_receive_skb_core (net/core/dev.c:5423) + __netif_receive_skb_list_core (net/core/dev.c:5606) + __netif_receive_skb_list (net/core/dev.c:5674) + netif_receive_skb_list_internal (net/core/dev.c:5764) + napi_gro_receive (net/core/gro.c:609) + e1000_clean_rx_irq (drivers/net/ethernet/intel/e1000/e1000_main.c:4467) + e1000_clean (drivers/net/ethernet/intel/e1000/e1000_main.c:3805) + __napi_poll (net/core/dev.c:6533) + net_rx_action (net/core/dev.c:6735) + __do_softirq (kernel/softirq.c:554) + run_ksoftirqd (kernel/softirq.c:913) + smpboot_thread_fn (kernel/smpboot.c:164) + kthread (kernel/kthread.c:388) + ret_from_fork (arch/x86/kernel/process.c:153) + ret_from_fork_asm (arch/x86/entry/entry_64.S:250) + + +The root causes are as follows: +Thread A Thread B +... netif_receive_skb +br_dev_stop ... + br_multicast_leave_snoopers ... + __ip_mc_dec_group ... + __igmp_group_dropped igmp_rcv + igmp_stop_timer igmp_heard_query //ref = 1 + ip_ma_put igmp_mod_timer + refcount_dec_and_test igmp_start_timer //ref = 0 + ... refcount_inc //ref increases from 0 +When the device receives an IGMPv2 Query message, it starts the timer +immediately, regardless of whether the device is running. If the device is +down and has left the multicast group, it will cause the mc list refcount +uaf issue. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Zhengchao Shao +Reviewed-by: Eric Dumazet +Reviewed-by: Hangbin Liu +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv4/igmp.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c +index 4cffdb9795ded..cb55fede03c04 100644 +--- a/net/ipv4/igmp.c ++++ b/net/ipv4/igmp.c +@@ -216,8 +216,10 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay) + int tv = prandom_u32() % max_delay; + + im->tm_running = 1; +- if (!mod_timer(&im->timer, jiffies+tv+2)) +- refcount_inc(&im->refcnt); ++ if (refcount_inc_not_zero(&im->refcnt)) { ++ if (mod_timer(&im->timer, jiffies + tv + 2)) ++ ip_ma_put(im); ++ } + } + + static void igmp_gq_start_timer(struct in_device *in_dev) +-- +2.42.0 + diff --git a/queue-5.10/misc-pci_endpoint_test-add-deviceid-for-am64-and-j72.patch b/queue-5.10/misc-pci_endpoint_test-add-deviceid-for-am64-and-j72.patch new file mode 100644 index 00000000000..4cb0e82c08e --- /dev/null +++ b/queue-5.10/misc-pci_endpoint_test-add-deviceid-for-am64-and-j72.patch @@ -0,0 +1,51 @@ +From 8cc92eb756ed37bc4fbe05e70cf08b1bc743c39c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Aug 2021 18:03:36 +0530 +Subject: misc: pci_endpoint_test: Add deviceID for AM64 and J7200 + +From: Kishon Vijay Abraham I + +[ Upstream commit 7c52009d94ab561e70cb72e007a6076f20451f85 ] + +Add device ID specific to AM64 and J7200 in pci_endpoint_test so that +endpoints configured with those deviceIDs can use pci_endpoint_test +driver. + +Link: https://lore.kernel.org/r/20210811123336.31357-6-kishon@ti.com +Signed-off-by: Kishon Vijay Abraham I +Signed-off-by: Lorenzo Pieralisi +Stable-dep-of: 8293703a492a ("misc: pci_endpoint_test: Add deviceID for J721S2 PCIe EP device support") +Signed-off-by: Sasha Levin +--- + drivers/misc/pci_endpoint_test.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c +index b4a07a166605a..9832c2966c110 100644 +--- a/drivers/misc/pci_endpoint_test.c ++++ b/drivers/misc/pci_endpoint_test.c +@@ -70,6 +70,8 @@ + + #define PCI_DEVICE_ID_TI_J721E 0xb00d + #define PCI_DEVICE_ID_TI_AM654 0xb00c ++#define PCI_DEVICE_ID_TI_J7200 0xb00f ++#define PCI_DEVICE_ID_TI_AM64 0xb010 + #define PCI_DEVICE_ID_LS1088A 0x80c0 + + #define is_am654_pci_dev(pdev) \ +@@ -1000,6 +1002,12 @@ static const struct pci_device_id pci_endpoint_test_tbl[] = { + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_J721E), + .driver_data = (kernel_ulong_t)&j721e_data, + }, ++ { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_J7200), ++ .driver_data = (kernel_ulong_t)&j721e_data, ++ }, ++ { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_AM64), ++ .driver_data = (kernel_ulong_t)&j721e_data, ++ }, + { } + }; + MODULE_DEVICE_TABLE(pci, pci_endpoint_test_tbl); +-- +2.42.0 + diff --git a/queue-5.10/misc-pci_endpoint_test-add-deviceid-for-j721s2-pcie-.patch b/queue-5.10/misc-pci_endpoint_test-add-deviceid-for-j721s2-pcie-.patch new file mode 100644 index 00000000000..ef247d5b2b2 --- /dev/null +++ b/queue-5.10/misc-pci_endpoint_test-add-deviceid-for-j721s2-pcie-.patch @@ -0,0 +1,48 @@ +From d86ba311a88b40ca322afd318e702c40b7110694 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Oct 2023 17:32:48 +0530 +Subject: misc: pci_endpoint_test: Add deviceID for J721S2 PCIe EP device + support + +From: Siddharth Vadapalli + +[ Upstream commit 8293703a492ae97c86af27c75b76e6239ec86483 ] + +Add DEVICE_ID for J721S2 and enable support for endpoints configured +with this DEVICE_ID in the pci_endpoint_test driver. + +Signed-off-by: Siddharth Vadapalli +Cc: stable +Reviewed-by: Manivannan Sadhasivam +Link: https://lore.kernel.org/r/20231020120248.3168406-1-s-vadapalli@ti.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/pci_endpoint_test.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c +index 9832c2966c110..cdb9a55a2c706 100644 +--- a/drivers/misc/pci_endpoint_test.c ++++ b/drivers/misc/pci_endpoint_test.c +@@ -72,6 +72,7 @@ + #define PCI_DEVICE_ID_TI_AM654 0xb00c + #define PCI_DEVICE_ID_TI_J7200 0xb00f + #define PCI_DEVICE_ID_TI_AM64 0xb010 ++#define PCI_DEVICE_ID_TI_J721S2 0xb013 + #define PCI_DEVICE_ID_LS1088A 0x80c0 + + #define is_am654_pci_dev(pdev) \ +@@ -1008,6 +1009,9 @@ static const struct pci_device_id pci_endpoint_test_tbl[] = { + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_AM64), + .driver_data = (kernel_ulong_t)&j721e_data, + }, ++ { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_J721S2), ++ .driver_data = (kernel_ulong_t)&j721e_data, ++ }, + { } + }; + MODULE_DEVICE_TABLE(pci, pci_endpoint_test_tbl); +-- +2.42.0 + diff --git a/queue-5.10/net-ravb-start-tx-queues-after-hw-initialization-suc.patch b/queue-5.10/net-ravb-start-tx-queues-after-hw-initialization-suc.patch new file mode 100644 index 00000000000..3f4c7501a89 --- /dev/null +++ b/queue-5.10/net-ravb-start-tx-queues-after-hw-initialization-suc.patch @@ -0,0 +1,46 @@ +From 6ff786ef816922f43ed217e445a5c3081f96cb38 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Nov 2023 10:04:37 +0200 +Subject: net: ravb: Start TX queues after HW initialization succeeded + +From: Claudiu Beznea + +[ Upstream commit 6f32c086602050fc11157adeafaa1c1eb393f0af ] + +ravb_phy_start() may fail. If that happens, the TX queues will remain +started. Thus, move the netif_tx_start_all_queues() after PHY is +successfully initialized. + +Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") +Reviewed-by: Sergey Shtylyov +Signed-off-by: Claudiu Beznea +Reviewed-by: Kalesh AP +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/ravb_main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c +index a9cd390dedbd8..f092f468016bd 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -1383,13 +1383,13 @@ static int ravb_open(struct net_device *ndev) + if (priv->chip_id == RCAR_GEN2) + ravb_ptp_init(ndev, priv->pdev); + +- netif_tx_start_all_queues(ndev); +- + /* PHY control start */ + error = ravb_phy_start(ndev); + if (error) + goto out_ptp_stop; + ++ netif_tx_start_all_queues(ndev); ++ + return 0; + + out_ptp_stop: +-- +2.42.0 + diff --git a/queue-5.10/net-ravb-use-pm_runtime_resume_and_get.patch b/queue-5.10/net-ravb-use-pm_runtime_resume_and_get.patch new file mode 100644 index 00000000000..612c45b8f43 --- /dev/null +++ b/queue-5.10/net-ravb-use-pm_runtime_resume_and_get.patch @@ -0,0 +1,48 @@ +From f5bfbbf1a217c6d6f6b611030ffc18b26895200c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Nov 2023 10:04:35 +0200 +Subject: net: ravb: Use pm_runtime_resume_and_get() + +From: Claudiu Beznea + +[ Upstream commit 88b74831faaee455c2af380382d979fc38e79270 ] + +pm_runtime_get_sync() may return an error. In case it returns with an error +dev->power.usage_count needs to be decremented. pm_runtime_resume_and_get() +takes care of this. Thus use it. + +Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") +Reviewed-by: Sergey Shtylyov +Signed-off-by: Claudiu Beznea +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/ravb_main.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c +index 9d4a35f006c68..a9cd390dedbd8 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -2072,7 +2072,9 @@ static int ravb_probe(struct platform_device *pdev) + ndev->hw_features = NETIF_F_RXCSUM; + + pm_runtime_enable(&pdev->dev); +- pm_runtime_get_sync(&pdev->dev); ++ error = pm_runtime_resume_and_get(&pdev->dev); ++ if (error < 0) ++ goto out_rpm_disable; + + /* The Ether-specific entries in the device structure. */ + ndev->base_addr = res->start; +@@ -2247,6 +2249,7 @@ static int ravb_probe(struct platform_device *pdev) + free_netdev(ndev); + + pm_runtime_put(&pdev->dev); ++out_rpm_disable: + pm_runtime_disable(&pdev->dev); + return error; + } +-- +2.42.0 + diff --git a/queue-5.10/net-stmmac-xgmac-disable-fpe-mmc-interrupts.patch b/queue-5.10/net-stmmac-xgmac-disable-fpe-mmc-interrupts.patch new file mode 100644 index 00000000000..40424973438 --- /dev/null +++ b/queue-5.10/net-stmmac-xgmac-disable-fpe-mmc-interrupts.patch @@ -0,0 +1,54 @@ +From fe323ec4679ae4f983cd811af2e8f9ba4973ae56 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 25 Nov 2023 14:01:26 +0800 +Subject: net: stmmac: xgmac: Disable FPE MMC interrupts + +From: Furong Xu <0x1207@gmail.com> + +[ Upstream commit e54d628a2721bfbb002c19f6e8ca6746cec7640f ] + +Commit aeb18dd07692 ("net: stmmac: xgmac: Disable MMC interrupts +by default") tries to disable MMC interrupts to avoid a storm of +unhandled interrupts, but leaves the FPE(Frame Preemption) MMC +interrupts enabled, FPE MMC interrupts can cause the same problem. +Now we mask FPE TX and RX interrupts to disable all MMC interrupts. + +Fixes: aeb18dd07692 ("net: stmmac: xgmac: Disable MMC interrupts by default") +Reviewed-by: Larysa Zaremba +Signed-off-by: Furong Xu <0x1207@gmail.com> +Reviewed-by: Serge Semin +Reviewed-by: Wojciech Drewek +Link: https://lore.kernel.org/r/20231125060126.2328690-1-0x1207@gmail.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/stmicro/stmmac/mmc_core.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c +index a57b0fa815aba..a510bac0b825b 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c ++++ b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c +@@ -177,8 +177,10 @@ + #define MMC_XGMAC_RX_DISCARD_OCT_GB 0x1b4 + #define MMC_XGMAC_RX_ALIGN_ERR_PKT 0x1bc + ++#define MMC_XGMAC_TX_FPE_INTR_MASK 0x204 + #define MMC_XGMAC_TX_FPE_FRAG 0x208 + #define MMC_XGMAC_TX_HOLD_REQ 0x20c ++#define MMC_XGMAC_RX_FPE_INTR_MASK 0x224 + #define MMC_XGMAC_RX_PKT_ASSEMBLY_ERR 0x228 + #define MMC_XGMAC_RX_PKT_SMD_ERR 0x22c + #define MMC_XGMAC_RX_PKT_ASSEMBLY_OK 0x230 +@@ -352,6 +354,8 @@ static void dwxgmac_mmc_intr_all_mask(void __iomem *mmcaddr) + { + writel(0x0, mmcaddr + MMC_RX_INTR_MASK); + writel(0x0, mmcaddr + MMC_TX_INTR_MASK); ++ writel(MMC_DEFAULT_MASK, mmcaddr + MMC_XGMAC_TX_FPE_INTR_MASK); ++ writel(MMC_DEFAULT_MASK, mmcaddr + MMC_XGMAC_RX_FPE_INTR_MASK); + writel(MMC_DEFAULT_MASK, mmcaddr + MMC_XGMAC_RX_IPC_INTR_MASK); + } + +-- +2.42.0 + diff --git a/queue-5.10/octeontx2-pf-fix-adding-mbox-work-queue-entry-when-n.patch b/queue-5.10/octeontx2-pf-fix-adding-mbox-work-queue-entry-when-n.patch new file mode 100644 index 00000000000..e60c70b7686 --- /dev/null +++ b/queue-5.10/octeontx2-pf-fix-adding-mbox-work-queue-entry-when-n.patch @@ -0,0 +1,51 @@ +From 3080ca3ff73ecccd97095f0096a773bc9735ce7d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 25 Nov 2023 22:04:02 +0530 +Subject: octeontx2-pf: Fix adding mbox work queue entry when num_vfs > 64 + +From: Geetha sowjanya + +[ Upstream commit 51597219e0cd5157401d4d0ccb5daa4d9961676f ] + +When more than 64 VFs are enabled for a PF then mbox communication +between VF and PF is not working as mbox work queueing for few VFs +are skipped due to wrong calculation of VF numbers. + +Fixes: d424b6c02415 ("octeontx2-pf: Enable SRIOV and added VF mbox handling") +Signed-off-by: Geetha sowjanya +Signed-off-by: Subbaraya Sundeep +Link: https://lore.kernel.org/r/1700930042-5400-1-git-send-email-sbhatta@marvell.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +index 000dd89c4baff..d6f7a2a58aee8 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +@@ -556,7 +556,9 @@ static irqreturn_t otx2_pfvf_mbox_intr_handler(int irq, void *pf_irq) + otx2_write64(pf, RVU_PF_VFPF_MBOX_INTX(1), intr); + otx2_queue_work(mbox, pf->mbox_pfvf_wq, 64, vfs, intr, + TYPE_PFVF); +- vfs -= 64; ++ if (intr) ++ trace_otx2_msg_interrupt(mbox->mbox.pdev, "VF(s) to PF", intr); ++ vfs = 64; + } + + intr = otx2_read64(pf, RVU_PF_VFPF_MBOX_INTX(0)); +@@ -564,7 +566,8 @@ static irqreturn_t otx2_pfvf_mbox_intr_handler(int irq, void *pf_irq) + + otx2_queue_work(mbox, pf->mbox_pfvf_wq, 0, vfs, intr, TYPE_PFVF); + +- trace_otx2_msg_interrupt(mbox->mbox.pdev, "VF(s) to PF", intr); ++ if (intr) ++ trace_otx2_msg_interrupt(mbox->mbox.pdev, "VF(s) to PF", intr); + + return IRQ_HANDLED; + } +-- +2.42.0 + diff --git a/queue-5.10/perf-intel-pt-adjust-sample-flags-for-vm-exit.patch b/queue-5.10/perf-intel-pt-adjust-sample-flags-for-vm-exit.patch new file mode 100644 index 00000000000..21d72a37d6d --- /dev/null +++ b/queue-5.10/perf-intel-pt-adjust-sample-flags-for-vm-exit.patch @@ -0,0 +1,54 @@ +From de73fe90b28cb61ad6d2117ad0d209523ccd04c2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 Feb 2021 11:57:59 +0200 +Subject: perf intel-pt: Adjust sample flags for VM-Exit + +From: Adrian Hunter + +[ Upstream commit 695fc4510615f8db40ebaf7a2c011f0a594b5f77 ] + +Use the change of NR to detect whether an asynchronous branch is a VM-Exit. + +Note VM-Entry is determined from the vmlaunch or vmresume instruction, +in which case, sample flags will show "VMentry" even if the VM-Entry fails. + +Signed-off-by: Adrian Hunter +Acked-by: Andi Kleen +Cc: Alexander Shishkin +Cc: Jiri Olsa +Link: https://lore.kernel.org/r/20210218095801.19576-10-adrian.hunter@intel.com +Signed-off-by: Arnaldo Carvalho de Melo +Stable-dep-of: f2d87895cbc4 ("perf intel-pt: Fix async branch flags") +Signed-off-by: Sasha Levin +--- + tools/perf/util/intel-pt.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c +index 453773ce6f455..918da9a430c08 100644 +--- a/tools/perf/util/intel-pt.c ++++ b/tools/perf/util/intel-pt.c +@@ -1137,13 +1137,16 @@ static void intel_pt_sample_flags(struct intel_pt_queue *ptq) + if (ptq->state->flags & INTEL_PT_ABORT_TX) { + ptq->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_TX_ABORT; + } else if (ptq->state->flags & INTEL_PT_ASYNC) { +- if (ptq->state->to_ip) ++ if (!ptq->state->to_ip) ++ ptq->flags = PERF_IP_FLAG_BRANCH | ++ PERF_IP_FLAG_TRACE_END; ++ else if (ptq->state->from_nr && !ptq->state->to_nr) ++ ptq->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL | ++ PERF_IP_FLAG_VMEXIT; ++ else + ptq->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL | + PERF_IP_FLAG_ASYNC | + PERF_IP_FLAG_INTERRUPT; +- else +- ptq->flags = PERF_IP_FLAG_BRANCH | +- PERF_IP_FLAG_TRACE_END; + ptq->insn_len = 0; + } else { + if (ptq->state->from_ip) +-- +2.42.0 + diff --git a/queue-5.10/perf-intel-pt-fix-async-branch-flags.patch b/queue-5.10/perf-intel-pt-fix-async-branch-flags.patch new file mode 100644 index 00000000000..939b8a5e30c --- /dev/null +++ b/queue-5.10/perf-intel-pt-fix-async-branch-flags.patch @@ -0,0 +1,42 @@ +From e16bcab90f7503209013ffa4c129b41b82d59fe8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Sep 2023 10:29:53 +0300 +Subject: perf intel-pt: Fix async branch flags + +From: Adrian Hunter + +[ Upstream commit f2d87895cbc4af80649850dcf5da36de6b2ed3dd ] + +Ensure PERF_IP_FLAG_ASYNC is set always for asynchronous branches (i.e. +interrupts etc). + +Fixes: 90e457f7be08 ("perf tools: Add Intel PT support") +Cc: stable@vger.kernel.org +Signed-off-by: Adrian Hunter +Acked-by: Namhyung Kim +Link: https://lore.kernel.org/r/20230928072953.19369-1-adrian.hunter@intel.com +Signed-off-by: Namhyung Kim +Signed-off-by: Sasha Levin +--- + tools/perf/util/intel-pt.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c +index 918da9a430c08..a4ea962e28d18 100644 +--- a/tools/perf/util/intel-pt.c ++++ b/tools/perf/util/intel-pt.c +@@ -1139,9 +1139,11 @@ static void intel_pt_sample_flags(struct intel_pt_queue *ptq) + } else if (ptq->state->flags & INTEL_PT_ASYNC) { + if (!ptq->state->to_ip) + ptq->flags = PERF_IP_FLAG_BRANCH | ++ PERF_IP_FLAG_ASYNC | + PERF_IP_FLAG_TRACE_END; + else if (ptq->state->from_nr && !ptq->state->to_nr) + ptq->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL | ++ PERF_IP_FLAG_ASYNC | + PERF_IP_FLAG_VMEXIT; + else + ptq->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL | +-- +2.42.0 + diff --git a/queue-5.10/r8169-prevent-potential-deadlock-in-rtl8169_close.patch b/queue-5.10/r8169-prevent-potential-deadlock-in-rtl8169_close.patch new file mode 100644 index 00000000000..c21ebc4c126 --- /dev/null +++ b/queue-5.10/r8169-prevent-potential-deadlock-in-rtl8169_close.patch @@ -0,0 +1,51 @@ +From 60c9ac4977373a8967a01362d410f0b5e98ee068 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 26 Nov 2023 23:01:02 +0100 +Subject: r8169: prevent potential deadlock in rtl8169_close + +From: Heiner Kallweit + +[ Upstream commit 91d3d149978ba7b238198dd80e4b823756aa7cfa ] + +ndo_stop() is RTNL-protected by net core, and the worker function takes +RTNL as well. Therefore we will deadlock when trying to execute a +pending work synchronously. To fix this execute any pending work +asynchronously. This will do no harm because netif_running() is false +in ndo_stop(), and therefore the work function is effectively a no-op. +However we have to ensure that no task is running or pending after +rtl_remove_one(), therefore add a call to cancel_work_sync(). + +Fixes: abe5fc42f9ce ("r8169: use RTNL to protect critical sections") +Signed-off-by: Heiner Kallweit +Link: https://lore.kernel.org/r/12395867-1d17-4cac-aa7d-c691938fcddf@gmail.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/realtek/r8169_main.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c +index ab6af1f1ad5bb..d33720f68c679 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -4769,7 +4769,7 @@ static int rtl8169_close(struct net_device *dev) + rtl8169_down(tp); + rtl8169_rx_clear(tp); + +- cancel_work_sync(&tp->wk.work); ++ cancel_work(&tp->wk.work); + + free_irq(pci_irq_vector(pdev, 0), tp); + +@@ -5035,6 +5035,8 @@ static void rtl_remove_one(struct pci_dev *pdev) + if (pci_dev_run_wake(pdev)) + pm_runtime_get_noresume(&pdev->dev); + ++ cancel_work_sync(&tp->wk.work); ++ + unregister_netdev(tp->dev); + + if (r8168_check_dash(tp)) +-- +2.42.0 + diff --git a/queue-5.10/ravb-fix-races-between-ravb_tx_timeout_work-and-net-.patch b/queue-5.10/ravb-fix-races-between-ravb_tx_timeout_work-and-net-.patch new file mode 100644 index 00000000000..8375e92dbf1 --- /dev/null +++ b/queue-5.10/ravb-fix-races-between-ravb_tx_timeout_work-and-net-.patch @@ -0,0 +1,79 @@ +From 96c86db6d4728f9b66b672339113f7e022f42aec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Nov 2023 21:24:20 +0900 +Subject: ravb: Fix races between ravb_tx_timeout_work() and net related ops + +From: Yoshihiro Shimoda + +[ Upstream commit 9870257a0a338cd8d6c1cddab74e703f490f6779 ] + +Fix races between ravb_tx_timeout_work() and functions of net_device_ops +and ethtool_ops by using rtnl_trylock() and rtnl_unlock(). Note that +since ravb_close() is under the rtnl lock and calls cancel_work_sync(), +ravb_tx_timeout_work() should calls rtnl_trylock(). Otherwise, a deadlock +may happen in ravb_tx_timeout_work() like below: + +CPU0 CPU1 + ravb_tx_timeout() + schedule_work() +... +__dev_close_many() +// Under rtnl lock +ravb_close() +cancel_work_sync() +// Waiting + ravb_tx_timeout_work() + rtnl_lock() + // This is possible to cause a deadlock + +If rtnl_trylock() fails, rescheduling the work with sleep for 1 msec. + +Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") +Signed-off-by: Yoshihiro Shimoda +Reviewed-by: Sergey Shtylyov +Link: https://lore.kernel.org/r/20231127122420.3706751-1-yoshihiro.shimoda.uh@renesas.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/ravb_main.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c +index f218bacec0013..9d4a35f006c68 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -1438,6 +1438,12 @@ static void ravb_tx_timeout_work(struct work_struct *work) + struct net_device *ndev = priv->ndev; + int error; + ++ if (!rtnl_trylock()) { ++ usleep_range(1000, 2000); ++ schedule_work(&priv->work); ++ return; ++ } ++ + netif_tx_stop_all_queues(ndev); + + /* Stop PTP Clock driver */ +@@ -1470,7 +1476,7 @@ static void ravb_tx_timeout_work(struct work_struct *work) + */ + netdev_err(ndev, "%s: ravb_dmac_init() failed, error %d\n", + __func__, error); +- return; ++ goto out_unlock; + } + ravb_emac_init(ndev); + +@@ -1480,6 +1486,9 @@ static void ravb_tx_timeout_work(struct work_struct *work) + ravb_ptp_init(ndev, priv->pdev); + + netif_tx_start_all_queues(ndev); ++ ++out_unlock: ++ rtnl_unlock(); + } + + /* Packet transmit function for Ethernet AVB */ +-- +2.42.0 + diff --git a/queue-5.10/revert-workqueue-remove-unused-cancel_work.patch b/queue-5.10/revert-workqueue-remove-unused-cancel_work.patch new file mode 100644 index 00000000000..1b188d62e6a --- /dev/null +++ b/queue-5.10/revert-workqueue-remove-unused-cancel_work.patch @@ -0,0 +1,64 @@ +From 86d721ba16ba8b0efb3aa9f2b94c54926edc09ed Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 May 2022 09:47:28 -0400 +Subject: Revert "workqueue: remove unused cancel_work()" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Andrey Grodzovsky + +[ Upstream commit 73b4b53276a1d6290cd4f47dbbc885b6e6e59ac6 ] + +This reverts commit 6417250d3f894e66a68ba1cd93676143f2376a6f. + +amdpgu need this function in order to prematurly stop pending +reset works when another reset work already in progress. + +Acked-by: Tejun Heo +Signed-off-by: Andrey Grodzovsky +Reviewed-by: Lai Jiangshan +Reviewed-by: Christian König +Signed-off-by: Alex Deucher +Stable-dep-of: 91d3d149978b ("r8169: prevent potential deadlock in rtl8169_close") +Signed-off-by: Sasha Levin +--- + include/linux/workqueue.h | 1 + + kernel/workqueue.c | 9 +++++++++ + 2 files changed, 10 insertions(+) + +diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h +index 460c58fa011ae..0383fac637e19 100644 +--- a/include/linux/workqueue.h ++++ b/include/linux/workqueue.h +@@ -460,6 +460,7 @@ extern int schedule_on_each_cpu(work_func_t func); + int execute_in_process_context(work_func_t fn, struct execute_work *); + + extern bool flush_work(struct work_struct *work); ++extern bool cancel_work(struct work_struct *work); + extern bool cancel_work_sync(struct work_struct *work); + + extern bool flush_delayed_work(struct delayed_work *dwork); +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index 37d01e44d4837..63140e4dd5dfc 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -3240,6 +3240,15 @@ static bool __cancel_work(struct work_struct *work, bool is_dwork) + return ret; + } + ++/* ++ * See cancel_delayed_work() ++ */ ++bool cancel_work(struct work_struct *work) ++{ ++ return __cancel_work(work, false); ++} ++EXPORT_SYMBOL(cancel_work); ++ + /** + * cancel_delayed_work - cancel a delayed work + * @dwork: delayed_work to cancel +-- +2.42.0 + diff --git a/queue-5.10/s390-cmma-fix-detection-of-dat-pages.patch b/queue-5.10/s390-cmma-fix-detection-of-dat-pages.patch new file mode 100644 index 00000000000..ee0211da01d --- /dev/null +++ b/queue-5.10/s390-cmma-fix-detection-of-dat-pages.patch @@ -0,0 +1,67 @@ +From a2756bafb53edef07c9bf9d1e3f127f029f1efd9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Oct 2023 10:15:19 +0200 +Subject: s390/cmma: fix detection of DAT pages + +From: Heiko Carstens + +[ Upstream commit 44d93045247661acbd50b1629e62f415f2747577 ] + +If the cmma no-dat feature is available the kernel page tables are walked +to identify and mark all pages which are used for address translation (all +region, segment, and page tables). In a subsequent loop all other pages are +marked as "no-dat" pages with the ESSA instruction. + +This information is visible to the hypervisor, so that the hypervisor can +optimize purging of guest TLB entries. The initial loop however is +incorrect: only the first three of the four pages which belong to segment +and region tables will be marked as being used for DAT. The last page is +incorrectly marked as no-dat. + +This can result in incorrect guest TLB flushes. + +Fix this by simply marking all four pages. + +Cc: +Reviewed-by: Claudio Imbrenda +Signed-off-by: Heiko Carstens +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/mm/page-states.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/s390/mm/page-states.c b/arch/s390/mm/page-states.c +index 7f0e154a470ad..4e5312fa2c539 100644 +--- a/arch/s390/mm/page-states.c ++++ b/arch/s390/mm/page-states.c +@@ -131,7 +131,7 @@ static void mark_kernel_pud(p4d_t *p4d, unsigned long addr, unsigned long end) + continue; + if (!pud_folded(*pud)) { + page = phys_to_page(pud_val(*pud)); +- for (i = 0; i < 3; i++) ++ for (i = 0; i < 4; i++) + set_bit(PG_arch_1, &page[i].flags); + } + mark_kernel_pmd(pud, addr, next); +@@ -152,7 +152,7 @@ static void mark_kernel_p4d(pgd_t *pgd, unsigned long addr, unsigned long end) + continue; + if (!p4d_folded(*p4d)) { + page = phys_to_page(p4d_val(*p4d)); +- for (i = 0; i < 3; i++) ++ for (i = 0; i < 4; i++) + set_bit(PG_arch_1, &page[i].flags); + } + mark_kernel_pud(p4d, addr, next); +@@ -174,7 +174,7 @@ static void mark_kernel_pgd(void) + continue; + if (!pgd_folded(*pgd)) { + page = phys_to_page(pgd_val(*pgd)); +- for (i = 0; i < 3; i++) ++ for (i = 0; i < 4; i++) + set_bit(PG_arch_1, &page[i].flags); + } + mark_kernel_p4d(pgd, addr, next); +-- +2.42.0 + diff --git a/queue-5.10/s390-mm-fix-phys-vs-virt-confusion-in-mark_kernel_px.patch b/queue-5.10/s390-mm-fix-phys-vs-virt-confusion-in-mark_kernel_px.patch new file mode 100644 index 00000000000..a4e48b45baa --- /dev/null +++ b/queue-5.10/s390-mm-fix-phys-vs-virt-confusion-in-mark_kernel_px.patch @@ -0,0 +1,65 @@ +From 73a259635eae4ca3a9680bf67f283638226d2f64 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Mar 2021 18:32:55 +0200 +Subject: s390/mm: fix phys vs virt confusion in mark_kernel_pXd() functions + family + +From: Alexander Gordeev + +[ Upstream commit 3784231b1e091857bd129fd9658a8b3cedbdcd58 ] + +Due to historical reasons mark_kernel_pXd() functions +misuse the notion of physical vs virtual addresses +difference. + +Signed-off-by: Alexander Gordeev +Signed-off-by: Heiko Carstens +Stable-dep-of: 44d930452476 ("s390/cmma: fix detection of DAT pages") +Signed-off-by: Sasha Levin +--- + arch/s390/mm/page-states.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/s390/mm/page-states.c b/arch/s390/mm/page-states.c +index 567c69f3069e7..7f0e154a470ad 100644 +--- a/arch/s390/mm/page-states.c ++++ b/arch/s390/mm/page-states.c +@@ -112,7 +112,7 @@ static void mark_kernel_pmd(pud_t *pud, unsigned long addr, unsigned long end) + next = pmd_addr_end(addr, end); + if (pmd_none(*pmd) || pmd_large(*pmd)) + continue; +- page = virt_to_page(pmd_val(*pmd)); ++ page = phys_to_page(pmd_val(*pmd)); + set_bit(PG_arch_1, &page->flags); + } while (pmd++, addr = next, addr != end); + } +@@ -130,7 +130,7 @@ static void mark_kernel_pud(p4d_t *p4d, unsigned long addr, unsigned long end) + if (pud_none(*pud) || pud_large(*pud)) + continue; + if (!pud_folded(*pud)) { +- page = virt_to_page(pud_val(*pud)); ++ page = phys_to_page(pud_val(*pud)); + for (i = 0; i < 3; i++) + set_bit(PG_arch_1, &page[i].flags); + } +@@ -151,7 +151,7 @@ static void mark_kernel_p4d(pgd_t *pgd, unsigned long addr, unsigned long end) + if (p4d_none(*p4d)) + continue; + if (!p4d_folded(*p4d)) { +- page = virt_to_page(p4d_val(*p4d)); ++ page = phys_to_page(p4d_val(*p4d)); + for (i = 0; i < 3; i++) + set_bit(PG_arch_1, &page[i].flags); + } +@@ -173,7 +173,7 @@ static void mark_kernel_pgd(void) + if (pgd_none(*pgd)) + continue; + if (!pgd_folded(*pgd)) { +- page = virt_to_page(pgd_val(*pgd)); ++ page = phys_to_page(pgd_val(*pgd)); + for (i = 0; i < 3; i++) + set_bit(PG_arch_1, &page[i].flags); + } +-- +2.42.0 + diff --git a/queue-5.10/scsi-core-introduce-the-scsi_cmd_to_rq-function.patch b/queue-5.10/scsi-core-introduce-the-scsi_cmd_to_rq-function.patch new file mode 100644 index 00000000000..3e2e6ce8445 --- /dev/null +++ b/queue-5.10/scsi-core-introduce-the-scsi_cmd_to_rq-function.patch @@ -0,0 +1,54 @@ +From 902f55d8546cd32d66d7fe0d93f5e254cb913801 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Aug 2021 16:03:04 -0700 +Subject: scsi: core: Introduce the scsi_cmd_to_rq() function + +From: Bart Van Assche + +[ Upstream commit 51f3a478892873337c54068d1185bcd797000a52 ] + +The 'request' member of struct scsi_cmnd is superfluous. The struct request +and struct scsi_cmnd data structures are adjacent and hence the request +pointer can be derived easily from a scsi_cmnd pointer. Introduce a helper +function that performs that conversion in a type-safe way. This patch is +the first step towards removing the request member from struct +scsi_cmnd. Making that change has the following advantages: + + - This is a performance optimization since adding an offset to a pointer + takes less time than dereferencing a pointer. + + - struct scsi_cmnd becomes smaller. + +Link: https://lore.kernel.org/r/20210809230355.8186-2-bvanassche@acm.org +Cc: Christoph Hellwig +Cc: Hannes Reinecke +Cc: Ming Lei +Reviewed-by: Hannes Reinecke +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +Stable-dep-of: 19597cad64d6 ("scsi: qla2xxx: Fix system crash due to bad pointer access") +Signed-off-by: Sasha Levin +--- + include/scsi/scsi_cmnd.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h +index 4d272e834ca2e..b1c9b52876f3c 100644 +--- a/include/scsi/scsi_cmnd.h ++++ b/include/scsi/scsi_cmnd.h +@@ -144,6 +144,12 @@ struct scsi_cmnd { + unsigned int extra_len; /* length of alignment and padding */ + }; + ++/* Variant of blk_mq_rq_from_pdu() that verifies the type of its argument. */ ++static inline struct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd) ++{ ++ return blk_mq_rq_from_pdu(scmd); ++} ++ + /* + * Return the driver private allocation behind the command. + * Only works if cmd_size is set in the host template. +-- +2.42.0 + diff --git a/queue-5.10/scsi-qla2xxx-fix-system-crash-due-to-bad-pointer-acc.patch b/queue-5.10/scsi-qla2xxx-fix-system-crash-due-to-bad-pointer-acc.patch new file mode 100644 index 00000000000..fb5401d08be --- /dev/null +++ b/queue-5.10/scsi-qla2xxx-fix-system-crash-due-to-bad-pointer-acc.patch @@ -0,0 +1,77 @@ +From bbb771cc2f32e9948ccc3610fd799ceee90d8b3d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Oct 2023 12:19:12 +0530 +Subject: scsi: qla2xxx: Fix system crash due to bad pointer access + +From: Quinn Tran + +[ Upstream commit 19597cad64d608aa8ac2f8aef50a50187a565223 ] + +User experiences system crash when running AER error injection. The +perturbation causes the abort-all-I/O path to trigger. The driver assumes +all I/O on this path is FCP only. If there is both NVMe & FCP traffic, a +system crash happens. Add additional check to see if I/O is FCP or not +before access. + +PID: 999019 TASK: ff35d769f24722c0 CPU: 53 COMMAND: "kworker/53:1" + 0 [ff3f78b964847b58] machine_kexec at ffffffffae86973d + 1 [ff3f78b964847ba8] __crash_kexec at ffffffffae9be29d + 2 [ff3f78b964847c70] crash_kexec at ffffffffae9bf528 + 3 [ff3f78b964847c78] oops_end at ffffffffae8282ab + 4 [ff3f78b964847c98] exc_page_fault at ffffffffaf2da502 + 5 [ff3f78b964847cc0] asm_exc_page_fault at ffffffffaf400b62 + [exception RIP: qla2x00_abort_srb+444] + RIP: ffffffffc07b5f8c RSP: ff3f78b964847d78 RFLAGS: 00010046 + RAX: 0000000000000282 RBX: ff35d74a0195a200 RCX: ff35d76886fd03a0 + RDX: 0000000000000001 RSI: ffffffffc07c5ec8 RDI: ff35d74a0195a200 + RBP: ff35d76913d22080 R8: ff35d7694d103200 R9: ff35d7694d103200 + R10: 0000000100000000 R11: ffffffffb05d6630 R12: 0000000000010000 + R13: ff3f78b964847df8 R14: ff35d768d8754000 R15: ff35d768877248e0 + ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 + 6 [ff3f78b964847d70] qla2x00_abort_srb at ffffffffc07b5f84 [qla2xxx] + 7 [ff3f78b964847de0] __qla2x00_abort_all_cmds at ffffffffc07b6238 [qla2xxx] + 8 [ff3f78b964847e38] qla2x00_abort_all_cmds at ffffffffc07ba635 [qla2xxx] + 9 [ff3f78b964847e58] qla2x00_terminate_rport_io at ffffffffc08145eb [qla2xxx] +10 [ff3f78b964847e70] fc_terminate_rport_io at ffffffffc045987e [scsi_transport_fc] +11 [ff3f78b964847e88] process_one_work at ffffffffae914f15 +12 [ff3f78b964847ed0] worker_thread at ffffffffae9154c0 +13 [ff3f78b964847f10] kthread at ffffffffae91c456 +14 [ff3f78b964847f50] ret_from_fork at ffffffffae8036ef + +Cc: stable@vger.kernel.org +Fixes: f45bca8c5052 ("scsi: qla2xxx: Fix double scsi_done for abort path") +Signed-off-by: Quinn Tran +Signed-off-by: Nilesh Javali +Link: https://lore.kernel.org/r/20231030064912.37912-1-njavali@marvell.com +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qla2xxx/qla_os.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c +index 136522a1c7281..0930bf996cd30 100644 +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -1714,8 +1714,16 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res, + } + + spin_lock_irqsave(qp->qp_lock_ptr, *flags); +- if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd))) +- sp->done(sp, res); ++ switch (sp->type) { ++ case SRB_SCSI_CMD: ++ if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd))) ++ sp->done(sp, res); ++ break; ++ default: ++ if (ret_cmd) ++ sp->done(sp, res); ++ break; ++ } + } else { + sp->done(sp, res); + } +-- +2.42.0 + diff --git a/queue-5.10/scsi-qla2xxx-use-scsi_cmd_to_rq-instead-of-scsi_cmnd.patch b/queue-5.10/scsi-qla2xxx-use-scsi_cmd_to_rq-instead-of-scsi_cmnd.patch new file mode 100644 index 00000000000..696a042796d --- /dev/null +++ b/queue-5.10/scsi-qla2xxx-use-scsi_cmd_to_rq-instead-of-scsi_cmnd.patch @@ -0,0 +1,46 @@ +From fdf58f02e2ddacf51d38b42e3e339eabb6a6f587 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Aug 2021 16:03:41 -0700 +Subject: scsi: qla2xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request + +From: Bart Van Assche + +[ Upstream commit c7d6b2c2cd5656b05849afb0de3f422da1742d0f ] + +Prepare for removal of the request pointer by using scsi_cmd_to_rq() +instead. This patch does not change any functionality. + +Link: https://lore.kernel.org/r/20210809230355.8186-39-bvanassche@acm.org +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +Stable-dep-of: 19597cad64d6 ("scsi: qla2xxx: Fix system crash due to bad pointer access") +Signed-off-by: Sasha Levin +--- + drivers/scsi/qla2xxx/qla_os.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c +index 8d199deaf3b12..136522a1c7281 100644 +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -839,7 +839,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) + uint16_t hwq; + struct qla_qpair *qpair = NULL; + +- tag = blk_mq_unique_tag(cmd->request); ++ tag = blk_mq_unique_tag(scsi_cmd_to_rq(cmd)); + hwq = blk_mq_unique_tag_to_hwq(tag); + qpair = ha->queue_pair_map[hwq]; + +@@ -1714,7 +1714,7 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res, + } + + spin_lock_irqsave(qp->qp_lock_ptr, *flags); +- if (ret_cmd && blk_mq_request_started(cmd->request)) ++ if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd))) + sp->done(sp, res); + } else { + sp->done(sp, res); +-- +2.42.0 + diff --git a/queue-5.10/selftests-net-ipsec-fix-constant-out-of-range.patch b/queue-5.10/selftests-net-ipsec-fix-constant-out-of-range.patch new file mode 100644 index 00000000000..56b4eaac7e9 --- /dev/null +++ b/queue-5.10/selftests-net-ipsec-fix-constant-out-of-range.patch @@ -0,0 +1,56 @@ +From 696928b404022b278bfe8a66378f0c94788e35f4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Nov 2023 12:15:19 -0500 +Subject: selftests/net: ipsec: fix constant out of range + +From: Willem de Bruijn + +[ Upstream commit 088559815477c6f623a5db5993491ddd7facbec7 ] + +Fix a small compiler warning. + +nr_process must be a signed long: it is assigned a signed long by +strtol() and is compared against LONG_MIN and LONG_MAX. + +ipsec.c:2280:65: + error: result of comparison of constant -9223372036854775808 + with expression of type 'unsigned int' is always false + [-Werror,-Wtautological-constant-out-of-range-compare] + + if ((errno == ERANGE && (nr_process == LONG_MAX || nr_process == LONG_MIN)) + +Fixes: bc2652b7ae1e ("selftest/net/xfrm: Add test for ipsec tunnel") +Signed-off-by: Willem de Bruijn +Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com> +Link: https://lore.kernel.org/r/20231124171645.1011043-2-willemdebruijn.kernel@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/ipsec.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/testing/selftests/net/ipsec.c b/tools/testing/selftests/net/ipsec.c +index 17ced7d6ce259..03b048b668315 100644 +--- a/tools/testing/selftests/net/ipsec.c ++++ b/tools/testing/selftests/net/ipsec.c +@@ -2117,7 +2117,7 @@ static int check_results(void) + + int main(int argc, char **argv) + { +- unsigned int nr_process = 1; ++ long nr_process = 1; + int route_sock = -1, ret = KSFT_SKIP; + int test_desc_fd[2]; + uint32_t route_seq; +@@ -2138,7 +2138,7 @@ int main(int argc, char **argv) + exit_usage(argv); + } + +- if (nr_process > MAX_PROCESSES || !nr_process) { ++ if (nr_process > MAX_PROCESSES || nr_process < 1) { + printk("nr_process should be between [1; %u]", + MAX_PROCESSES); + exit_usage(argv); +-- +2.42.0 + diff --git a/queue-5.10/selftests-net-mptcp-fix-uninitialized-variable-warni.patch b/queue-5.10/selftests-net-mptcp-fix-uninitialized-variable-warni.patch new file mode 100644 index 00000000000..a5bd61c300d --- /dev/null +++ b/queue-5.10/selftests-net-mptcp-fix-uninitialized-variable-warni.patch @@ -0,0 +1,78 @@ +From 14fc3eb027d5fdc7bb85826ace30faadd9923d6d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Nov 2023 12:15:22 -0500 +Subject: selftests/net: mptcp: fix uninitialized variable warnings + +From: Willem de Bruijn + +[ Upstream commit 00a4f8fd9c750f20d8fd4535c71c9caa7ef5ff2f ] + +Same init_rng() in both tests. The function reads /dev/urandom to +initialize srand(). In case of failure, it falls back onto the +entropy in the uninitialized variable. Not sure if this is on purpose. +But failure reading urandom should be rare, so just fail hard. While +at it, convert to getrandom(). Which man 4 random suggests is simpler +and more robust. + + mptcp_inq.c:525:6: + mptcp_connect.c:1131:6: + + error: variable 'foo' is used uninitialized + whenever 'if' condition is false + [-Werror,-Wsometimes-uninitialized] + +Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp") +Fixes: b51880568f20 ("selftests: mptcp: add inq test case") +Cc: Florian Westphal +Signed-off-by: Willem de Bruijn + +---- + +When input is randomized because this is expected to meaningfully +explore edge cases, should we also add +1. logging the random seed to stdout and +2. adding a command line argument to replay from a specific seed +I can do this in net-next, if authors find it useful in this case. +Reviewed-by: Matthieu Baerts + +Link: https://lore.kernel.org/r/20231124171645.1011043-5-willemdebruijn.kernel@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/mptcp/mptcp_connect.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c +index 77bb62feb8726..37c1ec888ba2e 100644 +--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c ++++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c +@@ -15,6 +15,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -734,15 +735,11 @@ int main_loop_s(int listensock) + + static void init_rng(void) + { +- int fd = open("/dev/urandom", O_RDONLY); + unsigned int foo; + +- if (fd > 0) { +- int ret = read(fd, &foo, sizeof(foo)); +- +- if (ret < 0) +- srand(fd + foo); +- close(fd); ++ if (getrandom(&foo, sizeof(foo), 0) == -1) { ++ perror("getrandom"); ++ exit(1); + } + + srand(foo); +-- +2.42.0 + diff --git a/queue-5.10/series b/queue-5.10/series index 1c060b4f046..bb84d545efa 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -86,3 +86,43 @@ btrfs-fix-off-by-one-when-checking-chunk-map-includes-logical-address.patch btrfs-send-ensure-send_fd-is-writable.patch btrfs-make-error-messages-more-clear-when-getting-a-chunk-map.patch input-xpad-add-hyperx-clutch-gladiate-support.patch +hv_netvsc-fix-race-of-netvsc-and-vf-register_netdevi.patch +usb-core-change-configuration-warnings-to-notices.patch +usb-config-fix-iteration-issue-in-usb_get_bos_descri.patch +ipv4-igmp-fix-refcnt-uaf-issue-when-receiving-igmp-q.patch +dpaa2-eth-increase-the-needed-headroom-to-account-fo.patch +selftests-net-ipsec-fix-constant-out-of-range.patch +selftests-net-mptcp-fix-uninitialized-variable-warni.patch +net-stmmac-xgmac-disable-fpe-mmc-interrupts.patch +octeontx2-pf-fix-adding-mbox-work-queue-entry-when-n.patch +revert-workqueue-remove-unused-cancel_work.patch +r8169-prevent-potential-deadlock-in-rtl8169_close.patch +ravb-fix-races-between-ravb_tx_timeout_work-and-net-.patch +net-ravb-use-pm_runtime_resume_and_get.patch +net-ravb-start-tx-queues-after-hw-initialization-suc.patch +perf-intel-pt-adjust-sample-flags-for-vm-exit.patch +perf-intel-pt-fix-async-branch-flags.patch +ext4-improve-write-performance-with-disabled-delallo.patch +ext4-mark-buffer-new-if-it-is-unwritten-to-avoid-sta.patch +smb3-fix-touch-h-of-symlink.patch +asoc-intel-move-soc_intel_is_foo-helpers-to-a-generi.patch +asoc-sof-sof-pci-dev-use-community-key-on-all-up-boa.patch +asoc-sof-sof-pci-dev-add-parameter-to-override-topol.patch +asoc-sof-sof-pci-dev-don-t-use-the-community-key-on-.patch +asoc-sof-sof-pci-dev-fix-community-key-quirk-detecti.patch +s390-mm-fix-phys-vs-virt-confusion-in-mark_kernel_px.patch +s390-cmma-fix-detection-of-dat-pages.patch +misc-pci_endpoint_test-add-deviceid-for-am64-and-j72.patch +misc-pci_endpoint_test-add-deviceid-for-j721s2-pcie-.patch +fbdev-stifb-make-the-sti-next-font-pointer-a-32-bit-.patch +ima-annotate-iint-mutex-to-avoid-lockdep-false-posit.patch +ext4-properly-sync-file-size-update-after-o_sync-dir.patch +driver-core-move-the-removable-attribute-from-usb-to.patch +drm-amdgpu-don-t-use-atrm-for-external-devices.patch +fs-add-ctime-accessors-infrastructure.patch +smb3-fix-caching-of-ctime-on-setxattr.patch +scsi-core-introduce-the-scsi_cmd_to_rq-function.patch +scsi-qla2xxx-use-scsi_cmd_to_rq-instead-of-scsi_cmnd.patch +scsi-qla2xxx-fix-system-crash-due-to-bad-pointer-acc.patch +cpufreq-imx6q-don-t-warn-for-disabling-a-non-existin.patch +cpufreq-imx6q-don-t-disable-792-mhz-opp-unnecessaril.patch diff --git a/queue-5.10/smb3-fix-caching-of-ctime-on-setxattr.patch b/queue-5.10/smb3-fix-caching-of-ctime-on-setxattr.patch new file mode 100644 index 00000000000..ce47d508e1a --- /dev/null +++ b/queue-5.10/smb3-fix-caching-of-ctime-on-setxattr.patch @@ -0,0 +1,43 @@ +From 836b5968aa2dc6ebd5130cf2a0e3b7cdfbcd2408 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Nov 2023 21:38:13 -0600 +Subject: smb3: fix caching of ctime on setxattr + +From: Steve French + +[ Upstream commit 5923d6686a100c2b4cabd4c2ca9d5a12579c7614 ] + +Fixes xfstest generic/728 which had been failing due to incorrect +ctime after setxattr and removexattr + +Update ctime on successful set of xattr + +Cc: stable@vger.kernel.org +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/cifs/xattr.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c +index b8299173ea7e3..c6931eab3f97e 100644 +--- a/fs/cifs/xattr.c ++++ b/fs/cifs/xattr.c +@@ -157,10 +157,13 @@ static int cifs_xattr_set(const struct xattr_handler *handler, + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) + goto out; + +- if (pTcon->ses->server->ops->set_EA) ++ if (pTcon->ses->server->ops->set_EA) { + rc = pTcon->ses->server->ops->set_EA(xid, pTcon, + full_path, name, value, (__u16)size, + cifs_sb->local_nls, cifs_sb); ++ if (rc == 0) ++ inode_set_ctime_current(inode); ++ } + break; + + case XATTR_CIFS_ACL: +-- +2.42.0 + diff --git a/queue-5.10/smb3-fix-touch-h-of-symlink.patch b/queue-5.10/smb3-fix-touch-h-of-symlink.patch new file mode 100644 index 00000000000..6e497199654 --- /dev/null +++ b/queue-5.10/smb3-fix-touch-h-of-symlink.patch @@ -0,0 +1,40 @@ +From b28ce71ebf50adb14da41c42606a3c9235abcb96 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Oct 2023 12:18:23 -0500 +Subject: smb3: fix touch -h of symlink + +From: Steve French + +[ Upstream commit 475efd9808a3094944a56240b2711349e433fb66 ] + +For example: + touch -h -t 02011200 testfile +where testfile is a symlink would not change the timestamp, but + touch -t 02011200 testfile +does work to change the timestamp of the target + +Suggested-by: David Howells +Reported-by: Micah Veilleux +Closes: https://bugzilla.samba.org/show_bug.cgi?id=14476 +Cc: stable@vger.kernel.org +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/cifs/cifsfs.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c +index 0d8d7b57636f7..b87d6792b14ad 100644 +--- a/fs/cifs/cifsfs.c ++++ b/fs/cifs/cifsfs.c +@@ -1076,6 +1076,7 @@ const struct inode_operations cifs_file_inode_ops = { + + const struct inode_operations cifs_symlink_inode_ops = { + .get_link = cifs_get_link, ++ .setattr = cifs_setattr, + .permission = cifs_permission, + .listxattr = cifs_listxattr, + }; +-- +2.42.0 + diff --git a/queue-5.10/usb-config-fix-iteration-issue-in-usb_get_bos_descri.patch b/queue-5.10/usb-config-fix-iteration-issue-in-usb_get_bos_descri.patch new file mode 100644 index 00000000000..5c3cec008be --- /dev/null +++ b/queue-5.10/usb-config-fix-iteration-issue-in-usb_get_bos_descri.patch @@ -0,0 +1,57 @@ +From 296faafe59e3b705184d4b31bb9f5237b6deec25 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Nov 2023 14:13:25 +0200 +Subject: usb: config: fix iteration issue in 'usb_get_bos_descriptor()' + +From: Niklas Neronin + +[ Upstream commit 974bba5c118f4c2baf00de0356e3e4f7928b4cbc ] + +The BOS descriptor defines a root descriptor and is the base descriptor for +accessing a family of related descriptors. + +Function 'usb_get_bos_descriptor()' encounters an iteration issue when +skipping the 'USB_DT_DEVICE_CAPABILITY' descriptor type. This results in +the same descriptor being read repeatedly. + +To address this issue, a 'goto' statement is introduced to ensure that the +pointer and the amount read is updated correctly. This ensures that the +function iterates to the next descriptor instead of reading the same +descriptor repeatedly. + +Cc: stable@vger.kernel.org +Fixes: 3dd550a2d365 ("USB: usbcore: Fix slab-out-of-bounds bug during device reset") +Signed-off-by: Niklas Neronin +Acked-by: Mathias Nyman +Reviewed-by: Alan Stern +Link: https://lore.kernel.org/r/20231115121325.471454-1-niklas.neronin@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/core/config.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c +index 1e40e63d301bd..2f8a1225b6976 100644 +--- a/drivers/usb/core/config.c ++++ b/drivers/usb/core/config.c +@@ -1047,7 +1047,7 @@ int usb_get_bos_descriptor(struct usb_device *dev) + + if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) { + dev_notice(ddev, "descriptor type invalid, skip\n"); +- continue; ++ goto skip_to_next_descriptor; + } + + switch (cap_type) { +@@ -1080,6 +1080,7 @@ int usb_get_bos_descriptor(struct usb_device *dev) + break; + } + ++skip_to_next_descriptor: + total_len -= length; + buffer += length; + } +-- +2.42.0 + diff --git a/queue-5.10/usb-core-change-configuration-warnings-to-notices.patch b/queue-5.10/usb-core-change-configuration-warnings-to-notices.patch new file mode 100644 index 00000000000..78f4dec976c --- /dev/null +++ b/queue-5.10/usb-core-change-configuration-warnings-to-notices.patch @@ -0,0 +1,401 @@ +From be1c34523d785c206e0dd6ebeca7ff0d0f09f8bc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 2 Nov 2022 14:13:19 -0400 +Subject: USB: core: Change configuration warnings to notices + +From: Alan Stern + +[ Upstream commit 7a09c1269702db8eccb6f718da2b00173e1e0034 ] + +It has been pointed out that the kernel log messages warning about +problems in USB configuration and related descriptors are vexing for +users. The warning log level has a fairly high priority, but the user +can do nothing to fix the underlying errors in the device's firmware. + +To reduce the amount of useless information produced by tools that +filter high-priority log messages, we can change these warnings to +notices, i.e., change dev_warn() to dev_notice(). The same holds for +a few messages that currently use dev_err(): Unless they indicate a +failure that might make a device unusable (such as inability to +transfer a config descriptor), change them to dev_notice() also. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=216630 +Suggested-by: Artem S. Tashkinov +Signed-off-by: Alan Stern +Link: https://lore.kernel.org/r/Y2KzPx0h6z1jXCuN@rowland.harvard.edu +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 974bba5c118f ("usb: config: fix iteration issue in 'usb_get_bos_descriptor()'") +Signed-off-by: Sasha Levin +--- + drivers/usb/core/config.c | 82 +++++++++++++++++++-------------------- + 1 file changed, 41 insertions(+), 41 deletions(-) + +diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c +index 39f1eca60a714..1e40e63d301bd 100644 +--- a/drivers/usb/core/config.c ++++ b/drivers/usb/core/config.c +@@ -61,7 +61,7 @@ static void usb_parse_ssp_isoc_endpoint_companion(struct device *ddev, + desc = (struct usb_ssp_isoc_ep_comp_descriptor *) buffer; + if (desc->bDescriptorType != USB_DT_SSP_ISOC_ENDPOINT_COMP || + size < USB_DT_SSP_ISOC_EP_COMP_SIZE) { +- dev_warn(ddev, "Invalid SuperSpeedPlus isoc endpoint companion" ++ dev_notice(ddev, "Invalid SuperSpeedPlus isoc endpoint companion" + "for config %d interface %d altsetting %d ep %d.\n", + cfgno, inum, asnum, ep->desc.bEndpointAddress); + return; +@@ -83,7 +83,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, + + if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP || + size < USB_DT_SS_EP_COMP_SIZE) { +- dev_warn(ddev, "No SuperSpeed endpoint companion for config %d " ++ dev_notice(ddev, "No SuperSpeed endpoint companion for config %d " + " interface %d altsetting %d ep %d: " + "using minimum values\n", + cfgno, inum, asnum, ep->desc.bEndpointAddress); +@@ -109,13 +109,13 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, + + /* Check the various values */ + if (usb_endpoint_xfer_control(&ep->desc) && desc->bMaxBurst != 0) { +- dev_warn(ddev, "Control endpoint with bMaxBurst = %d in " ++ dev_notice(ddev, "Control endpoint with bMaxBurst = %d in " + "config %d interface %d altsetting %d ep %d: " + "setting to zero\n", desc->bMaxBurst, + cfgno, inum, asnum, ep->desc.bEndpointAddress); + ep->ss_ep_comp.bMaxBurst = 0; + } else if (desc->bMaxBurst > 15) { +- dev_warn(ddev, "Endpoint with bMaxBurst = %d in " ++ dev_notice(ddev, "Endpoint with bMaxBurst = %d in " + "config %d interface %d altsetting %d ep %d: " + "setting to 15\n", desc->bMaxBurst, + cfgno, inum, asnum, ep->desc.bEndpointAddress); +@@ -125,7 +125,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, + if ((usb_endpoint_xfer_control(&ep->desc) || + usb_endpoint_xfer_int(&ep->desc)) && + desc->bmAttributes != 0) { +- dev_warn(ddev, "%s endpoint with bmAttributes = %d in " ++ dev_notice(ddev, "%s endpoint with bmAttributes = %d in " + "config %d interface %d altsetting %d ep %d: " + "setting to zero\n", + usb_endpoint_xfer_control(&ep->desc) ? "Control" : "Bulk", +@@ -134,7 +134,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, + ep->ss_ep_comp.bmAttributes = 0; + } else if (usb_endpoint_xfer_bulk(&ep->desc) && + desc->bmAttributes > 16) { +- dev_warn(ddev, "Bulk endpoint with more than 65536 streams in " ++ dev_notice(ddev, "Bulk endpoint with more than 65536 streams in " + "config %d interface %d altsetting %d ep %d: " + "setting to max\n", + cfgno, inum, asnum, ep->desc.bEndpointAddress); +@@ -142,7 +142,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, + } else if (usb_endpoint_xfer_isoc(&ep->desc) && + !USB_SS_SSP_ISOC_COMP(desc->bmAttributes) && + USB_SS_MULT(desc->bmAttributes) > 3) { +- dev_warn(ddev, "Isoc endpoint has Mult of %d in " ++ dev_notice(ddev, "Isoc endpoint has Mult of %d in " + "config %d interface %d altsetting %d ep %d: " + "setting to 3\n", + USB_SS_MULT(desc->bmAttributes), +@@ -160,7 +160,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, + else + max_tx = 999999; + if (le16_to_cpu(desc->wBytesPerInterval) > max_tx) { +- dev_warn(ddev, "%s endpoint with wBytesPerInterval of %d in " ++ dev_notice(ddev, "%s endpoint with wBytesPerInterval of %d in " + "config %d interface %d altsetting %d ep %d: " + "setting to %d\n", + usb_endpoint_xfer_isoc(&ep->desc) ? "Isoc" : "Int", +@@ -273,7 +273,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, + else if (d->bLength >= USB_DT_ENDPOINT_SIZE) + n = USB_DT_ENDPOINT_SIZE; + else { +- dev_warn(ddev, "config %d interface %d altsetting %d has an " ++ dev_notice(ddev, "config %d interface %d altsetting %d has an " + "invalid endpoint descriptor of length %d, skipping\n", + cfgno, inum, asnum, d->bLength); + goto skip_to_next_endpoint_or_interface_descriptor; +@@ -281,7 +281,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, + + i = d->bEndpointAddress & ~USB_ENDPOINT_DIR_MASK; + if (i >= 16 || i == 0) { +- dev_warn(ddev, "config %d interface %d altsetting %d has an " ++ dev_notice(ddev, "config %d interface %d altsetting %d has an " + "invalid endpoint with address 0x%X, skipping\n", + cfgno, inum, asnum, d->bEndpointAddress); + goto skip_to_next_endpoint_or_interface_descriptor; +@@ -293,7 +293,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, + + /* Check for duplicate endpoint addresses */ + if (config_endpoint_is_duplicate(config, inum, asnum, d)) { +- dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", ++ dev_notice(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", + cfgno, inum, asnum, d->bEndpointAddress); + goto skip_to_next_endpoint_or_interface_descriptor; + } +@@ -301,7 +301,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, + /* Ignore some endpoints */ + if (udev->quirks & USB_QUIRK_ENDPOINT_IGNORE) { + if (usb_endpoint_is_ignored(udev, ifp, d)) { +- dev_warn(ddev, "config %d interface %d altsetting %d has an ignored endpoint with address 0x%X, skipping\n", ++ dev_notice(ddev, "config %d interface %d altsetting %d has an ignored endpoint with address 0x%X, skipping\n", + cfgno, inum, asnum, + d->bEndpointAddress); + goto skip_to_next_endpoint_or_interface_descriptor; +@@ -378,7 +378,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, + } + } + if (d->bInterval < i || d->bInterval > j) { +- dev_warn(ddev, "config %d interface %d altsetting %d " ++ dev_notice(ddev, "config %d interface %d altsetting %d " + "endpoint 0x%X has an invalid bInterval %d, " + "changing to %d\n", + cfgno, inum, asnum, +@@ -391,7 +391,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, + * them usable, we will try treating them as Interrupt endpoints. + */ + if (udev->speed == USB_SPEED_LOW && usb_endpoint_xfer_bulk(d)) { +- dev_warn(ddev, "config %d interface %d altsetting %d " ++ dev_notice(ddev, "config %d interface %d altsetting %d " + "endpoint 0x%X is Bulk; changing to Interrupt\n", + cfgno, inum, asnum, d->bEndpointAddress); + endpoint->desc.bmAttributes = USB_ENDPOINT_XFER_INT; +@@ -408,7 +408,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, + */ + maxp = le16_to_cpu(endpoint->desc.wMaxPacketSize); + if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) { +- dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", ++ dev_notice(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", + cfgno, inum, asnum, d->bEndpointAddress); + } + +@@ -439,7 +439,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, + j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)]; + + if (maxp > j) { +- dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n", ++ dev_notice(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n", + cfgno, inum, asnum, d->bEndpointAddress, maxp, j); + maxp = j; + endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp); +@@ -452,7 +452,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, + */ + if (udev->speed == USB_SPEED_HIGH && usb_endpoint_xfer_bulk(d)) { + if (maxp != 512) +- dev_warn(ddev, "config %d interface %d altsetting %d " ++ dev_notice(ddev, "config %d interface %d altsetting %d " + "bulk endpoint 0x%X has invalid maxpacket %d\n", + cfgno, inum, asnum, d->bEndpointAddress, + maxp); +@@ -533,7 +533,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno, + i < intfc->num_altsetting; + (++i, ++alt)) { + if (alt->desc.bAlternateSetting == asnum) { +- dev_warn(ddev, "Duplicate descriptor for config %d " ++ dev_notice(ddev, "Duplicate descriptor for config %d " + "interface %d altsetting %d, skipping\n", + cfgno, inum, asnum); + goto skip_to_next_interface_descriptor; +@@ -559,7 +559,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno, + num_ep = num_ep_orig = alt->desc.bNumEndpoints; + alt->desc.bNumEndpoints = 0; /* Use as a counter */ + if (num_ep > USB_MAXENDPOINTS) { +- dev_warn(ddev, "too many endpoints for config %d interface %d " ++ dev_notice(ddev, "too many endpoints for config %d interface %d " + "altsetting %d: %d, using maximum allowed: %d\n", + cfgno, inum, asnum, num_ep, USB_MAXENDPOINTS); + num_ep = USB_MAXENDPOINTS; +@@ -590,7 +590,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno, + } + + if (n != num_ep_orig) +- dev_warn(ddev, "config %d interface %d altsetting %d has %d " ++ dev_notice(ddev, "config %d interface %d altsetting %d has %d " + "endpoint descriptor%s, different from the interface " + "descriptor's value: %d\n", + cfgno, inum, asnum, n, plural(n), num_ep_orig); +@@ -625,7 +625,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + if (config->desc.bDescriptorType != USB_DT_CONFIG || + config->desc.bLength < USB_DT_CONFIG_SIZE || + config->desc.bLength > size) { +- dev_err(ddev, "invalid descriptor for config index %d: " ++ dev_notice(ddev, "invalid descriptor for config index %d: " + "type = 0x%X, length = %d\n", cfgidx, + config->desc.bDescriptorType, config->desc.bLength); + return -EINVAL; +@@ -636,7 +636,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + size -= config->desc.bLength; + + if (nintf > USB_MAXINTERFACES) { +- dev_warn(ddev, "config %d has too many interfaces: %d, " ++ dev_notice(ddev, "config %d has too many interfaces: %d, " + "using maximum allowed: %d\n", + cfgno, nintf, USB_MAXINTERFACES); + nintf = USB_MAXINTERFACES; +@@ -650,7 +650,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + (buffer2 += header->bLength, size2 -= header->bLength)) { + + if (size2 < sizeof(struct usb_descriptor_header)) { +- dev_warn(ddev, "config %d descriptor has %d excess " ++ dev_notice(ddev, "config %d descriptor has %d excess " + "byte%s, ignoring\n", + cfgno, size2, plural(size2)); + break; +@@ -658,7 +658,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + + header = (struct usb_descriptor_header *) buffer2; + if ((header->bLength > size2) || (header->bLength < 2)) { +- dev_warn(ddev, "config %d has an invalid descriptor " ++ dev_notice(ddev, "config %d has an invalid descriptor " + "of length %d, skipping remainder of the config\n", + cfgno, header->bLength); + break; +@@ -670,7 +670,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + + d = (struct usb_interface_descriptor *) header; + if (d->bLength < USB_DT_INTERFACE_SIZE) { +- dev_warn(ddev, "config %d has an invalid " ++ dev_notice(ddev, "config %d has an invalid " + "interface descriptor of length %d, " + "skipping\n", cfgno, d->bLength); + continue; +@@ -680,7 +680,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + + if ((dev->quirks & USB_QUIRK_HONOR_BNUMINTERFACES) && + n >= nintf_orig) { +- dev_warn(ddev, "config %d has more interface " ++ dev_notice(ddev, "config %d has more interface " + "descriptors, than it declares in " + "bNumInterfaces, ignoring interface " + "number: %d\n", cfgno, inum); +@@ -688,7 +688,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + } + + if (inum >= nintf_orig) +- dev_warn(ddev, "config %d has an invalid " ++ dev_notice(ddev, "config %d has an invalid " + "interface number: %d but max is %d\n", + cfgno, inum, nintf_orig - 1); + +@@ -713,14 +713,14 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + + d = (struct usb_interface_assoc_descriptor *)header; + if (d->bLength < USB_DT_INTERFACE_ASSOCIATION_SIZE) { +- dev_warn(ddev, ++ dev_notice(ddev, + "config %d has an invalid interface association descriptor of length %d, skipping\n", + cfgno, d->bLength); + continue; + } + + if (iad_num == USB_MAXIADS) { +- dev_warn(ddev, "found more Interface " ++ dev_notice(ddev, "found more Interface " + "Association Descriptors " + "than allocated for in " + "configuration %d\n", cfgno); +@@ -731,7 +731,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + + } else if (header->bDescriptorType == USB_DT_DEVICE || + header->bDescriptorType == USB_DT_CONFIG) +- dev_warn(ddev, "config %d contains an unexpected " ++ dev_notice(ddev, "config %d contains an unexpected " + "descriptor of type 0x%X, skipping\n", + cfgno, header->bDescriptorType); + +@@ -740,11 +740,11 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + config->desc.wTotalLength = cpu_to_le16(buffer2 - buffer0); + + if (n != nintf) +- dev_warn(ddev, "config %d has %d interface%s, different from " ++ dev_notice(ddev, "config %d has %d interface%s, different from " + "the descriptor's value: %d\n", + cfgno, n, plural(n), nintf_orig); + else if (n == 0) +- dev_warn(ddev, "config %d has no interfaces?\n", cfgno); ++ dev_notice(ddev, "config %d has no interfaces?\n", cfgno); + config->desc.bNumInterfaces = nintf = n; + + /* Check for missing interface numbers */ +@@ -754,7 +754,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + break; + } + if (j >= nintf) +- dev_warn(ddev, "config %d has no interface number " ++ dev_notice(ddev, "config %d has no interface number " + "%d\n", cfgno, i); + } + +@@ -762,7 +762,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + for (i = 0; i < nintf; ++i) { + j = nalts[i]; + if (j > USB_MAXALTSETTING) { +- dev_warn(ddev, "too many alternate settings for " ++ dev_notice(ddev, "too many alternate settings for " + "config %d interface %d: %d, " + "using maximum allowed: %d\n", + cfgno, inums[i], j, USB_MAXALTSETTING); +@@ -811,7 +811,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, + break; + } + if (n >= intfc->num_altsetting) +- dev_warn(ddev, "config %d interface %d has no " ++ dev_notice(ddev, "config %d interface %d has no " + "altsetting %d\n", cfgno, inums[i], j); + } + } +@@ -868,7 +868,7 @@ int usb_get_configuration(struct usb_device *dev) + int result; + + if (ncfg > USB_MAXCONFIG) { +- dev_warn(ddev, "too many configurations: %d, " ++ dev_notice(ddev, "too many configurations: %d, " + "using maximum allowed: %d\n", ncfg, USB_MAXCONFIG); + dev->descriptor.bNumConfigurations = ncfg = USB_MAXCONFIG; + } +@@ -902,7 +902,7 @@ int usb_get_configuration(struct usb_device *dev) + "descriptor/%s: %d\n", cfgno, "start", result); + if (result != -EPIPE) + goto err; +- dev_err(ddev, "chopping to %d config(s)\n", cfgno); ++ dev_notice(ddev, "chopping to %d config(s)\n", cfgno); + dev->descriptor.bNumConfigurations = cfgno; + break; + } else if (result < 4) { +@@ -934,7 +934,7 @@ int usb_get_configuration(struct usb_device *dev) + goto err; + } + if (result < length) { +- dev_warn(ddev, "config index %d descriptor too short " ++ dev_notice(ddev, "config index %d descriptor too short " + "(expected %i, got %i)\n", cfgno, length, result); + length = result; + } +@@ -993,7 +993,7 @@ int usb_get_bos_descriptor(struct usb_device *dev) + /* Get BOS descriptor */ + ret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE); + if (ret < USB_DT_BOS_SIZE || bos->bLength < USB_DT_BOS_SIZE) { +- dev_err(ddev, "unable to get BOS descriptor or descriptor too short\n"); ++ dev_notice(ddev, "unable to get BOS descriptor or descriptor too short\n"); + if (ret >= 0) + ret = -ENOMSG; + kfree(bos); +@@ -1021,7 +1021,7 @@ int usb_get_bos_descriptor(struct usb_device *dev) + + ret = usb_get_descriptor(dev, USB_DT_BOS, 0, buffer, total_len); + if (ret < total_len) { +- dev_err(ddev, "unable to get BOS descriptor set\n"); ++ dev_notice(ddev, "unable to get BOS descriptor set\n"); + if (ret >= 0) + ret = -ENOMSG; + goto err; +@@ -1046,7 +1046,7 @@ int usb_get_bos_descriptor(struct usb_device *dev) + } + + if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) { +- dev_warn(ddev, "descriptor type invalid, skip\n"); ++ dev_notice(ddev, "descriptor type invalid, skip\n"); + continue; + } + +-- +2.42.0 +