Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752994AbbHEV1b (ORCPT ); Wed, 5 Aug 2015 17:27:31 -0400 Received: from mail-bl2on0139.outbound.protection.outlook.com ([65.55.169.139]:11594 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751282AbbHEV13 (ORCPT ); Wed, 5 Aug 2015 17:27:29 -0400 X-Greylist: delayed 5607 seconds by postgrey-1.27 at vger.kernel.org; Wed, 05 Aug 2015 17:27:28 EDT From: Stuart Yoder To: Mark Rutland , "devicetree@vger.kernel.org" CC: "lorenzo.pieralisi@arm.com" , "arnd@arndb.de" , "marc.zyngier@arm.com" , "will.deacon@arm.com" , "linux-kernel@vger.kernel.org" , "ddaney@caviumnetworks.com" , "iommu@lists.linux-foundation.org" , "tirumalesh.chalamarla@caviumnetworks.com" , "laurent.pinchart@ideasonboard.com" , "thunder.leizhen@huawei.com" , "treding@nvidia.com" , "linux-arm-kernel@lists.infradead.org" , "majun258@huawei.com" Subject: RE: [PATCH 2/3] Docs: dt: Add PCI MSI map bindings Thread-Topic: [PATCH 2/3] Docs: dt: Add PCI MSI map bindings Thread-Index: AQHQz7OMMDkID8JeeEyDf5iKDJQfEp39x74w Date: Wed, 5 Aug 2015 19:53:59 +0000 Message-ID: References: <1437670365-20704-1-git-send-email-mark.rutland@arm.com> <1437670365-20704-3-git-send-email-mark.rutland@arm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=stuart.yoder@freescale.com; x-originating-ip: [192.88.168.49] x-microsoft-exchange-diagnostics: 1;CY1PR0301MB0747;5:D26P76JYBaGauJxeOvnkCKGFzsXxXiYPq7QYSrCZVm5P5yt111SzQ4QXZbrDgzm/j9b4RmBp2BNuyD8ap2ckum8gNLv20d1YkEwyQCURnh/8QFX4N8tbV8S91lHzzgVtHLfNEDBNStx1V5TlDoF/Ew==;24:ehSEaHUJ9Wnuz5z2QAU+eBvLeSAeS9ttmmc6Tp5FyvhP9bIlzNfUBBtWwZnyC0pu/nwFXSv8mfW9sq6CZCSB0vCKpo0SisleJOKvYJr25qI=;20:NSJDfaAlqr4x4313bHAfCZCrwcJVKPCMMMTbKP6h/o6JyNjWWYeaGDtMfOD2IDjy6r7MXc2kcFmnjtgMsrKgHQ== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0747; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:CY1PR0301MB0747;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0747; x-forefront-prvs: 06592CCE58 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(199003)(164054003)(189002)(377454003)(66066001)(2656002)(19580395003)(2900100001)(2950100001)(33656002)(2501003)(5001830100001)(189998001)(5002640100001)(64706001)(5003600100002)(76576001)(10400500002)(76176999)(50986999)(92566002)(101416001)(54356999)(19580405001)(97736004)(81156007)(5001770100001)(4001540100001)(40100003)(46102003)(5001860100001)(122556002)(5001960100002)(102836002)(77096005)(74316001)(86362001)(105586002)(99286002)(87936001)(62966003)(106356001)(106116001)(68736005)(77156002)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0301MB0747;H:CY1PR0301MB0748.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Aug 2015 19:53:59.1260 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB0747 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t75LRZ4p010818 Content-Length: 3596 Lines: 89 > From: Mark Rutland > Date: Thu, Jul 23, 2015 at 11:52 AM [cut] > diff --git a/Documentation/devicetree/bindings/pci/pci-msi.txt > b/Documentation/devicetree/bindings/pci/pci-msi.txt > new file mode 100644 > index 0000000..9b3cc81 > --- /dev/null > +++ b/Documentation/devicetree/bindings/pci/pci-msi.txt > @@ -0,0 +1,220 @@ > +This document describes the generic device tree binding for describing the > +relationship between PCI devices and MSI controllers. > + > +Each PCI device under a root complex is uniquely identified by its Requester ID > +(AKA RID). A Requester ID is a triplet of a Bus number, Device number, and > +Function number. > + > +For the purpose of this document, when treated as a numeric value, a RID is > +formatted such that: > + > +* Bits [15:8] are the Bus number. > +* Bits [7:3] are the Device number. > +* Bits [2:0] are the Function number. > +* Any other bits required for padding must be zero. > + > +MSIs may be distinguished in part through the use of sideband data accompanying > +writes. In the case of PCI devices, this sideband data may be derived from the > +Requester ID. A mechanism is required to associate a device with both the MSI > +controllers it can address, and the sideband data that will be associated with > +its writes to those controllers. > + > +For generic MSI bindings, see > +Documentation/devicetree/bindings/interrupt-controller/msi.txt. > + > + > +PCI root complex > +================ > + > +Optional properties > +------------------- > + > +- msi-map: Maps a Requester ID to an MSI controller and associated > + msi-specifier data. The property is an arbitrary number of tuples of > + (rid-base,msi-controller,msi-base,length), where: > + > + * rid-base is a single cell describing the first RID matched by the entry. > + > + * msi-controller is a single phandle to an MSI controller > + > + * msi-base is an msi-specifier describing the msi-specifier produced for the > + first RID matched by the entry. > + > + * length is a single cell describing how many consecutive RIDs are matched > + following the rid-base. > + > + Any RID r in the interval [rid-base, rid-base + length) is associated with > + the listed msi-controller, with the msi-specifier (r - rid-base + msi-base). > + > +- msi-map-mask: A mask to be applied to each Requester ID prior to being mapped > + to an msi-specifier per the msi-map property. Can we extend the msi-map-mask definition to say: "A mask value of 0x0 is valid and indicates that no RIDs are _currently_ mapped to any msi-specifier." We have an SoC with a programmable hardware table in the PCI controller that maps requester ID to stream ID, so the overall msi-map (and iommu-map) definition fit into that scheme. But, we would like to be able make the RID->stream-ID mapping decision _lazily_, in Linux, based on actual usage of PCI devices. pcie@3600000 { compatible = "fsl,ls2085a-pcie", "snps,dw-pcie"; device_type = "pci"; ... msi-map = <0x0 &msi_a 0x7 4>, msi-map-mask = <0x0> }; That specifies the there are 4 stream IDs starting at stream ID 0x7, but the requester ID's are not mapped (because the mask is 0x0). This tells the PCI controller driver that there are 4 msi-specifiers (e.g. stream IDs) available and what they are. (same definition would apply to the iommu-map-mask) Thanks, Stuart ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?