Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1809946ybn; Thu, 26 Sep 2019 02:32:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLVF2AGjITULHSnNk4AmiP1lTb3U4944RRMivK+OStYmWNO1XcZaqi/Wzx3UEV/mgbNmVT X-Received: by 2002:a50:d6db:: with SMTP id l27mr2496672edj.164.1569490372589; Thu, 26 Sep 2019 02:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569490372; cv=none; d=google.com; s=arc-20160816; b=s4kjoBtRFah/5GlVHO6sIkVxhZBzA/BQwbdxqwRWRMvjSOLrKN2Q9KJyusWG5DQ6DH Y/e6+bW9DFOzA7WiRzuVP7hWuPUuAVvfWw83XKNPpLrk8CZ3AKLBaGBPsJdNGdS6F3uR /EJsNUjgFVbUnJrLefZo9cWVt+HRqt5EQ7WTaR6PBbQE+msB6PLIC89U8sLwkHOcEMYt pGWWn5c9xLbhvJmj3Z/6OF4yEEh61tfu+sddvdF2Rdg71DTGxetLB6CNLo3axu1QG0jx 4LWvUFkaqkdUgsIkCTBM+D8JXdVJn3H6GM6eKH5o9LJdhjzfOQj36z4QRG8/5FUQYPK7 3CGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=7vmhBjqfYifJdS2WSP9f0iTo9aXnA6SVDK+l4oGewLw=; b=bgBmX4WxkqByC5nZMXb8CpCKbq+XzxRFRooPPe2mmVEfEcTYeTlf2zreVmi0R5NGFV Hzw7jjmwFe/jbEl30aaafjyXs6FWdAxK32tASiUezkQwKwZ10hZua5ngfELbR/bxxeIe rMTICK9fmqCrGY0kDSQWKN993t4gUxZDTUJmjacM4SQPXh8XR9llv7+19Iv8NF91nbyb Wk3Z8qGJWbLgHyPz/ZL6ly0JojUrcAc+LVblDneFW6pGBlSFwM/eyz/HvsT8tn9XjPh+ tMZjK4VZ7QGfHA6tc+jgpeNQ1u6e5MTtEumiqLP/wKY1dDXbh1Hur8mvgLFkJIzOzrKP RwWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ox13si679238ejb.0.2019.09.26.02.32.28; Thu, 26 Sep 2019 02:32:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405451AbfIYMcE (ORCPT + 99 others); Wed, 25 Sep 2019 08:32:04 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:50877 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405285AbfIYMcE (ORCPT ); Wed, 25 Sep 2019 08:32:04 -0400 X-Originating-IP: 86.250.200.211 Received: from windsurf (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 971A7FF80C; Wed, 25 Sep 2019 12:32:01 +0000 (UTC) Date: Wed, 25 Sep 2019 14:32:00 +0200 From: Thomas Petazzoni To: Remi Pommarel Cc: Lorenzo Pieralisi , Bjorn Helgaas , Ellie Reeves , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] PCI: aardvark: Use LTSSM state to build link training flag Message-ID: <20190925143200.696af4cf@windsurf> In-Reply-To: <20190522213351.21366-3-repk@triplefau.lt> References: <20190522213351.21366-3-repk@triplefau.lt> Organization: Bootlin X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Remi, On Wed, 22 May 2019 23:33:51 +0200 Remi Pommarel wrote: > Aardvark's PCI_EXP_LNKSTA_LT flag in its link status register is not > implemented and does not reflect the actual link training state (the > flag is always set to 0). In order to support link re-training feature > this flag has to be emulated. The Link Training and Status State > Machine (LTSSM) flag in Aardvark LMI config register could be used as > a link training indicator. Indeed if the LTSSM is in L0 or upper state > then link training has completed (see [1]). > > Unfortunately because after asking a link retraining it takes a while > for the LTSSM state to become less than 0x10 (due to L0s to recovery > state transition delays), LTSSM can still be in L0 while link training > has not finished yet. So this waits for link to be in recovery or lesser > state before returning after asking for a link retrain. > > [1] "PCI Express Base Specification", REV. 4.0 > PCI Express, February 19 2014, Table 4-14 > > Signed-off-by: Remi Pommarel Here as well, sorry for the very long delay, and many thanks for the great research work, including the arm-trusted-firmware fix. I reviewed the implementation, and tested on my Armada 3720 DB board with a E1000E NIC, and it all looks good to me. Acked-by: Thomas Petazzoni Thanks! Thomas -- Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com