Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp976042lqp; Thu, 23 May 2024 05:58:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWm/3Yg39xsQi6CRZWkFbwm6sGJhDNLa1EBc2SZmkG3u1Smdb38Voa6cLn+0MjJM+t9K5RQfTvtuBgey/v8d2cWCIqhgTk14JXJur051w== X-Google-Smtp-Source: AGHT+IGqglSDoI7BpVQzHjCBKjMDMbo9mPefR4S5ZCFz4NbxLxfjqK+Tb9y/n/TlTamVgpSO2nQE X-Received: by 2002:a17:906:f913:b0:a61:89e6:70fe with SMTP id a640c23a62f3a-a6228084086mr383565566b.21.1716469130662; Thu, 23 May 2024 05:58:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716469130; cv=pass; d=google.com; s=arc-20160816; b=yfs1+u9LunnQ+8TIPpeuHgS6TMbsbHGRPy4ViqSI/IlF60LZS4iorOefpMkkXNOn/8 O3zygEKNTkbQsDyCgF9J+DDGN/LnaBBko3hjB6Q/UdwPz7Pd9iwuq+mrgv1W92XzKm4N GmPPnYfFWqs0L8+dp7noKM233VexOojw+LznrUOIiQjWzxnl2LwXXUP/JrfVqvVCRGt5 aJMHZYROUTdJ1JR3CUnmwrV10Ggq75izuJf94lrF8x2xs8T08BRv49qiUFVqrxg7KzMh 7qBAalKWUfEYveuKru/BC2Dd2XJPy8q7qbgKNVaFISUTiqa0yuc60MsNzo9EjTbuZ/To Uuhw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:wdcironportexception:ironport-sdr:dkim-signature; bh=ssGr75x9hs8AkdoD2ze2So9MV1mRcRNdnEdXMmnIYOk=; fh=X0Lb6G6jJE8+QeYtFGxv2g5f8eI/IotqH0fFq08ifqY=; b=cXbbVzue27SDBew4/TxiZBCCt6Np87r5vCd7uiQOFkUx8cz9bC07obxa0T1jwL2d/q IJfbZTTyuMWCbs7fDNQDunxiXGXB0y2Vntr/H/2OKeLwGJ9TkPlAKDE7WUC4hhqVf2c+ a6MwlRa59R6GQWu48bv3z7+6ytHcRHFNdV3Pgy8YPxL2niC7TdXrq69p61oeUty7JYuM Z1rIqnrsFSVBiusZmya+Vhja5Z+iiI+PTGRbu1RslBSekUuxE6xtKvI1Yh1eMw1oqEdd zMvg3QRaPAJ95/W0Otg/VV7s2lBc7If1rNYbv3Gjwrc5IWMqZPhhxbRMLErYYK2ZR1wq iKNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wdc.com header.s=dkim.wdc.com header.b=Mkd3Bh4L; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); spf=pass (google.com: domain of linux-kernel+bounces-187523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b4c455si1601149466b.442.2024.05.23.05.58.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 05:58:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@wdc.com header.s=dkim.wdc.com header.b=Mkd3Bh4L; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); spf=pass (google.com: domain of linux-kernel+bounces-187523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 677821F21EC8 for ; Thu, 23 May 2024 12:58:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A52C14A4ED; Thu, 23 May 2024 12:58:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="Mkd3Bh4L" Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ED598174C; Thu, 23 May 2024 12:58:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716469122; cv=none; b=rj3Z2ohpF+5N+wDSoxD01t0b0Cu/o4HCw69PFmlmh77r1buDJpBeDy7JwRU9x4cXJqJZq21aMyTZ4LKobCcZTLhnNYGtyGZAkyDrx4sv5Pe339HY7hkcbiz9jtfN5aAH6JNJBugccVZ1mvL+3my1boBcGQhDmZfnDdYF2LZHZzQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716469122; c=relaxed/simple; bh=oV2ZFplCblWKmN/I2j0dD142TAdaLRkSzUlqV4hF1yw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UVHOGJYw4BNsK2XFMA4H0XmPITH1HGxtfspuebeeBo4cLmBNLEMmsI2YQ/RvNVvfKN+xecVxukP17FuHrXnRF511aLxPJIiozviBwOhJ572ad1z+gQQK8D4p3J9y8VDUEUILaY71KLG17YZwpkn45TxJ+cqEEvmVkegKP78y1zo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=Mkd3Bh4L; arc=none smtp.client-ip=216.71.154.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1716469120; x=1748005120; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=oV2ZFplCblWKmN/I2j0dD142TAdaLRkSzUlqV4hF1yw=; b=Mkd3Bh4L9L4QcsfG96chEZ1gX7gfq0IvK4RMLWJ+LIyw5nYlYkLoLByc oolW+pbEayY/91spqDHckmLYDZa9jStsW7Zs11uIlA13ZJOh6uwBEUiIK M4DJOecVD14nhMUxP3OlHG5ZN0sJ0oYl5QVJJwQkY0eSKD0EqaKLNFaaJ TfKzGqn3+3thnDgObg0NQNnDvALzg8Eymm+QzH4+kk1kCf3YjUh8NojIJ foDvKRxPjtYz/U54vEBQaKpQ86bJGV4IC6VlfklM2C1H4EPsgzK233XQc eNl/eVhFYeWLB0tE90vCqrFbI97KXFoyulhG1ToKOH6XVKqniUoTNrgd+ A==; X-CSE-ConnectionGUID: B1vBICsYTTuwkvbP7gcZhQ== X-CSE-MsgGUID: K+g1x1t8Rg+4LYSgjzX96w== X-IronPort-AV: E=Sophos;i="6.08,182,1712592000"; d="scan'208";a="17062539" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 May 2024 20:58:39 +0800 IronPort-SDR: 664f3136_ZssmQlMpJAR0S2alNUERHDIT1Ml7xFl4ZRQpOX5+WaltTJS 0WIQvBy2mg1Myl1BL6ika/A38lJZM7LsO8ZFa7g== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 23 May 2024 05:06:14 -0700 WDCIronportException: Internal Received: from bxygm33.ad.shared ([10.45.31.229]) by uls-op-cesaip02.wdc.com with ESMTP; 23 May 2024 05:58:38 -0700 From: Avri Altman To: "Martin K . Petersen" Cc: Bart Van Assche , Bean Huo , Peter Wang , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Avri Altman Subject: [PATCH v5 0/3] scsi: ufs: Allow RTT negotiation Date: Thu, 23 May 2024 15:58:23 +0300 Message-ID: <20240523125827.818-1-avri.altman@wdc.com> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The rtt-upiu packets precede any data-out upiu packets, thus synchronizing the data input to the device: this mostly applies to write operations, but there are other operations that requires rtt as well. There are several rules binding this rtt - data-out dialog, specifically There can be at most outstanding bMaxNumOfRTT such packets. This might have an effect on write performance (sequential write in particular), as each data-out upiu must wait for its rtt sibling. UFSHCI expects bMaxNumOfRTT to be min(bDeviceRTTCap, NORTT). However, as of today, there does not appear to be no-one who sets it: not the host controller nor the driver. It wasn't an issue up to now: bMaxNumOfRTT is set to 2 after manufacturing, and wasn't limiting the write performance. UFS4.0, and specifically gear 5 changes this, and requires the device to be more attentive. This doesn't come free - the device has to allocate more resources to that end, but the sequential write performance improvement is significant. Early measurements shows 25% gain when moving from rtt 2 to 9. Therefore, set bMaxNumOfRTT to be min(bDeviceRTTCap, NORTT) as UFSHCI expects. v4 -> v5: Quiesce the queues before writing bMaxNumOfRTT (Bart) Make bDeviceRTTCap available in ufshcd_device_params_init() (Bart) v3 -> v4: Allow bMaxNumOfRTT to be configured via sysfs (Bart) v2 -> v3: Allow platform vendors to take precedence having their own rtt negotiation mechanism (Peter) v1 -> v2: bMaxNumOfRTT is a Persistent attribute - do not override if it was written (Bean) Avri Altman (3): scsi: ufs: Allow RTT negotiation scsi: ufs: Allow platform vendors to set rtt scsi: ufs: sysfs: Make max_number_of_rtt read-write Documentation/ABI/testing/sysfs-driver-ufs | 14 +++-- drivers/ufs/core/ufs-sysfs.c | 72 +++++++++++++++++++++- drivers/ufs/core/ufshcd-priv.h | 12 ++++ drivers/ufs/core/ufshcd.c | 53 ++++++++++++---- include/ufs/ufs.h | 2 + include/ufs/ufshcd.h | 4 ++ include/ufs/ufshci.h | 1 + 7 files changed, 139 insertions(+), 19 deletions(-) -- 2.34.1