Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp984461rdb; Wed, 24 Jan 2024 00:48:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEB7JvXadE8D9KUW8LT3Uwjs90zofOjqUtMSb8Z3nXshxCrxEaALYYFhdkzKipdIRqyDI/s X-Received: by 2002:a17:902:f683:b0:1d7:836d:7b3f with SMTP id l3-20020a170902f68300b001d7836d7b3fmr696363plg.9.1706086116090; Wed, 24 Jan 2024 00:48:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706086116; cv=pass; d=google.com; s=arc-20160816; b=UlubflczdIW4L50sC1Qumwkm586P7fA4dB8sqxy96x+0crtJsHJEA0WCtYbjvU42ox pkVMD66Y84D4Nw7IrADS/GVEcOZKXcJlJUS8FM+Zhs6jzXX70YyjLl523ywigxt9efN1 dg74HTnCa9lXYDaMJEhaWctzQbCQGOUHvX16gHkOwNgNMtbsPyAoD9tLaRSl+buEcLSQ lziq5LwPOcB3ts2/TBstujleEQ7zay7zlzXOy2BhS13APD+XH0fGrIfyamvTBpJ5txB8 AAX01V9w3BuHngqwgJByrKwUNtXFU/J44Rk2wIhnl/1eR5r/qOOu/06S5vcaCd4gQrZb NNVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/7rbypgkDb+liCSqrr02j2nhDq3VhRD+glw+4uRNOQU=; fh=hUuSyPn0WYRGdbKcf/HCJKQK4LRmMJFDL3xf1ZV/JMc=; b=YhDbD8BLmuxNUeqGgws8OWvRyrPlHJ1gE7EkbH4sUFRXEHDsDKB/yPZQ7dXIhif9kE c2xtkNiND2VcSYfUMlN+kHo+VbbjRLSM7nNe1dTQjgo2EHWJT7PBT2z8cRwVI0lQSpO0 7OwboKtXavld0VZVXy+WWXZdBzWNwjuo+V1tdusOImh/E7mTn6D4kYM4LKRGGvLL4aQG /fgLssWoOOAauTMDWxcc9indFoppHlM2V2R1SlRO25NRfW0tXNOt6sZmPitRZBjS9Egr jQXJ8kbJ+Sl4/wL1TWodPR3WD5pUtBA0h3h8wDSOPWtIozWwaSs7ZF8+o89lB6brpaMr i2iA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S5+9laij; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-36656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36656-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k17-20020a170902c41100b001d5e414e1d6si11473984plk.482.2024.01.24.00.48.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 00:48:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S5+9laij; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-36656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36656-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AF622284ED7 for ; Wed, 24 Jan 2024 08:48:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 110B61798C; Wed, 24 Jan 2024 08:48:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="S5+9laij" Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C102117995 for ; Wed, 24 Jan 2024 08:48:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706086101; cv=none; b=Y1kkMzReoNyaPLKBy6FqjI0Rr7L5gDuljdc6PQv5gJevzwYjfGI5sBBD0Kz2q8YfXgSR7q80CQSbCR7i7hfy/Fm0HA6lLp7f6w8L5uw5nk7XFIgwjBlO+MZbJB5K9W6K2wQ7oUw+K/SBWHxdmBcWzlpw+atq17mw4na2BaZK5GU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706086101; c=relaxed/simple; bh=P4McOCY6FFE0rm/rfcDQp1J/v6wIBnRRgRJjY2BpMyI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bFGfqyI3Am5kALHtKtGdqkLBIXpOGrApT8Rt2bP+S49xMFZZgPAFAoD1t4dF/jHi7TgfTpYf1zocyOmNPkvSstmcS7xcIyHhHO37FfMuF9+2l6Nfqb3yCbFU3bQeTLE++8+JANYgDuzwTJdjwgS+WZGWvKRdjNog3Y3Ez7/YEKA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=S5+9laij; arc=none smtp.client-ip=209.85.219.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-6818aa08a33so36151586d6.0 for ; Wed, 24 Jan 2024 00:48:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706086098; x=1706690898; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=/7rbypgkDb+liCSqrr02j2nhDq3VhRD+glw+4uRNOQU=; b=S5+9laijnaySIyQqGT6T139zRj1oB8zVUNgzALSdIOCI4EkGB63ZusNvlq7zXhmX3t FU9uK1YBwlb28o7c82Md1Q2Dr3Dspu/q5Pu+PZHtyLeMT1ogEV8OouSWwNsitKoGMFfH ZNIo/YwWtqtwJxQsIcWar5zN5nmBGj+r/CHhreGiV1x+tAGYySbFNMWkA4+6gmmTuyuG WEHm9HsH0R38LDIXIMj8C5teThkQdUmCkxuN71Q2tQN3Y7x7d2UppEGMeJkXlymuOxEr eNUzT6MOHQCNglbqWf/Kc3uTzmReykOlIP89AdC5RgVko2uUVmLfEWiPBmbaB0VoHQh7 ogSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706086098; x=1706690898; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/7rbypgkDb+liCSqrr02j2nhDq3VhRD+glw+4uRNOQU=; b=ALnUjlyAYj1bZ/1Pls2P1thAN1ELr+kP7WCUlAZWoWMX9WaVuKKbNzj9d0BAxgZ2a6 5w32X6tWRKbLZJO6KiPKkzslgvSZziH45wsAGr8e4c5L19xjoEo53n7sgY0aLxghn88o TiUJ8/0xp2MzMgC/iTuC1t5Q3AmDhvk0SGYJP9oi+wjEg92wXx+SvduyXAoSjFJYpRCq 30A96F4QJcK1D7hhLcIVPWM80xonBhx9uEAIosrej3M++4+mpqKfMu853iR1szaBSKwr dUzSHJHResseYsIpQ5/L50TkiCRWmTRGXdmzuCxs3IA+Q/sBCe7c2JyKD6Y5SMjbIpcb KjmQ== X-Gm-Message-State: AOJu0YxFrFKzzljos+HJvX3DMCvO1a/7Kl3nKemRFyG2thpgiaVRLitP 60XuazERszAHKzHfOxOPtzRit9bcsO2cnPaHlQ5xDmjpCTByQrB6uFFksFtqxA== X-Received: by 2002:a05:6214:e66:b0:686:ad00:3fae with SMTP id jz6-20020a0562140e6600b00686ad003faemr1202389qvb.5.1706086098610; Wed, 24 Jan 2024 00:48:18 -0800 (PST) Received: from thinkpad ([117.217.189.109]) by smtp.gmail.com with ESMTPSA id qj21-20020a056214321500b00685f8308c9bsm3882632qvb.48.2024.01.24.00.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 00:48:18 -0800 (PST) Date: Wed, 24 Jan 2024 14:18:10 +0530 From: Manivannan Sadhasivam To: Eric Chanudet Cc: Bjorn Andersson , Konrad Dybcio , "James E.J. Bottomley" , "Martin K. Petersen" , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] scsi: ufs: qcom: avoid re-init quirk when gears match Message-ID: <20240124084810.GF4906@thinkpad> References: <20240123192854.1724905-4-echanude@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240123192854.1724905-4-echanude@redhat.com> On Tue, Jan 23, 2024 at 02:28:57PM -0500, Eric Chanudet wrote: > On sa8775p-ride, probing the hba will go through the > UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH path although the power info > are same during the second init. > > The REINIT quirk only applies starting with controller v4. For these, > ufs_qcom_get_hs_gear() reads the highest supported gear when setting the > host_params. After the negotiation, if the host and device are on the > same gear, it is the highest gear supported between the two. Skip REINIT > to save some time. > > Signed-off-by: Eric Chanudet Reviewed-by: Manivannan Sadhasivam - Mani > --- > > v1 -> v2: > * drop test against host->hw_ver.major >= 4 and amend description as a > result (Andrew/Mani) > * add comment, test device gear against host->phy_gear and reset > host->phy_gear only if necessary (Mani) > * Link to v1: https://lore.kernel.org/linux-arm-msm/20240119185537.3091366-11-echanude@redhat.com/ > > trace_event=ufs:ufshcd_init reports the time spent in ufshcd_probe_hba > where the re-init quirk is performed: > Currently: > 0.355879: ufshcd_init: 1d84000.ufs: took 103377 usecs, dev_state: UFS_ACTIVE_PWR_MODE, link_state: UIC_LINK_ACTIVE_STATE, err 0 > With this patch: > 0.297676: ufshcd_init: 1d84000.ufs: took 43553 usecs, dev_state: UFS_ACTIVE_PWR_MODE, link_state: UIC_LINK_ACTIVE_STATE, err 0 > > drivers/ufs/host/ufs-qcom.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > index 39eef470f8fa..f7dba7236c6e 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -738,8 +738,17 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, > * the second init can program the optimal PHY settings. This allows one to start > * the first init with either the minimum or the maximum support gear. > */ > - if (hba->ufshcd_state == UFSHCD_STATE_RESET) > - host->phy_gear = dev_req_params->gear_tx; > + if (hba->ufshcd_state == UFSHCD_STATE_RESET) { > + /* > + * Skip REINIT if the negotiated gear matches with the > + * initial phy_gear. Otherwise, update the phy_gear to > + * program the optimal gear setting during REINIT. > + */ > + if (host->phy_gear == dev_req_params->gear_tx) > + hba->quirks &= ~UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; > + else > + host->phy_gear = dev_req_params->gear_tx; > + } > > /* enable the device ref clock before changing to HS mode */ > if (!ufshcd_is_hs_mode(&hba->pwr_info) && > -- > 2.43.0 > -- மணிவண்ணன் சதாசிவம்