diff mbox series

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

Message ID 20231018055326.18256-2-jyanchou@realtek.com
State New
Headers show
Series Add DesignWare Mobile mmc driver | expand

Commit Message

Jyan Chou [周芷安] Oct. 18, 2023, 5:53 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>

---
v0 -> v1:
- Separate different patch supports into single patch.

v1 -> v2:
- Export cqhci_set_tran_desc for setting the descriptor's callback function.
---
---
 drivers/mmc/host/cqhci-core.c | 8 +++++++-
 drivers/mmc/host/cqhci.h      | 2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

kernel test robot Oct. 19, 2023, 9 a.m. UTC | #1
Hi Jyan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on ulf-hansson-mmc-mirror/next v6.6-rc6 next-20231018]
[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/20231018-135532
base:   linus/master
patch link:    https://lore.kernel.org/r/20231018055326.18256-2-jyanchou%40realtek.com
patch subject: [PATCH V2][1/4] mmc: solve DMA boundary limitation of CQHCI driver
config: csky-randconfig-001-20231019 (https://download.01.org/0day-ci/archive/20231019/202310191631.Hp1KsdtD-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231019/202310191631.Hp1KsdtD-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/202310191631.Hp1KsdtD-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/mmc/host/sdhci_am654.c:17:
>> drivers/mmc/host/cqhci.h:292:40: warning: 'struct mmc_data' declared inside parameter list will not be visible outside of this definition or declaration
     292 |         void (*setup_tran_desc)(struct mmc_data *data,
         |                                        ^~~~~~~~
--
>> drivers/mmc/host/cqhci-core.c:477:6: warning: no previous prototype for 'cqhci_set_tran_desc' [-Wmissing-prototypes]
     477 | void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
         |      ^~~~~~~~~~~~~~~~~~~


vim +292 drivers/mmc/host/cqhci.h

   281	
   282	struct cqhci_host_ops {
   283		void (*dumpregs)(struct mmc_host *mmc);
   284		void (*write_l)(struct cqhci_host *host, u32 val, int reg);
   285		u32 (*read_l)(struct cqhci_host *host, int reg);
   286		void (*enable)(struct mmc_host *mmc);
   287		void (*disable)(struct mmc_host *mmc, bool recovery);
   288		void (*update_dcmd_desc)(struct mmc_host *mmc, struct mmc_request *mrq,
   289					 u64 *data);
   290		void (*pre_enable)(struct mmc_host *mmc);
   291		void (*post_disable)(struct mmc_host *mmc);
 > 292		void (*setup_tran_desc)(struct mmc_data *data,
   293			struct cqhci_host *cq_host, u8 *desc, int sg_count);
   294	#ifdef CONFIG_MMC_CRYPTO
   295		int (*program_key)(struct cqhci_host *cq_host,
   296				   const union cqhci_crypto_cfg_entry *cfg, int slot);
   297	#endif
   298	};
   299
kernel test robot Oct. 19, 2023, 1 p.m. UTC | #2
Hi Jyan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.6-rc6 next-20231019]
[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/20231018-135532
base:   linus/master
patch link:    https://lore.kernel.org/r/20231018055326.18256-2-jyanchou%40realtek.com
patch subject: [PATCH V2][1/4] mmc: solve DMA boundary limitation of CQHCI driver
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20231019/202310192006.ZUfTNe5e-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/20231019/202310192006.ZUfTNe5e-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/202310192006.ZUfTNe5e-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/mmc/host/cqhci-core.c:477:6: warning: no previous prototype for function 'cqhci_set_tran_desc' [-Wmissing-prototypes]
   void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
        ^
   drivers/mmc/host/cqhci-core.c:477:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
   ^
   static 
   1 warning generated.


vim +/cqhci_set_tran_desc +477 drivers/mmc/host/cqhci-core.c

   476	
 > 477	void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
   478					bool dma64)
   479	{
   480		__le32 *attr = (__le32 __force *)desc;
   481	
   482		*attr = (CQHCI_VALID(1) |
   483			 CQHCI_END(end ? 1 : 0) |
   484			 CQHCI_INT(0) |
   485			 CQHCI_ACT(0x4) |
   486			 CQHCI_DAT_LENGTH(len));
   487	
   488		if (dma64) {
   489			__le64 *dataddr = (__le64 __force *)(desc + 4);
   490	
   491			dataddr[0] = cpu_to_le64(addr);
   492		} else {
   493			__le32 *dataddr = (__le32 __force *)(desc + 4);
   494	
   495			dataddr[0] = cpu_to_le32(addr);
   496		}
   497	}
   498	EXPORT_SYMBOL(cqhci_set_tran_desc);
   499
diff mbox series

Patch

diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
index b3d7d6d8d654..5560329d2a7d 100644
--- a/drivers/mmc/host/cqhci-core.c
+++ b/drivers/mmc/host/cqhci-core.c
@@ -474,7 +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,
+void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
 				bool dma64)
 {
 	__le32 *attr = (__le32 __force *)desc;
@@ -495,6 +495,7 @@  static void cqhci_set_tran_desc(u8 *desc, dma_addr_t addr, int len, bool end,
 		dataddr[0] = cpu_to_le32(addr);
 	}
 }
+EXPORT_SYMBOL(cqhci_set_tran_desc);
 
 static int cqhci_prep_tran_desc(struct mmc_request *mrq,
 			       struct cqhci_host *cq_host, int tag)
@@ -516,6 +517,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..cb3dfb161c54 100644
--- a/drivers/mmc/host/cqhci.h
+++ b/drivers/mmc/host/cqhci.h
@@ -289,6 +289,8 @@  struct cqhci_host_ops {
 				 u64 *data);
 	void (*pre_enable)(struct mmc_host *mmc);
 	void (*post_disable)(struct mmc_host *mmc);
+	void (*setup_tran_desc)(struct mmc_data *data,
+		struct cqhci_host *cq_host, u8 *desc, int sg_count);
 #ifdef CONFIG_MMC_CRYPTO
 	int (*program_key)(struct cqhci_host *cq_host,
 			   const union cqhci_crypto_cfg_entry *cfg, int slot);