From patchwork Thu Aug 15 14:32:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 2845191 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2A39CBF546 for ; Thu, 15 Aug 2013 14:33:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86ADF2030D for ; Thu, 15 Aug 2013 14:33:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D41B920384 for ; Thu, 15 Aug 2013 14:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758226Ab3HOOc5 (ORCPT ); Thu, 15 Aug 2013 10:32:57 -0400 Received: from ns.mm-sol.com ([212.124.72.66]:52513 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757786Ab3HOOcL (ORCPT ); Thu, 15 Aug 2013 10:32:11 -0400 Received: from mms.int.mm-sol.com (unknown [172.18.0.3]) by extserv.mm-sol.com (Postfix) with ESMTPSA id BBFF2C697; Thu, 15 Aug 2013 17:32:10 +0300 (EEST) From: Georgi Djakov To: cjb@laptop.org Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Georgi Djakov , Krishna Konda Subject: [PATCH 4/5] mmc: sdhci: add quirk for max_discard calculation Date: Thu, 15 Aug 2013 17:32:19 +0300 Message-Id: <1376577140-2652-5-git-send-email-gdjakov@mm-sol.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1376577140-2652-1-git-send-email-gdjakov@mm-sol.com> References: <1376577140-2652-1-git-send-email-gdjakov@mm-sol.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The SDHCI driver by default specifies a parameter that causes the core layer to calculate a max discard value which will be set on the mmc queue. Unfortunately the value calculated because of this would be very small compared to what comes in by default. As a result of this, any secure discard kind of operations are very slow. Add quirk so that the SDHCI host can use the default max_discard value. CC: Krishna Konda Signed-off-by: Georgi Djakov --- drivers/mmc/host/sdhci.c | 3 ++- include/linux/mmc/sdhci.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 39544b4..e21bb6f 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2957,7 +2957,8 @@ int sdhci_add_host(struct sdhci_host *host) if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) host->timeout_clk = mmc->f_max / 1000; - mmc->max_discard_to = (1 << 27) / host->timeout_clk; + if (!(host->quirks2 & SDHCI_QUIRK2_USE_MAX_DISCARD_SIZE)) + mmc->max_discard_to = (1 << 27) / host->timeout_clk; mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_ERASE | MMC_CAP_CMD23; diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index 603ef9d..f42f6dd 100644 --- a/include/linux/mmc/sdhci.h +++ b/include/linux/mmc/sdhci.h @@ -104,6 +104,10 @@ struct sdhci_host { #define SDHCI_QUIRK2_SLOW_INT_CLR (1<<7) /* Ignore CMD CRC errors for tuning commands */ #define SDHCI_QUIRK2_IGNORE_CMDCRC_FOR_TUNING (1<<8) +/* Dont use the max_discard_to so that the maximum discard unit gets picked by + * the mmc queue. Otherwise, it takes a long time for secure discard kind of + * operations to complete. */ +#define SDHCI_QUIRK2_USE_MAX_DISCARD_SIZE (1<<9) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */