Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp587090ybz; Wed, 15 Apr 2020 14:36:36 -0700 (PDT) X-Google-Smtp-Source: APiQypLrlDAPtmo7mgqPCAUQhgAoZ4CH6/kCxiqRVXMXub6XM8nRtDeUh4Ftl+OoAhJRiQn3hu0Z X-Received: by 2002:aa7:cf1a:: with SMTP id a26mr27123553edy.12.1586986596007; Wed, 15 Apr 2020 14:36:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586986596; cv=none; d=google.com; s=arc-20160816; b=KvUN/4nUukt05tKlgZ3I/pcv+/NA0iVoaFK+dZOKhggSAw9N0bX9/h8Dp6R9nxLp6f k2ZOTgqeENvqMzEpaS+BmuJ2AK/wyFH5XHfWbNRcjmjjBjsz3uqQ22SvueH0V5+N9LAi fQFIBVNRSOHrCoHjP/4EgElt19RCM1kAQBAKImtZohsBVqevaKPD8vxf8JAl86OQQj9v wLkBPSTNy5smlVHnZn0TQYX1Cte04Q0hsh9S3ATqRM6u12rD1wmS4jAmuB5t6splOApe GE6OVP0pq29eo3p1H0D/oFA3r+YX0CCkTA+5bmxCz3G+IxtK3SMZYBhbcU1hp+dO2Oaj AFkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject:ironport-sdr :ironport-sdr; bh=qSq9EkHDRoEhWY9+wBF3tswVsRJiyGJewUSmE4d6XiU=; b=Mbfp4TmOcoAyzF+Z+TtO41pdv1y/qyrOCfsMR/NxRHeLezNCBawjlabbCI3Zq/hHr/ iblo+cNVzvSfHGflxQ3VfXDyXuOXU3yEgiibv6oKlpwbQDFkpI/AVxaaaVUUuTeakreC mKJY6tkxSdoLze6I+H8vuARQJq9aNLkkEqzZirrP7DGwGyO3AOzAcD6tGJ+yMR0lK7Fq 0YERBQkPUa3iNBGjWxTwhfT0AB688POeOWxaj7N6zKEKep1D+RWt6RAxccbW/dakj1oN tUmsk7n0rYWGzUTsyu4CuliEPUXz8ohw25V9PqofxiPig1kkhdJ4f4tktss5TvusFtoi Zo7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e4si4630377edm.570.2020.04.15.14.36.12; Wed, 15 Apr 2020 14:36:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732848AbgDNNtU (ORCPT + 99 others); Tue, 14 Apr 2020 09:49:20 -0400 Received: from mga12.intel.com ([192.55.52.136]:30458 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388105AbgDNNss (ORCPT ); Tue, 14 Apr 2020 09:48:48 -0400 IronPort-SDR: Wnz1yPzBLW0c1HLt3uEdhL1QT150Y4SrgB5i9x6/WMFQFu1lh/8Xl1QvR+J3PUk5x4V5KC1T3p z6Uvo+D2ukFg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 06:48:47 -0700 IronPort-SDR: Ny/ZagQyHiMzUsJbw7iCuEBiMwf3T11gCmuZPUzB0PbQQ1XB5A6ROCjYYxclPkrI+XrQKUqnLl x90OkNyxbUtQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,382,1580803200"; d="scan'208";a="243817401" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.87]) ([10.237.72.87]) by fmsmga007.fm.intel.com with ESMTP; 14 Apr 2020 06:48:45 -0700 Subject: Re: [PATCH v5 2/3] mmc: host: sdhci: Implement the request_atomic() API To: Baolin Wang , ulf.hansson@linaro.org Cc: arnd@arndb.de, orsonzhai@gmail.com, zhang.lyra@gmail.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org References: <9ed34afa9fb42e0c234065cac5401d7826942b55.1586744073.git.baolin.wang7@gmail.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <9d118792-8551-7988-464e-162550bc6614@intel.com> Date: Tue, 14 Apr 2020 16:47:55 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <9ed34afa9fb42e0c234065cac5401d7826942b55.1586744073.git.baolin.wang7@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/04/20 5:46 am, Baolin Wang wrote: > Implement the request_atomic() ops for the sdhci driver to process > one request in the atomic context if the card is nonremovable. > > Moreover, we should return BUSY flag if controller has not released > the inhibit bits to allow HSQ trying to send request again in non-atomic > context. > > Suggested-by: Adrian Hunter > Signed-off-by: Baolin Wang Acked-by: Adrian Hunter > --- > drivers/mmc/host/sdhci.c | 34 ++++++++++++++++++++++++++++++++++ > drivers/mmc/host/sdhci.h | 1 + > 2 files changed, 35 insertions(+) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 10b9570f48aa..0baef595de26 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -2144,6 +2144,40 @@ void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) > } > EXPORT_SYMBOL_GPL(sdhci_request); > > +int sdhci_request_atomic(struct mmc_host *mmc, struct mmc_request *mrq) > +{ > + struct sdhci_host *host = mmc_priv(mmc); > + struct mmc_command *cmd; > + unsigned long flags; > + int ret = 0; > + > + spin_lock_irqsave(&host->lock, flags); > + > + if (sdhci_present_error(host, mrq->cmd, true)) { > + sdhci_finish_mrq(host, mrq); > + goto out_finish; > + } > + > + cmd = sdhci_manual_cmd23(host, mrq) ? mrq->sbc : mrq->cmd; > + > + /* > + * The HSQ may send a command in interrupt context without polling > + * the busy signaling, which means we should return BUSY if controller > + * has not released inhibit bits to allow HSQ trying to send request > + * again in non-atomic context. So we should not finish this request > + * here. > + */ > + if (!sdhci_send_command(host, cmd)) > + ret = -EBUSY; > + else > + sdhci_led_activate(host); > + > +out_finish: > + spin_unlock_irqrestore(&host->lock, flags); > + return ret; > +} > +EXPORT_SYMBOL_GPL(sdhci_request_atomic); > + > void sdhci_set_bus_width(struct sdhci_host *host, int width) > { > u8 ctrl; > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index a7e469c00617..4bd70da7aa00 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -776,6 +776,7 @@ void sdhci_set_power_and_bus_voltage(struct sdhci_host *host, > 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); > +int 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); >