Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756237AbbKDSC3 (ORCPT ); Wed, 4 Nov 2015 13:02:29 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:37155 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756097AbbKDSC0 (ORCPT ); Wed, 4 Nov 2015 13:02:26 -0500 X-IronPort-AV: E=Sophos;i="5.20,244,1444662000"; d="scan'208";a="197853698" From: Phil Edworthy To: Will Deacon CC: "Liviu.Dudau@arm.com" , Lorenzo Pieralisi , Arnd Bergmann , "linux-pci@vger.kernel.org" , Magnus , "linux-kernel@vger.kernel.org" , Bjorn Helgaas , "linux-arm-kernel@lists.infradead.org" Subject: RE: PCIe host controller behind IOMMU on ARM Thread-Topic: PCIe host controller behind IOMMU on ARM Thread-Index: AdEXBXpsqoonZ+nqRTu1yvYRg99bGAABv/qAAAApWPAAASaHgAAAPSUwAADDdYAABSfyoA== Date: Wed, 4 Nov 2015 18:02:18 +0000 Message-ID: References: <20151104142412.GS963@e106497-lin.cambridge.arm.com> <20151104150147.GT963@e106497-lin.cambridge.arm.com> <20151104153028.GR5405@arm.com> In-Reply-To: <20151104153028.GR5405@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=phil.edworthy@renesas.com; x-originating-ip: [193.141.220.21] x-microsoft-exchange-diagnostics: 1;PS1PR06MB1179;5:rj/ogWT39VCdNTat2uj6k9Vijwvtwfm/QMuy+C1BSSA3B5vs0Ju/ApAoZmUte+bTocrnPlBMyvQV25IA5As11W71HD7Cpsao+EL0YNK4yFNppgXBT2JH1y/e59RH4ALQRO95bcU+NApMNA3o5XG6tw==;24:F4EjEAyaXpj18MIaQNh7WCLAIooLBci2i93vmlT+PCVtTfPwKimOMPHFwNBU/7N0Vk8N66hoQ+gndvXc+WYnO/H2WX2Ruqw2WzTqWl/mKQ0=;20:1PMD7KTon5dZ2eNdYYzGzLxHcllzQdyB20xYI53+uNf7k1V3KkGf4pRDnwNrb1Oi60BugUbPhQdVb3DlRtHgH06E4XvOjOpQaQMamXozt1eNosH5tKWQaEJWKqYIvqcUgIuuHnvyXTwfG0hawS6w1PEdDGU4l7cMeokedcy4a+A= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1179; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046);SRVR:PS1PR06MB1179;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1179; x-forefront-prvs: 0750463DC9 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(24454002)(199003)(189002)(189998001)(106356001)(87936001)(54356999)(92566002)(50986999)(40100003)(81156007)(76176999)(97736004)(122556002)(66066001)(33656002)(105586002)(101416001)(86362001)(5007970100001)(110136002)(5003600100002)(5004730100002)(5008740100001)(5001960100002)(5890100001)(76576001)(11100500001)(93886004)(77096005)(74316001)(5002640100001)(2900100001)(102836002)(10400500002)(2950100001);DIR:OUT;SFP:1102;SCL:1;SRVR:PS1PR06MB1179;H:PS1PR06MB1180.apcprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Nov 2015 18:02:18.9982 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1179 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 tA4I2XUX014948 Content-Length: 1991 Lines: 40 Hi Will, On 04 November 2015 15:30, Will wrote: > On Wed, Nov 04, 2015 at 03:19:13PM +0000, Phil Edworthy wrote: > > On 04 November 2015 15:02, Liviu wrote: > > > On Wed, Nov 04, 2015 at 02:48:38PM +0000, Phil Edworthy wrote: > > > > Sure, though since this is bog standard Intel PCIe ethernet card which works > > > > fine when the IOMMU is effectively unused, I don’t think there is a problem > > > > with that. > > > > > > > > The driver for the PCIe controller sets up the IOMMU mapping ok when I > > > > do a test call to dma_alloc_coherent() in the controller's driver. i.e. when I > > > > do this, it ends up in arm_iommu_alloc_attrs(), which calls > > > > __iommu_alloc_buffer() and __alloc_iova(). > > > > > > > > When an endpoint driver allocates and maps a dma coherent buffer it > > > > also needs to end up in arm_iommu_alloc_attrs(), but it doesn't. > > > > > > Why do you think that? Remember that the only thing attached to the > IOMMU is > > > the > > > host controller. The endpoint is on the PCIe bus, which gets a different > > > translation > > > that the IOMMU knows nothing about. If it helps you to visualise it better, > think > > > of the host controller as another IOMMU device. It's the ops of the host > > > controller > > > that should be invoked, not the IOMMU's. > > Ok, that makes sense. I'll have a think and poke it a bit more... > > Take a look at of_iommu_configure, which is currently lacking support > for PCI devices. It should be using a variant on the device-tree bindings > already in use for describing MSI device IDs, so that we can translate > the RequesterID of the endpoint into an ID that the IOMMU can understand. Whilst we want to introduce isolation at some point, right now we would like to use the IOMMU as this PCIe controller only uses a 32-bit AXI address. Thanks Phil ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?