Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp288584rwb; Sat, 17 Sep 2022 05:25:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FumnuhJMDfmXE7tnn+8VsEZ0gP3lzK9wbZckXHe1VMWRe8qIDfyrpUTnuuWDNEAsTY3LB X-Received: by 2002:a05:6402:40d3:b0:451:5249:d516 with SMTP id z19-20020a05640240d300b004515249d516mr7693428edb.154.1663417523446; Sat, 17 Sep 2022 05:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663417523; cv=none; d=google.com; s=arc-20160816; b=yUjllVi6iZEBiEmjnsD5THkW6FdVKRVFgpSn0hBPP6faa8wgWn1Br8mHKjCFJetqWm HAvC4ZZp0FqPJ2PSEkmB6ZXeO6e1jP4NA6xSPxB+wk232JPJDByxK59ziXpoF8ySQDna 4SDkAEF7AOXhLS2SnqurI+AuxDZZVJNPaHgD1mHRHzfbQUHlRTklUUtGCjbbT6a4x5u7 GGWIrz+xX47/3yudVxfJYwVr7qD+qRvUjTs4KIAopJnIw+O1Q+cBcnc8/8ch35bq8UvL kAPfMiDuHkNIiIt++qIDaKCAdHrs6ymKoI5IWGpz94gP78obs989NIrr8MJpGWA27bYp sopQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:subject:cc:to :from:date; bh=IKqceqf4yCxCDWYSSblnYFf8k6yIfYjGgnuXiZYacrY=; b=SaCYqpA7aj2ipQGrzaK18S/m/n9nMMJ5BswSlnWUpehnRNqCiOd0t4OD0s5xq+kNX+ L+cd2YKJxHv0f31BK8G4DorneK+yF7WnKLavLsfDtNHWR3zAUDBmZWBpsad3xJyNo/zf 39Wo+AwOB5IG/Q1iKmMJkQ+obq6oyu3c9mYQppNduv5kTe8x8kTg4jbIpIXL6xwfovYZ 6weKiAx2SjtDGcPyQUBKvyjsDtgC39b/cPGdYGchYcgbqjm/r6CShqfAt0CgewIWRCMk 4n3X6DePT1lumg6Nj+fHhFypTUC3ufRrycL2nrNX3hwFsl2OUFpQcCc7LlkbRLDrBzOX 3WPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb36-20020a1709071ca400b00779dcbe3ac8si6317236ejc.8.2022.09.17.05.24.55; Sat, 17 Sep 2022 05:25:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbiIQMDJ (ORCPT + 99 others); Sat, 17 Sep 2022 08:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbiIQMDH (ORCPT ); Sat, 17 Sep 2022 08:03:07 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 98BC92ED4C; Sat, 17 Sep 2022 05:03:06 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id C7A9792009C; Sat, 17 Sep 2022 14:03:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id B8C0292009B; Sat, 17 Sep 2022 13:03:05 +0100 (BST) Date: Sat, 17 Sep 2022 13:03:05 +0100 (BST) From: "Maciej W. Rozycki" To: Bjorn Helgaas cc: Stefan Roese , Jim Wilson , David Abdurachmanov , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 0/5] pci: Work around ASMedia ASM2824 PCIe link training failures Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,HDRS_LCASE, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This is v5 of the change to work around a PCIe link training phenomenon where a pair of devices both capable of operating at a link speed above 2.5GT/s seems unable to negotiate the link speed and continues training indefinitely with the Link Training bit switching on and off repeatedly and the data link layer never reaching the active state. This was originally observed in a configuration featuring a downstream port of the ASMedia ASM2824 Gen 3 switch wired to the upstream port of the Pericom PI7C9X2G304 Gen 2 switch. However in the course of review I have come to the conclusion that similarly to the earlier similar change to U-Boot it is indeed expected to be safe to apply this workaround to any downstream port that has failed link negotiation provided that: 1. the port is capable of reporting the data link layer link active status (because unlike U-Boot we cannot busy-loop continuously polling the link training bit), and: 2. we don't attempt to lift the 2.5GT/s speed restriction, imposed as the basis of the workaround, for devices not explicitly known to continue working in that case. It is expected to be safe because the workaround is applied to a failed link, that is one that does not (at the time this code is executed) work anyway, so trying to bring it up cannot make the situation worse. So this version of the workaround is attempted for all PCIe devices discovered, and only the lifting of the 2.5GT/s speed restriction is qualified by the vendor:device ID, currently one of the ASMedia ASM2824 device only. Broadening the scope of the quirk has in turn made it necessary to make some adjustments to code elsewhere and consequently what was originally a single patch has now become a small series instead. This has been verified with a SiFive HiFive unmatched board, booting with or without the workaround activated in U-Boot, which covered both the link retraining part of the quirk and the lifting of speed restriction already imposed by U-Boot. Please see individual change descriptions for further details. Questions or comments? Otherwise please apply. Maciej