]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.1
authorSasha Levin <sashal@kernel.org>
Wed, 31 May 2023 17:11:04 +0000 (13:11 -0400)
committerSasha Levin <sashal@kernel.org>
Wed, 31 May 2023 17:11:04 +0000 (13:11 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-6.1/dmaengine-at_xdmac-disable-enable-clock-directly-on-.patch [new file with mode: 0644]
queue-6.1/dmaengine-at_xdmac-do-not-resume-channels-paused-by-.patch [new file with mode: 0644]
queue-6.1/dmaengine-at_xdmac-restore-the-content-of-grws-regis.patch [new file with mode: 0644]
queue-6.1/octeontx2-af-add-validation-for-lmac-type.patch [new file with mode: 0644]
queue-6.1/rdma-rxe-fix-the-error-trying-to-register-non-static.patch [new file with mode: 0644]
queue-6.1/series
queue-6.1/wifi-iwlwifi-mvm-fix-potential-memory-leak.patch [new file with mode: 0644]
queue-6.1/wifi-iwlwifi-mvm-support-wowlan-info-notification-ve.patch [new file with mode: 0644]
queue-6.1/wifi-rtw89-correct-5-mhz-mask-setting.patch [new file with mode: 0644]

diff --git a/queue-6.1/dmaengine-at_xdmac-disable-enable-clock-directly-on-.patch b/queue-6.1/dmaengine-at_xdmac-disable-enable-clock-directly-on-.patch
new file mode 100644 (file)
index 0000000..d52d7f9
--- /dev/null
@@ -0,0 +1,56 @@
+From 573ebc5490ed734daba324fb737cd5b90b155138 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 Feb 2023 17:18:21 +0200
+Subject: dmaengine: at_xdmac: disable/enable clock directly on suspend/resume
+
+From: Claudiu Beznea <claudiu.beznea@microchip.com>
+
+[ Upstream commit 2de5ddb5e68c94b781b3789bca1ce52000d7d0e0 ]
+
+Runtime PM APIs for at_xdmac just plays with clk_enable()/clk_disable()
+letting aside the clk_prepare()/clk_unprepare() that needs to be
+executed as the clock is also prepared on probe. Thus instead of using
+runtime PM force suspend/resume APIs use
+clk_disable_unprepare() + pm_runtime_put_noidle() on suspend and
+clk_prepare_enable() + pm_runtime_get_noresume() on resume. This
+approach as been chosen instead of using runtime PM force suspend/resume
+with clk_unprepare()/clk_prepare() as it looks simpler and the final
+code is better.
+
+While at it added the missing pm_runtime_mark_last_busy() on suspend before
+decrementing the reference counter.
+
+Fixes: 650b0e990cbd ("dmaengine: at_xdmac: add runtime pm support")
+Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
+Link: https://lore.kernel.org/r/20230214151827.1050280-2-claudiu.beznea@microchip.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Stable-dep-of: 44fe8440bda5 ("dmaengine: at_xdmac: do not resume channels paused by consumers")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/at_xdmac.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
+index bfc8ae2143957..7f7557e4c31d7 100644
+--- a/drivers/dma/at_xdmac.c
++++ b/drivers/dma/at_xdmac.c
+@@ -1993,6 +1993,7 @@ static int __maybe_unused atmel_xdmac_suspend(struct device *dev)
+       at_xdmac_off(atxdmac);
+       clk_disable_unprepare(atxdmac->clk);
++
+       return 0;
+ }
+@@ -2009,6 +2010,8 @@ static int __maybe_unused atmel_xdmac_resume(struct device *dev)
+       if (ret)
+               return ret;
++      pm_runtime_get_noresume(atxdmac->dev);
++
+       at_xdmac_axi_config(pdev);
+       /* Clear pending interrupts. */
+-- 
+2.39.2
+
diff --git a/queue-6.1/dmaengine-at_xdmac-do-not-resume-channels-paused-by-.patch b/queue-6.1/dmaengine-at_xdmac-do-not-resume-channels-paused-by-.patch
new file mode 100644 (file)
index 0000000..8bd7a62
--- /dev/null
@@ -0,0 +1,134 @@
+From d532a33206f0551e79db35b0dcc35bca9dcb4beb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 Feb 2023 17:18:23 +0200
+Subject: dmaengine: at_xdmac: do not resume channels paused by consumers
+
+From: Claudiu Beznea <claudiu.beznea@microchip.com>
+
+[ Upstream commit 44fe8440bda545b5d167329df88c47609a645168 ]
+
+In case there are DMA channels not paused by consumers in suspend
+process (valid on AT91 SoCs for serial driver when no_console_suspend) the
+driver pauses them (using at_xdmac_device_pause() which is also the same
+function called by dmaengine_pause()) and then in the resume process the
+driver resumes them calling at_xdmac_device_resume() which is the same
+function called by dmaengine_resume()). This is good for DMA channels
+not paused by consumers but for drivers that calls
+dmaengine_pause()/dmaegine_resume() on suspend/resume path this may lead to
+DMA channel being enabled before the IP is enabled. For IPs that needs
+strict ordering with regards to DMA channel enablement this will lead to
+wrong behavior. To fix this add a new set of functions
+at_xdmac_device_pause_internal()/at_xdmac_device_resume_internal() to be
+called only on suspend/resume.
+
+Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver")
+Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
+Link: https://lore.kernel.org/r/20230214151827.1050280-4-claudiu.beznea@microchip.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/at_xdmac.c | 48 ++++++++++++++++++++++++++++++++++++------
+ 1 file changed, 42 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
+index 7f7557e4c31d7..cb1374b161291 100644
+--- a/drivers/dma/at_xdmac.c
++++ b/drivers/dma/at_xdmac.c
+@@ -186,6 +186,7 @@
+ enum atc_status {
+       AT_XDMAC_CHAN_IS_CYCLIC = 0,
+       AT_XDMAC_CHAN_IS_PAUSED,
++      AT_XDMAC_CHAN_IS_PAUSED_INTERNAL,
+ };
+ struct at_xdmac_layout {
+@@ -346,6 +347,11 @@ static inline int at_xdmac_chan_is_paused(struct at_xdmac_chan *atchan)
+       return test_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status);
+ }
++static inline int at_xdmac_chan_is_paused_internal(struct at_xdmac_chan *atchan)
++{
++      return test_bit(AT_XDMAC_CHAN_IS_PAUSED_INTERNAL, &atchan->status);
++}
++
+ static inline bool at_xdmac_chan_is_peripheral_xfer(u32 cfg)
+ {
+       return cfg & AT_XDMAC_CC_TYPE_PER_TRAN;
+@@ -1807,6 +1813,26 @@ static int at_xdmac_device_config(struct dma_chan *chan,
+       return ret;
+ }
++static void at_xdmac_device_pause_set(struct at_xdmac *atxdmac,
++                                    struct at_xdmac_chan *atchan)
++{
++      at_xdmac_write(atxdmac, atxdmac->layout->grws, atchan->mask);
++      while (at_xdmac_chan_read(atchan, AT_XDMAC_CC) &
++             (AT_XDMAC_CC_WRIP | AT_XDMAC_CC_RDIP))
++              cpu_relax();
++}
++
++static void at_xdmac_device_pause_internal(struct at_xdmac_chan *atchan)
++{
++      struct at_xdmac         *atxdmac = to_at_xdmac(atchan->chan.device);
++      unsigned long           flags;
++
++      spin_lock_irqsave(&atchan->lock, flags);
++      set_bit(AT_XDMAC_CHAN_IS_PAUSED_INTERNAL, &atchan->status);
++      at_xdmac_device_pause_set(atxdmac, atchan);
++      spin_unlock_irqrestore(&atchan->lock, flags);
++}
++
+ static int at_xdmac_device_pause(struct dma_chan *chan)
+ {
+       struct at_xdmac_chan    *atchan = to_at_xdmac_chan(chan);
+@@ -1819,15 +1845,25 @@ static int at_xdmac_device_pause(struct dma_chan *chan)
+               return 0;
+       spin_lock_irqsave(&atchan->lock, flags);
+-      at_xdmac_write(atxdmac, atxdmac->layout->grws, atchan->mask);
+-      while (at_xdmac_chan_read(atchan, AT_XDMAC_CC)
+-             & (AT_XDMAC_CC_WRIP | AT_XDMAC_CC_RDIP))
+-              cpu_relax();
++
++      at_xdmac_device_pause_set(atxdmac, atchan);
++      /* Decrement runtime PM ref counter for each active descriptor. */
+       spin_unlock_irqrestore(&atchan->lock, flags);
+       return 0;
+ }
++static void at_xdmac_device_resume_internal(struct at_xdmac_chan *atchan)
++{
++      struct at_xdmac         *atxdmac = to_at_xdmac(atchan->chan.device);
++      unsigned long           flags;
++
++      spin_lock_irqsave(&atchan->lock, flags);
++      at_xdmac_write(atxdmac, atxdmac->layout->grwr, atchan->mask);
++      clear_bit(AT_XDMAC_CHAN_IS_PAUSED_INTERNAL, &atchan->status);
++      spin_unlock_irqrestore(&atchan->lock, flags);
++}
++
+ static int at_xdmac_device_resume(struct dma_chan *chan)
+ {
+       struct at_xdmac_chan    *atchan = to_at_xdmac_chan(chan);
+@@ -1982,7 +2018,7 @@ static int __maybe_unused atmel_xdmac_suspend(struct device *dev)
+               atchan->save_cc = at_xdmac_chan_read(atchan, AT_XDMAC_CC);
+               if (at_xdmac_chan_is_cyclic(atchan)) {
+                       if (!at_xdmac_chan_is_paused(atchan))
+-                              at_xdmac_device_pause(chan);
++                              at_xdmac_device_pause_internal(atchan);
+                       atchan->save_cim = at_xdmac_chan_read(atchan, AT_XDMAC_CIM);
+                       atchan->save_cnda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA);
+                       atchan->save_cndc = at_xdmac_chan_read(atchan, AT_XDMAC_CNDC);
+@@ -2027,7 +2063,7 @@ static int __maybe_unused atmel_xdmac_resume(struct device *dev)
+               at_xdmac_chan_write(atchan, AT_XDMAC_CC, atchan->save_cc);
+               if (at_xdmac_chan_is_cyclic(atchan)) {
+                       if (at_xdmac_chan_is_paused(atchan))
+-                              at_xdmac_device_resume(chan);
++                              at_xdmac_device_resume_internal(atchan);
+                       at_xdmac_chan_write(atchan, AT_XDMAC_CNDA, atchan->save_cnda);
+                       at_xdmac_chan_write(atchan, AT_XDMAC_CNDC, atchan->save_cndc);
+                       at_xdmac_chan_write(atchan, AT_XDMAC_CIE, atchan->save_cim);
+-- 
+2.39.2
+
diff --git a/queue-6.1/dmaengine-at_xdmac-restore-the-content-of-grws-regis.patch b/queue-6.1/dmaengine-at_xdmac-restore-the-content-of-grws-regis.patch
new file mode 100644 (file)
index 0000000..b90609d
--- /dev/null
@@ -0,0 +1,47 @@
+From 5928229bf4726638572b676c906a107242a89c7a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 Feb 2023 17:18:24 +0200
+Subject: dmaengine: at_xdmac: restore the content of grws register
+
+From: Claudiu Beznea <claudiu.beznea@microchip.com>
+
+[ Upstream commit 7c5eb63d16b01c202aaa95f374ae15a807745a73 ]
+
+In case the system suspends to a deep sleep state where power to DMA
+controller is cut-off we need to restore the content of GRWS register.
+This is a write only register and writing bit X tells the controller
+to suspend read and write requests for channel X. Thus set GRWS before
+restoring the content of GE (Global Enable) regiter.
+
+Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver")
+Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
+Link: https://lore.kernel.org/r/20230214151827.1050280-5-claudiu.beznea@microchip.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/at_xdmac.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
+index cb1374b161291..fc018b633822e 100644
+--- a/drivers/dma/at_xdmac.c
++++ b/drivers/dma/at_xdmac.c
+@@ -2064,6 +2064,15 @@ static int __maybe_unused atmel_xdmac_resume(struct device *dev)
+               if (at_xdmac_chan_is_cyclic(atchan)) {
+                       if (at_xdmac_chan_is_paused(atchan))
+                               at_xdmac_device_resume_internal(atchan);
++
++                      /*
++                       * We may resume from a deep sleep state where power
++                       * to DMA controller is cut-off. Thus, restore the
++                       * suspend state of channels set though dmaengine API.
++                       */
++                      else if (at_xdmac_chan_is_paused(atchan))
++                              at_xdmac_device_pause_set(atxdmac, atchan);
++
+                       at_xdmac_chan_write(atchan, AT_XDMAC_CNDA, atchan->save_cnda);
+                       at_xdmac_chan_write(atchan, AT_XDMAC_CNDC, atchan->save_cndc);
+                       at_xdmac_chan_write(atchan, AT_XDMAC_CIE, atchan->save_cim);
+-- 
+2.39.2
+
diff --git a/queue-6.1/octeontx2-af-add-validation-for-lmac-type.patch b/queue-6.1/octeontx2-af-add-validation-for-lmac-type.patch
new file mode 100644 (file)
index 0000000..e77ec9f
--- /dev/null
@@ -0,0 +1,60 @@
+From 13e3363f94c6b3abc9b2ddc554caa4b72648fa4d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 May 2023 12:39:38 +0530
+Subject: octeontx2-af: Add validation for lmac type
+
+From: Hariprasad Kelam <hkelam@marvell.com>
+
+[ Upstream commit cb5edce271764524b88b1a6866b3e626686d9a33 ]
+
+Upon physical link change, firmware reports to the kernel about the
+change along with the details like speed, lmac_type_id, etc.
+Kernel derives lmac_type based on lmac_type_id received from firmware.
+
+In a few scenarios, firmware returns an invalid lmac_type_id, which
+is resulting in below kernel panic. This patch adds the missing
+validation of the lmac_type_id field.
+
+Internal error: Oops: 96000005 [#1] PREEMPT SMP
+[   35.321595] Modules linked in:
+[   35.328982] CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted
+5.4.210-g2e3169d8e1bc-dirty #17
+[   35.337014] Hardware name: Marvell CN103XX board (DT)
+[   35.344297] Workqueue: events work_for_cpu_fn
+[   35.352730] pstate: 40400089 (nZcv daIf +PAN -UAO)
+[   35.360267] pc : strncpy+0x10/0x30
+[   35.366595] lr : cgx_link_change_handler+0x90/0x180
+
+Fixes: 61071a871ea6 ("octeontx2-af: Forward CGX link notifications to PFs")
+Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
+Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
+Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
+Reviewed-by: Simon Horman <simon.horman@corigine.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+index 8fdd3afe59981..afdddfced7e69 100644
+--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
++++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+@@ -1225,6 +1225,14 @@ static inline void link_status_user_format(u64 lstat,
+       linfo->an = FIELD_GET(RESP_LINKSTAT_AN, lstat);
+       linfo->fec = FIELD_GET(RESP_LINKSTAT_FEC, lstat);
+       linfo->lmac_type_id = cgx_get_lmac_type(cgx, lmac_id);
++
++      if (linfo->lmac_type_id >= LMAC_MODE_MAX) {
++              dev_err(&cgx->pdev->dev, "Unknown lmac_type_id %d reported by firmware on cgx port%d:%d",
++                      linfo->lmac_type_id, cgx->cgx_id, lmac_id);
++              strncpy(linfo->lmac_type, "Unknown", LMACTYPE_STR_LEN - 1);
++              return;
++      }
++
+       lmac_string = cgx_lmactype_string[linfo->lmac_type_id];
+       strncpy(linfo->lmac_type, lmac_string, LMACTYPE_STR_LEN - 1);
+ }
+-- 
+2.39.2
+
diff --git a/queue-6.1/rdma-rxe-fix-the-error-trying-to-register-non-static.patch b/queue-6.1/rdma-rxe-fix-the-error-trying-to-register-non-static.patch
new file mode 100644 (file)
index 0000000..0d2abe0
--- /dev/null
@@ -0,0 +1,53 @@
+From 09ee3b21766c1b8814eeedb4a871d6b637a3d905 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Apr 2023 18:11:15 +0800
+Subject: RDMA/rxe: Fix the error "trying to register non-static key in
+ rxe_cleanup_task"
+
+From: Zhu Yanjun <yanjun.zhu@linux.dev>
+
+[ Upstream commit b2b1ddc457458fecd1c6f385baa9fbda5f0c63ad ]
+
+In the function rxe_create_qp(), rxe_qp_from_init() is called to
+initialize qp, internally things like rxe_init_task are not setup until
+rxe_qp_init_req().
+
+If an error occurred before this point then the unwind will call
+rxe_cleanup() and eventually to rxe_qp_do_cleanup()/rxe_cleanup_task()
+which will oops when trying to access the uninitialized spinlock.
+
+If rxe_init_task is not executed, rxe_cleanup_task will not be called.
+
+Reported-by: syzbot+cfcc1a3c85be15a40cba@syzkaller.appspotmail.com
+Link: https://syzkaller.appspot.com/bug?id=fd85757b74b3eb59f904138486f755f71e090df8
+Fixes: 8700e3e7c485 ("Soft RoCE driver")
+Fixes: 2d4b21e0a291 ("IB/rxe: Prevent from completer to operate on non valid QP")
+Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
+Link: https://lore.kernel.org/r/20230413101115.1366068-1-yanjun.zhu@intel.com
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/infiniband/sw/rxe/rxe_qp.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
+index e459fb542b83a..1f6e006c51c4a 100644
+--- a/drivers/infiniband/sw/rxe/rxe_qp.c
++++ b/drivers/infiniband/sw/rxe/rxe_qp.c
+@@ -792,8 +792,11 @@ static void rxe_qp_do_cleanup(struct work_struct *work)
+               del_timer_sync(&qp->rnr_nak_timer);
+       }
+-      rxe_cleanup_task(&qp->req.task);
+-      rxe_cleanup_task(&qp->comp.task);
++      if (qp->req.task.func)
++              rxe_cleanup_task(&qp->req.task);
++
++      if (qp->comp.task.func)
++              rxe_cleanup_task(&qp->comp.task);
+       /* flush out any receive wr's or pending requests */
+       if (qp->req.task.func)
+-- 
+2.39.2
+
index a1bbbb9c10a7ee08a30972e2c0d29b524272c136..036e4c565b4be419baf818e0ffbbf4c4c13fcb4e 100644 (file)
@@ -24,3 +24,11 @@ vfio-type1-check-pfn-valid-before-converting-to-stru.patch
 net-page_pool-use-in_softirq-instead.patch
 page_pool-fix-inconsistency-for-page_pool_ring_-un-l.patch
 net-phy-mscc-enable-vsc8501-2-rgmii-rx-clock.patch
+wifi-rtw89-correct-5-mhz-mask-setting.patch
+wifi-iwlwifi-mvm-support-wowlan-info-notification-ve.patch
+wifi-iwlwifi-mvm-fix-potential-memory-leak.patch
+rdma-rxe-fix-the-error-trying-to-register-non-static.patch
+dmaengine-at_xdmac-disable-enable-clock-directly-on-.patch
+dmaengine-at_xdmac-do-not-resume-channels-paused-by-.patch
+dmaengine-at_xdmac-restore-the-content-of-grws-regis.patch
+octeontx2-af-add-validation-for-lmac-type.patch
diff --git a/queue-6.1/wifi-iwlwifi-mvm-fix-potential-memory-leak.patch b/queue-6.1/wifi-iwlwifi-mvm-fix-potential-memory-leak.patch
new file mode 100644 (file)
index 0000000..94ca143
--- /dev/null
@@ -0,0 +1,58 @@
+From 23492c160e827ce52d7a893fd751ca2d35de47fa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 18 Apr 2023 12:28:08 +0300
+Subject: wifi: iwlwifi: mvm: fix potential memory leak
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit 457d7fb03e6c3d73fbb509bd85fc4b02d1ab405e ]
+
+If we do get multiple notifications from firmware, then
+we might have allocated 'notif', but don't free it. Fix
+that by checking for duplicates before allocation.
+
+Fixes: 4da46a06d443 ("wifi: iwlwifi: mvm: Add support for wowlan info notification")
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
+Link: https://lore.kernel.org/r/20230418122405.116758321cc4.I8bdbcbb38c89ac637eaa20dda58fa9165b25893a@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+index 0253dedb9b71a..c876e81437fee 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+@@ -2714,6 +2714,13 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait,
+       case WIDE_ID(PROT_OFFLOAD_GROUP, WOWLAN_INFO_NOTIFICATION): {
+               struct iwl_wowlan_info_notif *notif;
++              if (d3_data->notif_received & IWL_D3_NOTIF_WOWLAN_INFO) {
++                      /* We might get two notifications due to dual bss */
++                      IWL_DEBUG_WOWLAN(mvm,
++                                       "Got additional wowlan info notification\n");
++                      break;
++              }
++
+               if (wowlan_info_ver < 2) {
+                       struct iwl_wowlan_info_notif_v1 *notif_v1 = (void *)pkt->data;
+@@ -2732,13 +2739,6 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait,
+                       notif = (void *)pkt->data;
+               }
+-              if (d3_data->notif_received & IWL_D3_NOTIF_WOWLAN_INFO) {
+-                      /* We might get two notifications due to dual bss */
+-                      IWL_DEBUG_WOWLAN(mvm,
+-                                       "Got additional wowlan info notification\n");
+-                      break;
+-              }
+-
+               d3_data->notif_received |= IWL_D3_NOTIF_WOWLAN_INFO;
+               len = iwl_rx_packet_payload_len(pkt);
+               iwl_mvm_parse_wowlan_info_notif(mvm, notif, d3_data->status,
+-- 
+2.39.2
+
diff --git a/queue-6.1/wifi-iwlwifi-mvm-support-wowlan-info-notification-ve.patch b/queue-6.1/wifi-iwlwifi-mvm-support-wowlan-info-notification-ve.patch
new file mode 100644 (file)
index 0000000..470bde1
--- /dev/null
@@ -0,0 +1,152 @@
+From 4dada827feddcf97216c3e02cebebbc7f1167625 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Apr 2023 21:40:27 +0300
+Subject: wifi: iwlwifi: mvm: support wowlan info notification version 2
+
+From: Haim Dreyfuss <haim.dreyfuss@intel.com>
+
+[ Upstream commit 905d50ddbc83bef0d7f3386e7f3472b0324b405b ]
+
+As part of version 2 we don't need to have wake_packet_bufsize
+and wake_packet_length. The first one is already calculated by the driver,
+the latter is sent as part of the wake packet notification.
+
+Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
+Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
+Link: https://lore.kernel.org/r/20230413213309.3b53213b10d4.Ibf2f15aca614def2d262dd267d1aad65931b58f1@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Stable-dep-of: 457d7fb03e6c ("wifi: iwlwifi: mvm: fix potential memory leak")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../net/wireless/intel/iwlwifi/fw/api/d3.h    | 37 ++++++++++++++++++-
+ drivers/net/wireless/intel/iwlwifi/mvm/d3.c   | 35 +++++++++++++++++-
+ 2 files changed, 69 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/d3.h b/drivers/net/wireless/intel/iwlwifi/fw/api/d3.h
+index df0833890e55a..8a613e150a024 100644
+--- a/drivers/net/wireless/intel/iwlwifi/fw/api/d3.h
++++ b/drivers/net/wireless/intel/iwlwifi/fw/api/d3.h
+@@ -767,7 +767,7 @@ struct iwl_wowlan_status_v12 {
+ } __packed; /* WOWLAN_STATUSES_RSP_API_S_VER_12 */
+ /**
+- * struct iwl_wowlan_info_notif - WoWLAN information notification
++ * struct iwl_wowlan_info_notif_v1 - WoWLAN information notification
+  * @gtk: GTK data
+  * @igtk: IGTK data
+  * @replay_ctr: GTK rekey replay counter
+@@ -785,7 +785,7 @@ struct iwl_wowlan_status_v12 {
+  * @station_id: station id
+  * @reserved2: reserved
+  */
+-struct iwl_wowlan_info_notif {
++struct iwl_wowlan_info_notif_v1 {
+       struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
+       struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
+       __le64 replay_ctr;
+@@ -803,6 +803,39 @@ struct iwl_wowlan_info_notif {
+       u8 reserved2[2];
+ } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_1 */
++/**
++ * struct iwl_wowlan_info_notif - WoWLAN information notification
++ * @gtk: GTK data
++ * @igtk: IGTK data
++ * @replay_ctr: GTK rekey replay counter
++ * @pattern_number: number of the matched patterns
++ * @reserved1: reserved
++ * @qos_seq_ctr: QoS sequence counters to use next
++ * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
++ * @num_of_gtk_rekeys: number of GTK rekeys
++ * @transmitted_ndps: number of transmitted neighbor discovery packets
++ * @received_beacons: number of received beacons
++ * @tid_tear_down: bit mask of tids whose BA sessions were closed
++ *    in suspend state
++ * @station_id: station id
++ * @reserved2: reserved
++ */
++struct iwl_wowlan_info_notif {
++      struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
++      struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
++      __le64 replay_ctr;
++      __le16 pattern_number;
++      __le16 reserved1;
++      __le16 qos_seq_ctr[8];
++      __le32 wakeup_reasons;
++      __le32 num_of_gtk_rekeys;
++      __le32 transmitted_ndps;
++      __le32 received_beacons;
++      u8 tid_tear_down;
++      u8 station_id;
++      u8 reserved2[2];
++} __packed; /* WOWLAN_INFO_NTFY_API_S_VER_2 */
++
+ /**
+  * struct iwl_wowlan_wake_pkt_notif - WoWLAN wake packet notification
+  * @wake_packet_length: wakeup packet length
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+index bbdda3e1ff3fc..0253dedb9b71a 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+@@ -2011,6 +2011,12 @@ static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm,
+ {
+       u32 i;
++      if (!data) {
++              IWL_ERR(mvm, "iwl_wowlan_info_notif data is NULL\n");
++              status = NULL;
++              return;
++      }
++
+       if (len < sizeof(*data)) {
+               IWL_ERR(mvm, "Invalid WoWLAN info notification!\n");
+               status = NULL;
+@@ -2698,10 +2704,33 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait,
+       struct iwl_d3_data *d3_data = data;
+       u32 len;
+       int ret;
++      int wowlan_info_ver = iwl_fw_lookup_notif_ver(mvm->fw,
++                                                    PROT_OFFLOAD_GROUP,
++                                                    WOWLAN_INFO_NOTIFICATION,
++                                                    IWL_FW_CMD_VER_UNKNOWN);
++
+       switch (WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd)) {
+       case WIDE_ID(PROT_OFFLOAD_GROUP, WOWLAN_INFO_NOTIFICATION): {
+-              struct iwl_wowlan_info_notif *notif = (void *)pkt->data;
++              struct iwl_wowlan_info_notif *notif;
++
++              if (wowlan_info_ver < 2) {
++                      struct iwl_wowlan_info_notif_v1 *notif_v1 = (void *)pkt->data;
++
++                      notif = kmemdup(notif_v1,
++                                      offsetofend(struct iwl_wowlan_info_notif,
++                                                  received_beacons),
++                                      GFP_ATOMIC);
++
++                      if (!notif)
++                              return false;
++
++                      notif->tid_tear_down = notif_v1->tid_tear_down;
++                      notif->station_id = notif_v1->station_id;
++
++              } else {
++                      notif = (void *)pkt->data;
++              }
+               if (d3_data->notif_received & IWL_D3_NOTIF_WOWLAN_INFO) {
+                       /* We might get two notifications due to dual bss */
+@@ -2714,6 +2743,10 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait,
+               len = iwl_rx_packet_payload_len(pkt);
+               iwl_mvm_parse_wowlan_info_notif(mvm, notif, d3_data->status,
+                                               len);
++
++              if (wowlan_info_ver < 2)
++                      kfree(notif);
++
+               if (d3_data->status &&
+                   d3_data->status->wakeup_reasons & IWL_WOWLAN_WAKEUP_REASON_HAS_WAKEUP_PKT)
+                       /* We are supposed to get also wake packet notif */
+-- 
+2.39.2
+
diff --git a/queue-6.1/wifi-rtw89-correct-5-mhz-mask-setting.patch b/queue-6.1/wifi-rtw89-correct-5-mhz-mask-setting.patch
new file mode 100644 (file)
index 0000000..ceb39af
--- /dev/null
@@ -0,0 +1,56 @@
+From f510296a3a539d8b33d4b76814f0850d4befc8c1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 6 Apr 2023 15:28:41 +0800
+Subject: wifi: rtw89: correct 5 MHz mask setting
+
+From: Eric Huang <echuang@realtek.com>
+
+[ Upstream commit d33fc8d0368c180fe2338bfae4f5367a66a719f4 ]
+
+Use primary channel index to determine which 5 MHz mask should be enable.
+This mask is used to prevent noise from channel edge to effect CCA
+threshold in wide bandwidth (>= 40 MHZ).
+
+Fixes: 1b00e9236a71 ("rtw89: 8852c: add set channel of BB part")
+Fixes: 6b0698984eb0 ("wifi: rtw89: 8852b: add chip_ops::set_channel")
+Cc: stable@vger.kernel.org
+Signed-off-by: Eric Huang <echuang@realtek.com>
+Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://lore.kernel.org/r/20230406072841.8308-1-pkshih@realtek.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/realtek/rtw89/rtw8852c.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
+index 67653b3e1a356..3109114cec6ff 100644
+--- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c
++++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c
+@@ -1484,18 +1484,19 @@ static void rtw8852c_5m_mask(struct rtw89_dev *rtwdev,
+                            const struct rtw89_chan *chan,
+                            enum rtw89_phy_idx phy_idx)
+ {
+-      u8 pri_ch = chan->primary_channel;
++      u8 pri_ch = chan->pri_ch_idx;
+       bool mask_5m_low;
+       bool mask_5m_en;
+       switch (chan->band_width) {
+       case RTW89_CHANNEL_WIDTH_40:
+               mask_5m_en = true;
+-              mask_5m_low = pri_ch == 2;
++              mask_5m_low = pri_ch == RTW89_SC_20_LOWER;
+               break;
+       case RTW89_CHANNEL_WIDTH_80:
+-              mask_5m_en = ((pri_ch == 3) || (pri_ch == 4));
+-              mask_5m_low = pri_ch == 4;
++              mask_5m_en = pri_ch == RTW89_SC_20_UPMOST ||
++                           pri_ch == RTW89_SC_20_LOWEST;
++              mask_5m_low = pri_ch == RTW89_SC_20_LOWEST;
+               break;
+       default:
+               mask_5m_en = false;
+-- 
+2.39.2
+