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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18C70C4828E for ; Fri, 2 Feb 2024 21:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=oj2yhHeh7m/BDN87MhxGWw/D4OGEI4sKOSyASDLbnHc=; b=lLDkQ32nmKbSC6 C/0LHSKBWlPwixYT4wQZqr/bIgTo71hT9y0YKeNwsRK/NM5L9MBdIvymrUal3FDUxwOMvepo9uPfN Lxr2J0RE55XeCnXb9kwdkqdkLK2lyCNoQRI/Alf2eq1dMjU3IkGVV9KwxaOpR5Cghjlrkv8Jf6sgd 6f45Qe8LVSQXmfPqU6boYJcMyp3wQQ7ZdijtSQEQj67XMKMG5OnTlBVmMusxdLFtw9i9s+C6NvDwe NUHNeTipRJiGIHSVoWzdRR9SOoITBwYH3foNgbIMYLJhz17ayseUGIY4EOuc7A1UTtepIlEmmkOT8 H1pXL2pDjMRuEiZAxy7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rW1Uc-0000000Dakn-0eHE; Fri, 02 Feb 2024 21:54:38 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rW1UY-0000000Dajc-43q1 for linux-arm-kernel@lists.infradead.org; Fri, 02 Feb 2024 21:54:36 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C35916266F; Fri, 2 Feb 2024 21:54:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E936C433C7; Fri, 2 Feb 2024 21:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706910873; bh=g2E+c2yAPlr4mynw8XRrEWwtZ0cuRU9sb/1VLjj4d+A=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=NS8zPrbawxvDfY0Eh7Q6yuZ1sIPxS165/J7/2Y7tKanOBPLD+4dB3IXc8L5YVGy80 bSWHpRgxY9QHX90pQtSVPTYdQ/RF+IJfmh4C9vwg31doe1ucpeQzgA1E6HsCWaqTHZ WCHB5KJ5V0wkgI2ydWwMccY0UpKEymbcFn/iIF/oxzC7FMfuTNMEXPOkifc6HJT1KX AjBVnvpt9LpUJv70WYr8CkRldTO5/oVEKraxwJZLD566+Vag7nYVd32hSm516qWbzq RYeFz6sshI5fm5CjbRRLRy0SymKXAinGlASjWBOzggBE/yLhBhaEvy48n0tB++7L6V ClG0C1+ZWvgsA== Date: Fri, 2 Feb 2024 15:54:31 -0600 From: Bjorn Helgaas To: Frank Li Cc: manivannan.sadhasivam@linaro.org, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: Re: [PATCH v9 05/16] PCI: imx6: Using "linux,pci-domain" as slot ID Message-ID: <20240202215431.GA728556@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240119171122.3057511-6-Frank.Li@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240202_135435_078537_05A9B917 X-CRM114-Status: GOOD ( 18.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jan 19, 2024 at 12:11:11PM -0500, Frank Li wrote: > Avoid use get slot id by compared with register physical address. If there > are more than 2 slots, compared logic will become complex. > > "linux,pci-domain" already exist at dts since commit: > commit (c0b70f05c87f3b arm64: dts: imx8mq: use_dt_domains for pci node). > > So it is safe to remove compare basic address code: > ... > if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) > imx6_pcie->controller_id = 1; > ... I have no idea what this is telling me. I guess you don't want to use IMX8MQ_PCIE2_BASE_ADDR to decide something? That much sounds good: the *address* of some MMIO space doesn't tell us anything about the function of that space. I expect the "compatible" string to tell the driver what the programming model of the device is. > + /* Using linux,pci-domain as PCI slot id */ > + imx6_pcie->controller_id = of_get_pci_domain_nr(node); > + /* > + * If there are no "linux,pci-domain" property specified in DT, then assume only one > + * controller is available. > + */ > + if (imx6_pcie->controller_id == -EINVAL) > + imx6_pcie->controller_id = 0; > + else if (imx6_pcie->controller_id < 0) > + return dev_err_probe(dev, imx6_pcie->controller_id, > + "linux,pci-domain have wrong value\n"); Maybe I'm missing something here. It looks like this driver uses controller_id to distinguish between hardware variants or maybe between two Root Ports (slots?) in the same SoC? imx6_pcie_grp_offset return imx6_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14; imx6_pcie_configure_type id = imx6_pcie->controller_id if (!drvdata->mode_mask[id]) # <-- looks unsafe id = 0; regmap_update_bits(drvdata->mode_off[id], ...) (This "mode_mask[id]" looks like it will reference garbage if the DT supplies "linux,pci-domain = <2>". A bogus DT shouldn't be able to cause a driver to misbehave like that.) That doesn't seem related to "linux,pci-domain" at all. Bjorn _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel