Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4241411ybf; Tue, 3 Mar 2020 23:42:50 -0800 (PST) X-Google-Smtp-Source: ADFU+vveqUxfAfHlY+GZnSDG8puPoFuDug97RQn7xOZhyqUKL6o7OJaWXIo4GKndVt1c0eWf2vAe X-Received: by 2002:a05:6830:1bc3:: with SMTP id v3mr1425670ota.310.1583307770118; Tue, 03 Mar 2020 23:42:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583307770; cv=none; d=google.com; s=arc-20160816; b=IySTZU8mhh08T0KMrIIFPpi3nESFV80UD+i4TLdGvg0/J4GiA2OfIXd2gqSkc60+AG /vQM2Tf+jf5LFQ/JeYbfOUw4U90TM4hFKEdBjWjT+8z5aUB1nnYeRQ46Gc+2N6sTAbKn LyOLd3NGvuKKuONlo2y+gJo9E+jPgvXreHe7xOZVP0vuwp6NgSlhKeRWaQRkCLFBRCLN K3T5gGFFlp0GoB+iJSM5vf5T3FCxe1X6OR4hSaDpg6NK+8m0iBVhFmhBSSt+9ZrWo7Ti pii4XhF5+5Gj7o3ogUahCqCc87UFh7N1sIILi+8YOnqbfw9Eb9mPq5T40VRca+zwp9Cj pwRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=UuO82t2CTJ8u+mIQWhpCsbN6XGcm5YIydRt9WbDocTg=; b=ClLaqLEa8y7C1Qaos18/MvhD4430j0oVZ1Z0o4QD9GklGCMf1rGPT4UJmaLKtpAejn 3dHUBjl95soUSqoRC8wMjtBEIk8nJx7vVn/Jts/y5KHQkfkHnaTvCpAc7IOvHTCJU8n1 qV9/W3TodVWBz5o+Otl+me/6TvpE+pDrzXxg4Z1Isik24xkAputRtP7VYQhyfCUOgc7F 1ax3Al7x6Tl3EZvgtF4UDphGroWqBBvhsZt2VjzxZM4vtxxlVDOFtY1vM5Il8f2cMxu8 dHvamIBKPabt6dtvY3k91ikge6Fx7sjRAEBPhAt3i5W5I+l9Jst8fnMc1fJWJokNIWNg NVng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=q5+LEcMc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d24si660409oij.121.2020.03.03.23.42.38; Tue, 03 Mar 2020 23:42:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=q5+LEcMc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728671AbgCDHm0 (ORCPT + 99 others); Wed, 4 Mar 2020 02:42:26 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:35977 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728486AbgCDHmZ (ORCPT ); Wed, 4 Mar 2020 02:42:25 -0500 Received: by mail-pj1-f66.google.com with SMTP id d7so570885pjw.1; Tue, 03 Mar 2020 23:42:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=UuO82t2CTJ8u+mIQWhpCsbN6XGcm5YIydRt9WbDocTg=; b=q5+LEcMcECo3hiwQqVqhgnOiB10Cx8lLXJrUNQts+N1ziH7dAOmF8WZ0jlhgSq+5sx 3LuhT4Fk/awSwYJH4qaa0Z/frz47C4b+WNVch7n+OGd9hqQzEk+6oFsZXw9/mYQQZAIj 3hTnIBKNbVnEcxsJ3IT1eA7cWAjxOT0N2dPoqDPlP+uQvz3K9TqWWG2HtXz9rAac3KtH 7ZFmXUYjkr/BZVYHO+j0BJhuwRQvtUWXAyPtB2ZF1fRSow7JIAgA6MMGFx38tdCb9LdW qDicAAF/f+QxVmufCgAKJbNdr1Mmkisbh+ZrCGQh6J9XS7i6jjnM3OUkSwC3ngEjOd1y oybQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=UuO82t2CTJ8u+mIQWhpCsbN6XGcm5YIydRt9WbDocTg=; b=Y2doG22wUls5ZQc5ZtrN7XWcJGCc689qubHAwpIO8QGpr54M6vJ1btKdIXJGqA4WAW yEsp9mvA84q5UHhGSPuocmAyvlVJ3mqKenpSkfkW0J9XNEU3vMk/Snbjif4Cx4pOiE0U OSY2Ech/n+jXENKA+X72pBkjDCDe4KpNjjE8PE32TRtv1coum3YLf6owE6lnJROwV04Y 2uYLxpepJW/B+A4sFhTrpctBKnywhMJa9eSYThsSuwNtWI0v8am6AOdl0/4miAOj+0Fd p4MFU2k3IQ8MdsIiLiNBSCibjOjMmbZPX15F26ewotTqroVxbblD35CivxJHWnTtSiXm lRWA== X-Gm-Message-State: ANhLgQ0J02utmySafO+37QX9aXIEYKecX4d3CTtEz5IW31WlMtn117xB kwqWq463DhHxJVV0g0NNSTY= X-Received: by 2002:a17:90a:3324:: with SMTP id m33mr1774085pjb.167.1583307743416; Tue, 03 Mar 2020 23:42:23 -0800 (PST) Received: from sh03840pcu.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id k24sm24097374pgm.61.2020.03.03.23.42.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Mar 2020 23:42:23 -0800 (PST) From: Baolin Wang To: adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: orsonzhai@gmail.com, zhang.lyra@gmail.com, baolin.wang7@gmail.com, arnd@arndb.de, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH 1/3] mmc: host: Introduce the request_atomic() for the host Date: Wed, 4 Mar 2020 15:42:00 +0800 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The SD host controller can process one request in the atomic context if the card is nonremovable, which means we can submit next request in the irq hard handler when using the MMC software queue to reduce the latency. Thus this patch adds a new API request_atomic() for the host controller and implement it for the SD host controller. Suggested-by: Adrian Hunter Signed-off-by: Baolin Wang --- drivers/mmc/host/sdhci.c | 27 +++++++++++++++++++-------- drivers/mmc/host/sdhci.h | 1 + include/linux/mmc/host.h | 3 +++ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 9c37451..4febbcb 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2016,17 +2016,12 @@ void sdhci_set_power(struct sdhci_host *host, unsigned char mode, * * \*****************************************************************************/ -void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) +static void sdhci_start_request(struct mmc_host *mmc, struct mmc_request *mrq, + int present) { - struct sdhci_host *host; - int present; + struct sdhci_host *host = mmc_priv(mmc); unsigned long flags; - host = mmc_priv(mmc); - - /* Firstly check card presence */ - present = mmc->ops->get_cd(mmc); - spin_lock_irqsave(&host->lock, flags); sdhci_led_activate(host); @@ -2043,6 +2038,22 @@ void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) spin_unlock_irqrestore(&host->lock, flags); } + +void sdhci_request_atomic(struct mmc_host *mmc, struct mmc_request *mrq) +{ + sdhci_start_request(mmc, mrq, 1); +} +EXPORT_SYMBOL_GPL(sdhci_request_atomic); + +void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) +{ + int present; + + /* Firstly check card presence */ + present = mmc->ops->get_cd(mmc); + + sdhci_start_request(mmc, mrq, present); +} EXPORT_SYMBOL_GPL(sdhci_request); void sdhci_set_bus_width(struct sdhci_host *host, int width) diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index cac2d97..5507a73 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -775,6 +775,7 @@ void sdhci_set_power(struct sdhci_host *host, unsigned char mode, void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, unsigned short vdd); void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq); +void sdhci_request_atomic(struct mmc_host *mmc, struct mmc_request *mrq); void sdhci_set_bus_width(struct sdhci_host *host, int width); void sdhci_reset(struct sdhci_host *host, u8 mask); void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 562ed06..db5e59c 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -92,6 +92,9 @@ struct mmc_host_ops { int err); void (*pre_req)(struct mmc_host *host, struct mmc_request *req); void (*request)(struct mmc_host *host, struct mmc_request *req); + /* Submit one request to host in atomic context. */ + void (*request_atomic)(struct mmc_host *host, + struct mmc_request *req); /* * Avoid calling the next three functions too often or in a "fast -- 1.9.1