Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp397789rwd; Tue, 30 May 2023 23:07:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65kj6lUND53uU+QJoYopjZT7+ddfXBCRzRW5ncuiJNWf479XhJHLVNxoAzCnrj2LaS0McY X-Received: by 2002:a92:d242:0:b0:338:18f1:db72 with SMTP id v2-20020a92d242000000b0033818f1db72mr1894281ilg.29.1685513258421; Tue, 30 May 2023 23:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685513258; cv=none; d=google.com; s=arc-20160816; b=RoA6gXEwsJzAYj1bqo2k/NmUtShzzUPRk4BcN0ZxauM2onrrjTSudlrm/+uY2YKei8 yFaQ6b3idhr0LGt/3MXvYeb3V8XqY6lg6QM+YNIkLEbT/COrVlsAYeEyZnk3KN69N5iP 8jw1+A1BYXCIzF+3c9pOMSfWb2F+YA3K/Glg9QQek6pNN9Xqz+hpPcOGIaePQqwAocmj bJ92KvwCn+CjXLyyA0ekP/2MXl8H9ky50OQx0/ryk8BiQ9Cg4oexxo90X1SEdVJO0WiS zL4HMh6xoY154NoPXzMIFm0WHNZp29JV1GvXDM0F8NMwWfWOjuhi112lku8AMmLDzGk9 8Low== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=JVHD2w3X3KnAM1n+zKnQ6ZD6o3uYVXH4u8vCHT/VKl0=; b=isG8ozj2Z6i/7lJCwL4tjJkuYa4BHXw+FbWZ+EAN7qnaqsAlSoJLBnlruBOl+aOu4L /qWLirZpKoKa5h8holPzS4ZbOClpMGs2QUCxOMlmAtFBiSIoCLFK8mliow1g+bge52I2 QuVU7xZnOZ9nXwOAZAhUFV5YQPQH3T9DeP6V2nRwAiWhD5RWC7sRWCdusltlrmLcRO3n yLFYEr0U4fV31vPCg3tum6tUBggYQjm7bjrhjP6NpwpUf8EIg0aMFU7+vRk5YTFPsfV0 ICSdav5rjE2S8iZTI6wHGkrlj1parhD1yfO9aycna+zzEDwVRNgtc7HKthDGoTc/xhE5 KO3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dFXQXlci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020a170902e81200b001ae64583e34si372369plg.194.2023.05.30.23.07.26; Tue, 30 May 2023 23:07:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dFXQXlci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234264AbjEaFr3 (ORCPT + 99 others); Wed, 31 May 2023 01:47:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230201AbjEaFr2 (ORCPT ); Wed, 31 May 2023 01:47:28 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DABD211C; Tue, 30 May 2023 22:47:26 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34V5HHIr010866; Wed, 31 May 2023 05:46:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=JVHD2w3X3KnAM1n+zKnQ6ZD6o3uYVXH4u8vCHT/VKl0=; b=dFXQXlciXMPdxB0CEEzVecbcBdZejhJZ4VEafmgl3RKq0V9YHIOKl34K9ZAG5rCHfeIt C0zQtbfs/dta6UH5oyGifodfgqwhpqL8dsZ20y6347FMSEJu+ryR0bqlzPHCAEb8iw4I 2adclXPooXB+M67dIbKuo0P/JuNexxdy4x/pFgq9TScXQfgQS7KqtT007LEfDYh2UOfh EUO7R4QOS9zgJeHxh0aEl0NZocSZ0Xv3a9GB4z+Ex36LwOWBRRrAfGnyL3NpUEfmQ+ph /FlQ7UWwb4k4vrbtulOCH1tLTBTRABgozazz60RXplirx2Pq6KvO55O6Ez1WYUQ9QilN jQ== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qwx8q888n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 31 May 2023 05:46:43 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 34V5kgAc016084 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 31 May 2023 05:46:42 GMT Received: from [192.168.143.77] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Tue, 30 May 2023 22:46:41 -0700 Message-ID: <29df7084-374a-8ef5-202e-fa7512da0464@quicinc.com> Date: Tue, 30 May 2023 22:46:41 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v2] scsi: ufs: core: Do not open code SZ_x Content-Language: en-US To: Avri Altman , "James E . J . Bottomley" , "Martin K . Petersen" CC: , , Keoseong Park , Bean Huo , Stanley Chu References: <20230531051713.2080-1-avri.altman@wdc.com> From: "Bao D. Nguyen" In-Reply-To: <20230531051713.2080-1-avri.altman@wdc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: YPDCIRBvRug5W-Qm4aJeFFWyoRaWkCZo X-Proofpoint-GUID: YPDCIRBvRug5W-Qm4aJeFFWyoRaWkCZo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_01,2023-05-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 mlxlogscore=999 adultscore=0 impostorscore=0 malwarescore=0 clxscore=1011 spamscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305310050 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/30/2023 10:17 PM, Avri Altman wrote: > v1 -> v2: Attend UTMRD as well > > A tad cleanup - No functional change. While you are at it, how about blk_queue_update_dma_alignment(q, 4096 - 1) in ufshcd_slave_configure() and drivers/ufs/core/ufshpb.c pool_size = PAGE_ALIGN(ufshpb_host_map_kbytes * 1024) / PAGE_SIZE; Thanks, Bao > > Signed-off-by: Avri Altman > Reviewed-by: Bean Huo > Reviewed-by: Stanley Chu > --- > drivers/ufs/core/ufshcd.c | 10 +++++----- > include/ufs/ufshci.h | 2 +- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > index fdf5073c7c6c..10a10f8f0bd1 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -2519,7 +2519,7 @@ static void ufshcd_sgl_to_prdt(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, int > * 11b to indicate Dword granularity. A value of '3' > * indicates 4 bytes, '7' indicates 8 bytes, etc." > */ > - WARN_ONCE(len > 256 * 1024, "len = %#x\n", len); > + WARN_ONCE(len > SZ_256K, "len = %#x\n", len); > prd->size = cpu_to_le32(len - 1); > prd->addr = cpu_to_le64(sg->dma_address); > prd->reserved = 0; > @@ -3765,7 +3765,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) > > /* > * Allocate memory for UTP Transfer descriptors > - * UFSHCI requires 1024 byte alignment of UTRD > + * UFSHCI requires 1KB alignment of UTRD > */ > utrdl_size = (sizeof(struct utp_transfer_req_desc) * hba->nutrs); > hba->utrdl_base_addr = dmam_alloc_coherent(hba->dev, > @@ -3773,7 +3773,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) > &hba->utrdl_dma_addr, > GFP_KERNEL); > if (!hba->utrdl_base_addr || > - WARN_ON(hba->utrdl_dma_addr & (1024 - 1))) { > + WARN_ON(hba->utrdl_dma_addr & (SZ_1K - 1))) { > dev_err(hba->dev, > "Transfer Descriptor Memory allocation failed\n"); > goto out; > @@ -3797,7 +3797,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) > &hba->utmrdl_dma_addr, > GFP_KERNEL); > if (!hba->utmrdl_base_addr || > - WARN_ON(hba->utmrdl_dma_addr & (1024 - 1))) { > + WARN_ON(hba->utmrdl_dma_addr & (SZ_1K - 1))) { > dev_err(hba->dev, > "Task Management Descriptor Memory allocation failed\n"); > goto out; > @@ -8760,7 +8760,7 @@ static const struct scsi_host_template ufshcd_driver_template = { > .cmd_per_lun = UFSHCD_CMD_PER_LUN, > .can_queue = UFSHCD_CAN_QUEUE, > .max_segment_size = PRDT_DATA_BYTE_COUNT_MAX, > - .max_sectors = (1 << 20) / SECTOR_SIZE, /* 1 MiB */ > + .max_sectors = SZ_1M / SECTOR_SIZE, > .max_host_blocked = 1, > .track_queue_depth = 1, > .skip_settle_delay = 1, > diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h > index 11424bb03814..db2d5db5c88e 100644 > --- a/include/ufs/ufshci.h > +++ b/include/ufs/ufshci.h > @@ -453,7 +453,7 @@ enum { > }; > > /* The maximum length of the data byte count field in the PRDT is 256KB */ > -#define PRDT_DATA_BYTE_COUNT_MAX (256 * 1024) > +#define PRDT_DATA_BYTE_COUNT_MAX SZ_256K > /* The granularity of the data byte count field in the PRDT is 32-bit */ > #define PRDT_DATA_BYTE_COUNT_PAD 4 >