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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ED5EC43217 for ; Thu, 10 Nov 2022 23:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230462AbiKJXBR (ORCPT ); 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 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