linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Saravana Kannan <saravanak@google.com>
Cc: Rob Herring <robh@kernel.org>, Bjorn Helgaas <helgaas@kernel.org>,
	PCI <linux-pci@vger.kernel.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Android Kernel Team <kernel-team@android.com>
Subject: Re: [PATCH 1/2] PCI: rockchip: Work around missing device_type property in DT
Date: Tue, 18 Aug 2020 20:02:59 +0100	[thread overview]
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...

  reply	other threads:[~2020-08-18 19:03 UTC|newest]

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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).