]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Jun 2024 14:21:11 +0000 (16:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Jun 2024 14:21:11 +0000 (16:21 +0200)
added patches:
dmaengine-axi-dmac-fix-possible-race-in-remove.patch
fs-proc-fix-softlockup-in-__read_vmcore.patch
iio-adc-axi-adc-make-sure-axi-clock-is-enabled.patch
iio-invensense-fix-interrupt-timestamp-alignment.patch
knfsd-lookup-can-return-an-illegal-error-value.patch
ocfs2-fix-races-between-hole-punching-and-aio-dio.patch
ocfs2-use-coarse-time-for-new-created-files.patch
pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch
remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch
remoteproc-k3-r5-wait-for-core0-power-up-before-powering-up-core1.patch

queue-6.6/dmaengine-axi-dmac-fix-possible-race-in-remove.patch [new file with mode: 0644]
queue-6.6/fs-proc-fix-softlockup-in-__read_vmcore.patch [new file with mode: 0644]
queue-6.6/iio-adc-axi-adc-make-sure-axi-clock-is-enabled.patch [new file with mode: 0644]
queue-6.6/iio-invensense-fix-interrupt-timestamp-alignment.patch [new file with mode: 0644]
queue-6.6/knfsd-lookup-can-return-an-illegal-error-value.patch [new file with mode: 0644]
queue-6.6/ocfs2-fix-races-between-hole-punching-and-aio-dio.patch [new file with mode: 0644]
queue-6.6/ocfs2-use-coarse-time-for-new-created-files.patch [new file with mode: 0644]
queue-6.6/pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch [new file with mode: 0644]
queue-6.6/remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch [new file with mode: 0644]
queue-6.6/remoteproc-k3-r5-wait-for-core0-power-up-before-powering-up-core1.patch [new file with mode: 0644]
queue-6.6/series

diff --git a/queue-6.6/dmaengine-axi-dmac-fix-possible-race-in-remove.patch b/queue-6.6/dmaengine-axi-dmac-fix-possible-race-in-remove.patch
new file mode 100644 (file)
index 0000000..d9d1e68
--- /dev/null
@@ -0,0 +1,35 @@
+From 1bc31444209c8efae98cb78818131950d9a6f4d6 Mon Sep 17 00:00:00 2001
+From: Nuno Sa <nuno.sa@analog.com>
+Date: Thu, 28 Mar 2024 14:58:50 +0100
+Subject: dmaengine: axi-dmac: fix possible race in remove()
+
+From: Nuno Sa <nuno.sa@analog.com>
+
+commit 1bc31444209c8efae98cb78818131950d9a6f4d6 upstream.
+
+We need to first free the IRQ before calling of_dma_controller_free().
+Otherwise we could get an interrupt and schedule a tasklet while
+removing the DMA controller.
+
+Fixes: 0e3b67b348b8 ("dmaengine: Add support for the Analog Devices AXI-DMAC DMA controller")
+Cc: stable@kernel.org
+Signed-off-by: Nuno Sa <nuno.sa@analog.com>
+Link: https://lore.kernel.org/r/20240328-axi-dmac-devm-probe-v3-1-523c0176df70@analog.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/dma-axi-dmac.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/dma/dma-axi-dmac.c
++++ b/drivers/dma/dma-axi-dmac.c
+@@ -1033,8 +1033,8 @@ static int axi_dmac_remove(struct platfo
+ {
+       struct axi_dmac *dmac = platform_get_drvdata(pdev);
+-      of_dma_controller_free(pdev->dev.of_node);
+       free_irq(dmac->irq, dmac);
++      of_dma_controller_free(pdev->dev.of_node);
+       tasklet_kill(&dmac->chan.vchan.task);
+       dma_async_device_unregister(&dmac->dma_dev);
+       clk_disable_unprepare(dmac->clk);
diff --git a/queue-6.6/fs-proc-fix-softlockup-in-__read_vmcore.patch b/queue-6.6/fs-proc-fix-softlockup-in-__read_vmcore.patch
new file mode 100644 (file)
index 0000000..b4bfe48
--- /dev/null
@@ -0,0 +1,42 @@
+From 5cbcb62dddf5346077feb82b7b0c9254222d3445 Mon Sep 17 00:00:00 2001
+From: Rik van Riel <riel@surriel.com>
+Date: Tue, 7 May 2024 09:18:58 -0400
+Subject: fs/proc: fix softlockup in __read_vmcore
+
+From: Rik van Riel <riel@surriel.com>
+
+commit 5cbcb62dddf5346077feb82b7b0c9254222d3445 upstream.
+
+While taking a kernel core dump with makedumpfile on a larger system,
+softlockup messages often appear.
+
+While softlockup warnings can be harmless, they can also interfere with
+things like RCU freeing memory, which can be problematic when the kdump
+kexec image is configured with as little memory as possible.
+
+Avoid the softlockup, and give things like work items and RCU a chance to
+do their thing during __read_vmcore by adding a cond_resched.
+
+Link: https://lkml.kernel.org/r/20240507091858.36ff767f@imladris.surriel.com
+Signed-off-by: Rik van Riel <riel@surriel.com>
+Acked-by: Baoquan He <bhe@redhat.com>
+Cc: Dave Young <dyoung@redhat.com>
+Cc: Vivek Goyal <vgoyal@redhat.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/proc/vmcore.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/proc/vmcore.c
++++ b/fs/proc/vmcore.c
+@@ -383,6 +383,8 @@ static ssize_t __read_vmcore(struct iov_
+               /* leave now if filled buffer already */
+               if (!iov_iter_count(iter))
+                       return acc;
++
++              cond_resched();
+       }
+       list_for_each_entry(m, &vmcore_list, list) {
diff --git a/queue-6.6/iio-adc-axi-adc-make-sure-axi-clock-is-enabled.patch b/queue-6.6/iio-adc-axi-adc-make-sure-axi-clock-is-enabled.patch
new file mode 100644 (file)
index 0000000..ba45070
--- /dev/null
@@ -0,0 +1,47 @@
+From 80721776c5af6f6dce7d84ba8df063957aa425a2 Mon Sep 17 00:00:00 2001
+From: Nuno Sa <nuno.sa@analog.com>
+Date: Fri, 26 Apr 2024 17:42:13 +0200
+Subject: iio: adc: axi-adc: make sure AXI clock is enabled
+
+From: Nuno Sa <nuno.sa@analog.com>
+
+commit 80721776c5af6f6dce7d84ba8df063957aa425a2 upstream.
+
+We can only access the IP core registers if the bus clock is enabled. As
+such we need to get and enable it and not rely on anyone else to do it.
+
+Note this clock is a very fundamental one that is typically enabled
+pretty early during boot. Independently of that, we should really rely on
+it to be enabled.
+
+Fixes: ef04070692a2 ("iio: adc: adi-axi-adc: add support for AXI ADC IP core")
+Signed-off-by: Nuno Sa <nuno.sa@analog.com>
+Link: https://lore.kernel.org/r/20240426-ad9467-new-features-v2-4-6361fc3ba1cc@analog.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/adc/adi-axi-adc.c |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/iio/adc/adi-axi-adc.c
++++ b/drivers/iio/adc/adi-axi-adc.c
+@@ -175,6 +175,7 @@ static int adi_axi_adc_probe(struct plat
+       struct adi_axi_adc_state *st;
+       void __iomem *base;
+       unsigned int ver;
++      struct clk *clk;
+       int ret;
+       st = devm_kzalloc(&pdev->dev, sizeof(*st), GFP_KERNEL);
+@@ -195,6 +196,10 @@ static int adi_axi_adc_probe(struct plat
+       if (!expected_ver)
+               return -ENODEV;
++      clk = devm_clk_get_enabled(&pdev->dev, NULL);
++      if (IS_ERR(clk))
++              return PTR_ERR(clk);
++
+       /*
+        * Force disable the core. Up to the frontend to enable us. And we can
+        * still read/write registers...
diff --git a/queue-6.6/iio-invensense-fix-interrupt-timestamp-alignment.patch b/queue-6.6/iio-invensense-fix-interrupt-timestamp-alignment.patch
new file mode 100644 (file)
index 0000000..8dc1f21
--- /dev/null
@@ -0,0 +1,50 @@
+From 0340dc4c82590d8735c58cf904a8aa1173273ab5 Mon Sep 17 00:00:00 2001
+From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+Date: Fri, 26 Apr 2024 13:58:14 +0000
+Subject: iio: invensense: fix interrupt timestamp alignment
+
+From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+
+commit 0340dc4c82590d8735c58cf904a8aa1173273ab5 upstream.
+
+Restrict interrupt timestamp alignment for not overflowing max/min
+period thresholds.
+
+Fixes: 0ecc363ccea7 ("iio: make invensense timestamp module generic")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+Link: https://lore.kernel.org/r/20240426135814.141837-1-inv.git-commit@tdk.com
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/common/inv_sensors/inv_sensors_timestamp.c |    9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
++++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
+@@ -105,6 +105,9 @@ static bool inv_update_chip_period(struc
+ static void inv_align_timestamp_it(struct inv_sensors_timestamp *ts)
+ {
++      const int64_t period_min = ts->min_period * ts->mult;
++      const int64_t period_max = ts->max_period * ts->mult;
++      int64_t add_max, sub_max;
+       int64_t delta, jitter;
+       int64_t adjust;
+@@ -112,11 +115,13 @@ static void inv_align_timestamp_it(struc
+       delta = ts->it.lo - ts->timestamp;
+       /* adjust timestamp while respecting jitter */
++      add_max = period_max - (int64_t)ts->period;
++      sub_max = period_min - (int64_t)ts->period;
+       jitter = INV_SENSORS_TIMESTAMP_JITTER((int64_t)ts->period, ts->chip.jitter);
+       if (delta > jitter)
+-              adjust = jitter;
++              adjust = add_max;
+       else if (delta < -jitter)
+-              adjust = -jitter;
++              adjust = sub_max;
+       else
+               adjust = 0;
diff --git a/queue-6.6/knfsd-lookup-can-return-an-illegal-error-value.patch b/queue-6.6/knfsd-lookup-can-return-an-illegal-error-value.patch
new file mode 100644 (file)
index 0000000..a96d723
--- /dev/null
@@ -0,0 +1,47 @@
+From e221c45da3770962418fb30c27d941bbc70d595a Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+Date: Mon, 6 May 2024 12:30:04 -0400
+Subject: knfsd: LOOKUP can return an illegal error value
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+commit e221c45da3770962418fb30c27d941bbc70d595a upstream.
+
+The 'NFS error' NFSERR_OPNOTSUPP is not described by any of the official
+NFS related RFCs, but appears to have snuck into some older .x files for
+NFSv2.
+Either way, it is not in RFC1094, RFC1813 or any of the NFSv4 RFCs, so
+should not be returned by the knfsd server, and particularly not by the
+"LOOKUP" operation.
+
+Instead, let's return NFSERR_STALE, which is more appropriate if the
+filesystem encodes the filehandle as FILEID_INVALID.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfsd/nfsfh.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/nfsd/nfsfh.c
++++ b/fs/nfsd/nfsfh.c
+@@ -572,7 +572,7 @@ fh_compose(struct svc_fh *fhp, struct sv
+               _fh_update(fhp, exp, dentry);
+       if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID) {
+               fh_put(fhp);
+-              return nfserr_opnotsupp;
++              return nfserr_stale;
+       }
+       return 0;
+@@ -598,7 +598,7 @@ fh_update(struct svc_fh *fhp)
+       _fh_update(fhp, fhp->fh_export, dentry);
+       if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID)
+-              return nfserr_opnotsupp;
++              return nfserr_stale;
+       return 0;
+ out_bad:
+       printk(KERN_ERR "fh_update: fh not verified!\n");
diff --git a/queue-6.6/ocfs2-fix-races-between-hole-punching-and-aio-dio.patch b/queue-6.6/ocfs2-fix-races-between-hole-punching-and-aio-dio.patch
new file mode 100644 (file)
index 0000000..1de5c6d
--- /dev/null
@@ -0,0 +1,91 @@
+From 952b023f06a24b2ad6ba67304c4c84d45bea2f18 Mon Sep 17 00:00:00 2001
+From: Su Yue <glass.su@suse.com>
+Date: Mon, 8 Apr 2024 16:20:39 +0800
+Subject: ocfs2: fix races between hole punching and AIO+DIO
+
+From: Su Yue <glass.su@suse.com>
+
+commit 952b023f06a24b2ad6ba67304c4c84d45bea2f18 upstream.
+
+After commit "ocfs2: return real error code in ocfs2_dio_wr_get_block",
+fstests/generic/300 become from always failed to sometimes failed:
+
+========================================================================
+[  473.293420 ] run fstests generic/300
+
+[  475.296983 ] JBD2: Ignoring recovery information on journal
+[  475.302473 ] ocfs2: Mounting device (253,1) on (node local, slot 0) with ordered data mode.
+[  494.290998 ] OCFS2: ERROR (device dm-1): ocfs2_change_extent_flag: Owner 5668 has an extent at cpos 78723 which can no longer be found
+[  494.291609 ] On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
+[  494.292018 ] OCFS2: File system is now read-only.
+[  494.292224 ] (kworker/19:11,2628,19):ocfs2_mark_extent_written:5272 ERROR: status = -30
+[  494.292602 ] (kworker/19:11,2628,19):ocfs2_dio_end_io_write:2374 ERROR: status = -3
+fio: io_u error on file /mnt/scratch/racer: Read-only file system: write offset=460849152, buflen=131072
+=========================================================================
+
+In __blockdev_direct_IO, ocfs2_dio_wr_get_block is called to add unwritten
+extents to a list.  extents are also inserted into extent tree in
+ocfs2_write_begin_nolock.  Then another thread call fallocate to puch a
+hole at one of the unwritten extent.  The extent at cpos was removed by
+ocfs2_remove_extent().  At end io worker thread, ocfs2_search_extent_list
+found there is no such extent at the cpos.
+
+    T1                        T2                T3
+                              inode lock
+                                ...
+                                insert extents
+                                ...
+                              inode unlock
+ocfs2_fallocate
+ __ocfs2_change_file_space
+  inode lock
+  lock ip_alloc_sem
+  ocfs2_remove_inode_range inode
+   ocfs2_remove_btree_range
+    ocfs2_remove_extent
+    ^---remove the extent at cpos 78723
+  ...
+  unlock ip_alloc_sem
+  inode unlock
+                                       ocfs2_dio_end_io
+                                        ocfs2_dio_end_io_write
+                                         lock ip_alloc_sem
+                                         ocfs2_mark_extent_written
+                                          ocfs2_change_extent_flag
+                                           ocfs2_search_extent_list
+                                           ^---failed to find extent
+                                          ...
+                                          unlock ip_alloc_sem
+
+In most filesystems, fallocate is not compatible with racing with AIO+DIO,
+so fix it by adding to wait for all dio before fallocate/punch_hole like
+ext4.
+
+Link: https://lkml.kernel.org/r/20240408082041.20925-3-glass.su@suse.com
+Fixes: b25801038da5 ("ocfs2: Support xfs style space reservation ioctls")
+Signed-off-by: Su Yue <glass.su@suse.com>
+Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
+Cc: Changwei Ge <gechangwei@live.cn>
+Cc: Gang He <ghe@suse.com>
+Cc: Joel Becker <jlbec@evilplan.org>
+Cc: Jun Piao <piaojun@huawei.com>
+Cc: Junxiao Bi <junxiao.bi@oracle.com>
+Cc: Mark Fasheh <mark@fasheh.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ocfs2/file.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/ocfs2/file.c
++++ b/fs/ocfs2/file.c
+@@ -1934,6 +1934,8 @@ static int __ocfs2_change_file_space(str
+       inode_lock(inode);
++      /* Wait all existing dio workers, newcomers will block on i_rwsem */
++      inode_dio_wait(inode);
+       /*
+        * This prevents concurrent writes on other nodes
+        */
diff --git a/queue-6.6/ocfs2-use-coarse-time-for-new-created-files.patch b/queue-6.6/ocfs2-use-coarse-time-for-new-created-files.patch
new file mode 100644 (file)
index 0000000..4750c18
--- /dev/null
@@ -0,0 +1,87 @@
+From b8cb324277ee16f3eca3055b96fce4735a5a41c6 Mon Sep 17 00:00:00 2001
+From: Su Yue <glass.su@suse.com>
+Date: Mon, 8 Apr 2024 16:20:41 +0800
+Subject: ocfs2: use coarse time for new created files
+
+From: Su Yue <glass.su@suse.com>
+
+commit b8cb324277ee16f3eca3055b96fce4735a5a41c6 upstream.
+
+The default atime related mount option is '-o realtime' which means file
+atime should be updated if atime <= ctime or atime <= mtime.  atime should
+be updated in the following scenario, but it is not:
+==========================================================
+$ rm /mnt/testfile;
+$ echo test > /mnt/testfile
+$ stat -c "%X %Y %Z" /mnt/testfile
+1711881646 1711881646 1711881646
+$ sleep 5
+$ cat /mnt/testfile > /dev/null
+$ stat -c "%X %Y %Z" /mnt/testfile
+1711881646 1711881646 1711881646
+==========================================================
+
+And the reason the atime in the test is not updated is that ocfs2 calls
+ktime_get_real_ts64() in __ocfs2_mknod_locked during file creation.  Then
+inode_set_ctime_current() is called in inode_set_ctime_current() calls
+ktime_get_coarse_real_ts64() to get current time.
+
+ktime_get_real_ts64() is more accurate than ktime_get_coarse_real_ts64().
+In my test box, I saw ctime set by ktime_get_coarse_real_ts64() is less
+than ktime_get_real_ts64() even ctime is set later.  The ctime of the new
+inode is smaller than atime.
+
+The call trace is like:
+
+ocfs2_create
+  ocfs2_mknod
+    __ocfs2_mknod_locked
+    ....
+
+      ktime_get_real_ts64 <------- set atime,ctime,mtime, more accurate
+      ocfs2_populate_inode
+    ...
+    ocfs2_init_acl
+      ocfs2_acl_set_mode
+        inode_set_ctime_current
+          current_time
+            ktime_get_coarse_real_ts64 <-------less accurate
+
+ocfs2_file_read_iter
+  ocfs2_inode_lock_atime
+    ocfs2_should_update_atime
+      atime <= ctime ? <-------- false, ctime < atime due to accuracy
+
+So here call ktime_get_coarse_real_ts64 to set inode time coarser while
+creating new files.  It may lower the accuracy of file times.  But it's
+not a big deal since we already use coarse time in other places like
+ocfs2_update_inode_atime and inode_set_ctime_current.
+
+Link: https://lkml.kernel.org/r/20240408082041.20925-5-glass.su@suse.com
+Fixes: c62c38f6b91b ("ocfs2: replace CURRENT_TIME macro")
+Signed-off-by: Su Yue <glass.su@suse.com>
+Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
+Cc: Mark Fasheh <mark@fasheh.com>
+Cc: Joel Becker <jlbec@evilplan.org>
+Cc: Junxiao Bi <junxiao.bi@oracle.com>
+Cc: Changwei Ge <gechangwei@live.cn>
+Cc: Gang He <ghe@suse.com>
+Cc: Jun Piao <piaojun@huawei.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ocfs2/namei.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/ocfs2/namei.c
++++ b/fs/ocfs2/namei.c
+@@ -566,7 +566,7 @@ static int __ocfs2_mknod_locked(struct i
+       fe->i_last_eb_blk = 0;
+       strcpy(fe->i_signature, OCFS2_INODE_SIGNATURE);
+       fe->i_flags |= cpu_to_le32(OCFS2_VALID_FL);
+-      ktime_get_real_ts64(&ts);
++      ktime_get_coarse_real_ts64(&ts);
+       fe->i_atime = fe->i_ctime = fe->i_mtime =
+               cpu_to_le64(ts.tv_sec);
+       fe->i_mtime_nsec = fe->i_ctime_nsec = fe->i_atime_nsec =
diff --git a/queue-6.6/pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch b/queue-6.6/pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch
new file mode 100644 (file)
index 0000000..a777454
--- /dev/null
@@ -0,0 +1,52 @@
+From 2dba285caba53f309d6060fca911b43d63f41697 Mon Sep 17 00:00:00 2001
+From: Rick Wertenbroek <rick.wertenbroek@gmail.com>
+Date: Wed, 3 Apr 2024 16:45:08 +0200
+Subject: PCI: rockchip-ep: Remove wrong mask on subsys_vendor_id
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Rick Wertenbroek <rick.wertenbroek@gmail.com>
+
+commit 2dba285caba53f309d6060fca911b43d63f41697 upstream.
+
+Remove wrong mask on subsys_vendor_id. Both the Vendor ID and Subsystem
+Vendor ID are u16 variables and are written to a u32 register of the
+controller. The Subsystem Vendor ID was always 0 because the u16 value
+was masked incorrectly with GENMASK(31,16) resulting in all lower 16
+bits being set to 0 prior to the shift.
+
+Remove both masks as they are unnecessary and set the register correctly
+i.e., the lower 16-bits are the Vendor ID and the upper 16-bits are the
+Subsystem Vendor ID.
+
+This is documented in the RK3399 TRM section 17.6.7.1.17
+
+[kwilczynski: removed unnecesary newline]
+Fixes: cf590b078391 ("PCI: rockchip: Add EP driver for Rockchip PCIe controller")
+Link: https://lore.kernel.org/linux-pci/20240403144508.489835-1-rick.wertenbroek@gmail.com
+Signed-off-by: Rick Wertenbroek <rick.wertenbroek@gmail.com>
+Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/controller/pcie-rockchip-ep.c |    6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/drivers/pci/controller/pcie-rockchip-ep.c
++++ b/drivers/pci/controller/pcie-rockchip-ep.c
+@@ -98,10 +98,8 @@ static int rockchip_pcie_ep_write_header
+       /* All functions share the same vendor ID with function 0 */
+       if (fn == 0) {
+-              u32 vid_regs = (hdr->vendorid & GENMASK(15, 0)) |
+-                             (hdr->subsys_vendor_id & GENMASK(31, 16)) << 16;
+-
+-              rockchip_pcie_write(rockchip, vid_regs,
++              rockchip_pcie_write(rockchip,
++                                  hdr->vendorid | hdr->subsys_vendor_id << 16,
+                                   PCIE_CORE_CONFIG_VENDOR);
+       }
diff --git a/queue-6.6/remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch b/queue-6.6/remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch
new file mode 100644 (file)
index 0000000..047117c
--- /dev/null
@@ -0,0 +1,80 @@
+From 3c8a9066d584f5010b6f4ba03bf6b19d28973d52 Mon Sep 17 00:00:00 2001
+From: Beleswar Padhi <b-padhi@ti.com>
+Date: Tue, 30 Apr 2024 16:23:07 +0530
+Subject: remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs
+
+From: Beleswar Padhi <b-padhi@ti.com>
+
+commit 3c8a9066d584f5010b6f4ba03bf6b19d28973d52 upstream.
+
+PSC controller has a limitation that it can only power-up the second
+core when the first core is in ON state. Power-state for core0 should be
+equal to or higher than core1.
+
+Therefore, prevent core1 from powering up before core0 during the start
+process from sysfs. Similarly, prevent core0 from shutting down before
+core1 has been shut down from sysfs.
+
+Fixes: 6dedbd1d5443 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem")
+Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240430105307.1190615-3-b-padhi@ti.com
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/remoteproc/ti_k3_r5_remoteproc.c |   23 +++++++++++++++++++++--
+ 1 file changed, 21 insertions(+), 2 deletions(-)
+
+--- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
++++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
+@@ -548,7 +548,7 @@ static int k3_r5_rproc_start(struct rpro
+       struct k3_r5_rproc *kproc = rproc->priv;
+       struct k3_r5_cluster *cluster = kproc->cluster;
+       struct device *dev = kproc->dev;
+-      struct k3_r5_core *core;
++      struct k3_r5_core *core0, *core;
+       u32 boot_addr;
+       int ret;
+@@ -574,6 +574,15 @@ static int k3_r5_rproc_start(struct rpro
+                               goto unroll_core_run;
+               }
+       } else {
++              /* do not allow core 1 to start before core 0 */
++              core0 = list_first_entry(&cluster->cores, struct k3_r5_core,
++                                       elem);
++              if (core != core0 && core0->rproc->state == RPROC_OFFLINE) {
++                      dev_err(dev, "%s: can not start core 1 before core 0\n",
++                              __func__);
++                      return -EPERM;
++              }
++
+               ret = k3_r5_core_run(core);
+               if (ret)
+                       goto put_mbox;
+@@ -619,7 +628,8 @@ static int k3_r5_rproc_stop(struct rproc
+ {
+       struct k3_r5_rproc *kproc = rproc->priv;
+       struct k3_r5_cluster *cluster = kproc->cluster;
+-      struct k3_r5_core *core = kproc->core;
++      struct device *dev = kproc->dev;
++      struct k3_r5_core *core1, *core = kproc->core;
+       int ret;
+       /* halt all applicable cores */
+@@ -632,6 +642,15 @@ static int k3_r5_rproc_stop(struct rproc
+                       }
+               }
+       } else {
++              /* do not allow core 0 to stop before core 1 */
++              core1 = list_last_entry(&cluster->cores, struct k3_r5_core,
++                                      elem);
++              if (core != core1 && core1->rproc->state != RPROC_OFFLINE) {
++                      dev_err(dev, "%s: can not stop core 0 before core 1\n",
++                              __func__);
++                      return -EPERM;
++              }
++
+               ret = k3_r5_core_halt(core);
+               if (ret)
+                       goto out;
diff --git a/queue-6.6/remoteproc-k3-r5-wait-for-core0-power-up-before-powering-up-core1.patch b/queue-6.6/remoteproc-k3-r5-wait-for-core0-power-up-before-powering-up-core1.patch
new file mode 100644 (file)
index 0000000..7676ce8
--- /dev/null
@@ -0,0 +1,121 @@
+From 61f6f68447aba08aeaa97593af3a7d85a114891f Mon Sep 17 00:00:00 2001
+From: Apurva Nandan <a-nandan@ti.com>
+Date: Tue, 30 Apr 2024 16:23:06 +0530
+Subject: remoteproc: k3-r5: Wait for core0 power-up before powering up core1
+
+From: Apurva Nandan <a-nandan@ti.com>
+
+commit 61f6f68447aba08aeaa97593af3a7d85a114891f upstream.
+
+PSC controller has a limitation that it can only power-up the second core
+when the first core is in ON state. Power-state for core0 should be equal
+to or higher than core1, else the kernel is seen hanging during rproc
+loading.
+
+Make the powering up of cores sequential, by waiting for the current core
+to power-up before proceeding to the next core, with a timeout of 2sec.
+Add a wait queue event in k3_r5_cluster_rproc_init call, that will wait
+for the current core to be released from reset before proceeding with the
+next core.
+
+Fixes: 6dedbd1d5443 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem")
+Signed-off-by: Apurva Nandan <a-nandan@ti.com>
+Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240430105307.1190615-2-b-padhi@ti.com
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/remoteproc/ti_k3_r5_remoteproc.c |   33 +++++++++++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+--- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
++++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
+@@ -103,12 +103,14 @@ struct k3_r5_soc_data {
+  * @dev: cached device pointer
+  * @mode: Mode to configure the Cluster - Split or LockStep
+  * @cores: list of R5 cores within the cluster
++ * @core_transition: wait queue to sync core state changes
+  * @soc_data: SoC-specific feature data for a R5FSS
+  */
+ struct k3_r5_cluster {
+       struct device *dev;
+       enum cluster_mode mode;
+       struct list_head cores;
++      wait_queue_head_t core_transition;
+       const struct k3_r5_soc_data *soc_data;
+ };
+@@ -128,6 +130,7 @@ struct k3_r5_cluster {
+  * @atcm_enable: flag to control ATCM enablement
+  * @btcm_enable: flag to control BTCM enablement
+  * @loczrama: flag to dictate which TCM is at device address 0x0
++ * @released_from_reset: flag to signal when core is out of reset
+  */
+ struct k3_r5_core {
+       struct list_head elem;
+@@ -144,6 +147,7 @@ struct k3_r5_core {
+       u32 atcm_enable;
+       u32 btcm_enable;
+       u32 loczrama;
++      bool released_from_reset;
+ };
+ /**
+@@ -460,6 +464,8 @@ static int k3_r5_rproc_prepare(struct rp
+                       ret);
+               return ret;
+       }
++      core->released_from_reset = true;
++      wake_up_interruptible(&cluster->core_transition);
+       /*
+        * Newer IP revisions like on J7200 SoCs support h/w auto-initialization
+@@ -1140,6 +1146,12 @@ static int k3_r5_rproc_configure_mode(st
+               return ret;
+       }
++      /*
++       * Skip the waiting mechanism for sequential power-on of cores if the
++       * core has already been booted by another entity.
++       */
++      core->released_from_reset = c_state;
++
+       ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl,
+                                    &stat);
+       if (ret < 0) {
+@@ -1280,6 +1292,26 @@ init_rmem:
+                   cluster->mode == CLUSTER_MODE_SINGLECPU ||
+                   cluster->mode == CLUSTER_MODE_SINGLECORE)
+                       break;
++
++              /*
++               * R5 cores require to be powered on sequentially, core0
++               * should be in higher power state than core1 in a cluster
++               * So, wait for current core to power up before proceeding
++               * to next core and put timeout of 2sec for each core.
++               *
++               * This waiting mechanism is necessary because
++               * rproc_auto_boot_callback() for core1 can be called before
++               * core0 due to thread execution order.
++               */
++              ret = wait_event_interruptible_timeout(cluster->core_transition,
++                                                     core->released_from_reset,
++                                                     msecs_to_jiffies(2000));
++              if (ret <= 0) {
++                      dev_err(dev,
++                              "Timed out waiting for %s core to power up!\n",
++                              rproc->name);
++                      return ret;
++              }
+       }
+       return 0;
+@@ -1709,6 +1741,7 @@ static int k3_r5_probe(struct platform_d
+       cluster->dev = dev;
+       cluster->soc_data = data;
+       INIT_LIST_HEAD(&cluster->cores);
++      init_waitqueue_head(&cluster->core_transition);
+       ret = of_property_read_u32(np, "ti,cluster-mode", &cluster->mode);
+       if (ret < 0 && ret != -EINVAL) {
index 044d1ce42834957a49e04731ac72873b2d2adee6..e9a4b240b626ee4c27da53c1dbcbfe2ca4c121a4 100644 (file)
@@ -211,3 +211,13 @@ dma-buf-handle-testing-kthreads-creation-failure.patch
 tracing-add-module_description-to-preemptirq_delay_test.patch
 vmci-prevent-speculation-leaks-by-sanitizing-event-in-event_deliver.patch
 spmi-hisi-spmi-controller-do-not-override-device-identifier.patch
+knfsd-lookup-can-return-an-illegal-error-value.patch
+fs-proc-fix-softlockup-in-__read_vmcore.patch
+ocfs2-use-coarse-time-for-new-created-files.patch
+ocfs2-fix-races-between-hole-punching-and-aio-dio.patch
+pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch
+dmaengine-axi-dmac-fix-possible-race-in-remove.patch
+remoteproc-k3-r5-wait-for-core0-power-up-before-powering-up-core1.patch
+remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch
+iio-adc-axi-adc-make-sure-axi-clock-is-enabled.patch
+iio-invensense-fix-interrupt-timestamp-alignment.patch