]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Thu, 6 Apr 2023 11:22:49 +0000 (07:22 -0400)
committerSasha Levin <sashal@kernel.org>
Thu, 6 Apr 2023 11:22:49 +0000 (07:22 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/nfsv4-check-the-return-value-of-update_open_stateid.patch [new file with mode: 0644]
queue-4.19/nfsv4-convert-struct-nfs4_state-to-use-refcount_t.patch [new file with mode: 0644]
queue-4.19/nfsv4-fix-hangs-when-recovering-open-state-after-a-s.patch [new file with mode: 0644]
queue-4.19/pinctrl-added-irqf_shared-flag-for-amd-pinctrl-drive.patch [new file with mode: 0644]
queue-4.19/pinctrl-amd-disable-and-mask-interrupts-on-probe.patch [new file with mode: 0644]
queue-4.19/pinctrl-amd-disable-and-mask-interrupts-on-resume.patch [new file with mode: 0644]
queue-4.19/pinctrl-amd-use-irqchip-template.patch [new file with mode: 0644]
queue-4.19/series [new file with mode: 0644]

diff --git a/queue-4.19/nfsv4-check-the-return-value-of-update_open_stateid.patch b/queue-4.19/nfsv4-check-the-return-value-of-update_open_stateid.patch
new file mode 100644 (file)
index 0000000..59ff199
--- /dev/null
@@ -0,0 +1,55 @@
+From 21d56dc1f26a2c820e8e91c1c0d2be1f8d449003 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 29 Jul 2019 18:25:00 +0100
+Subject: NFSv4: Check the return value of update_open_stateid()
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+[ Upstream commit e3c8dc761ead061da2220ee8f8132f729ac3ddfe ]
+
+Ensure that we always check the return value of update_open_stateid()
+so that we can retry if the update of local state failed. This fixes
+infinite looping on state recovery.
+
+Fixes: e23008ec81ef3 ("NFSv4 reduce attribute requests for open reclaim")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Cc: stable@vger.kernel.org # v3.7+
+Stable-dep-of: 6165a16a5ad9 ("NFSv4: Fix hangs when recovering open state after a server reboot")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/nfs4proc.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
+index 4f8775d9d0f06..70150894ed77f 100644
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -1862,8 +1862,9 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data)
+       if (data->o_res.delegation_type != 0)
+               nfs4_opendata_check_deleg(data, state);
+ update:
+-      update_open_stateid(state, &data->o_res.stateid, NULL,
+-                          data->o_arg.fmode);
++      if (!update_open_stateid(state, &data->o_res.stateid,
++                              NULL, data->o_arg.fmode))
++              return ERR_PTR(-EAGAIN);
+       refcount_inc(&state->count);
+       return state;
+@@ -1928,8 +1929,11 @@ _nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data)
+       if (data->o_res.delegation_type != 0)
+               nfs4_opendata_check_deleg(data, state);
+-      update_open_stateid(state, &data->o_res.stateid, NULL,
+-                      data->o_arg.fmode);
++      if (!update_open_stateid(state, &data->o_res.stateid,
++                              NULL, data->o_arg.fmode)) {
++              nfs4_put_open_state(state);
++              state = ERR_PTR(-EAGAIN);
++      }
+ out:
+       nfs_release_seqid(data->o_arg.seqid);
+       return state;
+-- 
+2.39.2
+
diff --git a/queue-4.19/nfsv4-convert-struct-nfs4_state-to-use-refcount_t.patch b/queue-4.19/nfsv4-convert-struct-nfs4_state-to-use-refcount_t.patch
new file mode 100644 (file)
index 0000000..7cfb158
--- /dev/null
@@ -0,0 +1,114 @@
+From 60c36c8782afc456ad7eed4ddddf8b004c87a934 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 2 Sep 2018 19:19:07 -0400
+Subject: NFSv4: Convert struct nfs4_state to use refcount_t
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+[ Upstream commit ace9fad43aa60a88af4b57a8328f0958e3d07bf0 ]
+
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Stable-dep-of: 6165a16a5ad9 ("NFSv4: Fix hangs when recovering open state after a server reboot")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/nfs4_fs.h   | 2 +-
+ fs/nfs/nfs4proc.c  | 8 ++++----
+ fs/nfs/nfs4state.c | 8 ++++----
+ 3 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
+index 5ac7bf24c507b..2d438318681a5 100644
+--- a/fs/nfs/nfs4_fs.h
++++ b/fs/nfs/nfs4_fs.h
+@@ -190,7 +190,7 @@ struct nfs4_state {
+       unsigned int n_wronly;          /* Number of write-only references */
+       unsigned int n_rdwr;            /* Number of read/write references */
+       fmode_t state;                  /* State on the server (R,W, or RW) */
+-      atomic_t count;
++      refcount_t count;
+       wait_queue_head_t waitq;
+ };
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
+index 250fa88303fad..4f8775d9d0f06 100644
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -1792,7 +1792,7 @@ static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata)
+ out:
+       return ERR_PTR(ret);
+ out_return_state:
+-      atomic_inc(&state->count);
++      refcount_inc(&state->count);
+       return state;
+ }
+@@ -1864,7 +1864,7 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data)
+ update:
+       update_open_stateid(state, &data->o_res.stateid, NULL,
+                           data->o_arg.fmode);
+-      atomic_inc(&state->count);
++      refcount_inc(&state->count);
+       return state;
+ }
+@@ -1902,7 +1902,7 @@ nfs4_opendata_find_nfs4_state(struct nfs4_opendata *data)
+               return ERR_CAST(inode);
+       if (data->state != NULL && data->state->inode == inode) {
+               state = data->state;
+-              atomic_inc(&state->count);
++              refcount_inc(&state->count);
+       } else
+               state = nfs4_get_open_state(inode, data->owner);
+       iput(inode);
+@@ -1975,7 +1975,7 @@ static struct nfs4_opendata *nfs4_open_recoverdata_alloc(struct nfs_open_context
+       if (opendata == NULL)
+               return ERR_PTR(-ENOMEM);
+       opendata->state = state;
+-      atomic_inc(&state->count);
++      refcount_inc(&state->count);
+       return opendata;
+ }
+diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
+index b9fbd01ef4cfe..e5b4c6987c846 100644
+--- a/fs/nfs/nfs4state.c
++++ b/fs/nfs/nfs4state.c
+@@ -675,7 +675,7 @@ nfs4_alloc_open_state(void)
+       state = kzalloc(sizeof(*state), GFP_NOFS);
+       if (!state)
+               return NULL;
+-      atomic_set(&state->count, 1);
++      refcount_set(&state->count, 1);
+       INIT_LIST_HEAD(&state->lock_states);
+       spin_lock_init(&state->state_lock);
+       seqlock_init(&state->seqlock);
+@@ -709,7 +709,7 @@ __nfs4_find_state_byowner(struct inode *inode, struct nfs4_state_owner *owner)
+                       continue;
+               if (!nfs4_valid_open_stateid(state))
+                       continue;
+-              if (atomic_inc_not_zero(&state->count))
++              if (refcount_inc_not_zero(&state->count))
+                       return state;
+       }
+       return NULL;
+@@ -763,7 +763,7 @@ void nfs4_put_open_state(struct nfs4_state *state)
+       struct inode *inode = state->inode;
+       struct nfs4_state_owner *owner = state->owner;
+-      if (!atomic_dec_and_lock(&state->count, &owner->so_lock))
++      if (!refcount_dec_and_lock(&state->count, &owner->so_lock))
+               return;
+       spin_lock(&inode->i_lock);
+       list_del(&state->inode_states);
+@@ -1596,7 +1596,7 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs
+                       continue;
+               if (state->state == 0)
+                       continue;
+-              atomic_inc(&state->count);
++              refcount_inc(&state->count);
+               spin_unlock(&sp->so_lock);
+               status = ops->recover_open(sp, state);
+               if (status >= 0) {
+-- 
+2.39.2
+
diff --git a/queue-4.19/nfsv4-fix-hangs-when-recovering-open-state-after-a-s.patch b/queue-4.19/nfsv4-fix-hangs-when-recovering-open-state-after-a-s.patch
new file mode 100644 (file)
index 0000000..85ba3af
--- /dev/null
@@ -0,0 +1,50 @@
+From 8feee4b756be210a6e97346434092e6883452401 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 Mar 2023 00:17:36 -0400
+Subject: NFSv4: Fix hangs when recovering open state after a server reboot
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+[ Upstream commit 6165a16a5ad9b237bb3131cff4d3c601ccb8f9a3 ]
+
+When we're using a cached open stateid or a delegation in order to avoid
+sending a CLAIM_PREVIOUS open RPC call to the server, we don't have a
+new open stateid to present to update_open_stateid().
+Instead rely on nfs4_try_open_cached(), just as if we were doing a
+normal open.
+
+Fixes: d2bfda2e7aa0 ("NFSv4: don't reprocess cached open CLAIM_PREVIOUS")
+Cc: stable@vger.kernel.org
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/nfs4proc.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
+index 70150894ed77f..3651619468d74 100644
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -1851,8 +1851,7 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data)
+       if (!data->rpc_done) {
+               if (data->rpc_status)
+                       return ERR_PTR(data->rpc_status);
+-              /* cached opens have already been processed */
+-              goto update;
++              return nfs4_try_open_cached(data);
+       }
+       ret = nfs_refresh_inode(inode, &data->f_attr);
+@@ -1861,7 +1860,7 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data)
+       if (data->o_res.delegation_type != 0)
+               nfs4_opendata_check_deleg(data, state);
+-update:
++
+       if (!update_open_stateid(state, &data->o_res.stateid,
+                               NULL, data->o_arg.fmode))
+               return ERR_PTR(-EAGAIN);
+-- 
+2.39.2
+
diff --git a/queue-4.19/pinctrl-added-irqf_shared-flag-for-amd-pinctrl-drive.patch b/queue-4.19/pinctrl-added-irqf_shared-flag-for-amd-pinctrl-drive.patch
new file mode 100644 (file)
index 0000000..c8bd208
--- /dev/null
@@ -0,0 +1,40 @@
+From a2150a4b2ff86e26e62749c99fecb15ca8315160 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 4 Apr 2019 13:16:26 +0000
+Subject: pinctrl: Added IRQF_SHARED flag for amd-pinctrl driver
+
+From: Sandeep Singh <sandeep.singh@amd.com>
+
+[ Upstream commit 279ffafaf39d60b3c37cb3f0f7de310d0dd834ad ]
+
+Some of the AMD reference boards used single GPIO line for
+multiple devices. So added IRQF_SHARED flag in amd pinctrl driver.
+
+Signed-off-by: Sandeep Singh <Sandeep.Singh@amd.com>
+Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
+cc: Nehal Shah <Nehal-bakulchandra.Shah@amd.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Stable-dep-of: b26cd9325be4 ("pinctrl: amd: Disable and mask interrupts on resume")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/pinctrl-amd.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
+index 66b9c5826ec03..d76e50bc9d85c 100644
+--- a/drivers/pinctrl/pinctrl-amd.c
++++ b/drivers/pinctrl/pinctrl-amd.c
+@@ -943,8 +943,8 @@ static int amd_gpio_probe(struct platform_device *pdev)
+               goto out2;
+       }
+-      ret = devm_request_irq(&pdev->dev, irq_base, amd_gpio_irq_handler, 0,
+-                             KBUILD_MODNAME, gpio_dev);
++      ret = devm_request_irq(&pdev->dev, irq_base, amd_gpio_irq_handler,
++                             IRQF_SHARED, KBUILD_MODNAME, gpio_dev);
+       if (ret)
+               goto out2;
+-- 
+2.39.2
+
diff --git a/queue-4.19/pinctrl-amd-disable-and-mask-interrupts-on-probe.patch b/queue-4.19/pinctrl-amd-disable-and-mask-interrupts-on-probe.patch
new file mode 100644 (file)
index 0000000..7dbc52a
--- /dev/null
@@ -0,0 +1,79 @@
+From c5b96c8006237be20f9651983a1ac5b77ee54bfe Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 9 Oct 2021 14:32:40 +1100
+Subject: pinctrl: amd: disable and mask interrupts on probe
+
+From: Sachi King <nakato@nakato.io>
+
+[ Upstream commit 4e5a04be88fe335ad5331f4f8c17f4ebd357e065 ]
+
+Some systems such as the Microsoft Surface Laptop 4 leave interrupts
+enabled and configured for use in sleep states on boot, which cause
+unexpected behaviour such as spurious wakes and failed resumes in
+s2idle states.
+
+As interrupts should not be enabled until they are claimed and
+explicitly enabled, disabling any interrupts mistakenly left enabled by
+firmware should be safe.
+
+Signed-off-by: Sachi King <nakato@nakato.io>
+Link: https://lore.kernel.org/r/20211009033240.21543-1-nakato@nakato.io
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Stable-dep-of: b26cd9325be4 ("pinctrl: amd: Disable and mask interrupts on resume")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/pinctrl-amd.c | 31 +++++++++++++++++++++++++++++++
+ 1 file changed, 31 insertions(+)
+
+diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
+index 4d283ebaaf230..a44902b140879 100644
+--- a/drivers/pinctrl/pinctrl-amd.c
++++ b/drivers/pinctrl/pinctrl-amd.c
+@@ -774,6 +774,34 @@ static const struct pinconf_ops amd_pinconf_ops = {
+       .pin_config_group_set = amd_pinconf_group_set,
+ };
++static void amd_gpio_irq_init(struct amd_gpio *gpio_dev)
++{
++      struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
++      unsigned long flags;
++      u32 pin_reg, mask;
++      int i;
++
++      mask = BIT(WAKE_CNTRL_OFF_S0I3) | BIT(WAKE_CNTRL_OFF_S3) |
++              BIT(INTERRUPT_MASK_OFF) | BIT(INTERRUPT_ENABLE_OFF) |
++              BIT(WAKE_CNTRL_OFF_S4);
++
++      for (i = 0; i < desc->npins; i++) {
++              int pin = desc->pins[i].number;
++              const struct pin_desc *pd = pin_desc_get(gpio_dev->pctrl, pin);
++
++              if (!pd)
++                      continue;
++
++              raw_spin_lock_irqsave(&gpio_dev->lock, flags);
++
++              pin_reg = readl(gpio_dev->base + i * 4);
++              pin_reg &= ~mask;
++              writel(pin_reg, gpio_dev->base + i * 4);
++
++              raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
++      }
++}
++
+ #ifdef CONFIG_PM_SLEEP
+ static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin)
+ {
+@@ -922,6 +950,9 @@ static int amd_gpio_probe(struct platform_device *pdev)
+               return PTR_ERR(gpio_dev->pctrl);
+       }
++      /* Disable and mask interrupts */
++      amd_gpio_irq_init(gpio_dev);
++
+       girq = &gpio_dev->gc.irq;
+       girq->chip = &amd_gpio_irqchip;
+       /* This will let us handle the parent IRQ in the driver */
+-- 
+2.39.2
+
diff --git a/queue-4.19/pinctrl-amd-disable-and-mask-interrupts-on-resume.patch b/queue-4.19/pinctrl-amd-disable-and-mask-interrupts-on-resume.patch
new file mode 100644 (file)
index 0000000..b291559
--- /dev/null
@@ -0,0 +1,102 @@
+From e089b05d98b0e4bd23e584b42f1e980bbec58408 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 Mar 2023 09:32:59 +0000
+Subject: pinctrl: amd: Disable and mask interrupts on resume
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Kornel Dulęba <korneld@chromium.org>
+
+[ Upstream commit b26cd9325be4c1fcd331b77f10acb627c560d4d7 ]
+
+This fixes a similar problem to the one observed in:
+commit 4e5a04be88fe ("pinctrl: amd: disable and mask interrupts on probe").
+
+On some systems, during suspend/resume cycle firmware leaves
+an interrupt enabled on a pin that is not used by the kernel.
+This confuses the AMD pinctrl driver and causes spurious interrupts.
+
+The driver already has logic to detect if a pin is used by the kernel.
+Leverage it to re-initialize interrupt fields of a pin only if it's not
+used by us.
+
+Cc: stable@vger.kernel.org
+Fixes: dbad75dd1f25 ("pinctrl: add AMD GPIO driver support.")
+Signed-off-by: Kornel Dulęba <korneld@chromium.org>
+Link: https://lore.kernel.org/r/20230320093259.845178-1-korneld@chromium.org
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/pinctrl-amd.c | 36 +++++++++++++++++++----------------
+ 1 file changed, 20 insertions(+), 16 deletions(-)
+
+diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
+index a44902b140879..3f9540d4fd362 100644
+--- a/drivers/pinctrl/pinctrl-amd.c
++++ b/drivers/pinctrl/pinctrl-amd.c
+@@ -774,32 +774,34 @@ static const struct pinconf_ops amd_pinconf_ops = {
+       .pin_config_group_set = amd_pinconf_group_set,
+ };
+-static void amd_gpio_irq_init(struct amd_gpio *gpio_dev)
++static void amd_gpio_irq_init_pin(struct amd_gpio *gpio_dev, int pin)
+ {
+-      struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
++      const struct pin_desc *pd;
+       unsigned long flags;
+       u32 pin_reg, mask;
+-      int i;
+       mask = BIT(WAKE_CNTRL_OFF_S0I3) | BIT(WAKE_CNTRL_OFF_S3) |
+               BIT(INTERRUPT_MASK_OFF) | BIT(INTERRUPT_ENABLE_OFF) |
+               BIT(WAKE_CNTRL_OFF_S4);
+-      for (i = 0; i < desc->npins; i++) {
+-              int pin = desc->pins[i].number;
+-              const struct pin_desc *pd = pin_desc_get(gpio_dev->pctrl, pin);
+-
+-              if (!pd)
+-                      continue;
++      pd = pin_desc_get(gpio_dev->pctrl, pin);
++      if (!pd)
++              return;
+-              raw_spin_lock_irqsave(&gpio_dev->lock, flags);
++      raw_spin_lock_irqsave(&gpio_dev->lock, flags);
++      pin_reg = readl(gpio_dev->base + pin * 4);
++      pin_reg &= ~mask;
++      writel(pin_reg, gpio_dev->base + pin * 4);
++      raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
++}
+-              pin_reg = readl(gpio_dev->base + i * 4);
+-              pin_reg &= ~mask;
+-              writel(pin_reg, gpio_dev->base + i * 4);
++static void amd_gpio_irq_init(struct amd_gpio *gpio_dev)
++{
++      struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
++      int i;
+-              raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
+-      }
++      for (i = 0; i < desc->npins; i++)
++              amd_gpio_irq_init_pin(gpio_dev, i);
+ }
+ #ifdef CONFIG_PM_SLEEP
+@@ -854,8 +856,10 @@ static int amd_gpio_resume(struct device *dev)
+       for (i = 0; i < desc->npins; i++) {
+               int pin = desc->pins[i].number;
+-              if (!amd_gpio_should_save(gpio_dev, pin))
++              if (!amd_gpio_should_save(gpio_dev, pin)) {
++                      amd_gpio_irq_init_pin(gpio_dev, pin);
+                       continue;
++              }
+               raw_spin_lock_irqsave(&gpio_dev->lock, flags);
+               gpio_dev->saved_regs[i] |= readl(gpio_dev->base + pin * 4) & PIN_IRQ_PENDING;
+-- 
+2.39.2
+
diff --git a/queue-4.19/pinctrl-amd-use-irqchip-template.patch b/queue-4.19/pinctrl-amd-use-irqchip-template.patch
new file mode 100644 (file)
index 0000000..2724cb6
--- /dev/null
@@ -0,0 +1,74 @@
+From 408a3542032f7316cf6c13f5c024cf86dd936cdb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 Jul 2020 12:15:45 +0200
+Subject: pinctrl: amd: Use irqchip template
+
+From: Linus Walleij <linus.walleij@linaro.org>
+
+[ Upstream commit e81376ebbafc679a5cea65f25f5ab242172f52df ]
+
+This makes the driver use the irqchip template to assign
+properties to the gpio_irq_chip instead of using the
+explicit call to gpiochip_irqchip_add().
+
+The irqchip is instead added while adding the gpiochip.
+
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Cc: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
+Cc: Sandeep Singh <sandeep.singh@amd.com>
+Link: https://lore.kernel.org/r/20200722101545.144373-1-linus.walleij@linaro.org
+Stable-dep-of: b26cd9325be4 ("pinctrl: amd: Disable and mask interrupts on resume")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/pinctrl-amd.c | 21 ++++++++++-----------
+ 1 file changed, 10 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
+index d76e50bc9d85c..4d283ebaaf230 100644
+--- a/drivers/pinctrl/pinctrl-amd.c
++++ b/drivers/pinctrl/pinctrl-amd.c
+@@ -858,6 +858,7 @@ static int amd_gpio_probe(struct platform_device *pdev)
+       int irq_base;
+       struct resource *res;
+       struct amd_gpio *gpio_dev;
++      struct gpio_irq_chip *girq;
+       gpio_dev = devm_kzalloc(&pdev->dev,
+                               sizeof(struct amd_gpio), GFP_KERNEL);
+@@ -921,6 +922,15 @@ static int amd_gpio_probe(struct platform_device *pdev)
+               return PTR_ERR(gpio_dev->pctrl);
+       }
++      girq = &gpio_dev->gc.irq;
++      girq->chip = &amd_gpio_irqchip;
++      /* This will let us handle the parent IRQ in the driver */
++      girq->parent_handler = NULL;
++      girq->num_parents = 0;
++      girq->parents = NULL;
++      girq->default_type = IRQ_TYPE_NONE;
++      girq->handler = handle_simple_irq;
++
+       ret = gpiochip_add_data(&gpio_dev->gc, gpio_dev);
+       if (ret)
+               return ret;
+@@ -932,17 +942,6 @@ static int amd_gpio_probe(struct platform_device *pdev)
+               goto out2;
+       }
+-      ret = gpiochip_irqchip_add(&gpio_dev->gc,
+-                              &amd_gpio_irqchip,
+-                              0,
+-                              handle_simple_irq,
+-                              IRQ_TYPE_NONE);
+-      if (ret) {
+-              dev_err(&pdev->dev, "could not add irqchip\n");
+-              ret = -ENODEV;
+-              goto out2;
+-      }
+-
+       ret = devm_request_irq(&pdev->dev, irq_base, amd_gpio_irq_handler,
+                              IRQF_SHARED, KBUILD_MODNAME, gpio_dev);
+       if (ret)
+-- 
+2.39.2
+
diff --git a/queue-4.19/series b/queue-4.19/series
new file mode 100644 (file)
index 0000000..1eb695c
--- /dev/null
@@ -0,0 +1,7 @@
+pinctrl-added-irqf_shared-flag-for-amd-pinctrl-drive.patch
+pinctrl-amd-use-irqchip-template.patch
+pinctrl-amd-disable-and-mask-interrupts-on-probe.patch
+pinctrl-amd-disable-and-mask-interrupts-on-resume.patch
+nfsv4-convert-struct-nfs4_state-to-use-refcount_t.patch
+nfsv4-check-the-return-value-of-update_open_stateid.patch
+nfsv4-fix-hangs-when-recovering-open-state-after-a-s.patch