Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp82593lqo; Wed, 15 May 2024 22:51:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwAq6xcafKzqKyLPOTDowhoJm1r1y4w9Tvfc3YdYKeZ2wqqI8CQYY2LwbIikYHJkPEU1MOp0m0WaxjOyRht2TjQKsRAkua0SqbNjwi/A== X-Google-Smtp-Source: AGHT+IHa89iHmc3zR1tgpa/56uWl+xkFOsqQRuElfO2bNDgfYigOrBcilZCz81ljDNbP8t/lrJ32 X-Received: by 2002:a05:6a20:d70b:b0:1af:d6dc:86b9 with SMTP id adf61e73a8af0-1afde1faeb8mr17969159637.53.1715838713827; Wed, 15 May 2024 22:51:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715838713; cv=pass; d=google.com; s=arc-20160816; b=ePFHrzPrM7iv8qeIPUWt/PbBDFFfhdjecxyTXHZdm5+VM4LjIsn0GFYg9G6ey+Hj7S jxQRgOtuiABhp5TaeNbXvYuwD7F9r9bZCerOLHuDizWQFRkQSyH3Ginu3CKTxCgVS+Jp ioZi0VTrnLv8yBCIqpBY+byMGO2me3MQab6I8afT9+Pdsj/WqZRpzgGftDYiX4PVgJh0 6LzfIjgauiLBeki1ukR0gjj55b9+jL9fwZGERzT7FetYA7+zLkYwEy3TuNxNQ1Nlz7bW vW0FT4c90eK4baVQTlc2q11zu3iLcLLdGvYjiHDdJ5lyLTsXsgmOfnb/9RtkBgQM+LdO n5uQ== 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=dVtqadNez4OKPvWFFj2HZfsgATq8qO7/SMx7c57DCKg=; fh=X0Lb6G6jJE8+QeYtFGxv2g5f8eI/IotqH0fFq08ifqY=; b=GalooMk1ptZu0HELBuSdj05+C/VbPEY7gU+++QKRc+VHjtBeVxUlxpJWVkgnSowOky IBtfq4J3Euu6UjWKA85hlk1V7S7MW69/3VgterGQm89DG6Die1r7Qm3mFkpQ50ZbVX96 vv4XYg99g0EuHVeSWjR5n5ftXgjldhF9OuEWKZF6s5qq0kSej+ohKuFsCf7LNxyUu0sj FHqfqbFZv1nJd49VJQOCKzsuhsQgSnveT+vy0sKz/IIurQgkIselPivHQ47w7OpWsNd9 YLn/MLpUZKqJ7Yc5gRUI/nEfwAzAy9e/arP1lH7KShh+xXnEQW/TK5XYkkhLI+TqTRvv mo6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wdc.com header.s=dkim.wdc.com header.b=hxxZIqjm; 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-180656-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180656-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2ba3efb5176si826543a91.148.2024.05.15.22.51.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 22:51:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180656-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wdc.com header.s=dkim.wdc.com header.b=hxxZIqjm; 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-180656-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180656-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 81727B2142A for ; Thu, 16 May 2024 05:51:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49FE7208A8; Thu, 16 May 2024 05:51:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="hxxZIqjm" Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (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 A06486FB2; Thu, 16 May 2024 05:51:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715838700; cv=none; b=mXwhuwmJhFhxIhYu/0iqY8gWzS7AXExTsj7BOaJhopniOFPuuVA3RqCTUsK36vHzpwyMrqfaqjCKh/dYOz2mehMhKku8cMgVfTe3AmLpvrMBBpptwfbNALAGQXfshC1MrmjvKQpyhbxkEEcQT7wpdqSKlgzDgFhcBYTwdGCR7mo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715838700; c=relaxed/simple; bh=cpWaJ+eMi0gVI6L9oDTMwrfL74E04TY3aha+fAqLIJ8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=I5oAJsUTneIbG29t+WTZW0P0rM136cidbopYVU/AYno8546IKr42A9Dg9IwJu3IxF0hBTmuf4B7sIEsf4Kgptmi//gm9PBCHO5Zws7NZSps9ipGlqIFKxd8bwYMJnqPUpWKacBhUoYikUCMtfAmhVDYXnufVL0dom9xNtRBm8sU= 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=hxxZIqjm; arc=none smtp.client-ip=216.71.153.144 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=1715838698; x=1747374698; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=cpWaJ+eMi0gVI6L9oDTMwrfL74E04TY3aha+fAqLIJ8=; b=hxxZIqjmFr113gL5Fd4ykjI/Mrs5xgX0FhMXHfdPriuOVrBqMGkfrWzQ sgRW/RIM+MbZfP8JqAK17R/S9kaX/rXKjLXsTvNPOBGlN7KArjbtAWMKY qrAdbMp6UoAxtAlDuB829zCXSpaHFO6YDRO6TmpwZDqqhJ2XcQaOCCXhk rXhqcwZEBgueiDq/WnTb/y39vj2Vb+wG0kcJ3TKt+w6R9rwtdf0l/9H6k 5Tll9x3QT0M8WKVZ8lEQit+Vt8y/XkZUdlx0EQBQuZ/GWvsS/lQ2kY0Xb pFdv1IUncJhsTDbvtUGLrgge4cmXRN4PuCv8zer+V47/21p+gIzxFM9xI g==; X-CSE-ConnectionGUID: vZPcrZdnSTKFYaYAf06t3w== X-CSE-MsgGUID: /m9cWilmS9SVdAFjl6pTUw== X-IronPort-AV: E=Sophos;i="6.08,163,1712592000"; d="scan'208";a="17296230" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 16 May 2024 13:51:31 +0800 IronPort-SDR: 664592a3_wG3DMHgPrDTGd1ZDwI7tApJ2LAEXTdmvpATu7l7mfoDNzkM kHQb0x7onvlHrfdAVevXL+mmlqXC5LAdRDMAhnA== 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; 15 May 2024 21:59:15 -0700 WDCIronportException: Internal Received: from bxygm33.ad.shared ([10.45.31.229]) by uls-op-cesaip02.wdc.com with ESMTP; 15 May 2024 22:51:29 -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 v4 0/3] scsi: ufs: Allow RTT negotiation Date: Thu, 16 May 2024 08:51:21 +0300 Message-ID: <20240516055124.24490-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 appears 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. 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 | 58 +++++++++++++++++++++- drivers/ufs/core/ufshcd.c | 39 +++++++++++++++ include/ufs/ufshcd.h | 4 ++ include/ufs/ufshci.h | 1 + 5 files changed, 109 insertions(+), 7 deletions(-) -- 2.34.1