Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1198159rdb; Fri, 19 Jan 2024 11:05:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDyrzUL0pIJyzpGQDI8oIn6z8ct7o3OWTwxS502BfN249sNRrYPMoK7nhX8akXhHmzFUZG X-Received: by 2002:ae9:ea02:0:b0:783:3002:b789 with SMTP id f2-20020ae9ea02000000b007833002b789mr1994295qkg.51.1705691139157; Fri, 19 Jan 2024 11:05:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705691139; cv=pass; d=google.com; s=arc-20160816; b=vxNnAXOkqjD3C8bidb+7vRNJF+MLvfMnyqb8WxJeT02PwMEmliteIAJcN+SLwkds8y c8dRtvjKIDEY+5CQKDfsI7t3mJgDt3ZADHYQEZwC3nsZBfQWWcUCfs7icvAsEhn/jKPh 4jWFGHRfzifKU1GTM/75w92R2zmfM5ZOhBW75neOPtVVsQpfka0IXEgZdjYOKmLH5P6u I0cliEdraQdBg/dYCBDCd4368AyUyK53PlqsM0whs6l3h9Bpi9K0fJEYKjwU7vJt8uAJ fHvFI4AFixoBKFuWRCC3HVpvs83QS6sHMIR/Y1upiRig2r3fbffHGZuW0BxWPB0q7u33 KI8w== 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:dkim-signature; bh=h7dgBmNFNgtTu8p/Tt/5S3Mre4JNaLCa+imUc7DnV5Q=; fh=YN5riroVEdnCqzWiknyQJI5I81fIZkVpvouWHSl4Gxg=; b=uErmF5nqkFAwJcRQbron9/oSxgr4xu8Lwqsk4W8geCJNi7/0xR9Mo1LGWMC+97a0o5 4dyCydn22Cy7JSFxvepNXV+Nl5gz3Wsro8tdLGd/eOA5ikbeOPDTc8Y/h/gKjnYXNgS5 O5uS2agTgz8/E+lxfdu0QdLbb2vW3Dz717NUbT4RBzgWR0QGIizFYguSkJtPnUnnVzMT 45PoiMSTkMJMvBPGWXIQTDec9M53OMPrOAPJrJjLIAn6zBNFZfrcM1ygeluoWfgtQY0c 8JUqwVvc7ZSerouegMpUNvZ0Ptgmj99g2V+GZ2uYubqW5uZ/9kH8tg1Dp0w33ucsawDu 23sg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ejtkZp7L; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-31506-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31506-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e6-20020ac85986000000b00429c4813550si17409659qte.345.2024.01.19.11.05.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 11:05:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31506-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ejtkZp7L; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-31506-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31506-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8827B1C24B1E for ; Fri, 19 Jan 2024 19:05:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D017B56454; Fri, 19 Jan 2024 19:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ejtkZp7L" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 7B7CC54F87 for ; Fri, 19 Jan 2024 19:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705691122; cv=none; b=oKXCb+ZSqS+Ty0POHvMutmYYgIjqlDBDQyRxNlLH1LCG73X8f/ZsovC7FFr+34rWnAPr5J37oxCiPTRlTglgDGdT3V+IgYwXR1QoQH+9emsuZy2VTtCnpDIV+PIzaBjxPA6Q86+MGckuiCxA/TmE7jiC0ZCXpMBSXZEk6hGaWZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705691122; c=relaxed/simple; bh=i3mHQi3y8X+GXccdvNGpfS2jPcXaEZnke1U5uVd1P+U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-type; b=JDzCkvP/0XdSXkKjD7POToZ+ozGsTTZb70mMV7SxjNbYiwLXt96w3KIZDMKmiQncqAodlmbNewGV9fYZ6bqaTR7RaYdGAJfes7wbAL5q+I6Rl7YaZUvPtEGHDbfPJrDiU37EK0++oCO7BWrCIEW2FAgNFcOsnJasWyleezmAkUw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ejtkZp7L; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705691119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h7dgBmNFNgtTu8p/Tt/5S3Mre4JNaLCa+imUc7DnV5Q=; b=ejtkZp7LSRCp4+bA3Hn/7M04SEIsY6kfef0mnYhXJ9dnMKyswNvRlyI6gVycoWOBYq/hnd w/nbC+ZL9scxAP70HKwgVMxAQowK9k3BFxcgFaYAjyJG1GcwFJcoi68tx4Ic27ntDkwx2b nWhIuw0GgQZTxmUB3FndvqkEl//OcNk= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-509-pDQZMomTPJu0Bz9vNI3p3Q-1; Fri, 19 Jan 2024 14:05:18 -0500 X-MC-Unique: pDQZMomTPJu0Bz9vNI3p3Q-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7831aaa797aso202323085a.1 for ; Fri, 19 Jan 2024 11:05:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705691117; x=1706295917; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=h7dgBmNFNgtTu8p/Tt/5S3Mre4JNaLCa+imUc7DnV5Q=; b=hAjWZFPN8Hq5qChTCdLjapD6MUnpRbz18VKNHMftE7YNZbrBj+tDz7S2yemg8clowJ gDspZTgx7D6piiS41vgnqRZwAlfSW+VPHi+oTHNbO/GwxMTzRKZngDLIcQO70lbqJUiP SLqFZ9FzfgRr3NEr3ZgVZLYPyQ9oN2NNlZ4Fx5VSAlbMUSzXN7zP8zjIZRrTCTWLjMl9 YmT2QyWQEAodJ5oaXl/F+yqfhGajqnGsELd08+WImVxW6PTk7VYoyqCcSjgj4N2/DIas iHdnoBB1uupeeBq+JTYzDKeNv3p3DM2ZfnA9aVrCpcIbbzNx/GR5J9g0OGRkywp40lpF 7h4g== X-Gm-Message-State: AOJu0Yxhnb9Lc2JVH+EK+TFMLlHdOkCPX1ilyp6+N+OJaGSpzk6uz+5O Y4f9sPJJU+pL0bOBIUggxDvt5hxBN82EjxZ63er+3U4caCgNj1aQKyuTO8BZNO9ZVq9MTIh/BAg hTXsrJyGtC+avYUra/AkZ38efYwY0sE/bR0TURjQFL512JuplxsK4XsjVU1jNfw== X-Received: by 2002:a05:620a:1452:b0:781:b188:c7ec with SMTP id i18-20020a05620a145200b00781b188c7ecmr2179294qkl.74.1705691117379; Fri, 19 Jan 2024 11:05:17 -0800 (PST) X-Received: by 2002:a05:620a:1452:b0:781:b188:c7ec with SMTP id i18-20020a05620a145200b00781b188c7ecmr2179278qkl.74.1705691117114; Fri, 19 Jan 2024 11:05:17 -0800 (PST) Received: from localhost (pool-71-184-142-128.bstnma.fios.verizon.net. [71.184.142.128]) by smtp.gmail.com with ESMTPSA id hj11-20020a05622a620b00b00428346b88bfsm7912081qtb.65.2024.01.19.11.05.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 11:05:16 -0800 (PST) From: Eric Chanudet To: Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Chanudet Subject: [PATCH] scsi: ufs: qcom: avoid re-init quirk when gears match Date: Fri, 19 Jan 2024 13:55:47 -0500 Message-ID: <20240119185537.3091366-11-echanude@redhat.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit 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. If the host is at least v4, ufs_qcom_get_hs_gear() picked 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 the re-init to save some time. Signed-off-by: Eric Chanudet --- "trace_event=ufs:ufshcd_init" reports the time spent where the re-init quirk is performed. On sa8775p-ride: Baseline: 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 39eef470f8fa..f9f161340e78 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -738,8 +738,12 @@ 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) + if (hba->ufshcd_state == UFSHCD_STATE_RESET) { + if (host->hw_ver.major >= 0x4 && + host_params->hs_tx_gear == dev_req_params->gear_tx) + hba->quirks &= ~UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; 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