From f6084337691f24610e03d4f8f73605cfe470d490 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 3 Dec 2023 15:07:03 -0500 Subject: [PATCH] Fixes for 5.15 Signed-off-by: Sasha Levin --- ...soc_intel_is_foo-helpers-to-a-generi.patch | 176 ++++++++ ...-dev-add-parameter-to-override-topol.patch | 92 ++++ ...-dev-don-t-use-the-community-key-on-.patch | 99 +++++ ...-dev-fix-community-key-quirk-detecti.patch | 47 ++ ...-dev-use-community-key-on-all-up-boa.patch | 61 +++ ...n-t-disable-792-mhz-opp-unnecessaril.patch | 49 +++ ...n-t-warn-for-disabling-a-non-existin.patch | 93 ++++ ...se-the-needed-headroom-to-account-fo.patch | 85 ++++ ...te-performance-with-disabled-delallo.patch | 47 ++ ...-new-if-it-is-unwritten-to-avoid-sta.patch | 145 +++++++ ...nc-file-size-update-after-o_sync-dir.patch | 246 +++++++++++ ...-the-sti-next-font-pointer-a-32-bit-.patch | 39 ++ ...s-add-ctime-accessors-infrastructure.patch | 116 +++++ ...ce-of-netvsc-and-vf-register_netdevi.patch | 89 ++++ ...context-clearing-consistent-with-con.patch | 46 ++ ...devtlb-invalidation-requests-when-te.patch | 69 +++ ...fcnt-uaf-issue-when-receiving-igmp-q.patch | 114 +++++ ...eturn-value-of-reset_control_deasser.patch | 60 +++ ...x-queues-after-hw-initialization-suc.patch | 46 ++ ...dma-in-case-of-failures-on-ravb_open.patch | 37 ++ ...t-ravb-use-pm_runtime_resume_and_get.patch | 48 +++ ...mac-xgmac-disable-fpe-mmc-interrupts.patch | 54 +++ ...ntx2-af-fix-possible-buffer-overflow.patch | 55 +++ ...-adding-mbox-work-queue-entry-when-n.patch | 51 +++ ...perf-intel-pt-fix-async-branch-flags.patch | 42 ++ ...iommu-enable_ddw-incorrectly-returns.patch | 74 ++++ ...-potential-deadlock-in-rtl8169_close.patch | 51 +++ ...etween-ravb_tx_timeout_work-and-net-.patch | 79 ++++ ...ndling-of-irq-enable-disable-regs-in.patch | 106 +++++ ...arate-line0-desc-line1-err-and-line2.patch | 159 +++++++ ...-workqueue-remove-unused-cancel_work.patch | 64 +++ ...-net-ipsec-fix-constant-out-of-range.patch | 56 +++ ...l-add-missing-spdx-license-to-makefi.patch | 35 ++ ...l-move-_gnu_source-define-into-makef.patch | 57 +++ queue-5.15/series | 39 ++ ...mb3-fix-caching-of-ctime-on-setxattr.patch | 43 ++ queue-5.15/smb3-fix-touch-h-of-symlink.patch | 40 ++ ..._struct_group-attributes-to-the-cont.patch | 79 ++++ ...teration-issue-in-usb_get_bos_descri.patch | 57 +++ ...ge-configuration-warnings-to-notices.patch | 401 ++++++++++++++++++ 40 files changed, 3346 insertions(+) create mode 100644 queue-5.15/asoc-intel-move-soc_intel_is_foo-helpers-to-a-generi.patch create mode 100644 queue-5.15/asoc-sof-sof-pci-dev-add-parameter-to-override-topol.patch create mode 100644 queue-5.15/asoc-sof-sof-pci-dev-don-t-use-the-community-key-on-.patch create mode 100644 queue-5.15/asoc-sof-sof-pci-dev-fix-community-key-quirk-detecti.patch create mode 100644 queue-5.15/asoc-sof-sof-pci-dev-use-community-key-on-all-up-boa.patch create mode 100644 queue-5.15/cpufreq-imx6q-don-t-disable-792-mhz-opp-unnecessaril.patch create mode 100644 queue-5.15/cpufreq-imx6q-don-t-warn-for-disabling-a-non-existin.patch create mode 100644 queue-5.15/dpaa2-eth-increase-the-needed-headroom-to-account-fo.patch create mode 100644 queue-5.15/ext4-improve-write-performance-with-disabled-delallo.patch create mode 100644 queue-5.15/ext4-mark-buffer-new-if-it-is-unwritten-to-avoid-sta.patch create mode 100644 queue-5.15/ext4-properly-sync-file-size-update-after-o_sync-dir.patch create mode 100644 queue-5.15/fbdev-stifb-make-the-sti-next-font-pointer-a-32-bit-.patch create mode 100644 queue-5.15/fs-add-ctime-accessors-infrastructure.patch create mode 100644 queue-5.15/hv_netvsc-fix-race-of-netvsc-and-vf-register_netdevi.patch create mode 100644 queue-5.15/iommu-vt-d-make-context-clearing-consistent-with-con.patch create mode 100644 queue-5.15/iommu-vt-d-omit-devtlb-invalidation-requests-when-te.patch create mode 100644 queue-5.15/ipv4-igmp-fix-refcnt-uaf-issue-when-receiving-igmp-q.patch create mode 100644 queue-5.15/net-ravb-check-return-value-of-reset_control_deasser.patch create mode 100644 queue-5.15/net-ravb-start-tx-queues-after-hw-initialization-suc.patch create mode 100644 queue-5.15/net-ravb-stop-dma-in-case-of-failures-on-ravb_open.patch create mode 100644 queue-5.15/net-ravb-use-pm_runtime_resume_and_get.patch create mode 100644 queue-5.15/net-stmmac-xgmac-disable-fpe-mmc-interrupts.patch create mode 100644 queue-5.15/octeontx2-af-fix-possible-buffer-overflow.patch create mode 100644 queue-5.15/octeontx2-pf-fix-adding-mbox-work-queue-entry-when-n.patch create mode 100644 queue-5.15/perf-intel-pt-fix-async-branch-flags.patch create mode 100644 queue-5.15/powerpc-pseries-iommu-enable_ddw-incorrectly-returns.patch create mode 100644 queue-5.15/r8169-prevent-potential-deadlock-in-rtl8169_close.patch create mode 100644 queue-5.15/ravb-fix-races-between-ravb_tx_timeout_work-and-net-.patch create mode 100644 queue-5.15/ravb-separate-handling-of-irq-enable-disable-regs-in.patch create mode 100644 queue-5.15/ravb-support-separate-line0-desc-line1-err-and-line2.patch create mode 100644 queue-5.15/revert-workqueue-remove-unused-cancel_work.patch create mode 100644 queue-5.15/selftests-net-ipsec-fix-constant-out-of-range.patch create mode 100644 queue-5.15/selftests-resctrl-add-missing-spdx-license-to-makefi.patch create mode 100644 queue-5.15/selftests-resctrl-move-_gnu_source-define-into-makef.patch create mode 100644 queue-5.15/smb3-fix-caching-of-ctime-on-setxattr.patch create mode 100644 queue-5.15/smb3-fix-touch-h-of-symlink.patch create mode 100644 queue-5.15/uapi-propagate-__struct_group-attributes-to-the-cont.patch create mode 100644 queue-5.15/usb-config-fix-iteration-issue-in-usb_get_bos_descri.patch create mode 100644 queue-5.15/usb-core-change-configuration-warnings-to-notices.patch diff --git a/queue-5.15/asoc-intel-move-soc_intel_is_foo-helpers-to-a-generi.patch b/queue-5.15/asoc-intel-move-soc_intel_is_foo-helpers-to-a-generi.patch new file mode 100644 index 00000000000..4919f6c1eec --- /dev/null +++ b/queue-5.15/asoc-intel-move-soc_intel_is_foo-helpers-to-a-generi.patch @@ -0,0 +1,176 @@ +From 9d5acf209f699fc5b74a41eb60dd623195580a63 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.15/asoc-sof-sof-pci-dev-add-parameter-to-override-topol.patch b/queue-5.15/asoc-sof-sof-pci-dev-add-parameter-to-override-topol.patch new file mode 100644 index 00000000000..96587d9bb7b --- /dev/null +++ b/queue-5.15/asoc-sof-sof-pci-dev-add-parameter-to-override-topol.patch @@ -0,0 +1,92 @@ +From 3af8b4d42c111f7f436f43741206a8eeb33a72a1 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 c1cd156996b43..6b103118cfd1b 100644 +--- a/sound/soc/sof/sof-pci-dev.c ++++ b/sound/soc/sof/sof-pci-dev.c +@@ -27,17 +27,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; + } + +@@ -183,9 +187,20 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + 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; ++ } + + /* set callback to be called on successful device probe to enable runtime_pm */ + sof_pdata->sof_probe_complete = sof_pci_probe_complete; +-- +2.42.0 + diff --git a/queue-5.15/asoc-sof-sof-pci-dev-don-t-use-the-community-key-on-.patch b/queue-5.15/asoc-sof-sof-pci-dev-don-t-use-the-community-key-on-.patch new file mode 100644 index 00000000000..7eeb6048f90 --- /dev/null +++ b/queue-5.15/asoc-sof-sof-pci-dev-don-t-use-the-community-key-on-.patch @@ -0,0 +1,99 @@ +From 3b1a48a19721985fec7ec5ab95c011d9ce784d4a 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 6b103118cfd1b..9f0732461a611 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 +@@ -36,6 +37,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) + +@@ -66,15 +68,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"), + } +@@ -167,7 +189,7 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + "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.15/asoc-sof-sof-pci-dev-fix-community-key-quirk-detecti.patch b/queue-5.15/asoc-sof-sof-pci-dev-fix-community-key-quirk-detecti.patch new file mode 100644 index 00000000000..943b35ef957 --- /dev/null +++ b/queue-5.15/asoc-sof-sof-pci-dev-fix-community-key-quirk-detecti.patch @@ -0,0 +1,47 @@ +From f20716c278838f9cc45b020d3d46292ee9230b36 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 9f0732461a611..ec40053041e15 100644 +--- a/sound/soc/sof/sof-pci-dev.c ++++ b/sound/soc/sof/sof-pci-dev.c +@@ -101,6 +101,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.15/asoc-sof-sof-pci-dev-use-community-key-on-all-up-boa.patch b/queue-5.15/asoc-sof-sof-pci-dev-use-community-key-on-all-up-boa.patch new file mode 100644 index 00000000000..b4e7038d2e7 --- /dev/null +++ b/queue-5.15/asoc-sof-sof-pci-dev-use-community-key-on-all-up-boa.patch @@ -0,0 +1,61 @@ +From e9b1c6fe8fdb110dc482dc8fb5fd9f5e9dff97bc 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 3b4c011e02834..c1cd156996b43 100644 +--- a/sound/soc/sof/sof-pci-dev.c ++++ b/sound/soc/sof/sof-pci-dev.c +@@ -64,17 +64,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.15/cpufreq-imx6q-don-t-disable-792-mhz-opp-unnecessaril.patch b/queue-5.15/cpufreq-imx6q-don-t-disable-792-mhz-opp-unnecessaril.patch new file mode 100644 index 00000000000..ce8758bb496 --- /dev/null +++ b/queue-5.15/cpufreq-imx6q-don-t-disable-792-mhz-opp-unnecessaril.patch @@ -0,0 +1,49 @@ +From ebaafcfd9bf51b7b96e448495d0112f320cc2c90 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 37d30fa2df5fa..67f98a083d223 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.15/cpufreq-imx6q-don-t-warn-for-disabling-a-non-existin.patch b/queue-5.15/cpufreq-imx6q-don-t-warn-for-disabling-a-non-existin.patch new file mode 100644 index 00000000000..1e031f8807f --- /dev/null +++ b/queue-5.15/cpufreq-imx6q-don-t-warn-for-disabling-a-non-existin.patch @@ -0,0 +1,93 @@ +From 56bf685f5037117cee7e9bede1a6a1fd14103a4a 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 90beb26ed34e9..37d30fa2df5fa 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.15/dpaa2-eth-increase-the-needed-headroom-to-account-fo.patch b/queue-5.15/dpaa2-eth-increase-the-needed-headroom-to-account-fo.patch new file mode 100644 index 00000000000..19dd1e3634e --- /dev/null +++ b/queue-5.15/dpaa2-eth-increase-the-needed-headroom-to-account-fo.patch @@ -0,0 +1,85 @@ +From c03c9e1cc788dce07fccf84079adb0db9c50fcbd 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 c48d410936517..78040a09313ef 100644 +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -952,14 +952,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 +@@ -4446,6 +4444,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 cdb623d5f2c1a..67fd926331fed 100644 +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +@@ -670,7 +670,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.15/ext4-improve-write-performance-with-disabled-delallo.patch b/queue-5.15/ext4-improve-write-performance-with-disabled-delallo.patch new file mode 100644 index 00000000000..8239357c536 --- /dev/null +++ b/queue-5.15/ext4-improve-write-performance-with-disabled-delallo.patch @@ -0,0 +1,47 @@ +From 2f09b1565e6ec3112a2eb52acfbc41de93550a2f 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 64a783f221052..c3b0fc7580e83 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.15/ext4-mark-buffer-new-if-it-is-unwritten-to-avoid-sta.patch b/queue-5.15/ext4-mark-buffer-new-if-it-is-unwritten-to-avoid-sta.patch new file mode 100644 index 00000000000..e4c3b0980a9 --- /dev/null +++ b/queue-5.15/ext4-mark-buffer-new-if-it-is-unwritten-to-avoid-sta.patch @@ -0,0 +1,145 @@ +From a23d2f2cef58f4c6e8e837657dc416a0ac609a76 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 c3b0fc7580e83..2ec1796922871 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.15/ext4-properly-sync-file-size-update-after-o_sync-dir.patch b/queue-5.15/ext4-properly-sync-file-size-update-after-o_sync-dir.patch new file mode 100644 index 00000000000..7f35f1d9145 --- /dev/null +++ b/queue-5.15/ext4-properly-sync-file-size-update-after-o_sync-dir.patch @@ -0,0 +1,246 @@ +From 91d014706a567575472e4872abeac522965cbe1f 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 4704fe627c4e2..94ce73fadcba6 100644 +--- a/fs/ext4/file.c ++++ b/fs/ext4/file.c +@@ -279,80 +279,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 +@@ -361,9 +319,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, +@@ -372,31 +349,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) + 0); + 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.15/fbdev-stifb-make-the-sti-next-font-pointer-a-32-bit-.patch b/queue-5.15/fbdev-stifb-make-the-sti-next-font-pointer-a-32-bit-.patch new file mode 100644 index 00000000000..ed78bd733d1 --- /dev/null +++ b/queue-5.15/fbdev-stifb-make-the-sti-next-font-pointer-a-32-bit-.patch @@ -0,0 +1,39 @@ +From d6bdef383a27b21178c26e44b13838e41d078acc 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.15/fs-add-ctime-accessors-infrastructure.patch b/queue-5.15/fs-add-ctime-accessors-infrastructure.patch new file mode 100644 index 00000000000..336803e20d6 --- /dev/null +++ b/queue-5.15/fs-add-ctime-accessors-infrastructure.patch @@ -0,0 +1,116 @@ +From 577d25ed2932ca15942a73452f18f10d723b5940 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 7cb048a3b3bdb..ec41a11e2f8fe 100644 +--- a/fs/inode.c ++++ b/fs/inode.c +@@ -2335,6 +2335,22 @@ struct timespec64 current_time(struct inode *inode) + } + EXPORT_SYMBOL(current_time); + ++/** ++ * 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 + * @mnt_userns: user namespace of the mount @inode was found from +diff --git a/include/linux/fs.h b/include/linux/fs.h +index 6bba7a58c95c6..6f287fac0ecee 100644 +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -1722,7 +1722,50 @@ static inline bool fsuidgid_has_mapping(struct super_block *sb, + kgid_has_mapping(fs_userns, kgid); + } + +-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.15/hv_netvsc-fix-race-of-netvsc-and-vf-register_netdevi.patch b/queue-5.15/hv_netvsc-fix-race-of-netvsc-and-vf-register_netdevi.patch new file mode 100644 index 00000000000..90a7a559e60 --- /dev/null +++ b/queue-5.15/hv_netvsc-fix-race-of-netvsc-and-vf-register_netdevi.patch @@ -0,0 +1,89 @@ +From 7b7c8f10f726097e65bd551b118cc82d8ad79b45 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 ce1b299c89f53..c3a8ac244a08e 100644 +--- a/drivers/net/hyperv/netvsc_drv.c ++++ b/drivers/net/hyperv/netvsc_drv.c +@@ -2563,15 +2563,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 +@@ -2579,9 +2570,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); + +@@ -2615,9 +2620,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.15/iommu-vt-d-make-context-clearing-consistent-with-con.patch b/queue-5.15/iommu-vt-d-make-context-clearing-consistent-with-con.patch new file mode 100644 index 00000000000..0b2780e0678 --- /dev/null +++ b/queue-5.15/iommu-vt-d-make-context-clearing-consistent-with-con.patch @@ -0,0 +1,46 @@ +From 708c75d6a3cab555a4ef273c77f7678ea2c8b9f0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Nov 2023 11:26:05 +0800 +Subject: iommu/vt-d: Make context clearing consistent with context mapping + +From: Lu Baolu + +[ Upstream commit 9a16ab9d640274b20813d2d17475e18d3e99d834 ] + +In the iommu probe_device path, domain_context_mapping() allows setting +up the context entry for a non-PCI device. However, in the iommu +release_device path, domain_context_clear() only clears context entries +for PCI devices. + +Make domain_context_clear() behave consistently with +domain_context_mapping() by clearing context entries for both PCI and +non-PCI devices. + +Fixes: 579305f75d34 ("iommu/vt-d: Update to use PCI DMA aliases") +Signed-off-by: Lu Baolu +Reviewed-by: Kevin Tian +Link: https://lore.kernel.org/r/20231114011036.70142-4-baolu.lu@linux.intel.com +Signed-off-by: Joerg Roedel +Signed-off-by: Sasha Levin +--- + drivers/iommu/intel/iommu.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c +index 51f008398c0cc..46b2751c3f003 100644 +--- a/drivers/iommu/intel/iommu.c ++++ b/drivers/iommu/intel/iommu.c +@@ -4465,8 +4465,8 @@ static int domain_context_clear_one_cb(struct pci_dev *pdev, u16 alias, void *op + */ + static void domain_context_clear(struct device_domain_info *info) + { +- if (!info->iommu || !info->dev || !dev_is_pci(info->dev)) +- return; ++ if (!dev_is_pci(info->dev)) ++ domain_context_clear_one(info, info->bus, info->devfn); + + pci_for_each_dma_alias(to_pci_dev(info->dev), + &domain_context_clear_one_cb, info); +-- +2.42.0 + diff --git a/queue-5.15/iommu-vt-d-omit-devtlb-invalidation-requests-when-te.patch b/queue-5.15/iommu-vt-d-omit-devtlb-invalidation-requests-when-te.patch new file mode 100644 index 00000000000..bd6ba2f27c7 --- /dev/null +++ b/queue-5.15/iommu-vt-d-omit-devtlb-invalidation-requests-when-te.patch @@ -0,0 +1,69 @@ +From 4c5e513fafe49463446deb6200bf325878785bcc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Nov 2023 11:26:03 +0800 +Subject: iommu/vt-d: Omit devTLB invalidation requests when TES=0 + +From: Lu Baolu + +[ Upstream commit 0f5432a9b839847dcfe9fa369d72e3d646102ddf ] + +The latest VT-d spec indicates that when remapping hardware is disabled +(TES=0 in Global Status Register), upstream ATS Invalidation Completion +requests are treated as UR (Unsupported Request). + +Consequently, the spec recommends in section 4.3 Handling of Device-TLB +Invalidations that software refrain from submitting any Device-TLB +invalidation requests when address remapping hardware is disabled. + +Verify address remapping hardware is enabled prior to submitting Device- +TLB invalidation requests. + +Fixes: 792fb43ce2c9 ("iommu/vt-d: Enable Intel IOMMU scalable mode by default") +Signed-off-by: Lu Baolu +Reviewed-by: Kevin Tian +Link: https://lore.kernel.org/r/20231114011036.70142-2-baolu.lu@linux.intel.com +Signed-off-by: Joerg Roedel +Signed-off-by: Sasha Levin +--- + drivers/iommu/intel/dmar.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c +index 7c20083d4a798..0ad33d8d99d1f 100644 +--- a/drivers/iommu/intel/dmar.c ++++ b/drivers/iommu/intel/dmar.c +@@ -1518,6 +1518,15 @@ void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 pfsid, + { + struct qi_desc desc; + ++ /* ++ * VT-d spec, section 4.3: ++ * ++ * Software is recommended to not submit any Device-TLB invalidation ++ * requests while address remapping hardware is disabled. ++ */ ++ if (!(iommu->gcmd & DMA_GCMD_TE)) ++ return; ++ + if (mask) { + addr |= (1ULL << (VTD_PAGE_SHIFT + mask - 1)) - 1; + desc.qw1 = QI_DEV_IOTLB_ADDR(addr) | QI_DEV_IOTLB_SIZE; +@@ -1583,6 +1592,15 @@ void qi_flush_dev_iotlb_pasid(struct intel_iommu *iommu, u16 sid, u16 pfsid, + unsigned long mask = 1UL << (VTD_PAGE_SHIFT + size_order - 1); + struct qi_desc desc = {.qw1 = 0, .qw2 = 0, .qw3 = 0}; + ++ /* ++ * VT-d spec, section 4.3: ++ * ++ * Software is recommended to not submit any Device-TLB invalidation ++ * requests while address remapping hardware is disabled. ++ */ ++ if (!(iommu->gcmd & DMA_GCMD_TE)) ++ return; ++ + desc.qw0 = QI_DEV_EIOTLB_PASID(pasid) | QI_DEV_EIOTLB_SID(sid) | + QI_DEV_EIOTLB_QDEP(qdep) | QI_DEIOTLB_TYPE | + QI_DEV_IOTLB_PFSID(pfsid); +-- +2.42.0 + diff --git a/queue-5.15/ipv4-igmp-fix-refcnt-uaf-issue-when-receiving-igmp-q.patch b/queue-5.15/ipv4-igmp-fix-refcnt-uaf-issue-when-receiving-igmp-q.patch new file mode 100644 index 00000000000..c28094f897c --- /dev/null +++ b/queue-5.15/ipv4-igmp-fix-refcnt-uaf-issue-when-receiving-igmp-q.patch @@ -0,0 +1,114 @@ +From 86f00a4966b97ccd454916054ad276a16336c079 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 1f63dc8897a40..88e780a168652 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.15/net-ravb-check-return-value-of-reset_control_deasser.patch b/queue-5.15/net-ravb-check-return-value-of-reset_control_deasser.patch new file mode 100644 index 00000000000..303f106e4b9 --- /dev/null +++ b/queue-5.15/net-ravb-check-return-value-of-reset_control_deasser.patch @@ -0,0 +1,60 @@ +From e6b63cbea4eb07086adc95fec8197041d0c61762 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Nov 2023 10:04:34 +0200 +Subject: net: ravb: Check return value of reset_control_deassert() + +From: Claudiu Beznea + +[ Upstream commit d8eb6ea4b302e7ff78535c205510e359ac10a0bd ] + +reset_control_deassert() could return an error. Some devices cannot work +if reset signal de-assert operation fails. To avoid this check the return +code of reset_control_deassert() in ravb_probe() and take proper action. + +Along with it, the free_netdev() call from the error path was moved after +reset_control_assert() on its own label (out_free_netdev) to free +netdev in case reset_control_deassert() fails. + +Fixes: 0d13a1a464a0 ("ravb: Add reset support") +Reviewed-by: Sergey Shtylyov +Reviewed-by: Philipp Zabel +Signed-off-by: Claudiu Beznea +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/ravb_main.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c +index b180e2225227c..709c770b391c5 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -2188,7 +2188,10 @@ static int ravb_probe(struct platform_device *pdev) + ndev->features = info->net_features; + ndev->hw_features = info->net_hw_features; + +- reset_control_deassert(rstc); ++ error = reset_control_deassert(rstc); ++ if (error) ++ goto out_free_netdev; ++ + pm_runtime_enable(&pdev->dev); + pm_runtime_get_sync(&pdev->dev); + +@@ -2373,11 +2376,11 @@ static int ravb_probe(struct platform_device *pdev) + out_disable_refclk: + clk_disable_unprepare(priv->refclk); + out_release: +- free_netdev(ndev); +- + pm_runtime_put(&pdev->dev); + pm_runtime_disable(&pdev->dev); + reset_control_assert(rstc); ++out_free_netdev: ++ free_netdev(ndev); + return error; + } + +-- +2.42.0 + diff --git a/queue-5.15/net-ravb-start-tx-queues-after-hw-initialization-suc.patch b/queue-5.15/net-ravb-start-tx-queues-after-hw-initialization-suc.patch new file mode 100644 index 00000000000..7388301dd1f --- /dev/null +++ b/queue-5.15/net-ravb-start-tx-queues-after-hw-initialization-suc.patch @@ -0,0 +1,46 @@ +From ec2cfc4973c92b81fb60f18240a7f702eddc7809 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 a556faa47f036..0c73bc4df98d5 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -1448,13 +1448,13 @@ static int ravb_open(struct net_device *ndev) + if (info->gptp) + 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.15/net-ravb-stop-dma-in-case-of-failures-on-ravb_open.patch b/queue-5.15/net-ravb-stop-dma-in-case-of-failures-on-ravb_open.patch new file mode 100644 index 00000000000..47dfe34a1ac --- /dev/null +++ b/queue-5.15/net-ravb-stop-dma-in-case-of-failures-on-ravb_open.patch @@ -0,0 +1,37 @@ +From 61e036522830c7fdffc6a04eda3d92eecfda1aa3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Nov 2023 10:04:38 +0200 +Subject: net: ravb: Stop DMA in case of failures on ravb_open() + +From: Claudiu Beznea + +[ Upstream commit eac16a733427ba0de2449ffc7bd3da32ddb65cb7 ] + +In case ravb_phy_start() returns with error the settings applied in +ravb_dmac_init() are not reverted (e.g. config mode). For this call +ravb_stop_dma() on failure path of ravb_open(). + +Fixes: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver") +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 | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c +index 5cdc7bc63e267..1212a9b4822b3 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -1472,6 +1472,7 @@ static int ravb_open(struct net_device *ndev) + /* Stop PTP Clock driver */ + if (info->gptp) + ravb_ptp_stop(ndev); ++ ravb_stop_dma(ndev); + out_free_irq_mgmta: + if (!info->multi_irqs) + goto out_free_irq; +-- +2.42.0 + diff --git a/queue-5.15/net-ravb-use-pm_runtime_resume_and_get.patch b/queue-5.15/net-ravb-use-pm_runtime_resume_and_get.patch new file mode 100644 index 00000000000..8c8fed8a187 --- /dev/null +++ b/queue-5.15/net-ravb-use-pm_runtime_resume_and_get.patch @@ -0,0 +1,48 @@ +From 1d54b3d8edeff97f709b29ee2a4379db914899ba 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 709c770b391c5..a556faa47f036 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -2193,7 +2193,9 @@ static int ravb_probe(struct platform_device *pdev) + goto out_free_netdev; + + 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; + + if (info->multi_irqs) + irq = platform_get_irq_byname(pdev, "ch22"); +@@ -2377,6 +2379,7 @@ static int ravb_probe(struct platform_device *pdev) + clk_disable_unprepare(priv->refclk); + out_release: + pm_runtime_put(&pdev->dev); ++out_rpm_disable: + pm_runtime_disable(&pdev->dev); + reset_control_assert(rstc); + out_free_netdev: +-- +2.42.0 + diff --git a/queue-5.15/net-stmmac-xgmac-disable-fpe-mmc-interrupts.patch b/queue-5.15/net-stmmac-xgmac-disable-fpe-mmc-interrupts.patch new file mode 100644 index 00000000000..a66b699d7df --- /dev/null +++ b/queue-5.15/net-stmmac-xgmac-disable-fpe-mmc-interrupts.patch @@ -0,0 +1,54 @@ +From fe9ef6ed4931e24aa27e9d288bfcf609b0c379c0 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.15/octeontx2-af-fix-possible-buffer-overflow.patch b/queue-5.15/octeontx2-af-fix-possible-buffer-overflow.patch new file mode 100644 index 00000000000..a1d49760795 --- /dev/null +++ b/queue-5.15/octeontx2-af-fix-possible-buffer-overflow.patch @@ -0,0 +1,55 @@ +From 7366526216b28b188d2825f6956180af9651f2d6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 25 Nov 2023 00:08:02 +0300 +Subject: octeontx2-af: Fix possible buffer overflow + +From: Elena Salomatkina + +[ Upstream commit ad31c629ca3c87f6d557488c1f9faaebfbcd203c ] + +A loop in rvu_mbox_handler_nix_bandprof_free() contains +a break if (idx == MAX_BANDPROF_PER_PFFUNC), +but if idx may reach MAX_BANDPROF_PER_PFFUNC +buffer '(*req->prof_idx)[layer]' overflow happens before that check. + +The patch moves the break to the +beginning of the loop. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: e8e095b3b370 ("octeontx2-af: cn10k: Bandwidth profiles config support"). +Signed-off-by: Elena Salomatkina +Reviewed-by: Simon Horman +Reviewed-by: Subbaraya Sundeep +Link: https://lore.kernel.org/r/20231124210802.109763-1-elena.salomatkina.cmc@gmail.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +index 1593efc4502b5..5f9f6da5c45bb 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +@@ -5045,6 +5045,8 @@ int rvu_mbox_handler_nix_bandprof_free(struct rvu *rvu, + + ipolicer = &nix_hw->ipolicer[layer]; + for (idx = 0; idx < req->prof_count[layer]; idx++) { ++ if (idx == MAX_BANDPROF_PER_PFFUNC) ++ break; + prof_idx = req->prof_idx[layer][idx]; + if (prof_idx >= ipolicer->band_prof.max || + ipolicer->pfvf_map[prof_idx] != pcifunc) +@@ -5058,8 +5060,6 @@ int rvu_mbox_handler_nix_bandprof_free(struct rvu *rvu, + ipolicer->pfvf_map[prof_idx] = 0x00; + ipolicer->match_id[prof_idx] = 0; + rvu_free_rsrc(&ipolicer->band_prof, prof_idx); +- if (idx == MAX_BANDPROF_PER_PFFUNC) +- break; + } + } + mutex_unlock(&rvu->rsrc_lock); +-- +2.42.0 + diff --git a/queue-5.15/octeontx2-pf-fix-adding-mbox-work-queue-entry-when-n.patch b/queue-5.15/octeontx2-pf-fix-adding-mbox-work-queue-entry-when-n.patch new file mode 100644 index 00000000000..80d1e78d4a1 --- /dev/null +++ b/queue-5.15/octeontx2-pf-fix-adding-mbox-work-queue-entry-when-n.patch @@ -0,0 +1,51 @@ +From 699d91b11bea505e115cbcff9ad88c57a500f22c 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 8cb4b16ffad77..4eec574631c7e 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +@@ -557,7 +557,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)); +@@ -565,7 +567,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.15/perf-intel-pt-fix-async-branch-flags.patch b/queue-5.15/perf-intel-pt-fix-async-branch-flags.patch new file mode 100644 index 00000000000..fe660726982 --- /dev/null +++ b/queue-5.15/perf-intel-pt-fix-async-branch-flags.patch @@ -0,0 +1,42 @@ +From 1cfa2db5127d96f933dee417b760b54aff30da06 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 7a2ce387079e3..805bad9364e94 100644 +--- a/tools/perf/util/intel-pt.c ++++ b/tools/perf/util/intel-pt.c +@@ -1346,9 +1346,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.15/powerpc-pseries-iommu-enable_ddw-incorrectly-returns.patch b/queue-5.15/powerpc-pseries-iommu-enable_ddw-incorrectly-returns.patch new file mode 100644 index 00000000000..66e2ed79def --- /dev/null +++ b/queue-5.15/powerpc-pseries-iommu-enable_ddw-incorrectly-returns.patch @@ -0,0 +1,74 @@ +From e8c5af5c56f6481c9f6b7141b8a934242cc0b36c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Oct 2023 22:08:02 -0500 +Subject: powerpc/pseries/iommu: enable_ddw incorrectly returns direct mapping + for SR-IOV device + +From: Gaurav Batra + +[ Upstream commit 3bf983e4e93ce8e6d69e9d63f52a66ec0856672e ] + +When a device is initialized, the driver invokes dma_supported() twice - +first for streaming mappings followed by coherent mappings. For an +SR-IOV device, default window is deleted and DDW created. With vPMEM +enabled, TCE mappings are dynamically created for both vPMEM and SR-IOV +device. There are no direct mappings. + +First time when dma_supported() is called with 64 bit mask, DDW is created +and marked as dynamic window. The second time dma_supported() is called, +enable_ddw() finds existing window for the device and incorrectly returns +it as "direct mapping". + +This only happens when size of DDW is big enough to map max LPAR memory. + +This results in streaming TCEs to not get dynamically mapped, since code +incorrently assumes these are already pre-mapped. The adapter initially +comes up but goes down due to EEH. + +Fixes: 381ceda88c4c ("powerpc/pseries/iommu: Make use of DDW for indirect mapping") +Cc: stable@vger.kernel.org # v5.15+ +Signed-off-by: Gaurav Batra +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20231003030802.47914-1-gbatra@linux.vnet.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/platforms/pseries/iommu.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c +index aa5f8074e9b10..bee61292de23b 100644 +--- a/arch/powerpc/platforms/pseries/iommu.c ++++ b/arch/powerpc/platforms/pseries/iommu.c +@@ -891,7 +891,8 @@ static int remove_ddw(struct device_node *np, bool remove_prop, const char *win_ + return 0; + } + +-static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int *window_shift) ++static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int *window_shift, ++ bool *direct_mapping) + { + struct dma_win *window; + const struct dynamic_dma_window_prop *dma64; +@@ -904,6 +905,7 @@ static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int *windo + dma64 = window->prop; + *dma_addr = be64_to_cpu(dma64->dma_base); + *window_shift = be32_to_cpu(dma64->window_shift); ++ *direct_mapping = window->direct; + found = true; + break; + } +@@ -1253,10 +1255,8 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn) + + mutex_lock(&dma_win_init_mutex); + +- if (find_existing_ddw(pdn, &dev->dev.archdata.dma_offset, &len)) { +- direct_mapping = (len >= max_ram_len); ++ if (find_existing_ddw(pdn, &dev->dev.archdata.dma_offset, &len, &direct_mapping)) + goto out_unlock; +- } + + /* + * If we already went through this for a previous function of +-- +2.42.0 + diff --git a/queue-5.15/r8169-prevent-potential-deadlock-in-rtl8169_close.patch b/queue-5.15/r8169-prevent-potential-deadlock-in-rtl8169_close.patch new file mode 100644 index 00000000000..bdb335f3613 --- /dev/null +++ b/queue-5.15/r8169-prevent-potential-deadlock-in-rtl8169_close.patch @@ -0,0 +1,51 @@ +From 5e56cde1b216404d9104613531d2c0f05bccd676 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 d4de5ec690e50..84fb739679298 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -4744,7 +4744,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); + +@@ -5000,6 +5000,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 (tp->dash_type != RTL_DASH_NONE) +-- +2.42.0 + diff --git a/queue-5.15/ravb-fix-races-between-ravb_tx_timeout_work-and-net-.patch b/queue-5.15/ravb-fix-races-between-ravb_tx_timeout_work-and-net-.patch new file mode 100644 index 00000000000..757e5842765 --- /dev/null +++ b/queue-5.15/ravb-fix-races-between-ravb_tx_timeout_work-and-net-.patch @@ -0,0 +1,79 @@ +From 4d42d2e9613fc10d2cd5b14db840007cf24f12fe 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 19733c9a7c25e..b180e2225227c 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -1504,6 +1504,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 */ +@@ -1536,7 +1542,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); + +@@ -1546,6 +1552,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.15/ravb-separate-handling-of-irq-enable-disable-regs-in.patch b/queue-5.15/ravb-separate-handling-of-irq-enable-disable-regs-in.patch new file mode 100644 index 00000000000..1f81a299536 --- /dev/null +++ b/queue-5.15/ravb-separate-handling-of-irq-enable-disable-regs-in.patch @@ -0,0 +1,106 @@ +From 94fa16aa4a3405459e8c882d3eebe102b6f022c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 May 2022 12:47:19 +0100 +Subject: ravb: Separate handling of irq enable/disable regs into feature + +From: Phil Edworthy + +[ Upstream commit cb99badde146c327f150773921ffe080abe1eb44 ] + +Currently, when the HW has a single interrupt, the driver uses the +GIC, TIC, RIC0 registers to enable and disable interrupts. +When the HW has multiple interrupts, it uses the GIE, GID, TIE, TID, +RIE0, RID0 registers. + +However, other devices, e.g. RZ/V2M, have multiple irqs and only have +the GIC, TIC, RIC0 registers. +Therefore, split this into a separate feature. + +Signed-off-by: Phil Edworthy +Reviewed-by: Biju Das +Reviewed-by: Sergey Shtylyov +Signed-off-by: David S. Miller +Stable-dep-of: eac16a733427 ("net: ravb: Stop DMA in case of failures on ravb_open()") +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/ravb.h | 1 + + drivers/net/ethernet/renesas/ravb_main.c | 5 +++-- + drivers/net/ethernet/renesas/ravb_ptp.c | 6 +++--- + 3 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h +index a475f54a6b63c..a3cd09c7003bf 100644 +--- a/drivers/net/ethernet/renesas/ravb.h ++++ b/drivers/net/ethernet/renesas/ravb.h +@@ -1000,6 +1000,7 @@ struct ravb_hw_info { + unsigned internal_delay:1; /* AVB-DMAC has internal delays */ + unsigned tx_counters:1; /* E-MAC has TX counters */ + unsigned multi_irqs:1; /* AVB-DMAC and E-MAC has multiple irqs */ ++ unsigned irq_en_dis:1; /* Has separate irq enable and disable regs */ + unsigned gptp:1; /* AVB-DMAC has gPTP support */ + unsigned ccc_gac:1; /* AVB-DMAC has gPTP support active in config mode */ + }; +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c +index 0c73bc4df98d5..57215c834188c 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -821,7 +821,7 @@ static bool ravb_queue_interrupt(struct net_device *ndev, int q) + if (((ris0 & ric0) & BIT(q)) || ((tis & tic) & BIT(q))) { + if (napi_schedule_prep(&priv->napi[q])) { + /* Mask RX and TX interrupts */ +- if (!info->multi_irqs) { ++ if (!info->irq_en_dis) { + ravb_write(ndev, ric0 & ~BIT(q), RIC0); + ravb_write(ndev, tic & ~BIT(q), TIC); + } else { +@@ -988,7 +988,7 @@ static int ravb_poll(struct napi_struct *napi, int budget) + + /* Re-enable RX/TX interrupts */ + spin_lock_irqsave(&priv->lock, flags); +- if (!info->multi_irqs) { ++ if (!info->irq_en_dis) { + ravb_modify(ndev, RIC0, mask, mask); + ravb_modify(ndev, TIC, mask, mask); + } else { +@@ -2038,6 +2038,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = { + .internal_delay = 1, + .tx_counters = 1, + .multi_irqs = 1, ++ .irq_en_dis = 1, + .ccc_gac = 1, + }; + +diff --git a/drivers/net/ethernet/renesas/ravb_ptp.c b/drivers/net/ethernet/renesas/ravb_ptp.c +index c099656dd75b6..87c4306d66ecc 100644 +--- a/drivers/net/ethernet/renesas/ravb_ptp.c ++++ b/drivers/net/ethernet/renesas/ravb_ptp.c +@@ -198,7 +198,7 @@ static int ravb_ptp_extts(struct ptp_clock_info *ptp, + priv->ptp.extts[req->index] = on; + + spin_lock_irqsave(&priv->lock, flags); +- if (!info->multi_irqs) ++ if (!info->irq_en_dis) + ravb_modify(ndev, GIC, GIC_PTCE, on ? GIC_PTCE : 0); + else if (on) + ravb_write(ndev, GIE_PTCS, GIE); +@@ -254,7 +254,7 @@ static int ravb_ptp_perout(struct ptp_clock_info *ptp, + error = ravb_ptp_update_compare(priv, (u32)start_ns); + if (!error) { + /* Unmask interrupt */ +- if (!info->multi_irqs) ++ if (!info->irq_en_dis) + ravb_modify(ndev, GIC, GIC_PTME, GIC_PTME); + else + ravb_write(ndev, GIE_PTMS0, GIE); +@@ -266,7 +266,7 @@ static int ravb_ptp_perout(struct ptp_clock_info *ptp, + perout->period = 0; + + /* Mask interrupt */ +- if (!info->multi_irqs) ++ if (!info->irq_en_dis) + ravb_modify(ndev, GIC, GIC_PTME, 0); + else + ravb_write(ndev, GID_PTMD0, GID); +-- +2.42.0 + diff --git a/queue-5.15/ravb-support-separate-line0-desc-line1-err-and-line2.patch b/queue-5.15/ravb-support-separate-line0-desc-line1-err-and-line2.patch new file mode 100644 index 00000000000..590de4c1000 --- /dev/null +++ b/queue-5.15/ravb-support-separate-line0-desc-line1-err-and-line2.patch @@ -0,0 +1,159 @@ +From d1251b821e6def3c1b110fcce4751a74bcc7f5b0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 May 2022 12:47:20 +0100 +Subject: ravb: Support separate Line0 (Desc), Line1 (Err) and Line2 (Mgmt) + irqs + +From: Phil Edworthy + +[ Upstream commit b0265dcba3d6c1689e6ce315bed09192fb587403 ] + +R-Car has a combined interrupt line, ch22 = Line0_DiA | Line1_A | Line2_A. +RZ/V2M has separate interrupt lines for each of these, so add a feature +that allows the driver to get these interrupts and call the common handler. + +Signed-off-by: Phil Edworthy +Reviewed-by: Biju Das +Reviewed-by: Sergey Shtylyov +Signed-off-by: David S. Miller +Stable-dep-of: eac16a733427 ("net: ravb: Stop DMA in case of failures on ravb_open()") +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/ravb.h | 3 ++ + drivers/net/ethernet/renesas/ravb_main.c | 56 +++++++++++++++++++++--- + 2 files changed, 53 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h +index a3cd09c7003bf..29df692ebaaa2 100644 +--- a/drivers/net/ethernet/renesas/ravb.h ++++ b/drivers/net/ethernet/renesas/ravb.h +@@ -1001,6 +1001,7 @@ struct ravb_hw_info { + unsigned tx_counters:1; /* E-MAC has TX counters */ + unsigned multi_irqs:1; /* AVB-DMAC and E-MAC has multiple irqs */ + unsigned irq_en_dis:1; /* Has separate irq enable and disable regs */ ++ unsigned err_mgmt_irqs:1; /* Line1 (Err) and Line2 (Mgmt) irqs are separate */ + unsigned gptp:1; /* AVB-DMAC has gPTP support */ + unsigned ccc_gac:1; /* AVB-DMAC has gPTP support active in config mode */ + }; +@@ -1046,6 +1047,8 @@ struct ravb_private { + int msg_enable; + int speed; + int emac_irq; ++ int erra_irq; ++ int mgmta_irq; + int rx_irqs[NUM_RX_QUEUE]; + int tx_irqs[NUM_TX_QUEUE]; + +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c +index 57215c834188c..5cdc7bc63e267 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -1436,12 +1436,23 @@ static int ravb_open(struct net_device *ndev) + ndev, dev, "ch19:tx_nc"); + if (error) + goto out_free_irq_nc_rx; ++ ++ if (info->err_mgmt_irqs) { ++ error = ravb_hook_irq(priv->erra_irq, ravb_multi_interrupt, ++ ndev, dev, "err_a"); ++ if (error) ++ goto out_free_irq_nc_tx; ++ error = ravb_hook_irq(priv->mgmta_irq, ravb_multi_interrupt, ++ ndev, dev, "mgmt_a"); ++ if (error) ++ goto out_free_irq_erra; ++ } + } + + /* Device init */ + error = ravb_dmac_init(ndev); + if (error) +- goto out_free_irq_nc_tx; ++ goto out_free_irq_mgmta; + ravb_emac_init(ndev); + + /* Initialise PTP Clock driver */ +@@ -1461,9 +1472,15 @@ static int ravb_open(struct net_device *ndev) + /* Stop PTP Clock driver */ + if (info->gptp) + ravb_ptp_stop(ndev); +-out_free_irq_nc_tx: ++out_free_irq_mgmta: + if (!info->multi_irqs) + goto out_free_irq; ++ if (info->err_mgmt_irqs) ++ free_irq(priv->mgmta_irq, ndev); ++out_free_irq_erra: ++ if (info->err_mgmt_irqs) ++ free_irq(priv->erra_irq, ndev); ++out_free_irq_nc_tx: + free_irq(priv->tx_irqs[RAVB_NC], ndev); + out_free_irq_nc_rx: + free_irq(priv->rx_irqs[RAVB_NC], ndev); +@@ -1791,6 +1808,10 @@ static int ravb_close(struct net_device *ndev) + free_irq(priv->tx_irqs[RAVB_BE], ndev); + free_irq(priv->rx_irqs[RAVB_BE], ndev); + free_irq(priv->emac_irq, ndev); ++ if (info->err_mgmt_irqs) { ++ free_irq(priv->erra_irq, ndev); ++ free_irq(priv->mgmta_irq, ndev); ++ } + } + free_irq(ndev->irq, ndev); + +@@ -2198,10 +2219,14 @@ static int ravb_probe(struct platform_device *pdev) + if (error < 0) + goto out_rpm_disable; + +- if (info->multi_irqs) +- irq = platform_get_irq_byname(pdev, "ch22"); +- else ++ if (info->multi_irqs) { ++ if (info->err_mgmt_irqs) ++ irq = platform_get_irq_byname(pdev, "dia"); ++ else ++ irq = platform_get_irq_byname(pdev, "ch22"); ++ } else { + irq = platform_get_irq(pdev, 0); ++ } + if (irq < 0) { + error = irq; + goto out_release; +@@ -2240,7 +2265,10 @@ static int ravb_probe(struct platform_device *pdev) + of_property_read_bool(np, "renesas,ether-link-active-low"); + + if (info->multi_irqs) { +- irq = platform_get_irq_byname(pdev, "ch24"); ++ if (info->err_mgmt_irqs) ++ irq = platform_get_irq_byname(pdev, "line3"); ++ else ++ irq = platform_get_irq_byname(pdev, "ch24"); + if (irq < 0) { + error = irq; + goto out_release; +@@ -2262,6 +2290,22 @@ static int ravb_probe(struct platform_device *pdev) + } + priv->tx_irqs[i] = irq; + } ++ ++ if (info->err_mgmt_irqs) { ++ irq = platform_get_irq_byname(pdev, "err_a"); ++ if (irq < 0) { ++ error = irq; ++ goto out_release; ++ } ++ priv->erra_irq = irq; ++ ++ irq = platform_get_irq_byname(pdev, "mgmt_a"); ++ if (irq < 0) { ++ error = irq; ++ goto out_release; ++ } ++ priv->mgmta_irq = irq; ++ } + } + + priv->clk = devm_clk_get(&pdev->dev, NULL); +-- +2.42.0 + diff --git a/queue-5.15/revert-workqueue-remove-unused-cancel_work.patch b/queue-5.15/revert-workqueue-remove-unused-cancel_work.patch new file mode 100644 index 00000000000..538ba72ae13 --- /dev/null +++ b/queue-5.15/revert-workqueue-remove-unused-cancel_work.patch @@ -0,0 +1,64 @@ +From 9f0fbbc9754349435c6fec5448ca21df41ec4c33 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 1e96680f50230..5f2e531d0a80d 100644 +--- a/include/linux/workqueue.h ++++ b/include/linux/workqueue.h +@@ -462,6 +462,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 962ee27ec7d70..d5f30b610217e 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -3277,6 +3277,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.15/selftests-net-ipsec-fix-constant-out-of-range.patch b/queue-5.15/selftests-net-ipsec-fix-constant-out-of-range.patch new file mode 100644 index 00000000000..3aeddd61ce9 --- /dev/null +++ b/queue-5.15/selftests-net-ipsec-fix-constant-out-of-range.patch @@ -0,0 +1,56 @@ +From e13238682e8f8df3aafc2baacebf40d22c2da886 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 3d7dde2c321b3..c5be3f390849b 100644 +--- a/tools/testing/selftests/net/ipsec.c ++++ b/tools/testing/selftests/net/ipsec.c +@@ -2278,7 +2278,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; +@@ -2299,7 +2299,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.15/selftests-resctrl-add-missing-spdx-license-to-makefi.patch b/queue-5.15/selftests-resctrl-add-missing-spdx-license-to-makefi.patch new file mode 100644 index 00000000000..d210c6f0b34 --- /dev/null +++ b/queue-5.15/selftests-resctrl-add-missing-spdx-license-to-makefi.patch @@ -0,0 +1,35 @@ +From 05f4cc3bbdf3d7fd0c95b5e8f5ff5ad743b73fb2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 23 Mar 2022 17:12:27 +0900 +Subject: selftests/resctrl: Add missing SPDX license to Makefile + +From: Shaopeng Tan + +[ Upstream commit 68c4844985d1f8c1b1a71dfcdbfacb5a30babc95 ] + +Add the missing SPDX(SPDX-License-Identifier) license header to +tools/testing/selftests/resctrl/Makefile. + +Acked-by: Reinette Chatre +Reviewed-by: Fenghua Yu +Signed-off-by: Shaopeng Tan +Signed-off-by: Shuah Khan +Stable-dep-of: 3a1e4a91aa45 ("selftests/resctrl: Move _GNU_SOURCE define into Makefile") +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/resctrl/Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tools/testing/selftests/resctrl/Makefile b/tools/testing/selftests/resctrl/Makefile +index 9cc7e0108c8b0..5073dbc961258 100644 +--- a/tools/testing/selftests/resctrl/Makefile ++++ b/tools/testing/selftests/resctrl/Makefile +@@ -1,3 +1,5 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ + CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2 + CFLAGS += $(KHDR_INCLUDES) + +-- +2.42.0 + diff --git a/queue-5.15/selftests-resctrl-move-_gnu_source-define-into-makef.patch b/queue-5.15/selftests-resctrl-move-_gnu_source-define-into-makef.patch new file mode 100644 index 00000000000..68c4beeb299 --- /dev/null +++ b/queue-5.15/selftests-resctrl-move-_gnu_source-define-into-makef.patch @@ -0,0 +1,57 @@ +From c190d9ce9f3d2e9e7416fca50698d891811c42a0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Oct 2023 12:48:10 +0300 +Subject: selftests/resctrl: Move _GNU_SOURCE define into Makefile +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ilpo Järvinen + +[ Upstream commit 3a1e4a91aa454a1c589a9824d54179fdbfccde45 ] + +_GNU_SOURCE is defined in resctrl.h. Defining _GNU_SOURCE has a large +impact on what gets defined when including headers either before or +after it. This can result in compile failures if .c file decides to +include a standard header file before resctrl.h. + +It is safer to define _GNU_SOURCE in Makefile so it is always defined +regardless of in which order includes are done. + +Signed-off-by: Ilpo Järvinen +Tested-by: Shaopeng Tan +Reviewed-by: Reinette Chatre +Reviewed-by: Shaopeng Tan +Cc: +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/resctrl/Makefile | 2 +- + tools/testing/selftests/resctrl/resctrl.h | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + +diff --git a/tools/testing/selftests/resctrl/Makefile b/tools/testing/selftests/resctrl/Makefile +index 5073dbc961258..2deac2031de9e 100644 +--- a/tools/testing/selftests/resctrl/Makefile ++++ b/tools/testing/selftests/resctrl/Makefile +@@ -1,6 +1,6 @@ + # SPDX-License-Identifier: GPL-2.0 + +-CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2 ++CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE + CFLAGS += $(KHDR_INCLUDES) + + TEST_GEN_PROGS := resctrl_tests +diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h +index dbe5cfb545585..4597bba66ad45 100644 +--- a/tools/testing/selftests/resctrl/resctrl.h ++++ b/tools/testing/selftests/resctrl/resctrl.h +@@ -1,5 +1,4 @@ + /* SPDX-License-Identifier: GPL-2.0 */ +-#define _GNU_SOURCE + #ifndef RESCTRL_H + #define RESCTRL_H + #include +-- +2.42.0 + diff --git a/queue-5.15/series b/queue-5.15/series index 15499200817..05d827a9ef7 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -25,3 +25,42 @@ input-xpad-add-hyperx-clutch-gladiate-support.patch vlan-introduce-vlan_dev_free_egress_priority.patch vlan-move-dev_put-into-vlan_dev_uninit.patch rcu-avoid-tracing-a-few-functions-executed-in-stop-machine.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 +uapi-propagate-__struct_group-attributes-to-the-cont.patch +selftests-net-ipsec-fix-constant-out-of-range.patch +octeontx2-af-fix-possible-buffer-overflow.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-check-return-value-of-reset_control_deasser.patch +net-ravb-use-pm_runtime_resume_and_get.patch +net-ravb-start-tx-queues-after-hw-initialization-suc.patch +ravb-separate-handling-of-irq-enable-disable-regs-in.patch +ravb-support-separate-line0-desc-line1-err-and-line2.patch +net-ravb-stop-dma-in-case-of-failures-on-ravb_open.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 +selftests-resctrl-add-missing-spdx-license-to-makefi.patch +selftests-resctrl-move-_gnu_source-define-into-makef.patch +powerpc-pseries-iommu-enable_ddw-incorrectly-returns.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 +fbdev-stifb-make-the-sti-next-font-pointer-a-32-bit-.patch +ext4-properly-sync-file-size-update-after-o_sync-dir.patch +fs-add-ctime-accessors-infrastructure.patch +smb3-fix-caching-of-ctime-on-setxattr.patch +cpufreq-imx6q-don-t-warn-for-disabling-a-non-existin.patch +cpufreq-imx6q-don-t-disable-792-mhz-opp-unnecessaril.patch +iommu-vt-d-omit-devtlb-invalidation-requests-when-te.patch +iommu-vt-d-make-context-clearing-consistent-with-con.patch diff --git a/queue-5.15/smb3-fix-caching-of-ctime-on-setxattr.patch b/queue-5.15/smb3-fix-caching-of-ctime-on-setxattr.patch new file mode 100644 index 00000000000..7a8e81e6ed0 --- /dev/null +++ b/queue-5.15/smb3-fix-caching-of-ctime-on-setxattr.patch @@ -0,0 +1,43 @@ +From 249c291fbc2d7f39af3235137c58b91a36dbc5d2 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 9d486fbbfbbde..6f719b9cf9e9e 100644 +--- a/fs/cifs/xattr.c ++++ b/fs/cifs/xattr.c +@@ -150,10 +150,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.15/smb3-fix-touch-h-of-symlink.patch b/queue-5.15/smb3-fix-touch-h-of-symlink.patch new file mode 100644 index 00000000000..37990c26edd --- /dev/null +++ b/queue-5.15/smb3-fix-touch-h-of-symlink.patch @@ -0,0 +1,40 @@ +From 3cad54ca2ddbb7595b7dfd78af9ab2e03ddb08e6 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 b5ae209539ff1..af688e39f31ac 100644 +--- a/fs/cifs/cifsfs.c ++++ b/fs/cifs/cifsfs.c +@@ -1127,6 +1127,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.15/uapi-propagate-__struct_group-attributes-to-the-cont.patch b/queue-5.15/uapi-propagate-__struct_group-attributes-to-the-cont.patch new file mode 100644 index 00000000000..667a1f0a195 --- /dev/null +++ b/queue-5.15/uapi-propagate-__struct_group-attributes-to-the-cont.patch @@ -0,0 +1,79 @@ +From 80741d2335d2f6c70f1fd4f65f9912df50cdc027 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Nov 2023 14:05:08 +0300 +Subject: uapi: propagate __struct_group() attributes to the container union + +From: Dmitry Antipov + +[ Upstream commit 4e86f32a13af1970d21be94f659cae56bbe487ee ] + +Recently the kernel test robot has reported an ARM-specific BUILD_BUG_ON() +in an old and unmaintained wil6210 wireless driver. The problem comes from +the structure packing rules of old ARM ABI ('-mabi=apcs-gnu'). For example, +the following structure is packed to 18 bytes instead of 16: + +struct poorly_packed { + unsigned int a; + unsigned int b; + unsigned short c; + union { + struct { + unsigned short d; + unsigned int e; + } __attribute__((packed)); + struct { + unsigned short d; + unsigned int e; + } __attribute__((packed)) inner; + }; +} __attribute__((packed)); + +To fit it into 16 bytes, it's required to add packed attribute to the +container union as well: + +struct poorly_packed { + unsigned int a; + unsigned int b; + unsigned short c; + union { + struct { + unsigned short d; + unsigned int e; + } __attribute__((packed)); + struct { + unsigned short d; + unsigned int e; + } __attribute__((packed)) inner; + } __attribute__((packed)); +} __attribute__((packed)); + +Thanks to Andrew Pinski of GCC team for sorting the things out at +https://gcc.gnu.org/pipermail/gcc/2023-November/242888.html. + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202311150821.cI4yciFE-lkp@intel.com +Signed-off-by: Dmitry Antipov +Link: https://lore.kernel.org/r/20231120110607.98956-1-dmantipov@yandex.ru +Fixes: 50d7bd38c3aa ("stddef: Introduce struct_group() helper macro") +Signed-off-by: Kees Cook +Signed-off-by: Sasha Levin +--- + include/uapi/linux/stddef.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h +index 7837ba4fe7289..dcd50fb2164a1 100644 +--- a/include/uapi/linux/stddef.h ++++ b/include/uapi/linux/stddef.h +@@ -27,7 +27,7 @@ + union { \ + struct { MEMBERS } ATTRS; \ + struct TAG { MEMBERS } ATTRS NAME; \ +- } ++ } ATTRS + + /** + * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union +-- +2.42.0 + diff --git a/queue-5.15/usb-config-fix-iteration-issue-in-usb_get_bos_descri.patch b/queue-5.15/usb-config-fix-iteration-issue-in-usb_get_bos_descri.patch new file mode 100644 index 00000000000..4a668d585d8 --- /dev/null +++ b/queue-5.15/usb-config-fix-iteration-issue-in-usb_get_bos_descri.patch @@ -0,0 +1,57 @@ +From 5345b9fcef4597cee0d9e92a168858c0151c05a7 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 34de57c8e72b3..5f190bfe88000 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) { +@@ -1081,6 +1081,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.15/usb-core-change-configuration-warnings-to-notices.patch b/queue-5.15/usb-core-change-configuration-warnings-to-notices.patch new file mode 100644 index 00000000000..3b442042da3 --- /dev/null +++ b/queue-5.15/usb-core-change-configuration-warnings-to-notices.patch @@ -0,0 +1,401 @@ +From cbdab633b94da88c0a8716e6a1e0bed29348c6fa 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 00e28456e4cc2..34de57c8e72b3 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 + -- 2.47.3