Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp1805650pxt; Sun, 8 Aug 2021 02:04:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOoWEEOwC6gs0YjTP5ILWFoY2GsZ0qwDiNWefhbLmlm35mjr8rIEBf7vJC5R3njIYUeprn X-Received: by 2002:a05:6638:624:: with SMTP id h4mr17842964jar.73.1628413467428; Sun, 08 Aug 2021 02:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628413467; cv=none; d=google.com; s=arc-20160816; b=DFAXzeXXUEvoqmUuea9JMicSTZxN5/EUS27bH8Gkxa4BcwxkrEiODw4KRW/dBGXVBj COXMHhx5sY3wHiaYNg+H+UxyYez8n8mzF9sNV56hLWhBRXUSZ2Wcf9aiwtlLRepunCeE Kw27t7Ffu20duOV8xXs0VtRyKI+vHD9iX+q5va54COqOGXtQvYbPglvVahdYvkyr1uBN OP9/hAxozlxXo2dDBR84QU7SCWs0g0hkWSLGZtXRzmovuWrOJJ0xW3RHxAB/+Tyl0OLp iymwh9wMLFsn04xYueR3voXXN1lAJQfQ1YTIpK0fbcVB8j9awWJ5HWwelfS792U5vRyw SCgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:wdcironportexception:ironport-sdr:ironport-sdr :dkim-signature; bh=6yLB7cGtViPpB408qAowAkLDrtt/u8fSjMNp8+cXXlM=; b=V0Bl5WwRl7F7CAQi5gQuj5ftdeh8yDzpXph4uLFVZzJWX1vGsw39aXXgCXaWVGCBvu 42xWaAsqRjuEt46wh0J01nta84qUyzeVwbgmsiiCSyUJ5kIEyDZBUlug7ahSnc0IN+VO SGriI6JQmZ9s98+vPyNpYPnYLYxrZTztpdk5ZPl+nqr8BDtPgOVgYsHnxJYMA2OyIQt0 MAKaHcZZOnaCQ2HiS69TmbLHPsP9B7KX8i4r8n+ybD71jG/Ul7PqrJtY55/QXsi7SXAq aOsRRytSwiPKFIzAdatFyegXgkJAEqsF1prCAdfadc0trU05tKLPDtQ+j+l/kXwCkhYA Qbsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=UD0mWTLs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t25si13655077ios.38.2021.08.08.02.04.16; Sun, 08 Aug 2021 02:04:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=UD0mWTLs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231465AbhHHJBP (ORCPT + 99 others); Sun, 8 Aug 2021 05:01:15 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:50653 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbhHHJBO (ORCPT ); Sun, 8 Aug 2021 05:01:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1628413256; x=1659949256; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=6B2CQU5+UkLRTV6KdGFECN3I7kOpqa+xwRhIgxF3D9A=; b=UD0mWTLsDGf3USg/2QJ+Qu9B4Nl+y4M854sCSv3iW2vly0pjqwmnNDCw LMqM9ik/wFfpmamtg5AyG7ovaRvlz/JvdN4ff8Asg71cA78O9ank049pY YlTXdN95EJeOFVO9sV6u3FpRJn/gCfJVQDIHYX+PN3wr7guEH2lPb8vHi RiCB+L3AvofGwpVDyx7m5b0jW7N4cTDKUMUVLRmxpwv8eJg5BeRG/c00U ahSPk7/CakbeieeaNVj38ltju7jkZLfVo9gYydDWhn3MoUoXzu9PcpJPt YH4XkJvq10hktDMQAT8uoPwytGZlcosQDjZUo8ngduxiKrNvcIPNoaLRC w==; X-IronPort-AV: E=Sophos;i="5.84,305,1620662400"; d="scan'208";a="288168028" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Aug 2021 17:00:55 +0800 IronPort-SDR: SjiJLIpTnTJwNxyaB4twf/JhkPMUq6C7qruGg3GJgP0z+gx04xi96wi2kGT3AVvMllWiemZTJs eKBhJitmVxNgoOZm2ZfR6DgADAi5GDmeB8qEJih+nWOgRwAV/obMjDl95IjUBbMO+YpEsWK9Bk Wn5LqRId18wqBAKDfeSk9ERJYPYN1N/qGjLzsA8FGjLLHh+PXMnyX1bwstkYMKEEBJ5Y8WznWn qP6gjdo16+1UPglmiAcB60Z6/m7YAJgbvh0jz18I2R6C5eXKZi7jKxOzzrlmZw3WSIh+mud3lP +YEpbybqXMT3B+6hItpTTuog Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2021 01:36:30 -0700 IronPort-SDR: 07lasYtr7CfWz+iI2OWhYHfFO0K7Qt7DVXzowy6cK9b/esIEbwoqSwJhIT+1Z/d5bYo6pvwgKf AK7mSAtJptbxr92CITg8VT1+saIy6eRHKsOwELek7l++Tdvb+ar/C1UFESueg0+8jGUH3O4Z83 QzQU4fL1tO12sndpr+C7YYft3blQhp1ucVpOhKEG6+fNaEVdN4HuJrAv/UyWKTJPPon8GG4iRH 5sauHDsxLAb+xH+D+ydZ/JnX5KEXDhNEquEFHufe1EHMxQpVhOvQwyTbsATosJMnHGgR7d/4XM 3eQ= WDCIronportException: Internal Received: from bxygm33.sdcorp.global.sandisk.com (HELO BXYGM33.ad.shared) ([10.0.231.247]) by uls-op-cesaip02.wdc.com with ESMTP; 08 Aug 2021 02:00:54 -0700 From: Avri Altman To: "James E . J . Bottomley" , "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Bart Van Assche , Daejun Park , Avri Altman Subject: [PATCH 2/4] scsi: ufshpb: Use a correct max multi chunk Date: Sun, 8 Aug 2021 12:00:22 +0300 Message-Id: <20210808090024.21721-3-avri.altman@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210808090024.21721-1-avri.altman@wdc.com> References: <20210808090024.21721-1-avri.altman@wdc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In HPB2.0, if pre_req_min_tr_len < transfer_len < pre_req_max_tr_len the driver is expected to send a HPB-WRITE-BUFFER companion to HPB-READ. The upper bound should fit into a single byte, regardless of bMAX_ DATA_SIZE_FOR_HPB_SINGLE_CMD which being an attribute (u32) can be significantly larger. To further illustrate the issue let us consider the following scenario: - SCSI_DEFAULT_MAX_SECTORS is 1024 limiting the IO chunks to 512KB - The OEM changes scsi_host_template .max_sectors to be 2048, which allows a 1M requests: transfer_len = 256 - pre_req_max_tr_len = HPB_MULTI_CHUNK_HIGH = 256 - ufshpb_is_supported_chunk returns true (256 <= 256) - WARN_ON_ONCE(256 > 256) doesn't warn - ufshpb_set_hpb_read_to_upiu cast transfer_len to u8: transfer_len = 0 - the command is failing with illegal request Fixes: 41d8a9333cc9 (scsi: ufs: ufshpb: Add HPB 2.0 support) Signed-off-by: Avri Altman --- drivers/scsi/ufs/ufshpb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/scsi/ufs/ufshpb.h index c74a6c35a446..6df317dfe034 100644 --- a/drivers/scsi/ufs/ufshpb.h +++ b/drivers/scsi/ufs/ufshpb.h @@ -32,7 +32,7 @@ /* hpb support chunk size */ #define HPB_LEGACY_CHUNK_HIGH 1 #define HPB_MULTI_CHUNK_LOW 7 -#define HPB_MULTI_CHUNK_HIGH 256 +#define HPB_MULTI_CHUNK_HIGH 255 /* hpb vender defined opcode */ #define UFSHPB_READ 0xF8 -- 2.17.1