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 X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED083C433E0 for ; Fri, 5 Feb 2021 03:33:02 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93E8361481 for ; Fri, 5 Feb 2021 03:33:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93E8361481 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=m5p.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.81497.150708 (Exim 4.92) (envelope-from ) id 1l7rrG-0004TD-5H; Fri, 05 Feb 2021 03:32:34 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 81497.150708; Fri, 05 Feb 2021 03:32:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l7rrG-0004T6-2A; Fri, 05 Feb 2021 03:32:34 +0000 Received: by outflank-mailman (input) for mailman id 81497; Fri, 05 Feb 2021 03:32:33 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l7rrF-0004Sl-6U for xen-devel@lists.xenproject.org; Fri, 05 Feb 2021 03:32:33 +0000 Received: from mailhost.m5p.com (unknown [74.104.188.4]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 61187142-8eaa-4a28-8043-e8503f06f38b; Fri, 05 Feb 2021 03:32:30 +0000 (UTC) Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.15.2/8.15.2) with ESMTPS id 1153WDlV037679 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 4 Feb 2021 22:32:19 -0500 (EST) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.15.2/8.15.2/Submit) id 1153WD1H037678; Thu, 4 Feb 2021 19:32:13 -0800 (PST) (envelope-from ehem) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 61187142-8eaa-4a28-8043-e8503f06f38b Date: Thu, 4 Feb 2021 19:32:13 -0800 From: Elliott Mitchell To: Rob Herring Cc: Stefano Stabellini , Julien Grall , Elliott Mitchell , xen-devel , Volodymyr Babchuk , julien@xen.org Subject: Re: Question on PCIe Device Tree bindings, Was: [PATCH] xen/arm: domain_build: Ignore device nodes with invalid addresses Message-ID: References: <9b97789b-5560-0186-642a-0501789830e5@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Feb 04, 2021 at 03:52:26PM -0600, Rob Herring wrote: > On Thu, Feb 4, 2021 at 3:33 PM Stefano Stabellini > wrote: > > > > On Thu, 4 Feb 2021, Rob Herring wrote: > > > On Thu, Feb 4, 2021 at 2:36 PM Stefano Stabellini > > > wrote: > > > > > > > > On Thu, 4 Feb 2021, Rob Herring wrote: > > > > > On Thu, Feb 4, 2021 at 11:56 AM Stefano Stabellini > > > > > wrote: > > > > > > > > > > > > Hi Rob, > > > > > > > > > > > > We have a question on the PCIe device tree bindings. In summary, we have > > > > > > come across the Raspberry Pi 4 PCIe description below: > > > > > > > > > > > > > > > > > > pcie0: pcie@7d500000 { > > > > > > compatible = "brcm,bcm2711-pcie"; > > > > > > reg = <0x0 0x7d500000 0x0 0x9310>; > > > > > > device_type = "pci"; > > > > > > #address-cells = <3>; > > > > > > #interrupt-cells = <1>; > > > > > > #size-cells = <2>; > > > > > > interrupts = , > > > > > > ; > > > > > > interrupt-names = "pcie", "msi"; > > > > > > interrupt-map-mask = <0x0 0x0 0x0 0x7>; > > > > > > interrupt-map = <0 0 0 1 &gicv2 GIC_SPI 143 > > > > > > IRQ_TYPE_LEVEL_HIGH>; > > > > > > msi-controller; > > > > > > msi-parent = <&pcie0>; > > > > > > > > > > > > ranges = <0x02000000 0x0 0xc0000000 0x6 0x00000000 > > > > > > 0x0 0x40000000>; > > > > > > /* > > > > > > * The wrapper around the PCIe block has a bug > > > > > > * preventing it from accessing beyond the first 3GB of > > > > > > * memory. > > > > > > */ > > > > > > dma-ranges = <0x02000000 0x0 0x00000000 0x0 0x00000000 > > > > > > 0x0 0xc0000000>; > > > > > > brcm,enable-ssc; > > > > > > > > > > > > pci@1,0 { > > > > > > #address-cells = <3>; > > > > > > #size-cells = <2>; > > > > > > ranges; > > > > > > > > > > > > reg = <0 0 0 0 0>; > > > > > > > > > > > > usb@1,0 { > > > > > > reg = <0x10000 0 0 0 0>; > > > > > > resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; > > > > > > }; > > > > > > }; > > > > > > }; > > > > > > > > > > > > > > > > > > Xen fails to parse it with an error because it tries to remap reg = > > > > > > <0x10000 0 0 0 0> as if it was a CPU address and of course it fails. > > > > > > > > > > > > Reading the device tree description in details, I cannot tell if Xen has > > > > > > a bug: the ranges property under pci@1,0 means that pci@1,0 is treated > > > > > > like a default bus (not a PCI bus), hence, the children regs are > > > > > > translated using the ranges property of the parent (pcie@7d500000). > > > > > > > > > > > > Is it possible that the device tree is missing device_type = > > > > > > "pci" under pci@1,0? Or is it just implied because pci@1,0 is a child of > > > > > > pcie@7d500000? > > > > > > > > > > Indeed, it should have device_type. Linux (only recently due to > > > > > another missing device_type case) will also look at node name, but > > > > > only 'pcie'. > > > > > > > > > > We should be able to create (or extend pci-bus.yaml) a schema to catch > > > > > this case. > > > > > > > > Ah, that is what I needed to know, thank you! Is Linux considering a > > > > node named "pcie" as if it has device_type = "pci"? > > > > > > Yes, it was added for Rockchip RK3399 to avoid a DT update and regression. > > > > > > > In Xen, also to cover the RPi4 case, maybe I could add a check for the > > > > node name to be "pci" or "pcie" and if so Xen could assume device_type = > > > > "pci". > > > > > > I assume this never worked for RPi4 (and Linux will have the same > > > issue), so can't we just update the DT in this case? > > > > I am not sure where the DT is coming from, probably from the RPi4 kernel > > trees or firmware. I think it would be good if somebody got in touch to > > tell them they have an issue. > > So you just take whatever downstream RPi invents? Good luck. > > > Elliot, where was that device tree coming from originally? Please excuse my very weak device-tree fu... I'm unsure which section is the problem, but looking at `git blame` what shows is commt d5c8dc0d4c880fbde5293cc186b1ab23466254c4. This commit is present in the Linux master branch and the linux-5.10.y branch. You were saying? -- (\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | ehem+sigmsg@m5p.com PGP 87145445 | ) / \_CS\ | _____ -O #include O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445