Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1556344 > unrolled thread
| Started by | Eric Auger <eric.auger@redhat.com> |
|---|---|
| First post | 2017-01-11 10:50 +0100 |
| Last post | 2017-01-16 10:10 +0100 |
| Articles | 8 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions Eric Auger <eric.auger@redhat.com> - 2017-01-11 10:50 +0100
[PATCH v8 04/18] iommu: iommu_alloc_resv_region Eric Auger <eric.auger@redhat.com> - 2017-01-11 10:50 +0100
[PATCH v8 03/18] iommu: Add a new type field in iommu_resv_region Eric Auger <eric.auger@redhat.com> - 2017-01-11 10:50 +0100
[PATCH v8 14/18] irqdomain: irq_domain_check_msi_remap Eric Auger <eric.auger@redhat.com> - 2017-01-11 10:50 +0100
RE: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions Bharat Bhushan <bharat.bhushan@nxp.com> - 2017-01-12 05:10 +0100
Re: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions Auger Eric <eric.auger@redhat.com> - 2017-01-12 08:50 +0100
Re: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions Tomasz Nowicki <tn@semihalf.com> - 2017-01-13 15:00 +0100
Re: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions Auger Eric <eric.auger@redhat.com> - 2017-01-16 10:10 +0100
| From | Eric Auger <eric.auger@redhat.com> |
|---|---|
| Date | 2017-01-11 10:50 +0100 |
| Subject | [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions |
| Message-ID | <sYnHz-5fJ-3@gated-at.bofh.it> |
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 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
[toc] | [next] | [standalone]
| From | Eric Auger <eric.auger@redhat.com> |
|---|---|
| Date | 2017-01-11 10:50 +0100 |
| Subject | [PATCH v8 04/18] iommu: iommu_alloc_resv_region |
| Message-ID | <sYnHA-5fJ-55@gated-at.bofh.it> |
| In reply to | #1556344 |
Introduce a new helper serving the purpose to allocate a reserved
region. This will be used in iommu driver implementing reserved
region callbacks.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
v3 -> v4:
- add INIT_LIST_HEAD(®ion->list)
- use int for prot param and add int type param
- remove implementation outside of CONFIG_IOMMU_API
---
drivers/iommu/iommu.c | 18 ++++++++++++++++++
include/linux/iommu.h | 2 ++
2 files changed, 20 insertions(+)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 1cee5c3..927878d 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1575,6 +1575,24 @@ void iommu_put_resv_regions(struct device *dev, struct list_head *list)
ops->put_resv_regions(dev, list);
}
+struct iommu_resv_region *iommu_alloc_resv_region(phys_addr_t start,
+ size_t length,
+ int prot, int type)
+{
+ struct iommu_resv_region *region;
+
+ region = kzalloc(sizeof(*region), GFP_KERNEL);
+ if (!region)
+ return NULL;
+
+ INIT_LIST_HEAD(®ion->list);
+ region->start = start;
+ region->length = length;
+ region->prot = prot;
+ region->type = type;
+ return region;
+}
+
/* Request that a device is direct mapped by the IOMMU */
int iommu_request_dm_for_dev(struct device *dev)
{
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 233a6bf..f6bb55d3 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -244,6 +244,8 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain,
extern void iommu_get_resv_regions(struct device *dev, struct list_head *list);
extern void iommu_put_resv_regions(struct device *dev, struct list_head *list);
extern int iommu_request_dm_for_dev(struct device *dev);
+extern struct iommu_resv_region *
+iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot, int type);
extern int iommu_attach_group(struct iommu_domain *domain,
struct iommu_group *group);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Eric Auger <eric.auger@redhat.com> |
|---|---|
| Date | 2017-01-11 10:50 +0100 |
| Subject | [PATCH v8 03/18] iommu: Add a new type field in iommu_resv_region |
| Message-ID | <sYnHB-5fJ-59@gated-at.bofh.it> |
| In reply to | #1556344 |
We introduce a new field to differentiate the reserved region
types and specialize the apply_resv_region implementation.
Legacy direct mapped regions have IOMMU_RESV_DIRECT type.
We introduce 2 new reserved memory types:
- IOMMU_RESV_MSI will characterize MSI regions that are mapped
- IOMMU_RESV_RESERVED characterize regions that cannot by mapped.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
v6 -> v7:
- rename IOMMU_RESV_NOMAP into IOMMU_RESV_RESERVED
---
drivers/iommu/amd_iommu.c | 1 +
include/linux/iommu.h | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index f7a024f..5f7ea4f 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -3186,6 +3186,7 @@ static void amd_iommu_get_resv_regions(struct device *dev,
region->start = entry->address_start;
region->length = entry->address_end - entry->address_start;
+ region->type = IOMMU_RESV_DIRECT;
if (entry->prot & IOMMU_PROT_IR)
region->prot |= IOMMU_READ;
if (entry->prot & IOMMU_PROT_IW)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index bfecb8b..233a6bf 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -117,18 +117,25 @@ enum iommu_attr {
DOMAIN_ATTR_MAX,
};
+/* These are the possible reserved region types */
+#define IOMMU_RESV_DIRECT (1 << 0)
+#define IOMMU_RESV_RESERVED (1 << 1)
+#define IOMMU_RESV_MSI (1 << 2)
+
/**
* struct iommu_resv_region - descriptor for a reserved memory region
* @list: Linked list pointers
* @start: System physical start address of the region
* @length: Length of the region in bytes
* @prot: IOMMU Protection flags (READ/WRITE/...)
+ * @type: Type of the reserved region
*/
struct iommu_resv_region {
struct list_head list;
phys_addr_t start;
size_t length;
int prot;
+ int type;
};
#ifdef CONFIG_IOMMU_API
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Eric Auger <eric.auger@redhat.com> |
|---|---|
| Date | 2017-01-11 10:50 +0100 |
| Subject | [PATCH v8 14/18] irqdomain: irq_domain_check_msi_remap |
| Message-ID | <sYnHB-5fJ-57@gated-at.bofh.it> |
| In reply to | #1556344 |
This new function checks whether all MSI irq domains
implement IRQ remapping. This is useful to understand
whether VFIO passthrough is safe with respect to interrupts.
On ARM typically an MSI controller can sit downstream
to the IOMMU without preventing VFIO passthrough.
As such any assigned device can write into the MSI doorbell.
In case the MSI controller implements IRQ remapping, assigned
devices will not be able to trigger interrupts towards the
host. On the contrary, the assignment must be emphasized as
unsafe with respect to interrupts.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
---
v7 -> v8:
- remove goto in irq_domain_check_msi_remap
- Added Marc's R-b
v5 -> v6:
- use irq_domain_hierarchical_is_msi_remap()
- comment rewording
v4 -> v5:
- Handle DOMAIN_BUS_FSL_MC_MSI domains
- Check parents
---
include/linux/irqdomain.h | 1 +
kernel/irq/irqdomain.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index bc2f571..188eced 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -222,6 +222,7 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
void *host_data);
extern struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,
enum irq_domain_bus_token bus_token);
+extern bool irq_domain_check_msi_remap(void);
extern void irq_set_default_host(struct irq_domain *host);
extern int irq_domain_alloc_descs(int virq, unsigned int nr_irqs,
irq_hw_number_t hwirq, int node,
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 876e131..d889751 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -278,6 +278,28 @@ struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,
EXPORT_SYMBOL_GPL(irq_find_matching_fwspec);
/**
+ * irq_domain_check_msi_remap - Check whether all MSI
+ * irq domains implement IRQ remapping
+ */
+bool irq_domain_check_msi_remap(void)
+{
+ struct irq_domain *h;
+ bool ret = true;
+
+ mutex_lock(&irq_domain_mutex);
+ list_for_each_entry(h, &irq_domain_list, link) {
+ if (irq_domain_is_msi(h) &&
+ !irq_domain_hierarchical_is_msi_remap(h)) {
+ ret = false;
+ break;
+ }
+ }
+ mutex_unlock(&irq_domain_mutex);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(irq_domain_check_msi_remap);
+
+/**
* irq_set_default_host() - Set a "default" irq domain
* @domain: default domain pointer
*
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Bharat Bhushan <bharat.bhushan@nxp.com> |
|---|---|
| Date | 2017-01-12 05:10 +0100 |
| Subject | RE: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions |
| Message-ID | <sYES5-7Fp-1@gated-at.bofh.it> |
| In reply to | #1556344 |
> -----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 <diana.craciun@nxp.com>; gpkulkarni@gmail.com; > shankerd@codeaurora.org; Bharat Bhushan <bharat.bhushan@nxp.com>; > 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 <bharat.bhushan@nxp.com> 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
[toc] | [prev] | [next] | [standalone]
| From | Auger Eric <eric.auger@redhat.com> |
|---|---|
| Date | 2017-01-12 08:50 +0100 |
| Subject | Re: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions |
| Message-ID | <sYIiZ-1dR-9@gated-at.bofh.it> |
| In reply to | #1557112 |
Hi Bharat, On 12/01/2017 04:59, Bharat Bhushan wrote: > > >> -----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 <diana.craciun@nxp.com>; gpkulkarni@gmail.com; >> shankerd@codeaurora.org; Bharat Bhushan <bharat.bhushan@nxp.com>; >> 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 <bharat.bhushan@nxp.com> Thank you for this! Best Regards Eric > > 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 >
[toc] | [prev] | [next] | [standalone]
| From | Tomasz Nowicki <tn@semihalf.com> |
|---|---|
| Date | 2017-01-13 15:00 +0100 |
| Subject | Re: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions |
| Message-ID | <sZayB-1yh-5@gated-at.bofh.it> |
| In reply to | #1556344 |
Hello Eric, On 11.01.2017 10:41, Eric Auger wrote: > 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 I tested the series on ThunderX with internal 10G VNIC and Intel IXGBE NIC. Please feel free to add my: Tested-by: Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com> Thanks, Tomasz
[toc] | [prev] | [next] | [standalone]
| From | Auger Eric <eric.auger@redhat.com> |
|---|---|
| Date | 2017-01-16 10:10 +0100 |
| Subject | Re: [PATCH v8 00/18] KVM PCIe/MSI passthrough on ARM/ARM64 and IOVA reserved regions |
| Message-ID | <t0bsC-6yd-47@gated-at.bofh.it> |
| In reply to | #1558417 |
Hi Tomasz, On 13/01/2017 14:59, Tomasz Nowicki wrote: > Hello Eric, > > On 11.01.2017 10:41, Eric Auger wrote: >> 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 > > I tested the series on ThunderX with internal 10G VNIC and Intel IXGBE > NIC. Please feel free to add my: > Tested-by: Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com> Many thanks! Eric > > Thanks, > Tomasz > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web