From: Marc Zyngier <maz@kernel.org>
To: Rob Herring <robh+dt@kernel.org>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>,
Frank Rowand <frowand.list@gmail.com>,
"open list:MIPS" <linux-mips@vger.kernel.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Huacai Chen <chenhc@lemote.com>,
Paul Burton <paulburton@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Nathan Chancellor <natechancellor@gmail.com>,
Nick Desaulniers <ndesaulniers@google.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Android Kernel Team <kernel-team@android.com>
Subject: Re: [PATCH v4 1/5] of_address: Add bus type match for pci ranges parser
Date: Sat, 15 Aug 2020 12:22:41 +0100 [thread overview]
Message-ID: <34ac2d7c0770f9aa450aaa3905c82f52@kernel.org> (raw)
In-Reply-To: <CAL_JsqKVhxu_cdo_umhY_SfuDhCC0G-AdsPAZpGB3eepOVFi-g@mail.gmail.com>
On 2020-08-14 23:51, Rob Herring wrote:
> On Fri, Aug 14, 2020 at 12:21 PM Marc Zyngier <maz@kernel.org> wrote:
>>
>> Hi all,
>>
>> On 2020-07-28 16:36, Jiaxun Yang wrote:
>> > So the parser can be used to parse range property of ISA bus.
>> >
>> > As they're all using PCI-like method of range property, there is no
>> > need
>> > start a new parser.
>> >
>> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> > Reviewed-by: Rob Herring <robh@kernel.org>
>>
>> This patch, although it looks correct, breaks the RK3399-based
>> systems, as they miss the (now required) 'device_type = "pci";'
>> property.
>
> Required since 1990 something...
And yet... The fact that it has been broken from day-1 (3.5 years
ago) shows how good we are at enforcing those requirements.
>
>> We can fix the in-tree DT, but that's not really an option
>> if someone relies on the DT being provided by the firmware
>> (I for one definitely do).
>
> Perhaps time to pay attention to schema errors:
>
> arch/arm64/boot/dts/rockchip/rk3399-sapphire-excavator.dt.yaml:
> pcie@f8000000: 'device_type' is a required property
As long as this isn't part of the normal build flow, these errors
will get ignored. I don't even know how to trigger this validation,
TBH.
> (I thought dtc would also catch this, but there we look for
> device_type and then do PCI checks like node name. I guess we needed
> to check for either device_type or the node name...)
That would be much better. At least this *does* run at build time.
>
>> I came up with the following hack, which solves the issue for
>> me. Definitely not my finest hour, but I really need this box
>> to keep going. I will post a patch fixing the DT separately.
>>
>> Thanks,
>>
>> M.
>>
>> From ceef5fd9c4d2005eb577505c68868ebe527c098f Mon Sep 17 00:00:00
>> 2001
>> From: Marc Zyngier <maz@kernel.org>
>> Date: Fri, 14 Aug 2020 19:10:12 +0100
>> Subject: [PATCH] of: address: Workaround broken DTs missing the
>> 'device_type =
>> "pci"' property
>>
>> Recent changes to the PCI bus parsing made it mandatory for
>> device trees nodes describing a PCI controller to have the
>> 'device_type = "pci"' property for the node to be matched.
>>
>> Although this is compliant with the specification, it breaks
>> existing device-trees that have been working fine for years
>> (the Rockchip rk3399-based systems being a prime example of
>> such breakage).
>>
>> In order to paper over the blunder, let's also match nodes
>> that have the "linux,pci-domain" property, as they are
>> pretty likely to be PCI nodes. This fixes the issue for
>> systems such as the above platforms.
>>
>> Fixes: 2f96593ecc37 ("of_address: Add bus type match for pci ranges
>> parser")
>> Signed-off-by: Marc Zyngier <maz@kernel.org>
>> ---
>> drivers/of/address.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/of/address.c b/drivers/of/address.c
>> index 590493e04b01..712e03781a2a 100644
>> --- a/drivers/of/address.c
>> +++ b/drivers/of/address.c
>> @@ -134,9 +134,12 @@ 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
>> + * "linux,pci-domain" is a workaround for broken device trees
>> + * lacking the required "device_type" property.
>
> I would suggest looking for 'pci' or 'pcie' node name instead.
>
> You should remove linux,pci-domain from rk3399 as it is pointless when
> there's a single PCI host bridge.
Indeed. I was clutching at straws here.
>
> The other option is fixup the live tree with of_add_property() in the
> Rockchip PCI driver. Less likely to impact anyone else.
That's actually a much better solution, thanks for pointing this out.
At least I can shout about broken DTs while fixing it up, and the
new fix is fairly neat.
I'll post new patches shortly.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2020-08-15 22:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 15:36 [PATCH v4 0/5] MIPS: Loongson64: Process ISA Node in DeviceTree Jiaxun Yang
2020-07-28 15:36 ` [PATCH v4 1/5] of_address: Add bus type match for pci ranges parser Jiaxun Yang
2020-08-14 18:21 ` Marc Zyngier
2020-08-14 22:51 ` Rob Herring
2020-08-15 11:22 ` Marc Zyngier [this message]
2020-07-28 15:36 ` [PATCH v4 2/5] MIPS: Loongson64: Process ISA Node in DeviceTree Jiaxun Yang
2020-07-28 15:36 ` [PATCH v4 3/5] MIPS: Loongson64: Enlarge IO_SPACE_LIMIT Jiaxun Yang
2020-07-28 15:36 ` [PATCH v4 4/5] MIPS: Loongson64: DTS: Fix ISA and PCI I/O ranges for RS780E PCH Jiaxun Yang
2020-07-28 15:36 ` [PATCH v4 5/5] MIPS: Loongson64: Add ISA node for LS7A PCH Jiaxun Yang
2020-07-28 20:52 ` [PATCH v4 0/5] MIPS: Loongson64: Process ISA Node in DeviceTree Thomas Bogendoerfer
2020-07-29 1:48 ` Jiaxun Yang
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=34ac2d7c0770f9aa450aaa3905c82f52@kernel.org \
--to=maz@kernel.org \
--cc=arnd@arndb.de \
--cc=chenhc@lemote.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=paulburton@kernel.org \
--cc=robh+dt@kernel.org \
--cc=tsbogend@alpha.franken.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.