+++ /dev/null
-From 3a5a8d343e1cf96eb9971b17cbd4b832ab19b8e7 Mon Sep 17 00:00:00 2001
-From: Ryan Roberts <ryan.roberts@arm.com>
-Date: Wed, 1 May 2024 15:33:10 +0100
-Subject: mm: fix race between __split_huge_pmd_locked() and GUP-fast
-
-From: Ryan Roberts <ryan.roberts@arm.com>
-
-commit 3a5a8d343e1cf96eb9971b17cbd4b832ab19b8e7 upstream.
-
-__split_huge_pmd_locked() can be called for a present THP, devmap or
-(non-present) migration entry. It calls pmdp_invalidate() unconditionally
-on the pmdp and only determines if it is present or not based on the
-returned old pmd. This is a problem for the migration entry case because
-pmd_mkinvalid(), called by pmdp_invalidate() must only be called for a
-present pmd.
-
-On arm64 at least, pmd_mkinvalid() will mark the pmd such that any future
-call to pmd_present() will return true. And therefore any lockless
-pgtable walker could see the migration entry pmd in this state and start
-interpretting the fields as if it were present, leading to BadThings (TM).
-GUP-fast appears to be one such lockless pgtable walker.
-
-x86 does not suffer the above problem, but instead pmd_mkinvalid() will
-corrupt the offset field of the swap entry within the swap pte. See link
-below for discussion of that problem.
-
-Fix all of this by only calling pmdp_invalidate() for a present pmd. And
-for good measure let's add a warning to all implementations of
-pmdp_invalidate[_ad](). I've manually reviewed all other
-pmdp_invalidate[_ad]() call sites and believe all others to be conformant.
-
-This is a theoretical bug found during code review. I don't have any test
-case to trigger it in practice.
-
-Link: https://lkml.kernel.org/r/20240501143310.1381675-1-ryan.roberts@arm.com
-Link: https://lore.kernel.org/all/0dd7827a-6334-439a-8fd0-43c98e6af22b@arm.com/
-Fixes: 84c3fc4e9c56 ("mm: thp: check pmd migration entry in common path")
-Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
-Reviewed-by: Zi Yan <ziy@nvidia.com>
-Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
-Acked-by: David Hildenbrand <david@redhat.com>
-Cc: Andreas Larsson <andreas@gaisler.com>
-Cc: Andy Lutomirski <luto@kernel.org>
-Cc: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
-Cc: Borislav Petkov (AMD) <bp@alien8.de>
-Cc: Catalin Marinas <catalin.marinas@arm.com>
-Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
-Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
-Cc: Dave Hansen <dave.hansen@linux.intel.com>
-Cc: "David S. Miller" <davem@davemloft.net>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jonathan Corbet <corbet@lwn.net>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
-Cc: Nicholas Piggin <npiggin@gmail.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Sven Schnelle <svens@linux.ibm.com>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Cc: Will Deacon <will@kernel.org>
-Cc: <stable@vger.kernel.org>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/powerpc/mm/pgtable-book3s64.c | 1
- arch/s390/include/asm/pgtable.h | 4 ++-
- arch/sparc/mm/tlb.c | 1
- mm/huge_memory.c | 49 +++++++++++++++++++------------------
- mm/pgtable-generic.c | 5 +++
- 5 files changed, 35 insertions(+), 25 deletions(-)
-
---- a/arch/powerpc/mm/pgtable-book3s64.c
-+++ b/arch/powerpc/mm/pgtable-book3s64.c
-@@ -106,6 +106,7 @@ pmd_t pmdp_invalidate(struct vm_area_str
- {
- unsigned long old_pmd;
-
-+ VM_WARN_ON_ONCE(!pmd_present(*pmdp));
- old_pmd = pmd_hugepage_update(vma->vm_mm, address, pmdp, _PAGE_PRESENT, 0);
- flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
- /*
---- a/arch/s390/include/asm/pgtable.h
-+++ b/arch/s390/include/asm/pgtable.h
-@@ -1532,8 +1532,10 @@ static inline pmd_t pmdp_huge_clear_flus
- static inline pmd_t pmdp_invalidate(struct vm_area_struct *vma,
- unsigned long addr, pmd_t *pmdp)
- {
-- pmd_t pmd = __pmd(pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
-+ pmd_t pmd;
-
-+ VM_WARN_ON_ONCE(!pmd_present(*pmdp));
-+ pmd = __pmd(pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
- return pmdp_xchg_direct(vma->vm_mm, addr, pmdp, pmd);
- }
-
---- a/arch/sparc/mm/tlb.c
-+++ b/arch/sparc/mm/tlb.c
-@@ -246,6 +246,7 @@ pmd_t pmdp_invalidate(struct vm_area_str
- {
- pmd_t old, entry;
-
-+ VM_WARN_ON_ONCE(!pmd_present(*pmdp));
- entry = __pmd(pmd_val(*pmdp) & ~_PAGE_VALID);
- old = pmdp_establish(vma, address, pmdp, entry);
- flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
---- a/mm/huge_memory.c
-+++ b/mm/huge_memory.c
-@@ -2168,38 +2168,41 @@ static void __split_huge_pmd_locked(stru
- return __split_huge_zero_page_pmd(vma, haddr, pmd);
- }
-
-- /*
-- * Up to this point the pmd is present and huge and userland has the
-- * whole access to the hugepage during the split (which happens in
-- * place). If we overwrite the pmd with the not-huge version pointing
-- * to the pte here (which of course we could if all CPUs were bug
-- * free), userland could trigger a small page size TLB miss on the
-- * small sized TLB while the hugepage TLB entry is still established in
-- * the huge TLB. Some CPU doesn't like that.
-- * See http://support.amd.com/us/Processor_TechDocs/41322.pdf, Erratum
-- * 383 on page 93. Intel should be safe but is also warns that it's
-- * only safe if the permission and cache attributes of the two entries
-- * loaded in the two TLB is identical (which should be the case here).
-- * But it is generally safer to never allow small and huge TLB entries
-- * for the same virtual address to be loaded simultaneously. So instead
-- * of doing "pmd_populate(); flush_pmd_tlb_range();" we first mark the
-- * current pmd notpresent (atomically because here the pmd_trans_huge
-- * must remain set at all times on the pmd until the split is complete
-- * for this pmd), then we flush the SMP TLB and finally we write the
-- * non-huge version of the pmd entry with pmd_populate.
-- */
-- old_pmd = pmdp_invalidate(vma, haddr, pmd);
--
-- pmd_migration = is_pmd_migration_entry(old_pmd);
-+ pmd_migration = is_pmd_migration_entry(*pmd);
- if (unlikely(pmd_migration)) {
- swp_entry_t entry;
-
-+ old_pmd = *pmd;
- entry = pmd_to_swp_entry(old_pmd);
- page = pfn_to_page(swp_offset(entry));
- write = is_write_migration_entry(entry);
- young = false;
- soft_dirty = pmd_swp_soft_dirty(old_pmd);
- } else {
-+ /*
-+ * Up to this point the pmd is present and huge and userland has
-+ * the whole access to the hugepage during the split (which
-+ * happens in place). If we overwrite the pmd with the not-huge
-+ * version pointing to the pte here (which of course we could if
-+ * all CPUs were bug free), userland could trigger a small page
-+ * size TLB miss on the small sized TLB while the hugepage TLB
-+ * entry is still established in the huge TLB. Some CPU doesn't
-+ * like that. See
-+ * http://support.amd.com/TechDocs/41322_10h_Rev_Gd.pdf, Erratum
-+ * 383 on page 105. Intel should be safe but is also warns that
-+ * it's only safe if the permission and cache attributes of the
-+ * two entries loaded in the two TLB is identical (which should
-+ * be the case here). But it is generally safer to never allow
-+ * small and huge TLB entries for the same virtual address to be
-+ * loaded simultaneously. So instead of doing "pmd_populate();
-+ * flush_pmd_tlb_range();" we first mark the current pmd
-+ * notpresent (atomically because here the pmd_trans_huge must
-+ * remain set at all times on the pmd until the split is
-+ * complete for this pmd), then we flush the SMP TLB and finally
-+ * we write the non-huge version of the pmd entry with
-+ * pmd_populate.
-+ */
-+ old_pmd = pmdp_invalidate(vma, haddr, pmd);
- page = pmd_page(old_pmd);
- if (pmd_dirty(old_pmd))
- SetPageDirty(page);
---- a/mm/pgtable-generic.c
-+++ b/mm/pgtable-generic.c
-@@ -184,7 +184,10 @@ pgtable_t pgtable_trans_huge_withdraw(st
- pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
- pmd_t *pmdp)
- {
-- pmd_t old = pmdp_establish(vma, address, pmdp, pmd_mknotpresent(*pmdp));
-+ pmd_t old;
-+
-+ VM_WARN_ON_ONCE(!pmd_present(*pmdp));
-+ old = pmdp_establish(vma, address, pmdp, pmd_mknotpresent(*pmdp));
- flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
- return old;
- }
regulator-core-fix-modpost-error-regulator_get_regma.patch
dmaengine-ioatdma-fix-missing-kmem_cache_destroy.patch
acpica-revert-acpica-avoid-info-mapping-multiple-bar.patch
-mm-fix-race-between-__split_huge_pmd_locked-and-gup-fast.patch
drm-radeon-fix-ubsan-warning-in-kv_dpm.c.patch
gcov-add-support-for-gcc-14.patch
arm-dts-samsung-smdkv310-fix-keypad-no-autorepeat.patch
+++ /dev/null
-From 2cf382de1e1ac754e72c6cbbbf66868d99251b70 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 30 May 2024 12:20:00 +0200
-Subject: gpio: tqmx86: introduce shadow register for GPIO output value
-
-From: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
-
-[ Upstream commit 9d6a811b522ba558bcb4ec01d12e72a0af8e9f6e ]
-
-The TQMx86 GPIO controller uses the same register address for input and
-output data. Reading the register will always return current inputs
-rather than the previously set outputs (regardless of the current
-direction setting). Therefore, using a RMW pattern does not make sense
-when setting output values. Instead, the previously set output register
-value needs to be stored as a shadow register.
-
-As there is no reliable way to get the current output values from the
-hardware, also initialize all channels to 0, to ensure that stored and
-actual output values match. This should usually not have any effect in
-practise, as the TQMx86 UEFI sets all outputs to 0 during boot.
-
-Also prepare for extension of the driver to more than 8 GPIOs by using
-DECLARE_BITMAP.
-
-Fixes: b868db94a6a7 ("gpio: tqmx86: Add GPIO from for this IO controller")
-Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-Link: https://lore.kernel.org/r/d0555933becd45fa92a85675d26e4d59343ddc01.1717063994.git.matthias.schiffer@ew.tq-group.com
-Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpio/gpio-tqmx86.c | 18 +++++++++++-------
- 1 file changed, 11 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
-index ea8b7c7f1fd45..d7b79f658faa6 100644
---- a/drivers/gpio/gpio-tqmx86.c
-+++ b/drivers/gpio/gpio-tqmx86.c
-@@ -6,6 +6,7 @@
- * Vadim V.Vlasov <vvlasov@dev.rtsoft.ru>
- */
-
-+#include <linux/bitmap.h>
- #include <linux/bitops.h>
- #include <linux/errno.h>
- #include <linux/gpio/driver.h>
-@@ -38,6 +39,7 @@ struct tqmx86_gpio_data {
- void __iomem *io_base;
- int irq;
- raw_spinlock_t spinlock;
-+ DECLARE_BITMAP(output, TQMX86_NGPIO);
- u8 irq_type[TQMX86_NGPI];
- };
-
-@@ -64,15 +66,10 @@ static void tqmx86_gpio_set(struct gpio_chip *chip, unsigned int offset,
- {
- struct tqmx86_gpio_data *gpio = gpiochip_get_data(chip);
- unsigned long flags;
-- u8 val;
-
- raw_spin_lock_irqsave(&gpio->spinlock, flags);
-- val = tqmx86_gpio_read(gpio, TQMX86_GPIOD);
-- if (value)
-- val |= BIT(offset);
-- else
-- val &= ~BIT(offset);
-- tqmx86_gpio_write(gpio, val, TQMX86_GPIOD);
-+ __assign_bit(offset, gpio->output, value);
-+ tqmx86_gpio_write(gpio, bitmap_get_value8(gpio->output, 0), TQMX86_GPIOD);
- raw_spin_unlock_irqrestore(&gpio->spinlock, flags);
- }
-
-@@ -258,6 +255,13 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
-
- tqmx86_gpio_write(gpio, (u8)~TQMX86_DIR_INPUT_MASK, TQMX86_GPIODD);
-
-+ /*
-+ * Reading the previous output state is not possible with TQMx86 hardware.
-+ * Initialize all outputs to 0 to have a defined state that matches the
-+ * shadow register.
-+ */
-+ tqmx86_gpio_write(gpio, 0, TQMX86_GPIOD);
-+
- chip = &gpio->chip;
- chip->label = "gpio-tqmx86";
- chip->owner = THIS_MODULE;
---
-2.43.0
-
+++ /dev/null
-From 94b8455c2f62f874a6dfa7ef13b5ed732abbf90d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 1 Aug 2023 23:38:39 +0300
-Subject: gpio: tqmx86: remove unneeded call to platform_set_drvdata()
-
-From: Andrei Coardos <aboutphysycs@gmail.com>
-
-[ Upstream commit 0a5e9306b812fe3517548fab92b3d3d6ce7576e5 ]
-
-This function call was found to be unnecessary as there is no equivalent
-platform_get_drvdata() call to access the private data of the driver. Also,
-the private data is defined in this driver, so there is no risk of it being
-accessed outside of this driver file.
-
-Reviewed-by: Alexandru Ardelean <alex@shruggie.ro>
-Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com>
-Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
-Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-Stable-dep-of: 9d6a811b522b ("gpio: tqmx86: introduce shadow register for GPIO output value")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpio/gpio-tqmx86.c | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
-index 09ca493b36176..ea8b7c7f1fd45 100644
---- a/drivers/gpio/gpio-tqmx86.c
-+++ b/drivers/gpio/gpio-tqmx86.c
-@@ -258,8 +258,6 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
-
- tqmx86_gpio_write(gpio, (u8)~TQMX86_DIR_INPUT_MASK, TQMX86_GPIODD);
-
-- platform_set_drvdata(pdev, gpio);
--
- chip = &gpio->chip;
- chip->label = "gpio-tqmx86";
- chip->owner = THIS_MODULE;
---
-2.43.0
-
+++ /dev/null
-From 3a5a8d343e1cf96eb9971b17cbd4b832ab19b8e7 Mon Sep 17 00:00:00 2001
-From: Ryan Roberts <ryan.roberts@arm.com>
-Date: Wed, 1 May 2024 15:33:10 +0100
-Subject: mm: fix race between __split_huge_pmd_locked() and GUP-fast
-
-From: Ryan Roberts <ryan.roberts@arm.com>
-
-commit 3a5a8d343e1cf96eb9971b17cbd4b832ab19b8e7 upstream.
-
-__split_huge_pmd_locked() can be called for a present THP, devmap or
-(non-present) migration entry. It calls pmdp_invalidate() unconditionally
-on the pmdp and only determines if it is present or not based on the
-returned old pmd. This is a problem for the migration entry case because
-pmd_mkinvalid(), called by pmdp_invalidate() must only be called for a
-present pmd.
-
-On arm64 at least, pmd_mkinvalid() will mark the pmd such that any future
-call to pmd_present() will return true. And therefore any lockless
-pgtable walker could see the migration entry pmd in this state and start
-interpretting the fields as if it were present, leading to BadThings (TM).
-GUP-fast appears to be one such lockless pgtable walker.
-
-x86 does not suffer the above problem, but instead pmd_mkinvalid() will
-corrupt the offset field of the swap entry within the swap pte. See link
-below for discussion of that problem.
-
-Fix all of this by only calling pmdp_invalidate() for a present pmd. And
-for good measure let's add a warning to all implementations of
-pmdp_invalidate[_ad](). I've manually reviewed all other
-pmdp_invalidate[_ad]() call sites and believe all others to be conformant.
-
-This is a theoretical bug found during code review. I don't have any test
-case to trigger it in practice.
-
-Link: https://lkml.kernel.org/r/20240501143310.1381675-1-ryan.roberts@arm.com
-Link: https://lore.kernel.org/all/0dd7827a-6334-439a-8fd0-43c98e6af22b@arm.com/
-Fixes: 84c3fc4e9c56 ("mm: thp: check pmd migration entry in common path")
-Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
-Reviewed-by: Zi Yan <ziy@nvidia.com>
-Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
-Acked-by: David Hildenbrand <david@redhat.com>
-Cc: Andreas Larsson <andreas@gaisler.com>
-Cc: Andy Lutomirski <luto@kernel.org>
-Cc: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
-Cc: Borislav Petkov (AMD) <bp@alien8.de>
-Cc: Catalin Marinas <catalin.marinas@arm.com>
-Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
-Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
-Cc: Dave Hansen <dave.hansen@linux.intel.com>
-Cc: "David S. Miller" <davem@davemloft.net>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jonathan Corbet <corbet@lwn.net>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
-Cc: Nicholas Piggin <npiggin@gmail.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Sven Schnelle <svens@linux.ibm.com>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Cc: Will Deacon <will@kernel.org>
-Cc: <stable@vger.kernel.org>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/powerpc/mm/book3s64/pgtable.c | 1
- arch/s390/include/asm/pgtable.h | 4 ++-
- arch/sparc/mm/tlb.c | 1
- mm/huge_memory.c | 49 +++++++++++++++++++------------------
- mm/pgtable-generic.c | 5 +++
- 5 files changed, 35 insertions(+), 25 deletions(-)
-
---- a/arch/powerpc/mm/book3s64/pgtable.c
-+++ b/arch/powerpc/mm/book3s64/pgtable.c
-@@ -107,6 +107,7 @@ pmd_t pmdp_invalidate(struct vm_area_str
- {
- unsigned long old_pmd;
-
-+ VM_WARN_ON_ONCE(!pmd_present(*pmdp));
- old_pmd = pmd_hugepage_update(vma->vm_mm, address, pmdp, _PAGE_PRESENT, _PAGE_INVALID);
- flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
- /*
---- a/arch/s390/include/asm/pgtable.h
-+++ b/arch/s390/include/asm/pgtable.h
-@@ -1609,8 +1609,10 @@ static inline pmd_t pmdp_huge_clear_flus
- static inline pmd_t pmdp_invalidate(struct vm_area_struct *vma,
- unsigned long addr, pmd_t *pmdp)
- {
-- pmd_t pmd = __pmd(pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
-+ pmd_t pmd;
-
-+ VM_WARN_ON_ONCE(!pmd_present(*pmdp));
-+ pmd = __pmd(pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
- return pmdp_xchg_direct(vma->vm_mm, addr, pmdp, pmd);
- }
-
---- a/arch/sparc/mm/tlb.c
-+++ b/arch/sparc/mm/tlb.c
-@@ -246,6 +246,7 @@ pmd_t pmdp_invalidate(struct vm_area_str
- {
- pmd_t old, entry;
-
-+ VM_WARN_ON_ONCE(!pmd_present(*pmdp));
- entry = __pmd(pmd_val(*pmdp) & ~_PAGE_VALID);
- old = pmdp_establish(vma, address, pmdp, entry);
- flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
---- a/mm/huge_memory.c
-+++ b/mm/huge_memory.c
-@@ -2198,38 +2198,41 @@ static void __split_huge_pmd_locked(stru
- return __split_huge_zero_page_pmd(vma, haddr, pmd);
- }
-
-- /*
-- * Up to this point the pmd is present and huge and userland has the
-- * whole access to the hugepage during the split (which happens in
-- * place). If we overwrite the pmd with the not-huge version pointing
-- * to the pte here (which of course we could if all CPUs were bug
-- * free), userland could trigger a small page size TLB miss on the
-- * small sized TLB while the hugepage TLB entry is still established in
-- * the huge TLB. Some CPU doesn't like that.
-- * See http://support.amd.com/us/Processor_TechDocs/41322.pdf, Erratum
-- * 383 on page 93. Intel should be safe but is also warns that it's
-- * only safe if the permission and cache attributes of the two entries
-- * loaded in the two TLB is identical (which should be the case here).
-- * But it is generally safer to never allow small and huge TLB entries
-- * for the same virtual address to be loaded simultaneously. So instead
-- * of doing "pmd_populate(); flush_pmd_tlb_range();" we first mark the
-- * current pmd notpresent (atomically because here the pmd_trans_huge
-- * must remain set at all times on the pmd until the split is complete
-- * for this pmd), then we flush the SMP TLB and finally we write the
-- * non-huge version of the pmd entry with pmd_populate.
-- */
-- old_pmd = pmdp_invalidate(vma, haddr, pmd);
--
-- pmd_migration = is_pmd_migration_entry(old_pmd);
-+ pmd_migration = is_pmd_migration_entry(*pmd);
- if (unlikely(pmd_migration)) {
- swp_entry_t entry;
-
-+ old_pmd = *pmd;
- entry = pmd_to_swp_entry(old_pmd);
- page = pfn_to_page(swp_offset(entry));
- write = is_write_migration_entry(entry);
- young = false;
- soft_dirty = pmd_swp_soft_dirty(old_pmd);
- } else {
-+ /*
-+ * Up to this point the pmd is present and huge and userland has
-+ * the whole access to the hugepage during the split (which
-+ * happens in place). If we overwrite the pmd with the not-huge
-+ * version pointing to the pte here (which of course we could if
-+ * all CPUs were bug free), userland could trigger a small page
-+ * size TLB miss on the small sized TLB while the hugepage TLB
-+ * entry is still established in the huge TLB. Some CPU doesn't
-+ * like that. See
-+ * http://support.amd.com/TechDocs/41322_10h_Rev_Gd.pdf, Erratum
-+ * 383 on page 105. Intel should be safe but is also warns that
-+ * it's only safe if the permission and cache attributes of the
-+ * two entries loaded in the two TLB is identical (which should
-+ * be the case here). But it is generally safer to never allow
-+ * small and huge TLB entries for the same virtual address to be
-+ * loaded simultaneously. So instead of doing "pmd_populate();
-+ * flush_pmd_tlb_range();" we first mark the current pmd
-+ * notpresent (atomically because here the pmd_trans_huge must
-+ * remain set at all times on the pmd until the split is
-+ * complete for this pmd), then we flush the SMP TLB and finally
-+ * we write the non-huge version of the pmd entry with
-+ * pmd_populate.
-+ */
-+ old_pmd = pmdp_invalidate(vma, haddr, pmd);
- page = pmd_page(old_pmd);
- if (pmd_dirty(old_pmd))
- SetPageDirty(page);
---- a/mm/pgtable-generic.c
-+++ b/mm/pgtable-generic.c
-@@ -185,7 +185,10 @@ pgtable_t pgtable_trans_huge_withdraw(st
- pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
- pmd_t *pmdp)
- {
-- pmd_t old = pmdp_establish(vma, address, pmdp, pmd_mknotpresent(*pmdp));
-+ pmd_t old;
-+
-+ VM_WARN_ON_ONCE(!pmd_present(*pmdp));
-+ old = pmdp_establish(vma, address, pmdp, pmd_mknotpresent(*pmdp));
- flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
- return old;
- }
+++ /dev/null
-From 38880b7913c75122ce831aea1e4d3a68412c3766 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 12 Feb 2022 21:23:11 +0530
-Subject: net: lan743x: Add PCI11010 / PCI11414 device IDs
-
-From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-
-[ Upstream commit bb4f6bffe33c8791549cb634d7b053aa5c3d1131 ]
-
-PCI11010/PCI11414 devices are enhancement of Ethernet LAN743x chip family.
-
-Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: 7725363936a8 ("net: lan743x: disable WOL upon resume to restore full data path operation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/microchip/lan743x_main.c | 2 ++
- drivers/net/ethernet/microchip/lan743x_main.h | 11 +++++++++--
- 2 files changed, 11 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
-index 083f7a051ca38..417fb4b8761dc 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -3051,6 +3051,8 @@ static const struct dev_pm_ops lan743x_pm_ops = {
- static const struct pci_device_id lan743x_pcidev_tbl[] = {
- { PCI_DEVICE(PCI_VENDOR_ID_SMSC, PCI_DEVICE_ID_SMSC_LAN7430) },
- { PCI_DEVICE(PCI_VENDOR_ID_SMSC, PCI_DEVICE_ID_SMSC_LAN7431) },
-+ { PCI_DEVICE(PCI_VENDOR_ID_SMSC, PCI_DEVICE_ID_SMSC_A011) },
-+ { PCI_DEVICE(PCI_VENDOR_ID_SMSC, PCI_DEVICE_ID_SMSC_A041) },
- { 0, }
- };
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
-index 1fbcef3910989..a8ff2bd12f63a 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -15,8 +15,13 @@
- #define ID_REV_ID_MASK_ (0xFFFF0000)
- #define ID_REV_ID_LAN7430_ (0x74300000)
- #define ID_REV_ID_LAN7431_ (0x74310000)
--#define ID_REV_IS_VALID_CHIP_ID_(id_rev) \
-- (((id_rev) & 0xFFF00000) == 0x74300000)
-+#define ID_REV_ID_LAN743X_ (0x74300000)
-+#define ID_REV_ID_A011_ (0xA0110000) // PCI11010
-+#define ID_REV_ID_A041_ (0xA0410000) // PCI11414
-+#define ID_REV_ID_A0X1_ (0xA0010000)
-+#define ID_REV_IS_VALID_CHIP_ID_(id_rev) \
-+ ((((id_rev) & 0xFFF00000) == ID_REV_ID_LAN743X_) || \
-+ (((id_rev) & 0xFF0F0000) == ID_REV_ID_A0X1_))
- #define ID_REV_CHIP_REV_MASK_ (0x0000FFFF)
- #define ID_REV_CHIP_REV_A0_ (0x00000000)
- #define ID_REV_CHIP_REV_B0_ (0x00000010)
-@@ -553,6 +558,8 @@ struct lan743x_adapter;
- #define PCI_VENDOR_ID_SMSC PCI_VENDOR_ID_EFAR
- #define PCI_DEVICE_ID_SMSC_LAN7430 (0x7430)
- #define PCI_DEVICE_ID_SMSC_LAN7431 (0x7431)
-+#define PCI_DEVICE_ID_SMSC_A011 (0xA011)
-+#define PCI_DEVICE_ID_SMSC_A041 (0xA041)
-
- #define PCI_CONFIG_LENGTH (0x1000)
-
---
-2.43.0
-
+++ /dev/null
-From f9dbac9e8c8d810b41afc60ed9556a17c6d74738 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 12 Feb 2022 21:23:12 +0530
-Subject: net: lan743x: Add support for 4 Tx queues
-
-From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-
-[ Upstream commit cf9aaea8e55b3f80488975a76fa4ca2ffaedcedd ]
-
-Add support for 4 Tx queues
-
-Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: 7725363936a8 ("net: lan743x: disable WOL upon resume to restore full data path operation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/microchip/lan743x_main.c | 83 +++++++++++++++----
- drivers/net/ethernet/microchip/lan743x_main.h | 12 ++-
- drivers/net/ethernet/microchip/lan743x_ptp.c | 8 +-
- 3 files changed, 79 insertions(+), 24 deletions(-)
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
-index 417fb4b8761dc..d2a98d633e97a 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -15,6 +15,18 @@
- #include "lan743x_main.h"
- #include "lan743x_ethtool.h"
-
-+static bool is_pci11x1x_chip(struct lan743x_adapter *adapter)
-+{
-+ struct lan743x_csr *csr = &adapter->csr;
-+ u32 id_rev = csr->id_rev;
-+
-+ if (((id_rev & 0xFFFF0000) == ID_REV_ID_A011_) ||
-+ ((id_rev & 0xFFFF0000) == ID_REV_ID_A041_)) {
-+ return true;
-+ }
-+ return false;
-+}
-+
- static void lan743x_pci_cleanup(struct lan743x_adapter *adapter)
- {
- pci_release_selected_regions(adapter->pdev,
-@@ -263,7 +275,7 @@ static void lan743x_intr_shared_isr(void *context, u32 int_sts, u32 flags)
- }
- }
- if (int_sts & INT_BIT_ALL_TX_) {
-- for (channel = 0; channel < LAN743X_USED_TX_CHANNELS;
-+ for (channel = 0; channel < adapter->used_tx_channels;
- channel++) {
- u32 int_bit = INT_BIT_DMA_TX_(channel);
-
-@@ -465,6 +477,7 @@ static int lan743x_intr_open(struct lan743x_adapter *adapter)
- {
- struct msix_entry msix_entries[LAN743X_MAX_VECTOR_COUNT];
- struct lan743x_intr *intr = &adapter->intr;
-+ unsigned int used_tx_channels;
- u32 int_vec_en_auto_clr = 0;
- u32 int_vec_map0 = 0;
- u32 int_vec_map1 = 0;
-@@ -479,9 +492,10 @@ static int lan743x_intr_open(struct lan743x_adapter *adapter)
- sizeof(struct msix_entry) * LAN743X_MAX_VECTOR_COUNT);
- for (index = 0; index < LAN743X_MAX_VECTOR_COUNT; index++)
- msix_entries[index].entry = index;
-+ used_tx_channels = adapter->used_tx_channels;
- ret = pci_enable_msix_range(adapter->pdev,
- msix_entries, 1,
-- 1 + LAN743X_USED_TX_CHANNELS +
-+ 1 + used_tx_channels +
- LAN743X_USED_RX_CHANNELS);
-
- if (ret > 0) {
-@@ -586,8 +600,8 @@ static int lan743x_intr_open(struct lan743x_adapter *adapter)
- if (intr->number_of_vectors > 1) {
- int number_of_tx_vectors = intr->number_of_vectors - 1;
-
-- if (number_of_tx_vectors > LAN743X_USED_TX_CHANNELS)
-- number_of_tx_vectors = LAN743X_USED_TX_CHANNELS;
-+ if (number_of_tx_vectors > used_tx_channels)
-+ number_of_tx_vectors = used_tx_channels;
- flags = LAN743X_VECTOR_FLAG_SOURCE_STATUS_READ |
- LAN743X_VECTOR_FLAG_SOURCE_STATUS_W2C |
- LAN743X_VECTOR_FLAG_SOURCE_ENABLE_CHECK |
-@@ -625,9 +639,9 @@ static int lan743x_intr_open(struct lan743x_adapter *adapter)
- INT_VEC_EN_(vector));
- }
- }
-- if ((intr->number_of_vectors - LAN743X_USED_TX_CHANNELS) > 1) {
-+ if ((intr->number_of_vectors - used_tx_channels) > 1) {
- int number_of_rx_vectors = intr->number_of_vectors -
-- LAN743X_USED_TX_CHANNELS - 1;
-+ used_tx_channels - 1;
-
- if (number_of_rx_vectors > LAN743X_USED_RX_CHANNELS)
- number_of_rx_vectors = LAN743X_USED_RX_CHANNELS;
-@@ -2488,7 +2502,8 @@ static int lan743x_netdev_close(struct net_device *netdev)
- struct lan743x_adapter *adapter = netdev_priv(netdev);
- int index;
-
-- lan743x_tx_close(&adapter->tx[0]);
-+ for (index = 0; index < adapter->used_tx_channels; index++)
-+ lan743x_tx_close(&adapter->tx[index]);
-
- for (index = 0; index < LAN743X_USED_RX_CHANNELS; index++)
- lan743x_rx_close(&adapter->rx[index]);
-@@ -2534,12 +2549,19 @@ static int lan743x_netdev_open(struct net_device *netdev)
- goto close_rx;
- }
-
-- ret = lan743x_tx_open(&adapter->tx[0]);
-- if (ret)
-- goto close_rx;
--
-+ for (index = 0; index < adapter->used_tx_channels; index++) {
-+ ret = lan743x_tx_open(&adapter->tx[index]);
-+ if (ret)
-+ goto close_tx;
-+ }
- return 0;
-
-+close_tx:
-+ for (index = 0; index < adapter->used_tx_channels; index++) {
-+ if (adapter->tx[index].ring_cpu_ptr)
-+ lan743x_tx_close(&adapter->tx[index]);
-+ }
-+
- close_rx:
- for (index = 0; index < LAN743X_USED_RX_CHANNELS; index++) {
- if (adapter->rx[index].ring_cpu_ptr)
-@@ -2566,8 +2588,12 @@ static netdev_tx_t lan743x_netdev_xmit_frame(struct sk_buff *skb,
- struct net_device *netdev)
- {
- struct lan743x_adapter *adapter = netdev_priv(netdev);
-+ u8 ch = 0;
-+
-+ if (adapter->is_pci11x1x)
-+ ch = skb->queue_mapping % PCI11X1X_USED_TX_CHANNELS;
-
-- return lan743x_tx_xmit_frame(&adapter->tx[0], skb);
-+ return lan743x_tx_xmit_frame(&adapter->tx[ch], skb);
- }
-
- static int lan743x_netdev_ioctl(struct net_device *netdev,
-@@ -2698,6 +2724,15 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
- int index;
- int ret;
-
-+ adapter->is_pci11x1x = is_pci11x1x_chip(adapter);
-+ if (adapter->is_pci11x1x) {
-+ adapter->max_tx_channels = PCI11X1X_MAX_TX_CHANNELS;
-+ adapter->used_tx_channels = PCI11X1X_USED_TX_CHANNELS;
-+ } else {
-+ adapter->max_tx_channels = LAN743X_MAX_TX_CHANNELS;
-+ adapter->used_tx_channels = LAN743X_USED_TX_CHANNELS;
-+ }
-+
- adapter->intr.irq = adapter->pdev->irq;
- lan743x_csr_write(adapter, INT_EN_CLR, 0xFFFFFFFF);
-
-@@ -2728,10 +2763,13 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
- adapter->rx[index].channel_number = index;
- }
-
-- tx = &adapter->tx[0];
-- tx->adapter = adapter;
-- tx->channel_number = 0;
-- spin_lock_init(&tx->ring_lock);
-+ for (index = 0; index < adapter->used_tx_channels; index++) {
-+ tx = &adapter->tx[index];
-+ tx->adapter = adapter;
-+ tx->channel_number = index;
-+ spin_lock_init(&tx->ring_lock);
-+ }
-+
- return 0;
- }
-
-@@ -2783,8 +2821,17 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev,
- struct net_device *netdev = NULL;
- int ret = -ENODEV;
-
-- netdev = devm_alloc_etherdev(&pdev->dev,
-- sizeof(struct lan743x_adapter));
-+ if (id->device == PCI_DEVICE_ID_SMSC_A011 ||
-+ id->device == PCI_DEVICE_ID_SMSC_A041) {
-+ netdev = devm_alloc_etherdev_mqs(&pdev->dev,
-+ sizeof(struct lan743x_adapter),
-+ PCI11X1X_USED_TX_CHANNELS,
-+ LAN743X_USED_RX_CHANNELS);
-+ } else {
-+ netdev = devm_alloc_etherdev(&pdev->dev,
-+ sizeof(struct lan743x_adapter));
-+ }
-+
- if (!netdev)
- goto return_error;
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
-index a8ff2bd12f63a..9769ee004423d 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -540,10 +540,12 @@
-
- #define LAN743X_MAX_RX_CHANNELS (4)
- #define LAN743X_MAX_TX_CHANNELS (1)
-+#define PCI11X1X_MAX_TX_CHANNELS (4)
- struct lan743x_adapter;
-
- #define LAN743X_USED_RX_CHANNELS (4)
- #define LAN743X_USED_TX_CHANNELS (1)
-+#define PCI11X1X_USED_TX_CHANNELS (4)
- #define LAN743X_INT_MOD (400)
-
- #if (LAN743X_USED_RX_CHANNELS > LAN743X_MAX_RX_CHANNELS)
-@@ -552,6 +554,9 @@ struct lan743x_adapter;
- #if (LAN743X_USED_TX_CHANNELS > LAN743X_MAX_TX_CHANNELS)
- #error Invalid LAN743X_USED_TX_CHANNELS
- #endif
-+#if (PCI11X1X_USED_TX_CHANNELS > PCI11X1X_MAX_TX_CHANNELS)
-+#error Invalid PCI11X1X_USED_TX_CHANNELS
-+#endif
-
- /* PCI */
- /* SMSC acquired EFAR late 1990's, MCHP acquired SMSC 2012 */
-@@ -719,8 +724,11 @@ struct lan743x_adapter {
- u8 mac_address[ETH_ALEN];
-
- struct lan743x_phy phy;
-- struct lan743x_tx tx[LAN743X_MAX_TX_CHANNELS];
-- struct lan743x_rx rx[LAN743X_MAX_RX_CHANNELS];
-+ struct lan743x_tx tx[PCI11X1X_USED_TX_CHANNELS];
-+ struct lan743x_rx rx[LAN743X_USED_RX_CHANNELS];
-+ bool is_pci11x1x;
-+ u8 max_tx_channels;
-+ u8 used_tx_channels;
-
- #define LAN743X_ADAPTER_FLAG_OTP BIT(0)
- u32 flags;
-diff --git a/drivers/net/ethernet/microchip/lan743x_ptp.c b/drivers/net/ethernet/microchip/lan743x_ptp.c
-index e8fe9a90fe4f9..d099d6c7cd07d 100644
---- a/drivers/net/ethernet/microchip/lan743x_ptp.c
-+++ b/drivers/net/ethernet/microchip/lan743x_ptp.c
-@@ -1127,21 +1127,21 @@ int lan743x_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
-
- switch (config.tx_type) {
- case HWTSTAMP_TX_OFF:
-- for (index = 0; index < LAN743X_MAX_TX_CHANNELS;
-- index++)
-+ for (index = 0; index < adapter->used_tx_channels;
-+ index++)
- lan743x_tx_set_timestamping_mode(&adapter->tx[index],
- false, false);
- lan743x_ptp_set_sync_ts_insert(adapter, false);
- break;
- case HWTSTAMP_TX_ON:
-- for (index = 0; index < LAN743X_MAX_TX_CHANNELS;
-+ for (index = 0; index < adapter->used_tx_channels;
- index++)
- lan743x_tx_set_timestamping_mode(&adapter->tx[index],
- true, false);
- lan743x_ptp_set_sync_ts_insert(adapter, false);
- break;
- case HWTSTAMP_TX_ONESTEP_SYNC:
-- for (index = 0; index < LAN743X_MAX_TX_CHANNELS;
-+ for (index = 0; index < adapter->used_tx_channels;
- index++)
- lan743x_tx_set_timestamping_mode(&adapter->tx[index],
- true, true);
---
-2.43.0
-
+++ /dev/null
-From 9fd7960ea22db50aa7ea1cd62dc4a6b3fda187a5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 12 Feb 2022 21:23:14 +0530
-Subject: net: lan743x: Add support for SGMII interface
-
-From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-
-[ Upstream commit a46d9d37c4f4fa16c3f1915a1b0a19c31fed5099 ]
-
-This change facilitates the selection between SGMII and (R)GIII
-interfaces
-
-Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: 8c248cd83601 ("net: lan743x: Support WOL at both the PHY and MAC appropriately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/microchip/lan743x_main.c | 48 +++++++++++++++++++
- drivers/net/ethernet/microchip/lan743x_main.h | 17 +++++++
- 2 files changed, 65 insertions(+)
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
-index 9f39afdfd415e..f77d3221072d9 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -15,6 +15,34 @@
- #include "lan743x_main.h"
- #include "lan743x_ethtool.h"
-
-+static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
-+{
-+ u32 chip_rev;
-+ u32 strap;
-+
-+ strap = lan743x_csr_read(adapter, STRAP_READ);
-+ if (strap & STRAP_READ_USE_SGMII_EN_) {
-+ if (strap & STRAP_READ_SGMII_EN_)
-+ adapter->is_sgmii_en = true;
-+ else
-+ adapter->is_sgmii_en = false;
-+ netif_dbg(adapter, drv, adapter->netdev,
-+ "STRAP_READ: 0x%08X\n", strap);
-+ } else {
-+ chip_rev = lan743x_csr_read(adapter, FPGA_REV);
-+ if (chip_rev) {
-+ if (chip_rev & FPGA_SGMII_OP)
-+ adapter->is_sgmii_en = true;
-+ else
-+ adapter->is_sgmii_en = false;
-+ netif_dbg(adapter, drv, adapter->netdev,
-+ "FPGA_REV: 0x%08X\n", chip_rev);
-+ } else {
-+ adapter->is_sgmii_en = false;
-+ }
-+ }
-+}
-+
- static bool is_pci11x1x_chip(struct lan743x_adapter *adapter)
- {
- struct lan743x_csr *csr = &adapter->csr;
-@@ -2741,6 +2769,7 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
- adapter->max_tx_channels = PCI11X1X_MAX_TX_CHANNELS;
- adapter->used_tx_channels = PCI11X1X_USED_TX_CHANNELS;
- adapter->max_vector_count = PCI11X1X_MAX_VECTOR_COUNT;
-+ pci11x1x_strap_get_status(adapter);
- } else {
- adapter->max_tx_channels = LAN743X_MAX_TX_CHANNELS;
- adapter->used_tx_channels = LAN743X_USED_TX_CHANNELS;
-@@ -2789,6 +2818,7 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
-
- static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)
- {
-+ u32 sgmii_ctl;
- int ret;
-
- adapter->mdiobus = devm_mdiobus_alloc(&adapter->pdev->dev);
-@@ -2798,6 +2828,24 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)
- }
-
- adapter->mdiobus->priv = (void *)adapter;
-+ if (adapter->is_pci11x1x) {
-+ if (adapter->is_sgmii_en) {
-+ sgmii_ctl = lan743x_csr_read(adapter, SGMII_CTL);
-+ sgmii_ctl |= SGMII_CTL_SGMII_ENABLE_;
-+ sgmii_ctl &= ~SGMII_CTL_SGMII_POWER_DN_;
-+ lan743x_csr_write(adapter, SGMII_CTL, sgmii_ctl);
-+ netif_dbg(adapter, drv, adapter->netdev,
-+ "SGMII operation\n");
-+ } else {
-+ sgmii_ctl = lan743x_csr_read(adapter, SGMII_CTL);
-+ sgmii_ctl &= ~SGMII_CTL_SGMII_ENABLE_;
-+ sgmii_ctl |= SGMII_CTL_SGMII_POWER_DN_;
-+ lan743x_csr_write(adapter, SGMII_CTL, sgmii_ctl);
-+ netif_dbg(adapter, drv, adapter->netdev,
-+ "(R)GMII operation\n");
-+ }
-+ }
-+
- adapter->mdiobus->read = lan743x_mdiobus_read;
- adapter->mdiobus->write = lan743x_mdiobus_write;
- adapter->mdiobus->name = "lan743x-mdiobus";
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
-index 52d787aed0d17..1825021c63f81 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -29,6 +29,17 @@
- #define FPGA_REV (0x04)
- #define FPGA_REV_GET_MINOR_(fpga_rev) (((fpga_rev) >> 8) & 0x000000FF)
- #define FPGA_REV_GET_MAJOR_(fpga_rev) ((fpga_rev) & 0x000000FF)
-+#define FPGA_SGMII_OP BIT(24)
-+
-+#define STRAP_READ (0x0C)
-+#define STRAP_READ_USE_SGMII_EN_ BIT(22)
-+#define STRAP_READ_SGMII_EN_ BIT(6)
-+#define STRAP_READ_SGMII_REFCLK_ BIT(5)
-+#define STRAP_READ_SGMII_2_5G_ BIT(4)
-+#define STRAP_READ_BASE_X_ BIT(3)
-+#define STRAP_READ_RGMII_TXC_DELAY_EN_ BIT(2)
-+#define STRAP_READ_RGMII_RXC_DELAY_EN_ BIT(1)
-+#define STRAP_READ_ADV_PM_DISABLE_ BIT(0)
-
- #define HW_CFG (0x010)
- #define HW_CFG_RST_PROTECT_PCIE_ BIT(19)
-@@ -246,6 +257,11 @@
- #define MAC_WUCSR2_IPV6_TCPSYN_RCD_ BIT(5)
- #define MAC_WUCSR2_IPV4_TCPSYN_RCD_ BIT(4)
-
-+#define SGMII_CTL (0x728)
-+#define SGMII_CTL_SGMII_ENABLE_ BIT(31)
-+#define SGMII_CTL_LINK_STATUS_SOURCE_ BIT(8)
-+#define SGMII_CTL_SGMII_POWER_DN_ BIT(1)
-+
- #define INT_STS (0x780)
- #define INT_BIT_DMA_RX_(channel) BIT(24 + (channel))
- #define INT_BIT_ALL_RX_ (0x0F000000)
-@@ -763,6 +779,7 @@ struct lan743x_adapter {
- struct lan743x_tx tx[PCI11X1X_USED_TX_CHANNELS];
- struct lan743x_rx rx[LAN743X_USED_RX_CHANNELS];
- bool is_pci11x1x;
-+ bool is_sgmii_en;
- u8 max_tx_channels;
- u8 used_tx_channels;
- u8 max_vector_count;
---
-2.43.0
-
+++ /dev/null
-From b8bbd8e71c54ce8b790c4ee74b9e0d09fb2509e6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 16 Jun 2022 09:42:24 +0530
-Subject: net: lan743x: Add support to Secure-ON WOL
-
-From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-
-[ Upstream commit 6b3768ac8e2b3e3594f6851a073f2a11cfb82719 ]
-
-Add support to Magic Packet Detection with Secure-ON for PCI11010/PCI11414 chips
-
-Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 7725363936a8 ("net: lan743x: disable WOL upon resume to restore full data path operation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../net/ethernet/microchip/lan743x_ethtool.c | 12 ++++++++
- drivers/net/ethernet/microchip/lan743x_main.c | 29 +++++++++++++++++++
- drivers/net/ethernet/microchip/lan743x_main.h | 10 +++++++
- 3 files changed, 51 insertions(+)
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
-index eedec13460787..469a591cf9cd2 100644
---- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
-+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
-@@ -787,7 +787,12 @@ static void lan743x_ethtool_get_wol(struct net_device *netdev,
- wol->supported |= WAKE_BCAST | WAKE_UCAST | WAKE_MCAST |
- WAKE_MAGIC | WAKE_PHY | WAKE_ARP;
-
-+ if (adapter->is_pci11x1x)
-+ wol->supported |= WAKE_MAGICSECURE;
-+
- wol->wolopts |= adapter->wolopts;
-+ if (adapter->wolopts & WAKE_MAGICSECURE)
-+ memcpy(wol->sopass, adapter->sopass, sizeof(wol->sopass));
- }
-
- static int lan743x_ethtool_set_wol(struct net_device *netdev,
-@@ -808,6 +813,13 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
- adapter->wolopts |= WAKE_PHY;
- if (wol->wolopts & WAKE_ARP)
- adapter->wolopts |= WAKE_ARP;
-+ if (wol->wolopts & WAKE_MAGICSECURE &&
-+ wol->wolopts & WAKE_MAGIC) {
-+ memcpy(adapter->sopass, wol->sopass, sizeof(wol->sopass));
-+ adapter->wolopts |= WAKE_MAGICSECURE;
-+ } else {
-+ memset(adapter->sopass, 0, sizeof(u8) * SOPASS_MAX);
-+ }
-
- device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts);
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
-index d2a98d633e97a..114dd5847c958 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -2940,6 +2940,7 @@ static void lan743x_pm_set_wol(struct lan743x_adapter *adapter)
- const u8 ipv6_multicast[3] = { 0x33, 0x33 };
- const u8 arp_type[2] = { 0x08, 0x06 };
- int mask_index;
-+ u32 sopass;
- u32 pmtctl;
- u32 wucsr;
- u32 macrx;
-@@ -3034,6 +3035,14 @@ static void lan743x_pm_set_wol(struct lan743x_adapter *adapter)
- pmtctl |= PMT_CTL_RX_FCT_RFE_D3_CLK_OVR_;
- }
-
-+ if (adapter->wolopts & WAKE_MAGICSECURE) {
-+ sopass = *(u32 *)adapter->sopass;
-+ lan743x_csr_write(adapter, MAC_MP_SO_LO, sopass);
-+ sopass = *(u16 *)&adapter->sopass[4];
-+ lan743x_csr_write(adapter, MAC_MP_SO_HI, sopass);
-+ wucsr |= MAC_MP_SO_EN_;
-+ }
-+
- lan743x_csr_write(adapter, MAC_WUCSR, wucsr);
- lan743x_csr_write(adapter, PMT_CTL, pmtctl);
- lan743x_csr_write(adapter, MAC_RX, macrx);
-@@ -3044,6 +3053,7 @@ static int lan743x_pm_suspend(struct device *dev)
- struct pci_dev *pdev = to_pci_dev(dev);
- struct net_device *netdev = pci_get_drvdata(pdev);
- struct lan743x_adapter *adapter = netdev_priv(netdev);
-+ u32 data;
-
- lan743x_pcidev_shutdown(pdev);
-
-@@ -3055,6 +3065,18 @@ static int lan743x_pm_suspend(struct device *dev)
- if (adapter->wolopts)
- lan743x_pm_set_wol(adapter);
-
-+ if (adapter->is_pci11x1x) {
-+ /* Save HW_CFG to config again in PM resume */
-+ data = lan743x_csr_read(adapter, HW_CFG);
-+ adapter->hw_cfg = data;
-+ data |= (HW_CFG_RST_PROTECT_PCIE_ |
-+ HW_CFG_D3_RESET_DIS_ |
-+ HW_CFG_D3_VAUX_OVR_ |
-+ HW_CFG_HOT_RESET_DIS_ |
-+ HW_CFG_RST_PROTECT_);
-+ lan743x_csr_write(adapter, HW_CFG, data);
-+ }
-+
- /* Host sets PME_En, put D3hot */
- return pci_prepare_to_sleep(pdev);;
- }
-@@ -3070,6 +3092,10 @@ static int lan743x_pm_resume(struct device *dev)
- pci_restore_state(pdev);
- pci_save_state(pdev);
-
-+ /* Restore HW_CFG that was saved during pm suspend */
-+ if (adapter->is_pci11x1x)
-+ lan743x_csr_write(adapter, HW_CFG, adapter->hw_cfg);
-+
- ret = lan743x_hardware_init(adapter, pdev);
- if (ret) {
- netif_err(adapter, probe, adapter->netdev,
-@@ -3086,6 +3112,9 @@ static int lan743x_pm_resume(struct device *dev)
- lan743x_netdev_open(netdev);
-
- netif_device_attach(netdev);
-+ ret = lan743x_csr_read(adapter, MAC_WK_SRC);
-+ netif_info(adapter, drv, adapter->netdev,
-+ "Wakeup source : 0x%08X\n", ret);
-
- return 0;
- }
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
-index 9769ee004423d..5c8bcc5cecc8a 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -31,6 +31,11 @@
- #define FPGA_REV_GET_MAJOR_(fpga_rev) ((fpga_rev) & 0x000000FF)
-
- #define HW_CFG (0x010)
-+#define HW_CFG_RST_PROTECT_PCIE_ BIT(19)
-+#define HW_CFG_HOT_RESET_DIS_ BIT(15)
-+#define HW_CFG_D3_VAUX_OVR_ BIT(14)
-+#define HW_CFG_D3_RESET_DIS_ BIT(13)
-+#define HW_CFG_RST_PROTECT_ BIT(12)
- #define HW_CFG_RELOAD_TYPE_ALL_ (0x00000FC0)
- #define HW_CFG_EE_OTP_RELOAD_ BIT(4)
- #define HW_CFG_LRST_ BIT(1)
-@@ -148,6 +153,7 @@
- #define MAC_EEE_TX_LPI_REQ_DLY_CNT (0x130)
-
- #define MAC_WUCSR (0x140)
-+#define MAC_MP_SO_EN_ BIT(21)
- #define MAC_WUCSR_RFE_WAKE_EN_ BIT(14)
- #define MAC_WUCSR_PFDA_EN_ BIT(3)
- #define MAC_WUCSR_WAKE_EN_ BIT(2)
-@@ -155,6 +161,8 @@
- #define MAC_WUCSR_BCST_EN_ BIT(0)
-
- #define MAC_WK_SRC (0x144)
-+#define MAC_MP_SO_HI (0x148)
-+#define MAC_MP_SO_LO (0x14C)
-
- #define MAC_WUF_CFG0 (0x150)
- #define MAC_NUM_OF_WUF_CFG (32)
-@@ -713,6 +721,7 @@ struct lan743x_adapter {
- int msg_enable;
- #ifdef CONFIG_PM
- u32 wolopts;
-+ u8 sopass[SOPASS_MAX];
- #endif
- struct pci_dev *pdev;
- struct lan743x_csr csr;
-@@ -732,6 +741,7 @@ struct lan743x_adapter {
-
- #define LAN743X_ADAPTER_FLAG_OTP BIT(0)
- u32 flags;
-+ u32 hw_cfg;
- };
-
- #define LAN743X_COMPONENT_FLAG_RX(channel) BIT(20 + (channel))
---
-2.43.0
-
+++ /dev/null
-From 4c9084c176f54a24daf3c3d777e38897dd9d1c33 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 14 Jun 2024 22:41:55 +0530
-Subject: net: lan743x: disable WOL upon resume to restore full data path
- operation
-
-From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-
-[ Upstream commit 7725363936a88351b71495774c1e0e852ae4cdca ]
-
-When Wake-on-LAN (WoL) is active and the system is in suspend mode, triggering
-a system event can wake the system from sleep, which may block the data path.
-To restore normal data path functionality after waking, disable all wake-up
-events. Furthermore, clear all Write 1 to Clear (W1C) status bits by writing
-1's to them.
-
-Fixes: 4d94282afd95 ("lan743x: Add power management support")
-Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
-Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/microchip/lan743x_main.c | 30 ++++++++++++++++---
- drivers/net/ethernet/microchip/lan743x_main.h | 24 +++++++++++++++
- 2 files changed, 50 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
-index 114dd5847c958..b07033c2851e4 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -2951,7 +2951,7 @@ static void lan743x_pm_set_wol(struct lan743x_adapter *adapter)
-
- /* clear wake settings */
- pmtctl = lan743x_csr_read(adapter, PMT_CTL);
-- pmtctl |= PMT_CTL_WUPS_MASK_;
-+ pmtctl |= PMT_CTL_WUPS_MASK_ | PMT_CTL_RES_CLR_WKP_MASK_;
- pmtctl &= ~(PMT_CTL_GPIO_WAKEUP_EN_ | PMT_CTL_EEE_WAKEUP_EN_ |
- PMT_CTL_WOL_EN_ | PMT_CTL_MAC_D3_RX_CLK_OVR_ |
- PMT_CTL_RX_FCT_RFE_D3_CLK_OVR_ | PMT_CTL_ETH_PHY_WAKE_EN_);
-@@ -3086,6 +3086,7 @@ static int lan743x_pm_resume(struct device *dev)
- struct pci_dev *pdev = to_pci_dev(dev);
- struct net_device *netdev = pci_get_drvdata(pdev);
- struct lan743x_adapter *adapter = netdev_priv(netdev);
-+ u32 data;
- int ret;
-
- pci_set_power_state(pdev, PCI_D0);
-@@ -3104,6 +3105,30 @@ static int lan743x_pm_resume(struct device *dev)
- return ret;
- }
-
-+ ret = lan743x_csr_read(adapter, MAC_WK_SRC);
-+ netif_dbg(adapter, drv, adapter->netdev,
-+ "Wakeup source : 0x%08X\n", ret);
-+
-+ /* Clear the wol configuration and status bits. Note that
-+ * the status bits are "Write One to Clear (W1C)"
-+ */
-+ data = MAC_WUCSR_EEE_TX_WAKE_ | MAC_WUCSR_EEE_RX_WAKE_ |
-+ MAC_WUCSR_RFE_WAKE_FR_ | MAC_WUCSR_PFDA_FR_ | MAC_WUCSR_WUFR_ |
-+ MAC_WUCSR_MPR_ | MAC_WUCSR_BCAST_FR_;
-+ lan743x_csr_write(adapter, MAC_WUCSR, data);
-+
-+ data = MAC_WUCSR2_NS_RCD_ | MAC_WUCSR2_ARP_RCD_ |
-+ MAC_WUCSR2_IPV6_TCPSYN_RCD_ | MAC_WUCSR2_IPV4_TCPSYN_RCD_;
-+ lan743x_csr_write(adapter, MAC_WUCSR2, data);
-+
-+ data = MAC_WK_SRC_ETH_PHY_WK_ | MAC_WK_SRC_IPV6_TCPSYN_RCD_WK_ |
-+ MAC_WK_SRC_IPV4_TCPSYN_RCD_WK_ | MAC_WK_SRC_EEE_TX_WK_ |
-+ MAC_WK_SRC_EEE_RX_WK_ | MAC_WK_SRC_RFE_FR_WK_ |
-+ MAC_WK_SRC_PFDA_FR_WK_ | MAC_WK_SRC_MP_FR_WK_ |
-+ MAC_WK_SRC_BCAST_FR_WK_ | MAC_WK_SRC_WU_FR_WK_ |
-+ MAC_WK_SRC_WK_FR_SAVED_;
-+ lan743x_csr_write(adapter, MAC_WK_SRC, data);
-+
- /* open netdev when netdev is at running state while resume.
- * For instance, it is true when system wakesup after pm-suspend
- * However, it is false when system wakes up after suspend GUI menu
-@@ -3112,9 +3137,6 @@ static int lan743x_pm_resume(struct device *dev)
- lan743x_netdev_open(netdev);
-
- netif_device_attach(netdev);
-- ret = lan743x_csr_read(adapter, MAC_WK_SRC);
-- netif_info(adapter, drv, adapter->netdev,
-- "Wakeup source : 0x%08X\n", ret);
-
- return 0;
- }
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
-index 5c8bcc5cecc8a..fc33a05ff02d2 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -48,6 +48,7 @@
- #define PMT_CTL_RX_FCT_RFE_D3_CLK_OVR_ BIT(18)
- #define PMT_CTL_GPIO_WAKEUP_EN_ BIT(15)
- #define PMT_CTL_EEE_WAKEUP_EN_ BIT(13)
-+#define PMT_CTL_RES_CLR_WKP_MASK_ GENMASK(9, 8)
- #define PMT_CTL_READY_ BIT(7)
- #define PMT_CTL_ETH_PHY_RST_ BIT(4)
- #define PMT_CTL_WOL_EN_ BIT(3)
-@@ -155,12 +156,31 @@
- #define MAC_WUCSR (0x140)
- #define MAC_MP_SO_EN_ BIT(21)
- #define MAC_WUCSR_RFE_WAKE_EN_ BIT(14)
-+#define MAC_WUCSR_EEE_TX_WAKE_ BIT(13)
-+#define MAC_WUCSR_EEE_RX_WAKE_ BIT(11)
-+#define MAC_WUCSR_RFE_WAKE_FR_ BIT(9)
-+#define MAC_WUCSR_PFDA_FR_ BIT(7)
-+#define MAC_WUCSR_WUFR_ BIT(6)
-+#define MAC_WUCSR_MPR_ BIT(5)
-+#define MAC_WUCSR_BCAST_FR_ BIT(4)
- #define MAC_WUCSR_PFDA_EN_ BIT(3)
- #define MAC_WUCSR_WAKE_EN_ BIT(2)
- #define MAC_WUCSR_MPEN_ BIT(1)
- #define MAC_WUCSR_BCST_EN_ BIT(0)
-
- #define MAC_WK_SRC (0x144)
-+#define MAC_WK_SRC_ETH_PHY_WK_ BIT(17)
-+#define MAC_WK_SRC_IPV6_TCPSYN_RCD_WK_ BIT(16)
-+#define MAC_WK_SRC_IPV4_TCPSYN_RCD_WK_ BIT(15)
-+#define MAC_WK_SRC_EEE_TX_WK_ BIT(14)
-+#define MAC_WK_SRC_EEE_RX_WK_ BIT(13)
-+#define MAC_WK_SRC_RFE_FR_WK_ BIT(12)
-+#define MAC_WK_SRC_PFDA_FR_WK_ BIT(11)
-+#define MAC_WK_SRC_MP_FR_WK_ BIT(10)
-+#define MAC_WK_SRC_BCAST_FR_WK_ BIT(9)
-+#define MAC_WK_SRC_WU_FR_WK_ BIT(8)
-+#define MAC_WK_SRC_WK_FR_SAVED_ BIT(7)
-+
- #define MAC_MP_SO_HI (0x148)
- #define MAC_MP_SO_LO (0x14C)
-
-@@ -221,6 +241,10 @@
- #define RFE_INDX(index) (0x580 + (index << 2))
-
- #define MAC_WUCSR2 (0x600)
-+#define MAC_WUCSR2_NS_RCD_ BIT(7)
-+#define MAC_WUCSR2_ARP_RCD_ BIT(6)
-+#define MAC_WUCSR2_IPV6_TCPSYN_RCD_ BIT(5)
-+#define MAC_WUCSR2_IPV4_TCPSYN_RCD_ BIT(4)
-
- #define INT_STS (0x780)
- #define INT_BIT_DMA_RX_(channel) BIT(24 + (channel))
---
-2.43.0
-
+++ /dev/null
-From cbb47a4861bfd582a36b15e0cf40f4ff7dac944a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 12 Feb 2022 21:23:13 +0530
-Subject: net: lan743x: Increase MSI(x) vectors to 16 and Int de-assertion
- timers to 10
-
-From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-
-[ Upstream commit ac16b6eb39d6023585bcbd220feca04f10cab9dd ]
-
-Increase MSI / MSI-X vectors supported from 8 to 16 and
-Interrupt De-assertion timers from 8 to 10
-
-Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: 8c248cd83601 ("net: lan743x: Support WOL at both the PHY and MAC appropriately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/microchip/lan743x_main.c | 32 +++++++++++++------
- drivers/net/ethernet/microchip/lan743x_main.h | 6 +++-
- 2 files changed, 28 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
-index b07033c2851e4..9f39afdfd415e 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -440,7 +440,7 @@ static u32 lan743x_intr_get_vector_flags(struct lan743x_adapter *adapter,
- {
- int index;
-
-- for (index = 0; index < LAN743X_MAX_VECTOR_COUNT; index++) {
-+ for (index = 0; index < adapter->max_vector_count; index++) {
- if (adapter->intr.vector_list[index].int_mask & int_mask)
- return adapter->intr.vector_list[index].flags;
- }
-@@ -453,9 +453,12 @@ static void lan743x_intr_close(struct lan743x_adapter *adapter)
- int index = 0;
-
- lan743x_csr_write(adapter, INT_EN_CLR, INT_BIT_MAS_);
-- lan743x_csr_write(adapter, INT_VEC_EN_CLR, 0x000000FF);
-+ if (adapter->is_pci11x1x)
-+ lan743x_csr_write(adapter, INT_VEC_EN_CLR, 0x0000FFFF);
-+ else
-+ lan743x_csr_write(adapter, INT_VEC_EN_CLR, 0x000000FF);
-
-- for (index = 0; index < LAN743X_MAX_VECTOR_COUNT; index++) {
-+ for (index = 0; index < intr->number_of_vectors; index++) {
- if (intr->flags & INTR_FLAG_IRQ_REQUESTED(index)) {
- lan743x_intr_unregister_isr(adapter, index);
- intr->flags &= ~INTR_FLAG_IRQ_REQUESTED(index);
-@@ -475,10 +478,11 @@ static void lan743x_intr_close(struct lan743x_adapter *adapter)
-
- static int lan743x_intr_open(struct lan743x_adapter *adapter)
- {
-- struct msix_entry msix_entries[LAN743X_MAX_VECTOR_COUNT];
-+ struct msix_entry msix_entries[PCI11X1X_MAX_VECTOR_COUNT];
- struct lan743x_intr *intr = &adapter->intr;
- unsigned int used_tx_channels;
- u32 int_vec_en_auto_clr = 0;
-+ u8 max_vector_count;
- u32 int_vec_map0 = 0;
- u32 int_vec_map1 = 0;
- int ret = -ENODEV;
-@@ -488,9 +492,10 @@ static int lan743x_intr_open(struct lan743x_adapter *adapter)
- intr->number_of_vectors = 0;
-
- /* Try to set up MSIX interrupts */
-+ max_vector_count = adapter->max_vector_count;
- memset(&msix_entries[0], 0,
-- sizeof(struct msix_entry) * LAN743X_MAX_VECTOR_COUNT);
-- for (index = 0; index < LAN743X_MAX_VECTOR_COUNT; index++)
-+ sizeof(struct msix_entry) * max_vector_count);
-+ for (index = 0; index < max_vector_count; index++)
- msix_entries[index].entry = index;
- used_tx_channels = adapter->used_tx_channels;
- ret = pci_enable_msix_range(adapter->pdev,
-@@ -586,8 +591,15 @@ static int lan743x_intr_open(struct lan743x_adapter *adapter)
- lan743x_csr_write(adapter, INT_MOD_CFG5, LAN743X_INT_MOD);
- lan743x_csr_write(adapter, INT_MOD_CFG6, LAN743X_INT_MOD);
- lan743x_csr_write(adapter, INT_MOD_CFG7, LAN743X_INT_MOD);
-- lan743x_csr_write(adapter, INT_MOD_MAP0, 0x00005432);
-- lan743x_csr_write(adapter, INT_MOD_MAP1, 0x00000001);
-+ if (adapter->is_pci11x1x) {
-+ lan743x_csr_write(adapter, INT_MOD_CFG8, LAN743X_INT_MOD);
-+ lan743x_csr_write(adapter, INT_MOD_CFG9, LAN743X_INT_MOD);
-+ lan743x_csr_write(adapter, INT_MOD_MAP0, 0x00007654);
-+ lan743x_csr_write(adapter, INT_MOD_MAP1, 0x00003210);
-+ } else {
-+ lan743x_csr_write(adapter, INT_MOD_MAP0, 0x00005432);
-+ lan743x_csr_write(adapter, INT_MOD_MAP1, 0x00000001);
-+ }
- lan743x_csr_write(adapter, INT_MOD_MAP2, 0x00FFFFFF);
- }
-
-@@ -662,7 +674,7 @@ static int lan743x_intr_open(struct lan743x_adapter *adapter)
- LAN743X_VECTOR_FLAG_SOURCE_STATUS_AUTO_CLEAR;
- }
- for (index = 0; index < number_of_rx_vectors; index++) {
-- int vector = index + 1 + LAN743X_USED_TX_CHANNELS;
-+ int vector = index + 1 + used_tx_channels;
- u32 int_bit = INT_BIT_DMA_RX_(index);
-
- /* map RX interrupt to vector */
-@@ -2728,9 +2740,11 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
- if (adapter->is_pci11x1x) {
- adapter->max_tx_channels = PCI11X1X_MAX_TX_CHANNELS;
- adapter->used_tx_channels = PCI11X1X_USED_TX_CHANNELS;
-+ adapter->max_vector_count = PCI11X1X_MAX_VECTOR_COUNT;
- } else {
- adapter->max_tx_channels = LAN743X_MAX_TX_CHANNELS;
- adapter->used_tx_channels = LAN743X_USED_TX_CHANNELS;
-+ adapter->max_vector_count = LAN743X_MAX_VECTOR_COUNT;
- }
-
- adapter->intr.irq = adapter->pdev->irq;
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
-index fc33a05ff02d2..52d787aed0d17 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -293,6 +293,8 @@
- #define INT_MOD_CFG5 (0x7D4)
- #define INT_MOD_CFG6 (0x7D8)
- #define INT_MOD_CFG7 (0x7DC)
-+#define INT_MOD_CFG8 (0x7E0)
-+#define INT_MOD_CFG9 (0x7E4)
-
- #define PTP_CMD_CTL (0x0A00)
- #define PTP_CMD_CTL_PTP_CLK_STP_NSEC_ BIT(6)
-@@ -645,13 +647,14 @@ struct lan743x_vector {
- };
-
- #define LAN743X_MAX_VECTOR_COUNT (8)
-+#define PCI11X1X_MAX_VECTOR_COUNT (16)
-
- struct lan743x_intr {
- int flags;
-
- unsigned int irq;
-
-- struct lan743x_vector vector_list[LAN743X_MAX_VECTOR_COUNT];
-+ struct lan743x_vector vector_list[PCI11X1X_MAX_VECTOR_COUNT];
- int number_of_vectors;
- bool using_vectors;
-
-@@ -762,6 +765,7 @@ struct lan743x_adapter {
- bool is_pci11x1x;
- u8 max_tx_channels;
- u8 used_tx_channels;
-+ u8 max_vector_count;
-
- #define LAN743X_ADAPTER_FLAG_OTP BIT(0)
- u32 flags;
---
-2.43.0
-
+++ /dev/null
-From 011430715ffb28689b6d78d4c65aa2728f6682f7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 14 Jun 2024 22:41:56 +0530
-Subject: net: lan743x: Support WOL at both the PHY and MAC appropriately
-
-From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-
-[ Upstream commit 8c248cd836014339498486f14f435c0e344183a7 ]
-
-Prevent options not supported by the PHY from being requested to it by the MAC
-Whenever a WOL option is supported by both, the PHY is given priority
-since that usually leads to better power savings.
-
-Fixes: e9e13b6adc33 ("lan743x: fix for potential NULL pointer dereference with bare card")
-Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
-Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../net/ethernet/microchip/lan743x_ethtool.c | 44 +++++++++++++++++--
- drivers/net/ethernet/microchip/lan743x_main.c | 18 ++++++--
- drivers/net/ethernet/microchip/lan743x_main.h | 4 ++
- 3 files changed, 58 insertions(+), 8 deletions(-)
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
-index 469a591cf9cd2..aa549bb7201b7 100644
---- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
-+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
-@@ -784,8 +784,12 @@ static void lan743x_ethtool_get_wol(struct net_device *netdev,
- if (netdev->phydev)
- phy_ethtool_get_wol(netdev->phydev, wol);
-
-- wol->supported |= WAKE_BCAST | WAKE_UCAST | WAKE_MCAST |
-- WAKE_MAGIC | WAKE_PHY | WAKE_ARP;
-+ if (wol->supported != adapter->phy_wol_supported)
-+ netif_warn(adapter, drv, adapter->netdev,
-+ "PHY changed its supported WOL! old=%x, new=%x\n",
-+ adapter->phy_wol_supported, wol->supported);
-+
-+ wol->supported |= MAC_SUPPORTED_WAKES;
-
- if (adapter->is_pci11x1x)
- wol->supported |= WAKE_MAGICSECURE;
-@@ -800,7 +804,39 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
- {
- struct lan743x_adapter *adapter = netdev_priv(netdev);
-
-+ /* WAKE_MAGICSEGURE is a modifier of and only valid together with
-+ * WAKE_MAGIC
-+ */
-+ if ((wol->wolopts & WAKE_MAGICSECURE) && !(wol->wolopts & WAKE_MAGIC))
-+ return -EINVAL;
-+
-+ if (netdev->phydev) {
-+ struct ethtool_wolinfo phy_wol;
-+ int ret;
-+
-+ phy_wol.wolopts = wol->wolopts & adapter->phy_wol_supported;
-+
-+ /* If WAKE_MAGICSECURE was requested, filter out WAKE_MAGIC
-+ * for PHYs that do not support WAKE_MAGICSECURE
-+ */
-+ if (wol->wolopts & WAKE_MAGICSECURE &&
-+ !(adapter->phy_wol_supported & WAKE_MAGICSECURE))
-+ phy_wol.wolopts &= ~WAKE_MAGIC;
-+
-+ ret = phy_ethtool_set_wol(netdev->phydev, &phy_wol);
-+ if (ret && (ret != -EOPNOTSUPP))
-+ return ret;
-+
-+ if (ret == -EOPNOTSUPP)
-+ adapter->phy_wolopts = 0;
-+ else
-+ adapter->phy_wolopts = phy_wol.wolopts;
-+ } else {
-+ adapter->phy_wolopts = 0;
-+ }
-+
- adapter->wolopts = 0;
-+ wol->wolopts &= ~adapter->phy_wolopts;
- if (wol->wolopts & WAKE_UCAST)
- adapter->wolopts |= WAKE_UCAST;
- if (wol->wolopts & WAKE_MCAST)
-@@ -821,10 +857,10 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
- memset(adapter->sopass, 0, sizeof(u8) * SOPASS_MAX);
- }
-
-+ wol->wolopts = adapter->wolopts | adapter->phy_wolopts;
- device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts);
-
-- return netdev->phydev ? phy_ethtool_set_wol(netdev->phydev, wol)
-- : -ENETDOWN;
-+ return 0;
- }
- #endif /* CONFIG_PM */
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
-index f77d3221072d9..4cd042db45b96 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -2594,6 +2594,17 @@ static int lan743x_netdev_open(struct net_device *netdev)
- if (ret)
- goto close_tx;
- }
-+
-+#ifdef CONFIG_PM
-+ if (adapter->netdev->phydev) {
-+ struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
-+
-+ phy_ethtool_get_wol(netdev->phydev, &wol);
-+ adapter->phy_wol_supported = wol.supported;
-+ adapter->phy_wolopts = wol.wolopts;
-+ }
-+#endif
-+
- return 0;
-
- close_tx:
-@@ -3025,10 +3036,9 @@ static void lan743x_pm_set_wol(struct lan743x_adapter *adapter)
-
- pmtctl |= PMT_CTL_ETH_PHY_D3_COLD_OVR_ | PMT_CTL_ETH_PHY_D3_OVR_;
-
-- if (adapter->wolopts & WAKE_PHY) {
-- pmtctl |= PMT_CTL_ETH_PHY_EDPD_PLL_CTL_;
-+ if (adapter->phy_wolopts)
- pmtctl |= PMT_CTL_ETH_PHY_WAKE_EN_;
-- }
-+
- if (adapter->wolopts & WAKE_MAGIC) {
- wucsr |= MAC_WUCSR_MPEN_;
- macrx |= MAC_RX_RXEN_;
-@@ -3124,7 +3134,7 @@ static int lan743x_pm_suspend(struct device *dev)
- lan743x_csr_write(adapter, MAC_WUCSR2, 0);
- lan743x_csr_write(adapter, MAC_WK_SRC, 0xFFFFFFFF);
-
-- if (adapter->wolopts)
-+ if (adapter->wolopts || adapter->phy_wolopts)
- lan743x_pm_set_wol(adapter);
-
- if (adapter->is_pci11x1x) {
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
-index 1825021c63f81..13634771ae2c0 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -758,6 +758,8 @@ struct lan743x_rx {
- u32 frame_count;
- };
-
-+#define MAC_SUPPORTED_WAKES (WAKE_BCAST | WAKE_UCAST | WAKE_MCAST | \
-+ WAKE_MAGIC | WAKE_ARP)
- struct lan743x_adapter {
- struct net_device *netdev;
- struct mii_bus *mdiobus;
-@@ -765,6 +767,8 @@ struct lan743x_adapter {
- #ifdef CONFIG_PM
- u32 wolopts;
- u8 sopass[SOPASS_MAX];
-+ u32 phy_wolopts;
-+ u32 phy_wol_supported;
- #endif
- struct pci_dev *pdev;
- struct lan743x_csr csr;
---
-2.43.0
-
+++ /dev/null
-From e6a73b840d68707c457fcf7d624d217aabc1ddb6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 23 Sep 2020 11:21:40 +0800
-Subject: net: microchip: Make `lan743x_pm_suspend` function return right value
-
-From: Zheng Yongjun <zhengyongjun3@huawei.com>
-
-[ Upstream commit 46237bf3ee834252edb73cfc48855e99b3bd744b ]
-
-drivers/net/ethernet/microchip/lan743x_main.c: In function lan743x_pm_suspend:
-
-`ret` is set but not used. In fact, `pci_prepare_to_sleep` function value should
-be the right value of `lan743x_pm_suspend` function, therefore, fix it.
-
-Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: 7725363936a8 ("net: lan743x: disable WOL upon resume to restore full data path operation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/microchip/lan743x_main.c | 5 +----
- 1 file changed, 1 insertion(+), 4 deletions(-)
-
-diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
-index 6458dbd6c631a..083f7a051ca38 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -2997,7 +2997,6 @@ static int lan743x_pm_suspend(struct device *dev)
- struct pci_dev *pdev = to_pci_dev(dev);
- struct net_device *netdev = pci_get_drvdata(pdev);
- struct lan743x_adapter *adapter = netdev_priv(netdev);
-- int ret;
-
- lan743x_pcidev_shutdown(pdev);
-
-@@ -3010,9 +3009,7 @@ static int lan743x_pm_suspend(struct device *dev)
- lan743x_pm_set_wol(adapter);
-
- /* Host sets PME_En, put D3hot */
-- ret = pci_prepare_to_sleep(pdev);
--
-- return 0;
-+ return pci_prepare_to_sleep(pdev);;
- }
-
- static int lan743x_pm_resume(struct device *dev)
---
-2.43.0
-
af_unix-use-skb_queue_len_lockless-in-sk_diag_show_r.patch
af_unix-annotate-data-race-of-sk-sk_shutdown-in-sk_d.patch
ipv6-fix-possible-race-in-__fib6_drop_pcpu_from.patch
-usb-gadget-f_fs-remove-likely-unlikely.patch
usb-gadget-f_fs-fix-race-between-aio_cancel-and-aio-.patch
asoc-ti-davinci-mcasp-remove-redundant-assignment-to.patch
asoc-ti-davinci-mcasp-remove-always-zero-of-davinci_.patch
sunrpc-return-proper-error-from-gss_wrap_req_priv.patch
gpio-tqmx86-fix-typo-in-kconfig-label.patch
bitops-introduce-the-for_each_set_clump8-macro.patch
-gpio-tqmx86-remove-unneeded-call-to-platform_set_drv.patch
-gpio-tqmx86-introduce-shadow-register-for-gpio-outpu.patch
hid-core-remove-unnecessary-warn_on-in-implement.patch
iommu-amd-use-4k-page-for-completion-wait-write-back.patch
iommu-amd-introduce-pci-segment-structure.patch
ipv6-prevent-possible-null-dereference-in-rt6_probe.patch
xfrm6-check-ip6_dst_idev-return-value-in-xfrm6_get_s.patch
netns-make-get_net_ns-handle-zero-refcount-net.patch
-net-microchip-make-lan743x_pm_suspend-function-retur.patch
-net-lan743x-add-pci11010-pci11414-device-ids.patch
-net-lan743x-add-support-for-4-tx-queues.patch
-net-lan743x-add-support-to-secure-on-wol.patch
-net-lan743x-disable-wol-upon-resume-to-restore-full-.patch
-net-lan743x-increase-msi-x-vectors-to-16-and-int-de-.patch
-net-lan743x-add-support-for-sgmii-interface.patch
-net-lan743x-support-wol-at-both-the-phy-and-mac-appr.patch
net-sched-act_api-rely-on-rcu-in-tcf_idr_check_alloc.patch
net-sched-act_api-fix-possible-infinite-loop-in-tcf_.patch
virtio_net-checksum-offloading-handling-fix.patch
regulator-core-fix-modpost-error-regulator_get_regma.patch
dmaengine-ioatdma-fix-missing-kmem_cache_destroy.patch
acpica-revert-acpica-avoid-info-mapping-multiple-bar.patch
-mm-fix-race-between-__split_huge_pmd_locked-and-gup-fast.patch
drm-radeon-fix-ubsan-warning-in-kv_dpm.c.patch
gcov-add-support-for-gcc-14.patch
i2c-ocores-set-iack-bit-after-core-is-enabled.patch
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- drivers/usb/gadget/function/f_fs.c | 4 ++++
+ drivers/usb/gadget/function/f_fs.c | 4 ++++
1 file changed, 4 insertions(+)
-diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
-index 1a8249bc5f715..123cdac5cee64 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
-@@ -827,6 +827,7 @@ static void ffs_user_copy_worker(struct work_struct *work)
+@@ -827,6 +827,7 @@ static void ffs_user_copy_worker(struct
int ret = io_data->req->status ? io_data->req->status :
io_data->req->actual;
bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD;
if (io_data->read && ret > 0) {
mm_segment_t oldfs = get_fs();
-@@ -843,7 +844,10 @@ static void ffs_user_copy_worker(struct work_struct *work)
+@@ -843,7 +844,10 @@ static void ffs_user_copy_worker(struct
if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd)
eventfd_signal(io_data->ffs->ffs_eventfd, 1);
if (io_data->read)
kfree(io_data->to_free);
---
-2.43.0
-
+++ /dev/null
-From eb78f6f3dbb11612afcd8a66e3a36699a6d174b8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 27 Nov 2020 15:05:59 +0100
-Subject: USB: gadget: f_fs: remove likely/unlikely
-
-From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
-[ Upstream commit 8704fd73bf5658bf4b827643f7f526481082d83f ]
-
-They are used way too often in this file, in some ways that are actually
-wrong. Almost all of these are already known by the compiler and CPU so
-just remove them all as none of these should be on any "hot paths" where
-it actually matters.
-
-Cc: Felipe Balbi <balbi@kernel.org>
-Reported-by: Peter Chen <peter.chen@nxp.com>
-Reviewed-by: Peter Chen <peter.chen@nxp.com>
-Link: https://lore.kernel.org/r/20201127140559.381351-6-gregkh@linuxfoundation.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: 24729b307eef ("usb: gadget: f_fs: Fix race between aio_cancel() and AIO request complete")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/gadget/function/f_fs.c | 177 ++++++++++++++---------------
- 1 file changed, 88 insertions(+), 89 deletions(-)
-
-diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
-index 1cf4f4bee019b..1a8249bc5f715 100644
---- a/drivers/usb/gadget/function/f_fs.c
-+++ b/drivers/usb/gadget/function/f_fs.c
-@@ -301,11 +301,11 @@ static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len)
- reinit_completion(&ffs->ep0req_completion);
-
- ret = usb_ep_queue(ffs->gadget->ep0, req, GFP_ATOMIC);
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- return ret;
-
- ret = wait_for_completion_interruptible(&ffs->ep0req_completion);
-- if (unlikely(ret)) {
-+ if (ret) {
- usb_ep_dequeue(ffs->gadget->ep0, req);
- return -EINTR;
- }
-@@ -342,7 +342,7 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf,
-
- /* Acquire mutex */
- ret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- return ret;
-
- /* Check state */
-@@ -350,7 +350,7 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf,
- case FFS_READ_DESCRIPTORS:
- case FFS_READ_STRINGS:
- /* Copy data */
-- if (unlikely(len < 16)) {
-+ if (len < 16) {
- ret = -EINVAL;
- break;
- }
-@@ -365,7 +365,7 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf,
- if (ffs->state == FFS_READ_DESCRIPTORS) {
- pr_info("read descriptors\n");
- ret = __ffs_data_got_descs(ffs, data, len);
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- break;
-
- ffs->state = FFS_READ_STRINGS;
-@@ -373,11 +373,11 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf,
- } else {
- pr_info("read strings\n");
- ret = __ffs_data_got_strings(ffs, data, len);
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- break;
-
- ret = ffs_epfiles_create(ffs);
-- if (unlikely(ret)) {
-+ if (ret) {
- ffs->state = FFS_CLOSING;
- break;
- }
-@@ -386,7 +386,7 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf,
- mutex_unlock(&ffs->mutex);
-
- ret = ffs_ready(ffs);
-- if (unlikely(ret < 0)) {
-+ if (ret < 0) {
- ffs->state = FFS_CLOSING;
- return ret;
- }
-@@ -500,7 +500,7 @@ static ssize_t __ffs_ep0_read_events(struct ffs_data *ffs, char __user *buf,
- spin_unlock_irq(&ffs->ev.waitq.lock);
- mutex_unlock(&ffs->mutex);
-
-- return unlikely(copy_to_user(buf, events, size)) ? -EFAULT : size;
-+ return copy_to_user(buf, events, size) ? -EFAULT : size;
- }
-
- static ssize_t ffs_ep0_read(struct file *file, char __user *buf,
-@@ -519,7 +519,7 @@ static ssize_t ffs_ep0_read(struct file *file, char __user *buf,
-
- /* Acquire mutex */
- ret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- return ret;
-
- /* Check state */
-@@ -541,7 +541,7 @@ static ssize_t ffs_ep0_read(struct file *file, char __user *buf,
-
- case FFS_NO_SETUP:
- n = len / sizeof(struct usb_functionfs_event);
-- if (unlikely(!n)) {
-+ if (!n) {
- ret = -EINVAL;
- break;
- }
-@@ -572,9 +572,9 @@ static ssize_t ffs_ep0_read(struct file *file, char __user *buf,
-
- spin_unlock_irq(&ffs->ev.waitq.lock);
-
-- if (likely(len)) {
-+ if (len) {
- data = kmalloc(len, GFP_KERNEL);
-- if (unlikely(!data)) {
-+ if (!data) {
- ret = -ENOMEM;
- goto done_mutex;
- }
-@@ -591,7 +591,7 @@ static ssize_t ffs_ep0_read(struct file *file, char __user *buf,
-
- /* unlocks spinlock */
- ret = __ffs_ep0_queue_wait(ffs, data, len);
-- if (likely(ret > 0) && unlikely(copy_to_user(buf, data, len)))
-+ if ((ret > 0) && (copy_to_user(buf, data, len)))
- ret = -EFAULT;
- goto done_mutex;
-
-@@ -613,7 +613,7 @@ static int ffs_ep0_open(struct inode *inode, struct file *file)
-
- ENTER();
-
-- if (unlikely(ffs->state == FFS_CLOSING))
-+ if (ffs->state == FFS_CLOSING)
- return -EBUSY;
-
- file->private_data = ffs;
-@@ -662,7 +662,7 @@ static __poll_t ffs_ep0_poll(struct file *file, poll_table *wait)
- poll_wait(file, &ffs->ev.waitq, wait);
-
- ret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- return mask;
-
- switch (ffs->state) {
-@@ -711,7 +711,7 @@ static const struct file_operations ffs_ep0_operations = {
- static void ffs_epfile_io_complete(struct usb_ep *_ep, struct usb_request *req)
- {
- ENTER();
-- if (likely(req->context)) {
-+ if (req->context) {
- struct ffs_ep *ep = _ep->driver_data;
- ep->status = req->status ? req->status : req->actual;
- complete(req->context);
-@@ -721,10 +721,10 @@ static void ffs_epfile_io_complete(struct usb_ep *_ep, struct usb_request *req)
- static ssize_t ffs_copy_to_iter(void *data, int data_len, struct iov_iter *iter)
- {
- ssize_t ret = copy_to_iter(data, data_len, iter);
-- if (likely(ret == data_len))
-+ if (ret == data_len)
- return ret;
-
-- if (unlikely(iov_iter_count(iter)))
-+ if (iov_iter_count(iter))
- return -EFAULT;
-
- /*
-@@ -894,7 +894,7 @@ static ssize_t __ffs_epfile_read_buffered(struct ffs_epfile *epfile,
- return ret;
- }
-
-- if (unlikely(iov_iter_count(iter))) {
-+ if (iov_iter_count(iter)) {
- ret = -EFAULT;
- } else {
- buf->length -= ret;
-@@ -915,10 +915,10 @@ static ssize_t __ffs_epfile_read_data(struct ffs_epfile *epfile,
- struct ffs_buffer *buf;
-
- ssize_t ret = copy_to_iter(data, data_len, iter);
-- if (likely(data_len == ret))
-+ if (data_len == ret)
- return ret;
-
-- if (unlikely(iov_iter_count(iter)))
-+ if (iov_iter_count(iter))
- return -EFAULT;
-
- /* See ffs_copy_to_iter for more context. */
-@@ -939,7 +939,7 @@ static ssize_t __ffs_epfile_read_data(struct ffs_epfile *epfile,
- * in struct ffs_epfile for full read_buffer pointer synchronisation
- * story.
- */
-- if (unlikely(cmpxchg(&epfile->read_buffer, NULL, buf)))
-+ if (cmpxchg(&epfile->read_buffer, NULL, buf))
- kfree(buf);
-
- return ret;
-@@ -977,7 +977,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
-
- /* We will be using request and read_buffer */
- ret = ffs_mutex_lock(&epfile->mutex, file->f_flags & O_NONBLOCK);
-- if (unlikely(ret))
-+ if (ret)
- goto error;
-
- /* Allocate & copy */
-@@ -1022,7 +1022,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
- spin_unlock_irq(&epfile->ffs->eps_lock);
-
- data = ffs_alloc_buffer(io_data, data_len);
-- if (unlikely(!data)) {
-+ if (!data) {
- ret = -ENOMEM;
- goto error_mutex;
- }
-@@ -1042,7 +1042,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
- ret = usb_ep_set_halt(ep->ep);
- if (!ret)
- ret = -EBADMSG;
-- } else if (unlikely(data_len == -EINVAL)) {
-+ } else if (data_len == -EINVAL) {
- /*
- * Sanity Check: even though data_len can't be used
- * uninitialized at the time I write this comment, some
-@@ -1077,12 +1077,12 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
- req->complete = ffs_epfile_io_complete;
-
- ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- goto error_lock;
-
- spin_unlock_irq(&epfile->ffs->eps_lock);
-
-- if (unlikely(wait_for_completion_interruptible(&done))) {
-+ if (wait_for_completion_interruptible(&done)) {
- /*
- * To avoid race condition with ffs_epfile_io_complete,
- * dequeue the request first then check
-@@ -1124,7 +1124,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
- req->complete = ffs_epfile_async_io_complete;
-
- ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
-- if (unlikely(ret)) {
-+ if (ret) {
- io_data->req = NULL;
- usb_ep_free_request(ep->ep, req);
- goto error_lock;
-@@ -1175,7 +1175,7 @@ static int ffs_aio_cancel(struct kiocb *kiocb)
-
- spin_lock_irqsave(&epfile->ffs->eps_lock, flags);
-
-- if (likely(io_data && io_data->ep && io_data->req))
-+ if (io_data && io_data->ep && io_data->req)
- value = usb_ep_dequeue(io_data->ep, io_data->req);
- else
- value = -EINVAL;
-@@ -1194,7 +1194,7 @@ static ssize_t ffs_epfile_write_iter(struct kiocb *kiocb, struct iov_iter *from)
-
- if (!is_sync_kiocb(kiocb)) {
- p = kzalloc(sizeof(io_data), GFP_KERNEL);
-- if (unlikely(!p))
-+ if (!p)
- return -ENOMEM;
- p->aio = true;
- } else {
-@@ -1231,7 +1231,7 @@ static ssize_t ffs_epfile_read_iter(struct kiocb *kiocb, struct iov_iter *to)
-
- if (!is_sync_kiocb(kiocb)) {
- p = kzalloc(sizeof(io_data), GFP_KERNEL);
-- if (unlikely(!p))
-+ if (!p)
- return -ENOMEM;
- p->aio = true;
- } else {
-@@ -1405,7 +1405,7 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
-
- inode = new_inode(sb);
-
-- if (likely(inode)) {
-+ if (inode) {
- struct timespec64 ts = current_time(inode);
-
- inode->i_ino = get_next_ino();
-@@ -1437,11 +1437,11 @@ static struct dentry *ffs_sb_create_file(struct super_block *sb,
- ENTER();
-
- dentry = d_alloc_name(sb->s_root, name);
-- if (unlikely(!dentry))
-+ if (!dentry)
- return NULL;
-
- inode = ffs_sb_make_inode(sb, data, fops, NULL, &ffs->file_perms);
-- if (unlikely(!inode)) {
-+ if (!inode) {
- dput(dentry);
- return NULL;
- }
-@@ -1488,12 +1488,11 @@ static int ffs_sb_fill(struct super_block *sb, struct fs_context *fc)
- &simple_dir_inode_operations,
- &data->perms);
- sb->s_root = d_make_root(inode);
-- if (unlikely(!sb->s_root))
-+ if (!sb->s_root)
- return -ENOMEM;
-
- /* EP0 file */
-- if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs,
-- &ffs_ep0_operations)))
-+ if (!ffs_sb_create_file(sb, "ep0", ffs, &ffs_ep0_operations))
- return -ENOMEM;
-
- return 0;
-@@ -1586,13 +1585,13 @@ static int ffs_fs_get_tree(struct fs_context *fc)
- return invalf(fc, "No source specified");
-
- ffs = ffs_data_new(fc->source);
-- if (unlikely(!ffs))
-+ if (!ffs)
- return -ENOMEM;
- ffs->file_perms = ctx->perms;
- ffs->no_disconnect = ctx->no_disconnect;
-
- ffs->dev_name = kstrdup(fc->source, GFP_KERNEL);
-- if (unlikely(!ffs->dev_name)) {
-+ if (!ffs->dev_name) {
- ffs_data_put(ffs);
- return -ENOMEM;
- }
-@@ -1674,7 +1673,7 @@ static int functionfs_init(void)
- ENTER();
-
- ret = register_filesystem(&ffs_fs_type);
-- if (likely(!ret))
-+ if (!ret)
- pr_info("file system registered\n");
- else
- pr_err("failed registering file system (%d)\n", ret);
-@@ -1719,7 +1718,7 @@ static void ffs_data_put(struct ffs_data *ffs)
- {
- ENTER();
-
-- if (unlikely(refcount_dec_and_test(&ffs->ref))) {
-+ if (refcount_dec_and_test(&ffs->ref)) {
- pr_info("%s(): freeing\n", __func__);
- ffs_data_clear(ffs);
- ffs_release_dev(ffs->private_data);
-@@ -1770,7 +1769,7 @@ static void ffs_data_closed(struct ffs_data *ffs)
- static struct ffs_data *ffs_data_new(const char *dev_name)
- {
- struct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL);
-- if (unlikely(!ffs))
-+ if (!ffs)
- return NULL;
-
- ENTER();
-@@ -1876,11 +1875,11 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
- return -EBADFD;
-
- first_id = usb_string_ids_n(cdev, ffs->strings_count);
-- if (unlikely(first_id < 0))
-+ if (first_id < 0)
- return first_id;
-
- ffs->ep0req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);
-- if (unlikely(!ffs->ep0req))
-+ if (!ffs->ep0req)
- return -ENOMEM;
- ffs->ep0req->complete = ffs_ep0_complete;
- ffs->ep0req->context = ffs;
-@@ -1940,7 +1939,7 @@ static int ffs_epfiles_create(struct ffs_data *ffs)
- epfile->dentry = ffs_sb_create_file(ffs->sb, epfile->name,
- epfile,
- &ffs_epfile_operations);
-- if (unlikely(!epfile->dentry)) {
-+ if (!epfile->dentry) {
- ffs_epfiles_destroy(epfiles, i - 1);
- return -ENOMEM;
- }
-@@ -1981,7 +1980,7 @@ static void ffs_func_eps_disable(struct ffs_function *func)
- ep = func->eps;
- while (count--) {
- /* pending requests get nuked */
-- if (likely(ep->ep))
-+ if (ep->ep)
- usb_ep_disable(ep->ep);
- ++ep;
-
-@@ -2019,7 +2018,7 @@ static int ffs_func_eps_enable(struct ffs_function *func)
- }
-
- ret = usb_ep_enable(ep->ep);
-- if (likely(!ret)) {
-+ if (!ret) {
- epfile->ep = ep;
- epfile->in = usb_endpoint_dir_in(ep->ep->desc);
- epfile->isoc = usb_endpoint_xfer_isoc(ep->ep->desc);
-@@ -2092,12 +2091,12 @@ static int __must_check ffs_do_single_desc(char *data, unsigned len,
- #define __entity_check_ENDPOINT(val) ((val) & USB_ENDPOINT_NUMBER_MASK)
- #define __entity(type, val) do { \
- pr_vdebug("entity " #type "(%02x)\n", (val)); \
-- if (unlikely(!__entity_check_ ##type(val))) { \
-+ if (!__entity_check_ ##type(val)) { \
- pr_vdebug("invalid entity's value\n"); \
- return -EINVAL; \
- } \
- ret = entity(FFS_ ##type, &val, _ds, priv); \
-- if (unlikely(ret < 0)) { \
-+ if (ret < 0) { \
- pr_debug("entity " #type "(%02x); ret = %d\n", \
- (val), ret); \
- return ret; \
-@@ -2222,7 +2221,7 @@ static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len,
-
- /* Record "descriptor" entity */
- ret = entity(FFS_DESCRIPTOR, (u8 *)num, (void *)data, priv);
-- if (unlikely(ret < 0)) {
-+ if (ret < 0) {
- pr_debug("entity DESCRIPTOR(%02lx); ret = %d\n",
- num, ret);
- return ret;
-@@ -2233,7 +2232,7 @@ static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len,
-
- ret = ffs_do_single_desc(data, len, entity, priv,
- ¤t_class);
-- if (unlikely(ret < 0)) {
-+ if (ret < 0) {
- pr_debug("%s returns %d\n", __func__, ret);
- return ret;
- }
-@@ -2339,7 +2338,7 @@ static int __must_check ffs_do_single_os_desc(char *data, unsigned len,
- /* loop over all ext compat/ext prop descriptors */
- while (feature_count--) {
- ret = entity(type, h, data, len, priv);
-- if (unlikely(ret < 0)) {
-+ if (ret < 0) {
- pr_debug("bad OS descriptor, type: %d\n", type);
- return ret;
- }
-@@ -2379,7 +2378,7 @@ static int __must_check ffs_do_os_descs(unsigned count,
- return -EINVAL;
-
- ret = __ffs_do_os_desc_header(&type, desc);
-- if (unlikely(ret < 0)) {
-+ if (ret < 0) {
- pr_debug("entity OS_DESCRIPTOR(%02lx); ret = %d\n",
- num, ret);
- return ret;
-@@ -2400,7 +2399,7 @@ static int __must_check ffs_do_os_descs(unsigned count,
- */
- ret = ffs_do_single_os_desc(data, len, type,
- feature_count, entity, priv, desc);
-- if (unlikely(ret < 0)) {
-+ if (ret < 0) {
- pr_debug("%s returns %d\n", __func__, ret);
- return ret;
- }
-@@ -2632,20 +2631,20 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
-
- ENTER();
-
-- if (unlikely(len < 16 ||
-- get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC ||
-- get_unaligned_le32(data + 4) != len))
-+ if (len < 16 ||
-+ get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC ||
-+ get_unaligned_le32(data + 4) != len)
- goto error;
- str_count = get_unaligned_le32(data + 8);
- lang_count = get_unaligned_le32(data + 12);
-
- /* if one is zero the other must be zero */
-- if (unlikely(!str_count != !lang_count))
-+ if (!str_count != !lang_count)
- goto error;
-
- /* Do we have at least as many strings as descriptors need? */
- needed_count = ffs->strings_count;
-- if (unlikely(str_count < needed_count))
-+ if (str_count < needed_count)
- goto error;
-
- /*
-@@ -2669,7 +2668,7 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
-
- char *vlabuf = kmalloc(vla_group_size(d), GFP_KERNEL);
-
-- if (unlikely(!vlabuf)) {
-+ if (!vlabuf) {
- kfree(_data);
- return -ENOMEM;
- }
-@@ -2697,7 +2696,7 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
- unsigned needed = needed_count;
- u32 str_per_lang = str_count;
-
-- if (unlikely(len < 3))
-+ if (len < 3)
- goto error_free;
- t->language = get_unaligned_le16(data);
- t->strings = s;
-@@ -2710,7 +2709,7 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
- do { /* str_count > 0 so we can use do-while */
- size_t length = strnlen(data, len);
-
-- if (unlikely(length == len))
-+ if (length == len)
- goto error_free;
-
- /*
-@@ -2718,7 +2717,7 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
- * if that's the case we simply ignore the
- * rest
- */
-- if (likely(needed)) {
-+ if (needed) {
- /*
- * s->id will be set while adding
- * function to configuration so for
-@@ -2740,7 +2739,7 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
- } while (--lang_count);
-
- /* Some garbage left? */
-- if (unlikely(len))
-+ if (len)
- goto error_free;
-
- /* Done! */
-@@ -2887,7 +2886,7 @@ static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep,
-
- ffs_ep = func->eps + idx;
-
-- if (unlikely(ffs_ep->descs[ep_desc_id])) {
-+ if (ffs_ep->descs[ep_desc_id]) {
- pr_err("two %sspeed descriptors for EP %d\n",
- speed_names[ep_desc_id],
- ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
-@@ -2918,12 +2917,12 @@ static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep,
- wMaxPacketSize = ds->wMaxPacketSize;
- pr_vdebug("autoconfig\n");
- ep = usb_ep_autoconfig(func->gadget, ds);
-- if (unlikely(!ep))
-+ if (!ep)
- return -ENOTSUPP;
- ep->driver_data = func->eps + idx;
-
- req = usb_ep_alloc_request(ep, GFP_KERNEL);
-- if (unlikely(!req))
-+ if (!req)
- return -ENOMEM;
-
- ffs_ep->ep = ep;
-@@ -2965,7 +2964,7 @@ static int __ffs_func_bind_do_nums(enum ffs_entity_type type, u8 *valuep,
- idx = *valuep;
- if (func->interfaces_nums[idx] < 0) {
- int id = usb_interface_id(func->conf, &func->function);
-- if (unlikely(id < 0))
-+ if (id < 0)
- return id;
- func->interfaces_nums[idx] = id;
- }
-@@ -2986,7 +2985,7 @@ static int __ffs_func_bind_do_nums(enum ffs_entity_type type, u8 *valuep,
- return 0;
-
- idx = (*valuep & USB_ENDPOINT_NUMBER_MASK) - 1;
-- if (unlikely(!func->eps[idx].ep))
-+ if (!func->eps[idx].ep)
- return -EINVAL;
-
- {
-@@ -3171,12 +3170,12 @@ static int _ffs_func_bind(struct usb_configuration *c,
- ENTER();
-
- /* Has descriptors only for speeds gadget does not support */
-- if (unlikely(!(full | high | super)))
-+ if (!(full | high | super))
- return -ENOTSUPP;
-
- /* Allocate a single chunk, less management later on */
- vlabuf = kzalloc(vla_group_size(d), GFP_KERNEL);
-- if (unlikely(!vlabuf))
-+ if (!vlabuf)
- return -ENOMEM;
-
- ffs->ms_os_descs_ext_prop_avail = vla_ptr(vlabuf, d, ext_prop);
-@@ -3205,13 +3204,13 @@ static int _ffs_func_bind(struct usb_configuration *c,
- * endpoints first, so that later we can rewrite the endpoint
- * numbers without worrying that it may be described later on.
- */
-- if (likely(full)) {
-+ if (full) {
- func->function.fs_descriptors = vla_ptr(vlabuf, d, fs_descs);
- fs_len = ffs_do_descs(ffs->fs_descs_count,
- vla_ptr(vlabuf, d, raw_descs),
- d_raw_descs__sz,
- __ffs_func_bind_do_descs, func);
-- if (unlikely(fs_len < 0)) {
-+ if (fs_len < 0) {
- ret = fs_len;
- goto error;
- }
-@@ -3219,13 +3218,13 @@ static int _ffs_func_bind(struct usb_configuration *c,
- fs_len = 0;
- }
-
-- if (likely(high)) {
-+ if (high) {
- func->function.hs_descriptors = vla_ptr(vlabuf, d, hs_descs);
- hs_len = ffs_do_descs(ffs->hs_descs_count,
- vla_ptr(vlabuf, d, raw_descs) + fs_len,
- d_raw_descs__sz - fs_len,
- __ffs_func_bind_do_descs, func);
-- if (unlikely(hs_len < 0)) {
-+ if (hs_len < 0) {
- ret = hs_len;
- goto error;
- }
-@@ -3233,14 +3232,14 @@ static int _ffs_func_bind(struct usb_configuration *c,
- hs_len = 0;
- }
-
-- if (likely(super)) {
-+ if (super) {
- func->function.ss_descriptors = func->function.ssp_descriptors =
- vla_ptr(vlabuf, d, ss_descs);
- ss_len = ffs_do_descs(ffs->ss_descs_count,
- vla_ptr(vlabuf, d, raw_descs) + fs_len + hs_len,
- d_raw_descs__sz - fs_len - hs_len,
- __ffs_func_bind_do_descs, func);
-- if (unlikely(ss_len < 0)) {
-+ if (ss_len < 0) {
- ret = ss_len;
- goto error;
- }
-@@ -3258,7 +3257,7 @@ static int _ffs_func_bind(struct usb_configuration *c,
- (super ? ffs->ss_descs_count : 0),
- vla_ptr(vlabuf, d, raw_descs), d_raw_descs__sz,
- __ffs_func_bind_do_nums, func);
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- goto error;
-
- func->function.os_desc_table = vla_ptr(vlabuf, d, os_desc_table);
-@@ -3279,7 +3278,7 @@ static int _ffs_func_bind(struct usb_configuration *c,
- d_raw_descs__sz - fs_len - hs_len -
- ss_len,
- __ffs_func_bind_do_os_desc, func);
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- goto error;
- }
- func->function.os_desc_n =
-@@ -3330,7 +3329,7 @@ static int ffs_func_set_alt(struct usb_function *f,
-
- if (alt != (unsigned)-1) {
- intf = ffs_func_revmap_intf(func, interface);
-- if (unlikely(intf < 0))
-+ if (intf < 0)
- return intf;
- }
-
-@@ -3355,7 +3354,7 @@ static int ffs_func_set_alt(struct usb_function *f,
-
- ffs->func = func;
- ret = ffs_func_eps_enable(func);
-- if (likely(ret >= 0))
-+ if (ret >= 0)
- ffs_event_add(ffs, FUNCTIONFS_ENABLE);
- return ret;
- }
-@@ -3397,13 +3396,13 @@ static int ffs_func_setup(struct usb_function *f,
- switch (creq->bRequestType & USB_RECIP_MASK) {
- case USB_RECIP_INTERFACE:
- ret = ffs_func_revmap_intf(func, le16_to_cpu(creq->wIndex));
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- return ret;
- break;
-
- case USB_RECIP_ENDPOINT:
- ret = ffs_func_revmap_ep(func, le16_to_cpu(creq->wIndex));
-- if (unlikely(ret < 0))
-+ if (ret < 0)
- return ret;
- if (func->ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)
- ret = func->ffs->eps_addrmap[ret];
-@@ -3662,7 +3661,7 @@ static struct usb_function *ffs_alloc(struct usb_function_instance *fi)
- ENTER();
-
- func = kzalloc(sizeof(*func), GFP_KERNEL);
-- if (unlikely(!func))
-+ if (!func)
- return ERR_PTR(-ENOMEM);
-
- func->function.name = "Function FS Gadget";
-@@ -3876,7 +3875,7 @@ static void ffs_closed(struct ffs_data *ffs)
- static int ffs_mutex_lock(struct mutex *mutex, unsigned nonblock)
- {
- return nonblock
-- ? likely(mutex_trylock(mutex)) ? 0 : -EAGAIN
-+ ? mutex_trylock(mutex) ? 0 : -EAGAIN
- : mutex_lock_interruptible(mutex);
- }
-
-@@ -3884,14 +3883,14 @@ static char *ffs_prepare_buffer(const char __user *buf, size_t len)
- {
- char *data;
-
-- if (unlikely(!len))
-+ if (!len)
- return NULL;
-
- data = kmalloc(len, GFP_KERNEL);
-- if (unlikely(!data))
-+ if (!data)
- return ERR_PTR(-ENOMEM);
-
-- if (unlikely(copy_from_user(data, buf, len))) {
-+ if (copy_from_user(data, buf, len)) {
- kfree(data);
- return ERR_PTR(-EFAULT);
- }
---
-2.43.0
-