From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 E8917348465 for ; Sat, 7 Mar 2026 13:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772888548; cv=none; b=cvSPi388/woloUtBLZjPRgHX10r59gH2/5EbadxkE6c2gLr8S2O8BZ+fC0tQyD/3k29AlLs3NbeHQwndgllHhbr/IXbjklUel2xjPujdJgFE/h3LKWch0yl8QvuuCz0sJtfpcTnrpYf3rh1nf6otWfKRdkB/F+fU1wed+N51Ijg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772888548; c=relaxed/simple; bh=rq0wbPaRWXXFADsPr/4TR/KHwsK0FYUDyGYXvTrXaiI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EFM19KZ1zv/79v5uI2TEc8qya7ZklgSVFodjjOVUHYax1iPvVxAcdSC6EZF7HZ6WVzbTENWCvz7MMxgFqTE4coE3xpwUQapeDOrAIXwPLRRAjK6gNSyXT1wClv07wu+srZRUHTrGr2eXxcXhPLbUr0TRiFZOCVgxllKyXDTNmKs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ZMmAm4Xh; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=RIcuUiqQ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ZMmAm4Xh"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="RIcuUiqQ" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 627BfTSx4144711 for ; Sat, 7 Mar 2026 13:02:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= bsqG/fOrxLTztrfYdimrOt9nHUp4N1EZkp2EYUzLRuo=; b=ZMmAm4Xh/GnhB+eA mJIT9ttWKPxiH8X2LMELI0gX4lWgWqvTSdFu35YD1h/4yh73+6D62jiBq3yXScll /Cr+gS1xLZHSMxFbT4qNPW8FY4gO/I+JGpnm3q6cT0oiPMxO78PWE/0WutiAofPx ab3cRqKgFEr/9iHOyFDYVnQk6pLYXLMF2n9kmYOVnBcYMh3ZToF2laHXlsSxnCE1 M8MSy3Ih70zs3tDZZwLo5OYNTMPAJ6kcmnSmjDOMwYKcFOn52rwirW+e53m5m52L Q1TvGJIV/2XPH9RTPqmc4enohGMIYhdXzsc3dVmjn1iPf7ttyMXVP+xa53vVhZDS 64kz/w== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crc3v8t4d-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 07 Mar 2026 13:02:25 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2adef9d486bso89752315ad.2 for ; Sat, 07 Mar 2026 05:02:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772888545; x=1773493345; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bsqG/fOrxLTztrfYdimrOt9nHUp4N1EZkp2EYUzLRuo=; b=RIcuUiqQA33yu9TOX7/4o84WnrsZ6y8bLaOeOl33LvScmXy/kj/N9mH9tc2UjbR1dz FJY/mwGd/FR0QpjiyMEaqUNMyE8K5chKKYHooHU+j0m6NoxS17hCgMnLc9qnBHcNCogR qjs90Uy4mRpBldQyHspN7FaPvP4J4CUXrnaAJmjwaaERYkPo5MAFxzuIOaxPKBjkRPyp xRIBSkUTBEiznv702ZDR5BdgZ8ClFCt9TqT5m60svU1Z32IscH82nsLplALvaoCLdOKR SKSRfn3vznO0jPY1JTn5nUZdpyFkCgGfoBLsLqXwH1jbs9J1WV98JJIUhK/4IQxGFp9p 2gpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772888545; x=1773493345; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bsqG/fOrxLTztrfYdimrOt9nHUp4N1EZkp2EYUzLRuo=; b=kHhUTerNWXV/K/vxMVUNRlVX/Ox2JqJOCBsCml1tv41Ue7VNkaA++ri+H2S3jUt2BF mgBk42IdwRR/uOXs2Xi/3+BpHLqnuyAvBRXTYZdf5YoM+VsoB40RjhRWdPb6l3TGtbu0 uesiA7icjudIU5T8J9lgy40+k+6RqHl+kAEGxwm1xyxem1/zmnUC/mswtw/fhLvYz+Z8 aRRFW0cPtYNL5U8UiIhX5xG7aeH/C4hjcXt3W5HOOlbYJ9T5EnMNrAMMUbQsAK+kpO/x SlpUbiHY7dyDJSjWqOZZl1Q52PRcSbZMfDkI3ZoAgqBXKdGmGxFVY3WsnMcMT4hff6Pf c5oA== X-Forwarded-Encrypted: i=1; AJvYcCWQqTEevJvguiddy0pa10fLDN9/N35naxUywHFUlMu8qIE5SQUsUYDnw36FzTjHFrFbbXmRl/4eMohHyBU=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1zja3ITeG4hhDJuCIw6zxBGyi4/FpMbnWdVMtHRZIJywofDNO rr+ZfFMjXinykK5Ff0YdPJSsNV3erpih1w02vBN8WaoMIq0pqICF+4lAz75oVs19JyavK0icOo3 SLqNlcSr7wqLderoSXoJeqKS7WyZV+HrTmBcZaVuki4SsPBdbLuVgXJSrlcimS4sBZGE= X-Gm-Gg: ATEYQzyaV6j0Sf0uTvB+SqJQDyJvvMHtZtK85JoDFNIqDykI0SqDYhnsYUfYlfy0zOd rAuFSg7d6irssIE/yOHgcZTxJJBkl8Id/cwcFEYY2usSfcQdQzO+0GgR2p5FbxqvxECmB+qKNpC XUHKSetbSp6u+X1Z0YyWMtZutazPSlIpazpdnYxE+hXpP0z7O3Vwzb3GculdfjFJnAzBTBGMd6B x2fQ0FYtkOnzwPWmhoez48TyaW4+yf1CkDJtabDJ0k0xTXeYXx901tLE/VuFPivtCCr0MtNK2S5 NnIxL0ATomFyL4rXexG/Or/IxUauvPubR7afjcFgBujEb/FtzqoRMY58OTeqE/eRXA3NADhWEGF bCdjcfK1MDcDEbAuPaKwzV4S7Z2vxqDRvyBo17e+WVBENCGw7gze7G95mEwofjMDHEOrbAbe6bZ +aERV3SaW2SL0= X-Received: by 2002:a17:902:db09:b0:2ae:5723:afa9 with SMTP id d9443c01a7336-2ae8253c933mr62100735ad.53.1772888544704; Sat, 07 Mar 2026 05:02:24 -0800 (PST) X-Received: by 2002:a17:902:db09:b0:2ae:5723:afa9 with SMTP id d9443c01a7336-2ae8253c933mr62100355ad.53.1772888544092; Sat, 07 Mar 2026 05:02:24 -0800 (PST) Received: from [10.133.33.226] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae83e83ad5sm51866655ad.26.2026.03.07.05.02.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 07 Mar 2026 05:02:23 -0800 (PST) Message-ID: <824e88eb-56a1-4ecd-861e-df9be7cfb9c7@oss.qualcomm.com> Date: Sat, 7 Mar 2026 21:02:15 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 06/11] scsi: ufs: core: Add support to retrain TX Equalization via debugfs To: Bart Van Assche , avri.altman@wdc.com, beanhuo@micron.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, Alim Akhtar , "James E.J. Bottomley" , Peter Wang , "Bao D. Nguyen" , Adrian Hunter , open list References: <20260304135313.413688-1-can.guo@oss.qualcomm.com> <20260304135313.413688-7-can.guo@oss.qualcomm.com> <22dcd303-db72-4661-9d42-67c7215cc089@acm.org> Content-Language: en-US From: Can Guo In-Reply-To: <22dcd303-db72-4661-9d42-67c7215cc089@acm.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: IrHkCYkhXZgEi1-ZVpHl9xA-ghIgA4wW X-Proofpoint-GUID: IrHkCYkhXZgEi1-ZVpHl9xA-ghIgA4wW X-Authority-Analysis: v=2.4 cv=OOQqHCaB c=1 sm=1 tr=0 ts=69ac21e1 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=ILuXRL2B8Dq3KeV0KTQA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA3MDEyMiBTYWx0ZWRfXzBdgLCos7R+Y LJ7vXco0uVlV32P7TIIM9GEupfS6fYx/oj08r8mv+/FG2eQrv38z7wVuzX56GNN5L0vA+QyzCiy 5MggxCQ5ygjDiVo9vdGJcvzwaVECbi4yIN0P34EJCQrpAddw5I8oVOuE/xIVKUd2TpyoaaON6jU 4c0YBUwZanlvFTYrRhRIaaWmi8zsmgkeiD3EzvZrQ3nsg7nfX6T5vcKtYTsyXRGYBtMFe9dPhn5 QTipBDYjbrJRq/2Au0xB01VVTxZLjinu/DCKKgSQlwBcwUmTMuY/1o+PwOjBU8k/qqn6hd5hqld AFdv21r/kDCpQUYYK7ilm48a6DLKndNFTjmkmETj4ZJ+zAylj0EwvZTyM6iRYAiQBrRSelzgkNe V7x0ewfCNjaNEYkVyak/mRWz/nSz803fEGn9oAB1PT3nX+++byXaqh36h4XK08C3trZa8fYAlfX D0NeMu+B0wNE1xWTy/Q== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-07_04,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603070122 On 3/5/2026 10:11 PM, Bart Van Assche wrote: > On 3/4/26 7:53 AM, Can Guo wrote: >> +    ret = kstrtoint_from_user(buf, count, 0, &val); >> +    if (ret) >> +        return ret; >> + >> +    if (val != 1) >> +        return -EINVAL; > > Why does "1" have to be written into the "retrain_tx_eq" attribute to > trigger retraining? Nobody will know that "1" has to be written into > this attribute without reading the code. I propose to accept strings > for this attribute, e.g. "retrain" to trigger retraining. I expect that > this will make shell scripts that write into this attribute easier to > read. Thanks for the suggestion, point taken. Will use string "retrain" as input for the trigger. > >> +int ufshcd_retrain_tx_eq(struct ufs_hba *hba, u32 gear) >> +{ >> +    struct ufs_pa_layer_attr new_pwr_info, final_params = { 0 }; >> +    int ret; > > The recommended style for zero-initializing data structures is "{}" > instead of "{ 0 }". The initializer "{}" doesn't trigger any compiler > warnings if the first member of a data structure is a pointer. A > compiler warning will be triggered when using "{ 0 }" and the first > member of a data structure is a pointer. Thanks for letting me know. > >> +    ret = ufshcd_pause_command_processing(hba, 1 * USEC_PER_SEC); >> +    if (ret) >> +        return ret; >> + >> +    ufshcd_hold(hba); > > The ufshcd_hold() call probably should come before the > ufshcd_pause_command_processing() call to reduce latency. OK. > >> +int ufshcd_pause_command_processing(struct ufs_hba *hba, u64 >> timeout_us) >> +{ >> +    int ret = 0; >> + >> +    mutex_lock(&hba->host->scan_mutex); >> +    blk_mq_quiesce_tagset(&hba->host->tag_set); >> +    down_write(&hba->clk_scaling_lock); >> + >> +    if (ufshcd_wait_for_pending_cmds(hba, 1 * USEC_PER_SEC)) { >> +        ret = -EBUSY; >> +        up_write(&hba->clk_scaling_lock); >> +        blk_mq_unquiesce_tagset(&hba->host->tag_set); >> +        mutex_unlock(&hba->host->scan_mutex); >> +    } >> + >> +    return ret; >> +} >> + >> +void ufshcd_resume_command_processing(struct ufs_hba *hba) >> +{ >> +    up_write(&hba->clk_scaling_lock); >> +    blk_mq_unquiesce_tagset(&hba->host->tag_set); >> +    mutex_unlock(&hba->host->scan_mutex); >> +} > > Because of the "one change per patch" rule, introduction of these two > helper functions should go into a separate patch. Sure. Thanks, Can Guo. > > Thanks, > > Bart.