Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3024476rwd; Fri, 16 Jun 2023 11:07:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4PX9dWifZRkx1fcKvefk5gBu2/yDF51T2/V+XqkZsqCxG9XEpK52YKjJoIEpvf48Mb/Tjp X-Received: by 2002:a17:903:445:b0:1b3:f3ae:e1ed with SMTP id iw5-20020a170903044500b001b3f3aee1edmr2343946plb.37.1686938879588; Fri, 16 Jun 2023 11:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686938879; cv=none; d=google.com; s=arc-20160816; b=uYC37uvHzY+4h1jITWHVLasCCdkRdzcpGuD0vMH7SF93nnDj3XBeSKLx8SfLJmMtbv LejxDqf2gLmxScdX1BKAISSno+ZjZr3p0TjWwKGSugY0IdAQM5nWzgQaBByrMQJTrRo4 oK1xwPgogjFbXyGMtRzLEsrECtZTvm+5pmYNmIiBZko19A2e5zF8PeFJvn+ck4sbIYYN clr2wN9WoWHVvQ+nD975LjamO3rvpK+wPT640YocB2pS9Chi4K46XXEB8QhKMDFjRFnr U/wWJA5N38d6yxW6rf9539KDRaysszawBzoQuRy2nii0gDdZqCGBZuWA6N23BPZp29Dm ME9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yZ8eEA+x+5gozagiComb31MKFfHvm1oQLeCgj8pDoEM=; b=vUqgConT2qFUkCilswxyhaDGOFzIF/GHnZJ5xt/WExgUqfTUZj/qPUPdAoCNNXNyL4 g9On6pMF6okYXRE1F+yBVpkfwYT9W6jUksqsM8iZKBZ+WtFTUyy0W+B+zKF0DQMjaG9T ysrWASqbyNcMLCsqZuXmLAT9F2Xxal9sGaoh/XPlTB3Y64XeM0Js/CD0vpTbktCrG8M4 QLXO92SgSJkGmQ/ve7muJWv6WbJEi2jwFGUUWf/qZAD5nO2UBNy864oCMR1SxVO///Ih PKrAiZvb0NL+JvAAc9JtqBKHH7tj052jH9XBTOV2xjKfMqLBY2Bjjh+aKLveNG8jRUqn VRvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q0csU51x; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a170902ea0c00b001ae0691dfdbsi1985209plg.158.2023.06.16.11.07.46; Fri, 16 Jun 2023 11:07:59 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q0csU51x; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230022AbjFPR6Q (ORCPT + 99 others); Fri, 16 Jun 2023 13:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbjFPR6M (ORCPT ); Fri, 16 Jun 2023 13:58:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6933A3AA8; Fri, 16 Jun 2023 10:57:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ECE0A62D55; Fri, 16 Jun 2023 17:57:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A1C3C433CC; Fri, 16 Jun 2023 17:57:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686938278; bh=yZ8eEA+x+5gozagiComb31MKFfHvm1oQLeCgj8pDoEM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Q0csU51xJSe3z57XK+uNhWB8+Mjt/9Cjdr+9YejZTkvkjX+brhGBXKl4Gd1kTHeBa qdsfOcz4pxPbtegCYxvv2QztEsOh4/GDC2ihnUuO2OWZqd7HxPSSMyTm+LtGhCdVEe Ybfbp6+WpsLB/bTYCBvZNMS+eYKG85d2rFJtbqBWkUrLq6qlTC4P8OIL1Q3lUJLk1f foI7ZlMiMqGp7qmtlI4S4/GlaLqAhxfOpJKYcUGbGMlTkej/MO/BquYDjpZ9g1UIAm RUvQeHoQ37ZuqhcUmTE3CiyMnAyH1iXmYL0b0BeAyRZqnxoFi/Rfm6Urf4cBrloR7E xq+i601kTs/dg== Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-4f84d70bf96so1286575e87.0; Fri, 16 Jun 2023 10:57:58 -0700 (PDT) X-Gm-Message-State: AC+VfDwQakx8rH2xvv04sWlGQjGGgGK5IKexCv/MDAaX/HsTBNLICfMn 9cRHzIJ2QkpV2wbkyk4J0Vt9T1qPOwKtG7Amvg== X-Received: by 2002:a05:6512:33c7:b0:4f8:4b19:9533 with SMTP id d7-20020a05651233c700b004f84b199533mr1185954lfg.19.1686938276276; Fri, 16 Jun 2023 10:57:56 -0700 (PDT) MIME-Version: 1.0 References: <20230601163335.6zw4ojbqxz2ws6vx@skbuf> <20230601221532.2rfcda4sg5nl7pzp@skbuf> <7a7f78ae-7fd8-b68d-691c-609a38ab3161@loongson.cn> <20230602101628.jkgq3cmwccgsfb4c@skbuf> <87f2b231-2e16-e7b8-963b-fc86c407bc96@loongson.cn> <20230604085500.ioaos3ydehvqq24i@skbuf> In-Reply-To: <20230604085500.ioaos3ydehvqq24i@skbuf> From: Rob Herring Date: Fri, 16 Jun 2023 11:57:43 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH pci] PCI: don't skip probing entire device if first fn OF node has status = "disabled" To: Vladimir Oltean Cc: Jianmin Lv , Liu Peibao , Bjorn Helgaas , linux-pci@vger.kernel.org, netdev@vger.kernel.org, Bjorn Helgaas , Claudiu Manoil , Michael Walle , linux-kernel@vger.kernel.org, Binbin Zhou , Huacai Chen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Sun, Jun 4, 2023 at 2:55=E2=80=AFAM Vladimir Oltean wrote: > Sorry, just now seeing this as I've been out the last month. > On Sat, Jun 03, 2023 at 10:35:50AM +0800, Jianmin Lv wrote: > > > How about 3. handle of_device_is_available() in the probe function of > > > the "loongson, pci-gmac" driver? Would that not work? > > > > > This way does work only for the specified device. There are other devic= es, > > such as HDA, I2S, etc, which have shared pins. Then we have to add > > of_device_is_available() checking to those drivers one by one. And we a= re > > not sure if there are other devices in new generation chips in future. = So > > I'm afraid that the way you mentioned is not suitable for us. If we decided that disabled devices should probe, then that is exactly what will have to be done. The restriction (of shared pins) is in the devices and is potentially per device, so it makes more sense for the device's drivers to handle than the host bridge IMO. (Assuming the core doesn't handle a per device property.) > Got it, so you have more on-chip PCIe devices than the ones listed in > loongson64-2k1000.dtsi, and you don't want to describe them in the > device tree just to put status =3D "disabled" for those devices/functions > that you don't want Linux to use - although you could, and it wouldn't > be that hard or have unintended side effects. > > Though you need to admit, in case you had an on-chip multi-function PCIe > device like the NXP ENETC, and you wanted Linux to not use function 0, > the strategy you're suggesting here that is acceptable for Loongson > would not have worked. > > I believe we need a bit of coordination from PCIe and device tree > maintainers, to suggest what would be the encouraged best practices and > ways to solve this regression for the ENETC. I think we need to define what behavior is correct for 'status =3D "disabled"'. For almost everywhere in DT, it is equivalent to the device is not present. A not present device doesn't probe. There are unfortunately cases where status got ignored/forgotten and PCI was one of those. PCI is a bit different since there are 2 sources of information about a device being present. The intent with PCI is DT overrides what's discovered. For example, 'vendor-id' overrides what's read from the h/w. I think we can fix making the status per function simply by making 'match_driver' be set based on the status. This would move the check later to just before probing. That would not work for a case where accessing the config registers is a problem. It doesn't sound like that's a problem for Loongson based on the above response, but their original solution did prevent that. This change would also mean the PCI quirks would run. Perhaps the func0 memory clearing you need could be run as a quirk instead? Rob