From patchwork Wed Oct 9 11:21:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13828245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6367DCEDD87 for ; Wed, 9 Oct 2024 11:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=W1Fwj3/79g+NY6+faRKtNgwsGaf+fSmMjnCj8KQUGTo=; b=eOmwsJW2I9WpA7fjxnkO5l1l2l xJevBXn4IHg4ZvFgjCzeAMvz4odUsePnJKOJlD4+kBiGv1FB+gEswivOlRShsQyxAF8EityWevrTA bB+k6zdkGBSsL50Ors5IK3q65JaqBRbMP7vN7A4ByBTJJtNr6SLUWcQ0wJkgHviQ2NbpJqaKS5B7S UMePOYb+dmwjpQ3WFfZeelpnFiqjnJJhQELFYJ0OudOH7x1ke1S0EauwL+4d3PoQFNKquID7PgO2O W/odytlypwM/v61G2F77SbSU4YemepbtmLcIh3rBDUisS1QZemX0JIIzfpKyXFmYNAvTY/ApY1b+t UzstWbBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syVKB-000000097Vy-2etw; Wed, 09 Oct 2024 11:57:51 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syUla-000000092Yb-02Rn for linux-arm-kernel@bombadil.infradead.org; Wed, 09 Oct 2024 11:22:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=W1Fwj3/79g+NY6+faRKtNgwsGaf+fSmMjnCj8KQUGTo=; b=R88708Srn1eiUAkdpl37QgTrKD h8dt2rfrQy2jvsVTDkMSOoUlr/fP9A4zb1oyRM+zJ+mU0wdYyjMLlI+2p0vaPas1V4+cdKJbGZn0g XvDkI51vbtKQCCGou2oWK0AcZryKd7uMXhnM3Ru62aLgv6CKMAq7kVw+/ehrxMERscCyOYwN0yPH0 L6A+KdIrmkPTeV+p4WOB4jsEZsMm0bb+oOmbPKXE620E0mdrfwU9uQuxWd5Ryik95ze49a4IFv3Fm RhdikKW1A6x13FQ6OrmNox04GcIEVZw5bimhtciAIVLQgTLLpSC3Dl1rVruVnMnpJVkuPoeOESa4Y knkwQCKA==; Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syUlX-00000004vQz-0eva for linux-arm-kernel@lists.infradead.org; Wed, 09 Oct 2024 11:22:04 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42f6bec84b5so69070195e9.1 for ; Wed, 09 Oct 2024 04:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728472921; x=1729077721; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W1Fwj3/79g+NY6+faRKtNgwsGaf+fSmMjnCj8KQUGTo=; b=G53h9vfGXoMvlNAVcwipngeeOXO7AZaXgp7fLZlyX15TYzi5OX95116G4yOtPE34cJ l1JYDJ4Y/zqhsx51NVzHUN9jLv9PUoK07P4ToxwCcfRS33J9BxTD50GdRnQK8Bn07yVm f5//T2IUD6FIPSoWC6TduLK3DRZBllLaCJQ+fopPzIBGKlMOB+0jnHEW5J0DHC+4DGlm aVo2aDYIzHPILo2/1WFzVVGWXjS+X32Kx5zo0pRBdDpUljbIPh7WfoMPfDIVaKuHXLac sR0iQtTuHkQPeWlrN2TdPMHig2eyDdsA804FQ7D3iBqrh8OsUoBM4mNqk4X3ouE03bhX QhVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728472921; x=1729077721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W1Fwj3/79g+NY6+faRKtNgwsGaf+fSmMjnCj8KQUGTo=; b=CZd6TuwDKOTWaNRDD95Q5xGU99vmld9MBbeffVp634AlRGE3hKyeGHAAJh8s9Ne1o6 s509vQtBi6j8KfD3ciUxcqcjwzsslx9KVGD5tHdnzw8BPdU6FLC8Xh5iB8N4HeSAtKPe wd4/NS/Hc6meAE/GDCAeESDJry/TelGsAXMe9fKr33a42MK+7forVtqAuA6cSD472Uhl ZiycTukA5q+LjrkvWs2vDoEwkKMvZf4/SBe4HjQsS/wTGWgKk+ZXJNkd3Tb7kVMojVpE hqokQexjLWu/l293YcehF40w+dcKC46170SUN9PRzoSxwnP900LA8t/WdAf3wQWnIEHd eQMQ== X-Forwarded-Encrypted: i=1; AJvYcCUfIjTttU6GvYdUoyFIPenuzIR2mU8krJVCSRshagp1OUzBQoc3QyfymTyefnqp6sbQa3C+PlLUvCnOBoJgTBhf@lists.infradead.org X-Gm-Message-State: AOJu0YxByUAOCihRmb+/ciAAkLNy4d6O1TEyOiYBOs0tclQOKu8g0TA3 vj67YWydE75WyOEWUDCXBMNqiw+MBjFeoh0cW226Ce6f05RYJ1eEpBRi7qwqEiT6x5JA6hi08UB x X-Google-Smtp-Source: AGHT+IGhYNO9ZBnMSQoh0ZgHAq4d+L9zcAuCJO5c+hulGqbv+vwl+vbBiaHCglEGvUH+mq9MA+vOBw== X-Received: by 2002:a05:600c:4ec7:b0:42c:d74b:eb26 with SMTP id 5b1f17b1804b1-430ccf48471mr16078145e9.21.1728472920765; Wed, 09 Oct 2024 04:22:00 -0700 (PDT) Received: from gpeter-l.lan ([145.224.65.7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4310c3dcdcbsm12331445e9.0.2024.10.09.04.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 04:22:00 -0700 (PDT) From: Peter Griffin To: alim.akhtar@samsung.com, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com, avri.altman@wdc.com, bvanassche@acm.org, krzk@kernel.org Cc: tudor.ambarus@linaro.org, andre.draszik@linaro.org, kernel-team@android.com, willmcvicker@google.com, linux-scsi@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Griffin Subject: [PATCH 7/7] scsi: ufs: exynos: add gs101_ufs_drv_init() hook and enable WriteBooster Date: Wed, 9 Oct 2024 12:21:41 +0100 Message-ID: <20241009112141.1771087-8-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog In-Reply-To: <20241009112141.1771087-1-peter.griffin@linaro.org> References: <20241009112141.1771087-1-peter.griffin@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241009_122203_237874_216C08C0 X-CRM114-Status: GOOD ( 15.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Factor out the common code into a new exynos_ufs_shareability() function and provide a dedicated gs101_drv_init() hook. This allows us to enable WriteBooster capability (UFSHCD_CAP_WB_EN) in a way that doesn't effect other SoCs supported in this driver. WriteBooster improves write speeds by enabling a pseudo SLC cache. Using the `fio seqwrite` test we can achieve speeds of 945MB/s with this feature enabled (until the cache is exhausted) before dropping back to ~260MB/s (which are the speeds we see without the WriteBooster feature enabled). Assuming the UFSHCD_CAP_WB_EN capability is set by the host then WriteBooster can also be enabled and disabled via sysfs so it is possible for the system to only enable it when extra write performance is required. Signed-off-by: Peter Griffin --- drivers/ufs/host/ufs-exynos.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index d4e786afbbbc..b0ccff7ca3fb 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -203,7 +203,7 @@ static int exynos7_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) return 0; } -static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) +static int exynos_ufs_shareability(struct device *dev, struct exynos_ufs *ufs) { /* IO Coherency setting */ if (ufs->sysreg) { @@ -215,6 +215,21 @@ static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) return 0; } +static int gs101_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) +{ + struct ufs_hba *hba = ufs->hba; + + /* Enable WriteBooster */ + hba->caps |= UFSHCD_CAP_WB_EN; + + return exynos_ufs_shareability(dev, ufs); +} + +static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) +{ + return exynos_ufs_shareability(dev, ufs); +} + static int exynosauto_ufs_post_hce_enable(struct exynos_ufs *ufs) { struct ufs_hba *hba = ufs->hba; @@ -2124,7 +2139,7 @@ static const struct exynos_ufs_drv_data gs101_ufs_drvs = { .opts = EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR | EXYNOS_UFS_OPT_UFSPR_SECURE | EXYNOS_UFS_OPT_TIMER_TICK_SELECT, - .drv_init = exynosauto_ufs_drv_init, + .drv_init = gs101_ufs_drv_init, .pre_link = gs101_ufs_pre_link, .post_link = gs101_ufs_post_link, .pre_pwr_change = gs101_ufs_pre_pwr_change,