diff mbox series

[V6,1/4] mmc: solve DMA boundary limitation of CQHCI driver

Message ID 20231109082043.27147-2-jyanchou@realtek.com (mailing list archive)
State New, archived
Headers show
Series Add DesignWare Mobile mmc driver | expand

Commit Message

Jyan Chou [周芷安] Nov. 9, 2023, 8:20 a.m. UTC
Due to synopsys data book's description, it had a limitation
while using DMA that buffer size and start address must not
exceed 128 MB.

We add an option setup_tran_desc to make tran_desc setting flexible.

Signed-off-by: Jyan Chou <jyanchou@realtek.com>

---
v4 -> v5:
- use EXPORT_SYMBOL_GPL to replace EXPORT_SYMBOL
- Fix kernel test robot build errors, let 'setup_tran_desc' to be a member in
  'const struct cqhci_host_ops'.

v2 -> v3:
- Fix auto test compile warning.

v1 -> v2:
- Export cqhci_set_tran_desc for setting the descriptor's callback function.

v0 -> v1:
- Separate different patch supports into single patch.
---
 drivers/mmc/host/cqhci-core.c | 11 ++++++++---
 drivers/mmc/host/cqhci.h      |  8 ++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

Comments

kernel test robot Nov. 9, 2023, 3:22 p.m. UTC | #1
Hi Jyan,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on ulf-hansson-mmc-mirror/next v6.6 next-20231109]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jyan-Chou/mmc-solve-DMA-boundary-limitation-of-CQHCI-driver/20231109-190435
base:   linus/master
patch link:    https://lore.kernel.org/r/20231109082043.27147-2-jyanchou%40realtek.com
patch subject: [PATCH V6][1/4] mmc: solve DMA boundary limitation of CQHCI driver
config: arc-randconfig-002-20231109 (https://download.01.org/0day-ci/archive/20231109/202311092347.9A8MgzyN-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231109/202311092347.9A8MgzyN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311092347.9A8MgzyN-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/mmc/host/cqhci-core.c: In function 'cqhci_prep_tran_desc':
>> drivers/mmc/host/cqhci-core.c:519:25: error: 'const struct cqhci_host_ops' has no member named 'setup_tran_desc'
     519 |         if (cq_host->ops->setup_tran_desc) {
         |                         ^~
   drivers/mmc/host/cqhci-core.c:520:29: error: 'const struct cqhci_host_ops' has no member named 'setup_tran_desc'
     520 |                 cq_host->ops->setup_tran_desc(data, cq_host, desc, sg_count);
         |                             ^~


vim +519 drivers/mmc/host/cqhci-core.c

   498	
   499	static int cqhci_prep_tran_desc(struct mmc_request *mrq,
   500					struct cqhci_host *cq_host, int tag)
   501	{
   502		struct mmc_data *data = mrq->data;
   503		int i, sg_count, len;
   504		bool end = false;
   505		bool dma64 = cq_host->dma64;
   506		dma_addr_t addr;
   507		u8 *desc;
   508		struct scatterlist *sg;
   509	
   510		sg_count = cqhci_dma_map(mrq->host, mrq);
   511		if (sg_count < 0) {
   512			pr_err("%s: %s: unable to map sg lists, %d\n",
   513					mmc_hostname(mrq->host), __func__, sg_count);
   514			return sg_count;
   515		}
   516	
   517		desc = get_trans_desc(cq_host, tag);
   518	
 > 519		if (cq_host->ops->setup_tran_desc) {
   520			cq_host->ops->setup_tran_desc(data, cq_host, desc, sg_count);
   521			return 0;
   522		}
   523	
   524		for_each_sg(data->sg, sg, sg_count, i) {
   525			addr = sg_dma_address(sg);
   526			len = sg_dma_len(sg);
   527	
   528			if ((i+1) == sg_count)
   529				end = true;
   530			cqhci_set_tran_desc(desc, addr, len, end, dma64);
   531			desc += cq_host->trans_desc_len;
   532		}
   533	
   534		return 0;
   535	}
   536
kernel test robot Nov. 10, 2023, 9:16 a.m. UTC | #2
Hi Jyan,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.6 next-20231110]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jyan-Chou/mmc-solve-DMA-boundary-limitation-of-CQHCI-driver/20231109-190435
base:   linus/master
patch link:    https://lore.kernel.org/r/20231109082043.27147-2-jyanchou%40realtek.com
patch subject: [PATCH V6][1/4] mmc: solve DMA boundary limitation of CQHCI driver
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20231110/202311101711.FFnMF7iH-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231110/202311101711.FFnMF7iH-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311101711.FFnMF7iH-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/mmc/host/cqhci-core.c:519:20: error: no member named 'setup_tran_desc' in 'struct cqhci_host_ops'
           if (cq_host->ops->setup_tran_desc) {
               ~~~~~~~~~~~~  ^
   drivers/mmc/host/cqhci-core.c:520:17: error: no member named 'setup_tran_desc' in 'struct cqhci_host_ops'
                   cq_host->ops->setup_tran_desc(data, cq_host, desc, sg_count);
                   ~~~~~~~~~~~~  ^
   2 errors generated.


vim +519 drivers/mmc/host/cqhci-core.c

   498	
   499	static int cqhci_prep_tran_desc(struct mmc_request *mrq,
   500					struct cqhci_host *cq_host, int tag)
   501	{
   502		struct mmc_data *data = mrq->data;
   503		int i, sg_count, len;
   504		bool end = false;
   505		bool dma64 = cq_host->dma64;
   506		dma_addr_t addr;
   507		u8 *desc;
   508		struct scatterlist *sg;
   509	
   510		sg_count = cqhci_dma_map(mrq->host, mrq);
   511		if (sg_count < 0) {
   512			pr_err("%s: %s: unable to map sg lists, %d\n",
   513					mmc_hostname(mrq->host), __func__, sg_count);
   514			return sg_count;
   515		}
   516	
   517		desc = get_trans_desc(cq_host, tag);
   518	
 > 519		if (cq_host->ops->setup_tran_desc) {
   520			cq_host->ops->setup_tran_desc(data, cq_host, desc, sg_count);
   521			return 0;
   522		}
   523	
   524		for_each_sg(data->sg, sg, sg_count, i) {
   525			addr = sg_dma_address(sg);
   526			len = sg_dma_len(sg);
   527	
   528			if ((i+1) == sg_count)
   529				end = true;
   530			cqhci_set_tran_desc(desc, addr, len, end, dma64);
   531			desc += cq_host->trans_desc_len;
   532		}
   533	
   534		return 0;
   535	}
   536
diff mbox series

Patch

diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
index b3d7d6d8d654..c4889fca1556 100644
--- a/drivers/mmc/host/cqhci-core.c
+++ b/drivers/mmc/host/cqhci-core.c
@@ -474,8 +474,7 @@  static int cqhci_dma_map(struct mmc_host *host, struct mmc_request *mrq)
 	return sg_count;
 }
 
-static void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
-				bool dma64)
+void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end, bool dma64)
 {
 	__le32 *attr = (__le32 __force *)desc;
 
@@ -495,9 +494,10 @@  static void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
 		dataddr[0] = cpu_to_le32(addr);
 	}
 }
+EXPORT_SYMBOL_GPL(cqhci_set_tran_desc);
 
 static int cqhci_prep_tran_desc(struct mmc_request *mrq,
-			       struct cqhci_host *cq_host, int tag)
+				struct cqhci_host *cq_host, int tag)
 {
 	struct mmc_data *data = mrq->data;
 	int i, sg_count, len;
@@ -516,6 +516,11 @@  static int cqhci_prep_tran_desc(struct mmc_request *mrq,
 
 	desc = get_trans_desc(cq_host, tag);
 
+	if (cq_host->ops->setup_tran_desc) {
+		cq_host->ops->setup_tran_desc(data, cq_host, desc, sg_count);
+		return 0;
+	}
+
 	for_each_sg(data->sg, sg, sg_count, i) {
 		addr = sg_dma_address(sg);
 		len = sg_dma_len(sg);
diff --git a/drivers/mmc/host/cqhci.h b/drivers/mmc/host/cqhci.h
index 1a12e40a02e6..713fc56127df 100644
--- a/drivers/mmc/host/cqhci.h
+++ b/drivers/mmc/host/cqhci.h
@@ -216,6 +216,7 @@  union cqhci_crypto_cfg_entry {
 struct cqhci_host_ops;
 struct mmc_host;
 struct mmc_request;
+struct mmc_data;
 struct cqhci_slot;
 
 struct cqhci_host {
@@ -293,6 +294,11 @@  struct cqhci_host_ops {
 	int (*program_key)(struct cqhci_host *cq_host,
 			   const union cqhci_crypto_cfg_entry *cfg, int slot);
 #endif
+
+#ifdef CONFIG_MMC_DW_CQE
+	void (*setup_tran_desc)(struct mmc_data *data,
+				struct cqhci_host *cq_host, u8 *desc, int sg_count);
+#endif
 };
 
 static inline void cqhci_writel(struct cqhci_host *host, u32 val, int reg)
@@ -322,6 +328,8 @@  static inline int cqhci_suspend(struct mmc_host *mmc)
 {
 	return cqhci_deactivate(mmc);
 }
+
+void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end, bool dma64);
 int cqhci_resume(struct mmc_host *mmc);
 
 #endif