Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp1094974pxy; Sun, 15 Aug 2021 09:37:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDFFdPfo3M0zmkgn4boa9VGmRI1nio2fky+idkII+yffYXd/82rDsmc3pcYGJf0gssebSz X-Received: by 2002:a17:906:54c:: with SMTP id k12mr11841145eja.429.1629045464067; Sun, 15 Aug 2021 09:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629045464; cv=none; d=google.com; s=arc-20160816; b=dDKsrxlgqHqrGtKgCemlqlT/Ii+tqyy7/I5OK+wLI+rQUOofi5Nq1trNl/32Ofof04 PiR04JXgPnepvtmVc9FZzEGfM4kHZAQXjrFSkqrNpnWiW7PUT33br6s4OM3lEDVkdf/Y yG0e9SYb6qfpyWnqXbD/6j6cdgb7mD3r/gj3e7K9+UFJHN7ZYFC1xFB0d3ik446jATMc TpXAuQVuB7fFYMZngvihfJV4EQDH9lfZwf+sI5V80Ujl0vXzehBThDUERTA69z1mn2kN 6VcnViV9bhIlkPgMOcjuVN2ii/RUNsAQKWfctN3Oi4C8i0NDd04xX4BLTjhkIjN9vyn6 bYnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=a7+2IuxPEEUSz/hpylVa3BagphEjd/mtB2XgbZ0QyOY=; b=MvfYRgDGpZDS/dcjwnCSq9pLDELSMBi5LXrD01L75YPbtP/uoqmHB5t0v8bGFSOGq8 erPFBSTb2XpchfkQ+Nc8cad64aM5RtDtSnAidLQNmFGfuUD+TredOdPUs7CG2Ktnh02o kIkwJLfODyY1cjFO5NG59ziyF485uqTAPRPycxv7tLzV3qRBwD6VomFa8Go32du735LJ PyqeVslE0cClEPwC67IZqflM4pxE6aswj+w0bS6dyUu/kHy2NyMzUiB7ALugAXleRsVt +OJstVs/HgzlFtlxb4Kfodh2/y78VkHU+zGnbGNlJ/YEQSlR3skAERnCCCY/y/yLCEci 8QDQ== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ne31si8809964ejc.157.2021.08.15.09.37.20; Sun, 15 Aug 2021 09:37: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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229603AbhHOQgg (ORCPT + 99 others); Sun, 15 Aug 2021 12:36:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:41278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbhHOQgf (ORCPT ); Sun, 15 Aug 2021 12:36:35 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6EE1A611C4; Sun, 15 Aug 2021 16:36:05 +0000 (UTC) Received: from 109-170-232-56.xdsl.murphx.net ([109.170.232.56] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mFJ7D-0058KJ-CF; Sun, 15 Aug 2021 17:36:03 +0100 Date: Sun, 15 Aug 2021 17:36:02 +0100 Message-ID: <8735ra1x8t.wl-maz@kernel.org> From: Marc Zyngier To: Rob Herring Cc: Mark Kettenis , devicetree@vger.kernel.org, Robin Murphy , Sven Peter , Mark Kettenis , Hector Martin , Bjorn Helgaas , linux-arm-kernel , PCI , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 1/2] dt-bindings: pci: Add DT bindings for apple,pcie In-Reply-To: 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> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 109.170.232.56 X-SA-Exim-Rcpt-To: robh@kernel.org, mark.kettenis@xs4all.nl, 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 X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > > 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. > 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. > > 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. > 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. 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? Thanks, M. -- Without deviation from the norm, progress is not possible.