Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp360631rdb; Thu, 15 Feb 2024 02:22:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXb+cC7LityX8bjs/oa5Z5yWh1W3s5p5vIBGCCEiv0dG6WPRttRod92Ah8ekiun1MejlRMhXticN3yCkCJwJRLeP0DlxepVGFjPqRieZQ== X-Google-Smtp-Source: AGHT+IGvqICXNSvmVyTFV88F91SVUJFmIx82Z9/oVInwP77hxleHjrUMwuHBegY0Z+815kKKUo/t X-Received: by 2002:a05:6a00:92a5:b0:6e1:e4c:7741 with SMTP id jw37-20020a056a0092a500b006e10e4c7741mr1943830pfb.26.1707992522801; Thu, 15 Feb 2024 02:22:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707992522; cv=pass; d=google.com; s=arc-20160816; b=sA7LdZtfKEiWhQGFKHbHrVPtJkfbsin+Yhbkgel+BIH/FmYKrhD/YXywO8g8azFR0J cf4RQ+r4haNUlgGWz+DEDR1YkKH5SvC9RO5XtMkFvezaUKuZkxnmbqpml1G9pkAOdFUa JasgK0M79X1VUqOygQ/b72lhGwco4l81pNsHq2j/mmfv2mfhEFfD5k1AOnw1T6xgsML3 61yRgQvTYFvwsKQsILBE4/Me4j5BgcXcJkzQYXe+aXZbEI/EBUHhEJp7GAI096Dq4X2c 2koxTCfNRIXwaGepcP0MJ7W7f8MRqFHHdxOHAbK2DuNjzK9O+TJ0LXt6a7avUrd4Q/+d G5fA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=Ciw4pOtP95/auA7ToeOHSPYuZOxAhM3oTuFVWwrCe4I=; fh=nFGGyCiyN6Ksqv1tL4kzujunK6mZjA6Zt0nBTXpZI9E=; b=W2SKlAQLi8V6GuEE6FgFNxswMAw/p247LdFh7sT5PKMEMCpSowdzTw/86jEc/dg/rc r4cEtOSwbhJMUmpN9w/2FQQwAzpHnY5Qdvv4KW+ATYoyNvw/F2hmED/fDrCuZjpkEfbr Ij2VZ5LnIxG3gVvZMA0l+3xGASMPNKtFgrpjIMvwpZ64YAb4F4+eMj/2KfSAxLv3GDuB GztU31DQjWuckxZvD9mPTYob+J6n79tP7+ix+HFGPrqbB2bvaLOHce2gxjh4fXhIboNc TIKHee1ok+fNXAcb9jlmyXOdgZb/8GAuLhQE54NLaLaFXmaKRg0bZjndzkcXuXbBYknE nvkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qAe9h4xU; 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-66618-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66618-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. [139.178.88.99]) by mx.google.com with ESMTPS id f7-20020a056a0022c700b006e08a4ac43esi936352pfj.376.2024.02.15.02.22.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 02:22:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66618-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qAe9h4xU; 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-66618-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66618-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 7163A28130A for ; Thu, 15 Feb 2024 10:22:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46EB169951; Thu, 15 Feb 2024 10:21:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qAe9h4xU" Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 92CB967C44 for ; Thu, 15 Feb 2024 10:21:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707992511; cv=none; b=FepVnFXr5QQd0nIN4mcS9Fqu+mYhL7hdEO9EXAudzAiSznTSPzYFjT/K8LwSAqoS460xyU6jrtaZHierYLq3KiWoMVxOsP5yYYgpaACDYHR1Kep95dZDUqDuA7iGxZIwVwT+CUCOBMcbGye/thhtJYnWYWlRCSQmvTlCbehAfF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707992511; c=relaxed/simple; bh=YT83jAApk16SoeiAMl/v7WhogysHMW2ucF4uBrLYJgg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ULo9kWJqARMehmK1GNZYAJZos0L1ouSF6iwISlMfZ5XuHFm9EMBuJq8XODrk2p4NHCTPPozzIK6jRv8ThuI/5+xladPdU5WBj2BLgfRkzrB0UGRhcb4Ay0Ht8C+ZEJ3047W5gEfydwoVFPZ1zNHuECmINWBBh7qBkijb3X/K+A8= 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=qAe9h4xU; arc=none smtp.client-ip=209.85.208.49 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-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-55a8fd60af0so1005142a12.1 for ; Thu, 15 Feb 2024 02:21:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707992508; x=1708597308; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Ciw4pOtP95/auA7ToeOHSPYuZOxAhM3oTuFVWwrCe4I=; b=qAe9h4xU3pMbFl23XO/ZRH6n82/1CKM2lo537rbZeqm43te562ztbUeDff6kWIRf0C 7M5/g81oe68UHsfpziByW4UkYpBdhCdpokZwzFcwxJ70wP5JOSH4MilRmWkiLKbgVfbp dBv/ZCTTOK58R6uL0ysfDOi9J7OMnI3JlpJS7yYYmKpPh+EEXl+GgKgzBqMSAojfefTY GJOLsH96vhnt0APzgjq4/xkUIRBduTRfWRm3Rx8XV6XRKcxSoTjuph+piV0dfZtzswZr /RxuqTklo0odpllCRQvQqBlKZm5yrYyd+kEos58S1Rsq3DmxMJZizwZBmBKQHpgge5kC 4fXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707992508; x=1708597308; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ciw4pOtP95/auA7ToeOHSPYuZOxAhM3oTuFVWwrCe4I=; b=K1vm2+a0ORrH4KeybKAko36nFTZgpxI17w25tC27W0+yGzofDchbLIClzoha3lUP8U ODOgTb3fREMEn3CyfnE09IXy8Ememyb2iRpLVEbY9eAv+WTPFvM7CCUXbNGglL9ep1s+ Y9RknUdyCqVfH3FfNKKzPnCHPKXOIWeuGcjFws2U7e4vNiBApSP2hwK0DUafIpPM9ShK jwFeXnh4PWtK/34h5X3l9sJbMym6eewtAayN6tvyxpQKzQZrI1qPdL7dIJjMOFv1Gdr3 zPmDikdzMuboB657pgbbpGPbjKpkAjQCDDDFpKhyaDOowpm3v4kGitrn65PuU3VBKmzU ARpw== X-Forwarded-Encrypted: i=1; AJvYcCXWu5tlF7F0YY2OSWzXMXmPAvFLiqjJVed0cVPxGcQ+jJnM475SIWVPiaRntrYe0pwon8BAvCviVAMXuDPHVQ1xU21ajGHNB3KPSuqC X-Gm-Message-State: AOJu0YxfoEpCd+l81VKvWH+uGnKiSAnOggPV0XvX4iLe2ypEfcii7ozT q/OlC36+6f4eY3VVyDyks9ruuzp1RxLIBL7dQKJG3AwtacQNGqueL2LP558jT9I= X-Received: by 2002:aa7:d518:0:b0:561:fec0:cd44 with SMTP id y24-20020aa7d518000000b00561fec0cd44mr1251437edq.27.1707992507614; Thu, 15 Feb 2024 02:21:47 -0800 (PST) Received: from [192.168.192.135] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id em2-20020a056402364200b005639fbc1ff4sm405940edb.43.2024.02.15.02.21.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Feb 2024 02:21:47 -0800 (PST) Message-ID: <3a040d65-4843-4e7d-818e-2523d112c74a@linaro.org> Date: Thu, 15 Feb 2024 11:21:45 +0100 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 2/3] PCI: qcom: Read back PARF_LTSSM register Content-Language: en-US To: Bjorn Helgaas Cc: Bjorn Andersson , Manivannan Sadhasivam , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold References: <20240214222819.GA1269395@bhelgaas> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6CoUDqALsmfS3MUG5Pj2Ne9+0jRg4hEnB92AyF9rW2G3qisFcwPgvatt7 TXD5E38mLyOPOUyXNj9XpDbt1hNwKQfiidmPh5e7VNAWRnW1iCMMoKqzM1Anzq7e5Afyeifz zRcQPLaqrPjnKqZGL2BKQSZDh6NkI5ZLRhhHQf61fkWcUpTp1oDC6jWVfT7hwRVIQLrrNj9G MpPzrlN4YuAqKeIer1FMt8cq64ifgTzxHzXsMcUdclzq2LTk2RXaPl6Jg/IXWqUClJHbamSk t1bfif3SnmhA6TiNvEpDKPiT3IDs42THU6ygslrBxyROQPWLI9IL1y8S6RtEh8H+NZQWZNzm UQ3imZirlPjxZtvz1BtnnBWS06e7x/UEAguj7VHCuymVgpl2Za17d1jj81YN5Rp5L9GXxkV1 aUEwONM3eCI3qcYm5JNc5X+JthZOWsbIPSC1Rhxz3JmWIwP1udr5E3oNRe9u2LIEq+wH/toH kpPDhTeMkvt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tb9U/nZvhhdfilEDLe0jKJY0RJErbdRHsalwQCrtq/1ewQpMpsRxXzAjgfRN jc4tgxRWmI+aVTzSRpywNahzZBT695hMz81cVZJoZzaV0KaMTlSnBkrviPz1nIGHYCHJxF9r cIu0GSIyUjZ/7xslxdvjpLth16H27JCWDzDqIQMtg61063gNyEyWgt1qRSaK14JIH/DoYRfn jfFQSC8bffFjat7BQGFz4ZpRavkMUFuDirn5Tf28oc5ebe2cIHp4/kajTx/7JOxWZ80U70mA cBgEeYSrYYnX+UJsSxpzLc/0sT1eRJDEhI4XIQM4ClIzpsCIN5HnVF76UQXh3a9zpwh3dk8i bhN/URmCOTH+LHNJYN/MxY8wuukq877DWB7k86pBs5IDLAXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: <20240214222819.GA1269395@bhelgaas> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 14.02.2024 23:28, Bjorn Helgaas wrote: > On Wed, Feb 14, 2024 at 10:35:16PM +0100, Konrad Dybcio wrote: >> On 12.02.2024 22:17, Bjorn Helgaas wrote: >>> Maybe include the reason in the subject? "Read back" is literally >>> what the diff says. >>> >>> On Sat, Feb 10, 2024 at 06:10:06PM +0100, Konrad Dybcio wrote: >>>> To ensure write completion, read the PARF_LTSSM register after setting >>>> the LTSSM enable bit before polling for "link up". >>> >>> The write will obviously complete *some* time; I assume the point is >>> that it's important for it to complete before some other event, and it >>> would be nice to know why that's important. >> >> Right, that's very much meaningful on non-total-store-ordering >> architectures, like arm64, where the CPU receives a store instruction, >> but that does not necessarily impact the memory/MMIO state immediately. > > I was hinting that maybe we could say what the other event is, or what > problem this solves? E.g., maybe it's as simple as "there's no point > in polling for link up until after the PARF_LTSSM store completes." > > But while the read of PARF_LTSSM might reduce the number of "is the > link up" polls, it probably wouldn't speed anything up otherwise, so I > suspect there's an actual functional reason for this patch, and that's > what I'm getting at. So, the register containing the "enable switch" (PARF_LTSSM) can (due to the armv8 memory model) be "written" but not "change the value of memory/mmio from the perspective of other (non-CPU) memory-readers (such as the MMIO-mapped PCI controller itself)". In that case, the CPU will happily continue calling qcom_pcie_link_up() in a loop, waiting for the PCIe controller to bring the link up, however the PCIE controller may have never received the PARF_LTSSM "enable link" write by the time we decide to time out on checking the link status. It may also never happen for you, but that's exactly like a classic race condition, where it may simply not manifest due to the code around the problematic lines hiding it. It may also only manifest on certain CPU cores that try to be smarter than you and keep reordering/delaying instructions if they don't seem immediately necessary. Konrad