]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.8
authorSasha Levin <sashal@kernel.org>
Sun, 7 Apr 2024 20:11:06 +0000 (16:11 -0400)
committerSasha Levin <sashal@kernel.org>
Sun, 7 Apr 2024 20:11:06 +0000 (16:11 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
52 files changed:
queue-6.8/9p-fix-read-write-debug-statements-to-report-server-.patch [new file with mode: 0644]
queue-6.8/alsa-hda-cs35l56-add-acpi-device-match-tables.patch [new file with mode: 0644]
queue-6.8/asoc-amd-acp-fix-for-acp-pdm-configuration-check.patch [new file with mode: 0644]
queue-6.8/asoc-amd-acp-fix-for-acp_init-function-error-handlin.patch [new file with mode: 0644]
queue-6.8/asoc-cs42l43-correct-extraction-of-data-pointer-in-s.patch [new file with mode: 0644]
queue-6.8/asoc-ops-fix-wraparound-for-mask-in-snd_soc_get_vols.patch [new file with mode: 0644]
queue-6.8/asoc-rt5682-sdw-fix-locking-sequence.patch [new file with mode: 0644]
queue-6.8/asoc-rt711-sdca-fix-locking-sequence.patch [new file with mode: 0644]
queue-6.8/asoc-rt711-sdw-fix-locking-sequence.patch [new file with mode: 0644]
queue-6.8/asoc-rt712-sdca-sdw-fix-locking-sequence.patch [new file with mode: 0644]
queue-6.8/asoc-rt722-sdca-sdw-fix-locking-sequence.patch [new file with mode: 0644]
queue-6.8/asoc-sof-amd-fix-for-false-dsp-interrupts.patch [new file with mode: 0644]
queue-6.8/asoc-tas2781-mark-dvc_tlv-with-__maybe_unused.patch [new file with mode: 0644]
queue-6.8/asoc-wm_adsp-fix-missing-mutex_lock-in-wm_adsp_write.patch [new file with mode: 0644]
queue-6.8/ata-sata_mv-fix-pci-device-id-table-declaration-comp.patch [new file with mode: 0644]
queue-6.8/ata-sata_sx4-fix-pdc20621_get_from_dimm-on-64-bit.patch [new file with mode: 0644]
queue-6.8/block-count-blk_open_restrict_writes-openers.patch [new file with mode: 0644]
queue-6.8/cifs-fix-caching-to-try-to-do-open-o_wronly-as-rdwr-.patch [new file with mode: 0644]
queue-6.8/drivers-perf-riscv-disable-perf_sample_branch_-while.patch [new file with mode: 0644]
queue-6.8/drm-i915-dp-fix-dsc-state-hw-readout-for-sst-connect.patch [new file with mode: 0644]
queue-6.8/drm-i915-gt-limit-the-reserved-vm-space-to-only-the-.patch [new file with mode: 0644]
queue-6.8/drm-panfrost-fix-power-transition-timeout-warnings.patch [new file with mode: 0644]
queue-6.8/drm-prime-unbreak-virtgpu-dma-buf-export.patch [new file with mode: 0644]
queue-6.8/lib-stackdepot-move-stack_record-struct-definition-i.patch [new file with mode: 0644]
queue-6.8/nfsd-hold-a-lighter-weight-client-reference-over-cb_.patch [new file with mode: 0644]
queue-6.8/nouveau-uvmm-fix-addr-range-calcs-for-remap-operatio.patch [new file with mode: 0644]
queue-6.8/regmap-maple-fix-cache-corruption-in-regcache_maple_.patch [new file with mode: 0644]
queue-6.8/regmap-maple-fix-uninitialized-symbol-ret-warnings.patch [new file with mode: 0644]
queue-6.8/revert-alsa-emu10k1-fix-synthesizer-sample-playback-.patch [new file with mode: 0644]
queue-6.8/risc-v-update-at_vector_size_arch-for-new-at_minsigs.patch [new file with mode: 0644]
queue-6.8/riscv-disable-preemption-when-using-patch_map.patch [new file with mode: 0644]
queue-6.8/riscv-fix-warning-by-declaring-arch_cpu_idle-as-noin.patch [new file with mode: 0644]
queue-6.8/riscv-hwprobe-do-not-produce-frtace-relocation.patch [new file with mode: 0644]
queue-6.8/riscv-mm-fix-prototype-to-avoid-discarding-const.patch [new file with mode: 0644]
queue-6.8/riscv-use-kern_info-in-do_trap.patch [new file with mode: 0644]
queue-6.8/s390-pai-fix-sampling-event-removal-for-pmu-device-d.patch [new file with mode: 0644]
queue-6.8/scsi-mylex-fix-sysfs-buffer-lengths.patch [new file with mode: 0644]
queue-6.8/scsi-sd-unregister-device-if-device_add_disk-failed-.patch [new file with mode: 0644]
queue-6.8/series
queue-6.8/spi-mchp-pci1xxx-fix-a-possible-null-pointer-derefer.patch [new file with mode: 0644]
queue-6.8/spi-s3c64xx-allow-full-fifo-masks.patch [new file with mode: 0644]
queue-6.8/spi-s3c64xx-define-a-magic-value.patch [new file with mode: 0644]
queue-6.8/spi-s3c64xx-determine-the-fifo-depth-only-once.patch [new file with mode: 0644]
queue-6.8/spi-s3c64xx-explicitly-include-linux-bits.h.patch [new file with mode: 0644]
queue-6.8/spi-s3c64xx-extract-fifo-depth-calculation-to-a-dedi.patch [new file with mode: 0644]
queue-6.8/spi-s3c64xx-remove-else-after-return.patch [new file with mode: 0644]
queue-6.8/spi-s3c64xx-sort-headers-alphabetically.patch [new file with mode: 0644]
queue-6.8/spi-s3c64xx-use-dma-mode-from-fifo-size.patch [new file with mode: 0644]
queue-6.8/stackdepot-rename-pool_index-to-pool_index_plus_1.patch [new file with mode: 0644]
queue-6.8/sunrpc-fix-a-slow-server-side-memory-leak-with-rpc-o.patch [new file with mode: 0644]
queue-6.8/thermal-gov_power_allocator-allow-binding-without-co.patch [new file with mode: 0644]
queue-6.8/thermal-gov_power_allocator-allow-binding-without-tr.patch [new file with mode: 0644]

diff --git a/queue-6.8/9p-fix-read-write-debug-statements-to-report-server-.patch b/queue-6.8/9p-fix-read-write-debug-statements-to-report-server-.patch
new file mode 100644 (file)
index 0000000..b756a12
--- /dev/null
@@ -0,0 +1,69 @@
+From 0eda11b4ad9156ffce5fe1a3334467c6612b980b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 9 Jan 2024 12:39:03 +0900
+Subject: 9p: Fix read/write debug statements to report server reply
+
+From: Dominique Martinet <asmadeus@codewreck.org>
+
+[ Upstream commit be3193e58ec210b2a72fb1134c2a0695088a911d ]
+
+Previous conversion to iov missed these debug statements which would now
+always print the requested size instead of the actual server reply.
+
+Write also added a loop in a much older commit but we didn't report
+these, while reads do report each iteration -- it's more coherent to
+keep reporting all requests to server so move that at the same time.
+
+Fixes: 7f02464739da ("9p: convert to advancing variant of iov_iter_get_pages_alloc()")
+Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
+Message-ID: <20240109-9p-rw-trace-v1-1-327178114257@codewreck.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/9p/client.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/net/9p/client.c b/net/9p/client.c
+index e265a0ca6bddd..f7e90b4769bba 100644
+--- a/net/9p/client.c
++++ b/net/9p/client.c
+@@ -1583,7 +1583,7 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to,
+               received = rsize;
+       }
+-      p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", count);
++      p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", received);
+       if (non_zc) {
+               int n = copy_to_iter(dataptr, received, to);
+@@ -1609,9 +1609,6 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)
+       int total = 0;
+       *err = 0;
+-      p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %zd\n",
+-               fid->fid, offset, iov_iter_count(from));
+-
+       while (iov_iter_count(from)) {
+               int count = iov_iter_count(from);
+               int rsize = fid->iounit;
+@@ -1623,6 +1620,9 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)
+               if (count < rsize)
+                       rsize = count;
++              p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %d (/%d)\n",
++                       fid->fid, offset, rsize, count);
++
+               /* Don't bother zerocopy for small IO (< 1024) */
+               if (clnt->trans_mod->zc_request && rsize > 1024) {
+                       req = p9_client_zc_rpc(clnt, P9_TWRITE, NULL, from, 0,
+@@ -1650,7 +1650,7 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)
+                       written = rsize;
+               }
+-              p9_debug(P9_DEBUG_9P, "<<< RWRITE count %d\n", count);
++              p9_debug(P9_DEBUG_9P, "<<< RWRITE count %d\n", written);
+               p9_req_put(clnt, req);
+               iov_iter_revert(from, count - written - iov_iter_count(from));
+-- 
+2.43.0
+
diff --git a/queue-6.8/alsa-hda-cs35l56-add-acpi-device-match-tables.patch b/queue-6.8/alsa-hda-cs35l56-add-acpi-device-match-tables.patch
new file mode 100644 (file)
index 0000000..8a6d3ab
--- /dev/null
@@ -0,0 +1,78 @@
+From d5e6db4446a26aeaab8cb8e9792d9017d719a51f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Mar 2024 12:13:55 +0000
+Subject: ALSA: hda: cs35l56: Add ACPI device match tables
+
+From: Simon Trimmer <simont@opensource.cirrus.com>
+
+[ Upstream commit 2d0401ee38d43ab0e4cdd02dfc9d402befb2b5c8 ]
+
+Adding the ACPI HIDs to the match table triggers the cs35l56-hda modules
+to be loaded on boot so that Serial Multi Instantiate can add the
+devices to the bus and begin the driver init sequence.
+
+Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
+Fixes: 73cfbfa9caea ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
+Message-ID: <20240328121355.18972-1-simont@opensource.cirrus.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/cs35l56_hda_i2c.c | 13 +++++++++++--
+ sound/pci/hda/cs35l56_hda_spi.c | 13 +++++++++++--
+ 2 files changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/sound/pci/hda/cs35l56_hda_i2c.c b/sound/pci/hda/cs35l56_hda_i2c.c
+index a9ef6d86de839..09a810a50a12b 100644
+--- a/sound/pci/hda/cs35l56_hda_i2c.c
++++ b/sound/pci/hda/cs35l56_hda_i2c.c
+@@ -53,10 +53,19 @@ static const struct i2c_device_id cs35l56_hda_i2c_id[] = {
+       {}
+ };
++static const struct acpi_device_id cs35l56_acpi_hda_match[] = {
++      { "CSC3554", 0 },
++      { "CSC3556", 0 },
++      { "CSC3557", 0 },
++      {}
++};
++MODULE_DEVICE_TABLE(acpi, cs35l56_acpi_hda_match);
++
+ static struct i2c_driver cs35l56_hda_i2c_driver = {
+       .driver = {
+-              .name           = "cs35l56-hda",
+-              .pm             = &cs35l56_hda_pm_ops,
++              .name             = "cs35l56-hda",
++              .acpi_match_table = cs35l56_acpi_hda_match,
++              .pm               = &cs35l56_hda_pm_ops,
+       },
+       .id_table       = cs35l56_hda_i2c_id,
+       .probe          = cs35l56_hda_i2c_probe,
+diff --git a/sound/pci/hda/cs35l56_hda_spi.c b/sound/pci/hda/cs35l56_hda_spi.c
+index 080426de90830..04f9fe6197dc5 100644
+--- a/sound/pci/hda/cs35l56_hda_spi.c
++++ b/sound/pci/hda/cs35l56_hda_spi.c
+@@ -53,10 +53,19 @@ static const struct spi_device_id cs35l56_hda_spi_id[] = {
+       {}
+ };
++static const struct acpi_device_id cs35l56_acpi_hda_match[] = {
++      { "CSC3554", 0 },
++      { "CSC3556", 0 },
++      { "CSC3557", 0 },
++      {}
++};
++MODULE_DEVICE_TABLE(acpi, cs35l56_acpi_hda_match);
++
+ static struct spi_driver cs35l56_hda_spi_driver = {
+       .driver = {
+-              .name           = "cs35l56-hda",
+-              .pm             = &cs35l56_hda_pm_ops,
++              .name             = "cs35l56-hda",
++              .acpi_match_table = cs35l56_acpi_hda_match,
++              .pm               = &cs35l56_hda_pm_ops,
+       },
+       .id_table       = cs35l56_hda_spi_id,
+       .probe          = cs35l56_hda_spi_probe,
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-amd-acp-fix-for-acp-pdm-configuration-check.patch b/queue-6.8/asoc-amd-acp-fix-for-acp-pdm-configuration-check.patch
new file mode 100644 (file)
index 0000000..2e0b117
--- /dev/null
@@ -0,0 +1,44 @@
+From 6e7c074935120e0668fdc4b8c5583994fae00446 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Mar 2024 16:16:53 +0530
+Subject: ASoC: amd: acp: fix for acp pdm configuration check
+
+From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
+
+[ Upstream commit 4af565de9f8c74b9f6035924ce0d40adec211246 ]
+
+ACP PDM configuration has to be verified for all combinations.
+Remove FLAG_AMD_LEGACY_ONLY_DMIC check.
+
+Fixes: 3a94c8ad0aae ("ASoC: amd: acp: add code for scanning acp pdm controller")
+
+Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
+Link: https://msgid.link/r/20240327104657.3537664-2-Vijendar.Mukunda@amd.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/amd/acp/acp-pci.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c
+index 8c8b1dcac6281..440b91d4f261c 100644
+--- a/sound/soc/amd/acp/acp-pci.c
++++ b/sound/soc/amd/acp/acp-pci.c
+@@ -133,11 +133,9 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
+               }
+       }
+-      if (flag == FLAG_AMD_LEGACY_ONLY_DMIC) {
+-              ret = check_acp_pdm(pci, chip);
+-              if (ret < 0)
+-                      goto skip_pdev_creation;
+-      }
++      ret = check_acp_pdm(pci, chip);
++      if (ret < 0)
++              goto skip_pdev_creation;
+       chip->flag = flag;
+       memset(&pdevinfo, 0, sizeof(pdevinfo));
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-amd-acp-fix-for-acp_init-function-error-handlin.patch b/queue-6.8/asoc-amd-acp-fix-for-acp_init-function-error-handlin.patch
new file mode 100644 (file)
index 0000000..228e0d2
--- /dev/null
@@ -0,0 +1,40 @@
+From 8cf3beb24ad9643ccd0b8746ae08a8f788943555 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Mar 2024 11:08:12 +0530
+Subject: ASoC: amd: acp: fix for acp_init function error handling
+
+From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
+
+[ Upstream commit 2c603a4947a1247102ccb008d5eb6f37a4043c98 ]
+
+If acp_init() fails, acp pci driver probe should return error.
+Add acp_init() function return value check logic.
+
+Fixes: e61b415515d3 ("ASoC: amd: acp: refactor the acp init and de-init sequence")
+Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
+Link: https://lore.kernel.org/r/20240329053815.2373979-1-Vijendar.Mukunda@amd.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/amd/acp/acp-pci.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c
+index 440b91d4f261c..5f35b90eab8d3 100644
+--- a/sound/soc/amd/acp/acp-pci.c
++++ b/sound/soc/amd/acp/acp-pci.c
+@@ -115,7 +115,10 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
+               goto unregister_dmic_dev;
+       }
+-      acp_init(chip);
++      ret = acp_init(chip);
++      if (ret)
++              goto unregister_dmic_dev;
++
+       res = devm_kcalloc(&pci->dev, num_res, sizeof(struct resource), GFP_KERNEL);
+       if (!res) {
+               ret = -ENOMEM;
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-cs42l43-correct-extraction-of-data-pointer-in-s.patch b/queue-6.8/asoc-cs42l43-correct-extraction-of-data-pointer-in-s.patch
new file mode 100644 (file)
index 0000000..4504325
--- /dev/null
@@ -0,0 +1,69 @@
+From 4a9e1b313bb9d831e4f17a383e9659c0b9d69bff Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Mar 2024 10:54:34 +0000
+Subject: ASoC: cs42l43: Correct extraction of data pointer in suspend/resume
+
+From: Charles Keepax <ckeepax@opensource.cirrus.com>
+
+[ Upstream commit 56ebbd19c2989f7450341f581e2724a149d0f08e ]
+
+The current code is pulling the wrong pointer causing it to disable the
+wrong IRQ. Correct the code to pull the correct cs42l43 core data
+pointer.
+
+Fixes: 64353af49fec ("ASoC: cs42l43: Add system suspend ops to disable IRQ")
+Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Link: https://msgid.link/r/20240326105434.852907-1-ckeepax@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/cs42l43.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
+index a97ccb512deba..a24b52c9dda6b 100644
+--- a/sound/soc/codecs/cs42l43.c
++++ b/sound/soc/codecs/cs42l43.c
+@@ -2338,7 +2338,8 @@ static int cs42l43_codec_runtime_resume(struct device *dev)
+ static int cs42l43_codec_suspend(struct device *dev)
+ {
+-      struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
++      struct cs42l43_codec *priv = dev_get_drvdata(dev);
++      struct cs42l43 *cs42l43 = priv->core;
+       disable_irq(cs42l43->irq);
+@@ -2347,7 +2348,8 @@ static int cs42l43_codec_suspend(struct device *dev)
+ static int cs42l43_codec_suspend_noirq(struct device *dev)
+ {
+-      struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
++      struct cs42l43_codec *priv = dev_get_drvdata(dev);
++      struct cs42l43 *cs42l43 = priv->core;
+       enable_irq(cs42l43->irq);
+@@ -2356,7 +2358,8 @@ static int cs42l43_codec_suspend_noirq(struct device *dev)
+ static int cs42l43_codec_resume(struct device *dev)
+ {
+-      struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
++      struct cs42l43_codec *priv = dev_get_drvdata(dev);
++      struct cs42l43 *cs42l43 = priv->core;
+       enable_irq(cs42l43->irq);
+@@ -2365,7 +2368,8 @@ static int cs42l43_codec_resume(struct device *dev)
+ static int cs42l43_codec_resume_noirq(struct device *dev)
+ {
+-      struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
++      struct cs42l43_codec *priv = dev_get_drvdata(dev);
++      struct cs42l43 *cs42l43 = priv->core;
+       disable_irq(cs42l43->irq);
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-ops-fix-wraparound-for-mask-in-snd_soc_get_vols.patch b/queue-6.8/asoc-ops-fix-wraparound-for-mask-in-snd_soc_get_vols.patch
new file mode 100644 (file)
index 0000000..0895424
--- /dev/null
@@ -0,0 +1,42 @@
+From 9db0b24c58846648c82f9b36ccf3bd825af23182 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Mar 2024 18:01:31 -0700
+Subject: ASoC: ops: Fix wraparound for mask in snd_soc_get_volsw
+
+From: Stephen Lee <slee08177@gmail.com>
+
+[ Upstream commit fc563aa900659a850e2ada4af26b9d7a3de6c591 ]
+
+In snd_soc_info_volsw(), mask is generated by figuring out the index of
+the most significant bit set in max and converting the index to a
+bitmask through bit shift 1. Unintended wraparound occurs when max is an
+integer value with msb bit set. Since the bit shift value 1 is treated
+as an integer type, the left shift operation will wraparound and set
+mask to 0 instead of all 1's. In order to fix this, we type cast 1 as
+`1ULL` to prevent the wraparound.
+
+Fixes: 7077148fb50a ("ASoC: core: Split ops out of soc-core.c")
+Signed-off-by: Stephen Lee <slee08177@gmail.com>
+Link: https://msgid.link/r/20240326010131.6211-1-slee08177@gmail.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/soc-ops.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
+index 2d25748ca7066..b27e89ff6a167 100644
+--- a/sound/soc/soc-ops.c
++++ b/sound/soc/soc-ops.c
+@@ -263,7 +263,7 @@ int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
+       int max = mc->max;
+       int min = mc->min;
+       int sign_bit = mc->sign_bit;
+-      unsigned int mask = (1 << fls(max)) - 1;
++      unsigned int mask = (1ULL << fls(max)) - 1;
+       unsigned int invert = mc->invert;
+       int val;
+       int ret;
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-rt5682-sdw-fix-locking-sequence.patch b/queue-6.8/asoc-rt5682-sdw-fix-locking-sequence.patch
new file mode 100644 (file)
index 0000000..3c453c0
--- /dev/null
@@ -0,0 +1,45 @@
+From d4754375bb95c9211a67845c384c132a83b22b2b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Mar 2024 17:18:12 -0500
+Subject: ASoC: rt5682-sdw: fix locking sequence
+
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+
+[ Upstream commit 310a5caa4e861616a27a83c3e8bda17d65026fa8 ]
+
+The disable_irq_lock protects the 'disable_irq' value, we need to lock
+before testing it.
+
+Fixes: 02fb23d72720 ("ASoC: rt5682-sdw: fix for JD event handling in ClockStop Mode0")
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
+Reviewed-by: Chao Song <chao.song@linux.intel.com>
+Link: https://msgid.link/r/20240325221817.206465-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/rt5682-sdw.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c
+index e67c2e19cb1a7..1fdbef5fd6cba 100644
+--- a/sound/soc/codecs/rt5682-sdw.c
++++ b/sound/soc/codecs/rt5682-sdw.c
+@@ -763,12 +763,12 @@ static int __maybe_unused rt5682_dev_resume(struct device *dev)
+               return 0;
+       if (!slave->unattach_request) {
++              mutex_lock(&rt5682->disable_irq_lock);
+               if (rt5682->disable_irq == true) {
+-                      mutex_lock(&rt5682->disable_irq_lock);
+                       sdw_write_no_pm(slave, SDW_SCP_INTMASK1, SDW_SCP_INT1_IMPL_DEF);
+                       rt5682->disable_irq = false;
+-                      mutex_unlock(&rt5682->disable_irq_lock);
+               }
++              mutex_unlock(&rt5682->disable_irq_lock);
+               goto regmap_sync;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-rt711-sdca-fix-locking-sequence.patch b/queue-6.8/asoc-rt711-sdca-fix-locking-sequence.patch
new file mode 100644 (file)
index 0000000..0f1a9ac
--- /dev/null
@@ -0,0 +1,46 @@
+From 815025c6f50da83e410c1d92fd7042c63472743e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Mar 2024 17:18:13 -0500
+Subject: ASoC: rt711-sdca: fix locking sequence
+
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+
+[ Upstream commit ee287771644394d071e6a331951ee8079b64f9a7 ]
+
+The disable_irq_lock protects the 'disable_irq' value, we need to lock
+before testing it.
+
+Fixes: 23adeb7056ac ("ASoC: rt711-sdca: fix for JD event handling in ClockStop Mode0")
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
+Reviewed-by: Chao Song <chao.song@linux.intel.com>
+Link: https://msgid.link/r/20240325221817.206465-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/rt711-sdca-sdw.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdca-sdw.c
+index 935e597022d32..b8471b2d8f4f1 100644
+--- a/sound/soc/codecs/rt711-sdca-sdw.c
++++ b/sound/soc/codecs/rt711-sdca-sdw.c
+@@ -438,13 +438,13 @@ static int __maybe_unused rt711_sdca_dev_resume(struct device *dev)
+               return 0;
+       if (!slave->unattach_request) {
++              mutex_lock(&rt711->disable_irq_lock);
+               if (rt711->disable_irq == true) {
+-                      mutex_lock(&rt711->disable_irq_lock);
+                       sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK1, SDW_SCP_SDCA_INTMASK_SDCA_0);
+                       sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK2, SDW_SCP_SDCA_INTMASK_SDCA_8);
+                       rt711->disable_irq = false;
+-                      mutex_unlock(&rt711->disable_irq_lock);
+               }
++              mutex_unlock(&rt711->disable_irq_lock);
+               goto regmap_sync;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-rt711-sdw-fix-locking-sequence.patch b/queue-6.8/asoc-rt711-sdw-fix-locking-sequence.patch
new file mode 100644 (file)
index 0000000..71e6794
--- /dev/null
@@ -0,0 +1,45 @@
+From 91ee9029a90293b2c8342394c22f12d2c5c13341 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Mar 2024 17:18:14 -0500
+Subject: ASoC: rt711-sdw: fix locking sequence
+
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+
+[ Upstream commit aae86cfd8790bcc7693a5a0894df58de5cb5128c ]
+
+The disable_irq_lock protects the 'disable_irq' value, we need to lock
+before testing it.
+
+Fixes: b69de265bd0e ("ASoC: rt711: fix for JD event handling in ClockStop Mode0")
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
+Reviewed-by: Chao Song <chao.song@linux.intel.com>
+Link: https://msgid.link/r/20240325221817.206465-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/rt711-sdw.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c
+index 3f5773310ae8c..988451f24a756 100644
+--- a/sound/soc/codecs/rt711-sdw.c
++++ b/sound/soc/codecs/rt711-sdw.c
+@@ -536,12 +536,12 @@ static int __maybe_unused rt711_dev_resume(struct device *dev)
+               return 0;
+       if (!slave->unattach_request) {
++              mutex_lock(&rt711->disable_irq_lock);
+               if (rt711->disable_irq == true) {
+-                      mutex_lock(&rt711->disable_irq_lock);
+                       sdw_write_no_pm(slave, SDW_SCP_INTMASK1, SDW_SCP_INT1_IMPL_DEF);
+                       rt711->disable_irq = false;
+-                      mutex_unlock(&rt711->disable_irq_lock);
+               }
++              mutex_unlock(&rt711->disable_irq_lock);
+               goto regmap_sync;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-rt712-sdca-sdw-fix-locking-sequence.patch b/queue-6.8/asoc-rt712-sdca-sdw-fix-locking-sequence.patch
new file mode 100644 (file)
index 0000000..992c37e
--- /dev/null
@@ -0,0 +1,47 @@
+From 94f96cba36e5983b2334a984e1cd529292a32783 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Mar 2024 17:18:15 -0500
+Subject: ASoC: rt712-sdca-sdw: fix locking sequence
+
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+
+[ Upstream commit c8b2e5c1b959d100990e4f0cbad38e7d047bb97c ]
+
+The disable_irq_lock protects the 'disable_irq' value, we need to lock
+before testing it.
+
+Fixes: 7a8735c1551e ("ASoC: rt712-sdca: fix for JD event handling in ClockStop Mode0")
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
+Reviewed-by: Chao Song <chao.song@linux.intel.com>
+Link: https://msgid.link/r/20240325221817.206465-5-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/rt712-sdca-sdw.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/rt712-sdca-sdw.c b/sound/soc/codecs/rt712-sdca-sdw.c
+index 6b644a89c5890..ba877432cea61 100644
+--- a/sound/soc/codecs/rt712-sdca-sdw.c
++++ b/sound/soc/codecs/rt712-sdca-sdw.c
+@@ -438,13 +438,14 @@ static int __maybe_unused rt712_sdca_dev_resume(struct device *dev)
+               return 0;
+       if (!slave->unattach_request) {
++              mutex_lock(&rt712->disable_irq_lock);
+               if (rt712->disable_irq == true) {
+-                      mutex_lock(&rt712->disable_irq_lock);
++
+                       sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK1, SDW_SCP_SDCA_INTMASK_SDCA_0);
+                       sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK2, SDW_SCP_SDCA_INTMASK_SDCA_8);
+                       rt712->disable_irq = false;
+-                      mutex_unlock(&rt712->disable_irq_lock);
+               }
++              mutex_unlock(&rt712->disable_irq_lock);
+               goto regmap_sync;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-rt722-sdca-sdw-fix-locking-sequence.patch b/queue-6.8/asoc-rt722-sdca-sdw-fix-locking-sequence.patch
new file mode 100644 (file)
index 0000000..1abbe03
--- /dev/null
@@ -0,0 +1,46 @@
+From e7adab468dc1d11dc956fad4acbbc24cce7f1a91 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Mar 2024 17:18:16 -0500
+Subject: ASoC: rt722-sdca-sdw: fix locking sequence
+
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+
+[ Upstream commit adb354bbc231b23d3a05163ce35c1d598512ff64 ]
+
+The disable_irq_lock protects the 'disable_irq' value, we need to lock
+before testing it.
+
+Fixes: a0b7c59ac1a9 ("ASoC: rt722-sdca: fix for JD event handling in ClockStop Mode0")
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
+Reviewed-by: Chao Song <chao.song@linux.intel.com>
+Link: https://msgid.link/r/20240325221817.206465-6-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/rt722-sdca-sdw.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/rt722-sdca-sdw.c b/sound/soc/codecs/rt722-sdca-sdw.c
+index e24b9cbdc10c9..e33836fffd5f2 100644
+--- a/sound/soc/codecs/rt722-sdca-sdw.c
++++ b/sound/soc/codecs/rt722-sdca-sdw.c
+@@ -467,13 +467,13 @@ static int __maybe_unused rt722_sdca_dev_resume(struct device *dev)
+               return 0;
+       if (!slave->unattach_request) {
++              mutex_lock(&rt722->disable_irq_lock);
+               if (rt722->disable_irq == true) {
+-                      mutex_lock(&rt722->disable_irq_lock);
+                       sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK1, SDW_SCP_SDCA_INTMASK_SDCA_6);
+                       sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK2, SDW_SCP_SDCA_INTMASK_SDCA_8);
+                       rt722->disable_irq = false;
+-                      mutex_unlock(&rt722->disable_irq_lock);
+               }
++              mutex_unlock(&rt722->disable_irq_lock);
+               goto regmap_sync;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-sof-amd-fix-for-false-dsp-interrupts.patch b/queue-6.8/asoc-sof-amd-fix-for-false-dsp-interrupts.patch
new file mode 100644 (file)
index 0000000..b2bec7e
--- /dev/null
@@ -0,0 +1,55 @@
+From 25b847643bc1719e8420bc5e8ac8627a6fad6a28 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 4 Apr 2024 09:47:13 +0530
+Subject: ASoC: SOF: amd: fix for false dsp interrupts
+
+From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
+
+[ Upstream commit b9846a386734e73a1414950ebfd50f04919f5e24 ]
+
+Before ACP firmware loading, DSP interrupts are not expected.
+Sometimes after reboot, it's observed that before ACP firmware is loaded
+false DSP interrupt is reported.
+Registering the interrupt handler before acp initialization causing false
+interrupts sometimes on reboot as ACP reset is not applied.
+Correct the sequence by invoking acp initialization sequence prior to
+registering interrupt handler.
+
+Fixes: 738a2b5e2cc9 ("ASoC: SOF: amd: Add IPC support for ACP IP block")
+Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
+Link: https://msgid.link/r/20240404041717.430545-1-Vijendar.Mukunda@amd.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/sof/amd/acp.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
+index 4db8cdc91daae..2c242ef9f23c1 100644
+--- a/sound/soc/sof/amd/acp.c
++++ b/sound/soc/sof/amd/acp.c
+@@ -537,6 +537,10 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)
+               goto unregister_dev;
+       }
++      ret = acp_init(sdev);
++      if (ret < 0)
++              goto free_smn_dev;
++
+       sdev->ipc_irq = pci->irq;
+       ret = request_threaded_irq(sdev->ipc_irq, acp_irq_handler, acp_irq_thread,
+                                  IRQF_SHARED, "AudioDSP", sdev);
+@@ -546,10 +550,6 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)
+               goto free_smn_dev;
+       }
+-      ret = acp_init(sdev);
+-      if (ret < 0)
+-              goto free_ipc_irq;
+-
+       sdev->dsp_box.offset = 0;
+       sdev->dsp_box.size = BOX_SIZE_512;
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-tas2781-mark-dvc_tlv-with-__maybe_unused.patch b/queue-6.8/asoc-tas2781-mark-dvc_tlv-with-__maybe_unused.patch
new file mode 100644 (file)
index 0000000..4d433e2
--- /dev/null
@@ -0,0 +1,45 @@
+From 0c217ad3315f37b32b0d98e6f4c1260d0c61c708 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Mar 2024 23:47:37 +0100
+Subject: ASoC: tas2781: mark dvc_tlv with __maybe_unused
+
+From: Gergo Koteles <soyer@irl.hu>
+
+[ Upstream commit 831ec5e3538e989c7995137b5c5c661991a09504 ]
+
+Since we put dvc_tlv static variable to a header file it's copied to
+each module that includes the header. But not all of them are actually
+used it.
+
+Fix this W=1 build warning:
+
+include/sound/tas2781-tlv.h:18:35: warning: 'dvc_tlv' defined but not
+used [-Wunused-const-variable=]
+
+Reported-by: kernel test robot <lkp@intel.com>
+Closes: https://lore.kernel.org/oe-kbuild-all/202403290354.v0StnRpc-lkp@intel.com/
+Fixes: ae065d0ce9e3 ("ALSA: hda/tas2781: remove digital gain kcontrol")
+Signed-off-by: Gergo Koteles <soyer@irl.hu>
+Message-ID: <0e461545a2a6e9b6152985143e50526322e5f76b.1711665731.git.soyer@irl.hu>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/sound/tas2781-tlv.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/sound/tas2781-tlv.h b/include/sound/tas2781-tlv.h
+index 4038dd421150a..1dc59005d241f 100644
+--- a/include/sound/tas2781-tlv.h
++++ b/include/sound/tas2781-tlv.h
+@@ -15,7 +15,7 @@
+ #ifndef __TAS2781_TLV_H__
+ #define __TAS2781_TLV_H__
+-static const DECLARE_TLV_DB_SCALE(dvc_tlv, -10000, 100, 0);
++static const __maybe_unused DECLARE_TLV_DB_SCALE(dvc_tlv, -10000, 100, 0);
+ static const DECLARE_TLV_DB_SCALE(amp_vol_tlv, 1100, 50, 0);
+ #endif
+-- 
+2.43.0
+
diff --git a/queue-6.8/asoc-wm_adsp-fix-missing-mutex_lock-in-wm_adsp_write.patch b/queue-6.8/asoc-wm_adsp-fix-missing-mutex_lock-in-wm_adsp_write.patch
new file mode 100644 (file)
index 0000000..fdf498c
--- /dev/null
@@ -0,0 +1,47 @@
+From 133364e6c05acb797b7a0f37b5fdeb0ca07a22ec Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Mar 2024 11:02:27 +0000
+Subject: ASoC: wm_adsp: Fix missing mutex_lock in wm_adsp_write_ctl()
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit f193957b0fbbba397c8bddedf158b3bf7e4850fc ]
+
+wm_adsp_write_ctl() must hold the pwr_lock mutex when calling
+cs_dsp_get_ctl().
+
+This was previously partially fixed by commit 781118bc2fc1
+("ASoC: wm_adsp: Fix missing locking in wm_adsp_[read|write]_ctl()")
+but this only put locking around the call to cs_dsp_coeff_write_ctrl(),
+missing the call to cs_dsp_get_ctl().
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Fixes: 781118bc2fc1 ("ASoC: wm_adsp: Fix missing locking in wm_adsp_[read|write]_ctl()")
+Link: https://msgid.link/r/20240307110227.41421-1-rf@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/wm_adsp.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
+index 36ea0dcdc7ab0..9cb9068c0462a 100644
+--- a/sound/soc/codecs/wm_adsp.c
++++ b/sound/soc/codecs/wm_adsp.c
+@@ -683,11 +683,12 @@ static void wm_adsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl)
+ int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type,
+                     unsigned int alg, void *buf, size_t len)
+ {
+-      struct cs_dsp_coeff_ctl *cs_ctl = cs_dsp_get_ctl(&dsp->cs_dsp, name, type, alg);
++      struct cs_dsp_coeff_ctl *cs_ctl;
+       struct wm_coeff_ctl *ctl;
+       int ret;
+       mutex_lock(&dsp->cs_dsp.pwr_lock);
++      cs_ctl = cs_dsp_get_ctl(&dsp->cs_dsp, name, type, alg);
+       ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, buf, len);
+       mutex_unlock(&dsp->cs_dsp.pwr_lock);
+-- 
+2.43.0
+
diff --git a/queue-6.8/ata-sata_mv-fix-pci-device-id-table-declaration-comp.patch b/queue-6.8/ata-sata_mv-fix-pci-device-id-table-declaration-comp.patch
new file mode 100644 (file)
index 0000000..d0132de
--- /dev/null
@@ -0,0 +1,124 @@
+From ec5bb283c0aa888864f37e870d8aaa8fb64ccfb4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Apr 2024 10:06:48 +0200
+Subject: ata: sata_mv: Fix PCI device ID table declaration compilation warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 3137b83a90646917c90951d66489db466b4ae106 ]
+
+Building with W=1 shows a warning for an unused variable when CONFIG_PCI
+is diabled:
+
+drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable]
+static const struct pci_device_id mv_pci_tbl[] = {
+
+Move the table into the same block that containsn the pci_driver
+definition.
+
+Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/ata/sata_mv.c | 63 +++++++++++++++++++++----------------------
+ 1 file changed, 31 insertions(+), 32 deletions(-)
+
+diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
+index e82786c63fbd7..9bec0aee92e04 100644
+--- a/drivers/ata/sata_mv.c
++++ b/drivers/ata/sata_mv.c
+@@ -787,37 +787,6 @@ static const struct ata_port_info mv_port_info[] = {
+       },
+ };
+-static const struct pci_device_id mv_pci_tbl[] = {
+-      { PCI_VDEVICE(MARVELL, 0x5040), chip_504x },
+-      { PCI_VDEVICE(MARVELL, 0x5041), chip_504x },
+-      { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 },
+-      { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
+-      /* RocketRAID 1720/174x have different identifiers */
+-      { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
+-      { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
+-      { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
+-
+-      { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
+-      { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
+-      { PCI_VDEVICE(MARVELL, 0x6042), chip_6042 },
+-      { PCI_VDEVICE(MARVELL, 0x6080), chip_608x },
+-      { PCI_VDEVICE(MARVELL, 0x6081), chip_608x },
+-
+-      { PCI_VDEVICE(ADAPTEC2, 0x0241), chip_604x },
+-
+-      /* Adaptec 1430SA */
+-      { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 },
+-
+-      /* Marvell 7042 support */
+-      { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 },
+-
+-      /* Highpoint RocketRAID PCIe series */
+-      { PCI_VDEVICE(TTI, 0x2300), chip_7042 },
+-      { PCI_VDEVICE(TTI, 0x2310), chip_7042 },
+-
+-      { }                     /* terminate list */
+-};
+-
+ static const struct mv_hw_ops mv5xxx_ops = {
+       .phy_errata             = mv5_phy_errata,
+       .enable_leds            = mv5_enable_leds,
+@@ -4303,6 +4272,36 @@ static int mv_pci_init_one(struct pci_dev *pdev,
+ static int mv_pci_device_resume(struct pci_dev *pdev);
+ #endif
++static const struct pci_device_id mv_pci_tbl[] = {
++      { PCI_VDEVICE(MARVELL, 0x5040), chip_504x },
++      { PCI_VDEVICE(MARVELL, 0x5041), chip_504x },
++      { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 },
++      { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
++      /* RocketRAID 1720/174x have different identifiers */
++      { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
++      { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
++      { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
++
++      { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
++      { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
++      { PCI_VDEVICE(MARVELL, 0x6042), chip_6042 },
++      { PCI_VDEVICE(MARVELL, 0x6080), chip_608x },
++      { PCI_VDEVICE(MARVELL, 0x6081), chip_608x },
++
++      { PCI_VDEVICE(ADAPTEC2, 0x0241), chip_604x },
++
++      /* Adaptec 1430SA */
++      { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 },
++
++      /* Marvell 7042 support */
++      { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 },
++
++      /* Highpoint RocketRAID PCIe series */
++      { PCI_VDEVICE(TTI, 0x2300), chip_7042 },
++      { PCI_VDEVICE(TTI, 0x2310), chip_7042 },
++
++      { }                     /* terminate list */
++};
+ static struct pci_driver mv_pci_driver = {
+       .name                   = DRV_NAME,
+@@ -4315,6 +4314,7 @@ static struct pci_driver mv_pci_driver = {
+ #endif
+ };
++MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
+ /**
+  *      mv_print_info - Dump key info to kernel log for perusal.
+@@ -4487,7 +4487,6 @@ static void __exit mv_exit(void)
+ MODULE_AUTHOR("Brett Russ");
+ MODULE_DESCRIPTION("SCSI low-level driver for Marvell SATA controllers");
+ MODULE_LICENSE("GPL v2");
+-MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
+ MODULE_VERSION(DRV_VERSION);
+ MODULE_ALIAS("platform:" DRV_NAME);
+-- 
+2.43.0
+
diff --git a/queue-6.8/ata-sata_sx4-fix-pdc20621_get_from_dimm-on-64-bit.patch b/queue-6.8/ata-sata_sx4-fix-pdc20621_get_from_dimm-on-64-bit.patch
new file mode 100644 (file)
index 0000000..7776a2a
--- /dev/null
@@ -0,0 +1,71 @@
+From e247c8ed8ba9824536d0f71a27f75700c81e13df Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Mar 2024 15:53:37 +0100
+Subject: ata: sata_sx4: fix pdc20621_get_from_dimm() on 64-bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 52f80bb181a9a1530ade30bc18991900bbb9697f ]
+
+gcc warns about a memcpy() with overlapping pointers because of an
+incorrect size calculation:
+
+In file included from include/linux/string.h:369,
+                 from drivers/ata/sata_sx4.c:66:
+In function 'memcpy_fromio',
+    inlined from 'pdc20621_get_from_dimm.constprop' at drivers/ata/sata_sx4.c:962:2:
+include/linux/fortify-string.h:97:33: error: '__builtin_memcpy' accessing 4294934464 bytes at offsets 0 and [16, 16400] overlaps 6442385281 bytes at offset -2147450817 [-Werror=restrict]
+   97 | #define __underlying_memcpy     __builtin_memcpy
+      |                                 ^
+include/linux/fortify-string.h:620:9: note: in expansion of macro '__underlying_memcpy'
+  620 |         __underlying_##op(p, q, __fortify_size);                        \
+      |         ^~~~~~~~~~~~~
+include/linux/fortify-string.h:665:26: note: in expansion of macro '__fortify_memcpy_chk'
+  665 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
+      |                          ^~~~~~~~~~~~~~~~~~~~
+include/asm-generic/io.h:1184:9: note: in expansion of macro 'memcpy'
+ 1184 |         memcpy(buffer, __io_virt(addr), size);
+      |         ^~~~~~
+
+The problem here is the overflow of an unsigned 32-bit number to a
+negative that gets converted into a signed 'long', keeping a large
+positive number.
+
+Replace the complex calculation with a more readable min() variant
+that avoids the warning.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/ata/sata_sx4.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
+index b51d7a9d0d90c..a482741eb181f 100644
+--- a/drivers/ata/sata_sx4.c
++++ b/drivers/ata/sata_sx4.c
+@@ -957,8 +957,7 @@ static void pdc20621_get_from_dimm(struct ata_host *host, void *psource,
+       offset -= (idx * window_size);
+       idx++;
+-      dist = ((long) (window_size - (offset + size))) >= 0 ? size :
+-              (long) (window_size - offset);
++      dist = min(size, window_size - offset);
+       memcpy_fromio(psource, dimm_mmio + offset / 4, dist);
+       psource += dist;
+@@ -1005,8 +1004,7 @@ static void pdc20621_put_to_dimm(struct ata_host *host, void *psource,
+       readl(mmio + PDC_DIMM_WINDOW_CTLR);
+       offset -= (idx * window_size);
+       idx++;
+-      dist = ((long)(s32)(window_size - (offset + size))) >= 0 ? size :
+-              (long) (window_size - offset);
++      dist = min(size, window_size - offset);
+       memcpy_toio(dimm_mmio + offset / 4, psource, dist);
+       writel(0x01, mmio + PDC_GENERAL_CTLR);
+       readl(mmio + PDC_GENERAL_CTLR);
+-- 
+2.43.0
+
diff --git a/queue-6.8/block-count-blk_open_restrict_writes-openers.patch b/queue-6.8/block-count-blk_open_restrict_writes-openers.patch
new file mode 100644 (file)
index 0000000..14d1a6f
--- /dev/null
@@ -0,0 +1,72 @@
+From b7974a95c062fbc3c28a17bf6c0b6d6dfc8b2b61 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 23 Mar 2024 17:11:20 +0100
+Subject: block: count BLK_OPEN_RESTRICT_WRITES openers
+
+From: Christian Brauner <brauner@kernel.org>
+
+[ Upstream commit 3ff56e285de5a375fbfab3c3f1af81bbd23db36d ]
+
+The original changes in v6.8 do allow for a block device to be reopened
+with BLK_OPEN_RESTRICT_WRITES provided the same holder is used as per
+bdev_may_open(). I think this has a bug.
+
+The first opener @f1 of that block device will set bdev->bd_writers to
+-1. The second opener @f2 using the same holder will pass the check in
+bdev_may_open() that bdev->bd_writers must not be greater than zero.
+
+The first opener @f1 now closes the block device and in bdev_release()
+will end up calling bdev_yield_write_access() which calls
+bdev_writes_blocked() and sets bdev->bd_writers to 0 again.
+
+Now @f2 holds a file to that block device which was opened with
+exclusive write access but bdev->bd_writers has been reset to 0.
+
+So now @f3 comes along and succeeds in opening the block device with
+BLK_OPEN_WRITE betraying @f2's request to have exclusive write access.
+
+This isn't a practical issue yet because afaict there's no codepath
+inside the kernel that reopenes the same block device with
+BLK_OPEN_RESTRICT_WRITES but it will be if there is.
+
+Fix this by counting the number of BLK_OPEN_RESTRICT_WRITES openers. So
+we only allow writes again once all BLK_OPEN_RESTRICT_WRITES openers are
+done.
+
+Link: https://lore.kernel.org/r/20240323-abtauchen-klauen-c2953810082d@brauner
+Fixes: ed5cc702d311 ("block: Add config option to not allow writing to mounted devices")
+Reviewed-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Christian Brauner <brauner@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ block/bdev.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/block/bdev.c b/block/bdev.c
+index e9f1b12bd75c7..678807bcd0034 100644
+--- a/block/bdev.c
++++ b/block/bdev.c
+@@ -738,17 +738,17 @@ void blkdev_put_no_open(struct block_device *bdev)
+ static bool bdev_writes_blocked(struct block_device *bdev)
+ {
+-      return bdev->bd_writers == -1;
++      return bdev->bd_writers < 0;
+ }
+ static void bdev_block_writes(struct block_device *bdev)
+ {
+-      bdev->bd_writers = -1;
++      bdev->bd_writers--;
+ }
+ static void bdev_unblock_writes(struct block_device *bdev)
+ {
+-      bdev->bd_writers = 0;
++      bdev->bd_writers++;
+ }
+ static bool bdev_may_open(struct block_device *bdev, blk_mode_t mode)
+-- 
+2.43.0
+
diff --git a/queue-6.8/cifs-fix-caching-to-try-to-do-open-o_wronly-as-rdwr-.patch b/queue-6.8/cifs-fix-caching-to-try-to-do-open-o_wronly-as-rdwr-.patch
new file mode 100644 (file)
index 0000000..0765468
--- /dev/null
@@ -0,0 +1,251 @@
+From c2769ce3d8b7c046024d4a967bd7b4f2cb38fac3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 2 Apr 2024 10:11:35 +0100
+Subject: cifs: Fix caching to try to do open O_WRONLY as rdwr on server
+
+From: David Howells <dhowells@redhat.com>
+
+[ Upstream commit e9e62243a3e2322cf639f653a0b0a88a76446ce7 ]
+
+When we're engaged in local caching of a cifs filesystem, we cannot perform
+caching of a partially written cache granule unless we can read the rest of
+the granule.  This can result in unexpected access errors being reported to
+the user.
+
+Fix this by the following: if a file is opened O_WRONLY locally, but the
+mount was given the "-o fsc" flag, try first opening the remote file with
+GENERIC_READ|GENERIC_WRITE and if that returns -EACCES, try dropping the
+GENERIC_READ and doing the open again.  If that last succeeds, invalidate
+the cache for that file as for O_DIRECT.
+
+Fixes: 70431bfd825d ("cifs: Support fscache indexing rewrite")
+Signed-off-by: David Howells <dhowells@redhat.com>
+cc: Steve French <sfrench@samba.org>
+cc: Shyam Prasad N <nspmangalore@gmail.com>
+cc: Rohith Surabattula <rohiths.msft@gmail.com>
+cc: Jeff Layton <jlayton@kernel.org>
+cc: linux-cifs@vger.kernel.org
+cc: netfs@lists.linux.dev
+cc: linux-fsdevel@vger.kernel.org
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/client/dir.c     | 15 +++++++++++++
+ fs/smb/client/file.c    | 48 ++++++++++++++++++++++++++++++++---------
+ fs/smb/client/fscache.h |  6 ++++++
+ 3 files changed, 59 insertions(+), 10 deletions(-)
+
+diff --git a/fs/smb/client/dir.c b/fs/smb/client/dir.c
+index 89333d9bce36e..37897b919dd5a 100644
+--- a/fs/smb/client/dir.c
++++ b/fs/smb/client/dir.c
+@@ -189,6 +189,7 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
+       int disposition;
+       struct TCP_Server_Info *server = tcon->ses->server;
+       struct cifs_open_parms oparms;
++      int rdwr_for_fscache = 0;
+       *oplock = 0;
+       if (tcon->ses->server->oplocks)
+@@ -200,6 +201,10 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
+               return PTR_ERR(full_path);
+       }
++      /* If we're caching, we need to be able to fill in around partial writes. */
++      if (cifs_fscache_enabled(inode) && (oflags & O_ACCMODE) == O_WRONLY)
++              rdwr_for_fscache = 1;
++
+ #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+       if (tcon->unix_ext && cap_unix(tcon->ses) && !tcon->broken_posix_open &&
+           (CIFS_UNIX_POSIX_PATH_OPS_CAP &
+@@ -276,6 +281,8 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
+               desired_access |= GENERIC_READ; /* is this too little? */
+       if (OPEN_FMODE(oflags) & FMODE_WRITE)
+               desired_access |= GENERIC_WRITE;
++      if (rdwr_for_fscache == 1)
++              desired_access |= GENERIC_READ;
+       disposition = FILE_OVERWRITE_IF;
+       if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
+@@ -304,6 +311,7 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
+       if (!tcon->unix_ext && (mode & S_IWUGO) == 0)
+               create_options |= CREATE_OPTION_READONLY;
++retry_open:
+       oparms = (struct cifs_open_parms) {
+               .tcon = tcon,
+               .cifs_sb = cifs_sb,
+@@ -317,8 +325,15 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
+       rc = server->ops->open(xid, &oparms, oplock, buf);
+       if (rc) {
+               cifs_dbg(FYI, "cifs_create returned 0x%x\n", rc);
++              if (rc == -EACCES && rdwr_for_fscache == 1) {
++                      desired_access &= ~GENERIC_READ;
++                      rdwr_for_fscache = 2;
++                      goto retry_open;
++              }
+               goto out;
+       }
++      if (rdwr_for_fscache == 2)
++              cifs_invalidate_cache(inode, FSCACHE_INVAL_DIO_WRITE);
+ #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+       /*
+diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
+index 9d42a39009076..9ec835320f8a7 100644
+--- a/fs/smb/client/file.c
++++ b/fs/smb/client/file.c
+@@ -206,12 +206,12 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
+        */
+ }
+-static inline int cifs_convert_flags(unsigned int flags)
++static inline int cifs_convert_flags(unsigned int flags, int rdwr_for_fscache)
+ {
+       if ((flags & O_ACCMODE) == O_RDONLY)
+               return GENERIC_READ;
+       else if ((flags & O_ACCMODE) == O_WRONLY)
+-              return GENERIC_WRITE;
++              return rdwr_for_fscache == 1 ? (GENERIC_READ | GENERIC_WRITE) : GENERIC_WRITE;
+       else if ((flags & O_ACCMODE) == O_RDWR) {
+               /* GENERIC_ALL is too much permission to request
+                  can cause unnecessary access denied on create */
+@@ -348,11 +348,16 @@ static int cifs_nt_open(const char *full_path, struct inode *inode, struct cifs_
+       int create_options = CREATE_NOT_DIR;
+       struct TCP_Server_Info *server = tcon->ses->server;
+       struct cifs_open_parms oparms;
++      int rdwr_for_fscache = 0;
+       if (!server->ops->open)
+               return -ENOSYS;
+-      desired_access = cifs_convert_flags(f_flags);
++      /* If we're caching, we need to be able to fill in around partial writes. */
++      if (cifs_fscache_enabled(inode) && (f_flags & O_ACCMODE) == O_WRONLY)
++              rdwr_for_fscache = 1;
++
++      desired_access = cifs_convert_flags(f_flags, rdwr_for_fscache);
+ /*********************************************************************
+  *  open flag mapping table:
+@@ -389,6 +394,7 @@ static int cifs_nt_open(const char *full_path, struct inode *inode, struct cifs_
+       if (f_flags & O_DIRECT)
+               create_options |= CREATE_NO_BUFFER;
++retry_open:
+       oparms = (struct cifs_open_parms) {
+               .tcon = tcon,
+               .cifs_sb = cifs_sb,
+@@ -400,8 +406,16 @@ static int cifs_nt_open(const char *full_path, struct inode *inode, struct cifs_
+       };
+       rc = server->ops->open(xid, &oparms, oplock, buf);
+-      if (rc)
++      if (rc) {
++              if (rc == -EACCES && rdwr_for_fscache == 1) {
++                      desired_access = cifs_convert_flags(f_flags, 0);
++                      rdwr_for_fscache = 2;
++                      goto retry_open;
++              }
+               return rc;
++      }
++      if (rdwr_for_fscache == 2)
++              cifs_invalidate_cache(inode, FSCACHE_INVAL_DIO_WRITE);
+       /* TODO: Add support for calling posix query info but with passing in fid */
+       if (tcon->unix_ext)
+@@ -834,11 +848,11 @@ int cifs_open(struct inode *inode, struct file *file)
+ use_cache:
+       fscache_use_cookie(cifs_inode_cookie(file_inode(file)),
+                          file->f_mode & FMODE_WRITE);
+-      if (file->f_flags & O_DIRECT &&
+-          (!((file->f_flags & O_ACCMODE) != O_RDONLY) ||
+-           file->f_flags & O_APPEND))
+-              cifs_invalidate_cache(file_inode(file),
+-                                    FSCACHE_INVAL_DIO_WRITE);
++      if (!(file->f_flags & O_DIRECT))
++              goto out;
++      if ((file->f_flags & (O_ACCMODE | O_APPEND)) == O_RDONLY)
++              goto out;
++      cifs_invalidate_cache(file_inode(file), FSCACHE_INVAL_DIO_WRITE);
+ out:
+       free_dentry_path(page);
+@@ -903,6 +917,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
+       int disposition = FILE_OPEN;
+       int create_options = CREATE_NOT_DIR;
+       struct cifs_open_parms oparms;
++      int rdwr_for_fscache = 0;
+       xid = get_xid();
+       mutex_lock(&cfile->fh_mutex);
+@@ -966,7 +981,11 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
+       }
+ #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
+-      desired_access = cifs_convert_flags(cfile->f_flags);
++      /* If we're caching, we need to be able to fill in around partial writes. */
++      if (cifs_fscache_enabled(inode) && (cfile->f_flags & O_ACCMODE) == O_WRONLY)
++              rdwr_for_fscache = 1;
++
++      desired_access = cifs_convert_flags(cfile->f_flags, rdwr_for_fscache);
+       /* O_SYNC also has bit for O_DSYNC so following check picks up either */
+       if (cfile->f_flags & O_SYNC)
+@@ -978,6 +997,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
+       if (server->ops->get_lease_key)
+               server->ops->get_lease_key(inode, &cfile->fid);
++retry_open:
+       oparms = (struct cifs_open_parms) {
+               .tcon = tcon,
+               .cifs_sb = cifs_sb,
+@@ -1003,6 +1023,11 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
+               /* indicate that we need to relock the file */
+               oparms.reconnect = true;
+       }
++      if (rc == -EACCES && rdwr_for_fscache == 1) {
++              desired_access = cifs_convert_flags(cfile->f_flags, 0);
++              rdwr_for_fscache = 2;
++              goto retry_open;
++      }
+       if (rc) {
+               mutex_unlock(&cfile->fh_mutex);
+@@ -1011,6 +1036,9 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
+               goto reopen_error_exit;
+       }
++      if (rdwr_for_fscache == 2)
++              cifs_invalidate_cache(inode, FSCACHE_INVAL_DIO_WRITE);
++
+ #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+ reopen_success:
+ #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
+diff --git a/fs/smb/client/fscache.h b/fs/smb/client/fscache.h
+index a3d73720914f8..1f2ea9f5cc9a8 100644
+--- a/fs/smb/client/fscache.h
++++ b/fs/smb/client/fscache.h
+@@ -109,6 +109,11 @@ static inline void cifs_readahead_to_fscache(struct inode *inode,
+               __cifs_readahead_to_fscache(inode, pos, len);
+ }
++static inline bool cifs_fscache_enabled(struct inode *inode)
++{
++      return fscache_cookie_enabled(cifs_inode_cookie(inode));
++}
++
+ #else /* CONFIG_CIFS_FSCACHE */
+ static inline
+ void cifs_fscache_fill_coherency(struct inode *inode,
+@@ -124,6 +129,7 @@ static inline void cifs_fscache_release_inode_cookie(struct inode *inode) {}
+ static inline void cifs_fscache_unuse_inode_cookie(struct inode *inode, bool update) {}
+ static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode) { return NULL; }
+ static inline void cifs_invalidate_cache(struct inode *inode, unsigned int flags) {}
++static inline bool cifs_fscache_enabled(struct inode *inode) { return false; }
+ static inline int cifs_fscache_query_occupancy(struct inode *inode,
+                                              pgoff_t first, unsigned int nr_pages,
+-- 
+2.43.0
+
diff --git a/queue-6.8/drivers-perf-riscv-disable-perf_sample_branch_-while.patch b/queue-6.8/drivers-perf-riscv-disable-perf_sample_branch_-while.patch
new file mode 100644 (file)
index 0000000..5fbb793
--- /dev/null
@@ -0,0 +1,45 @@
+From 166886afd0e3fa2690e8d2e099c9b75d3b19c7af Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 12 Mar 2024 01:20:53 +0000
+Subject: drivers/perf: riscv: Disable PERF_SAMPLE_BRANCH_* while not supported
+
+From: Pu Lehui <pulehui@huawei.com>
+
+[ Upstream commit ea6873118493019474abbf57d5a800da365734df ]
+
+RISC-V perf driver does not yet support branch sampling. Although the
+specification is in the works [0], it is best to disable such events
+until support is available, otherwise we will get unexpected results.
+Due to this reason, two riscv bpf testcases get_branch_snapshot and
+perf_branches/perf_branches_hw fail.
+
+Link: https://github.com/riscv/riscv-control-transfer-records [0]
+Fixes: f5bfa23f576f ("RISC-V: Add a perf core library for pmu drivers")
+Signed-off-by: Pu Lehui <pulehui@huawei.com>
+Reviewed-by: Atish Patra <atishp@rivosinc.com>
+Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
+Link: https://lore.kernel.org/r/20240312012053.1178140-1-pulehui@huaweicloud.com
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/perf/riscv_pmu.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/perf/riscv_pmu.c b/drivers/perf/riscv_pmu.c
+index c78a6fd6c57f6..b4efdddb2ad91 100644
+--- a/drivers/perf/riscv_pmu.c
++++ b/drivers/perf/riscv_pmu.c
+@@ -313,6 +313,10 @@ static int riscv_pmu_event_init(struct perf_event *event)
+       u64 event_config = 0;
+       uint64_t cmask;
++      /* driver does not support branch stack sampling */
++      if (has_branch_stack(event))
++              return -EOPNOTSUPP;
++
+       hwc->flags = 0;
+       mapped_event = rvpmu->event_map(event, &event_config);
+       if (mapped_event < 0) {
+-- 
+2.43.0
+
diff --git a/queue-6.8/drm-i915-dp-fix-dsc-state-hw-readout-for-sst-connect.patch b/queue-6.8/drm-i915-dp-fix-dsc-state-hw-readout-for-sst-connect.patch
new file mode 100644 (file)
index 0000000..a0f296e
--- /dev/null
@@ -0,0 +1,65 @@
+From 11cf2c922097b78a9aa374dda2bb9c286a445ed3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 11 Mar 2024 16:56:26 +0200
+Subject: drm/i915/dp: Fix DSC state HW readout for SST connectors
+
+From: Imre Deak <imre.deak@intel.com>
+
+[ Upstream commit d725ce9d7c78fb4e22c6c7676106e135ade14fa8 ]
+
+Commit 0848814aa296 ("drm/i915/dp: Fix connector DSC HW state readout")
+moved the DSC HW state readout to a connector specific hook, however
+only added the hook for DP MST connectors, not for DP SST ones. Fix
+adding the hook for SST connectors as well.
+
+This fixes the following warn on platforms where BIOS enables DSC:
+
+[   66.208601] i915 0000:00:02.0: drm_WARN_ON(!connector->dp.dsc_decompression_aux || !connector->dp.dsc_decompression_enabled)
+...
+[   66.209024] RIP: 0010:intel_dp_sink_disable_decompression+0x76/0x110 [i915]
+...
+[   66.209333]  ? intel_dp_sink_disable_decompression+0x76/0x110 [i915]
+...
+[   66.210068]  intel_disable_ddi+0x135/0x1d0 [i915]
+[   66.210302]  intel_encoders_disable+0x9b/0xc0 [i915]
+[   66.210565]  hsw_crtc_disable+0x153/0x170 [i915]
+[   66.210823]  intel_old_crtc_state_disables+0x52/0xb0 [i915]
+[   66.211107]  intel_atomic_commit_tail+0x5cf/0x1330 [i915]
+[   66.211366]  intel_atomic_commit+0x39d/0x3f0 [i915]
+[   66.211612]  ? intel_atomic_commit+0x39d/0x3f0 [i915]
+[   66.211872]  drm_atomic_commit+0x9d/0xd0 [drm]
+[   66.211921]  ? __pfx___drm_printfn_info+0x10/0x10 [drm]
+[   66.211975]  intel_initial_commit+0x1a8/0x260 [i915]
+[   66.212234]  intel_display_driver_probe+0x2a/0x80 [i915]
+[   66.212479]  i915_driver_probe+0x7c6/0xc60 [i915]
+[   66.212664]  ? drm_privacy_screen_get+0x168/0x190 [drm]
+[   66.212711]  i915_pci_probe+0xe2/0x1c0 [i915]
+
+Fixes: 0848814aa296 ("drm/i915/dp: Fix connector DSC HW state readout")
+Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10410
+Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
+Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
+Signed-off-by: Imre Deak <imre.deak@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240311145626.2454923-1-imre.deak@intel.com
+(cherry picked from commit 7a51a2aa2384ea8bee76698ae586a2bea5b8ddb5)
+Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/i915/display/intel_dp.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
+index 94d2a15d8444a..820cc9d3cc0b3 100644
+--- a/drivers/gpu/drm/i915/display/intel_dp.c
++++ b/drivers/gpu/drm/i915/display/intel_dp.c
+@@ -6523,6 +6523,7 @@ intel_dp_init_connector(struct intel_digital_port *dig_port,
+               intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;
+       else
+               intel_connector->get_hw_state = intel_connector_get_hw_state;
++      intel_connector->sync_state = intel_dp_connector_sync_state;
+       if (!intel_edp_init_connector(intel_dp, intel_connector)) {
+               intel_dp_aux_fini(intel_dp);
+-- 
+2.43.0
+
diff --git a/queue-6.8/drm-i915-gt-limit-the-reserved-vm-space-to-only-the-.patch b/queue-6.8/drm-i915-gt-limit-the-reserved-vm-space-to-only-the-.patch
new file mode 100644 (file)
index 0000000..bf24654
--- /dev/null
@@ -0,0 +1,96 @@
+From e6385678b11a54156af908da05b06b9e96afa0a1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Mar 2024 21:05:46 +0100
+Subject: drm/i915/gt: Limit the reserved VM space to only the platforms that
+ need it
+
+From: Andi Shyti <andi.shyti@linux.intel.com>
+
+[ Upstream commit 94bf3e60e1a61973cdb6488af873b8de66250c77 ]
+
+Commit 9bb66c179f50 ("drm/i915: Reserve some kernel space per
+vm") reduces the available VM space of one page in order to apply
+Wa_16018031267 and Wa_16018063123.
+
+This page was reserved indiscrimitely in all platforms even when
+not needed. Limit it to DG2 onwards.
+
+Fixes: 9bb66c179f50 ("drm/i915: Reserve some kernel space per vm")
+Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
+Cc: Andrzej Hajda <andrzej.hajda@intel.com>
+Cc: Chris Wilson <chris.p.wilson@linux.intel.com>
+Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>
+Cc: Nirmoy Das <nirmoy.das@intel.com>
+Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
+Acked-by: Michal Mrozek <michal.mrozek@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240327200546.640108-1-andi.shyti@linux.intel.com
+(cherry picked from commit 9721634441d5dedba7f9eebb2bf0c9411cbafc4e)
+Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 3 +++
+ drivers/gpu/drm/i915/gt/intel_gt.c   | 6 ++++++
+ drivers/gpu/drm/i915/gt/intel_gt.h   | 9 +++++----
+ 3 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
+index fa46d2308b0ed..81bf2216371be 100644
+--- a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
++++ b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
+@@ -961,6 +961,9 @@ static int gen8_init_rsvd(struct i915_address_space *vm)
+       struct i915_vma *vma;
+       int ret;
++      if (!intel_gt_needs_wa_16018031267(vm->gt))
++              return 0;
++
+       /* The memory will be used only by GPU. */
+       obj = i915_gem_object_create_lmem(i915, PAGE_SIZE,
+                                         I915_BO_ALLOC_VOLATILE |
+diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
+index a425db5ed3a22..6a2c2718bcc38 100644
+--- a/drivers/gpu/drm/i915/gt/intel_gt.c
++++ b/drivers/gpu/drm/i915/gt/intel_gt.c
+@@ -1024,6 +1024,12 @@ enum i915_map_type intel_gt_coherent_map_type(struct intel_gt *gt,
+               return I915_MAP_WC;
+ }
++bool intel_gt_needs_wa_16018031267(struct intel_gt *gt)
++{
++      /* Wa_16018031267, Wa_16018063123 */
++      return IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 55), IP_VER(12, 71));
++}
++
+ bool intel_gt_needs_wa_22016122933(struct intel_gt *gt)
+ {
+       return MEDIA_VER_FULL(gt->i915) == IP_VER(13, 0) && gt->type == GT_MEDIA;
+diff --git a/drivers/gpu/drm/i915/gt/intel_gt.h b/drivers/gpu/drm/i915/gt/intel_gt.h
+index 608f5c8729285..003eb93b826fd 100644
+--- a/drivers/gpu/drm/i915/gt/intel_gt.h
++++ b/drivers/gpu/drm/i915/gt/intel_gt.h
+@@ -82,17 +82,18 @@ struct drm_printer;
+                 ##__VA_ARGS__);                                       \
+ } while (0)
+-#define NEEDS_FASTCOLOR_BLT_WABB(engine) ( \
+-      IS_GFX_GT_IP_RANGE(engine->gt, IP_VER(12, 55), IP_VER(12, 71)) && \
+-      engine->class == COPY_ENGINE_CLASS && engine->instance == 0)
+-
+ static inline bool gt_is_root(struct intel_gt *gt)
+ {
+       return !gt->info.id;
+ }
++bool intel_gt_needs_wa_16018031267(struct intel_gt *gt);
+ bool intel_gt_needs_wa_22016122933(struct intel_gt *gt);
++#define NEEDS_FASTCOLOR_BLT_WABB(engine) ( \
++      intel_gt_needs_wa_16018031267(engine->gt) && \
++      engine->class == COPY_ENGINE_CLASS && engine->instance == 0)
++
+ static inline struct intel_gt *uc_to_gt(struct intel_uc *uc)
+ {
+       return container_of(uc, struct intel_gt, uc);
+-- 
+2.43.0
+
diff --git a/queue-6.8/drm-panfrost-fix-power-transition-timeout-warnings.patch b/queue-6.8/drm-panfrost-fix-power-transition-timeout-warnings.patch
new file mode 100644 (file)
index 0000000..c7e83e7
--- /dev/null
@@ -0,0 +1,66 @@
+From 1fa9139963ed223e0e14b6e09acf39ef663cd4c1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Mar 2024 16:45:25 +0000
+Subject: drm/panfrost: fix power transition timeout warnings
+
+From: Christian Hewitt <christianshewitt@gmail.com>
+
+[ Upstream commit 2bd02f5a0bac4bb13e0da18652dc75ba0e4958ec ]
+
+Increase the timeout value to prevent system logs on Amlogic boards flooding
+with power transition warnings:
+
+[   13.047638] panfrost ffe40000.gpu: shader power transition timeout
+[   13.048674] panfrost ffe40000.gpu: l2 power transition timeout
+[   13.937324] panfrost ffe40000.gpu: shader power transition timeout
+[   13.938351] panfrost ffe40000.gpu: l2 power transition timeout
+...
+[39829.506904] panfrost ffe40000.gpu: shader power transition timeout
+[39829.507938] panfrost ffe40000.gpu: l2 power transition timeout
+[39949.508369] panfrost ffe40000.gpu: shader power transition timeout
+[39949.509405] panfrost ffe40000.gpu: l2 power transition timeout
+
+The 2000 value has been found through trial and error testing with devices
+using G52 and G31 GPUs.
+
+Fixes: 22aa1a209018 ("drm/panfrost: Really power off GPU cores in panfrost_gpu_power_off()")
+Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
+Reviewed-by: Steven Price <steven.price@arm.com>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Signed-off-by: Steven Price <steven.price@arm.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240322164525.2617508-1-christianshewitt@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/panfrost/panfrost_gpu.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
+index 9063ce2546422..fd8e44992184f 100644
+--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
+@@ -441,19 +441,19 @@ void panfrost_gpu_power_off(struct panfrost_device *pfdev)
+       gpu_write(pfdev, SHADER_PWROFF_LO, pfdev->features.shader_present);
+       ret = readl_relaxed_poll_timeout(pfdev->iomem + SHADER_PWRTRANS_LO,
+-                                       val, !val, 1, 1000);
++                                       val, !val, 1, 2000);
+       if (ret)
+               dev_err(pfdev->dev, "shader power transition timeout");
+       gpu_write(pfdev, TILER_PWROFF_LO, pfdev->features.tiler_present);
+       ret = readl_relaxed_poll_timeout(pfdev->iomem + TILER_PWRTRANS_LO,
+-                                       val, !val, 1, 1000);
++                                       val, !val, 1, 2000);
+       if (ret)
+               dev_err(pfdev->dev, "tiler power transition timeout");
+       gpu_write(pfdev, L2_PWROFF_LO, pfdev->features.l2_present);
+       ret = readl_poll_timeout(pfdev->iomem + L2_PWRTRANS_LO,
+-                               val, !val, 0, 1000);
++                               val, !val, 0, 2000);
+       if (ret)
+               dev_err(pfdev->dev, "l2 power transition timeout");
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.8/drm-prime-unbreak-virtgpu-dma-buf-export.patch b/queue-6.8/drm-prime-unbreak-virtgpu-dma-buf-export.patch
new file mode 100644 (file)
index 0000000..185500e
--- /dev/null
@@ -0,0 +1,46 @@
+From 4451e59833ad0f598122eb112c014747f30beec0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Mar 2024 14:48:01 -0700
+Subject: drm/prime: Unbreak virtgpu dma-buf export
+
+From: Rob Clark <robdclark@chromium.org>
+
+[ Upstream commit a4ec240f6b7c21cf846d10017c3ce423a0eae92c ]
+
+virtgpu "vram" GEM objects do not implement obj->get_sg_table().  But
+they also don't use drm_gem_map_dma_buf().  In fact they may not even
+have guest visible pages.  But it is perfectly fine to export and share
+with other virtual devices.
+
+Reported-by: Dominik Behr <dbehr@chromium.org>
+Fixes: 207395da5a97 ("drm/prime: reject DMA-BUF attach when get_sg_table is missing")
+Signed-off-by: Rob Clark <robdclark@chromium.org>
+Reviewed-by: Simon Ser <contact@emersion.fr>
+Signed-off-by: Simon Ser <contact@emersion.fr>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240322214801.319975-1-robdclark@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_prime.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
+index 7352bde299d54..03bd3c7bd0dc2 100644
+--- a/drivers/gpu/drm/drm_prime.c
++++ b/drivers/gpu/drm/drm_prime.c
+@@ -582,7 +582,12 @@ int drm_gem_map_attach(struct dma_buf *dma_buf,
+ {
+       struct drm_gem_object *obj = dma_buf->priv;
+-      if (!obj->funcs->get_sg_table)
++      /*
++       * drm_gem_map_dma_buf() requires obj->get_sg_table(), but drivers
++       * that implement their own ->map_dma_buf() do not.
++       */
++      if (dma_buf->ops->map_dma_buf == drm_gem_map_dma_buf &&
++          !obj->funcs->get_sg_table)
+               return -ENOSYS;
+       return drm_gem_pin(obj);
+-- 
+2.43.0
+
diff --git a/queue-6.8/lib-stackdepot-move-stack_record-struct-definition-i.patch b/queue-6.8/lib-stackdepot-move-stack_record-struct-definition-i.patch
new file mode 100644 (file)
index 0000000..8679a47
--- /dev/null
@@ -0,0 +1,150 @@
+From 4c6bcd6022e1b5208d4561274e7077ab8bec16ce Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 15 Feb 2024 22:59:02 +0100
+Subject: lib/stackdepot: move stack_record struct definition into the header
+
+From: Oscar Salvador <osalvador@suse.de>
+
+[ Upstream commit 8151c7a35d8bd8a12e93538ef7963ea209b6ab41 ]
+
+In order to move the heavy lifting into page_owner code, this one needs to
+have access to the stack_record structure, which right now sits in
+lib/stackdepot.c.  Move it to the stackdepot.h header so page_owner can
+access stack_record's struct fields.
+
+Link: https://lkml.kernel.org/r/20240215215907.20121-3-osalvador@suse.de
+Signed-off-by: Oscar Salvador <osalvador@suse.de>
+Reviewed-by: Marco Elver <elver@google.com>
+Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
+Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
+Cc: Alexander Potapenko <glider@google.com>
+Cc: Michal Hocko <mhocko@suse.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: a6c1d9cb9a68 ("stackdepot: rename pool_index to pool_index_plus_1")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/stackdepot.h | 47 ++++++++++++++++++++++++++++++++++++++
+ lib/stackdepot.c           | 43 ----------------------------------
+ 2 files changed, 47 insertions(+), 43 deletions(-)
+
+diff --git a/include/linux/stackdepot.h b/include/linux/stackdepot.h
+index adcbb8f236000..c4b5ad57c0660 100644
+--- a/include/linux/stackdepot.h
++++ b/include/linux/stackdepot.h
+@@ -30,6 +30,53 @@ typedef u32 depot_stack_handle_t;
+  */
+ #define STACK_DEPOT_EXTRA_BITS 5
++#define DEPOT_HANDLE_BITS (sizeof(depot_stack_handle_t) * 8)
++
++#define DEPOT_POOL_ORDER 2 /* Pool size order, 4 pages */
++#define DEPOT_POOL_SIZE (1LL << (PAGE_SHIFT + DEPOT_POOL_ORDER))
++#define DEPOT_STACK_ALIGN 4
++#define DEPOT_OFFSET_BITS (DEPOT_POOL_ORDER + PAGE_SHIFT - DEPOT_STACK_ALIGN)
++#define DEPOT_POOL_INDEX_BITS (DEPOT_HANDLE_BITS - DEPOT_OFFSET_BITS - \
++                             STACK_DEPOT_EXTRA_BITS)
++
++#ifdef CONFIG_STACKDEPOT
++/* Compact structure that stores a reference to a stack. */
++union handle_parts {
++      depot_stack_handle_t handle;
++      struct {
++              /* pool_index is offset by 1 */
++              u32 pool_index  : DEPOT_POOL_INDEX_BITS;
++              u32 offset      : DEPOT_OFFSET_BITS;
++              u32 extra       : STACK_DEPOT_EXTRA_BITS;
++      };
++};
++
++struct stack_record {
++      struct list_head hash_list;     /* Links in the hash table */
++      u32 hash;                       /* Hash in hash table */
++      u32 size;                       /* Number of stored frames */
++      union handle_parts handle;      /* Constant after initialization */
++      refcount_t count;
++      union {
++              unsigned long entries[CONFIG_STACKDEPOT_MAX_FRAMES];    /* Frames */
++              struct {
++                      /*
++                       * An important invariant of the implementation is to
++                       * only place a stack record onto the freelist iff its
++                       * refcount is zero. Because stack records with a zero
++                       * refcount are never considered as valid, it is safe to
++                       * union @entries and freelist management state below.
++                       * Conversely, as soon as an entry is off the freelist
++                       * and its refcount becomes non-zero, the below must not
++                       * be accessed until being placed back on the freelist.
++                       */
++                      struct list_head free_list;     /* Links in the freelist */
++                      unsigned long rcu_state;        /* RCU cookie */
++              };
++      };
++};
++#endif
++
+ typedef u32 depot_flags_t;
+ /*
+diff --git a/lib/stackdepot.c b/lib/stackdepot.c
+index c1ec2b4b6dabf..ee4bbe6513aa4 100644
+--- a/lib/stackdepot.c
++++ b/lib/stackdepot.c
+@@ -36,55 +36,12 @@
+ #include <linux/memblock.h>
+ #include <linux/kasan-enabled.h>
+-#define DEPOT_HANDLE_BITS (sizeof(depot_stack_handle_t) * 8)
+-
+-#define DEPOT_POOL_ORDER 2 /* Pool size order, 4 pages */
+-#define DEPOT_POOL_SIZE (1LL << (PAGE_SHIFT + DEPOT_POOL_ORDER))
+-#define DEPOT_STACK_ALIGN 4
+-#define DEPOT_OFFSET_BITS (DEPOT_POOL_ORDER + PAGE_SHIFT - DEPOT_STACK_ALIGN)
+-#define DEPOT_POOL_INDEX_BITS (DEPOT_HANDLE_BITS - DEPOT_OFFSET_BITS - \
+-                             STACK_DEPOT_EXTRA_BITS)
+ #define DEPOT_POOLS_CAP 8192
+ /* The pool_index is offset by 1 so the first record does not have a 0 handle. */
+ #define DEPOT_MAX_POOLS \
+       (((1LL << (DEPOT_POOL_INDEX_BITS)) - 1 < DEPOT_POOLS_CAP) ? \
+        (1LL << (DEPOT_POOL_INDEX_BITS)) - 1 : DEPOT_POOLS_CAP)
+-/* Compact structure that stores a reference to a stack. */
+-union handle_parts {
+-      depot_stack_handle_t handle;
+-      struct {
+-              u32 pool_index  : DEPOT_POOL_INDEX_BITS; /* pool_index is offset by 1 */
+-              u32 offset      : DEPOT_OFFSET_BITS;
+-              u32 extra       : STACK_DEPOT_EXTRA_BITS;
+-      };
+-};
+-
+-struct stack_record {
+-      struct list_head hash_list;     /* Links in the hash table */
+-      u32 hash;                       /* Hash in hash table */
+-      u32 size;                       /* Number of stored frames */
+-      union handle_parts handle;      /* Constant after initialization */
+-      refcount_t count;
+-      union {
+-              unsigned long entries[CONFIG_STACKDEPOT_MAX_FRAMES];    /* Frames */
+-              struct {
+-                      /*
+-                       * An important invariant of the implementation is to
+-                       * only place a stack record onto the freelist iff its
+-                       * refcount is zero. Because stack records with a zero
+-                       * refcount are never considered as valid, it is safe to
+-                       * union @entries and freelist management state below.
+-                       * Conversely, as soon as an entry is off the freelist
+-                       * and its refcount becomes non-zero, the below must not
+-                       * be accessed until being placed back on the freelist.
+-                       */
+-                      struct list_head free_list;     /* Links in the freelist */
+-                      unsigned long rcu_state;        /* RCU cookie */
+-              };
+-      };
+-};
+-
+ static bool stack_depot_disabled;
+ static bool __stack_depot_early_init_requested __initdata = IS_ENABLED(CONFIG_STACKDEPOT_ALWAYS_INIT);
+ static bool __stack_depot_early_init_passed __initdata;
+-- 
+2.43.0
+
diff --git a/queue-6.8/nfsd-hold-a-lighter-weight-client-reference-over-cb_.patch b/queue-6.8/nfsd-hold-a-lighter-weight-client-reference-over-cb_.patch
new file mode 100644 (file)
index 0000000..9c08dc3
--- /dev/null
@@ -0,0 +1,65 @@
+From b8df39e9731b3099b8bdae79fd9d1ac29fe3582e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Apr 2024 13:56:18 -0400
+Subject: nfsd: hold a lighter-weight client reference over CB_RECALL_ANY
+
+From: Jeff Layton <jlayton@kernel.org>
+
+[ Upstream commit 10396f4df8b75ff6ab0aa2cd74296565466f2c8d ]
+
+Currently the CB_RECALL_ANY job takes a cl_rpc_users reference to the
+client. While a callback job is technically an RPC that counter is
+really more for client-driven RPCs, and this has the effect of
+preventing the client from being unhashed until the callback completes.
+
+If nfsd decides to send a CB_RECALL_ANY just as the client reboots, we
+can end up in a situation where the callback can't complete on the (now
+dead) callback channel, but the new client can't connect because the old
+client can't be unhashed. This usually manifests as a NFS4ERR_DELAY
+return on the CREATE_SESSION operation.
+
+The job is only holding a reference to the client so it can clear a flag
+after the RPC completes. Fix this by having CB_RECALL_ANY instead hold a
+reference to the cl_nfsdfs.cl_ref. Typically we only take that sort of
+reference when dealing with the nfsdfs info files, but it should work
+appropriately here to ensure that the nfs4_client doesn't disappear.
+
+Fixes: 44df6f439a17 ("NFSD: add delegation reaper to react to low memory condition")
+Reported-by: Vladimir Benes <vbenes@redhat.com>
+Signed-off-by: Jeff Layton <jlayton@kernel.org>
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfsd/nfs4state.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
+index 7d6c657e0409d..692ede488254a 100644
+--- a/fs/nfsd/nfs4state.c
++++ b/fs/nfsd/nfs4state.c
+@@ -2888,12 +2888,9 @@ static void
+ nfsd4_cb_recall_any_release(struct nfsd4_callback *cb)
+ {
+       struct nfs4_client *clp = cb->cb_clp;
+-      struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
+-      spin_lock(&nn->client_lock);
+       clear_bit(NFSD4_CLIENT_CB_RECALL_ANY, &clp->cl_flags);
+-      put_client_renew_locked(clp);
+-      spin_unlock(&nn->client_lock);
++      drop_client(clp);
+ }
+ static const struct nfsd4_callback_ops nfsd4_cb_recall_any_ops = {
+@@ -6274,7 +6271,7 @@ deleg_reaper(struct nfsd_net *nn)
+               list_add(&clp->cl_ra_cblist, &cblist);
+               /* release in nfsd4_cb_recall_any_release */
+-              atomic_inc(&clp->cl_rpc_users);
++              kref_get(&clp->cl_nfsdfs.cl_ref);
+               set_bit(NFSD4_CLIENT_CB_RECALL_ANY, &clp->cl_flags);
+               clp->cl_ra_time = ktime_get_boottime_seconds();
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.8/nouveau-uvmm-fix-addr-range-calcs-for-remap-operatio.patch b/queue-6.8/nouveau-uvmm-fix-addr-range-calcs-for-remap-operatio.patch
new file mode 100644 (file)
index 0000000..ed03d40
--- /dev/null
@@ -0,0 +1,58 @@
+From cd1302ce0f3d6bf0d883a2609e4095651b153f15 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Mar 2024 12:43:16 +1000
+Subject: nouveau/uvmm: fix addr/range calcs for remap operations
+
+From: Dave Airlie <airlied@redhat.com>
+
+[ Upstream commit be141849ec00ef39935bf169c0f194ac70bf85ce ]
+
+dEQP-VK.sparse_resources.image_rebind.2d_array.r64i.128_128_8
+was causing a remap operation like the below.
+
+op_remap: prev: 0000003fffed0000 00000000000f0000 00000000a5abd18a 0000000000000000
+op_remap: next:
+op_remap: unmap: 0000003fffed0000 0000000000100000 0
+op_map: map: 0000003ffffc0000 0000000000010000 000000005b1ba33c 00000000000e0000
+
+This was resulting in an unmap operation from 0x3fffed0000+0xf0000, 0x100000
+which was corrupting the pagetables and oopsing the kernel.
+
+Fixes the prev + unmap range calcs to use start/end and map back to addr/range.
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI")
+Cc: Danilo Krummrich <dakr@redhat.com>
+Signed-off-by: Danilo Krummrich <dakr@redhat.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240328024317.2041851-1-airlied@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/nouveau/nouveau_uvmm.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
+index 0a0a11dc9ec03..ee02cd833c5e4 100644
+--- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c
++++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
+@@ -812,15 +812,15 @@ op_remap(struct drm_gpuva_op_remap *r,
+       struct drm_gpuva_op_unmap *u = r->unmap;
+       struct nouveau_uvma *uvma = uvma_from_va(u->va);
+       u64 addr = uvma->va.va.addr;
+-      u64 range = uvma->va.va.range;
++      u64 end = uvma->va.va.addr + uvma->va.va.range;
+       if (r->prev)
+               addr = r->prev->va.addr + r->prev->va.range;
+       if (r->next)
+-              range = r->next->va.addr - addr;
++              end = r->next->va.addr;
+-      op_unmap_range(u, addr, range);
++      op_unmap_range(u, addr, end - addr);
+ }
+ static int
+-- 
+2.43.0
+
diff --git a/queue-6.8/regmap-maple-fix-cache-corruption-in-regcache_maple_.patch b/queue-6.8/regmap-maple-fix-cache-corruption-in-regcache_maple_.patch
new file mode 100644 (file)
index 0000000..b181be4
--- /dev/null
@@ -0,0 +1,45 @@
+From 5d8ac6fd9d36152f5ff13a69877099ab3e7546b2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Mar 2024 11:44:06 +0000
+Subject: regmap: maple: Fix cache corruption in regcache_maple_drop()
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit 00bb549d7d63a21532e76e4a334d7807a54d9f31 ]
+
+When keeping the upper end of a cache block entry, the entry[] array
+must be indexed by the offset from the base register of the block,
+i.e. max - mas.index.
+
+The code was indexing entry[] by only the register address, leading
+to an out-of-bounds access that copied some part of the kernel
+memory over the cache contents.
+
+This bug was not detected by the regmap KUnit test because it only
+tests with a block of registers starting at 0, so mas.index == 0.
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Fixes: f033c26de5a5 ("regmap: Add maple tree based register cache")
+Link: https://msgid.link/r/20240327114406.976986-1-rf@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/base/regmap/regcache-maple.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/base/regmap/regcache-maple.c b/drivers/base/regmap/regcache-maple.c
+index 41edd6a430eb4..c1776127a5724 100644
+--- a/drivers/base/regmap/regcache-maple.c
++++ b/drivers/base/regmap/regcache-maple.c
+@@ -145,7 +145,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
+                       upper_index = max + 1;
+                       upper_last = mas.last;
+-                      upper = kmemdup(&entry[max + 1],
++                      upper = kmemdup(&entry[max - mas.index + 1],
+                                       ((mas.last - max) *
+                                        sizeof(unsigned long)),
+                                       map->alloc_flags);
+-- 
+2.43.0
+
diff --git a/queue-6.8/regmap-maple-fix-uninitialized-symbol-ret-warnings.patch b/queue-6.8/regmap-maple-fix-uninitialized-symbol-ret-warnings.patch
new file mode 100644 (file)
index 0000000..af7847c
--- /dev/null
@@ -0,0 +1,51 @@
+From 618931eca5e38a1a7b2c23076562167aa7b21820 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Mar 2024 14:46:30 +0000
+Subject: regmap: maple: Fix uninitialized symbol 'ret' warnings
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit eaa03486d932572dfd1c5f64f9dfebe572ad88c0 ]
+
+Fix warnings reported by smatch by initializing local 'ret' variable
+to 0.
+
+drivers/base/regmap/regcache-maple.c:186 regcache_maple_drop()
+error: uninitialized symbol 'ret'.
+drivers/base/regmap/regcache-maple.c:290 regcache_maple_sync()
+error: uninitialized symbol 'ret'.
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Fixes: f033c26de5a5 ("regmap: Add maple tree based register cache")
+Link: https://lore.kernel.org/r/20240329144630.1965159-1-rf@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/base/regmap/regcache-maple.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/base/regmap/regcache-maple.c b/drivers/base/regmap/regcache-maple.c
+index c1776127a5724..55999a50ccc0b 100644
+--- a/drivers/base/regmap/regcache-maple.c
++++ b/drivers/base/regmap/regcache-maple.c
+@@ -112,7 +112,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
+       unsigned long *entry, *lower, *upper;
+       unsigned long lower_index, lower_last;
+       unsigned long upper_index, upper_last;
+-      int ret;
++      int ret = 0;
+       lower = NULL;
+       upper = NULL;
+@@ -244,7 +244,7 @@ static int regcache_maple_sync(struct regmap *map, unsigned int min,
+       unsigned long lmin = min;
+       unsigned long lmax = max;
+       unsigned int r, v, sync_start;
+-      int ret;
++      int ret = 0;
+       bool sync_needed = false;
+       map->cache_bypass = true;
+-- 
+2.43.0
+
diff --git a/queue-6.8/revert-alsa-emu10k1-fix-synthesizer-sample-playback-.patch b/queue-6.8/revert-alsa-emu10k1-fix-synthesizer-sample-playback-.patch
new file mode 100644 (file)
index 0000000..90ce320
--- /dev/null
@@ -0,0 +1,72 @@
+From 7f1b3826b1a7255394d63765c1204c647d496a2b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Apr 2024 16:58:05 +0200
+Subject: Revert "ALSA: emu10k1: fix synthesizer sample playback position and
+ caching"
+
+From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
+
+[ Upstream commit 03f56ed4ead162551ac596c9e3076ff01f1c5836 ]
+
+As already anticipated in the original commit, playback was broken for
+very short samples. I just didn't expect it to be an actual problem,
+because we're talking about less than 1.5 milliseconds here. But clearly
+such wavetable samples do actually exist.
+
+The problem was that for such short samples we'd set the current
+position beyond the end of the loop, so we'd run off the end of the
+sample and play garbage.
+This is a bigger (more audible) problem than the original one, which was
+that we'd start playback with garbage (whatever was still in the cache),
+which would be mostly masked by the note's attack phase.
+
+So revert to the old behavior for now. We'll subsequently fix it
+properly with a bigger patch series.
+Note that this isn't a full revert - the dead code is not re-introduced,
+because that would be silly.
+
+Fixes: df335e9a8bcb ("ALSA: emu10k1: fix synthesizer sample playback position and caching")
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=218625
+Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
+Message-ID: <20240401145805.528794-1-oswald.buddenhagen@gmx.de>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/emu10k1/emu10k1_callback.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c
+index d36234b88fb42..941bfbf812ed3 100644
+--- a/sound/pci/emu10k1/emu10k1_callback.c
++++ b/sound/pci/emu10k1/emu10k1_callback.c
+@@ -255,7 +255,7 @@ lookup_voices(struct snd_emux *emu, struct snd_emu10k1 *hw,
+               /* check if sample is finished playing (non-looping only) */
+               if (bp != best + V_OFF && bp != best + V_FREE &&
+                   (vp->reg.sample_mode & SNDRV_SFNT_SAMPLE_SINGLESHOT)) {
+-                      val = snd_emu10k1_ptr_read(hw, CCCA_CURRADDR, vp->ch) - 64;
++                      val = snd_emu10k1_ptr_read(hw, CCCA_CURRADDR, vp->ch);
+                       if (val >= vp->reg.loopstart)
+                               bp = best + V_OFF;
+               }
+@@ -362,7 +362,7 @@ start_voice(struct snd_emux_voice *vp)
+       map = (hw->silent_page.addr << hw->address_mode) | (hw->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0);
+-      addr = vp->reg.start + 64;
++      addr = vp->reg.start;
+       temp = vp->reg.parm.filterQ;
+       ccca = (temp << 28) | addr;
+       if (vp->apitch < 0xe400)
+@@ -430,9 +430,6 @@ start_voice(struct snd_emux_voice *vp)
+               /* Q & current address (Q 4bit value, MSB) */
+               CCCA, ccca,
+-              /* cache */
+-              CCR, REG_VAL_PUT(CCR_CACHEINVALIDSIZE, 64),
+-
+               /* reset volume */
+               VTFT, vtarget | vp->ftarget,
+               CVCF, vtarget | CVCF_CURRENTFILTER_MASK,
+-- 
+2.43.0
+
diff --git a/queue-6.8/risc-v-update-at_vector_size_arch-for-new-at_minsigs.patch b/queue-6.8/risc-v-update-at_vector_size_arch-for-new-at_minsigs.patch
new file mode 100644 (file)
index 0000000..74de58f
--- /dev/null
@@ -0,0 +1,44 @@
+From 6abf6f8a440a99fc1b21549d04220a63abd8975c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 15 Dec 2023 23:27:20 -0500
+Subject: RISC-V: Update AT_VECTOR_SIZE_ARCH for new AT_MINSIGSTKSZ
+
+From: Victor Isaev <victor@torrio.net>
+
+[ Upstream commit 13dddf9319808badd2c1f5d7007b4e82838a648e ]
+
+"riscv: signal: Report signal frame size to userspace via auxv" (e92f469)
+has added new constant AT_MINSIGSTKSZ but failed to increment the size of
+auxv, keeping AT_VECTOR_SIZE_ARCH at 9.
+This fix correctly increments AT_VECTOR_SIZE_ARCH to 10, following the
+approach in the commit 94b07c1 ("arm64: signal: Report signal frame size
+to userspace via auxv").
+
+Link: https://lore.kernel.org/r/73883406.20231215232720@torrio.net
+Link: https://lore.kernel.org/all/20240102133617.3649-1-victor@torrio.net/
+Reported-by: Ivan Komarov <ivan.komarov@dfyz.info>
+Closes: https://lore.kernel.org/linux-riscv/CY3Z02NYV1C4.11BLB9PLVW9G1@fedora/
+Fixes: e92f469b0771 ("riscv: signal: Report signal frame size to userspace via auxv")
+Signed-off-by: Victor Isaev <isv@google.com>
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/riscv/include/uapi/asm/auxvec.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/riscv/include/uapi/asm/auxvec.h b/arch/riscv/include/uapi/asm/auxvec.h
+index 10aaa83db89ef..95050ebe9ad00 100644
+--- a/arch/riscv/include/uapi/asm/auxvec.h
++++ b/arch/riscv/include/uapi/asm/auxvec.h
+@@ -34,7 +34,7 @@
+ #define AT_L3_CACHEGEOMETRY   47
+ /* entries in ARCH_DLINFO */
+-#define AT_VECTOR_SIZE_ARCH   9
++#define AT_VECTOR_SIZE_ARCH   10
+ #define AT_MINSIGSTKSZ                51
+ #endif /* _UAPI_ASM_RISCV_AUXVEC_H */
+-- 
+2.43.0
+
diff --git a/queue-6.8/riscv-disable-preemption-when-using-patch_map.patch b/queue-6.8/riscv-disable-preemption-when-using-patch_map.patch
new file mode 100644 (file)
index 0000000..a0b0d1a
--- /dev/null
@@ -0,0 +1,79 @@
+From 7a78af71a238df62314d0a6bd654b2a2c8c15152 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Mar 2024 21:30:17 +0100
+Subject: riscv: Disable preemption when using patch_map()
+
+From: Alexandre Ghiti <alexghiti@rivosinc.com>
+
+[ Upstream commit a370c2419e4680a27382d9231edcf739d5d74efc ]
+
+patch_map() uses fixmap mappings to circumvent the non-writability of
+the kernel text mapping.
+
+The __set_fixmap() function only flushes the current cpu tlb, it does
+not emit an IPI so we must make sure that while we use a fixmap mapping,
+the current task is not migrated on another cpu which could miss the
+newly introduced fixmap mapping.
+
+So in order to avoid any task migration, disable the preemption.
+
+Reported-by: Andrea Parri <andrea@rivosinc.com>
+Closes: https://lore.kernel.org/all/ZcS+GAaM25LXsBOl@andrea/
+Reported-by: Andy Chiu <andy.chiu@sifive.com>
+Closes: https://lore.kernel.org/linux-riscv/CABgGipUMz3Sffu-CkmeUB1dKVwVQ73+7=sgC45-m0AE9RCjOZg@mail.gmail.com/
+Fixes: cad539baa48f ("riscv: implement a memset like function for text")
+Fixes: 0ff7c3b33127 ("riscv: Use text_mutex instead of patch_lock")
+Co-developed-by: Andy Chiu <andy.chiu@sifive.com>
+Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
+Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
+Acked-by: Puranjay Mohan <puranjay12@gmail.com>
+Link: https://lore.kernel.org/r/20240326203017.310422-3-alexghiti@rivosinc.com
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/riscv/kernel/patch.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c
+index 37e87fdcf6a00..30e12b310cab7 100644
+--- a/arch/riscv/kernel/patch.c
++++ b/arch/riscv/kernel/patch.c
+@@ -80,6 +80,8 @@ static int __patch_insn_set(void *addr, u8 c, size_t len)
+        */
+       lockdep_assert_held(&text_mutex);
++      preempt_disable();
++
+       if (across_pages)
+               patch_map(addr + PAGE_SIZE, FIX_TEXT_POKE1);
+@@ -92,6 +94,8 @@ static int __patch_insn_set(void *addr, u8 c, size_t len)
+       if (across_pages)
+               patch_unmap(FIX_TEXT_POKE1);
++      preempt_enable();
++
+       return 0;
+ }
+ NOKPROBE_SYMBOL(__patch_insn_set);
+@@ -122,6 +126,8 @@ static int __patch_insn_write(void *addr, const void *insn, size_t len)
+       if (!riscv_patch_in_stop_machine)
+               lockdep_assert_held(&text_mutex);
++      preempt_disable();
++
+       if (across_pages)
+               patch_map(addr + PAGE_SIZE, FIX_TEXT_POKE1);
+@@ -134,6 +140,8 @@ static int __patch_insn_write(void *addr, const void *insn, size_t len)
+       if (across_pages)
+               patch_unmap(FIX_TEXT_POKE1);
++      preempt_enable();
++
+       return ret;
+ }
+ NOKPROBE_SYMBOL(__patch_insn_write);
+-- 
+2.43.0
+
diff --git a/queue-6.8/riscv-fix-warning-by-declaring-arch_cpu_idle-as-noin.patch b/queue-6.8/riscv-fix-warning-by-declaring-arch_cpu_idle-as-noin.patch
new file mode 100644 (file)
index 0000000..c22de61
--- /dev/null
@@ -0,0 +1,70 @@
+From 2bae967fb73002747e12996c3bcf8e5f4dc2beba Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Mar 2024 21:30:16 +0100
+Subject: riscv: Fix warning by declaring arch_cpu_idle() as noinstr
+
+From: Alexandre Ghiti <alexghiti@rivosinc.com>
+
+[ Upstream commit 8a48ea87ce89fb701624f4b9e82556c81f30c7dc ]
+
+The following warning appears when using ftrace:
+
+[89855.443413] RCU not on for: arch_cpu_idle+0x0/0x1c
+[89855.445640] WARNING: CPU: 5 PID: 0 at include/linux/trace_recursion.h:162 arch_ftrace_ops_list_func+0x208/0x228
+[89855.445824] Modules linked in: xt_conntrack(E) nft_chain_nat(E) xt_MASQUERADE(E) nf_conntrack_netlink(E) xt_addrtype(E) nft_compat(E) nf_tables(E) nfnetlink(E) br_netfilter(E) cfg80211(E) nls_iso8859_1(E) ofpart(E) redboot(E) cmdlinepart(E) cfi_cmdset_0001(E) virtio_net(E) cfi_probe(E) cfi_util(E) 9pnet_virtio(E) gen_probe(E) net_failover(E) virtio_rng(E) failover(E) 9pnet(E) physmap(E) map_funcs(E) chipreg(E) mtd(E) uio_pdrv_genirq(E) uio(E) dm_multipath(E) scsi_dh_rdac(E) scsi_dh_emc(E) scsi_dh_alua(E) drm(E) efi_pstore(E) backlight(E) ip_tables(E) x_tables(E) raid10(E) raid456(E) async_raid6_recov(E) async_memcpy(E) async_pq(E) async_xor(E) xor(E) async_tx(E) raid6_pq(E) raid1(E) raid0(E) virtio_blk(E)
+[89855.451563] CPU: 5 PID: 0 Comm: swapper/5 Tainted: G            E      6.8.0-rc6ubuntu-defconfig #2
+[89855.451726] Hardware name: riscv-virtio,qemu (DT)
+[89855.451899] epc : arch_ftrace_ops_list_func+0x208/0x228
+[89855.452016]  ra : arch_ftrace_ops_list_func+0x208/0x228
+[89855.452119] epc : ffffffff8016b216 ra : ffffffff8016b216 sp : ffffaf808090fdb0
+[89855.452171]  gp : ffffffff827c7680 tp : ffffaf808089ad40 t0 : ffffffff800c0dd8
+[89855.452216]  t1 : 0000000000000001 t2 : 0000000000000000 s0 : ffffaf808090fe30
+[89855.452306]  s1 : 0000000000000000 a0 : 0000000000000026 a1 : ffffffff82cd6ac8
+[89855.452423]  a2 : ffffffff800458c8 a3 : ffffaf80b1870640 a4 : 0000000000000000
+[89855.452646]  a5 : 0000000000000000 a6 : 00000000ffffffff a7 : ffffffffffffffff
+[89855.452698]  s2 : ffffffff82766872 s3 : ffffffff80004caa s4 : ffffffff80ebea90
+[89855.452743]  s5 : ffffaf808089bd40 s6 : 8000000a00006e00 s7 : 0000000000000008
+[89855.452787]  s8 : 0000000000002000 s9 : 0000000080043700 s10: 0000000000000000
+[89855.452831]  s11: 0000000000000000 t3 : 0000000000100000 t4 : 0000000000000064
+[89855.452874]  t5 : 000000000000000c t6 : ffffaf80b182dbfc
+[89855.452929] status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003
+[89855.453053] [<ffffffff8016b216>] arch_ftrace_ops_list_func+0x208/0x228
+[89855.453191] [<ffffffff8000e082>] ftrace_call+0x8/0x22
+[89855.453265] [<ffffffff800a149c>] do_idle+0x24c/0x2ca
+[89855.453357] [<ffffffff8000da54>] return_to_handler+0x0/0x26
+[89855.453429] [<ffffffff8000b716>] smp_callin+0x92/0xb6
+[89855.453785] ---[ end trace 0000000000000000 ]---
+
+To fix this, mark arch_cpu_idle() as noinstr, like it is done in commit
+a9cbc1b471d2 ("s390/idle: mark arch_cpu_idle() noinstr").
+
+Reported-by: Evgenii Shatokhin <e.shatokhin@yadro.com>
+Closes: https://lore.kernel.org/linux-riscv/51f21b87-ebed-4411-afbc-c00d3dea2bab@yadro.com/
+Fixes: cfbc4f81c9d0 ("riscv: Select ARCH_WANTS_NO_INSTR")
+Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
+Reviewed-by: Andy Chiu <andy.chiu@sifive.com>
+Tested-by: Andy Chiu <andy.chiu@sifive.com>
+Acked-by: Puranjay Mohan <puranjay12@gmail.com>
+Link: https://lore.kernel.org/r/20240326203017.310422-2-alexghiti@rivosinc.com
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/riscv/kernel/process.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c
+index 92922dbd5b5c1..6abeecbfc51d0 100644
+--- a/arch/riscv/kernel/process.c
++++ b/arch/riscv/kernel/process.c
+@@ -37,7 +37,7 @@ EXPORT_SYMBOL(__stack_chk_guard);
+ extern asmlinkage void ret_from_fork(void);
+-void arch_cpu_idle(void)
++void noinstr arch_cpu_idle(void)
+ {
+       cpu_do_idle();
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.8/riscv-hwprobe-do-not-produce-frtace-relocation.patch b/queue-6.8/riscv-hwprobe-do-not-produce-frtace-relocation.patch
new file mode 100644 (file)
index 0000000..6328c4d
--- /dev/null
@@ -0,0 +1,73 @@
+From f0cb64532dc375910c53c762ed1ced93a5094bd8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Mar 2024 10:35:46 +0300
+Subject: riscv: hwprobe: do not produce frtace relocation
+
+From: Vladimir Isaev <vladimir.isaev@syntacore.com>
+
+[ Upstream commit ad14f7ca9f0d9fdf73d1fd61aaf8248d46ffc849 ]
+
+Such relocation causes crash of android linker similar to one
+described in commit e05d57dcb8c7
+("riscv: Fixup __vdso_gettimeofday broke dynamic ftrace").
+
+Looks like this relocation is added by CONFIG_DYNAMIC_FTRACE which is
+disabled in the default android kernel.
+
+Before:
+
+readelf -rW arch/riscv/kernel/vdso/vdso.so:
+
+Relocation section '.rela.dyn' at offset 0xd00 contains 1 entry:
+    Offset             Info             Type
+0000000000000d20  0000000000000003 R_RISCV_RELATIVE
+
+objdump:
+0000000000000c86 <__vdso_riscv_hwprobe@@LINUX_4.15>:
+ c86:   0001                    nop
+ c88:   0001                    nop
+ c8a:   0001                    nop
+ c8c:   0001                    nop
+ c8e:   e211                    bnez    a2,c92 <__vdso_riscv_hwprobe...
+
+After:
+readelf -rW arch/riscv/kernel/vdso/vdso.so:
+
+There are no relocations in this file.
+
+objdump:
+0000000000000c86 <__vdso_riscv_hwprobe@@LINUX_4.15>:
+ c86:   e211                    bnez    a2,c8a <__vdso_riscv_hwprobe...
+ c88:   c6b9                    beqz    a3,cd6 <__vdso_riscv_hwprobe...
+ c8a:   e739                    bnez    a4,cd8 <__vdso_riscv_hwprobe...
+ c8c:   ffffd797                auipc   a5,0xffffd
+
+Also disable SCS since it also should not be available in vdso.
+
+Fixes: aa5af0aa90ba ("RISC-V: Add hwprobe vDSO function and data")
+Signed-off-by: Roman Artemev <roman.artemev@syntacore.com>
+Signed-off-by: Vladimir Isaev <vladimir.isaev@syntacore.com>
+Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
+Reviewed-by: Guo Ren <guoren@kernel.org>
+Link: https://lore.kernel.org/r/20240313085843.17661-1-vladimir.isaev@syntacore.com
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/riscv/kernel/vdso/Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
+index 9b517fe1b8a8e..272c431ac5b9f 100644
+--- a/arch/riscv/kernel/vdso/Makefile
++++ b/arch/riscv/kernel/vdso/Makefile
+@@ -37,6 +37,7 @@ endif
+ # Disable -pg to prevent insert call site
+ CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS)
++CFLAGS_REMOVE_hwprobe.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS)
+ # Disable profiling and instrumentation for VDSO code
+ GCOV_PROFILE := n
+-- 
+2.43.0
+
diff --git a/queue-6.8/riscv-mm-fix-prototype-to-avoid-discarding-const.patch b/queue-6.8/riscv-mm-fix-prototype-to-avoid-discarding-const.patch
new file mode 100644 (file)
index 0000000..4225f10
--- /dev/null
@@ -0,0 +1,49 @@
+From a95b9c7c5f9e26d5da6f331bdd0951931addc81b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 1 Mar 2024 12:18:32 -0800
+Subject: riscv: mm: Fix prototype to avoid discarding const
+
+From: Samuel Holland <samuel.holland@sifive.com>
+
+[ Upstream commit 674bc0168e6b68070c75df22e97ab63b6eb60d89 ]
+
+__flush_tlb_range() does not modify the provided cpumask, so its cmask
+parameter can be pointer-to-const. This avoids the unsafe cast of
+cpu_online_mask.
+
+Fixes: 54d7431af73e ("riscv: Add support for BATCHED_UNMAP_TLB_FLUSH")
+Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
+Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
+Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
+Link: https://lore.kernel.org/r/20240301201837.2826172-1-samuel.holland@sifive.com
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/riscv/mm/tlbflush.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/riscv/mm/tlbflush.c b/arch/riscv/mm/tlbflush.c
+index 893566e004b73..07d743f87b3f6 100644
+--- a/arch/riscv/mm/tlbflush.c
++++ b/arch/riscv/mm/tlbflush.c
+@@ -99,7 +99,7 @@ static void __ipi_flush_tlb_range_asid(void *info)
+       local_flush_tlb_range_asid(d->start, d->size, d->stride, d->asid);
+ }
+-static void __flush_tlb_range(struct cpumask *cmask, unsigned long asid,
++static void __flush_tlb_range(const struct cpumask *cmask, unsigned long asid,
+                             unsigned long start, unsigned long size,
+                             unsigned long stride)
+ {
+@@ -200,7 +200,7 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
+ void flush_tlb_kernel_range(unsigned long start, unsigned long end)
+ {
+-      __flush_tlb_range((struct cpumask *)cpu_online_mask, FLUSH_TLB_NO_ASID,
++      __flush_tlb_range(cpu_online_mask, FLUSH_TLB_NO_ASID,
+                         start, end - start, PAGE_SIZE);
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.8/riscv-use-kern_info-in-do_trap.patch b/queue-6.8/riscv-use-kern_info-in-do_trap.patch
new file mode 100644 (file)
index 0000000..f4dde3d
--- /dev/null
@@ -0,0 +1,40 @@
+From 7ce75da8008b6630f0fcd7aa29fed1b44989e523 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Mar 2024 16:40:05 +0100
+Subject: riscv: use KERN_INFO in do_trap
+
+From: Andreas Schwab <schwab@suse.de>
+
+[ Upstream commit dd33e5dc7247041b565014f66286c9566b0e32b6 ]
+
+Print the instruction dump with info instead of emergency level.  The
+unhandled signal message is only for informational purpose.
+
+Fixes: b8a03a634129 ("riscv: add userland instruction dump to RISC-V splats")
+Signed-off-by: Andreas Schwab <schwab@suse.de>
+Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
+Reviewed-by: Atish Patra <atishp@rivosinc.com>
+Reviewed-by: Yunhui Cui <cuiyunhui@bytedance.com>
+Link: https://lore.kernel.org/r/mvmy1aegrhm.fsf@suse.de
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/riscv/kernel/traps.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
+index a1b9be3c4332d..142f5f5168fb1 100644
+--- a/arch/riscv/kernel/traps.c
++++ b/arch/riscv/kernel/traps.c
+@@ -121,7 +121,7 @@ void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr)
+               print_vma_addr(KERN_CONT " in ", instruction_pointer(regs));
+               pr_cont("\n");
+               __show_regs(regs);
+-              dump_instr(KERN_EMERG, regs);
++              dump_instr(KERN_INFO, regs);
+       }
+       force_sig_fault(signo, code, (void __user *)addr);
+-- 
+2.43.0
+
diff --git a/queue-6.8/s390-pai-fix-sampling-event-removal-for-pmu-device-d.patch b/queue-6.8/s390-pai-fix-sampling-event-removal-for-pmu-device-d.patch
new file mode 100644 (file)
index 0000000..6a05505
--- /dev/null
@@ -0,0 +1,90 @@
+From e7aab084340b2ad27d995db33f5782f8d1dba189 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 29 Feb 2024 15:00:28 +0100
+Subject: s390/pai: fix sampling event removal for PMU device driver
+
+From: Thomas Richter <tmricht@linux.ibm.com>
+
+[ Upstream commit e9f3af02f63909f41b43c28330434cc437639c5c ]
+
+In case of a sampling event, the PAI PMU device drivers need a
+reference to this event.  Currently to PMU device driver reference
+is removed when a sampling event is destroyed. This may lead to
+situations where the reference of the PMU device driver is removed
+while being used by a different sampling event.
+Reset the event reference pointer of the PMU device driver when
+a sampling event is deleted and before the next one might be added.
+
+Fixes: 39d62336f5c1 ("s390/pai: add support for cryptography counters")
+Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
+Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
+Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/s390/kernel/perf_pai_crypto.c | 10 +++++++---
+ arch/s390/kernel/perf_pai_ext.c    | 10 +++++++---
+ 2 files changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c
+index 522a5ea0a9f49..335e3f5d71f74 100644
+--- a/arch/s390/kernel/perf_pai_crypto.c
++++ b/arch/s390/kernel/perf_pai_crypto.c
+@@ -90,7 +90,6 @@ static void paicrypt_event_destroy(struct perf_event *event)
+                                                event->cpu);
+       struct paicrypt_map *cpump = mp->mapptr;
+-      cpump->event = NULL;
+       static_branch_dec(&pai_key);
+       mutex_lock(&pai_reserve_mutex);
+       debug_sprintf_event(cfm_dbg, 5, "%s event %#llx cpu %d users %d"
+@@ -348,10 +347,15 @@ static int paicrypt_add(struct perf_event *event, int flags)
+ static void paicrypt_stop(struct perf_event *event, int flags)
+ {
+-      if (!event->attr.sample_period) /* Counting */
++      struct paicrypt_mapptr *mp = this_cpu_ptr(paicrypt_root.mapptr);
++      struct paicrypt_map *cpump = mp->mapptr;
++
++      if (!event->attr.sample_period) {       /* Counting */
+               paicrypt_read(event);
+-      else                            /* Sampling */
++      } else {                                /* Sampling */
+               perf_sched_cb_dec(event->pmu);
++              cpump->event = NULL;
++      }
+       event->hw.state = PERF_HES_STOPPED;
+ }
+diff --git a/arch/s390/kernel/perf_pai_ext.c b/arch/s390/kernel/perf_pai_ext.c
+index 95d1a890640a3..db37c38ddcee4 100644
+--- a/arch/s390/kernel/perf_pai_ext.c
++++ b/arch/s390/kernel/perf_pai_ext.c
+@@ -121,7 +121,6 @@ static void paiext_event_destroy(struct perf_event *event)
+       struct paiext_map *cpump = mp->mapptr;
+       mutex_lock(&paiext_reserve_mutex);
+-      cpump->event = NULL;
+       if (refcount_dec_and_test(&cpump->refcnt))      /* Last reference gone */
+               paiext_free(mp);
+       paiext_root_free();
+@@ -355,10 +354,15 @@ static int paiext_add(struct perf_event *event, int flags)
+ static void paiext_stop(struct perf_event *event, int flags)
+ {
+-      if (!event->attr.sample_period) /* Counting */
++      struct paiext_mapptr *mp = this_cpu_ptr(paiext_root.mapptr);
++      struct paiext_map *cpump = mp->mapptr;
++
++      if (!event->attr.sample_period) {       /* Counting */
+               paiext_read(event);
+-      else                            /* Sampling */
++      } else {                                /* Sampling */
+               perf_sched_cb_dec(event->pmu);
++              cpump->event = NULL;
++      }
+       event->hw.state = PERF_HES_STOPPED;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.8/scsi-mylex-fix-sysfs-buffer-lengths.patch b/queue-6.8/scsi-mylex-fix-sysfs-buffer-lengths.patch
new file mode 100644 (file)
index 0000000..f939554
--- /dev/null
@@ -0,0 +1,189 @@
+From 708a205b08af8c29be9f88bb82fdb4b4a34b078f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Mar 2024 23:38:06 +0100
+Subject: scsi: mylex: Fix sysfs buffer lengths
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 1197c5b2099f716b3de327437fb50900a0b936c9 ]
+
+The myrb and myrs drivers use an odd way of implementing their sysfs files,
+calling snprintf() with a fixed length of 32 bytes to print into a page
+sized buffer. One of the strings is actually longer than 32 bytes, which
+clang can warn about:
+
+drivers/scsi/myrb.c:1906:10: error: 'snprintf' will always be truncated; specified size is 32, but format string expands to at least 34 [-Werror,-Wformat-truncation]
+drivers/scsi/myrs.c:1089:10: error: 'snprintf' will always be truncated; specified size is 32, but format string expands to at least 34 [-Werror,-Wformat-truncation]
+
+These could all be plain sprintf() without a length as the buffer is always
+long enough. On the other hand, sysfs files should not be overly long
+either, so just double the length to make sure the longest strings don't
+get truncated here.
+
+Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)")
+Fixes: 081ff398c56c ("scsi: myrb: Add Mylex RAID controller (block interface)")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Link: https://lore.kernel.org/r/20240326223825.4084412-8-arnd@kernel.org
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/myrb.c | 20 ++++++++++----------
+ drivers/scsi/myrs.c | 24 ++++++++++++------------
+ 2 files changed, 22 insertions(+), 22 deletions(-)
+
+diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
+index ca2e932dd9b70..f684eb5e04898 100644
+--- a/drivers/scsi/myrb.c
++++ b/drivers/scsi/myrb.c
+@@ -1775,9 +1775,9 @@ static ssize_t raid_state_show(struct device *dev,
+               name = myrb_devstate_name(ldev_info->state);
+               if (name)
+-                      ret = snprintf(buf, 32, "%s\n", name);
++                      ret = snprintf(buf, 64, "%s\n", name);
+               else
+-                      ret = snprintf(buf, 32, "Invalid (%02X)\n",
++                      ret = snprintf(buf, 64, "Invalid (%02X)\n",
+                                      ldev_info->state);
+       } else {
+               struct myrb_pdev_state *pdev_info = sdev->hostdata;
+@@ -1796,9 +1796,9 @@ static ssize_t raid_state_show(struct device *dev,
+               else
+                       name = myrb_devstate_name(pdev_info->state);
+               if (name)
+-                      ret = snprintf(buf, 32, "%s\n", name);
++                      ret = snprintf(buf, 64, "%s\n", name);
+               else
+-                      ret = snprintf(buf, 32, "Invalid (%02X)\n",
++                      ret = snprintf(buf, 64, "Invalid (%02X)\n",
+                                      pdev_info->state);
+       }
+       return ret;
+@@ -1886,11 +1886,11 @@ static ssize_t raid_level_show(struct device *dev,
+               name = myrb_raidlevel_name(ldev_info->raid_level);
+               if (!name)
+-                      return snprintf(buf, 32, "Invalid (%02X)\n",
++                      return snprintf(buf, 64, "Invalid (%02X)\n",
+                                       ldev_info->state);
+-              return snprintf(buf, 32, "%s\n", name);
++              return snprintf(buf, 64, "%s\n", name);
+       }
+-      return snprintf(buf, 32, "Physical Drive\n");
++      return snprintf(buf, 64, "Physical Drive\n");
+ }
+ static DEVICE_ATTR_RO(raid_level);
+@@ -1903,15 +1903,15 @@ static ssize_t rebuild_show(struct device *dev,
+       unsigned char status;
+       if (sdev->channel < myrb_logical_channel(sdev->host))
+-              return snprintf(buf, 32, "physical device - not rebuilding\n");
++              return snprintf(buf, 64, "physical device - not rebuilding\n");
+       status = myrb_get_rbld_progress(cb, &rbld_buf);
+       if (rbld_buf.ldev_num != sdev->id ||
+           status != MYRB_STATUS_SUCCESS)
+-              return snprintf(buf, 32, "not rebuilding\n");
++              return snprintf(buf, 64, "not rebuilding\n");
+-      return snprintf(buf, 32, "rebuilding block %u of %u\n",
++      return snprintf(buf, 64, "rebuilding block %u of %u\n",
+                       rbld_buf.ldev_size - rbld_buf.blocks_left,
+                       rbld_buf.ldev_size);
+ }
+diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
+index a1eec65a9713f..e824be9d9bbb9 100644
+--- a/drivers/scsi/myrs.c
++++ b/drivers/scsi/myrs.c
+@@ -947,9 +947,9 @@ static ssize_t raid_state_show(struct device *dev,
+               name = myrs_devstate_name(ldev_info->dev_state);
+               if (name)
+-                      ret = snprintf(buf, 32, "%s\n", name);
++                      ret = snprintf(buf, 64, "%s\n", name);
+               else
+-                      ret = snprintf(buf, 32, "Invalid (%02X)\n",
++                      ret = snprintf(buf, 64, "Invalid (%02X)\n",
+                                      ldev_info->dev_state);
+       } else {
+               struct myrs_pdev_info *pdev_info;
+@@ -958,9 +958,9 @@ static ssize_t raid_state_show(struct device *dev,
+               pdev_info = sdev->hostdata;
+               name = myrs_devstate_name(pdev_info->dev_state);
+               if (name)
+-                      ret = snprintf(buf, 32, "%s\n", name);
++                      ret = snprintf(buf, 64, "%s\n", name);
+               else
+-                      ret = snprintf(buf, 32, "Invalid (%02X)\n",
++                      ret = snprintf(buf, 64, "Invalid (%02X)\n",
+                                      pdev_info->dev_state);
+       }
+       return ret;
+@@ -1066,13 +1066,13 @@ static ssize_t raid_level_show(struct device *dev,
+               ldev_info = sdev->hostdata;
+               name = myrs_raid_level_name(ldev_info->raid_level);
+               if (!name)
+-                      return snprintf(buf, 32, "Invalid (%02X)\n",
++                      return snprintf(buf, 64, "Invalid (%02X)\n",
+                                       ldev_info->dev_state);
+       } else
+               name = myrs_raid_level_name(MYRS_RAID_PHYSICAL);
+-      return snprintf(buf, 32, "%s\n", name);
++      return snprintf(buf, 64, "%s\n", name);
+ }
+ static DEVICE_ATTR_RO(raid_level);
+@@ -1086,7 +1086,7 @@ static ssize_t rebuild_show(struct device *dev,
+       unsigned char status;
+       if (sdev->channel < cs->ctlr_info->physchan_present)
+-              return snprintf(buf, 32, "physical device - not rebuilding\n");
++              return snprintf(buf, 64, "physical device - not rebuilding\n");
+       ldev_info = sdev->hostdata;
+       ldev_num = ldev_info->ldev_num;
+@@ -1098,11 +1098,11 @@ static ssize_t rebuild_show(struct device *dev,
+               return -EIO;
+       }
+       if (ldev_info->rbld_active) {
+-              return snprintf(buf, 32, "rebuilding block %zu of %zu\n",
++              return snprintf(buf, 64, "rebuilding block %zu of %zu\n",
+                               (size_t)ldev_info->rbld_lba,
+                               (size_t)ldev_info->cfg_devsize);
+       } else
+-              return snprintf(buf, 32, "not rebuilding\n");
++              return snprintf(buf, 64, "not rebuilding\n");
+ }
+ static ssize_t rebuild_store(struct device *dev,
+@@ -1190,7 +1190,7 @@ static ssize_t consistency_check_show(struct device *dev,
+       unsigned short ldev_num;
+       if (sdev->channel < cs->ctlr_info->physchan_present)
+-              return snprintf(buf, 32, "physical device - not checking\n");
++              return snprintf(buf, 64, "physical device - not checking\n");
+       ldev_info = sdev->hostdata;
+       if (!ldev_info)
+@@ -1198,11 +1198,11 @@ static ssize_t consistency_check_show(struct device *dev,
+       ldev_num = ldev_info->ldev_num;
+       myrs_get_ldev_info(cs, ldev_num, ldev_info);
+       if (ldev_info->cc_active)
+-              return snprintf(buf, 32, "checking block %zu of %zu\n",
++              return snprintf(buf, 64, "checking block %zu of %zu\n",
+                               (size_t)ldev_info->cc_lba,
+                               (size_t)ldev_info->cfg_devsize);
+       else
+-              return snprintf(buf, 32, "not checking\n");
++              return snprintf(buf, 64, "not checking\n");
+ }
+ static ssize_t consistency_check_store(struct device *dev,
+-- 
+2.43.0
+
diff --git a/queue-6.8/scsi-sd-unregister-device-if-device_add_disk-failed-.patch b/queue-6.8/scsi-sd-unregister-device-if-device_add_disk-failed-.patch
new file mode 100644 (file)
index 0000000..3652db8
--- /dev/null
@@ -0,0 +1,43 @@
+From 0c9a43a52931f8460e098912e7b8427927783122 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 8 Dec 2023 16:23:35 +0800
+Subject: scsi: sd: Unregister device if device_add_disk() failed in sd_probe()
+
+From: Li Nan <linan122@huawei.com>
+
+[ Upstream commit 0296bea01cfa6526be6bd2d16dc83b4e7f1af91f ]
+
+"if device_add() succeeds, you should call device_del() when you want to
+get rid of it."
+
+In sd_probe(), device_add_disk() fails when device_add() has already
+succeeded, so change put_device() to device_unregister() to ensure device
+resources are released.
+
+Fixes: 2a7a891f4c40 ("scsi: sd: Add error handling support for add_disk()")
+Signed-off-by: Li Nan <linan122@huawei.com>
+Link: https://lore.kernel.org/r/20231208082335.1754205-1-linan666@huaweicloud.com
+Reviewed-by: Bart Van Assche <bvanassche@acm.org>
+Reviewed-by: Yu Kuai <yukuai3@huawei.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/sd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
+index d5d3eea006c13..35200a7a73553 100644
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -3757,7 +3757,7 @@ static int sd_probe(struct device *dev)
+       error = device_add_disk(dev, gd, NULL);
+       if (error) {
+-              put_device(&sdkp->disk_dev);
++              device_unregister(&sdkp->disk_dev);
+               put_disk(gd);
+               goto out;
+       }
+-- 
+2.43.0
+
index d7b3f5021073f217a4189fa6dd388869a02ddaea..c91ecc722c05b00a0fabdda4ac4a45b3a7720e79 100644 (file)
@@ -144,3 +144,54 @@ kvm-svm-add-support-for-allowing-zero-sev-asids.patch
 selftests-mptcp-connect-fix-shellcheck-warnings.patch
 selftests-mptcp-use-operator-to-append-strings.patch
 mptcp-don-t-account-accept-of-non-mpc-client-as-fall.patch
+9p-fix-read-write-debug-statements-to-report-server-.patch
+asoc-wm_adsp-fix-missing-mutex_lock-in-wm_adsp_write.patch
+asoc-cs42l43-correct-extraction-of-data-pointer-in-s.patch
+riscv-mm-fix-prototype-to-avoid-discarding-const.patch
+riscv-hwprobe-do-not-produce-frtace-relocation.patch
+drivers-perf-riscv-disable-perf_sample_branch_-while.patch
+block-count-blk_open_restrict_writes-openers.patch
+risc-v-update-at_vector_size_arch-for-new-at_minsigs.patch
+asoc-amd-acp-fix-for-acp-pdm-configuration-check.patch
+regmap-maple-fix-cache-corruption-in-regcache_maple_.patch
+alsa-hda-cs35l56-add-acpi-device-match-tables.patch
+drm-panfrost-fix-power-transition-timeout-warnings.patch
+nouveau-uvmm-fix-addr-range-calcs-for-remap-operatio.patch
+drm-prime-unbreak-virtgpu-dma-buf-export.patch
+asoc-rt5682-sdw-fix-locking-sequence.patch
+asoc-rt711-sdca-fix-locking-sequence.patch
+asoc-rt711-sdw-fix-locking-sequence.patch
+asoc-rt712-sdca-sdw-fix-locking-sequence.patch
+asoc-rt722-sdca-sdw-fix-locking-sequence.patch
+asoc-ops-fix-wraparound-for-mask-in-snd_soc_get_vols.patch
+asoc-tas2781-mark-dvc_tlv-with-__maybe_unused.patch
+spi-s3c64xx-extract-fifo-depth-calculation-to-a-dedi.patch
+spi-s3c64xx-sort-headers-alphabetically.patch
+spi-s3c64xx-explicitly-include-linux-bits.h.patch
+spi-s3c64xx-remove-else-after-return.patch
+spi-s3c64xx-define-a-magic-value.patch
+spi-s3c64xx-allow-full-fifo-masks.patch
+spi-s3c64xx-determine-the-fifo-depth-only-once.patch
+spi-s3c64xx-use-dma-mode-from-fifo-size.patch
+asoc-amd-acp-fix-for-acp_init-function-error-handlin.patch
+regmap-maple-fix-uninitialized-symbol-ret-warnings.patch
+ata-sata_sx4-fix-pdc20621_get_from_dimm-on-64-bit.patch
+scsi-mylex-fix-sysfs-buffer-lengths.patch
+scsi-sd-unregister-device-if-device_add_disk-failed-.patch
+revert-alsa-emu10k1-fix-synthesizer-sample-playback-.patch
+drm-i915-dp-fix-dsc-state-hw-readout-for-sst-connect.patch
+cifs-fix-caching-to-try-to-do-open-o_wronly-as-rdwr-.patch
+spi-mchp-pci1xxx-fix-a-possible-null-pointer-derefer.patch
+s390-pai-fix-sampling-event-removal-for-pmu-device-d.patch
+thermal-gov_power_allocator-allow-binding-without-co.patch
+thermal-gov_power_allocator-allow-binding-without-tr.patch
+drm-i915-gt-limit-the-reserved-vm-space-to-only-the-.patch
+ata-sata_mv-fix-pci-device-id-table-declaration-comp.patch
+asoc-sof-amd-fix-for-false-dsp-interrupts.patch
+sunrpc-fix-a-slow-server-side-memory-leak-with-rpc-o.patch
+riscv-use-kern_info-in-do_trap.patch
+riscv-fix-warning-by-declaring-arch_cpu_idle-as-noin.patch
+riscv-disable-preemption-when-using-patch_map.patch
+nfsd-hold-a-lighter-weight-client-reference-over-cb_.patch
+lib-stackdepot-move-stack_record-struct-definition-i.patch
+stackdepot-rename-pool_index-to-pool_index_plus_1.patch
diff --git a/queue-6.8/spi-mchp-pci1xxx-fix-a-possible-null-pointer-derefer.patch b/queue-6.8/spi-mchp-pci1xxx-fix-a-possible-null-pointer-derefer.patch
new file mode 100644 (file)
index 0000000..fa34634
--- /dev/null
@@ -0,0 +1,44 @@
+From 00eed173c8cac7ad3bdb6546969545a8368d2037 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Apr 2024 09:42:21 +0800
+Subject: spi: mchp-pci1xxx: Fix a possible null pointer dereference in
+ pci1xxx_spi_probe
+
+From: Huai-Yuan Liu <qq810974084@gmail.com>
+
+[ Upstream commit 1f886a7bfb3faf4c1021e73f045538008ce7634e ]
+
+In function pci1xxxx_spi_probe, there is a potential null pointer that
+may be caused by a failed memory allocation by the function devm_kzalloc.
+Hence, a null pointer check needs to be added to prevent null pointer
+dereferencing later in the code.
+
+To fix this issue, spi_bus->spi_int[iter] should be checked. The memory
+allocated by devm_kzalloc will be automatically released, so just directly
+return -ENOMEM without worrying about memory leaks.
+
+Fixes: 1cc0cbea7167 ("spi: microchip: pci1xxxx: Add driver for SPI controller of PCI1XXXX PCIe switch")
+Signed-off-by: Huai-Yuan Liu <qq810974084@gmail.com>
+Link: https://msgid.link/r/20240403014221.969801-1-qq810974084@gmail.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-pci1xxxx.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/spi/spi-pci1xxxx.c b/drivers/spi/spi-pci1xxxx.c
+index 5b2d3e4e21b7a..5a42266820522 100644
+--- a/drivers/spi/spi-pci1xxxx.c
++++ b/drivers/spi/spi-pci1xxxx.c
+@@ -275,6 +275,8 @@ static int pci1xxxx_spi_probe(struct pci_dev *pdev, const struct pci_device_id *
+               spi_bus->spi_int[iter] = devm_kzalloc(&pdev->dev,
+                                                     sizeof(struct pci1xxxx_spi_internal),
+                                                     GFP_KERNEL);
++              if (!spi_bus->spi_int[iter])
++                      return -ENOMEM;
+               spi_sub_ptr = spi_bus->spi_int[iter];
+               spi_sub_ptr->spi_host = devm_spi_alloc_host(dev, sizeof(struct spi_controller));
+               if (!spi_sub_ptr->spi_host)
+-- 
+2.43.0
+
diff --git a/queue-6.8/spi-s3c64xx-allow-full-fifo-masks.patch b/queue-6.8/spi-s3c64xx-allow-full-fifo-masks.patch
new file mode 100644 (file)
index 0000000..00cbbae
--- /dev/null
@@ -0,0 +1,152 @@
+From 12cfcf0adfb8ca7f0cdd7a523e2768cb1da53f95 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 16 Feb 2024 07:05:46 +0000
+Subject: spi: s3c64xx: allow full FIFO masks
+
+From: Tudor Ambarus <tudor.ambarus@linaro.org>
+
+[ Upstream commit d6911cf27e5c8491cbfedd4ae2d1ee74a3e685b4 ]
+
+The driver is wrong because is using partial register field masks for the
+SPI_STATUS.{RX, TX}_FIFO_LVL register fields.
+
+We see s3c64xx_spi_port_config.fifo_lvl_mask with different values for
+different instances of the same IP. Take s5pv210_spi_port_config for
+example, it defines:
+       .fifo_lvl_mask  = { 0x1ff, 0x7F },
+
+fifo_lvl_mask is used to determine the FIFO depth of the instance of the
+IP. In this case, the integrator uses a 256 bytes FIFO for the first SPI
+instance of the IP, and a 64 bytes FIFO for the second instance. While
+the first mask reflects the SPI_STATUS.{RX, TX}_FIFO_LVL register
+fields, the second one is two bits short. Using partial field masks is
+misleading and can hide problems of the driver's logic.
+
+Allow platforms to specify the full FIFO mask, regardless of the FIFO
+depth.
+
+Introduce {rx, tx}_fifomask to represent the SPI_STATUS.{RX, TX}_FIFO_LVL
+register fields. It's a shifted mask defining the field's length and
+position. We'll be able to deprecate the use of @rx_lvl_offset, as the
+shift value can be determined from the mask. The existing compatibles
+shall start using {rx, tx}_fifomask so that they use the full field mask
+and to avoid shifting the mask to position, and then shifting it back to
+zero in the {TX, RX}_FIFO_LVL macros.
+
+@rx_lvl_offset will be deprecated in a further patch, after we have the
+infrastructure to deprecate @fifo_lvl_mask as well.
+
+No functional change intended.
+
+Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
+Link: https://msgid.link/r/20240216070555.2483977-4-tudor.ambarus@linaro.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: a3d3eab627bb ("spi: s3c64xx: Use DMA mode from fifo size")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-s3c64xx.c | 40 +++++++++++++++++++++++++++++++++++----
+ 1 file changed, 36 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
+index 3da940e6299f0..688b8fad9e2fd 100644
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -3,6 +3,7 @@
+ // Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ //      Jaswinder Singh <jassi.brar@samsung.com>
++#include <linux/bitops.h>
+ #include <linux/bits.h>
+ #include <linux/clk.h>
+ #include <linux/delay.h>
+@@ -107,10 +108,10 @@
+ #define FIFO_LVL_MASK(i) ((i)->port_conf->fifo_lvl_mask[i->port_id])
+ #define S3C64XX_SPI_ST_TX_DONE(v, i) (((v) & \
+                               (1 << (i)->port_conf->tx_st_done)) ? 1 : 0)
+-#define TX_FIFO_LVL(v, i) (((v) >> S3C64XX_SPI_ST_TX_FIFO_LVL_SHIFT) &        \
+-                         FIFO_LVL_MASK(i))
+-#define RX_FIFO_LVL(v, i) (((v) >> (i)->port_conf->rx_lvl_offset) & \
+-                                      FIFO_LVL_MASK(i))
++#define TX_FIFO_LVL(v, sdd)   (((v) & (sdd)->tx_fifomask) >>          \
++                               __ffs((sdd)->tx_fifomask))
++#define RX_FIFO_LVL(v, sdd)   (((v) & (sdd)->rx_fifomask) >>          \
++                               __ffs((sdd)->rx_fifomask))
+ #define FIFO_DEPTH(i) ((FIFO_LVL_MASK(i) >> 1) + 1)
+ #define S3C64XX_SPI_MAX_TRAILCNT      0x3ff
+@@ -136,6 +137,10 @@ struct s3c64xx_spi_dma_data {
+  * struct s3c64xx_spi_port_config - SPI Controller hardware info
+  * @fifo_lvl_mask: Bit-mask for {TX|RX}_FIFO_LVL bits in SPI_STATUS register.
+  * @rx_lvl_offset: Bit offset of RX_FIFO_LVL bits in SPI_STATUS regiter.
++ * @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's
++ *               length and position.
++ * @tx_fifomask: SPI_STATUS.TX_FIFO_LVL mask. Shifted mask defining the field's
++ *               length and position.
+  * @tx_st_done: Bit offset of TX_DONE bit in SPI_STATUS regiter.
+  * @clk_div: Internal clock divider
+  * @quirks: Bitmask of known quirks
+@@ -153,6 +158,8 @@ struct s3c64xx_spi_dma_data {
+ struct s3c64xx_spi_port_config {
+       int     fifo_lvl_mask[MAX_SPI_PORTS];
+       int     rx_lvl_offset;
++      u32     rx_fifomask;
++      u32     tx_fifomask;
+       int     tx_st_done;
+       int     quirks;
+       int     clk_div;
+@@ -182,6 +189,10 @@ struct s3c64xx_spi_port_config {
+  * @tx_dma: Local transmit DMA data (e.g. chan and direction)
+  * @port_conf: Local SPI port configuartion data
+  * @port_id: Port identification number
++ * @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's
++ *               length and position.
++ * @tx_fifomask: SPI_STATUS.TX_FIFO_LVL mask. Shifted mask defining the field's
++ *               length and position.
+  */
+ struct s3c64xx_spi_driver_data {
+       void __iomem                    *regs;
+@@ -201,6 +212,8 @@ struct s3c64xx_spi_driver_data {
+       struct s3c64xx_spi_dma_data     tx_dma;
+       const struct s3c64xx_spi_port_config    *port_conf;
+       unsigned int                    port_id;
++      u32                             rx_fifomask;
++      u32                             tx_fifomask;
+ };
+ static void s3c64xx_flush_fifo(struct s3c64xx_spi_driver_data *sdd)
+@@ -1145,6 +1158,23 @@ static inline const struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
+       return (const struct s3c64xx_spi_port_config *)platform_get_device_id(pdev)->driver_data;
+ }
++static void s3c64xx_spi_set_fifomask(struct s3c64xx_spi_driver_data *sdd)
++{
++      const struct s3c64xx_spi_port_config *port_conf = sdd->port_conf;
++
++      if (port_conf->rx_fifomask)
++              sdd->rx_fifomask = port_conf->rx_fifomask;
++      else
++              sdd->rx_fifomask = FIFO_LVL_MASK(sdd) <<
++                      port_conf->rx_lvl_offset;
++
++      if (port_conf->tx_fifomask)
++              sdd->tx_fifomask = port_conf->tx_fifomask;
++      else
++              sdd->tx_fifomask = FIFO_LVL_MASK(sdd) <<
++                      S3C64XX_SPI_ST_TX_FIFO_LVL_SHIFT;
++}
++
+ static int s3c64xx_spi_probe(struct platform_device *pdev)
+ {
+       struct resource *mem_res;
+@@ -1190,6 +1220,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
+               sdd->port_id = pdev->id;
+       }
++      s3c64xx_spi_set_fifomask(sdd);
++
+       sdd->cur_bpw = 8;
+       sdd->tx_dma.direction = DMA_MEM_TO_DEV;
+-- 
+2.43.0
+
diff --git a/queue-6.8/spi-s3c64xx-define-a-magic-value.patch b/queue-6.8/spi-s3c64xx-define-a-magic-value.patch
new file mode 100644 (file)
index 0000000..6920584
--- /dev/null
@@ -0,0 +1,45 @@
+From ed1b0f71cda51ef776b5c7ab3ec76097ae8a90e5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 16 Feb 2024 07:05:45 +0000
+Subject: spi: s3c64xx: define a magic value
+
+From: Tudor Ambarus <tudor.ambarus@linaro.org>
+
+[ Upstream commit ff8faa8a5c0f4c2da797cd22a163ee3cc8823b13 ]
+
+Define a magic value, it will be used in the next patch as well.
+
+Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
+Link: https://msgid.link/r/20240216070555.2483977-3-tudor.ambarus@linaro.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: a3d3eab627bb ("spi: s3c64xx: Use DMA mode from fifo size")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-s3c64xx.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
+index 29e99410c9716..3da940e6299f0 100644
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -76,6 +76,7 @@
+ #define S3C64XX_SPI_INT_RX_FIFORDY_EN         (1<<1)
+ #define S3C64XX_SPI_INT_TX_FIFORDY_EN         (1<<0)
++#define S3C64XX_SPI_ST_TX_FIFO_LVL_SHIFT      6
+ #define S3C64XX_SPI_ST_RX_OVERRUN_ERR         (1<<5)
+ #define S3C64XX_SPI_ST_RX_UNDERRUN_ERR                (1<<4)
+ #define S3C64XX_SPI_ST_TX_OVERRUN_ERR         (1<<3)
+@@ -106,7 +107,8 @@
+ #define FIFO_LVL_MASK(i) ((i)->port_conf->fifo_lvl_mask[i->port_id])
+ #define S3C64XX_SPI_ST_TX_DONE(v, i) (((v) & \
+                               (1 << (i)->port_conf->tx_st_done)) ? 1 : 0)
+-#define TX_FIFO_LVL(v, i) (((v) >> 6) & FIFO_LVL_MASK(i))
++#define TX_FIFO_LVL(v, i) (((v) >> S3C64XX_SPI_ST_TX_FIFO_LVL_SHIFT) &        \
++                         FIFO_LVL_MASK(i))
+ #define RX_FIFO_LVL(v, i) (((v) >> (i)->port_conf->rx_lvl_offset) & \
+                                       FIFO_LVL_MASK(i))
+ #define FIFO_DEPTH(i) ((FIFO_LVL_MASK(i) >> 1) + 1)
+-- 
+2.43.0
+
diff --git a/queue-6.8/spi-s3c64xx-determine-the-fifo-depth-only-once.patch b/queue-6.8/spi-s3c64xx-determine-the-fifo-depth-only-once.patch
new file mode 100644 (file)
index 0000000..72e3c58
--- /dev/null
@@ -0,0 +1,99 @@
+From 90897b9977e95f8b8372861744e88b82d49d66eb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 16 Feb 2024 07:05:47 +0000
+Subject: spi: s3c64xx: determine the fifo depth only once
+
+From: Tudor Ambarus <tudor.ambarus@linaro.org>
+
+[ Upstream commit c6e776ab6abdfce5a1edcde7a22c639e76499939 ]
+
+Determine the FIFO depth only once, at probe time.
+``sdd->fifo_depth`` can be set later on with the FIFO depth
+specified in the device tree.
+
+Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
+Link: https://msgid.link/r/20240216070555.2483977-5-tudor.ambarus@linaro.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: a3d3eab627bb ("spi: s3c64xx: Use DMA mode from fifo size")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-s3c64xx.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
+index 688b8fad9e2fd..e059fb9db1da1 100644
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -189,6 +189,7 @@ struct s3c64xx_spi_port_config {
+  * @tx_dma: Local transmit DMA data (e.g. chan and direction)
+  * @port_conf: Local SPI port configuartion data
+  * @port_id: Port identification number
++ * @fifo_depth: depth of the FIFO.
+  * @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's
+  *               length and position.
+  * @tx_fifomask: SPI_STATUS.TX_FIFO_LVL mask. Shifted mask defining the field's
+@@ -212,6 +213,7 @@ struct s3c64xx_spi_driver_data {
+       struct s3c64xx_spi_dma_data     tx_dma;
+       const struct s3c64xx_spi_port_config    *port_conf;
+       unsigned int                    port_id;
++      unsigned int                    fifo_depth;
+       u32                             rx_fifomask;
+       u32                             tx_fifomask;
+ };
+@@ -422,7 +424,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host,
+       struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
+       if (sdd->rx_dma.ch && sdd->tx_dma.ch)
+-              return xfer->len > FIFO_DEPTH(sdd);
++              return xfer->len > sdd->fifo_depth;
+       return false;
+ }
+@@ -509,7 +511,7 @@ static u32 s3c64xx_spi_wait_for_timeout(struct s3c64xx_spi_driver_data *sdd,
+       void __iomem *regs = sdd->regs;
+       unsigned long val = 1;
+       u32 status;
+-      u32 max_fifo = FIFO_DEPTH(sdd);
++      u32 max_fifo = sdd->fifo_depth;
+       if (timeout_ms)
+               val = msecs_to_loops(timeout_ms);
+@@ -616,7 +618,7 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd,
+        * For any size less than the fifo size the below code is
+        * executed atleast once.
+        */
+-      loops = xfer->len / FIFO_DEPTH(sdd);
++      loops = xfer->len / sdd->fifo_depth;
+       buf = xfer->rx_buf;
+       do {
+               /* wait for data to be received in the fifo */
+@@ -753,7 +755,7 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host,
+                                   struct spi_transfer *xfer)
+ {
+       struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
+-      const unsigned int fifo_len = FIFO_DEPTH(sdd);
++      const unsigned int fifo_len = sdd->fifo_depth;
+       const void *tx_buf = NULL;
+       void *rx_buf = NULL;
+       int target_len = 0, origin_len = 0;
+@@ -1220,6 +1222,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
+               sdd->port_id = pdev->id;
+       }
++      sdd->fifo_depth = FIFO_DEPTH(sdd);
++
+       s3c64xx_spi_set_fifomask(sdd);
+       sdd->cur_bpw = 8;
+@@ -1311,7 +1315,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
+       dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Targets attached\n",
+                                       sdd->port_id, host->num_chipselect);
+       dev_dbg(&pdev->dev, "\tIOmem=[%pR]\tFIFO %dbytes\n",
+-                                      mem_res, FIFO_DEPTH(sdd));
++              mem_res, sdd->fifo_depth);
+       pm_runtime_mark_last_busy(&pdev->dev);
+       pm_runtime_put_autosuspend(&pdev->dev);
+-- 
+2.43.0
+
diff --git a/queue-6.8/spi-s3c64xx-explicitly-include-linux-bits.h.patch b/queue-6.8/spi-s3c64xx-explicitly-include-linux-bits.h.patch
new file mode 100644 (file)
index 0000000..b9661b8
--- /dev/null
@@ -0,0 +1,42 @@
+From 75db944eb8790500f36e6c4cf8ef98f52b2ca007 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Feb 2024 12:04:17 +0000
+Subject: spi: s3c64xx: explicitly include <linux/bits.h>
+
+From: Tudor Ambarus <tudor.ambarus@linaro.org>
+
+[ Upstream commit 4568fa574fcef3811a8140702979f076ef0f5bc0 ]
+
+The driver uses GENMASK() but does not include <linux/bits.h>.
+
+It is good practice to directly include all headers used, it avoids
+implicit dependencies and spurious breakage if someone rearranges
+headers and causes the implicit include to vanish.
+
+Include the missing header.
+
+Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
+Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
+Link: https://lore.kernel.org/r/20240207120431.2766269-4-tudor.ambarus@linaro.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: a3d3eab627bb ("spi: s3c64xx: Use DMA mode from fifo size")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-s3c64xx.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
+index 26d389d95af92..1e519b1537e71 100644
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -3,6 +3,7 @@
+ // Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ //      Jaswinder Singh <jassi.brar@samsung.com>
++#include <linux/bits.h>
+ #include <linux/clk.h>
+ #include <linux/delay.h>
+ #include <linux/dma-mapping.h>
+-- 
+2.43.0
+
diff --git a/queue-6.8/spi-s3c64xx-extract-fifo-depth-calculation-to-a-dedi.patch b/queue-6.8/spi-s3c64xx-extract-fifo-depth-calculation-to-a-dedi.patch
new file mode 100644 (file)
index 0000000..536d2b2
--- /dev/null
@@ -0,0 +1,84 @@
+From c2036fcfa9ba4f364f6c477640b25ed1cf00c9bc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 20 Jan 2024 11:00:01 -0600
+Subject: spi: s3c64xx: Extract FIFO depth calculation to a dedicated macro
+
+From: Sam Protsenko <semen.protsenko@linaro.org>
+
+[ Upstream commit 460efee706c2b6a4daba62ec143fea29c2e7b358 ]
+
+Simplify the code by extracting all cases of FIFO depth calculation into
+a dedicated macro. No functional change.
+
+Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
+Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
+Link: https://msgid.link/r/20240120170001.3356-1-semen.protsenko@linaro.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: a3d3eab627bb ("spi: s3c64xx: Use DMA mode from fifo size")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-s3c64xx.c | 13 ++++++-------
+ 1 file changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
+index 0e48ffd499b9f..432ec60d35684 100644
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -109,6 +109,7 @@
+ #define TX_FIFO_LVL(v, i) (((v) >> 6) & FIFO_LVL_MASK(i))
+ #define RX_FIFO_LVL(v, i) (((v) >> (i)->port_conf->rx_lvl_offset) & \
+                                       FIFO_LVL_MASK(i))
++#define FIFO_DEPTH(i) ((FIFO_LVL_MASK(i) >> 1) + 1)
+ #define S3C64XX_SPI_MAX_TRAILCNT      0x3ff
+ #define S3C64XX_SPI_TRAILCNT_OFF      19
+@@ -406,7 +407,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host,
+       struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
+       if (sdd->rx_dma.ch && sdd->tx_dma.ch) {
+-              return xfer->len > (FIFO_LVL_MASK(sdd) >> 1) + 1;
++              return xfer->len > FIFO_DEPTH(sdd);
+       } else {
+               return false;
+       }
+@@ -495,9 +496,7 @@ static u32 s3c64xx_spi_wait_for_timeout(struct s3c64xx_spi_driver_data *sdd,
+       void __iomem *regs = sdd->regs;
+       unsigned long val = 1;
+       u32 status;
+-
+-      /* max fifo depth available */
+-      u32 max_fifo = (FIFO_LVL_MASK(sdd) >> 1) + 1;
++      u32 max_fifo = FIFO_DEPTH(sdd);
+       if (timeout_ms)
+               val = msecs_to_loops(timeout_ms);
+@@ -604,7 +603,7 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd,
+        * For any size less than the fifo size the below code is
+        * executed atleast once.
+        */
+-      loops = xfer->len / ((FIFO_LVL_MASK(sdd) >> 1) + 1);
++      loops = xfer->len / FIFO_DEPTH(sdd);
+       buf = xfer->rx_buf;
+       do {
+               /* wait for data to be received in the fifo */
+@@ -741,7 +740,7 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host,
+                                   struct spi_transfer *xfer)
+ {
+       struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
+-      const unsigned int fifo_len = (FIFO_LVL_MASK(sdd) >> 1) + 1;
++      const unsigned int fifo_len = FIFO_DEPTH(sdd);
+       const void *tx_buf = NULL;
+       void *rx_buf = NULL;
+       int target_len = 0, origin_len = 0;
+@@ -1280,7 +1279,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
+       dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Targets attached\n",
+                                       sdd->port_id, host->num_chipselect);
+       dev_dbg(&pdev->dev, "\tIOmem=[%pR]\tFIFO %dbytes\n",
+-                                      mem_res, (FIFO_LVL_MASK(sdd) >> 1) + 1);
++                                      mem_res, FIFO_DEPTH(sdd));
+       pm_runtime_mark_last_busy(&pdev->dev);
+       pm_runtime_put_autosuspend(&pdev->dev);
+-- 
+2.43.0
+
diff --git a/queue-6.8/spi-s3c64xx-remove-else-after-return.patch b/queue-6.8/spi-s3c64xx-remove-else-after-return.patch
new file mode 100644 (file)
index 0000000..17dc2ea
--- /dev/null
@@ -0,0 +1,44 @@
+From 6132055803a73aa38adb50126b5850089e139d68 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Feb 2024 12:04:22 +0000
+Subject: spi: s3c64xx: remove else after return
+
+From: Tudor Ambarus <tudor.ambarus@linaro.org>
+
+[ Upstream commit 9d47e411f4d636519a8d26587928d34cf52c0c1f ]
+
+Else case is not needed after a return, remove it.
+
+Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
+Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
+Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
+Link: https://lore.kernel.org/r/20240207120431.2766269-9-tudor.ambarus@linaro.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: a3d3eab627bb ("spi: s3c64xx: Use DMA mode from fifo size")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-s3c64xx.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
+index 1e519b1537e71..29e99410c9716 100644
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -406,12 +406,10 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host,
+ {
+       struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
+-      if (sdd->rx_dma.ch && sdd->tx_dma.ch) {
++      if (sdd->rx_dma.ch && sdd->tx_dma.ch)
+               return xfer->len > FIFO_DEPTH(sdd);
+-      } else {
+-              return false;
+-      }
++      return false;
+ }
+ static int s3c64xx_enable_datapath(struct s3c64xx_spi_driver_data *sdd,
+-- 
+2.43.0
+
diff --git a/queue-6.8/spi-s3c64xx-sort-headers-alphabetically.patch b/queue-6.8/spi-s3c64xx-sort-headers-alphabetically.patch
new file mode 100644 (file)
index 0000000..d00ace7
--- /dev/null
@@ -0,0 +1,56 @@
+From edbaca553832b531dd3c9a603c9ff1b7668f488e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Feb 2024 12:04:15 +0000
+Subject: spi: s3c64xx: sort headers alphabetically
+
+From: Tudor Ambarus <tudor.ambarus@linaro.org>
+
+[ Upstream commit a77ce80f63f06d7ae933c332ed77c79136fa69b0 ]
+
+Sorting headers alphabetically helps locating duplicates,
+and makes it easier to figure out where to insert new headers.
+
+Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
+Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
+Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
+Link: https://lore.kernel.org/r/20240207120431.2766269-2-tudor.ambarus@linaro.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: a3d3eab627bb ("spi: s3c64xx: Use DMA mode from fifo size")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-s3c64xx.c | 13 ++++++-------
+ 1 file changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
+index 432ec60d35684..26d389d95af92 100644
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -3,19 +3,18 @@
+ // Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ //      Jaswinder Singh <jassi.brar@samsung.com>
+-#include <linux/init.h>
+-#include <linux/module.h>
+-#include <linux/interrupt.h>
+-#include <linux/delay.h>
+ #include <linux/clk.h>
++#include <linux/delay.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/dmaengine.h>
++#include <linux/init.h>
++#include <linux/interrupt.h>
++#include <linux/module.h>
++#include <linux/of.h>
++#include <linux/platform_data/spi-s3c64xx.h>
+ #include <linux/platform_device.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/spi/spi.h>
+-#include <linux/of.h>
+-
+-#include <linux/platform_data/spi-s3c64xx.h>
+ #define MAX_SPI_PORTS         12
+ #define S3C64XX_SPI_QUIRK_CS_AUTO     (1 << 1)
+-- 
+2.43.0
+
diff --git a/queue-6.8/spi-s3c64xx-use-dma-mode-from-fifo-size.patch b/queue-6.8/spi-s3c64xx-use-dma-mode-from-fifo-size.patch
new file mode 100644 (file)
index 0000000..0da9640
--- /dev/null
@@ -0,0 +1,54 @@
+From 4b2314a1725f356859e31839661b3538ca4d49c1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Mar 2024 17:58:40 +0900
+Subject: spi: s3c64xx: Use DMA mode from fifo size
+
+From: Jaewon Kim <jaewon02.kim@samsung.com>
+
+[ Upstream commit a3d3eab627bbbb0cb175910cf8d0f7022628a642 ]
+
+If the SPI data size is smaller than FIFO, it operates in PIO mode,
+and if it is larger than FIFO size, it oerates in DMA mode.
+
+If the SPI data size is equal to fifo, it operates in PIO mode and it is
+separated to 2 transfers. To prevent it, it must operate in DMA mode
+from the case where the data size and the fifo size are the same.
+
+Fixes: 1ee806718d5e ("spi: s3c64xx: support interrupt based pio mode")
+Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
+Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
+Link: https://lore.kernel.org/r/20240329085840.65856-1-jaewon02.kim@samsung.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-s3c64xx.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
+index e059fb9db1da1..652eadbefe24c 100644
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -424,7 +424,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host,
+       struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
+       if (sdd->rx_dma.ch && sdd->tx_dma.ch)
+-              return xfer->len > sdd->fifo_depth;
++              return xfer->len >= sdd->fifo_depth;
+       return false;
+ }
+@@ -783,10 +783,9 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host,
+                       return status;
+       }
+-      if (!is_polling(sdd) && (xfer->len > fifo_len) &&
++      if (!is_polling(sdd) && xfer->len >= fifo_len &&
+           sdd->rx_dma.ch && sdd->tx_dma.ch) {
+               use_dma = 1;
+-
+       } else if (xfer->len >= fifo_len) {
+               tx_buf = xfer->tx_buf;
+               rx_buf = xfer->rx_buf;
+-- 
+2.43.0
+
diff --git a/queue-6.8/stackdepot-rename-pool_index-to-pool_index_plus_1.patch b/queue-6.8/stackdepot-rename-pool_index-to-pool_index_plus_1.patch
new file mode 100644 (file)
index 0000000..61654b3
--- /dev/null
@@ -0,0 +1,84 @@
+From fe18eade6069c037f928451bf5ec2fe8e781927a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Apr 2024 17:14:58 -0700
+Subject: stackdepot: rename pool_index to pool_index_plus_1
+
+From: Peter Collingbourne <pcc@google.com>
+
+[ Upstream commit a6c1d9cb9a68bfa4512248419c4f4d880d19fe90 ]
+
+Commit 3ee34eabac2a ("lib/stackdepot: fix first entry having a 0-handle")
+changed the meaning of the pool_index field to mean "the pool index plus
+1".  This made the code accessing this field less self-documenting, as
+well as causing debuggers such as drgn to not be able to easily remain
+compatible with both old and new kernels, because they typically do that
+by testing for presence of the new field.  Because stackdepot is a
+debugging tool, we should make sure that it is debugger friendly.
+Therefore, give the field a different name to improve readability as well
+as enabling debugger backwards compatibility.
+
+This is needed in 6.9, which would otherwise become an odd release with
+the new semantics and old name so debuggers wouldn't recognize the new
+semantics there.
+
+Fixes: 3ee34eabac2a ("lib/stackdepot: fix first entry having a 0-handle")
+Link: https://lkml.kernel.org/r/20240402001500.53533-1-pcc@google.com
+Link: https://linux-review.googlesource.com/id/Ib3e70c36c1d230dd0a118dc22649b33e768b9f88
+Signed-off-by: Peter Collingbourne <pcc@google.com>
+Acked-by: Vlastimil Babka <vbabka@suse.cz>
+Reviewed-by: Alexander Potapenko <glider@google.com>
+Acked-by: Marco Elver <elver@google.com>
+Acked-by: Oscar Salvador <osalvador@suse.de>
+Cc: Andrey Konovalov <andreyknvl@gmail.com>
+Cc: Michal Hocko <mhocko@suse.com>
+Cc: Omar Sandoval <osandov@fb.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/stackdepot.h | 7 +++----
+ lib/stackdepot.c           | 4 ++--
+ 2 files changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/include/linux/stackdepot.h b/include/linux/stackdepot.h
+index c4b5ad57c0660..bf0136891a0f2 100644
+--- a/include/linux/stackdepot.h
++++ b/include/linux/stackdepot.h
+@@ -44,10 +44,9 @@ typedef u32 depot_stack_handle_t;
+ union handle_parts {
+       depot_stack_handle_t handle;
+       struct {
+-              /* pool_index is offset by 1 */
+-              u32 pool_index  : DEPOT_POOL_INDEX_BITS;
+-              u32 offset      : DEPOT_OFFSET_BITS;
+-              u32 extra       : STACK_DEPOT_EXTRA_BITS;
++              u32 pool_index_plus_1   : DEPOT_POOL_INDEX_BITS;
++              u32 offset              : DEPOT_OFFSET_BITS;
++              u32 extra               : STACK_DEPOT_EXTRA_BITS;
+       };
+ };
+diff --git a/lib/stackdepot.c b/lib/stackdepot.c
+index ee4bbe6513aa4..ee830f14afb78 100644
+--- a/lib/stackdepot.c
++++ b/lib/stackdepot.c
+@@ -330,7 +330,7 @@ static struct stack_record *depot_pop_free_pool(void **prealloc, size_t size)
+       stack = current_pool + pool_offset;
+       /* Pre-initialize handle once. */
+-      stack->handle.pool_index = pool_index + 1;
++      stack->handle.pool_index_plus_1 = pool_index + 1;
+       stack->handle.offset = pool_offset >> DEPOT_STACK_ALIGN;
+       stack->handle.extra = 0;
+       INIT_LIST_HEAD(&stack->hash_list);
+@@ -441,7 +441,7 @@ static struct stack_record *depot_fetch_stack(depot_stack_handle_t handle)
+       const int pools_num_cached = READ_ONCE(pools_num);
+       union handle_parts parts = { .handle = handle };
+       void *pool;
+-      u32 pool_index = parts.pool_index - 1;
++      u32 pool_index = parts.pool_index_plus_1 - 1;
+       size_t offset = parts.offset << DEPOT_STACK_ALIGN;
+       struct stack_record *stack;
+-- 
+2.43.0
+
diff --git a/queue-6.8/sunrpc-fix-a-slow-server-side-memory-leak-with-rpc-o.patch b/queue-6.8/sunrpc-fix-a-slow-server-side-memory-leak-with-rpc-o.patch
new file mode 100644 (file)
index 0000000..e1bf733
--- /dev/null
@@ -0,0 +1,67 @@
+From 40f63d2568e5ab9c695f1dacce31b9e10149b8a5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Apr 2024 10:36:25 -0400
+Subject: SUNRPC: Fix a slow server-side memory leak with RPC-over-TCP
+
+From: Chuck Lever <chuck.lever@oracle.com>
+
+[ Upstream commit 05258a0a69b3c5d2c003f818702c0a52b6fea861 ]
+
+Jan Schunk reports that his small NFS servers suffer from memory
+exhaustion after just a few days. A bisect shows that commit
+e18e157bb5c8 ("SUNRPC: Send RPC message on TCP with a single
+sock_sendmsg() call") is the first bad commit.
+
+That commit assumed that sock_sendmsg() releases all the pages in
+the underlying bio_vec array, but the reality is that it doesn't.
+svc_xprt_release() releases the rqst's response pages, but the
+record marker page fragment isn't one of those, so it is never
+released.
+
+This is a narrow fix that can be applied to stable kernels. A
+more extensive fix is in the works.
+
+Reported-by: Jan Schunk <scpcom@gmx.de>
+Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218671
+Fixes: e18e157bb5c8 ("SUNRPC: Send RPC message on TCP with a single sock_sendmsg() call")
+Cc: Alexander Duyck <alexander.duyck@gmail.com>
+Cc: Jakub Kacinski <kuba@kernel.org>
+Cc: David Howells <dhowells@redhat.com>
+Reviewed-by: David Howells <dhowells@redhat.com>
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sunrpc/svcsock.c | 10 +---------
+ 1 file changed, 1 insertion(+), 9 deletions(-)
+
+diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
+index 545017a3daa4d..6b3f01beb294b 100644
+--- a/net/sunrpc/svcsock.c
++++ b/net/sunrpc/svcsock.c
+@@ -1206,15 +1206,6 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp)
+  * MSG_SPLICE_PAGES is used exclusively to reduce the number of
+  * copy operations in this path. Therefore the caller must ensure
+  * that the pages backing @xdr are unchanging.
+- *
+- * Note that the send is non-blocking. The caller has incremented
+- * the reference count on each page backing the RPC message, and
+- * the network layer will "put" these pages when transmission is
+- * complete.
+- *
+- * This is safe for our RPC services because the memory backing
+- * the head and tail components is never kmalloc'd. These always
+- * come from pages in the svc_rqst::rq_pages array.
+  */
+ static int svc_tcp_sendmsg(struct svc_sock *svsk, struct svc_rqst *rqstp,
+                          rpc_fraghdr marker, unsigned int *sentp)
+@@ -1244,6 +1235,7 @@ static int svc_tcp_sendmsg(struct svc_sock *svsk, struct svc_rqst *rqstp,
+       iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
+                     1 + count, sizeof(marker) + rqstp->rq_res.len);
+       ret = sock_sendmsg(svsk->sk_sock, &msg);
++      page_frag_free(buf);
+       if (ret < 0)
+               return ret;
+       *sentp += ret;
+-- 
+2.43.0
+
diff --git a/queue-6.8/thermal-gov_power_allocator-allow-binding-without-co.patch b/queue-6.8/thermal-gov_power_allocator-allow-binding-without-co.patch
new file mode 100644 (file)
index 0000000..5201c06
--- /dev/null
@@ -0,0 +1,46 @@
+From f64cc435ca3920c13db520358a06fcfc3717e834 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Apr 2024 16:31:40 +0500
+Subject: thermal: gov_power_allocator: Allow binding without cooling devices
+
+From: Nikita Travkin <nikita@trvn.ru>
+
+[ Upstream commit 1057c4c36ef8b236a2e28edef301da0801338c5f ]
+
+IPA was recently refactored to split out memory allocation into a
+separate funciton. That funciton was made to return -EINVAL if there is
+zero power_actors and thus no memory to allocate. This causes IPA to
+fail probing when the thermal zone has no attached cooling devices.
+
+Since cooling devices can attach after the thermal zone is created and
+the governer is attached to it, failing probe due to the lack of cooling
+devices is incorrect.
+
+Change the allocate_actors_buffer() to return success when there is no
+cooling devices present.
+
+Fixes: 912e97c67cc3 ("thermal: gov_power_allocator: Move memory allocation out of throttle()")
+Signed-off-by: Nikita Travkin <nikita@trvn.ru>
+Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/thermal/gov_power_allocator.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
+index 81e061f183ad1..207a6a3936b54 100644
+--- a/drivers/thermal/gov_power_allocator.c
++++ b/drivers/thermal/gov_power_allocator.c
+@@ -606,7 +606,7 @@ static int allocate_actors_buffer(struct power_allocator_params *params,
+       /* There might be no cooling devices yet. */
+       if (!num_actors) {
+-              ret = -EINVAL;
++              ret = 0;
+               goto clean_state;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.8/thermal-gov_power_allocator-allow-binding-without-tr.patch b/queue-6.8/thermal-gov_power_allocator-allow-binding-without-tr.patch
new file mode 100644 (file)
index 0000000..440aa6c
--- /dev/null
@@ -0,0 +1,67 @@
+From f796d9e785ac9b6165a85580effd02ac867242ac Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Apr 2024 16:31:41 +0500
+Subject: thermal: gov_power_allocator: Allow binding without trip points
+
+From: Nikita Travkin <nikita@trvn.ru>
+
+[ Upstream commit da781936e7c301e6197eb6513775748e79fb2575 ]
+
+IPA probe function was recently refactored to perform extra error checks
+and make sure the thermal zone has trip points necessary for the IPA
+operation. With this change, if a thermal zone is probed such that it
+has no trip points that IPA can use, IPA will fail and the TZ won't be
+created. This is the case if a platform defines a TZ without cooling
+devices and only with "hot"/"critical" trip points, often found on some
+Qualcomm devices [1].
+
+Documentation across IPA code (notably get_governor_trips() kerneldoc)
+suggests that IPA is supposed to handle such TZ even if it won't
+actually do anything.
+
+This commit partially reverts the previous change to allow IPA to bind
+to such "empty" thermal zones.
+
+Fixes: e83747c2f8e3 ("thermal: gov_power_allocator: Set up trip points earlier")
+Link: arch/arm64/boot/dts/qcom/sc7180.dtsi#n4776 # [1]
+Signed-off-by: Nikita Travkin <nikita@trvn.ru>
+Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/thermal/gov_power_allocator.c | 12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
+index 207a6a3936b54..38581583ad289 100644
+--- a/drivers/thermal/gov_power_allocator.c
++++ b/drivers/thermal/gov_power_allocator.c
+@@ -679,11 +679,6 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
+               return -ENOMEM;
+       get_governor_trips(tz, params);
+-      if (!params->trip_max) {
+-              dev_warn(&tz->device, "power_allocator: missing trip_max\n");
+-              kfree(params);
+-              return -EINVAL;
+-      }
+       ret = check_power_actors(tz, params);
+       if (ret < 0) {
+@@ -712,9 +707,10 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
+       if (!tz->tzp->sustainable_power)
+               dev_warn(&tz->device, "power_allocator: sustainable_power will be estimated\n");
+-      estimate_pid_constants(tz, tz->tzp->sustainable_power,
+-                             params->trip_switch_on,
+-                             params->trip_max->temperature);
++      if (params->trip_max)
++              estimate_pid_constants(tz, tz->tzp->sustainable_power,
++                                     params->trip_switch_on,
++                                     params->trip_max->temperature);
+       reset_pid_controller(params);
+-- 
+2.43.0
+