Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1353669rwb; Thu, 10 Nov 2022 15:07:06 -0800 (PST) X-Google-Smtp-Source: AMsMyM4vEeNGEHYR4QeiPeBb5BhEIMCeuuNiFxR1c1sSJOcV5DwdKiaHqdzSIclmJCSPjTrPC39b X-Received: by 2002:a17:906:6889:b0:79f:cd7c:e861 with SMTP id n9-20020a170906688900b0079fcd7ce861mr4004472ejr.339.1668121626469; Thu, 10 Nov 2022 15:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668121626; cv=none; d=google.com; s=arc-20160816; b=bR30DsQo3xgwXZDzi2zHE3kmTW3ji0/VCfnQgI6Q3ty2vNwxq6TRQo1E5AlBttPiEr 2VOk8p+UCj9IkmZfsW6QqGU9JPjusTDAv1xlPqa8h7Zqpe0jgxDYY5FaVaS+NoLVOMgQ L8sVu6Y8x6eK9HbyGif8VUfKlz94zKMWX559IRGE+DvRCWmMnirp4fc7NKuZ9d8pnLIT HIPwEn7FNXogkUMFgMkG/DWlmqwfOOgFV2IKv1peUIVy2d9SMSljMhlw5gV79GN3h/mK f8JQ1cqKeYBpK0ePmRtKOQmEwY1Fu/n4fqhDXk+zgjtCEa+jcN8KuXsbVVCdfouPSyd+ 2qUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :feedback-id:dkim-signature:dkim-signature; bh=UKPaSMTeXe77X1VLSlbMaY688QZMhA56dV06akS0nEI=; b=YSuTy3pfiqrv7qCteuaH2drRRWpwbYbRyMYpICCIB+Y++Ix3yVJkvkHIxjFkKJqwJq OS4P3QRrmh0hgEKFsEMwAm35vHcss8Oy8vplcJOYAL/i8Z0XN+IRBHPj8JGqQAVxsxW9 pUkq/DrO7EpenhA6GhEAAhkX2Ktri5b8qf82PHQFbtMBSUPFOMn2iKzLmTDHTk/14yzg 8IzkIkSR2r2FegvN1+fYuZLZ9XUTsPlTkjadxcsyvviEv6QhaP8X11Fcc7YtfPILJBdT GBCbh5zKKxv3MLHXmZBVsqcOc0gQqcBDZ9i14I4tg5R7j5HK8nAzp2PzkzlGeemtTozf v6FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=JQmGNouc; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=g9HuPmYc; 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=flygoat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs14-20020a0564020c4e00b00462e4cbe815si790340edb.550.2022.11.10.15.06.43; Thu, 10 Nov 2022 15:07:06 -0800 (PST) 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=@flygoat.com header.s=fm2 header.b=JQmGNouc; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=g9HuPmYc; 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=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231277AbiKJXBR (ORCPT + 92 others); Thu, 10 Nov 2022 18:01:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231586AbiKJXBM (ORCPT ); Thu, 10 Nov 2022 18:01:12 -0500 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 824815F84B; Thu, 10 Nov 2022 15:01:09 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 437505C00DF; Thu, 10 Nov 2022 18:01:06 -0500 (EST) Received: from imap44 ([10.202.2.94]) by compute4.internal (MEProxy); Thu, 10 Nov 2022 18:01:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1668121266; x= 1668207666; bh=UKPaSMTeXe77X1VLSlbMaY688QZMhA56dV06akS0nEI=; b=J QmGNoucBS4EB9kN1WZiOV7WjS0oh/yBxWSi9iqh994VShw8N7ccdEXdTiqyo7Ayc CpT7Jytu36EnWUzHAVq/0cWU5emG3BrixWCr1y6K+HHPQKccGUXbVtMFcrgaQfVe m0oA/ZoMfA/OoJ78ZKrNAA7GKPOwoweI6uCYMX5InRsSH/JGeAQiu1NBOVdHdXH7 4lPeBE2mX1wMj2wcA0PkU8MVoncVihIlkkCAVeQeaIibFZPLNC8TddHVJ6tBYWf4 0j8xCqSwA0lG1ARbs1qu//izLhkojqJzWSh58lJR/S8kFTxqsUZq6ERE8l6smWCf Vt/A5cfPrBFX4V8z47klg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1668121266; x= 1668207666; bh=UKPaSMTeXe77X1VLSlbMaY688QZMhA56dV06akS0nEI=; b=g 9HuPmYcvJBDaMQqo9ub73ZT03x7r/WTOghZDdbV5QA01MHFSGn/YeAZLou2LD8JF 42oGLlB8bSFatcYyHEGAZNCCkBIVNTQGyjhOf67JMPxUpkN/JzMKj2DWRferuziS DPy2tDkpNk1qBfbO+G76CJdWvZJ4grw2peXo0x6WT878Iak1FLB9YMa07J9g3J6O qS0EryYbTUpx0M985RPPHyVIofwSRhzYpfB+FVX56pbd+EBdBcpJrIYsM1Y3Bj8D xX3F/gBEEkZP28dgQQQCcefVJ+FGsANlPqqPz7QldEk7JimVp9SZ9WKQ/Q02Pdt7 /9qtbBmbF0uc0+XRxeGNQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeehgddthecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedflfhi rgiguhhnucgjrghnghdfuceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh eqnecuggftrfgrthhtvghrnhepudefgeeftedugeehffdtheefgfevffelfefghefhjeeu geevtefhudduvdeihefgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7725A36A0073; Thu, 10 Nov 2022 18:01:05 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1115-g8b801eadce-fm-20221102.001-g8b801ead Mime-Version: 1.0 Message-Id: In-Reply-To: <20221110210731.GA672063@bhelgaas> References: <20221110210731.GA672063@bhelgaas> Date: Thu, 10 Nov 2022 23:00:45 +0000 From: "Jiaxun Yang" To: "Bjorn Helgaas" , "Liu Peibao" Cc: "Bjorn Helgaas" , "Rob Herring" , "Krzysztof Kozlowski" , "Lorenzo Pieralisi" , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , "Christophe JAILLET" , "Huacai Chen" , "Jianmin Lv" , "Yinbo Zhu" , linux-pci , linux-kernel@vger.kernel.org Subject: Re: [PATCH V4] PCI: loongson: Skip scanning unavailable child devices Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS 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 =E5=9C=A82022=E5=B9=B411=E6=9C=8810=E6=97=A5=E5=8D=81=E4=B8=80=E6=9C=88 = =E4=B8=8B=E5=8D=889:07=EF=BC=8CBjorn Helgaas=E5=86=99=E9=81=93=EF=BC=9A > On Tue, Nov 08, 2022 at 02:42:40PM +0800, Liu Peibao wrote: >> The PCI Controller of 2k1000 could not mask devices by setting vender= ID or >> device ID in configuration space header as invalid values. When there= are >> pins shareable between the platform device and PCI device, if the pla= tform >> device is preferred, we should not scan this PCI device. In the above >> scene, add `status =3D "disabled"` property in DT node of this PCI de= vice. >>=20 >> Signed-off-by: Liu Peibao >> --- >> V3 -> V4: 1. get rid of the masklist and search the status property >> directly. >> 2. check the status property only when accessing the vendor= ID. >> V2 -> V3: 1. use list_for_each_entry() for more clearly. >> 2. fix wrong use of sizeof(). >> V1 -> V2: use existing property "status" instead of adding new proper= ty. >>=20 >> drivers/pci/controller/pci-loongson.c | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >>=20 >> diff --git a/drivers/pci/controller/pci-loongson.c b/drivers/pci/cont= roller/pci-loongson.c >> index 05c50408f13b..efca0b3b5a29 100644 >> --- a/drivers/pci/controller/pci-loongson.c >> +++ b/drivers/pci/controller/pci-loongson.c >> @@ -194,6 +194,17 @@ static void __iomem *pci_loongson_map_bus(struct= pci_bus *bus, >> return NULL; >> } >> =20 >> +#ifdef CONFIG_OF >> + /* Don't access disabled devices. */ >> + if (pci_is_root_bus(bus) && where =3D=3D PCI_VENDOR_ID) { >> + struct device_node *dn; >> + >> + dn =3D of_pci_find_child_device(bus->dev.of_node, devfn); >> + if (dn && !of_device_is_available(dn)) >> + return NULL; >> + } >> +#endif > > Looks nice and simple, thanks for trying this out. Should we make this into common PCI code? I guess Loongson won=E2=80=99t be the last platform having such problem. > >> /* CFG0 can only access standard space */ >> if (where < PCI_CFG_SPACE_SIZE && priv->cfg0_base) >> return cfg0_map(priv, bus, devfn, where); >> --=20 >> 2.20.1 >> --=20 - Jiaxun