Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp770941rdb; Thu, 19 Oct 2023 20:52:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAgFKkB156WI719AnwIVbKGNhFjy3ieJsgH3ccpUUtGtH7W29MoX/w5LjgP4d3qja2BEBO X-Received: by 2002:a17:90a:fe89:b0:27d:5a4b:6dc2 with SMTP id co9-20020a17090afe8900b0027d5a4b6dc2mr825577pjb.11.1697773931592; Thu, 19 Oct 2023 20:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697773931; cv=none; d=google.com; s=arc-20160816; b=N7Za5ZS4GVN8ZRnAmPvVCYtWJoVOwfhZ7AnnlAvQLjpge00HBoJrTt82QxRY6Dk+MQ 1SD5t6hqDLWPGx6PNdtZet4/88IbXM0VCXFDR8gJiQFeQol7TC+f9pUN1JJSQx37VhF2 Yla7bRFKPECMSpH2I8ngB5lgaAtei5RHMTdTkTaSiw0xEOjnVvVHDo9DU9oQ8Y2pOWhz w584+R22Hhv8Z//Z3NnMb79UGq5X1UtQBARUz9OQnL/2NlkBmG56jO0xJgzqBGx0KTji EVXCyrPJ2KA1pP9OnFczZfxq9ewGVzpetshboPlzvZlBdmnBel1uRysQi+BKo7qJaJav gu7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5nUycRElQYZ+LkTf/gqjDO6edb4YriCMRU/l5B9jm1A=; fh=R9KwrL6Cegs7H2uyzfGb6VT6WBvTsKBodigQv1rV6cY=; b=Mw0mYH7xruxsYIkOLNU2inzig/KfT9NAQ9So0HwShpetpa4jbUu/xy0ZmRErtamFU1 5m0DflPDbQYWCp6sRVLsHI+smOMoqfXdmEKj3Otkxi3cbkTdXV2mEulvAiZyzc8OX8JI hyc3C9z2QPDqGsqzdPVHrzAq8tTOx4UJi8LetHvjEBuY4zqs1f5PZu2TBej+mVkv5Is6 87AD/Zlvi+YVQ2Joj4E0i2GZ+ghCMDQLyXmrMgZU04cXjaTnn+ocEzt0i8l3CrOaKPXA Le/qf4JmIZg5U2jQtkFmpRKxnhRYcLmqdOQ95vM6xBEGeFGDDVNQr3zIfp3NpeH1cWdb 5Scg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id cm5-20020a17090afa0500b002792c288cb7si3584805pjb.131.2023.10.19.20.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 20:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 442088247749; Thu, 19 Oct 2023 20:51:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376298AbjJTDuv (ORCPT + 99 others); Thu, 19 Oct 2023 23:50:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346919AbjJTDuq (ORCPT ); Thu, 19 Oct 2023 23:50:46 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D35741BF; Thu, 19 Oct 2023 20:50:43 -0700 (PDT) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 39K3nSjxD3723187, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.93/5.92) with ESMTPS id 39K3nSjxD3723187 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Oct 2023 11:49:28 +0800 Received: from RTEXMBS05.realtek.com.tw (172.21.6.98) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Fri, 20 Oct 2023 11:49:28 +0800 Received: from RTEXH36506.realtek.com.tw (172.21.6.27) by RTEXMBS05.realtek.com.tw (172.21.6.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 20 Oct 2023 11:49:28 +0800 Received: from localhost.localdomain (172.21.252.101) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server id 15.1.2507.17 via Frontend Transport; Fri, 20 Oct 2023 11:49:28 +0800 From: Jyan Chou To: , , CC: , , , , , , , , , , , , , , , Subject: [PATCH V3][1/4] mmc: solve DMA boundary limitation of CQHCI driver Date: Fri, 20 Oct 2023 11:49:18 +0800 Message-ID: <20231020034921.1179-2-jyanchou@realtek.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231020034921.1179-1-jyanchou@realtek.com> References: <20231020034921.1179-1-jyanchou@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-KSE-ServerInfo: RTEXMBS05.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 19 Oct 2023 20:51:51 -0700 (PDT) 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 --- 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 | 8 +++++++- drivers/mmc/host/cqhci.h | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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..fded53fc2a0b 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 { @@ -289,6 +290,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); @@ -322,6 +325,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 -- 2.42.0