From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAE73C433F5 for ; Wed, 8 Sep 2021 12:57:27 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E3F8361139 for ; Wed, 8 Sep 2021 12:57:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E3F8361139 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8384382BC4; Wed, 8 Sep 2021 14:57:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="DvP2rWqp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D79E83310; Wed, 8 Sep 2021 14:57:22 +0200 (CEST) Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AF7B8828EB for ; Wed, 8 Sep 2021 14:57:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-yb1-xb35.google.com with SMTP id z18so4041509ybg.8 for ; Wed, 08 Sep 2021 05:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=R3ikabSzBfjrCWzJl67oYnVPZYv42WwHbF6NS0wkWSQ=; b=DvP2rWqplqhOuFbwVNpLRHp4NUH13U0Cnw51ReDdoX4ellqsI7XZ9NfpcZxsvsS1/r ukRdv2Sz9SZUB4zN/iYX2kF5lMUWKZvWbcFMzHrAXzUHPtiKelSI4+VP+aCT6wgJoACD uNAs6h6aqN2Jar5wmFU9Yc9gl/lFgp0HGQ6CAEwJ/l28x76YUa4ETNb4rXcHlC1v5dMy Z06e1uJ7g7CCxsSwbXyunvRpQ+OZOQ9LbINgL1dQ50JB09uySAx54K8iM7Zf6fZf5uki jO5u8wlGXHZBmTv8Kco8LKbaOfICUMWwCM6M11Qa0/DNyGD1ohy4eqIQEmvLciMn7zMs eCSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=R3ikabSzBfjrCWzJl67oYnVPZYv42WwHbF6NS0wkWSQ=; b=YLZcO5PiXwJUCGnONuNW77wj3qHK1tDPYW6GORYnUkivSax49pFRIMj8qXtom2v7jb 9wlFq6jJsKDMMQGF/4ymiwc5TcmEiDKb7zZ/2Qa5dalMHfbVbKtqb0upvOg4jf9xPl16 3oJM+0sonAdtCYjJBUnwoJRLdz4lSBZlvQOoEeInBHRPJi4TAPxA9qsTgMguEdv7clJs X7AXtj9OVD9DO//Is4fG5rtIBKa30DSSXyQBPaOsS6GcSTkwpLyzw4gN3xL55/AqwlA1 eX7vMXQrnUKBTnt7DxgMRBrGCUBOzdHfoh44+fM7K3hQOsyYg8de7m1GTu3s8ad2jqiE I6+Q== X-Gm-Message-State: AOAM5309H+WC4IMTw8Gs6d8TxegHeK5fuWvnY8+IrURH+zDjmlhdoV4A ftNcvmpKGQTVRY68sra9/3/cXwzpWRaw1V9cJM8= X-Google-Smtp-Source: ABdhPJzOzlbb1uBnHbHFIhQJpeHmIfyv/JHHSErPOtn1Au/E1QXQookey+TjU8T17YuHHbx8NgZpag+OwQdlTlcmzaY= X-Received: by 2002:a25:ad52:: with SMTP id l18mr4676223ybe.453.1631105837539; Wed, 08 Sep 2021 05:57:17 -0700 (PDT) MIME-Version: 1.0 References: <20210907160708.31547-1-marek.behun@nic.cz> <20210908140256.393aeb9a@dellmb> In-Reply-To: <20210908140256.393aeb9a@dellmb> From: Bin Meng Date: Wed, 8 Sep 2021 20:57:06 +0800 Message-ID: Subject: Re: [PATCH u-boot] dm: pci: Fix handling of errors when scanning device To: =?UTF-8?B?TWFyZWsgQmVow7pu?= Cc: Simon Glass , Stefan Roese , U-Boot Mailing List , =?UTF-8?Q?Pali_Roh=C3=A1r?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Wed, Sep 8, 2021 at 8:02 PM Marek Beh=C3=BAn wrote: > > On Wed, 8 Sep 2021 09:06:28 +0800 > Bin Meng wrote: > > > On Wed, Sep 8, 2021 at 12:07 AM Marek Beh=C3=BAn > > wrote: > > > > > > From: Pali Roh=C3=A1r > > > > > > Some PCIe controller's read_config() method support indicating error > > > directly via return value, but some cannot distinguish all-ones (or > > > all-zeros) read response from an error. > > > > > > The current code in pci_bind_bus_devices() interprets all-ones / > > > all-zeros in PCI_VENDOR_ID register as "nothing connected", and > > > continues the cycle, but an error returned via return value breaks > > > the cycle. > > > > > > This is wrong for the PCIe controllers which return this error via > > > return value. > > > > > > Handle all errors when reading PCI_VENDOR_ID the same way. > > > > > > This fixes enumeration of PCI devices for example when there is a > > > PCI bridge connected behind another PCI bridge and not all ports are > > > connected to a device, and the controller (for example Aardvark) > > > translates the UR error (Unsupported Request) as -EOPNOTSUPP. > > > > > > Signed-off-by: Pali Roh=C3=A1r > > > Signed-off-by: Marek Beh=C3=BAn > > > --- > > > drivers/pci/pci-uclass.c | 9 +-------- > > > 1 file changed, 1 insertion(+), 8 deletions(-) > > > > > > > Is it possible to update these PCI controller drivers to fill in > > vendor id to all zeros when there is an errror? > > It is, but we think it is wrong. If the PCI controller supports > reporting errors, they should be propagated. > > What we might want to change in those controller drivers, though, is > error numbers, so that they are the same for each controller. For > example Unsupported Request should be always translated to EOPNOTSUPP. So if it is a real error that for some reason the controller cannot read the configuration space, we should abort instead of continue looping. Not sure what is the best approach though. FWIW, Reviewed-by: Bin Meng