From patchwork Mon Sep 17 12:21:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Ball X-Patchwork-Id: 1466771 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 32CAE3FCFC for ; Mon, 17 Sep 2012 12:21:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756117Ab2IQMVf (ORCPT ); Mon, 17 Sep 2012 08:21:35 -0400 Received: from void.printf.net ([89.145.121.20]:33861 "EHLO void.printf.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755969Ab2IQMVf (ORCPT ); Mon, 17 Sep 2012 08:21:35 -0400 Received: from 173-166-109-250-newengland.hfc.comcastbusiness.net ([173.166.109.250] helo=pullcord.laptop.org) by void.printf.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1TDaKJ-0000nS-1d; Mon, 17 Sep 2012 13:21:23 +0100 From: Chris Ball To: Jaehoon Chung Cc: linux-mmc , Kyungmin Park , Maya Erez , Konstantin Dorfman , Ulf Hansson , Adrian Hunter , Per FORLIN , "svenkatr\@ti.com" , Saugata Das , Hanumath Prasad , Sebastian Rasmussen , "Dong\, Chuanxiao" , Minchan Kim Subject: Re: [RESEND PATCH v12] mmc: support BKOPS feature for eMMC References: <5056E25A.6070207@samsung.com> <5056FD8E.5090200@samsung.com> <5056FEF8.6040700@samsung.com> Date: Mon, 17 Sep 2012 08:21:38 -0400 In-Reply-To: <5056FEF8.6040700@samsung.com> (Jaehoon Chung's message of "Mon, 17 Sep 2012 19:44:08 +0900") Message-ID: User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.90 (gnu/linux) MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Hi Jaehoon, On Mon, Sep 17 2012, Jaehoon Chung wrote: > Enable eMMC background operations (BKOPS) feature. > > If URGENT_BKOPS is set after a response, note that BKOPS > are required. Immediately run BKOPS if required. > read/write operations should be requested during BKOPS(LEVEL-1), > then issue HPI to interrupt the ongoing BKOPS > and service the foreground operation. > (This patch is only control the LEVEL2/3.) > > When repeating the writing 1GB data, at a certain time, performance is decreased. > At that time, card is also triggered the Level-3 or Level-2. > After running bkops, performance is recovered. > > Future considerations > * Check BKOPS_LEVEL=1 and start BKOPS in a preventive manner. > * Interrupt ongoing BKOPS before powering off the card. > * How get BKOPS_STATUS value.(periodically send ext_csd command?) > * If use periodic bkops, also consider runtime_pm control. > > Signed-off-by: Jaehoon Chung > Signed-off-by: Kyungmin Park > Signed-off-by: Konstantin Dorfman > Reviewed-by: Maya Erez Thanks, looks good now. Is it okay if I apply this stylistic patch before pushing to mmc-next? diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 4749557..044cd01 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -43,8 +43,8 @@ #include "sdio_ops.h" /* - * The Background operation can take a long time, depends on the house keeping - * operations the card has to peform + * Background operations can take a long time, depending on the housekeeping + * operations the card has to perform. */ #define MMC_BKOPS_MAX_TIMEOUT (4 * 60 * 1000) /* max time to wait in ms */ @@ -255,11 +255,11 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) /** * mmc_start_bkops - start BKOPS for supported cards * @card: MMC card to start BKOPS - * @form_exception: A flags to indicate if this function was - * called due to an exception raised by the card + * @form_exception: A flag to indicate if this function was + * called due to an exception raised by the card * * Start background operations whenever requested. - * when the urgent BKOPS bit is set in a R1 command response + * When the urgent BKOPS bit is set in a R1 command response * then background operations should be started immediately. */ void mmc_start_bkops(struct mmc_card *card, bool from_exception) @@ -275,7 +275,7 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception) err = mmc_read_bkops_status(card); if (err) { - pr_err("%s: Didn't read bkops status : %d\n", + pr_err("%s: Failed to read bkops status: %d\n", mmc_hostname(card->host), err); return; } @@ -283,8 +283,8 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception) if (!card->ext_csd.raw_bkops_status) return; - if (card->ext_csd.raw_bkops_status < EXT_CSD_BKOPS_LEVEL_2 - && (from_exception)) + if (card->ext_csd.raw_bkops_status < EXT_CSD_BKOPS_LEVEL_2 && + from_exception) return; mmc_claim_host(card->host); @@ -299,8 +299,8 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception) err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BKOPS_START, 1, timeout, use_busy_signal); if (err) { - pr_warn("%s: error %d starting bkops\n", - mmc_hostname(card->host), err); + pr_warn("%s: Error %d starting bkops\n", + mmc_hostname(card->host), err); goto out; } @@ -429,9 +429,9 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host, * Check BKOPS urgency for each R1 response */ if (host->card && mmc_card_mmc(host->card) && - ((mmc_resp_type(host->areq->mrq->cmd) == MMC_RSP_R1) || - (mmc_resp_type(host->areq->mrq->cmd) == MMC_RSP_R1B)) && - (host->areq->mrq->cmd->resp[0] & R1_EXCEPTION_EVENT)) + ((mmc_resp_type(host->areq->mrq->cmd) == MMC_RSP_R1) || + (mmc_resp_type(host->areq->mrq->cmd) == MMC_RSP_R1B)) && + (host->areq->mrq->cmd->resp[0] & R1_EXCEPTION_EVENT)) mmc_start_bkops(host->card, true); } @@ -477,7 +477,7 @@ EXPORT_SYMBOL(mmc_wait_for_req); * @card: the MMC card associated with the HPI transfer * * Issued High Priority Interrupt, and check for card status - * util out-of prg-state. + * until out-of prg-state. */ int mmc_interrupt_hpi(struct mmc_card *card) { @@ -572,8 +572,8 @@ EXPORT_SYMBOL(mmc_wait_for_cmd); * mmc_stop_bkops - stop ongoing BKOPS * @card: MMC card to check BKOPS * - * Send HPI command to stop ongoing background operations, - * to allow rapid servicing of foreground operations,e.g. read/ + * Send HPI command to stop ongoing background operations to + * allow rapid servicing of foreground operations, e.g. read/ * writes. Wait until the card comes out of the programming state * to avoid errors in servicing read/write requests. */ @@ -585,8 +585,8 @@ int mmc_stop_bkops(struct mmc_card *card) err = mmc_interrupt_hpi(card); /* - * if err is EINVAL, it's status that can't issue HPI. - * it should complete the BKOPS. + * If err is EINVAL, we can't issue an HPI. + * It should complete the BKOPS. */ if (!err || (err == -EINVAL)) { mmc_card_clr_doing_bkops(card); @@ -603,12 +603,12 @@ int mmc_read_bkops_status(struct mmc_card *card) u8 *ext_csd; /* - * In future work, we should be consider storing the entire ext_csd. + * In future work, we should consider storing the entire ext_csd. */ ext_csd = kmalloc(512, GFP_KERNEL); if (!ext_csd) { - pr_err("%s: could not allocate a buffer to " - "receive the ext_csd.\n", mmc_hostname(card->host)); + pr_err("%s: could not allocate buffer to receive the ext_csd.\n", + mmc_hostname(card->host)); return -ENOMEM; } @@ -2470,15 +2470,14 @@ int mmc_suspend_host(struct mmc_host *host) mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { - if (host->bus_ops->suspend) { if (mmc_card_doing_bkops(host->card)) { err = mmc_stop_bkops(host->card); if (err) goto out; } - } err = host->bus_ops->suspend(host); + } if (err == -ENOSYS || !host->bus_ops->resume) { /* @@ -2566,10 +2565,10 @@ int mmc_pm_notify(struct notifier_block *notify_block, case PM_HIBERNATION_PREPARE: case PM_SUSPEND_PREPARE: if (host->card && mmc_card_mmc(host->card) && - mmc_card_doing_bkops(host->card)) { + mmc_card_doing_bkops(host->card)) { err = mmc_stop_bkops(host->card); if (err) { - pr_err("%s didn't stop bkops\n", + pr_err("%s: didn't stop bkops\n", mmc_hostname(host)); return err; } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 9c5caa6..7509de1 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -463,15 +463,15 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } if (card->ext_csd.rev >= 5) { - /* check whether the eMMC card support BKOPS */ + /* check whether the eMMC card supports BKOPS */ if (ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1) { card->ext_csd.bkops = 1; card->ext_csd.bkops_en = ext_csd[EXT_CSD_BKOPS_EN]; card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; if (!card->ext_csd.bkops_en) - pr_info("%s: Didn't set BKOPS_EN bit!\n", - mmc_hostname(card->host)); + pr_info("%s: BKOPS_EN bit is not set\n", + mmc_hostname(card->host)); } /* check whether the eMMC card supports HPI */