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=-6.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 48186C433DB for ; Thu, 4 Feb 2021 21:53:01 +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 CEA7964FA0 for ; Thu, 4 Feb 2021 21:53:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEA7964FA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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.81450.150596 (Exim 4.92) (envelope-from ) id 1l7mYO-0007mY-36; Thu, 04 Feb 2021 21:52:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 81450.150596; Thu, 04 Feb 2021 21:52:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l7mYN-0007mR-Vy; Thu, 04 Feb 2021 21:52:43 +0000 Received: by outflank-mailman (input) for mailman id 81450; Thu, 04 Feb 2021 21:52:42 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l7mYM-0007mM-2M for xen-devel@lists.xenproject.org; Thu, 04 Feb 2021 21:52:42 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 725cb6a7-0189-4698-8235-552ec516869f; Thu, 04 Feb 2021 21:52:41 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 1575C64FA0 for ; Thu, 4 Feb 2021 21:52:40 +0000 (UTC) Received: by mail-ej1-f50.google.com with SMTP id i8so8163926ejc.7 for ; Thu, 04 Feb 2021 13:52:40 -0800 (PST) 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: 725cb6a7-0189-4698-8235-552ec516869f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612475560; bh=CA6RZ5cZsWmFr6tnDtX1gfiPU9iDcd+i935vjkJp2io=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=vAU78h1ADWrcT9HDMa2RDBNIBCVnJefNWsj+7Fdx4uzjSIe9BfUwsF9hXOUbEUcLB YpijZ+LHNEIpk4tnm+Tq25TGnYbxkbi6/POc8kn+mGckTxs2bv18BEZnef5oaAwiL2 2AnXkyDw5vYHgUZNUg39rIEL6U0cS3IPhFTDatUXbyIKa1fVEvETpqIQqrKwTN+Nla UCSjguKDNeaXjdOXPfoQH3BnZm+GtG/+L/PGlbnvkcd6sW8NJ3L/TgKbui0QTCL8fr ktBl2DU8sn6Z4zuYo7Vhy9pcDJrLpDApvyYeQZ4w/PC3KaNelTXtW7H32KfUcAPZWn qBpBeo74wZsWQ== X-Gm-Message-State: AOAM533/NlAidBWYgGgbCo2cJo0ysZEsW9fHEEujuMk9HVM70AAHgAnd 8E89w6HzbsFSUhCdpw/tObTA8U49uGr00CNMjQ== X-Google-Smtp-Source: ABdhPJyJOl5DBjCX9pBRmiwHlyIHxZYHXS14HqHDUjfknEaVuT+HKQjxh0VQ/dx+TbjCRvLzC3BcUXWc7pGCLbulytg= X-Received: by 2002:a17:906:c9d8:: with SMTP id hk24mr1138761ejb.468.1612475557780; Thu, 04 Feb 2021 13:52:37 -0800 (PST) MIME-Version: 1.0 References: <06d6b9ec-0db9-d6da-e30b-df9f9381157d@xen.org> <9b97789b-5560-0186-642a-0501789830e5@xen.org> In-Reply-To: From: Rob Herring Date: Thu, 4 Feb 2021 15:52:26 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Question on PCIe Device Tree bindings, Was: [PATCH] xen/arm: domain_build: Ignore device nodes with invalid addresses To: Stefano Stabellini Cc: Julien Grall , Elliott Mitchell , xen-devel , Volodymyr Babchuk , julien@xen.org Content-Type: text/plain; charset="UTF-8" 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? > > > From a Xen perspective, for the sake of minimizing user pains (given > that it might take a while to update those DTs) and to introduce as few > ties as possible with kernel versions, it might be best to add the > "pci" name workaround maybe with a /* HACK */ comment on top. There is some possibility of that causing a regression on another platform. That's why we limited Linux as much as possible and also print a warning. But we have to worry about 20 year old PowerMacs and such. Rob