From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935082AbcLTOLh (ORCPT ); Tue, 20 Dec 2016 09:11:37 -0500 Received: from mail-db5eur01on0077.outbound.protection.outlook.com ([104.47.2.77]:61504 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934218AbcLTOL3 (ORCPT ); Tue, 20 Dec 2016 09:11:29 -0500 X-Greylist: delayed 100469 seconds by postgrey-1.27 at vger.kernel.org; Tue, 20 Dec 2016 09:11:29 EST From: Bharat Bhushan To: Eric Auger , "eric.auger.pro@gmail.com" , "christoffer.dall@linaro.org" , "marc.zyngier@arm.com" , "robin.murphy@arm.com" , "alex.williamson@redhat.com" , "will.deacon@arm.com" , "joro@8bytes.org" , "tglx@linutronix.de" , "jason@lakedaemon.net" , "linux-arm-kernel@lists.infradead.org" CC: "kvm@vger.kernel.org" , "drjones@redhat.com" , "linux-kernel@vger.kernel.org" , "pranav.sawargaonkar@gmail.com" , "iommu@lists.linux-foundation.org" , "punit.agrawal@arm.com" , Diana Madalina Craciun , "gpkulkarni@gmail.com" , "shankerd@codeaurora.org" Subject: RE: [RFC v4 00/16] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions Thread-Topic: [RFC v4 00/16] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions Thread-Index: AQHSVX/KPZ/aghdSrU6/IjH8ofouLqEQSV7Q Date: Tue, 20 Dec 2016 04:45:57 +0000 Message-ID: References: <1481661034-3088-1-git-send-email-eric.auger@redhat.com> In-Reply-To: <1481661034-3088-1-git-send-email-eric.auger@redhat.com> 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=bharat.bhushan@nxp.com; x-originating-ip: [192.88.169.1] x-microsoft-exchange-diagnostics: 1;DB5PR04MB1319;7:lE+W7A/u+pLTePe3Wjnss2hJ8GYuh90Ys/+N5xW9Ip+M9ss0MbPCsnOOGVi4zYPFu0+hjMh0QJIWPvUdzMONmHHG6GpprJdmyDlO6kVp/6JdZN9juJzwDtn6D/soooovQeyuTDNX5XWjMrdmaSOnwuwneWO0uCUUpzkRDA1B+grKoSxHnfLKlfpCT/Y3T80lvBrCn0o1vPMxP1aY36H0zqTl5blZHnwlVkom5kJbReTeufRr60gU4MX2M+/UKG/bEdJ6GAKo5ipe6hcjOxqq3XGrrvS8G9McKFgBxRLts9FU+edMXIHOo/2TmSVI6DPKQqDTs+vUY1lZV7vtWMCdG26EanQPLHg3Bk5W02c0LneCsMiApW/0Tr12pQeg12lNduixdT8WLxKJMNNfej1/90fUHPEF6VeAbsnwEcObpu/bh/1vBKIKLZaubk6CRJ9RuKVHLyPjnjQ8Ul0eTxjBOA==;23:KmTqGpTlpgpKIBRPV3N50BxP5/Gps/gIF7oxn+yhstFixJOblUJ5ytk2jgkSQoWSmpRQ7iu7c6hzUb3xrFPIjWVGNchxSS0EsvxQItt7H7Nn+QKlq/U18qjeEL2oKdXhCIIk8R+sb/IylG89dlNvYw== x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(7916002)(39850400002)(39410400002)(39450400003)(39860400002)(39840400002)(199003)(13464003)(189002)(377454003)(6436002)(8936002)(2906002)(76576001)(7736002)(4326007)(106356001)(97736004)(5001770100001)(86362001)(77096006)(74316002)(2201001)(6506006)(9686002)(122556002)(189998001)(66066001)(68736007)(8676002)(81166006)(81156014)(25786008)(305945005)(7416002)(39060400001)(3660700001)(38730400001)(5660300001)(2501003)(2950100002)(7696004)(92566002)(76176999)(50986999)(54356999)(102836003)(3846002)(6116002)(106116001)(2900100001)(229853002)(3280700002)(101416001)(33656002)(105586002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR04MB1319;H:AM5PR0401MB2545.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; x-ms-office365-filtering-correlation-id: 2fc9184b-8bae-4802-66be-08d428931745 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DB5PR04MB1319; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(20558992708506)(166708455590820)(9452136761055)(185117386973197)(258649278758335); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123558021)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(6047074)(6072148);SRVR:DB5PR04MB1319;BCL:0;PCL:0;RULEID:;SRVR:DB5PR04MB1319; x-forefront-prvs: 0162ACCC24 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2016 04:45:57.9458 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR04MB1319 X-OriginatorOrg: nxp.com 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 quoted-printable to 8bit by mail.home.local id uBKEBlPB021064 Hi Eric, Tested this series on NXP ARMv8 platform. Thanks -Bharat > -----Original Message----- > From: Eric Auger [mailto:eric.auger@redhat.com] > Sent: Wednesday, December 14, 2016 2:00 AM > To: eric.auger@redhat.com; eric.auger.pro@gmail.com; > christoffer.dall@linaro.org; marc.zyngier@arm.com; > robin.murphy@arm.com; alex.williamson@redhat.com; > will.deacon@arm.com; joro@8bytes.org; tglx@linutronix.de; > jason@lakedaemon.net; linux-arm-kernel@lists.infradead.org > Cc: kvm@vger.kernel.org; drjones@redhat.com; linux- > kernel@vger.kernel.org; pranav.sawargaonkar@gmail.com; > iommu@lists.linux-foundation.org; punit.agrawal@arm.com; Diana Madalina > Craciun ; gpkulkarni@gmail.com; > shankerd@codeaurora.org; Bharat Bhushan > Subject: [RFC v4 00/16] KVM PCIe/MSI passthrough on ARM/ARM64 and > IOVA reserved regions > > Following LPC discussions, we now report reserved regions through iommu- > group sysfs reserved_regions attribute file. > > Reserved regions are populated through the IOMMU get_resv_region > callback (former get_dm_regions), now implemented by amd-iommu, intel- > iommu and arm-smmu: > - the amd-iommu reports device direct mapped regions. > - the intel-iommu reports the [0xfee00000 - 0xfeefffff] MSI window > as an IOMMU_RESV_NOMAP reserved region. > - the arm-smmu reports the MSI window (arbitrarily located at > 0x8000000 and 1MB large). > > Unsafe interrupt assignment is tested by enumerating all MSI irq domains > and checking they support MSI remapping. This check is done in case we > detect the iommu translates MSI (an IOMMU_RESV_MSI window exists). > Otherwise the IRQ remapping capability is checked at IOMMU level. > Obviously this is a defensive IRQ safety assessment. > Assuming there are several MSI controllers in the system and at least one > does not implement IRQ remapping, the assignment will be considered as > unsafe (even if this controller is not acessible from the assigned devices). > > The series integrates a not officially posted patch from Robin: > "iommu/dma: Allow MSI-only cookies". > > Best Regards > > Eric > > Git: complete series available at > https://github.com/eauger/linux/tree/v4.9-reserved-v4 > > History: > > RFCv3 -> RFCv4: > - arm-smmu driver does not register PCI host bridge windows as > reserved regions anymore > - Implement reserved region get/put callbacks also in arm-smmuv3 > - take the iommu_group lock on iommu_get_group_resv_regions > - add a type field in iommu_resv_region instead of using prot > - init the region list_head in iommu_alloc_resv_region, also > add type parameter > - iommu_insert_resv_region manage overlaps and sort reserved > windows > - address IRQ safety assessment by enumerating all the MSI irq > domains and checking the MSI_REMAP flag > - update Documentation/ABI/testing/sysfs-kernel-iommu_groups > - Did not add T-b since the code has significantly changed > > RFCv2 -> RFCv3: > - switch to an iommu-group sysfs API > - use new dummy allocator provided by Robin > - dummy allocator initialized by vfio-iommu-type1 after enumerating > the reserved regions > - at the moment ARM MSI base address/size is left unchanged compared > to v2 > - we currently report reserved regions and not usable IOVA regions as > requested by Alex > > RFC v1 -> v2: > - fix intel_add_reserved_regions > - add mutex lock/unlock in vfio_iommu_type1 > > > Eric Auger (16): > iommu/dma: Allow MSI-only cookies > iommu: Rename iommu_dm_regions into iommu_resv_regions > iommu: Add a new type field in iommu_resv_region > iommu: iommu_alloc_resv_region > iommu: Only map direct mapped regions > iommu: iommu_get_group_resv_regions > iommu: Implement reserved_regions iommu-group sysfs file > iommu/vt-d: Implement reserved region get/put callbacks > iommu/arm-smmu: Implement reserved region get/put callbacks > iommu/arm-smmu-v3: Implement reserved region get/put callbacks > irqdomain: Add IRQ_DOMAIN_FLAG_MSI_REMAP value > irqdomain: irq_domain_check_msi_remap > irqchip/gicv3-its: Sets IRQ_DOMAIN_FLAG_MSI_REMAP > vfio/type1: Allow transparent MSI IOVA allocation > vfio/type1: Check MSI remapping at irq domain level > iommu/arm-smmu: Do not advertise IOMMU_CAP_INTR_REMAP anymore > > .../ABI/testing/sysfs-kernel-iommu_groups | 9 ++ > drivers/iommu/amd_iommu.c | 21 +-- > drivers/iommu/arm-smmu-v3.c | 30 +++- > drivers/iommu/arm-smmu.c | 30 +++- > drivers/iommu/dma-iommu.c | 116 +++++++++++++--- > drivers/iommu/intel-iommu.c | 50 +++++-- > drivers/iommu/iommu.c | 152 +++++++++++++++++++-- > drivers/irqchip/irq-gic-v3-its.c | 1 + > drivers/vfio/vfio_iommu_type1.c | 37 ++++- > include/linux/dma-iommu.h | 7 + > include/linux/iommu.h | 46 +++++-- > include/linux/irqdomain.h | 8 ++ > kernel/irq/irqdomain.c | 24 ++++ > 13 files changed, 455 insertions(+), 76 deletions(-) > > -- > 1.9.1