+++ /dev/null
-From 9997c257e9e152369bc30a386cdf96a0210fe9a5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 15 Jun 2024 15:54:57 +0300
-Subject: ALSA: hda/realtek: Enable headset mic on IdeaPad 330-17IKB 81DM
-
-From: Ajrat Makhmutov <rautyrauty@gmail.com>
-
-[ Upstream commit b1fd0d1285b1eae8b99af36fb26ed2512b809af6 ]
-
-Headset microphone do not work out of the box with this laptop. This
-quirk fixes it. Zihao Wang specified the wrong subsystem id in his patch.
-
-Link: https://lore.kernel.org/all/20220424084120.74125-1-wzhd@ustc.edu/
-Fixes: 3b79954fd00d ("ALSA: hda/realtek: Add quirk for Yoga Duet 7 13ITL6 speakers")
-Signed-off-by: Ajrat Makhmutov <rauty@altlinux.org>
-Link: https://lore.kernel.org/r/20240615125457.167844-1-rauty@altlinux.org
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/pci/hda/patch_realtek.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
-index 4af8094938059..7f2ddfc72deab 100644
---- a/sound/pci/hda/patch_realtek.c
-+++ b/sound/pci/hda/patch_realtek.c
-@@ -9336,7 +9336,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
- SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
- SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
- SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
-- SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
-+ SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
- SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
- SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
- SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
---
-2.43.0
-
+++ /dev/null
-From 0adbbc66f9269b24f623e758d18c7d75ec444aaf Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 6 Jun 2024 23:32:48 +0300
-Subject: geneve: Fix incorrect inner network header offset when
- innerprotoinherit is set
-
-From: Gal Pressman <gal@nvidia.com>
-
-[ Upstream commit c6ae073f5903f6c6439d0ac855836a4da5c0a701 ]
-
-When innerprotoinherit is set, the tunneled packets do not have an inner
-Ethernet header.
-Change 'maclen' to not always assume the header length is ETH_HLEN, as
-there might not be a MAC header.
-
-This resolves issues with drivers (e.g. mlx5, in
-mlx5e_tx_tunnel_accel()) who rely on the skb inner network header offset
-to be correct, and use it for TX offloads.
-
-Fixes: d8a6213d70ac ("geneve: fix header validation in geneve[6]_xmit_skb")
-Signed-off-by: Gal Pressman <gal@nvidia.com>
-Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
-Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/geneve.c | 10 ++++++----
- include/net/ip_tunnels.h | 5 +++--
- 2 files changed, 9 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
-index c4cc539fe3155..b3e998fa14897 100644
---- a/drivers/net/geneve.c
-+++ b/drivers/net/geneve.c
-@@ -918,6 +918,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
- struct geneve_dev *geneve,
- const struct ip_tunnel_info *info)
- {
-+ bool inner_proto_inherit = geneve->cfg.inner_proto_inherit;
- bool xnet = !net_eq(geneve->net, dev_net(geneve->dev));
- struct geneve_sock *gs4 = rcu_dereference(geneve->sock4);
- const struct ip_tunnel_key *key = &info->key;
-@@ -929,7 +930,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
- __be16 sport;
- int err;
-
-- if (!skb_vlan_inet_prepare(skb))
-+ if (!skb_vlan_inet_prepare(skb, inner_proto_inherit))
- return -EINVAL;
-
- sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
-@@ -1002,7 +1003,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
- }
-
- err = geneve_build_skb(&rt->dst, skb, info, xnet, sizeof(struct iphdr),
-- geneve->cfg.inner_proto_inherit);
-+ inner_proto_inherit);
- if (unlikely(err))
- return err;
-
-@@ -1018,6 +1019,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
- struct geneve_dev *geneve,
- const struct ip_tunnel_info *info)
- {
-+ bool inner_proto_inherit = geneve->cfg.inner_proto_inherit;
- bool xnet = !net_eq(geneve->net, dev_net(geneve->dev));
- struct geneve_sock *gs6 = rcu_dereference(geneve->sock6);
- const struct ip_tunnel_key *key = &info->key;
-@@ -1027,7 +1029,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
- __be16 sport;
- int err;
-
-- if (!skb_vlan_inet_prepare(skb))
-+ if (!skb_vlan_inet_prepare(skb, inner_proto_inherit))
- return -EINVAL;
-
- sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
-@@ -1082,7 +1084,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
- ttl = ttl ? : ip6_dst_hoplimit(dst);
- }
- err = geneve_build_skb(dst, skb, info, xnet, sizeof(struct ipv6hdr),
-- geneve->cfg.inner_proto_inherit);
-+ inner_proto_inherit);
- if (unlikely(err))
- return err;
-
-diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
-index 1f016af0622bd..9c96c02f45b13 100644
---- a/include/net/ip_tunnels.h
-+++ b/include/net/ip_tunnels.h
-@@ -335,9 +335,10 @@ static inline bool pskb_inet_may_pull(struct sk_buff *skb)
-
- /* Variant of pskb_inet_may_pull().
- */
--static inline bool skb_vlan_inet_prepare(struct sk_buff *skb)
-+static inline bool skb_vlan_inet_prepare(struct sk_buff *skb,
-+ bool inner_proto_inherit)
- {
-- int nhlen = 0, maclen = ETH_HLEN;
-+ int nhlen = 0, maclen = inner_proto_inherit ? 0 : ETH_HLEN;
- __be16 type = skb->protocol;
-
- /* Essentially this is skb_protocol(skb, true)
---
-2.43.0
-
+++ /dev/null
-From 83cbf3efed47640d7e1875b000b9d39cac5a47fe Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 1 Feb 2022 12:02:59 +0000
-Subject: genirq: Allow the PM device to originate from irq domain
-
-From: Marc Zyngier <maz@kernel.org>
-
-[ Upstream commit 1f8863bfb5ca500ea1c7669b16b1931ba27fce20 ]
-
-As a preparation to moving the reference to the device used for
-runtime power management, add a new 'dev' field to the irqdomain
-structure for that exact purpose.
-
-The irq_chip_pm_{get,put}() helpers are made aware of the dual
-location via a new private helper.
-
-No functional change intended.
-
-Signed-off-by: Marc Zyngier <maz@kernel.org>
-Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Tested-by: Tony Lindgren <tony@atomide.com>
-Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>
-Link: https://lore.kernel.org/r/20220201120310.878267-2-maz@kernel.org
-Stable-dep-of: 08af509efdf8 ("gpio: tqmx86: store IRQ trigger type and unmask status separately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/linux/irqdomain.h | 10 ++++++++++
- kernel/irq/chip.c | 23 ++++++++++++++++++-----
- 2 files changed, 28 insertions(+), 5 deletions(-)
-
-diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
-index 9b9743f7538c4..60f53eadfa422 100644
---- a/include/linux/irqdomain.h
-+++ b/include/linux/irqdomain.h
-@@ -149,6 +149,8 @@ struct irq_domain_chip_generic;
- * @gc: Pointer to a list of generic chips. There is a helper function for
- * setting up one or more generic chips for interrupt controllers
- * drivers using the generic chip library which uses this pointer.
-+ * @dev: Pointer to a device that the domain represent, and that will be
-+ * used for power management purposes.
- * @parent: Pointer to parent irq_domain to support hierarchy irq_domains
- * @debugfs_file: dentry for the domain debugfs file
- *
-@@ -171,6 +173,7 @@ struct irq_domain {
- struct fwnode_handle *fwnode;
- enum irq_domain_bus_token bus_token;
- struct irq_domain_chip_generic *gc;
-+ struct device *dev;
- #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
- struct irq_domain *parent;
- #endif
-@@ -227,6 +230,13 @@ static inline struct device_node *irq_domain_get_of_node(struct irq_domain *d)
- return to_of_node(d->fwnode);
- }
-
-+static inline void irq_domain_set_pm_device(struct irq_domain *d,
-+ struct device *dev)
-+{
-+ if (d)
-+ d->dev = dev;
-+}
-+
- #ifdef CONFIG_IRQ_DOMAIN
- struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
- const char *name, phys_addr_t *pa);
-diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
-index e7d284261d450..b8aa9e22105f9 100644
---- a/kernel/irq/chip.c
-+++ b/kernel/irq/chip.c
-@@ -1586,6 +1586,17 @@ int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
- return 0;
- }
-
-+static struct device *irq_get_parent_device(struct irq_data *data)
-+{
-+ if (data->chip->parent_device)
-+ return data->chip->parent_device;
-+
-+ if (data->domain)
-+ return data->domain->dev;
-+
-+ return NULL;
-+}
-+
- /**
- * irq_chip_pm_get - Enable power for an IRQ chip
- * @data: Pointer to interrupt specific data
-@@ -1595,12 +1606,13 @@ int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
- */
- int irq_chip_pm_get(struct irq_data *data)
- {
-+ struct device *dev = irq_get_parent_device(data);
- int retval;
-
-- if (IS_ENABLED(CONFIG_PM) && data->chip->parent_device) {
-- retval = pm_runtime_get_sync(data->chip->parent_device);
-+ if (IS_ENABLED(CONFIG_PM) && dev) {
-+ retval = pm_runtime_get_sync(dev);
- if (retval < 0) {
-- pm_runtime_put_noidle(data->chip->parent_device);
-+ pm_runtime_put_noidle(dev);
- return retval;
- }
- }
-@@ -1618,10 +1630,11 @@ int irq_chip_pm_get(struct irq_data *data)
- */
- int irq_chip_pm_put(struct irq_data *data)
- {
-+ struct device *dev = irq_get_parent_device(data);
- int retval = 0;
-
-- if (IS_ENABLED(CONFIG_PM) && data->chip->parent_device)
-- retval = pm_runtime_put(data->chip->parent_device);
-+ if (IS_ENABLED(CONFIG_PM) && dev)
-+ retval = pm_runtime_put(dev);
-
- return (retval < 0) ? retval : 0;
- }
---
-2.43.0
-
+++ /dev/null
-From d80c55be2678b053ad6251eb013a41c30f4da3c9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 19 Apr 2022 15:18:39 +0100
-Subject: gpio: Add helpers to ease the transition towards immutable irq_chip
-
-From: Marc Zyngier <maz@kernel.org>
-
-[ Upstream commit 36b78aae4bfee749bbde73be570796bfd0f56bec ]
-
-Add a couple of new helpers to make it slightly simpler to convert
-drivers to immutable irq_chip structures:
-
-- GPIOCHIP_IRQ_RESOURCE_HELPERS populates the irq_chip structure
- with the resource management callbacks
-
-- gpio_irq_chip_set_chip() populates the gpio_irq_chip.chip
- structure, avoiding the proliferation of ugly casts
-
-Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
-Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
-Signed-off-by: Marc Zyngier <maz@kernel.org>
-Link: https://lore.kernel.org/r/20220419141846.598305-4-maz@kernel.org
-Stable-dep-of: 08af509efdf8 ("gpio: tqmx86: store IRQ trigger type and unmask status separately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/linux/gpio/driver.h | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
-index 38df53b541d53..897fc150552a2 100644
---- a/include/linux/gpio/driver.h
-+++ b/include/linux/gpio/driver.h
-@@ -595,6 +595,18 @@ void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset);
- int gpiochip_irq_reqres(struct irq_data *data);
- void gpiochip_irq_relres(struct irq_data *data);
-
-+/* Paste this in your irq_chip structure */
-+#define GPIOCHIP_IRQ_RESOURCE_HELPERS \
-+ .irq_request_resources = gpiochip_irq_reqres, \
-+ .irq_release_resources = gpiochip_irq_relres
-+
-+static inline void gpio_irq_chip_set_chip(struct gpio_irq_chip *girq,
-+ const struct irq_chip *chip)
-+{
-+ /* Yes, dropping const is ugly, but it isn't like we have a choice */
-+ girq->chip = (struct irq_chip *)chip;
-+}
-+
- /* Line status inquiry for drivers */
- bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset);
- bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset);
---
-2.43.0
-
+++ /dev/null
-From bf6d3c4ecb105ceea189578556cd6a6523c8c332 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 19 Apr 2022 15:18:37 +0100
-Subject: gpio: Don't fiddle with irqchips marked as immutable
-
-From: Marc Zyngier <maz@kernel.org>
-
-[ Upstream commit 6c846d026d490b2383d395bc8e7b06336219667b ]
-
-In order to move away from gpiolib messing with the internals of
-unsuspecting irqchips, add a flag by which irqchips advertise
-that they are not to be messed with, and do solemnly swear that
-they correctly call into the gpiolib helpers when required.
-
-Also nudge the users into converting their drivers to the
-new model.
-
-Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
-Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
-Signed-off-by: Marc Zyngier <maz@kernel.org>
-Link: https://lore.kernel.org/r/20220419141846.598305-2-maz@kernel.org
-Stable-dep-of: 08af509efdf8 ("gpio: tqmx86: store IRQ trigger type and unmask status separately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpio/gpiolib.c | 7 ++++++-
- include/linux/irq.h | 2 ++
- kernel/irq/debugfs.c | 1 +
- 3 files changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
-index 374bb9f432660..dcb9b95755cc4 100644
---- a/drivers/gpio/gpiolib.c
-+++ b/drivers/gpio/gpiolib.c
-@@ -1491,6 +1491,11 @@ static void gpiochip_set_irq_hooks(struct gpio_chip *gc)
- {
- struct irq_chip *irqchip = gc->irq.chip;
-
-+ if (irqchip->flags & IRQCHIP_IMMUTABLE)
-+ return;
-+
-+ chip_warn(gc, "not an immutable chip, please consider fixing it!\n");
-+
- if (!irqchip->irq_request_resources &&
- !irqchip->irq_release_resources) {
- irqchip->irq_request_resources = gpiochip_irq_reqres;
-@@ -1667,7 +1672,7 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gc)
- irq_domain_remove(gc->irq.domain);
- }
-
-- if (irqchip) {
-+ if (irqchip && !(irqchip->flags & IRQCHIP_IMMUTABLE)) {
- if (irqchip->irq_request_resources == gpiochip_irq_reqres) {
- irqchip->irq_request_resources = NULL;
- irqchip->irq_release_resources = NULL;
-diff --git a/include/linux/irq.h b/include/linux/irq.h
-index b89a8ac83d1bc..da4cd9fb3e5f3 100644
---- a/include/linux/irq.h
-+++ b/include/linux/irq.h
-@@ -568,6 +568,7 @@ struct irq_chip {
- * IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND: Invokes __enable_irq()/__disable_irq() for wake irqs
- * in the suspend path if they are in disabled state
- * IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup
-+ * IRQCHIP_IMMUTABLE: Don't ever change anything in this chip
- */
- enum {
- IRQCHIP_SET_TYPE_MASKED = (1 << 0),
-@@ -581,6 +582,7 @@ enum {
- IRQCHIP_SUPPORTS_NMI = (1 << 8),
- IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND = (1 << 9),
- IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10),
-+ IRQCHIP_IMMUTABLE = (1 << 11),
- };
-
- #include <linux/irqdesc.h>
-diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c
-index e4cff358b437e..7ff52d94b42c0 100644
---- a/kernel/irq/debugfs.c
-+++ b/kernel/irq/debugfs.c
-@@ -58,6 +58,7 @@ static const struct irq_bit_descr irqchip_flags[] = {
- BIT_MASK_DESCR(IRQCHIP_SUPPORTS_LEVEL_MSI),
- BIT_MASK_DESCR(IRQCHIP_SUPPORTS_NMI),
- BIT_MASK_DESCR(IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND),
-+ BIT_MASK_DESCR(IRQCHIP_IMMUTABLE),
- };
-
- static void
---
-2.43.0
-
+++ /dev/null
-From 909ab961748325ace965f8b2ed014861534a68cf Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 19 Apr 2022 15:18:38 +0100
-Subject: gpio: Expose the gpiochip_irq_re[ql]res helpers
-
-From: Marc Zyngier <maz@kernel.org>
-
-[ Upstream commit 704f08753b6dcd0e08c1953af0b2c7f3fac87111 ]
-
-The GPIO subsystem has a couple of internal helpers to manage
-resources on behalf of the irqchip. Expose them so that GPIO
-drivers can use them directly.
-
-Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
-Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
-Signed-off-by: Marc Zyngier <maz@kernel.org>
-Link: https://lore.kernel.org/r/20220419141846.598305-3-maz@kernel.org
-Stable-dep-of: 08af509efdf8 ("gpio: tqmx86: store IRQ trigger type and unmask status separately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpio/gpiolib.c | 6 ++++--
- include/linux/gpio/driver.h | 4 ++++
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
-index dcb9b95755cc4..cfbf9dc85e365 100644
---- a/drivers/gpio/gpiolib.c
-+++ b/drivers/gpio/gpiolib.c
-@@ -1439,19 +1439,21 @@ static int gpiochip_to_irq(struct gpio_chip *gc, unsigned offset)
- return irq_create_mapping(domain, offset);
- }
-
--static int gpiochip_irq_reqres(struct irq_data *d)
-+int gpiochip_irq_reqres(struct irq_data *d)
- {
- struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-
- return gpiochip_reqres_irq(gc, d->hwirq);
- }
-+EXPORT_SYMBOL(gpiochip_irq_reqres);
-
--static void gpiochip_irq_relres(struct irq_data *d)
-+void gpiochip_irq_relres(struct irq_data *d)
- {
- struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-
- gpiochip_relres_irq(gc, d->hwirq);
- }
-+EXPORT_SYMBOL(gpiochip_irq_relres);
-
- static void gpiochip_irq_mask(struct irq_data *d)
- {
-diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
-index 64c93a36a3a92..38df53b541d53 100644
---- a/include/linux/gpio/driver.h
-+++ b/include/linux/gpio/driver.h
-@@ -591,6 +591,10 @@ void gpiochip_relres_irq(struct gpio_chip *gc, unsigned int offset);
- void gpiochip_disable_irq(struct gpio_chip *gc, unsigned int offset);
- void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset);
-
-+/* irq_data versions of the above */
-+int gpiochip_irq_reqres(struct irq_data *data);
-+void gpiochip_irq_relres(struct irq_data *data);
-+
- /* Line status inquiry for drivers */
- bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset);
- bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset);
---
-2.43.0
-
+++ /dev/null
-From b2c6a4ea45397a74a3666d6acfc2fa979dea6e3f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 1 Feb 2022 12:03:07 +0000
-Subject: gpio: tpmx86: Move PM device over to irq domain
-
-From: Marc Zyngier <maz@kernel.org>
-
-[ Upstream commit 924610607f191bee4379bc3775b0fd025ad7e922 ]
-
-Move the reference to the device over to the irq domain.
-
-Signed-off-by: Marc Zyngier <maz@kernel.org>
-Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>
-Link: https://lore.kernel.org/r/20220201120310.878267-10-maz@kernel.org
-Stable-dep-of: 08af509efdf8 ("gpio: tqmx86: store IRQ trigger type and unmask status separately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpio/gpio-tqmx86.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
-index 3e7270e122bf1..e8360921ee23a 100644
---- a/drivers/gpio/gpio-tqmx86.c
-+++ b/drivers/gpio/gpio-tqmx86.c
-@@ -285,7 +285,6 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
- u8 irq_status;
-
- irq_chip->name = chip->label;
-- irq_chip->parent_device = &pdev->dev;
- irq_chip->irq_mask = tqmx86_gpio_irq_mask;
- irq_chip->irq_unmask = tqmx86_gpio_irq_unmask;
- irq_chip->irq_set_type = tqmx86_gpio_irq_set_type;
-@@ -320,6 +319,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
- goto out_pm_dis;
- }
-
-+ irq_domain_set_pm_device(girq->domain, dev);
-+
- dev_info(dev, "GPIO functionality initialized with %d pins\n",
- chip->ngpio);
-
---
-2.43.0
-
+++ /dev/null
-From 373d1c7067ad2aad97d5174ed0ed8feb2b6d342a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 20 Mar 2023 10:55:12 +0100
-Subject: gpio: tqmx86: Convert to immutable irq_chip
-
-From: Linus Walleij <linus.walleij@linaro.org>
-
-[ Upstream commit 8e43827b6ae727a745ce7a8cc19184b28905a965 ]
-
-Convert the driver to immutable irq-chip with a bit of
-intuition.
-
-Cc: Marc Zyngier <maz@kernel.org>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-Reviewed-by: Marc Zyngier <maz@kernel.org>
-Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-Stable-dep-of: 08af509efdf8 ("gpio: tqmx86: store IRQ trigger type and unmask status separately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpio/gpio-tqmx86.c | 28 ++++++++++++++++++++--------
- 1 file changed, 20 insertions(+), 8 deletions(-)
-
-diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
-index e8360921ee23a..d58fd82b71a8d 100644
---- a/drivers/gpio/gpio-tqmx86.c
-+++ b/drivers/gpio/gpio-tqmx86.c
-@@ -16,6 +16,7 @@
- #include <linux/module.h>
- #include <linux/platform_device.h>
- #include <linux/pm_runtime.h>
-+#include <linux/seq_file.h>
- #include <linux/slab.h>
-
- #define TQMX86_NGPIO 8
-@@ -35,7 +36,6 @@
-
- struct tqmx86_gpio_data {
- struct gpio_chip chip;
-- struct irq_chip irq_chip;
- void __iomem *io_base;
- int irq;
- raw_spinlock_t spinlock;
-@@ -119,6 +119,7 @@ static void tqmx86_gpio_irq_mask(struct irq_data *data)
- gpiic &= ~mask;
- tqmx86_gpio_write(gpio, gpiic, TQMX86_GPIIC);
- raw_spin_unlock_irqrestore(&gpio->spinlock, flags);
-+ gpiochip_disable_irq(&gpio->chip, irqd_to_hwirq(data));
- }
-
- static void tqmx86_gpio_irq_unmask(struct irq_data *data)
-@@ -131,6 +132,7 @@ static void tqmx86_gpio_irq_unmask(struct irq_data *data)
-
- mask = TQMX86_GPII_MASK << (offset * TQMX86_GPII_BITS);
-
-+ gpiochip_enable_irq(&gpio->chip, irqd_to_hwirq(data));
- raw_spin_lock_irqsave(&gpio->spinlock, flags);
- gpiic = tqmx86_gpio_read(gpio, TQMX86_GPIIC);
- gpiic &= ~mask;
-@@ -225,6 +227,22 @@ static void tqmx86_init_irq_valid_mask(struct gpio_chip *chip,
- clear_bit(3, valid_mask);
- }
-
-+static void tqmx86_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
-+{
-+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-+
-+ seq_printf(p, gc->label);
-+}
-+
-+static const struct irq_chip tqmx86_gpio_irq_chip = {
-+ .irq_mask = tqmx86_gpio_irq_mask,
-+ .irq_unmask = tqmx86_gpio_irq_unmask,
-+ .irq_set_type = tqmx86_gpio_irq_set_type,
-+ .irq_print_chip = tqmx86_gpio_irq_print_chip,
-+ .flags = IRQCHIP_IMMUTABLE,
-+ GPIOCHIP_IRQ_RESOURCE_HELPERS,
-+};
-+
- static int tqmx86_gpio_probe(struct platform_device *pdev)
- {
- struct device *dev = &pdev->dev;
-@@ -281,14 +299,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
- pm_runtime_enable(&pdev->dev);
-
- if (irq > 0) {
-- struct irq_chip *irq_chip = &gpio->irq_chip;
- u8 irq_status;
-
-- irq_chip->name = chip->label;
-- irq_chip->irq_mask = tqmx86_gpio_irq_mask;
-- irq_chip->irq_unmask = tqmx86_gpio_irq_unmask;
-- irq_chip->irq_set_type = tqmx86_gpio_irq_set_type;
--
- /* Mask all interrupts */
- tqmx86_gpio_write(gpio, 0, TQMX86_GPIIC);
-
-@@ -297,7 +309,7 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
- tqmx86_gpio_write(gpio, irq_status, TQMX86_GPIIS);
-
- girq = &chip->irq;
-- girq->chip = irq_chip;
-+ gpio_irq_chip_set_chip(girq, &tqmx86_gpio_irq_chip);
- girq->parent_handler = tqmx86_gpio_irq_handler;
- girq->num_parents = 1;
- girq->parents = devm_kcalloc(&pdev->dev, 1,
---
-2.43.0
-
+++ /dev/null
-From 5586ea72d9ac9a79f4eae2ffebb54e024ba1eee4 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 670cbd0435e3c..3e7270e122bf1 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);
- }
-
-@@ -261,6 +258,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 622b0df4f077bd9b3025e16edcb7df05ba577123 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 0f5d17f343f1e..670cbd0435e3c 100644
---- a/drivers/gpio/gpio-tqmx86.c
-+++ b/drivers/gpio/gpio-tqmx86.c
-@@ -261,8 +261,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
-
-From 9ad00cebca3b4083468a92595d5a4ef0b4782bd8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
+From 08af509efdf8dad08e972b48de0e2c2a7919ea8b Mon Sep 17 00:00:00 2001
+From: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Date: Thu, 30 May 2024 12:20:01 +0200
Subject: gpio: tqmx86: store IRQ trigger type and unmask status separately
From: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
-[ Upstream commit 08af509efdf8dad08e972b48de0e2c2a7919ea8b ]
+commit 08af509efdf8dad08e972b48de0e2c2a7919ea8b upstream.
irq_set_type() should not implicitly unmask the IRQ.
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Link: https://lore.kernel.org/r/6aa4f207f77cb58ef64ffb947e91949b0f753ccd.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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/gpio/gpio-tqmx86.c | 48 ++++++++++++++++++++++----------------
- 1 file changed, 28 insertions(+), 20 deletions(-)
+ drivers/gpio/gpio-tqmx86.c | 46 +++++++++++++++++++++++++--------------------
+ 1 file changed, 26 insertions(+), 20 deletions(-)
-diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
-index d58fd82b71a8d..e932cc803c24d 100644
--- a/drivers/gpio/gpio-tqmx86.c
+++ b/drivers/gpio/gpio-tqmx86.c
-@@ -29,15 +29,19 @@
+@@ -27,16 +27,20 @@
#define TQMX86_GPIIC 3 /* GPI Interrupt Configuration Register */
#define TQMX86_GPIIS 4 /* GPI Interrupt Status Register */
struct tqmx86_gpio_data {
struct gpio_chip chip;
+ struct irq_chip irq_chip;
void __iomem *io_base;
int irq;
+ /* Lock must be held for accessing output and irq_type fields */
raw_spinlock_t spinlock;
- DECLARE_BITMAP(output, TQMX86_NGPIO);
u8 irq_type[TQMX86_NGPI];
-@@ -104,21 +108,32 @@ static int tqmx86_gpio_get_direction(struct gpio_chip *chip,
+ };
+@@ -107,20 +111,30 @@ static int tqmx86_gpio_get_direction(str
return GPIO_LINE_DIRECTION_OUT;
}
+ gpio->irq_type[offset] &= ~TQMX86_INT_UNMASKED;
+ tqmx86_gpio_irq_config(gpio, offset);
raw_spin_unlock_irqrestore(&gpio->spinlock, flags);
-+
- gpiochip_disable_irq(&gpio->chip, irqd_to_hwirq(data));
}
-@@ -128,16 +143,12 @@ static void tqmx86_gpio_irq_unmask(struct irq_data *data)
+@@ -130,15 +144,10 @@ static void tqmx86_gpio_irq_unmask(struc
struct tqmx86_gpio_data *gpio = gpiochip_get_data(
irq_data_get_irq_chip_data(data));
unsigned long flags;
-
- mask = TQMX86_GPII_MASK << (offset * TQMX86_GPII_BITS);
- gpiochip_enable_irq(&gpio->chip, irqd_to_hwirq(data));
-+
raw_spin_lock_irqsave(&gpio->spinlock, flags);
- gpiic = tqmx86_gpio_read(gpio, TQMX86_GPIIC);
- gpiic &= ~mask;
raw_spin_unlock_irqrestore(&gpio->spinlock, flags);
}
-@@ -148,7 +159,7 @@ static int tqmx86_gpio_irq_set_type(struct irq_data *data, unsigned int type)
+@@ -149,7 +158,7 @@ static int tqmx86_gpio_irq_set_type(stru
unsigned int offset = (data->hwirq - TQMX86_NGPO);
unsigned int edge_type = type & IRQF_TRIGGER_MASK;
unsigned long flags;
switch (edge_type) {
case IRQ_TYPE_EDGE_RISING:
-@@ -164,13 +175,10 @@ static int tqmx86_gpio_irq_set_type(struct irq_data *data, unsigned int type)
+@@ -165,13 +174,10 @@ static int tqmx86_gpio_irq_set_type(stru
return -EINVAL; /* not supported */
}
raw_spin_unlock_irqrestore(&gpio->spinlock, flags);
return 0;
---
-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>
----
- Documentation/vm/arch_pgtable_helpers.rst | 6 ++-
- 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 ++-
- 6 files changed, 39 insertions(+), 27 deletions(-)
-
---- a/Documentation/vm/arch_pgtable_helpers.rst
-+++ b/Documentation/vm/arch_pgtable_helpers.rst
-@@ -134,7 +134,8 @@ PMD Page Table Helpers
- +---------------------------+--------------------------------------------------+
- | pmd_swp_clear_soft_dirty | Clears a soft dirty swapped PMD |
- +---------------------------+--------------------------------------------------+
--| pmd_mkinvalid | Invalidates a mapped PMD [1] |
-+| pmd_mkinvalid | Invalidates a present PMD; do not call for |
-+| | non-present PMD [1] |
- +---------------------------+--------------------------------------------------+
- | pmd_set_huge | Creates a PMD huge mapping |
- +---------------------------+--------------------------------------------------+
-@@ -190,7 +191,8 @@ PUD Page Table Helpers
- +---------------------------+--------------------------------------------------+
- | pud_mkdevmap | Creates a ZONE_DEVICE mapped PUD |
- +---------------------------+--------------------------------------------------+
--| pud_mkinvalid | Invalidates a mapped PUD [1] |
-+| pud_mkinvalid | Invalidates a present PUD; do not call for |
-+| | non-present PUD [1] |
- +---------------------------+--------------------------------------------------+
- | pud_set_huge | Creates a PUD huge mapping |
- +---------------------------+--------------------------------------------------+
---- a/arch/powerpc/mm/book3s64/pgtable.c
-+++ b/arch/powerpc/mm/book3s64/pgtable.c
-@@ -108,6 +108,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);
- return __pmd(old_pmd);
---- a/arch/s390/include/asm/pgtable.h
-+++ b/arch/s390/include/asm/pgtable.h
-@@ -1631,8 +1631,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
-@@ -244,6 +244,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
-@@ -2085,32 +2085,11 @@ 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/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);
--
-- 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 = migration_entry_to_page(entry);
- write = is_write_migration_entry(entry);
-@@ -2118,6 +2097,30 @@ static void __split_huge_pmd_locked(stru
- soft_dirty = pmd_swp_soft_dirty(old_pmd);
- uffd_wp = pmd_swp_uffd_wp(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
-@@ -194,7 +194,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_mkinvalid(*pmdp));
-+ pmd_t old;
-+
-+ VM_WARN_ON_ONCE(!pmd_present(*pmdp));
-+ old = pmdp_establish(vma, address, pmdp, pmd_mkinvalid(*pmdp));
- flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
- return old;
- }
+++ /dev/null
-From 850a915594ef259a944e57a010012abd4138e684 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 27 May 2022 23:23:52 +0530
-Subject: mmc: core: Capture eMMC and SD card errors
-
-From: Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com>
-
-[ Upstream commit 91f059c95c6a5dbc0907a5f871e7915a5e93c1f9 ]
-
-Add changes to capture eMMC and SD card errors.
-This is useful for debug and testing.
-
-Signed-off-by: Liangliang Lu <quic_luliang@quicinc.com>
-Signed-off-by: Sayali Lokhande <quic_sayalil@quicinc.com>
-Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
-Signed-off-by: Ram Prakash Gupta <quic_rampraka@quicinc.com>
-Signed-off-by: Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com>
-Acked-by: Adrian Hunter <adrian.hunter@intel.com>
-Link: https://lore.kernel.org/r/1653674036-21829-2-git-send-email-quic_c_sbhanu@quicinc.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Stable-dep-of: b3855668d98c ("mmc: sdhci: Add support for "Tuning Error" interrupts")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/core/core.c | 10 +++++++++-
- include/linux/mmc/host.h | 26 ++++++++++++++++++++++++++
- 2 files changed, 35 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
-index 2a8c7d5631d14..914ded6025235 100644
---- a/drivers/mmc/core/core.c
-+++ b/drivers/mmc/core/core.c
-@@ -947,9 +947,11 @@ int mmc_execute_tuning(struct mmc_card *card)
- }
-
- /* Only print error when we don't check for card removal */
-- if (!host->detect_change)
-+ if (!host->detect_change) {
- pr_err("%s: tuning execution failed: %d\n",
- mmc_hostname(host), err);
-+ mmc_debugfs_err_stats_inc(host, MMC_ERR_TUNING);
-+ }
-
- return err;
- }
-@@ -2322,6 +2324,12 @@ void mmc_rescan(struct work_struct *work)
- if (freqs[i] <= host->f_min)
- break;
- }
-+
-+ /*
-+ * Ignore the command timeout errors observed during
-+ * the card init as those are excepted.
-+ */
-+ host->err_stats[MMC_ERR_CMD_TIMEOUT] = 0;
- mmc_release_host(host);
-
- out:
-diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
-index fb08b86acdbf3..50df925bcefe0 100644
---- a/include/linux/mmc/host.h
-+++ b/include/linux/mmc/host.h
-@@ -79,6 +79,25 @@ struct mmc_ios {
-
- struct mmc_host;
-
-+enum mmc_err_stat {
-+ MMC_ERR_CMD_TIMEOUT,
-+ MMC_ERR_CMD_CRC,
-+ MMC_ERR_DAT_TIMEOUT,
-+ MMC_ERR_DAT_CRC,
-+ MMC_ERR_AUTO_CMD,
-+ MMC_ERR_ADMA,
-+ MMC_ERR_TUNING,
-+ MMC_ERR_CMDQ_RED,
-+ MMC_ERR_CMDQ_GCE,
-+ MMC_ERR_CMDQ_ICCE,
-+ MMC_ERR_REQ_TIMEOUT,
-+ MMC_ERR_CMDQ_REQ_TIMEOUT,
-+ MMC_ERR_ICE_CFG,
-+ MMC_ERR_CTRL_TIMEOUT,
-+ MMC_ERR_UNEXPECTED_IRQ,
-+ MMC_ERR_MAX,
-+};
-+
- struct mmc_host_ops {
- /*
- * It is optional for the host to implement pre_req and post_req in
-@@ -472,6 +491,7 @@ struct mmc_host {
- /* Host Software Queue support */
- bool hsq_enabled;
-
-+ u32 err_stats[MMC_ERR_MAX];
- unsigned long private[] ____cacheline_aligned;
- };
-
-@@ -607,6 +627,12 @@ static inline enum dma_data_direction mmc_get_dma_dir(struct mmc_data *data)
- return data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
- }
-
-+static inline void mmc_debugfs_err_stats_inc(struct mmc_host *host,
-+ enum mmc_err_stat stat)
-+{
-+ host->err_stats[stat] += 1;
-+}
-+
- int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
- int mmc_abort_tuning(struct mmc_host *host, u32 opcode);
-
---
-2.43.0
-
+++ /dev/null
-From 9b0485c53fffdb27d85c1790abadd790b498040d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 30 Jun 2021 06:16:58 +0200
-Subject: mmc: core: Only print retune error when we don't check for card
- removal
-
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-
-[ Upstream commit 8335928849729f8e5f10c1497c67260742f7a8cb ]
-
-Skip printing a retune error when we scan for a removed card because we
-then expect a failed command.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Adrian Hunter <adrian.hunter@intel.com>
-Link: https://lore.kernel.org/r/20210630041658.7574-1-wsa+renesas@sang-engineering.com
-[Ulf: Rebased patch]
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Stable-dep-of: b3855668d98c ("mmc: sdhci: Add support for "Tuning Error" interrupts")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/core/core.c | 12 +++++++-----
- 1 file changed, 7 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
-index d8b38203f0fe9..2a8c7d5631d14 100644
---- a/drivers/mmc/core/core.c
-+++ b/drivers/mmc/core/core.c
-@@ -940,15 +940,17 @@ int mmc_execute_tuning(struct mmc_card *card)
- opcode = MMC_SEND_TUNING_BLOCK;
-
- err = host->ops->execute_tuning(host, opcode);
--
-- if (err) {
-- pr_err("%s: tuning execution failed: %d\n",
-- mmc_hostname(host), err);
-- } else {
-+ if (!err) {
- mmc_retune_clear(host);
- mmc_retune_enable(host);
-+ return 0;
- }
-
-+ /* Only print error when we don't check for card removal */
-+ if (!host->detect_change)
-+ pr_err("%s: tuning execution failed: %d\n",
-+ mmc_hostname(host), err);
-+
- return err;
- }
-
---
-2.43.0
-
+++ /dev/null
-From e81a9beece2662eeee7fe2153da71b51a2d31e15 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 24 Jun 2021 17:16:16 +0200
-Subject: mmc: host: factor out clearing the retune state
-
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-
-[ Upstream commit 8ffb2611a752e1067c18fba39968080469394206 ]
-
-We have this in two places, so let's have a dedicated function. It is
-also more readable.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Adrian Hunter <adrian.hunter@intel.com>
-Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Link: https://lore.kernel.org/r/20210624151616.38770-4-wsa+renesas@sang-engineering.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Stable-dep-of: b3855668d98c ("mmc: sdhci: Add support for "Tuning Error" interrupts")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/core/core.c | 3 +--
- drivers/mmc/core/host.c | 3 +--
- drivers/mmc/core/host.h | 6 ++++++
- 3 files changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
-index d5ca59bd1c995..d8b38203f0fe9 100644
---- a/drivers/mmc/core/core.c
-+++ b/drivers/mmc/core/core.c
-@@ -945,8 +945,7 @@ int mmc_execute_tuning(struct mmc_card *card)
- pr_err("%s: tuning execution failed: %d\n",
- mmc_hostname(host), err);
- } else {
-- host->retune_now = 0;
-- host->need_retune = 0;
-+ mmc_retune_clear(host);
- mmc_retune_enable(host);
- }
-
-diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
-index 7ba1343ca5c1e..28834d1d07679 100644
---- a/drivers/mmc/core/host.c
-+++ b/drivers/mmc/core/host.c
-@@ -139,8 +139,7 @@ void mmc_retune_disable(struct mmc_host *host)
- mmc_retune_unpause(host);
- host->can_retune = 0;
- del_timer_sync(&host->retune_timer);
-- host->retune_now = 0;
-- host->need_retune = 0;
-+ mmc_retune_clear(host);
- }
-
- void mmc_retune_timer_stop(struct mmc_host *host)
-diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
-index 5e3b9534ffb23..855ecf428380f 100644
---- a/drivers/mmc/core/host.h
-+++ b/drivers/mmc/core/host.h
-@@ -21,6 +21,12 @@ int mmc_retune(struct mmc_host *host);
- void mmc_retune_pause(struct mmc_host *host);
- void mmc_retune_unpause(struct mmc_host *host);
-
-+static inline void mmc_retune_clear(struct mmc_host *host)
-+{
-+ host->retune_now = 0;
-+ host->need_retune = 0;
-+}
-+
- static inline void mmc_retune_hold_now(struct mmc_host *host)
- {
- host->retune_now = 0;
---
-2.43.0
-
+++ /dev/null
-From 6fbef751cf99c15345f0004ee7ad562dac2a917e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 21:16:35 +0200
-Subject: mmc: sdhci: Add support for "Tuning Error" interrupts
-
-From: Adrian Hunter <adrian.hunter@intel.com>
-
-[ Upstream commit b3855668d98cf9c6aec2db999dd27d872f8ba878 ]
-
-Most Bay Trail devices do not enable UHS modes for the external sdcard slot
-the Lenovo Yoga Tablet 2 830 / 1050 and Lenovo Yoga Tablet 2 Pro 1380 (8",
-10" and 13") models however do enable this.
-
-Using a UHS cards in these tablets results in errors like this one:
-
-[ 225.272001] mmc2: Unexpected interrupt 0x04000000.
-[ 225.272024] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
-[ 225.272034] mmc2: sdhci: Sys addr: 0x0712c400 | Version: 0x0000b502
-[ 225.272044] mmc2: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000007
-[ 225.272054] mmc2: sdhci: Argument: 0x00000000 | Trn mode: 0x00000023
-[ 225.272064] mmc2: sdhci: Present: 0x01e20002 | Host ctl: 0x00000016
-[ 225.272073] mmc2: sdhci: Power: 0x0000000f | Blk gap: 0x00000000
-[ 225.272082] mmc2: sdhci: Wake-up: 0x00000000 | Clock: 0x00000107
-[ 225.272092] mmc2: sdhci: Timeout: 0x0000000e | Int stat: 0x00000001
-[ 225.272101] mmc2: sdhci: Int enab: 0x03ff000b | Sig enab: 0x03ff000b
-[ 225.272110] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001
-[ 225.272119] mmc2: sdhci: Caps: 0x076864b2 | Caps_1: 0x00000004
-[ 225.272129] mmc2: sdhci: Cmd: 0x00000c1b | Max curr: 0x00000000
-[ 225.272138] mmc2: sdhci: Resp[0]: 0x00000c00 | Resp[1]: 0x00000000
-[ 225.272147] mmc2: sdhci: Resp[2]: 0x00000000 | Resp[3]: 0x00000900
-[ 225.272155] mmc2: sdhci: Host ctl2: 0x0000000c
-[ 225.272164] mmc2: sdhci: ADMA Err: 0x00000003 | ADMA Ptr: 0x0712c200
-[ 225.272172] mmc2: sdhci: ============================================
-
-which results in IO errors leading to issues accessing the sdcard.
-
-0x04000000 is a so-called "Tuning Error" which sofar the SDHCI driver
-does not support / enable. Modify the IRQ handler to process these.
-
-This fixes UHS microsd cards not working with these tablets.
-
-Link: https://lore.kernel.org/r/199bb4aa-c6b5-453e-be37-58bbf468800c@intel.com
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
-Cc: stable@vger.kernel.org
-Link: https://lore.kernel.org/r/20240410191639.526324-3-hdegoede@redhat.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/host/sdhci.c | 10 ++++++++--
- drivers/mmc/host/sdhci.h | 3 ++-
- 2 files changed, 10 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
-index 7df35c35778c1..feb1e3a3ddb0a 100644
---- a/drivers/mmc/host/sdhci.c
-+++ b/drivers/mmc/host/sdhci.c
-@@ -3421,12 +3421,18 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
- host->data->error = -EILSEQ;
- if (!mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND))))
- sdhci_err_stats_inc(host, DAT_CRC);
-- } else if ((intmask & SDHCI_INT_DATA_CRC) &&
-+ } else if ((intmask & (SDHCI_INT_DATA_CRC | SDHCI_INT_TUNING_ERROR)) &&
- SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND))
- != MMC_BUS_TEST_R) {
- host->data->error = -EILSEQ;
- if (!mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND))))
- sdhci_err_stats_inc(host, DAT_CRC);
-+ if (intmask & SDHCI_INT_TUNING_ERROR) {
-+ u16 ctrl2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
-+
-+ ctrl2 &= ~SDHCI_CTRL_TUNED_CLK;
-+ sdhci_writew(host, ctrl2, SDHCI_HOST_CONTROL2);
-+ }
- } else if (intmask & SDHCI_INT_ADMA_ERROR) {
- pr_err("%s: ADMA error: 0x%08x\n", mmc_hostname(host->mmc),
- intmask);
-@@ -3963,7 +3969,7 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error,
- } else
- *cmd_error = 0;
-
-- if (intmask & (SDHCI_INT_DATA_END_BIT | SDHCI_INT_DATA_CRC)) {
-+ if (intmask & (SDHCI_INT_DATA_END_BIT | SDHCI_INT_DATA_CRC | SDHCI_INT_TUNING_ERROR)) {
- *data_error = -EILSEQ;
- if (!mmc_op_tuning(host->cmd->opcode))
- sdhci_err_stats_inc(host, DAT_CRC);
-diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
-index ca5ae0f038804..2d9c518682f01 100644
---- a/drivers/mmc/host/sdhci.h
-+++ b/drivers/mmc/host/sdhci.h
-@@ -151,6 +151,7 @@
- #define SDHCI_INT_BUS_POWER 0x00800000
- #define SDHCI_INT_AUTO_CMD_ERR 0x01000000
- #define SDHCI_INT_ADMA_ERROR 0x02000000
-+#define SDHCI_INT_TUNING_ERROR 0x04000000
-
- #define SDHCI_INT_NORMAL_MASK 0x00007FFF
- #define SDHCI_INT_ERROR_MASK 0xFFFF8000
-@@ -162,7 +163,7 @@
- SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | \
- SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | \
- SDHCI_INT_DATA_END_BIT | SDHCI_INT_ADMA_ERROR | \
-- SDHCI_INT_BLK_GAP)
-+ SDHCI_INT_BLK_GAP | SDHCI_INT_TUNING_ERROR)
- #define SDHCI_INT_ALL_MASK ((unsigned int)-1)
-
- #define SDHCI_CQE_INT_ERR_MASK ( \
---
-2.43.0
-
+++ /dev/null
-From d284b4cefa170ec6852e3c3830ca5ee8654fea9b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 27 May 2022 23:23:53 +0530
-Subject: mmc: sdhci: Capture eMMC and SD card errors
-
-From: Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com>
-
-[ Upstream commit efe8f5c9b5e118070f424205078ababc46fd130a ]
-
-Add changes to capture eMMC and SD card errors.
-This is useful for debug and testing.
-
-Signed-off-by: Liangliang Lu <quic_luliang@quicinc.com>
-Signed-off-by: Sayali Lokhande <quic_sayalil@quicinc.com>
-Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
-Signed-off-by: Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com>
-Acked-by: Adrian Hunter <adrian.hunter@intel.com>
-Link: https://lore.kernel.org/r/1653674036-21829-3-git-send-email-quic_c_sbhanu@quicinc.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Stable-dep-of: b3855668d98c ("mmc: sdhci: Add support for "Tuning Error" interrupts")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/host/sdhci.c | 59 ++++++++++++++++++++++++++++++----------
- drivers/mmc/host/sdhci.h | 3 ++
- include/linux/mmc/mmc.h | 6 ++++
- 3 files changed, 53 insertions(+), 15 deletions(-)
-
-diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
-index 688248287e8d5..7df35c35778c1 100644
---- a/drivers/mmc/host/sdhci.c
-+++ b/drivers/mmc/host/sdhci.c
-@@ -225,6 +225,7 @@ void sdhci_reset(struct sdhci_host *host, u8 mask)
- if (timedout) {
- pr_err("%s: Reset 0x%x never completed.\n",
- mmc_hostname(host->mmc), (int)mask);
-+ sdhci_err_stats_inc(host, CTRL_TIMEOUT);
- sdhci_dumpregs(host);
- return;
- }
-@@ -1721,6 +1722,7 @@ static bool sdhci_send_command_retry(struct sdhci_host *host,
- if (!timeout--) {
- pr_err("%s: Controller never released inhibit bit(s).\n",
- mmc_hostname(host->mmc));
-+ sdhci_err_stats_inc(host, CTRL_TIMEOUT);
- sdhci_dumpregs(host);
- cmd->error = -EIO;
- return false;
-@@ -1970,6 +1972,7 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk)
- if (timedout) {
- pr_err("%s: Internal clock never stabilised.\n",
- mmc_hostname(host->mmc));
-+ sdhci_err_stats_inc(host, CTRL_TIMEOUT);
- sdhci_dumpregs(host);
- return;
- }
-@@ -1992,6 +1995,7 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk)
- if (timedout) {
- pr_err("%s: PLL clock never stabilised.\n",
- mmc_hostname(host->mmc));
-+ sdhci_err_stats_inc(host, CTRL_TIMEOUT);
- sdhci_dumpregs(host);
- return;
- }
-@@ -3192,6 +3196,7 @@ static void sdhci_timeout_timer(struct timer_list *t)
- if (host->cmd && !sdhci_data_line_cmd(host->cmd)) {
- pr_err("%s: Timeout waiting for hardware cmd interrupt.\n",
- mmc_hostname(host->mmc));
-+ sdhci_err_stats_inc(host, REQ_TIMEOUT);
- sdhci_dumpregs(host);
-
- host->cmd->error = -ETIMEDOUT;
-@@ -3214,6 +3219,7 @@ static void sdhci_timeout_data_timer(struct timer_list *t)
- (host->cmd && sdhci_data_line_cmd(host->cmd))) {
- pr_err("%s: Timeout waiting for hardware interrupt.\n",
- mmc_hostname(host->mmc));
-+ sdhci_err_stats_inc(host, REQ_TIMEOUT);
- sdhci_dumpregs(host);
-
- if (host->data) {
-@@ -3265,17 +3271,21 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask, u32 *intmask_p)
- return;
- pr_err("%s: Got command interrupt 0x%08x even though no command operation was in progress.\n",
- mmc_hostname(host->mmc), (unsigned)intmask);
-+ sdhci_err_stats_inc(host, UNEXPECTED_IRQ);
- sdhci_dumpregs(host);
- return;
- }
-
- if (intmask & (SDHCI_INT_TIMEOUT | SDHCI_INT_CRC |
- SDHCI_INT_END_BIT | SDHCI_INT_INDEX)) {
-- if (intmask & SDHCI_INT_TIMEOUT)
-+ if (intmask & SDHCI_INT_TIMEOUT) {
- host->cmd->error = -ETIMEDOUT;
-- else
-+ sdhci_err_stats_inc(host, CMD_TIMEOUT);
-+ } else {
- host->cmd->error = -EILSEQ;
--
-+ if (!mmc_op_tuning(host->cmd->opcode))
-+ sdhci_err_stats_inc(host, CMD_CRC);
-+ }
- /* Treat data command CRC error the same as data CRC error */
- if (host->cmd->data &&
- (intmask & (SDHCI_INT_CRC | SDHCI_INT_TIMEOUT)) ==
-@@ -3297,6 +3307,8 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask, u32 *intmask_p)
- -ETIMEDOUT :
- -EILSEQ;
-
-+ sdhci_err_stats_inc(host, AUTO_CMD);
-+
- if (sdhci_auto_cmd23(host, mrq)) {
- mrq->sbc->error = err;
- __sdhci_finish_mrq(host, mrq);
-@@ -3367,6 +3379,7 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
- if (intmask & SDHCI_INT_DATA_TIMEOUT) {
- host->data_cmd = NULL;
- data_cmd->error = -ETIMEDOUT;
-+ sdhci_err_stats_inc(host, CMD_TIMEOUT);
- __sdhci_finish_mrq(host, data_cmd->mrq);
- return;
- }
-@@ -3395,23 +3408,30 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
-
- pr_err("%s: Got data interrupt 0x%08x even though no data operation was in progress.\n",
- mmc_hostname(host->mmc), (unsigned)intmask);
-+ sdhci_err_stats_inc(host, UNEXPECTED_IRQ);
- sdhci_dumpregs(host);
-
- return;
- }
-
-- if (intmask & SDHCI_INT_DATA_TIMEOUT)
-+ if (intmask & SDHCI_INT_DATA_TIMEOUT) {
- host->data->error = -ETIMEDOUT;
-- else if (intmask & SDHCI_INT_DATA_END_BIT)
-+ sdhci_err_stats_inc(host, DAT_TIMEOUT);
-+ } else if (intmask & SDHCI_INT_DATA_END_BIT) {
- host->data->error = -EILSEQ;
-- else if ((intmask & SDHCI_INT_DATA_CRC) &&
-+ if (!mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND))))
-+ sdhci_err_stats_inc(host, DAT_CRC);
-+ } else if ((intmask & SDHCI_INT_DATA_CRC) &&
- SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND))
-- != MMC_BUS_TEST_R)
-+ != MMC_BUS_TEST_R) {
- host->data->error = -EILSEQ;
-- else if (intmask & SDHCI_INT_ADMA_ERROR) {
-+ if (!mmc_op_tuning(SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND))))
-+ sdhci_err_stats_inc(host, DAT_CRC);
-+ } else if (intmask & SDHCI_INT_ADMA_ERROR) {
- pr_err("%s: ADMA error: 0x%08x\n", mmc_hostname(host->mmc),
- intmask);
- sdhci_adma_show_error(host);
-+ sdhci_err_stats_inc(host, ADMA);
- host->data->error = -EIO;
- if (host->ops->adma_workaround)
- host->ops->adma_workaround(host, intmask);
-@@ -3609,6 +3629,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
- if (unexpected) {
- pr_err("%s: Unexpected interrupt 0x%08x.\n",
- mmc_hostname(host->mmc), unexpected);
-+ sdhci_err_stats_inc(host, UNEXPECTED_IRQ);
- sdhci_dumpregs(host);
- }
-
-@@ -3932,20 +3953,27 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error,
- if (!host->cqe_on)
- return false;
-
-- if (intmask & (SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC))
-+ if (intmask & (SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC)) {
- *cmd_error = -EILSEQ;
-- else if (intmask & SDHCI_INT_TIMEOUT)
-+ if (!mmc_op_tuning(host->cmd->opcode))
-+ sdhci_err_stats_inc(host, CMD_CRC);
-+ } else if (intmask & SDHCI_INT_TIMEOUT) {
- *cmd_error = -ETIMEDOUT;
-- else
-+ sdhci_err_stats_inc(host, CMD_TIMEOUT);
-+ } else
- *cmd_error = 0;
-
-- if (intmask & (SDHCI_INT_DATA_END_BIT | SDHCI_INT_DATA_CRC))
-+ if (intmask & (SDHCI_INT_DATA_END_BIT | SDHCI_INT_DATA_CRC)) {
- *data_error = -EILSEQ;
-- else if (intmask & SDHCI_INT_DATA_TIMEOUT)
-+ if (!mmc_op_tuning(host->cmd->opcode))
-+ sdhci_err_stats_inc(host, DAT_CRC);
-+ } else if (intmask & SDHCI_INT_DATA_TIMEOUT) {
- *data_error = -ETIMEDOUT;
-- else if (intmask & SDHCI_INT_ADMA_ERROR)
-+ sdhci_err_stats_inc(host, DAT_TIMEOUT);
-+ } else if (intmask & SDHCI_INT_ADMA_ERROR) {
- *data_error = -EIO;
-- else
-+ sdhci_err_stats_inc(host, ADMA);
-+ } else
- *data_error = 0;
-
- /* Clear selected interrupts. */
-@@ -3961,6 +3989,7 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error,
- sdhci_writel(host, intmask, SDHCI_INT_STATUS);
- pr_err("%s: CQE: Unexpected interrupt 0x%08x.\n",
- mmc_hostname(host->mmc), intmask);
-+ sdhci_err_stats_inc(host, UNEXPECTED_IRQ);
- sdhci_dumpregs(host);
- }
-
-diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
-index 4db57c3a8cd4b..ca5ae0f038804 100644
---- a/drivers/mmc/host/sdhci.h
-+++ b/drivers/mmc/host/sdhci.h
-@@ -354,6 +354,9 @@ struct sdhci_adma2_64_desc {
- */
- #define MMC_CMD_TRANSFER_TIME (10 * NSEC_PER_MSEC) /* max 10 ms */
-
-+#define sdhci_err_stats_inc(host, err_name) \
-+ mmc_debugfs_err_stats_inc((host)->mmc, MMC_ERR_##err_name)
-+
- enum sdhci_cookie {
- COOKIE_UNMAPPED,
- COOKIE_PRE_MAPPED, /* mapped by sdhci_pre_req() */
-diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
-index 545578fb814b0..6f7993803ee78 100644
---- a/include/linux/mmc/mmc.h
-+++ b/include/linux/mmc/mmc.h
-@@ -99,6 +99,12 @@ static inline bool mmc_op_multi(u32 opcode)
- opcode == MMC_READ_MULTIPLE_BLOCK;
- }
-
-+static inline bool mmc_op_tuning(u32 opcode)
-+{
-+ return opcode == MMC_SEND_TUNING_BLOCK ||
-+ opcode == MMC_SEND_TUNING_BLOCK_HS200;
-+}
-+
- /*
- * MMC_SWITCH argument format:
- *
---
-2.43.0
-
+++ /dev/null
-From eca9f5fdf549298e1d1f912b9fe02f41f955d81e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 25 Aug 2021 18:33:45 +0900
-Subject: mmc: sdhci: Change the code to check auto_cmd23
-
-From: ChanWoo Lee <cw9316.lee@samsung.com>
-
-[ Upstream commit 38929d4f0d811df399c99398ce0599f546369bd4 ]
-
-It is replaced with a function that is already declared.
-//[1/5] mmc: sdhci: Add helpers for the auto-CMD23 flag
-//20200412090349.1607-2-adrian.hunter@intel.com
-
-Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
-Acked-by: Adrian Hunter <adrian.hunter@intel.com>
-Link: https://lore.kernel.org/r/20210825093345.14706-1-cw9316.lee@samsung.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Stable-dep-of: b3855668d98c ("mmc: sdhci: Add support for "Tuning Error" interrupts")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/host/sdhci.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
-index bad01cc6823f6..688248287e8d5 100644
---- a/drivers/mmc/host/sdhci.c
-+++ b/drivers/mmc/host/sdhci.c
-@@ -3297,7 +3297,7 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask, u32 *intmask_p)
- -ETIMEDOUT :
- -EILSEQ;
-
-- if (mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) {
-+ if (sdhci_auto_cmd23(host, mrq)) {
- mrq->sbc->error = err;
- __sdhci_finish_mrq(host, mrq);
- return;
---
-2.43.0
-
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
-@@ -2492,26 +2492,34 @@ static int sdhci_get_cd(struct mmc_host
+@@ -2488,26 +2488,34 @@ static int sdhci_get_cd(struct mmc_host
static int sdhci_check_ro(struct sdhci_host *host)
{
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
-@@ -2493,11 +2493,8 @@ static int sdhci_get_cd(struct mmc_host
+@@ -2489,11 +2489,8 @@ static int sdhci_get_cd(struct mmc_host
static int sdhci_check_ro(struct sdhci_host *host)
{
bool allow_invert = false;
if (host->flags & SDHCI_DEVICE_DEAD) {
is_readonly = 0;
} else if (host->ops->get_ro) {
-@@ -2512,8 +2509,6 @@ static int sdhci_check_ro(struct sdhci_h
+@@ -2508,8 +2505,6 @@ static int sdhci_check_ro(struct sdhci_h
allow_invert = true;
}
+++ /dev/null
-From 292aedc50f4ca600cd3274b7c077c38d6ae9ff41 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 16 Mar 2022 08:15:57 +0200
-Subject: net: geneve: support IPv4/IPv6 as inner protocol
-
-From: Eyal Birger <eyal.birger@gmail.com>
-
-[ Upstream commit 435fe1c0c1f74b682dba85641406abf4337aade6 ]
-
-This patch adds support for encapsulating IPv4/IPv6 within GENEVE.
-
-In order to use this, a new IFLA_GENEVE_INNER_PROTO_INHERIT flag needs
-to be provided at device creation. This property cannot be changed for
-the time being.
-
-In case IP traffic is received on a non-tun device the drop count is
-increased.
-
-Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
-Link: https://lore.kernel.org/r/20220316061557.431872-1-eyal.birger@gmail.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Stable-dep-of: c6ae073f5903 ("geneve: Fix incorrect inner network header offset when innerprotoinherit is set")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/geneve.c | 82 +++++++++++++++++++++++++++---------
- include/uapi/linux/if_link.h | 1 +
- 2 files changed, 64 insertions(+), 19 deletions(-)
-
-diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
-index af35361a3dcee..c4cc539fe3155 100644
---- a/drivers/net/geneve.c
-+++ b/drivers/net/geneve.c
-@@ -54,6 +54,7 @@ struct geneve_config {
- bool use_udp6_rx_checksums;
- bool ttl_inherit;
- enum ifla_geneve_df df;
-+ bool inner_proto_inherit;
- };
-
- /* Pseudo network device */
-@@ -249,17 +250,24 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs,
- }
- }
-
-- skb_reset_mac_header(skb);
-- skb->protocol = eth_type_trans(skb, geneve->dev);
-- skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
--
- if (tun_dst)
- skb_dst_set(skb, &tun_dst->dst);
-
-- /* Ignore packet loops (and multicast echo) */
-- if (ether_addr_equal(eth_hdr(skb)->h_source, geneve->dev->dev_addr)) {
-- geneve->dev->stats.rx_errors++;
-- goto drop;
-+ if (gnvh->proto_type == htons(ETH_P_TEB)) {
-+ skb_reset_mac_header(skb);
-+ skb->protocol = eth_type_trans(skb, geneve->dev);
-+ skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
-+
-+ /* Ignore packet loops (and multicast echo) */
-+ if (ether_addr_equal(eth_hdr(skb)->h_source,
-+ geneve->dev->dev_addr)) {
-+ geneve->dev->stats.rx_errors++;
-+ goto drop;
-+ }
-+ } else {
-+ skb_reset_mac_header(skb);
-+ skb->dev = geneve->dev;
-+ skb->pkt_type = PACKET_HOST;
- }
-
- /* Save offset of outer header relative to skb->head,
-@@ -357,6 +365,7 @@ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
- struct genevehdr *geneveh;
- struct geneve_dev *geneve;
- struct geneve_sock *gs;
-+ __be16 inner_proto;
- int opts_len;
-
- /* Need UDP and Geneve header to be present */
-@@ -368,7 +377,11 @@ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
- if (unlikely(geneveh->ver != GENEVE_VER))
- goto drop;
-
-- if (unlikely(geneveh->proto_type != htons(ETH_P_TEB)))
-+ inner_proto = geneveh->proto_type;
-+
-+ if (unlikely((inner_proto != htons(ETH_P_TEB) &&
-+ inner_proto != htons(ETH_P_IP) &&
-+ inner_proto != htons(ETH_P_IPV6))))
- goto drop;
-
- gs = rcu_dereference_sk_user_data(sk);
-@@ -379,9 +392,14 @@ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
- if (!geneve)
- goto drop;
-
-+ if (unlikely((!geneve->cfg.inner_proto_inherit &&
-+ inner_proto != htons(ETH_P_TEB)))) {
-+ geneve->dev->stats.rx_dropped++;
-+ goto drop;
-+ }
-+
- opts_len = geneveh->opt_len * 4;
-- if (iptunnel_pull_header(skb, GENEVE_BASE_HLEN + opts_len,
-- htons(ETH_P_TEB),
-+ if (iptunnel_pull_header(skb, GENEVE_BASE_HLEN + opts_len, inner_proto,
- !net_eq(geneve->net, dev_net(geneve->dev)))) {
- geneve->dev->stats.rx_dropped++;
- goto drop;
-@@ -734,7 +752,8 @@ static int geneve_stop(struct net_device *dev)
- }
-
- static void geneve_build_header(struct genevehdr *geneveh,
-- const struct ip_tunnel_info *info)
-+ const struct ip_tunnel_info *info,
-+ __be16 inner_proto)
- {
- geneveh->ver = GENEVE_VER;
- geneveh->opt_len = info->options_len / 4;
-@@ -742,7 +761,7 @@ static void geneve_build_header(struct genevehdr *geneveh,
- geneveh->critical = !!(info->key.tun_flags & TUNNEL_CRIT_OPT);
- geneveh->rsvd1 = 0;
- tunnel_id_to_vni(info->key.tun_id, geneveh->vni);
-- geneveh->proto_type = htons(ETH_P_TEB);
-+ geneveh->proto_type = inner_proto;
- geneveh->rsvd2 = 0;
-
- if (info->key.tun_flags & TUNNEL_GENEVE_OPT)
-@@ -751,10 +770,12 @@ static void geneve_build_header(struct genevehdr *geneveh,
-
- static int geneve_build_skb(struct dst_entry *dst, struct sk_buff *skb,
- const struct ip_tunnel_info *info,
-- bool xnet, int ip_hdr_len)
-+ bool xnet, int ip_hdr_len,
-+ bool inner_proto_inherit)
- {
- bool udp_sum = !!(info->key.tun_flags & TUNNEL_CSUM);
- struct genevehdr *gnvh;
-+ __be16 inner_proto;
- int min_headroom;
- int err;
-
-@@ -772,8 +793,9 @@ static int geneve_build_skb(struct dst_entry *dst, struct sk_buff *skb,
- goto free_dst;
-
- gnvh = __skb_push(skb, sizeof(*gnvh) + info->options_len);
-- geneve_build_header(gnvh, info);
-- skb_set_inner_protocol(skb, htons(ETH_P_TEB));
-+ inner_proto = inner_proto_inherit ? skb->protocol : htons(ETH_P_TEB);
-+ geneve_build_header(gnvh, info, inner_proto);
-+ skb_set_inner_protocol(skb, inner_proto);
- return 0;
-
- free_dst:
-@@ -979,7 +1001,8 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
- }
- }
-
-- err = geneve_build_skb(&rt->dst, skb, info, xnet, sizeof(struct iphdr));
-+ err = geneve_build_skb(&rt->dst, skb, info, xnet, sizeof(struct iphdr),
-+ geneve->cfg.inner_proto_inherit);
- if (unlikely(err))
- return err;
-
-@@ -1058,7 +1081,8 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
- ttl = key->ttl;
- ttl = ttl ? : ip6_dst_hoplimit(dst);
- }
-- err = geneve_build_skb(dst, skb, info, xnet, sizeof(struct ipv6hdr));
-+ err = geneve_build_skb(dst, skb, info, xnet, sizeof(struct ipv6hdr),
-+ geneve->cfg.inner_proto_inherit);
- if (unlikely(err))
- return err;
-
-@@ -1407,6 +1431,14 @@ static int geneve_configure(struct net *net, struct net_device *dev,
- dst_cache_reset(&geneve->cfg.info.dst_cache);
- memcpy(&geneve->cfg, cfg, sizeof(*cfg));
-
-+ if (geneve->cfg.inner_proto_inherit) {
-+ dev->header_ops = NULL;
-+ dev->type = ARPHRD_NONE;
-+ dev->hard_header_len = 0;
-+ dev->addr_len = 0;
-+ dev->flags = IFF_NOARP;
-+ }
-+
- err = register_netdevice(dev);
- if (err)
- return err;
-@@ -1580,10 +1612,18 @@ static int geneve_nl2info(struct nlattr *tb[], struct nlattr *data[],
- #endif
- }
-
-+ if (data[IFLA_GENEVE_INNER_PROTO_INHERIT]) {
-+ if (changelink) {
-+ attrtype = IFLA_GENEVE_INNER_PROTO_INHERIT;
-+ goto change_notsup;
-+ }
-+ cfg->inner_proto_inherit = true;
-+ }
-+
- return 0;
- change_notsup:
- NL_SET_ERR_MSG_ATTR(extack, data[attrtype],
-- "Changing VNI, Port, endpoint IP address family, external, and UDP checksum attributes are not supported");
-+ "Changing VNI, Port, endpoint IP address family, external, inner_proto_inherit, and UDP checksum attributes are not supported");
- return -EOPNOTSUPP;
- }
-
-@@ -1818,6 +1858,10 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
- if (nla_put_u8(skb, IFLA_GENEVE_TTL_INHERIT, ttl_inherit))
- goto nla_put_failure;
-
-+ if (geneve->cfg.inner_proto_inherit &&
-+ nla_put_flag(skb, IFLA_GENEVE_INNER_PROTO_INHERIT))
-+ goto nla_put_failure;
-+
- return 0;
-
- nla_put_failure:
-diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
-index c4b23f06f69e0..9334f2128bb2e 100644
---- a/include/uapi/linux/if_link.h
-+++ b/include/uapi/linux/if_link.h
-@@ -761,6 +761,7 @@ enum {
- IFLA_GENEVE_LABEL,
- IFLA_GENEVE_TTL_INHERIT,
- IFLA_GENEVE_DF,
-+ IFLA_GENEVE_INNER_PROTO_INHERIT,
- __IFLA_GENEVE_MAX
- };
- #define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
---
-2.43.0
-
+++ /dev/null
-From 7305cecf730eb07316dd6e2159f3448e7675f1bf 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 50cb1c5251f71..51fe5b4c43dfb 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -3119,6 +3119,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 751f2bc9ce84e..eeab6bfee665b 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -16,8 +16,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)
-@@ -558,6 +563,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 a3f2cea4af73fa6fff2df0fc2a97d5d192976112 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 51fe5b4c43dfb..1ecd048dfe581 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -18,6 +18,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,
-@@ -266,7 +278,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);
-
-@@ -468,6 +480,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;
-@@ -482,9 +495,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) {
-@@ -589,8 +603,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 |
-@@ -628,9 +642,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;
-@@ -2551,7 +2565,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]);
-@@ -2597,12 +2612,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)
-@@ -2629,8 +2651,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,
-@@ -2761,6 +2787,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);
-
-@@ -2791,10 +2826,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;
- }
-
-@@ -2847,8 +2885,17 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev,
- const void *mac_addr;
- 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 eeab6bfee665b..17cdbfa7c2443 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -545,10 +545,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)
-@@ -557,6 +559,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 */
-@@ -725,8 +730,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 ab6d719d40f0c..0448544871920 100644
---- a/drivers/net/ethernet/microchip/lan743x_ptp.c
-+++ b/drivers/net/ethernet/microchip/lan743x_ptp.c
-@@ -1244,21 +1244,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 333ecb5dc1c328412b2c5cda351f9a87c0ee0001 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 c5de8f46cdd35..48f2788ebbdf5 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 1ecd048dfe581..6bbec041914d7 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -3008,6 +3008,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;
-@@ -3102,6 +3103,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);
-@@ -3112,6 +3121,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);
-
-@@ -3123,6 +3133,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);;
- }
-@@ -3138,6 +3160,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,
-@@ -3154,6 +3180,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 17cdbfa7c2443..30c180850c1a1 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -32,6 +32,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)
-@@ -153,6 +158,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)
-@@ -160,6 +166,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)
-@@ -719,6 +727,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;
-@@ -738,6 +747,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 033a89365646a96f1bf0d00efa3851e77b4dc1a1 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 6bbec041914d7..4584786ff8ce5 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.c
-+++ b/drivers/net/ethernet/microchip/lan743x_main.c
-@@ -3019,7 +3019,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_);
-@@ -3154,6 +3154,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);
-@@ -3172,6 +3173,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
-@@ -3180,9 +3205,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 30c180850c1a1..6417b96e23bd0 100644
---- a/drivers/net/ethernet/microchip/lan743x_main.h
-+++ b/drivers/net/ethernet/microchip/lan743x_main.h
-@@ -49,6 +49,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)
-@@ -160,12 +161,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)
-
-@@ -226,6 +246,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
-
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- drivers/infiniband/hw/mlx5/srq.c | 13 ++++++++-----
+ drivers/infiniband/hw/mlx5/srq.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
-diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c
-index 12d485872e771..7df3f32cc6434 100644
--- a/drivers/infiniband/hw/mlx5/srq.c
+++ b/drivers/infiniband/hw/mlx5/srq.c
-@@ -225,17 +225,20 @@ int mlx5_ib_create_srq(struct ib_srq *ib_srq,
+@@ -225,17 +225,20 @@ int mlx5_ib_create_srq(struct ib_srq *ib
int err;
struct mlx5_srq_attr in = {};
__u32 max_srq_wqes = 1 << MLX5_CAP_GEN(dev->mdev, log_max_srq_sz);
return -EINVAL;
}
---
-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
pm-core-redefine-pm_ptr-macro.patch
pm-core-add-new-_pm_ops-macros-deprecate-old-ones.patch
clk-sifive-do-not-register-clkdevs-for-prci-clocks.patch
sunrpc-return-proper-error-from-gss_wrap_req_priv.patch
gpio-tqmx86-fix-typo-in-kconfig-label.patch
-gpio-tqmx86-remove-unneeded-call-to-platform_set_drv.patch
-gpio-tqmx86-introduce-shadow-register-for-gpio-outpu.patch
-genirq-allow-the-pm-device-to-originate-from-irq-dom.patch
-gpio-tpmx86-move-pm-device-over-to-irq-domain.patch
-gpio-don-t-fiddle-with-irqchips-marked-as-immutable.patch
-gpio-expose-the-gpiochip_irq_re-ql-res-helpers.patch
-gpio-add-helpers-to-ease-the-transition-towards-immu.patch
-gpio-tqmx86-convert-to-immutable-irq_chip.patch
-gpio-tqmx86-store-irq-trigger-type-and-unmask-status.patch
hid-core-remove-unnecessary-warn_on-in-implement.patch
+gpio-tqmx86-store-irq-trigger-type-and-unmask-status-separately.patch
iommu-amd-introduce-pci-segment-structure.patch
iommu-amd-fix-sysfs-leak-in-iommu-init.patch
iommu-return-right-value-in-iommu_sva_bind_device.patch
drm-komeda-check-for-error-valued-pointer.patch
drm-bridge-panel-fix-runtime-warning-on-panel-bridge.patch
tcp-fix-race-in-tcp_v6_syn_recv_sock.patch
-net-geneve-support-ipv4-ipv6-as-inner-protocol.patch
-geneve-fix-incorrect-inner-network-header-offset-whe.patch
net-mlx5e-fix-features-validation-check-for-tunneled.patch
bluetooth-l2cap-fix-rejecting-l2cap_conn_param_updat.patch
netfilter-ipset-fix-race-between-namespace-cleanup-a.patch
mips-bmips-bcm6358-make-sure-cbr-is-correctly-set.patch
tracing-build-event-generation-tests-only-as-modules.patch
cipso-fix-total-option-length-computation.patch
-alsa-hda-realtek-enable-headset-mic-on-ideapad-330-1.patch
netrom-fix-a-memory-leak-in-nr_heartbeat_expiry.patch
ipv6-prevent-possible-null-deref-in-fib6_nh_init.patch
ipv6-prevent-possible-null-dereference-in-rt6_probe.patch
netns-make-get_net_ns-handle-zero-refcount-net.patch
sched-unbreak-wakeups.patch
qca_spi-make-interrupt-remembering-atomic.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-sched-act_api-rely-on-rcu-in-tcf_idr_check_alloc.patch
net-sched-act_api-fix-possible-infinite-loop-in-tcf_.patch
tipc-force-a-dst-refcount-before-doing-decryption.patch
rdma-move-more-uverbs_cmd_mask-settings-to-the-core.patch
rdma-check-srq_type-during-create_srq.patch
rdma-mlx5-add-check-for-srq-max_sge-attribute.patch
-mm-fix-race-between-__split_huge_pmd_locked-and-gup-fast.patch
alsa-hda-realtek-limit-mic-boost-on-n14ap7.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
arm-dts-samsung-exynos4412-origen-fix-keypad-no-auto.patch
arm-dts-samsung-smdk4412-fix-keypad-no-autorepeat.patch
-mmc-host-factor-out-clearing-the-retune-state.patch
-mmc-core-only-print-retune-error-when-we-don-t-check.patch
-mmc-sdhci-change-the-code-to-check-auto_cmd23.patch
-mmc-core-capture-emmc-and-sd-card-errors.patch
-mmc-sdhci-capture-emmc-and-sd-card-errors.patch
-mmc-sdhci-add-support-for-tuning-error-interrupts.patch
rtlwifi-rtl8192de-style-clean-ups.patch
wifi-rtlwifi-rtl8192de-fix-5-ghz-tx-power.patch
pmdomain-ti-sci-fix-duplicate-pd-referrals.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 7fd6d97cdb063..6744e8c1f0d29 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) {
kthread_use_mm(io_data->mm);
-@@ -839,7 +840,10 @@ static void ffs_user_copy_worker(struct work_struct *work)
+@@ -839,7 +840,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 07d9ac1068d8d3e68fad1590b9405aba16be30cf 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 ad7df99f09a4c..7fd6d97cdb063 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;
-
- /*
-@@ -890,7 +890,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;
-@@ -911,10 +911,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. */
-@@ -935,7 +935,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;
-@@ -973,7 +973,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 */
-@@ -1018,7 +1018,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;
- }
-@@ -1038,7 +1038,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
-@@ -1073,12 +1073,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
-@@ -1120,7 +1120,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;
-@@ -1171,7 +1171,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;
-@@ -1190,7 +1190,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 {
-@@ -1227,7 +1227,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 {
-@@ -1391,7 +1391,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();
-@@ -1423,11 +1423,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;
- }
-@@ -1474,12 +1474,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;
-@@ -1567,13 +1566,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;
- }
-@@ -1655,7 +1654,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);
-@@ -1700,7 +1699,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);
-@@ -1751,7 +1750,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();
-@@ -1857,11 +1856,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;
-@@ -1921,7 +1920,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;
- }
-@@ -1962,7 +1961,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;
-
-@@ -2000,7 +1999,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);
-@@ -2073,12 +2072,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; \
-@@ -2203,7 +2202,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;
-@@ -2214,7 +2213,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;
- }
-@@ -2320,7 +2319,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;
- }
-@@ -2360,7 +2359,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;
-@@ -2381,7 +2380,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;
- }
-@@ -2613,20 +2612,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;
-
- /*
-@@ -2650,7 +2649,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;
- }
-@@ -2678,7 +2677,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;
-@@ -2691,7 +2690,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;
-
- /*
-@@ -2699,7 +2698,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
-@@ -2721,7 +2720,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! */
-@@ -2868,7 +2867,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);
-@@ -2899,12 +2898,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;
-@@ -2946,7 +2945,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;
- }
-@@ -2967,7 +2966,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;
-
- {
-@@ -3152,12 +3151,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);
-@@ -3186,13 +3185,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;
- }
-@@ -3200,13 +3199,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;
- }
-@@ -3214,14 +3213,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;
- }
-@@ -3239,7 +3238,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);
-@@ -3260,7 +3259,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 =
-@@ -3311,7 +3310,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;
- }
-
-@@ -3336,7 +3335,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;
- }
-@@ -3378,13 +3377,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];
-@@ -3643,7 +3642,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";
-@@ -3857,7 +3856,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);
- }
-
-@@ -3865,14 +3864,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
-