From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751253AbdALD7y (ORCPT ); Wed, 11 Jan 2017 22:59:54 -0500 Received: from mail-db5eur01on0045.outbound.protection.outlook.com ([104.47.2.45]:56992 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750779AbdALD7t (ORCPT ); Wed, 11 Jan 2017 22:59:49 -0500 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" , "geethasowjanya.akula@gmail.com" Subject: RE: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions Thread-Topic: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions Thread-Index: AQHSa+78TI6uS/Ba1kiyvwZX/3NzlaE0N+kg Date: Thu, 12 Jan 2017 03:59:44 +0000 Message-ID: References: <1484127714-3263-1-git-send-email-eric.auger@redhat.com> In-Reply-To: <1484127714-3263-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-ms-office365-filtering-correlation-id: ad9939be-f070-43fb-bf7f-08d43a9f716f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:HE1PR04MB1321; x-microsoft-exchange-diagnostics: 1;HE1PR04MB1321;7:ZmEWAXX4NirZaKCQxpy+EK2JNAI8fxNaAF4luGevfwr3o9CubU9PIQ08QoT5XYwP3VISRacktrKJCXeSF5s6k4GSFOdfpJxQtZ5bNU/FRqjwFAC4zeRTWyIiolvu6VvHqWTbdIW2ILYS7NicKAqOVykWxdozeOKZc7KE7T/A2AfZq85BzE4yMEJUdqpmXkZj/+hHTM7Cs4F1JzicNXwG2pjPum7pIZVoAiUe5tOBRDjhPgZgZ46g+SqI7pfJQhTZ59Cg+9iGYjuXG9s7d/5sEMSXSkiCAoIB00axb/JdRZYu/9yRIghditlqwXySIS1iMIS/BUn5QWV+NY/MkU15YpVH0j6KQ61esygXNoHSp0E5lT+4iITf2C3f66dK4o7IU71gVM32jxl730oZCmQoVsq+HOc8ZxQtw8wjg1w5ETdbIzKMOHA8P1PJD/M3NWu/dHLbgJbbzaCsxLsopHMLBw== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(20558992708506)(166708455590820)(192374486261705)(9452136761055)(185117386973197)(258649278758335); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148)(6047074);SRVR:HE1PR04MB1321;BCL:0;PCL:0;RULEID:;SRVR:HE1PR04MB1321; x-forefront-prvs: 018577E36E x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(39860400002)(39450400003)(39850400002)(39410400002)(39840400002)(13464003)(377454003)(189002)(199003)(74316002)(25786008)(122556002)(99286003)(6306002)(55016002)(54906002)(3846002)(6116002)(102836003)(105586002)(86362001)(97736004)(106116001)(2201001)(2501003)(7696004)(4326007)(3280700002)(2950100002)(38730400001)(6436002)(229853002)(77096006)(39060400001)(6506006)(5660300001)(33656002)(5001770100001)(101416001)(66066001)(305945005)(2906002)(54356999)(9686003)(50986999)(76176999)(8676002)(8936002)(7736002)(68736007)(106356001)(92566002)(189998001)(3660700001)(81156014)(81166006)(2900100001)(7416002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR04MB1321;H:AM5PR0401MB2545.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jan 2017 03:59:44.1671 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1321 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 v0C401tO015469 > -----Original Message----- > From: Eric Auger [mailto:eric.auger@redhat.com] > Sent: Wednesday, January 11, 2017 3:12 PM > 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 ; > geethasowjanya.akula@gmail.com > Subject: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and > IOVA reserved regions > > Following LPC discussions, we now report reserved regions through the > 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 intel-iommu reports the [0xfee00000 - 0xfeefffff] MSI window > as a reserved region and RMRR regions as direct-mapped regions. > - the amd-iommu reports device direct mapped regions, the MSI region > and HT regions. > - 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 MSI remapping is supported in the above hierarchy. > 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 first patch stems from Robin's branch: > http://linux-arm.org/git?p=linux- > rm.git;a=shortlog;h=refs/heads/iommu/misc > > Best Regards > > Eric > > Git: complete series available at > https://github.com/eauger/linux/tree/v4.10-rc3-reserved-v8 This series is tested on NXP platform, if you want you can add my tested by Tested-by: Bharat Bhushan Thanks -Bharat > > istory: > > PATCHv7 -> PATCHv8 > - take into account Marc's comments and apply his R-b > - remove iommu_group_remove_file call in iommu_group_release > - add Will's A-b > - removed [PATCH v7 01/19] iommu/dma: Implement PCI allocation > optimisation and updated iommu/dma: Allow MSI-only cookies > as per Robin's indications > > PATCHv6 -> PATCHv7: > - iommu/dma: Implement PCI allocation optimisation was added to apply > iommu/dma: Allow MSI-only cookies > - report Intel RMRR as direct-mapped regions > - report the type in the iommu group sysfs reserved_regions file > - do not merge regions of different types when building the list > of reserved regions > - intgeration Robin's "iommu/dma: Allow MSI-only cookies" last > version > - update Documentation/ABI/testing/sysfs-kernel-iommu_groups > - rename IOMMU_RESV_NOMAP into IOMMU_RESV_RESERVED > > PATCHv5 -> PATCHv6 > - Introduce IRQ_DOMAIN_FLAG_MSI as suggested by Marc > - irq_domain_is_msi, irq_domain_is_msi_remap, > irq_domain_hierarchical_is_msi_remap, > - set IRQ_DOMAIN_FLAG_MSI in msi_create_irq_domain > - fix compil issue on i386 > - rework test at VFIO level > > RFCv4 -> PATCHv5 > - fix IRQ security assessment by looking at irq domain parents > - check DOMAIN_BUS_FSL_MC_MSI irq domains > - AMD MSI and HT regions are exposed in iommu group sysfs > > 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 > > RFC v2 -> v3: > - 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 (17): > 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/amd: Declare MSI and HT regions as reserved IOVA regions > iommu/arm-smmu: Implement reserved region get/put callbacks > iommu/arm-smmu-v3: Implement reserved region get/put callbacks > irqdomain: Add irq domain MSI and MSI_REMAP flags > genirq/msi: Set IRQ_DOMAIN_FLAG_MSI on MSI domain creation > 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 > > Robin Murphy (1): > iommu/dma: Allow MSI-only cookies > > .../ABI/testing/sysfs-kernel-iommu_groups | 12 ++ > drivers/iommu/amd_iommu.c | 54 ++++--- > drivers/iommu/arm-smmu-v3.c | 30 +++- > drivers/iommu/arm-smmu.c | 30 +++- > drivers/iommu/dma-iommu.c | 119 +++++++++++--- > drivers/iommu/intel-iommu.c | 92 ++++++++--- > drivers/iommu/iommu.c | 177 +++++++++++++++++++-- > drivers/irqchip/irq-gic-v3-its.c | 1 + > drivers/vfio/vfio_iommu_type1.c | 37 ++++- > include/linux/dma-iommu.h | 6 + > include/linux/iommu.h | 46 ++++-- > include/linux/irqdomain.h | 36 +++++ > kernel/irq/irqdomain.c | 36 +++++ > kernel/irq/msi.c | 4 +- > 14 files changed, 587 insertions(+), 93 deletions(-) > > -- > 1.9.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bharat Bhushan Subject: RE: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions Date: Thu, 12 Jan 2017 03:59:44 +0000 Message-ID: References: <1484127714-3263-1-git-send-email-eric.auger@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: "drjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org" , "kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "punit.agrawal-5wv7dgnIgG8@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "geethasowjanya.akula-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" , "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" , "pranav.sawargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" , "shankerd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org" , "gpkulkarni-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" To: Eric Auger , "eric.auger.pro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" , "christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org" , "marc.zyngier-5wv7dgnIgG8@public.gmane.org" , "robin.murphy-5wv7dgnIgG8@public.gmane.org" , "alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org" , "will.deacon-5wv7dgnIgG8@public.gmane.org" , "joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org" , "tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org" , "jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org" , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" Return-path: In-Reply-To: <1484127714-3263-1-git-send-email-eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org List-Id: kvm.vger.kernel.org > -----Original Message----- > From: Eric Auger [mailto:eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org] > Sent: Wednesday, January 11, 2017 3:12 PM > To: eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; eric.auger.pro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; > christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org; marc.zyngier-5wv7dgnIgG8@public.gmane.org; > robin.murphy-5wv7dgnIgG8@public.gmane.org; alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; > will.deacon-5wv7dgnIgG8@public.gmane.org; joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org; tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org; > jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org; linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org > Cc: kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; drjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; linux- > kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; pranav.sawargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; > iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org; punit.agrawal-5wv7dgnIgG8@public.gmane.org; Diana Madalina > Craciun ; gpkulkarni-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; > shankerd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org; Bharat Bhushan ; > geethasowjanya.akula-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > Subject: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and > IOVA reserved regions > > Following LPC discussions, we now report reserved regions through the > 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 intel-iommu reports the [0xfee00000 - 0xfeefffff] MSI window > as a reserved region and RMRR regions as direct-mapped regions. > - the amd-iommu reports device direct mapped regions, the MSI region > and HT regions. > - 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 MSI remapping is supported in the above hierarchy. > 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 first patch stems from Robin's branch: > http://linux-arm.org/git?p=linux- > rm.git;a=shortlog;h=refs/heads/iommu/misc > > Best Regards > > Eric > > Git: complete series available at > https://github.com/eauger/linux/tree/v4.10-rc3-reserved-v8 This series is tested on NXP platform, if you want you can add my tested by Tested-by: Bharat Bhushan Thanks -Bharat > > istory: > > PATCHv7 -> PATCHv8 > - take into account Marc's comments and apply his R-b > - remove iommu_group_remove_file call in iommu_group_release > - add Will's A-b > - removed [PATCH v7 01/19] iommu/dma: Implement PCI allocation > optimisation and updated iommu/dma: Allow MSI-only cookies > as per Robin's indications > > PATCHv6 -> PATCHv7: > - iommu/dma: Implement PCI allocation optimisation was added to apply > iommu/dma: Allow MSI-only cookies > - report Intel RMRR as direct-mapped regions > - report the type in the iommu group sysfs reserved_regions file > - do not merge regions of different types when building the list > of reserved regions > - intgeration Robin's "iommu/dma: Allow MSI-only cookies" last > version > - update Documentation/ABI/testing/sysfs-kernel-iommu_groups > - rename IOMMU_RESV_NOMAP into IOMMU_RESV_RESERVED > > PATCHv5 -> PATCHv6 > - Introduce IRQ_DOMAIN_FLAG_MSI as suggested by Marc > - irq_domain_is_msi, irq_domain_is_msi_remap, > irq_domain_hierarchical_is_msi_remap, > - set IRQ_DOMAIN_FLAG_MSI in msi_create_irq_domain > - fix compil issue on i386 > - rework test at VFIO level > > RFCv4 -> PATCHv5 > - fix IRQ security assessment by looking at irq domain parents > - check DOMAIN_BUS_FSL_MC_MSI irq domains > - AMD MSI and HT regions are exposed in iommu group sysfs > > 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 > > RFC v2 -> v3: > - 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 (17): > 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/amd: Declare MSI and HT regions as reserved IOVA regions > iommu/arm-smmu: Implement reserved region get/put callbacks > iommu/arm-smmu-v3: Implement reserved region get/put callbacks > irqdomain: Add irq domain MSI and MSI_REMAP flags > genirq/msi: Set IRQ_DOMAIN_FLAG_MSI on MSI domain creation > 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 > > Robin Murphy (1): > iommu/dma: Allow MSI-only cookies > > .../ABI/testing/sysfs-kernel-iommu_groups | 12 ++ > drivers/iommu/amd_iommu.c | 54 ++++--- > drivers/iommu/arm-smmu-v3.c | 30 +++- > drivers/iommu/arm-smmu.c | 30 +++- > drivers/iommu/dma-iommu.c | 119 +++++++++++--- > drivers/iommu/intel-iommu.c | 92 ++++++++--- > drivers/iommu/iommu.c | 177 +++++++++++++++++++-- > drivers/irqchip/irq-gic-v3-its.c | 1 + > drivers/vfio/vfio_iommu_type1.c | 37 ++++- > include/linux/dma-iommu.h | 6 + > include/linux/iommu.h | 46 ++++-- > include/linux/irqdomain.h | 36 +++++ > kernel/irq/irqdomain.c | 36 +++++ > kernel/irq/msi.c | 4 +- > 14 files changed, 587 insertions(+), 93 deletions(-) > > -- > 1.9.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: bharat.bhushan@nxp.com (Bharat Bhushan) Date: Thu, 12 Jan 2017 03:59:44 +0000 Subject: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions In-Reply-To: <1484127714-3263-1-git-send-email-eric.auger@redhat.com> References: <1484127714-3263-1-git-send-email-eric.auger@redhat.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org > -----Original Message----- > From: Eric Auger [mailto:eric.auger at redhat.com] > Sent: Wednesday, January 11, 2017 3:12 PM > To: eric.auger at redhat.com; eric.auger.pro at gmail.com; > christoffer.dall at linaro.org; marc.zyngier at arm.com; > robin.murphy at arm.com; alex.williamson at redhat.com; > will.deacon at arm.com; joro at 8bytes.org; tglx at linutronix.de; > jason at lakedaemon.net; linux-arm-kernel at lists.infradead.org > Cc: kvm at vger.kernel.org; drjones at redhat.com; linux- > kernel at vger.kernel.org; pranav.sawargaonkar at gmail.com; > iommu at lists.linux-foundation.org; punit.agrawal at arm.com; Diana Madalina > Craciun ; gpkulkarni at gmail.com; > shankerd at codeaurora.org; Bharat Bhushan ; > geethasowjanya.akula at gmail.com > Subject: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and > IOVA reserved regions > > Following LPC discussions, we now report reserved regions through the > 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 intel-iommu reports the [0xfee00000 - 0xfeefffff] MSI window > as a reserved region and RMRR regions as direct-mapped regions. > - the amd-iommu reports device direct mapped regions, the MSI region > and HT regions. > - 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 MSI remapping is supported in the above hierarchy. > 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 first patch stems from Robin's branch: > http://linux-arm.org/git?p=linux- > rm.git;a=shortlog;h=refs/heads/iommu/misc > > Best Regards > > Eric > > Git: complete series available at > https://github.com/eauger/linux/tree/v4.10-rc3-reserved-v8 This series is tested on NXP platform, if you want you can add my tested by Tested-by: Bharat Bhushan Thanks -Bharat > > istory: > > PATCHv7 -> PATCHv8 > - take into account Marc's comments and apply his R-b > - remove iommu_group_remove_file call in iommu_group_release > - add Will's A-b > - removed [PATCH v7 01/19] iommu/dma: Implement PCI allocation > optimisation and updated iommu/dma: Allow MSI-only cookies > as per Robin's indications > > PATCHv6 -> PATCHv7: > - iommu/dma: Implement PCI allocation optimisation was added to apply > iommu/dma: Allow MSI-only cookies > - report Intel RMRR as direct-mapped regions > - report the type in the iommu group sysfs reserved_regions file > - do not merge regions of different types when building the list > of reserved regions > - intgeration Robin's "iommu/dma: Allow MSI-only cookies" last > version > - update Documentation/ABI/testing/sysfs-kernel-iommu_groups > - rename IOMMU_RESV_NOMAP into IOMMU_RESV_RESERVED > > PATCHv5 -> PATCHv6 > - Introduce IRQ_DOMAIN_FLAG_MSI as suggested by Marc > - irq_domain_is_msi, irq_domain_is_msi_remap, > irq_domain_hierarchical_is_msi_remap, > - set IRQ_DOMAIN_FLAG_MSI in msi_create_irq_domain > - fix compil issue on i386 > - rework test at VFIO level > > RFCv4 -> PATCHv5 > - fix IRQ security assessment by looking at irq domain parents > - check DOMAIN_BUS_FSL_MC_MSI irq domains > - AMD MSI and HT regions are exposed in iommu group sysfs > > 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 > > RFC v2 -> v3: > - 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 (17): > 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/amd: Declare MSI and HT regions as reserved IOVA regions > iommu/arm-smmu: Implement reserved region get/put callbacks > iommu/arm-smmu-v3: Implement reserved region get/put callbacks > irqdomain: Add irq domain MSI and MSI_REMAP flags > genirq/msi: Set IRQ_DOMAIN_FLAG_MSI on MSI domain creation > 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 > > Robin Murphy (1): > iommu/dma: Allow MSI-only cookies > > .../ABI/testing/sysfs-kernel-iommu_groups | 12 ++ > drivers/iommu/amd_iommu.c | 54 ++++--- > drivers/iommu/arm-smmu-v3.c | 30 +++- > drivers/iommu/arm-smmu.c | 30 +++- > drivers/iommu/dma-iommu.c | 119 +++++++++++--- > drivers/iommu/intel-iommu.c | 92 ++++++++--- > drivers/iommu/iommu.c | 177 +++++++++++++++++++-- > drivers/irqchip/irq-gic-v3-its.c | 1 + > drivers/vfio/vfio_iommu_type1.c | 37 ++++- > include/linux/dma-iommu.h | 6 + > include/linux/iommu.h | 46 ++++-- > include/linux/irqdomain.h | 36 +++++ > kernel/irq/irqdomain.c | 36 +++++ > kernel/irq/msi.c | 4 +- > 14 files changed, 587 insertions(+), 93 deletions(-) > > -- > 1.9.1