Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp737515pxb; Wed, 18 Aug 2021 12:58:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymGwRIt1ZEPbHFcoboILylCCq8HdjmQKZfvp0OJQR+11EtgLQjo1RPkx/gQwvvhm/O7K7R X-Received: by 2002:a05:6402:51c7:: with SMTP id r7mr11996966edd.65.1629316724714; Wed, 18 Aug 2021 12:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629316724; cv=none; d=google.com; s=arc-20160816; b=cCfUDV3FLksH1Q1idRj0P08i51e/3FCX8bZ9OtjT8M+MT5djLl0d17s9/JsSsNkUcO fd8SyCR8bx1DkExvReFfEv+ykke/ckXFLgODuLrNaUPwCQg72y3WlIOFrBlZfrtbOqXZ sc+HaM912AVphZbmlYIIpcBYP0PIrRZ/EV/gG/ESCquxiAcKzhIUqw//ALsAlgbHi+7K QjUJSz1q4mRWftElppnPk96HSN0ktZHrCKodE2/MZUMFOmEMPF60PzqMjRYT0RdmqQEL 9pul2lgpGEtZGdL92gSkkNC8IsXMDmy1MfrN5xHUo2Z0xeBz7+iWgWaTzFJiYqU1YWH1 Vxhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:references:subject:in-reply-to:cc:to :from:date; bh=YZNCgdGB2LEsK5rEaPZxg4DBE7js8GbEMMvW+Zyc0yA=; b=PfKA4LXn8Dk+cUAjikaB3Rkck35sU/UkNUT75v5PCZ+jQ3CKRnTMN3S2kklYnldsgf 0E6a5a1ndW7XY2pYH+6BYA7a2bYra6UxS2NZyEGc/iJEkM6puzp8ik0DmwmNjXnlzrAT 5gKnydxfODHcvpx9yIz5SjwHQ4yLrtLmb33m//IFw1KYhDkBa5G0c44JSiFASS3EhEaQ wh2RO2E8U7Qunbwi+pos0tZJKk2IFBHIr/huQVukFew6gp82iwhgxCLA1XTBBtr2byLW OoiwUo2ui7PiVjZKuo68T94+JWp/qgy1nGBrNIwNylJzzakaGLK2ptu62bA0ozWl2sZi rzMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si1050653ejj.198.2021.08.18.12.58.21; Wed, 18 Aug 2021 12:58:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233061AbhHRT5E (ORCPT + 99 others); Wed, 18 Aug 2021 15:57:04 -0400 Received: from sibelius.xs4all.nl ([83.163.83.176]:56752 "EHLO sibelius.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232969AbhHRT4y (ORCPT ); Wed, 18 Aug 2021 15:56:54 -0400 Received: from localhost (bloch.sibelius.xs4all.nl [local]) by bloch.sibelius.xs4all.nl (OpenSMTPD) with ESMTPA id e0d5b866; Wed, 18 Aug 2021 21:56:10 +0200 (CEST) Date: Wed, 18 Aug 2021 21:56:10 +0200 (CEST) From: Mark Kettenis To: Rob Herring Cc: maz@kernel.org, devicetree@vger.kernel.org, robin.murphy@arm.com, sven@svenpeter.dev, kettenis@openbsd.org, marcan@marcan.st, bhelgaas@google.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: (message from Rob Herring on Sun, 15 Aug 2021 14:19:57 -0500) Subject: Re: [PATCH v3 1/2] dt-bindings: pci: Add DT bindings for apple,pcie References: <20210726083204.93196-1-mark.kettenis@xs4all.nl> <20210726083204.93196-2-mark.kettenis@xs4all.nl> <20210726231848.GA1025245@robh.at.kernel.org> <87sfzt1pg9.wl-maz@kernel.org> <8735ra1x8t.wl-maz@kernel.org> Message-ID: <56140331bd735d61@bloch.sibelius.xs4all.nl> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Rob Herring > Date: Sun, 15 Aug 2021 14:19:57 -0500 > > On Sun, Aug 15, 2021 at 11:36 AM Marc Zyngier wrote: > > > > Hi Rob, > > > > Apologies for the delay, I somehow misplaced this email... > > > > On Mon, 02 Aug 2021 17:10:39 +0100, > > Rob Herring wrote: > > > > > > On Sun, Aug 1, 2021 at 3:31 AM Marc Zyngier wrote: > > > > > > > > On Tue, 27 Jul 2021 00:18:48 +0100, > > > > Rob Herring wrote: > > > > > > > > > > On Mon, Jul 26, 2021 at 10:32:00AM +0200, Mark Kettenis wrote: > > > > > > From: Mark Kettenis > > > > > > > > > > > > The Apple PCIe host controller is a PCIe host controller with > > > > > > multiple root ports present in Apple ARM SoC platforms, including > > > > > > various iPhone and iPad devices and the "Apple Silicon" Macs. > > > > > > > > > > > > Signed-off-by: Mark Kettenis > > > > > > --- > > > > > > .../devicetree/bindings/pci/apple,pcie.yaml | 166 ++++++++++++++++++ > > > > > > MAINTAINERS | 1 + > > > > > > 2 files changed, 167 insertions(+) > > > > > > create mode 100644 Documentation/devicetree/bindings/pci/apple,pcie.yaml > > > > > > > > > > > > diff --git a/Documentation/devicetree/bindings/pci/apple,pcie.yaml b/Documentation/devicetree/bindings/pci/apple,pcie.yaml > > > > > > new file mode 100644 > > > > > > index 000000000000..bfcbdee79c64 > > > > > > --- /dev/null > > > > > > +++ b/Documentation/devicetree/bindings/pci/apple,pcie.yaml > > > > > > @@ -0,0 +1,166 @@ > > > > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > > > > > +%YAML 1.2 > > > > > > +--- > > > > > > +$id: http://devicetree.org/schemas/pci/apple,pcie.yaml# > > > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > > > > + > > > > > > +title: Apple PCIe host controller > > > > > > + > > > > > > +maintainers: > > > > > > + - Mark Kettenis > > > > > > + > > > > > > +description: | > > > > > > + The Apple PCIe host controller is a PCIe host controller with > > > > > > + multiple root ports present in Apple ARM SoC platforms, including > > > > > > + various iPhone and iPad devices and the "Apple Silicon" Macs. > > > > > > + The controller incorporates Synopsys DesigWare PCIe logic to > > > > > > + implements its root ports. But the ATU found on most DesignWare > > > > > > + PCIe host bridges is absent. > > > > > > > > > > blank line > > > > > > > > > > > + All root ports share a single ECAM space, but separate GPIOs are > > > > > > + used to take the PCI devices on those ports out of reset. Therefore > > > > > > + the standard "reset-gpio" and "max-link-speed" properties appear on > > > > > > > > > > reset-gpios > > > > > > > > > > > + the child nodes that represent the PCI bridges that correspond to > > > > > > + the individual root ports. > > > > > > > > > > blank line > > > > > > > > > > > + MSIs are handled by the PCIe controller and translated into regular > > > > > > + interrupts. A range of 32 MSIs is provided. These 32 MSIs can be > > > > > > + distributed over the root ports as the OS sees fit by programming > > > > > > + the PCIe controller's port registers. > > > > > > + > > > > > > +allOf: > > > > > > + - $ref: /schemas/pci/pci-bus.yaml# > > > > > > + > > > > > > +properties: > > > > > > + compatible: > > > > > > + items: > > > > > > + - const: apple,t8103-pcie > > > > > > + - const: apple,pcie > > > > > > + > > > > > > + reg: > > > > > > + minItems: 3 > > > > > > + maxItems: 5 > > > > > > + > > > > > > + reg-names: > > > > > > + minItems: 3 > > > > > > + maxItems: 5 > > > > > > + items: > > > > > > + - const: config > > > > > > + - const: rc > > > > > > + - const: port0 > > > > > > + - const: port1 > > > > > > + - const: port2 > > > > > > + > > > > > > + ranges: > > > > > > + minItems: 2 > > > > > > + maxItems: 2 > > > > > > + > > > > > > + interrupts: > > > > > > + description: > > > > > > + Interrupt specifiers, one for each root port. > > > > > > + minItems: 1 > > > > > > + maxItems: 3 > > > > > > + > > > > > > + msi-controller: true > > > > > > + msi-parent: true > > > > > > + > > > > > > + msi-ranges: > > > > > > + description: > > > > > > + A list of pairs , where "intid" is the first > > > > > > + interrupt number that can be used as an MSI, and "span" the size > > > > > > + of that range. > > > > > > + $ref: /schemas/types.yaml#/definitions/uint32-matrix > > > > > > + items: > > > > > > + minItems: 2 > > > > > > + maxItems: 2 > > > > > > > > > > I still have issues I raised on v1 with this property. It's genericish > > > > > looking, but not generic. 'intid' as a single cell can't specify any > > > > > parent interrupt such as a GIC which uses 3 cells. You could put in all > > > > > the cells, but you'd still be assuming which cell you can increment. > > > > > > > > The GIC bindings already use similar abstractions, see what we do for > > > > both GICv2m and GICv3 MBIs. Other MSI controllers use similar > > > > properties (alpine and loongson, for example). > > > > > > That's the problem. Everyone making up their own crap. > > > > And that crap gets approved: > > > > https://lore.kernel.org/lkml/20200512205704.GA10412@bogus/ > > > > I'm not trying to be antagonistic here, but it seems that your > > position on this very subject has changed recently. > > Not really, I think it's not the first time we've discussed this. But > as I see things over and over, my tolerance for another instance > without solving the problem for everyone diminishes. And what other > leverage do I have? > > Additionally, how long we have to support something comes into play. I > have no idea for a Loongson MSI controller. I have a better idea on an > Apple product... > > > > > > I think you should just list all these under 'interrupts' using > > > > > interrupt-names to make your life easier: > > > > > > > > > > interrupt-names: > > > > > items: > > > > > - const: port0 > > > > > - const: port1 > > > > > - const: port2 > > > > > - const: msi0 > > > > > - const: msi1 > > > > > - const: msi2 > > > > > - const: msi3 > > > > > ... > > > > > > > > > > Yeah, it's kind of verbose, but if the h/w block handles N interrupts, > > > > > you should list N interrupts. The worst case for the above is N entries > > > > > too if not contiguous. > > > > > > > > And that's where I beg to differ, again. > > > > > > > > Specifying interrupts like this gives the false impression that these > > > > interrupts are generated by the device that owns them (the RC). Which > > > > for MSIs is not the case. > > > > > > It's no different than an interrupt controller node having an > > > interrupts property. The source is downstream and the interrupt > > > controller is combining/translating the interrupts. > > > > > > The physical interrupt signals are connected to and originating in > > > this block. > > > > Oh, I also object to this, for the same reasons. The only case where > > it makes sense IMHO is when the interrupt controller is a multiplexer. > > So we've had the same kind of property for interrupt multiplexers. I'm > fine if you think an 'MSI to interrupts mapping property' should be > named something else. > > > > That sounds like perfectly 'describing the h/w' to me. > > > > I guess we have a different view of about these things. At the end of > > the day, I don't care enough as long as we can expose a range of > > interrupts one way or another. > > I don't really either. I just don't want 10 ways AND another... > > > > > This is not only verbose, this is > > > > semantically dubious. And what should we do when the number of > > > > possible interrupt is ridiculously large, as it is for the GICv3 ITS? > > > > > > I don't disagree with the verbose part. But that's not really an issue > > > in this case. > > > > > > > I wish we had a standard way to express these constraints. Until we > > > > do, I don't think enumerating individual interrupts is a practical > > > > thing to do, nor that it actually represents the topology of the > > > > system. > > > > > > The only way a standard way will happen is to stop accepting the > > > custom properties. > > > > > > All the custom properties suffer from knowledge of what the parent > > > interrupt controller is. To fix that, I think we need something like > > > this: > > > > > > msi-ranges = , , ; > > > > > > 'intspec' is defined by the parent interrupt-controller cells. step is > > > the value to add. And end is what to match on to stop aka the last > > > interrupt in the range. For example, if the GIC is the parent, we'd > > > have something like this: > > > > > > , <0 1 0>, > > > > > > Does this apply to cases other than MSI? I think so as don't we have > > > the same type of properties with the low power mode shadow interrupt > > > controllers? So 'interrupt-ranges'? > > > > This would work, though the increment seems a bit over-engineered. You > > also may need this property to accept multiple ranges. > > Yes, certainly. Worst case is a map. > > > > It looks to me like there's an assumption in the kernel that an MSI > > > controller has a linear range of parent interrupts? Is that correct > > > and something that's guaranteed? That assumption leaks into the > > > existing bindings. > > > > Depends on how the controller works. In general, the range maps to the > > MultiMSI requirements where the message is an offset from the base of > > the interrupt range. So you generally end-up with ranges of at least > > 32 contiguous MSIs. Anything under that is sub-par and probably not > > worth supporting. > > Maybe just this is enough: > msi-ranges = , , , , ... > > While I say 'length' here, that's really up to the interrupt parent to > interpret the intspec cells. So for the Apple PCIe controller we'd have: msi-ranges = ; That would work just fine. Should this be documented in the apple,pcie binding, or somewhere more generic? > > Of course, the controller may have some mapping facilities, which > > makes things more... interesting. > > > > > It's fine for the kernel to assume that until there's a case that's > > > not linear, but a common binding needs to be able handle a > > > non-linear case. > > > > Fair enough. I can probably work with Mark to upgrade the binding and > > the M1 PCIe code. Could you come up with a more formalised proposal? > > Not my itch. > > Rob >