public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests
@ 2025-04-08 12:27 Hardik Gohil
  2025-04-08 12:27 ` [PATCH 2/2] mmc: mmci: stm32: fix DMA API overlapping mappings warning Hardik Gohil
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hardik Gohil @ 2025-04-08 12:27 UTC (permalink / raw)
  To: stable; +Cc: christophe.kerello, sashal, ulf.hansson, Yann Gautier

From: Yann Gautier <yann.gautier@foss.st.com>

[ Upstream commit 970dc9c11a17994ab878016b536612ab00d1441d ]

In SDIO mode, the sg list for requests can be unaligned with what the
STM32 SDMMC internal DMA can support. In that case, instead of failing,
use a temporary bounce buffer to copy from/to the sg list.
This buffer is limited to 1MB. But for that we need to also limit
max_req_size to 1MB. It has not shown any throughput penalties for
SD-cards or eMMC.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Link: https://lore.kernel.org/r/20220328145114.334577-1-yann.gautier@foss.st.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Stable-dep-of: 6b1ba3f9040b ("mmc: mmci: stm32: fix DMA API overlapping mappings warning")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Tested-by: Hardik A Gohil <hgohil@mvista.com>
---
This fix was not backported to v5.4

Patch 1 and Patch 2 there were only line change.

Tested build successfully

dependend patch for this 2 patches
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.235&id=bdbf9faf5f2e6bb0c0243350428c908ac85c16b2

 drivers/mmc/host/mmci_stm32_sdmmc.c | 88 ++++++++++++++++++++++++++++++-------
 1 file changed, 71 insertions(+), 17 deletions(-)

diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c
index aa8c0ab..cab3a52 100644
--- a/drivers/mmc/host/mmci_stm32_sdmmc.c
+++ b/drivers/mmc/host/mmci_stm32_sdmmc.c
@@ -23,11 +23,16 @@ struct sdmmc_lli_desc {
 struct sdmmc_idma {
 	dma_addr_t sg_dma;
 	void *sg_cpu;
+	dma_addr_t bounce_dma_addr;
+	void *bounce_buf;
+	bool use_bounce_buffer;
 };
 
 int sdmmc_idma_validate_data(struct mmci_host *host,
 			     struct mmc_data *data)
 {
+	struct sdmmc_idma *idma = host->dma_priv;
+	struct device *dev = mmc_dev(host->mmc);
 	struct scatterlist *sg;
 	int i;
 
@@ -35,41 +40,69 @@ int sdmmc_idma_validate_data(struct mmci_host *host,
 	 * idma has constraints on idmabase & idmasize for each element
 	 * excepted the last element which has no constraint on idmasize
 	 */
+	idma->use_bounce_buffer = false;
 	for_each_sg(data->sg, sg, data->sg_len - 1, i) {
 		if (!IS_ALIGNED(sg->offset, sizeof(u32)) ||
 		    !IS_ALIGNED(sg->length, SDMMC_IDMA_BURST)) {
-			dev_err(mmc_dev(host->mmc),
+			dev_dbg(mmc_dev(host->mmc),
 				"unaligned scatterlist: ofst:%x length:%d\n",
 				data->sg->offset, data->sg->length);
-			return -EINVAL;
+			goto use_bounce_buffer;
 		}
 	}
 
 	if (!IS_ALIGNED(sg->offset, sizeof(u32))) {
-		dev_err(mmc_dev(host->mmc),
+		dev_dbg(mmc_dev(host->mmc),
 			"unaligned last scatterlist: ofst:%x length:%d\n",
 			data->sg->offset, data->sg->length);
-		return -EINVAL;
+		goto use_bounce_buffer;
+	}
+
+	return 0;
+
+use_bounce_buffer:
+	if (!idma->bounce_buf) {
+		idma->bounce_buf = dmam_alloc_coherent(dev,
+						       host->mmc->max_req_size,
+						       &idma->bounce_dma_addr,
+						       GFP_KERNEL);
+		if (!idma->bounce_buf) {
+			dev_err(dev, "Unable to map allocate DMA bounce buffer.\n");
+			return -ENOMEM;
+		}
 	}
 
+	idma->use_bounce_buffer = true;
+
 	return 0;
 }
 
 static int _sdmmc_idma_prep_data(struct mmci_host *host,
 				 struct mmc_data *data)
 {
-	int n_elem;
+	struct sdmmc_idma *idma = host->dma_priv;
 
-	n_elem = dma_map_sg(mmc_dev(host->mmc),
-			    data->sg,
-			    data->sg_len,
-			    mmc_get_dma_dir(data));
+	if (idma->use_bounce_buffer) {
+		if (data->flags & MMC_DATA_WRITE) {
+			unsigned int xfer_bytes = data->blksz * data->blocks;
 
-	if (!n_elem) {
-		dev_err(mmc_dev(host->mmc), "dma_map_sg failed\n");
-		return -EINVAL;
-	}
+			sg_copy_to_buffer(data->sg, data->sg_len,
+					  idma->bounce_buf, xfer_bytes);
+			dma_wmb();
+		}
+	} else {
+		int n_elem;
 
+		n_elem = dma_map_sg(mmc_dev(host->mmc),
+				    data->sg,
+				    data->sg_len,
+				    mmc_get_dma_dir(data));
+
+		if (!n_elem) {
+			dev_err(mmc_dev(host->mmc), "dma_map_sg failed\n");
+			return -EINVAL;
+		}
+	}
 	return 0;
 }
 
@@ -86,8 +119,19 @@ static int sdmmc_idma_prep_data(struct mmci_host *host,
 static void sdmmc_idma_unprep_data(struct mmci_host *host,
 				   struct mmc_data *data, int err)
 {
-	dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
-		     mmc_get_dma_dir(data));
+	struct sdmmc_idma *idma = host->dma_priv;
+
+	if (idma->use_bounce_buffer) {
+		if (data->flags & MMC_DATA_READ) {
+			unsigned int xfer_bytes = data->blksz * data->blocks;
+
+			sg_copy_from_buffer(data->sg, data->sg_len,
+					    idma->bounce_buf, xfer_bytes);
+		}
+	} else {
+		dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
+			     mmc_get_dma_dir(data));
+	}
 }
 
 static int sdmmc_idma_setup(struct mmci_host *host)
@@ -112,6 +156,8 @@ static int sdmmc_idma_setup(struct mmci_host *host)
 		host->mmc->max_segs = SDMMC_LLI_BUF_LEN /
 			sizeof(struct sdmmc_lli_desc);
 		host->mmc->max_seg_size = host->variant->stm32_idmabsize_mask;
+
+		host->mmc->max_req_size = SZ_1M;
 	} else {
 		host->mmc->max_segs = 1;
 		host->mmc->max_seg_size = host->mmc->max_req_size;
@@ -129,8 +175,16 @@ static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl)
 	struct scatterlist *sg;
 	int i;
 
-	if (!host->variant->dma_lli || data->sg_len == 1) {
-		writel_relaxed(sg_dma_address(data->sg),
+	if (!host->variant->dma_lli || data->sg_len == 1 ||
+	    idma->use_bounce_buffer) {
+		u32 dma_addr;
+
+		if (idma->use_bounce_buffer)
+			dma_addr = idma->bounce_dma_addr;
+		else
+			dma_addr = sg_dma_address(data->sg);
+
+		writel_relaxed(dma_addr,
 			       host->base + MMCI_STM32_IDMABASE0R);
 		writel_relaxed(MMCI_STM32_IDMAEN,
 			       host->base + MMCI_STM32_IDMACTRLR);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] mmc: mmci: stm32: fix DMA API overlapping mappings warning
  2025-04-08 12:27 [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests Hardik Gohil
@ 2025-04-08 12:27 ` Hardik Gohil
  2025-04-10 15:53 ` [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests Sasha Levin
  2025-04-22 12:15 ` Greg KH
  2 siblings, 0 replies; 5+ messages in thread
From: Hardik Gohil @ 2025-04-08 12:27 UTC (permalink / raw)
  To: stable; +Cc: christophe.kerello, sashal, ulf.hansson

From: Christophe Kerello <christophe.kerello@foss.st.com>

[ Upstream commit 6b1ba3f9040be5efc4396d86c9752cdc564730be ]

Turning on CONFIG_DMA_API_DEBUG_SG results in the following warning:

DMA-API: mmci-pl18x 48220000.mmc: cacheline tracking EEXIST,
overlapping mappings aren't supported
WARNING: CPU: 1 PID: 51 at kernel/dma/debug.c:568
add_dma_entry+0x234/0x2f4
Modules linked in:
CPU: 1 PID: 51 Comm: kworker/1:2 Not tainted 6.1.28 #1
Hardware name: STMicroelectronics STM32MP257F-EV1 Evaluation Board (DT)
Workqueue: events_freezable mmc_rescan
Call trace:
add_dma_entry+0x234/0x2f4
debug_dma_map_sg+0x198/0x350
__dma_map_sg_attrs+0xa0/0x110
dma_map_sg_attrs+0x10/0x2c
sdmmc_idma_prep_data+0x80/0xc0
mmci_prep_data+0x38/0x84
mmci_start_data+0x108/0x2dc
mmci_request+0xe4/0x190
__mmc_start_request+0x68/0x140
mmc_start_request+0x94/0xc0
mmc_wait_for_req+0x70/0x100
mmc_send_tuning+0x108/0x1ac
sdmmc_execute_tuning+0x14c/0x210
mmc_execute_tuning+0x48/0xec
mmc_sd_init_uhs_card.part.0+0x208/0x464
mmc_sd_init_card+0x318/0x89c
mmc_attach_sd+0xe4/0x180
mmc_rescan+0x244/0x320

DMA API debug brings to light leaking dma-mappings as dma_map_sg and
dma_unmap_sg are not correctly balanced.

If an error occurs in mmci_cmd_irq function, only mmci_dma_error
function is called and as this API is not managed on stm32 variant,
dma_unmap_sg is never called in this error path.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Fixes: 46b723dd867d ("mmc: mmci: add stm32 sdmmc variant")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240207143951.938144-1-christophe.kerello@foss.st.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mmc/host/mmci_stm32_sdmmc.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c
index cab3a52..dd52546 100644
--- a/drivers/mmc/host/mmci_stm32_sdmmc.c
+++ b/drivers/mmc/host/mmci_stm32_sdmmc.c
@@ -175,6 +175,8 @@ static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl)
 	struct scatterlist *sg;
 	int i;
 
+	host->dma_in_progress = true;
+
 	if (!host->variant->dma_lli || data->sg_len == 1 ||
 	    idma->use_bounce_buffer) {
 		u32 dma_addr;
@@ -213,9 +215,30 @@ static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl)
 	return 0;
 }
 
+static void sdmmc_idma_error(struct mmci_host *host)
+{
+	struct mmc_data *data = host->data;
+	struct sdmmc_idma *idma = host->dma_priv;
+
+	if (!dma_inprogress(host))
+		return;
+
+	writel_relaxed(0, host->base + MMCI_STM32_IDMACTRLR);
+	host->dma_in_progress = false;
+	data->host_cookie = 0;
+
+	if (!idma->use_bounce_buffer)
+		dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
+			     mmc_get_dma_dir(data));
+}
+
 static void sdmmc_idma_finalize(struct mmci_host *host, struct mmc_data *data)
 {
+	if (!dma_inprogress(host))
+		return;
+
 	writel_relaxed(0, host->base + MMCI_STM32_IDMACTRLR);
+	host->dma_in_progress = false;
 
 	if (!data->host_cookie)
 		sdmmc_idma_unprep_data(host, data, 0);
@@ -347,6 +370,7 @@ static struct mmci_host_ops sdmmc_variant_ops = {
 	.dma_setup = sdmmc_idma_setup,
 	.dma_start = sdmmc_idma_start,
 	.dma_finalize = sdmmc_idma_finalize,
+	.dma_error = sdmmc_idma_error,
 	.set_clkreg = mmci_sdmmc_set_clkreg,
 	.set_pwrreg = mmci_sdmmc_set_pwrreg,
 };
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests
  2025-04-08 12:27 [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests Hardik Gohil
  2025-04-08 12:27 ` [PATCH 2/2] mmc: mmci: stm32: fix DMA API overlapping mappings warning Hardik Gohil
@ 2025-04-10 15:53 ` Sasha Levin
  2025-04-11 13:47   ` Hardik Gohil
  2025-04-22 12:15 ` Greg KH
  2 siblings, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2025-04-10 15:53 UTC (permalink / raw)
  To: stable, hgohil; +Cc: Sasha Levin

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
❌ Build failures detected

The upstream commit SHA1 provided is correct: 970dc9c11a17994ab878016b536612ab00d1441d

WARNING: Author mismatch between patch and upstream commit:
Backport author: Hardik Gohil<hgohil@mvista.com>
Commit author: Yann Gautier<yann.gautier@foss.st.com>

Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.13.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)
5.15.y | Present (different SHA1: 287093040fc5)
5.10.y | Present (different SHA1: abda366ece48)

Note: The patch differs from the upstream commit:
---
1:  970dc9c11a179 < -:  ------------- mmc: mmci: stm32: use a buffer for unaligned DMA requests
-:  ------------- > 1:  1b01d9c341770 Linux 5.4.292
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.4.y        |  Success    |  Failed    |

Build Errors:
Build error for stable/linux-5.4.y:
    arch/x86/entry/entry_64.o: warning: objtool: .entry.text+0x1e1: stack state mismatch: cfa1=7+56 cfa2=7+40
    arch/x86/kvm/vmx/vmenter.o: warning: objtool: __vmx_vcpu_run()+0x12a: return with modified stack frame
    In file included from ./include/linux/list.h:9,
                     from ./include/linux/kobject.h:19,
                     from ./include/linux/of.h:17,
                     from ./include/linux/clk-provider.h:9,
                     from drivers/clk/qcom/clk-rpmh.c:6:
    drivers/clk/qcom/clk-rpmh.c: In function 'clk_rpmh_bcm_send_cmd':
    ./include/linux/kernel.h:843:43: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
      843 |                 (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
          |                                           ^~
    ./include/linux/kernel.h:857:18: note: in expansion of macro '__typecheck'
      857 |                 (__typecheck(x, y) && __no_side_effects(x, y))
          |                  ^~~~~~~~~~~
    ./include/linux/kernel.h:867:31: note: in expansion of macro '__safe_cmp'
      867 |         __builtin_choose_expr(__safe_cmp(x, y), \
          |                               ^~~~~~~~~~
    ./include/linux/kernel.h:876:25: note: in expansion of macro '__careful_cmp'
      876 | #define min(x, y)       __careful_cmp(x, y, <)
          |                         ^~~~~~~~~~~~~
    drivers/clk/qcom/clk-rpmh.c:273:21: note: in expansion of macro 'min'
      273 |         cmd_state = min(cmd_state, BCM_TCS_CMD_VOTE_MASK);
          |                     ^~~
    fs/xfs/libxfs/xfs_inode_fork.c: In function 'xfs_ifork_verify_attr':
    fs/xfs/libxfs/xfs_inode_fork.c:735:13: warning: the comparison will always evaluate as 'true' for the address of 'i_df' will never be NULL [-Waddress]
      735 |         if (!XFS_IFORK_PTR(ip, XFS_ATTR_FORK))
          |             ^
    In file included from fs/xfs/libxfs/xfs_inode_fork.c:14:
    ./fs/xfs/xfs_inode.h:38:33: note: 'i_df' declared here
       38 |         struct xfs_ifork        i_df;           /* data fork */
          |                                 ^~~~
    drivers/net/dsa/microchip/ksz9477.c: In function 'ksz9477_reset_switch':
    drivers/net/dsa/microchip/ksz9477.c:198:12: warning: unused variable 'data8' [-Wunused-variable]
      198 |         u8 data8;
          |            ^~~~~
    drivers/gpu/drm/i915/display/intel_dp.c: In function 'intel_dp_mode_valid':
    drivers/gpu/drm/i915/display/intel_dp.c:639:33: warning: 'drm_dp_dsc_sink_max_slice_count' reading 16 bytes from a region of size 0 [-Wstringop-overread]
      639 |                                 drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd,
          |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      640 |                                                                 true);
          |                                                                 ~~~~~
    drivers/gpu/drm/i915/display/intel_dp.c:639:33: note: referencing argument 1 of type 'const u8[16]' {aka 'const unsigned char[16]'}
    In file included from drivers/gpu/drm/i915/display/intel_dp.c:39:
    ./include/drm/drm_dp_helper.h:1174:4: note: in a call to function 'drm_dp_dsc_sink_max_slice_count'
     1174 | u8 drm_dp_dsc_sink_max_slice_count(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE],
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from ./include/linux/bitops.h:5,
                     from ./include/linux/kernel.h:12,
                     from ./include/linux/list.h:9,
                     from ./include/linux/module.h:9,
                     from drivers/net/ethernet/qlogic/qed/qed_debug.c:6:
    drivers/net/ethernet/qlogic/qed/qed_debug.c: In function 'qed_grc_dump_addr_range':
    ./include/linux/bits.h:8:33: warning: overflow in conversion from 'long unsigned int' to 'u8' {aka 'unsigned char'} changes value from '(long unsigned int)((int)vf_id << 8 | 128)' to '128' [-Woverflow]
        8 | #define BIT(nr)                 (UL(1) << (nr))
          |                                 ^
    drivers/net/ethernet/qlogic/qed/qed_debug.c:2572:31: note: in expansion of macro 'BIT'
     2572 |                         fid = BIT(PXP_PRETEND_CONCRETE_FID_VFVALID_SHIFT) |
          |                               ^~~
    drivers/gpu/drm/nouveau/dispnv50/wndw.c:628:1: warning: conflicting types for 'nv50_wndw_new_' due to enum/integer mismatch; have 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const u32 *, u32,  enum nv50_disp_interlock_type,  u32,  struct nv50_wndw **)' {aka 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const unsigned int *, unsigned int,  enum nv50_disp_interlock_type,  unsigned int,  struct nv50_wndw **)'} [-Wenum-int-mismatch]
      628 | nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
          | ^~~~~~~~~~~~~~
    In file included from drivers/gpu/drm/nouveau/dispnv50/wndw.c:22:
    drivers/gpu/drm/nouveau/dispnv50/wndw.h:39:5: note: previous declaration of 'nv50_wndw_new_' with type 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const u32 *, enum nv50_disp_interlock_type,  u32,  u32,  struct nv50_wndw **)' {aka 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const unsigned int *, enum nv50_disp_interlock_type,  unsigned int,  unsigned int,  struct nv50_wndw **)'}
       39 | int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
          |     ^~~~~~~~~~~~~~
    .tmp_vmlinux.kallsyms1.S: Assembler messages:
    .tmp_vmlinux.kallsyms1.S:148756: Warning: zero assumed for missing expression
    /home/sasha/compilers/gcc-14.2.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: .tmp_vmlinux.kallsyms1.o: in function `kallsyms_names':
    (.rodata+0x956df): undefined reference to `xb8'
    make: *** [Makefile:1121: vmlinux] Error 1
    make: Target '_all' not remade because of errors.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests
  2025-04-10 15:53 ` [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests Sasha Levin
@ 2025-04-11 13:47   ` Hardik Gohil
  0 siblings, 0 replies; 5+ messages in thread
From: Hardik Gohil @ 2025-04-11 13:47 UTC (permalink / raw)
  To: Sasha Levin; +Cc: stable

Helo Sasha,

Does this error have to do anything with the patch fix ? The driver
fix is dependent on ARM arch and does not apply to x86 arch.

I have compiled the 5.4.y kernel with patch applied and there was no such error.

Regards,
Hardik


On Thu, Apr 10, 2025 at 9:23 PM Sasha Levin <sashal@kernel.org> wrote:
>
> [ Sasha's backport helper bot ]
>
> Hi,
>
> Summary of potential issues:
> ❌ Build failures detected
>
> The upstream commit SHA1 provided is correct: 970dc9c11a17994ab878016b536612ab00d1441d
>
> WARNING: Author mismatch between patch and upstream commit:
> Backport author: Hardik Gohil<hgohil@mvista.com>
> Commit author: Yann Gautier<yann.gautier@foss.st.com>
>
> Status in newer kernel trees:
> 6.14.y | Present (exact SHA1)
> 6.13.y | Present (exact SHA1)
> 6.12.y | Present (exact SHA1)
> 6.6.y | Present (exact SHA1)
> 6.1.y | Present (exact SHA1)
> 5.15.y | Present (different SHA1: 287093040fc5)
> 5.10.y | Present (different SHA1: abda366ece48)
>
> Note: The patch differs from the upstream commit:
> ---
> 1:  970dc9c11a179 < -:  ------------- mmc: mmci: stm32: use a buffer for unaligned DMA requests
> -:  ------------- > 1:  1b01d9c341770 Linux 5.4.292
> ---
>
> Results of testing on various branches:
>
> | Branch                    | Patch Apply | Build Test |
> |---------------------------|-------------|------------|
> | stable/linux-5.4.y        |  Success    |  Failed    |
>
> Build Errors:
> Build error for stable/linux-5.4.y:
>     arch/x86/entry/entry_64.o: warning: objtool: .entry.text+0x1e1: stack state mismatch: cfa1=7+56 cfa2=7+40
>     arch/x86/kvm/vmx/vmenter.o: warning: objtool: __vmx_vcpu_run()+0x12a: return with modified stack frame
>     In file included from ./include/linux/list.h:9,
>                      from ./include/linux/kobject.h:19,
>                      from ./include/linux/of.h:17,
>                      from ./include/linux/clk-provider.h:9,
>                      from drivers/clk/qcom/clk-rpmh.c:6:
>     drivers/clk/qcom/clk-rpmh.c: In function 'clk_rpmh_bcm_send_cmd':
>     ./include/linux/kernel.h:843:43: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
>       843 |                 (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
>           |                                           ^~
>     ./include/linux/kernel.h:857:18: note: in expansion of macro '__typecheck'
>       857 |                 (__typecheck(x, y) && __no_side_effects(x, y))
>           |                  ^~~~~~~~~~~
>     ./include/linux/kernel.h:867:31: note: in expansion of macro '__safe_cmp'
>       867 |         __builtin_choose_expr(__safe_cmp(x, y), \
>           |                               ^~~~~~~~~~
>     ./include/linux/kernel.h:876:25: note: in expansion of macro '__careful_cmp'
>       876 | #define min(x, y)       __careful_cmp(x, y, <)
>           |                         ^~~~~~~~~~~~~
>     drivers/clk/qcom/clk-rpmh.c:273:21: note: in expansion of macro 'min'
>       273 |         cmd_state = min(cmd_state, BCM_TCS_CMD_VOTE_MASK);
>           |                     ^~~
>     fs/xfs/libxfs/xfs_inode_fork.c: In function 'xfs_ifork_verify_attr':
>     fs/xfs/libxfs/xfs_inode_fork.c:735:13: warning: the comparison will always evaluate as 'true' for the address of 'i_df' will never be NULL [-Waddress]
>       735 |         if (!XFS_IFORK_PTR(ip, XFS_ATTR_FORK))
>           |             ^
>     In file included from fs/xfs/libxfs/xfs_inode_fork.c:14:
>     ./fs/xfs/xfs_inode.h:38:33: note: 'i_df' declared here
>        38 |         struct xfs_ifork        i_df;           /* data fork */
>           |                                 ^~~~
>     drivers/net/dsa/microchip/ksz9477.c: In function 'ksz9477_reset_switch':
>     drivers/net/dsa/microchip/ksz9477.c:198:12: warning: unused variable 'data8' [-Wunused-variable]
>       198 |         u8 data8;
>           |            ^~~~~
>     drivers/gpu/drm/i915/display/intel_dp.c: In function 'intel_dp_mode_valid':
>     drivers/gpu/drm/i915/display/intel_dp.c:639:33: warning: 'drm_dp_dsc_sink_max_slice_count' reading 16 bytes from a region of size 0 [-Wstringop-overread]
>       639 |                                 drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd,
>           |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>       640 |                                                                 true);
>           |                                                                 ~~~~~
>     drivers/gpu/drm/i915/display/intel_dp.c:639:33: note: referencing argument 1 of type 'const u8[16]' {aka 'const unsigned char[16]'}
>     In file included from drivers/gpu/drm/i915/display/intel_dp.c:39:
>     ./include/drm/drm_dp_helper.h:1174:4: note: in a call to function 'drm_dp_dsc_sink_max_slice_count'
>      1174 | u8 drm_dp_dsc_sink_max_slice_count(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE],
>           |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     In file included from ./include/linux/bitops.h:5,
>                      from ./include/linux/kernel.h:12,
>                      from ./include/linux/list.h:9,
>                      from ./include/linux/module.h:9,
>                      from drivers/net/ethernet/qlogic/qed/qed_debug.c:6:
>     drivers/net/ethernet/qlogic/qed/qed_debug.c: In function 'qed_grc_dump_addr_range':
>     ./include/linux/bits.h:8:33: warning: overflow in conversion from 'long unsigned int' to 'u8' {aka 'unsigned char'} changes value from '(long unsigned int)((int)vf_id << 8 | 128)' to '128' [-Woverflow]
>         8 | #define BIT(nr)                 (UL(1) << (nr))
>           |                                 ^
>     drivers/net/ethernet/qlogic/qed/qed_debug.c:2572:31: note: in expansion of macro 'BIT'
>      2572 |                         fid = BIT(PXP_PRETEND_CONCRETE_FID_VFVALID_SHIFT) |
>           |                               ^~~
>     drivers/gpu/drm/nouveau/dispnv50/wndw.c:628:1: warning: conflicting types for 'nv50_wndw_new_' due to enum/integer mismatch; have 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const u32 *, u32,  enum nv50_disp_interlock_type,  u32,  struct nv50_wndw **)' {aka 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const unsigned int *, unsigned int,  enum nv50_disp_interlock_type,  unsigned int,  struct nv50_wndw **)'} [-Wenum-int-mismatch]
>       628 | nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
>           | ^~~~~~~~~~~~~~
>     In file included from drivers/gpu/drm/nouveau/dispnv50/wndw.c:22:
>     drivers/gpu/drm/nouveau/dispnv50/wndw.h:39:5: note: previous declaration of 'nv50_wndw_new_' with type 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const u32 *, enum nv50_disp_interlock_type,  u32,  u32,  struct nv50_wndw **)' {aka 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const unsigned int *, enum nv50_disp_interlock_type,  unsigned int,  unsigned int,  struct nv50_wndw **)'}
>        39 | int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
>           |     ^~~~~~~~~~~~~~
>     .tmp_vmlinux.kallsyms1.S: Assembler messages:
>     .tmp_vmlinux.kallsyms1.S:148756: Warning: zero assumed for missing expression
>     /home/sasha/compilers/gcc-14.2.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: .tmp_vmlinux.kallsyms1.o: in function `kallsyms_names':
>     (.rodata+0x956df): undefined reference to `xb8'
>     make: *** [Makefile:1121: vmlinux] Error 1
>     make: Target '_all' not remade because of errors.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests
  2025-04-08 12:27 [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests Hardik Gohil
  2025-04-08 12:27 ` [PATCH 2/2] mmc: mmci: stm32: fix DMA API overlapping mappings warning Hardik Gohil
  2025-04-10 15:53 ` [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests Sasha Levin
@ 2025-04-22 12:15 ` Greg KH
  2 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2025-04-22 12:15 UTC (permalink / raw)
  To: Hardik Gohil
  Cc: stable, christophe.kerello, sashal, ulf.hansson, Yann Gautier

On Tue, Apr 08, 2025 at 05:57:20PM +0530, Hardik Gohil wrote:
> From: Yann Gautier <yann.gautier@foss.st.com>
> 
> [ Upstream commit 970dc9c11a17994ab878016b536612ab00d1441d ]
> 
> In SDIO mode, the sg list for requests can be unaligned with what the
> STM32 SDMMC internal DMA can support. In that case, instead of failing,
> use a temporary bounce buffer to copy from/to the sg list.
> This buffer is limited to 1MB. But for that we need to also limit
> max_req_size to 1MB. It has not shown any throughput penalties for
> SD-cards or eMMC.
> 
> Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
> Link: https://lore.kernel.org/r/20220328145114.334577-1-yann.gautier@foss.st.com
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> Stable-dep-of: 6b1ba3f9040b ("mmc: mmci: stm32: fix DMA API overlapping mappings warning")
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> Tested-by: Hardik A Gohil <hgohil@mvista.com>
> ---
> This fix was not backported to v5.4
> 
> Patch 1 and Patch 2 there were only line change.
> 
> Tested build successfully
> 
> dependend patch for this 2 patches
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.235&id=bdbf9faf5f2e6bb0c0243350428c908ac85c16b2

Then please send the full patch series, not just "prep" patches.

I'm dropping both of these from my review queue now, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-04-22 12:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 12:27 [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests Hardik Gohil
2025-04-08 12:27 ` [PATCH 2/2] mmc: mmci: stm32: fix DMA API overlapping mappings warning Hardik Gohil
2025-04-10 15:53 ` [PATCH 1/2 v5.4.y] mmc: mmci: stm32: use a buffer for unaligned DMA requests Sasha Levin
2025-04-11 13:47   ` Hardik Gohil
2025-04-22 12:15 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox