Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp5877319ybx; Sun, 10 Nov 2019 23:39:15 -0800 (PST) X-Google-Smtp-Source: APXvYqyr31DgXL2YfEaMYGER2iGNTH1jI1BHOzl+NVdqWA5lhiGg+dLux1CwWZ3WGEMM4OX76+sN X-Received: by 2002:a50:90a6:: with SMTP id c35mr24798303eda.22.1573457954999; Sun, 10 Nov 2019 23:39:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573457954; cv=none; d=google.com; s=arc-20160816; b=BsDdqWflDKqdTTFxSBOZg3vsrUL82hNmLBvfdw5NzHIJnZobd3gYQ6gzdKdvo/A7NA Z7NpVAAVlfR85q/10y2iWrn0El8CeoHXu2+mSBePyApUbiGw6+vBcUotzadhNuL29lp5 oOR3osSLU9yW1s9fdSqDFsDONixTm3OOZVfEi3rnwwVZtBUBpu8L8Jh8MIWtcXLkldgf E1sncJgSQ9HQenC7/AGKGZmMq98ExIru6PQogTuLL1BdVxfQrNCG7JwssnCGOUV2afYF 2ALUFwRfnxHqCNfMvOAPY6CIIJENfCUf3evO2wwoMZkf5JQuvtcHmFxyLSYjjIHlmvtm yG5g== 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=i6cJtP2GLYXrWSbffAAlWqbiBaFJmvg9QhFIx0JCR4w=; b=CRALgAfrlUpAJnqhTPR1tT6rayIKRncj1xYpxfGu9vXBsjWCeer4P+uVxR9aG08SfJ dvUcNvDV1WPtZgyJA6GPtBqt/S5lMjxyQFYYDSb6CnBKjUX5DZorQYLFRCQN655jP5Ie hdXner8I26tJMVQPsEHHv0CpAIz3OeFanAbqQkN/CyZgwB3ew97QuXeOZ7+YKPFj3Ohv o27MJhj77afoLgmBiNeLeaMe+D5+FAbLLo4lJ38ZE1swO7YznYJq1v0Djf+9kyPmLEue wvemcptdt74+9IOZzqfjo67kLD1Nb9zsUooWPme6qPOT7ffWByRcKftR9jyxV171xnG2 Ysfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fDhq0K+/"; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k15si4009358ejr.327.2019.11.10.23.38.51; Sun, 10 Nov 2019 23:39:14 -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=@linaro.org header.s=google header.b="fDhq0K+/"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727043AbfKKHfa (ORCPT + 99 others); Mon, 11 Nov 2019 02:35:30 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:41326 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbfKKHf3 (ORCPT ); Mon, 11 Nov 2019 02:35:29 -0500 Received: by mail-pf1-f194.google.com with SMTP id p26so10095217pfq.8 for ; Sun, 10 Nov 2019 23:35:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=i6cJtP2GLYXrWSbffAAlWqbiBaFJmvg9QhFIx0JCR4w=; b=fDhq0K+/Rn0iuKKs10LO1snJBg6va0XLJdJa4Bz/h7Q5iuKxXTGigB77w3v0ezUGv7 wN9k5uqyPodAtGkyVOPY1YOlstq2rqxsBmFs+7tsqE/tF95NyFrwW0NiWsFmcMGxuSN6 7Xb7zSaRRZhZylx+27eHpbgWmeIuJJnbcxODRj7yqS8s6p6QeUUvcHiAsWaB9fQQviHo Hr4Xjv7NOWumj6n+AstBAJWIR3KJv8kWTHv8S9I8HlkSk1pAQnxR46/Cf6MoevHFfc+F 3B1CnqUYgyBVz60ZWMH/yaITJlVlDcDZ0zSZYP4AMXYEp4bRi42ls1WEsp+JLbcS/OFP PgeA== 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=i6cJtP2GLYXrWSbffAAlWqbiBaFJmvg9QhFIx0JCR4w=; b=q/l2tFHCVdsi6sNSlSGMj6BjH8TnubLvzKYdJFzXazzz+atfn9vc9Huv2T+GzxspQh FH5rwv7IZXZzBimwRSB3QtXbpbnrtBRgxOj09ZV3htegcFsw82YxoaVxzhUD6sVYnPsi Cqp3r0t4DbbGn7A3dPDQu7k7+RRAYzqIt16h7lY3pdGHSIag7yn133BuPjConF99VsRH SFA2tMXUilDVnzPO0F+0dPwpAmJSq9o+pFDi6H6quVqWWuBgd7jIkJTGo2rzRi3+zyq8 PEKiqcpYa1iNGrnrjSBILetV3PYwzGEUb+BjXpx4rJbDhL0+sGTucVpdt7Prz9VFuuZA SYMg== X-Gm-Message-State: APjAAAUUgffAU1wsCcGGa3xuMYe1kCHv36Ye6odv65BtxalrD1/i2GJT dDmrZNAW6z0bgMdUaHPVtn+AuQ== X-Received: by 2002:a63:9a12:: with SMTP id o18mr26772073pge.379.1573457727181; Sun, 10 Nov 2019 23:35:27 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id c184sm17345285pfc.159.2019.11.10.23.35.23 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Nov 2019 23:35:26 -0800 (PST) From: Baolin Wang To: adrian.hunter@intel.com, ulf.hansson@linaro.org, asutoshd@codeaurora.org Cc: orsonzhai@gmail.com, zhang.lyra@gmail.com, arnd@arndb.de, linus.walleij@linaro.org, vincent.guittot@linaro.org, baolin.wang@linaro.org, baolin.wang7@gmail.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 4/4] mmc: host: sdhci: Add a variable to defer to complete requests if needed Date: Mon, 11 Nov 2019 15:34:00 +0800 Message-Id: <119d3285ab610967b43f7c822dfdc0ebb8d521cb.1573456284.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 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 When using the host software queue, it will trigger the next request in irq handler without a context switch. But the sdhci_request() can not be called in interrupt context when using host software queue for some host drivers, due to the get_cd() ops can be sleepable. But for some host drivers, such as Spreadtrum host driver, the card is nonremovable, so the get_cd() ops is not sleepable, which means we can complete the data request and trigger the next request in irq handler to remove the context switch for the Spreadtrum host driver. Thus we still need introduce a variable in struct sdhci_host to indicate that we will always to defer to complete requests if the sdhci_request() can not be called in interrupt context for some host drivers, when using the host software queue. Suggested-by: Adrian Hunter Signed-off-by: Baolin Wang --- drivers/mmc/host/sdhci.c | 2 +- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 850241f..4bef066 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3035,7 +3035,7 @@ static inline bool sdhci_defer_done(struct sdhci_host *host, { struct mmc_data *data = mrq->data; - return host->pending_reset || + return host->pending_reset || host->always_defer_done || ((host->flags & SDHCI_REQ_USE_DMA) && data && data->host_cookie == COOKIE_MAPPED); } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index d89cdb9..a73ce89 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -533,6 +533,7 @@ struct sdhci_host { bool pending_reset; /* Cmd/data reset is pending */ bool irq_wake_enabled; /* IRQ wakeup is enabled */ bool v4_mode; /* Host Version 4 Enable */ + bool always_defer_done; /* Always defer to complete requests */ struct mmc_request *mrqs_done[SDHCI_MAX_MRQS]; /* Requests done */ struct mmc_command *cmd; /* Current command */ -- 1.7.9.5