Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1698074 > unrolled thread

[PATCH 1/2] vfio/type1: Cope with hardware MSI reserved regions

Started byRobin Murphy <robin.murphy@arm.com>
First post2017-07-27 17:00 +0200
Last post2017-08-10 21:20 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] vfio/type1: Cope with hardware MSI reserved regions Robin Murphy <robin.murphy@arm.com> - 2017-07-27 17:00 +0200
    Re: [PATCH 1/2] vfio/type1: Cope with hardware MSI reserved regions Auger Eric <eric.auger@redhat.com> - 2017-07-30 12:40 +0200
    RE: [PATCH 1/2] vfio/type1: Cope with hardware MSI reserved regions Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com> - 2017-07-31 18:10 +0200
    Re: [PATCH 1/2] vfio/type1: Cope with hardware MSI reserved regions Alex Williamson <alex.williamson@redhat.com> - 2017-08-10 21:20 +0200

#1698074 — [PATCH 1/2] vfio/type1: Cope with hardware MSI reserved regions

FromRobin Murphy <robin.murphy@arm.com>
Date2017-07-27 17:00 +0200
Subject[PATCH 1/2] vfio/type1: Cope with hardware MSI reserved regions
Message-ID<u7SqC-7mN-35@gated-at.bofh.it>
For ARM-based systems with a GICv3 ITS to provide interrupt isolation,
but hardware limitations which are worked around by having MSIs bypass
SMMU translation (e.g. HiSilicon Hip06/Hip07), VFIO neglects to check
for the IRQ_DOMAIN_FLAG_MSI_REMAP capability, (and thus erroneously
demands unsafe_interrupts) if a software-managed MSI region is absent.

Fix this by always checking for isolation capability at both the IRQ
domain and IOMMU domain levels, rather than predicating that on whether
MSIs require an IOMMU mapping (which was always slightly tenuous logic).

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/vfio/vfio_iommu_type1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 8549cb111627..2328be628f21 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -1265,8 +1265,8 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
 	INIT_LIST_HEAD(&domain->group_list);
 	list_add(&group->next, &domain->group_list);
 
-	msi_remap = resv_msi ? irq_domain_check_msi_remap() :
-				iommu_capable(bus, IOMMU_CAP_INTR_REMAP);
+	msi_remap = irq_domain_check_msi_remap() ||
+		    iommu_capable(bus, IOMMU_CAP_INTR_REMAP);
 
 	if (!allow_unsafe_interrupts && !msi_remap) {
 		pr_warn("%s: No interrupt remapping support.  Use the module param \"allow_unsafe_interrupts\" to enable VFIO IOMMU support on this platform\n",
-- 
2.12.2.dirty

[toc] | [next] | [standalone]


#1699507

FromAuger Eric <eric.auger@redhat.com>
Date2017-07-30 12:40 +0200
Message-ID<u8TNE-7ya-15@gated-at.bofh.it>
In reply to#1698074
Hi Robin,
On 27/07/2017 16:54, Robin Murphy wrote:
> For ARM-based systems with a GICv3 ITS to provide interrupt isolation,
> but hardware limitations which are worked around by having MSIs bypass
> SMMU translation (e.g. HiSilicon Hip06/Hip07), VFIO neglects to check
> for the IRQ_DOMAIN_FLAG_MSI_REMAP capability, (and thus erroneously
> demands unsafe_interrupts) if a software-managed MSI region is absent.
> 
> Fix this by always checking for isolation capability at both the IRQ
> domain and IOMMU domain levels, rather than predicating that on whether
> MSIs require an IOMMU mapping (which was always slightly tenuous logic).
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Thanks

Eric

> ---
>  drivers/vfio/vfio_iommu_type1.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index 8549cb111627..2328be628f21 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -1265,8 +1265,8 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
>  	INIT_LIST_HEAD(&domain->group_list);
>  	list_add(&group->next, &domain->group_list);
>  
> -	msi_remap = resv_msi ? irq_domain_check_msi_remap() :
> -				iommu_capable(bus, IOMMU_CAP_INTR_REMAP);
> +	msi_remap = irq_domain_check_msi_remap() ||
> +		    iommu_capable(bus, IOMMU_CAP_INTR_REMAP);
>  
>  	if (!allow_unsafe_interrupts && !msi_remap) {
>  		pr_warn("%s: No interrupt remapping support.  Use the module param \"allow_unsafe_interrupts\" to enable VFIO IOMMU support on this platform\n",
> 

[toc] | [prev] | [next] | [standalone]


#1700153

FromShameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Date2017-07-31 18:10 +0200
Message-ID<u9lqy-8oa-11@gated-at.bofh.it>
In reply to#1698074
> -----Original Message-----
> From: Robin Murphy [mailto:robin.murphy@arm.com]
> Sent: Thursday, July 27, 2017 3:54 PM
> To: alex.williamson@redhat.com
> Cc: kvm@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; eric.auger@redhat.com; Shameerali Kolothum
> Thodi; marc.zyngier@arm.com
> Subject: [PATCH 1/2] vfio/type1: Cope with hardware MSI reserved regions
> 
> For ARM-based systems with a GICv3 ITS to provide interrupt isolation,
> but hardware limitations which are worked around by having MSIs bypass
> SMMU translation (e.g. HiSilicon Hip06/Hip07), VFIO neglects to check
> for the IRQ_DOMAIN_FLAG_MSI_REMAP capability, (and thus erroneously
> demands unsafe_interrupts) if a software-managed MSI region is absent.
> 
> Fix this by always checking for isolation capability at both the IRQ
> domain and IOMMU domain levels, rather than predicating that on whether
> MSIs require an IOMMU mapping (which was always slightly tenuous logic).
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/vfio/vfio_iommu_type1.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vfio/vfio_iommu_type1.c
> b/drivers/vfio/vfio_iommu_type1.c
> index 8549cb111627..2328be628f21 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -1265,8 +1265,8 @@ static int vfio_iommu_type1_attach_group(void
> *iommu_data,
>  	INIT_LIST_HEAD(&domain->group_list);
>  	list_add(&group->next, &domain->group_list);
> 
> -	msi_remap = resv_msi ? irq_domain_check_msi_remap() :
> -				iommu_capable(bus,
> IOMMU_CAP_INTR_REMAP);
> +	msi_remap = irq_domain_check_msi_remap() ||
> +		    iommu_capable(bus, IOMMU_CAP_INTR_REMAP);
> 
>  	if (!allow_unsafe_interrupts && !msi_remap) {
>  		pr_warn("%s: No interrupt remapping support.  Use the
> module param \"allow_unsafe_interrupts\" to enable VFIO IOMMU support
> on this platform\n",

Verified these patches(1 and 2) on HiSilicon Hip07 platform along with HW MSI resv
region patches[1]. Please feel free to add, 

Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>

Thanks,
Shameer

1. https://www.spinics.net/lists/arm-kernel/msg595847.html

[toc] | [prev] | [next] | [standalone]


#1708975

FromAlex Williamson <alex.williamson@redhat.com>
Date2017-08-10 21:20 +0200
Message-ID<ud19U-1Bl-5@gated-at.bofh.it>
In reply to#1698074
On Thu, 27 Jul 2017 15:54:13 +0100
Robin Murphy <robin.murphy@arm.com> wrote:

> For ARM-based systems with a GICv3 ITS to provide interrupt isolation,
> but hardware limitations which are worked around by having MSIs bypass
> SMMU translation (e.g. HiSilicon Hip06/Hip07), VFIO neglects to check
> for the IRQ_DOMAIN_FLAG_MSI_REMAP capability, (and thus erroneously
> demands unsafe_interrupts) if a software-managed MSI region is absent.
> 
> Fix this by always checking for isolation capability at both the IRQ
> domain and IOMMU domain levels, rather than predicating that on whether
> MSIs require an IOMMU mapping (which was always slightly tenuous logic).
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/vfio/vfio_iommu_type1.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

I've pushed these to my next branch with Eric's R-b and Shameerali's
T-b for v4.14.  Thanks,

Alex

> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index 8549cb111627..2328be628f21 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -1265,8 +1265,8 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
>  	INIT_LIST_HEAD(&domain->group_list);
>  	list_add(&group->next, &domain->group_list);
>  
> -	msi_remap = resv_msi ? irq_domain_check_msi_remap() :
> -				iommu_capable(bus, IOMMU_CAP_INTR_REMAP);
> +	msi_remap = irq_domain_check_msi_remap() ||
> +		    iommu_capable(bus, IOMMU_CAP_INTR_REMAP);
>  
>  	if (!allow_unsafe_interrupts && !msi_remap) {
>  		pr_warn("%s: No interrupt remapping support.  Use the module param \"allow_unsafe_interrupts\" to enable VFIO IOMMU support on this platform\n",

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web