Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Saravana Kannan <saravanak@google.com>
Cc: Rob Herring <robh@kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Heiko Stuebner <heiko@sntech.de>, PCI <linux-pci@vger.kernel.org>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	Bjorn Helgaas <helgaas@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Android Kernel Team <kernel-team@android.com>,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/2] PCI: rockchip: Work around missing device_type property in DT
Date: Tue, 18 Aug 2020 20:02:59 +0100
Message-ID: <d6f0894a81c645d66480310cd741a44e@kernel.org> (raw)
In-Reply-To: <CAGETcx-hkz8fyAHuhRi=JhBFu4YUmL2UpHfgs7doLHK-RdKA0A@mail.gmail.com>

On 2020-08-18 18:48, Saravana Kannan wrote:
> On Tue, Aug 18, 2020 at 10:34 AM Marc Zyngier <maz@kernel.org> wrote:

[...]

>> OK. So how about something like this?
>> 
>> diff --git a/drivers/of/address.c b/drivers/of/address.c
>> index 590493e04b01..a7a6ee599b14 100644
>> --- a/drivers/of/address.c
>> +++ b/drivers/of/address.c
>> @@ -134,9 +134,13 @@ static int of_bus_pci_match(struct device_node 
>> *np)
>>          * "pciex" is PCI Express
>>          * "vci" is for the /chaos bridge on 1st-gen PCI powermacs
>>          * "ht" is hypertransport
>> +        *
>> +        * If none of the device_type match, and that the node name is
>> +        * "pcie", accept the device as PCI (with a warning).
>>          */
>>         return of_node_is_type(np, "pci") || of_node_is_type(np, 
>> "pciex") ||
>> -               of_node_is_type(np, "vci") || of_node_is_type(np, 
>> "ht");
>> +               of_node_is_type(np, "vci") || of_node_is_type(np, 
>> "ht") ||
>> +               WARN_ON_ONCE(of_node_name_eq(np, "pcie"));
> 
> I don't think we need the _ONCE. Otherwise, it'd warn only for the
> first device that has this problem.

Because probing devices doesn't necessarily occur once. Case in point,
it takes *10 to 15* attempts for a rk3399 system such as mine to finally
probe its PCIe device, thanks to the wonderful -EPROBE_DEFER.

Do I want to see the same stack trace 10 (or more) times? No.

> How about?
> WARN(of_node_name_eq(np, "pcie"), "Missing device type in %pOF", np)
> 
> That'll even tell them which node is bad.

I explained my objections above. Spitting out the device node is
useful, but there is no need to be exhaustive (if you're in a
position to fix the DT, you can track all the broken instances
for your device easily).

I'm actually minded to tone it down even more, because the stack
trace is meaningless to most users. See below for a revised patch.

         M.

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 590493e04b01..b37bd9cc2810 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -128,15 +128,29 @@ static unsigned int of_bus_pci_get_flags(const 
__be32 *addr)
   * PCI bus specific translator
   */

+static bool of_node_is_pcie(struct device_node *np)
+{
+	bool is_pcie = of_node_name_eq(np, "pcie");
+
+	if (is_pcie)
+		pr_warn_once("%pOF: Missing device_type\n", np);
+
+	return is_pcie;
+}
+
  static int of_bus_pci_match(struct device_node *np)
  {
  	/*
   	 * "pciex" is PCI Express
  	 * "vci" is for the /chaos bridge on 1st-gen PCI powermacs
  	 * "ht" is hypertransport
+	 *
+	 * If none of the device_type match, and that the node name is
+	 * "pcie", accept the device as PCI (with a warning).
  	 */
  	return of_node_is_type(np, "pci") || of_node_is_type(np, "pciex") ||
-		of_node_is_type(np, "vci") || of_node_is_type(np, "ht");
+		of_node_is_type(np, "vci") || of_node_is_type(np, "ht") ||
+		of_node_is_pcie(np);
  }

  static void of_bus_pci_count_cells(struct device_node *np,

-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-15 12:51 [PATCH 0/2] PCI: rockchip: Fix PCIe probing in 5.9 Marc Zyngier
2020-08-15 12:51 ` [PATCH 1/2] PCI: rockchip: Work around missing device_type property in DT Marc Zyngier
2020-08-15 23:22   ` Bjorn Helgaas
2020-08-16 10:39     ` Marc Zyngier
2020-08-17 16:12       ` Rob Herring
2020-08-18  7:35         ` Marc Zyngier
2020-08-18 14:23           ` Rob Herring
2020-08-18 17:34             ` Marc Zyngier
2020-08-18 17:48               ` Saravana Kannan
2020-08-18 19:02                 ` Marc Zyngier [this message]
2020-08-18 19:06                   ` Rob Herring
2020-08-15 12:51 ` [PATCH 2/2] arm64: dts: rockchip: Fix PCIe DT properties Marc Zyngier
2021-01-09 15:39 ` (subset) [PATCH 0/2] PCI: rockchip: Fix PCIe probing in 5.9 Heiko Stuebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6f0894a81c645d66480310cd741a44e@kernel.org \
    --to=maz@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=heiko@sntech.de \
    --cc=helgaas@kernel.org \
    --cc=kernel-team@android.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=shawn.lin@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git