From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754851AbcJFURB (ORCPT ); Thu, 6 Oct 2016 16:17:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47468 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751448AbcJFUQw (ORCPT ); Thu, 6 Oct 2016 16:16:52 -0400 Date: Thu, 6 Oct 2016 14:16:48 -0600 From: Alex Williamson To: Eric Auger Cc: eric.auger.pro@gmail.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, robin.murphy@arm.com, will.deacon@arm.com, joro@8bytes.org, tglx@linutronix.de, jason@lakedaemon.net, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, drjones@redhat.com, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, pranav.sawargaonkar@gmail.com, p.fedin@samsung.com, iommu@lists.linux-foundation.org, Jean-Philippe.Brucker@arm.com, yehuday@marvell.com, Manish.Jaggi@caviumnetworks.com Subject: Re: [PATCH v13 02/15] iommu/arm-smmu: Initialize the msi geometry Message-ID: <20161006141648.0eda1648@t450s.home> In-Reply-To: <1475743531-4780-3-git-send-email-eric.auger@redhat.com> References: <1475743531-4780-1-git-send-email-eric.auger@redhat.com> <1475743531-4780-3-git-send-email-eric.auger@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 06 Oct 2016 20:16:52 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Oct 2016 08:45:18 +0000 Eric Auger wrote: > On ARM, MSI write transactions also are translated by the smmu. > Let's report that specificity by setting the iommu_msi_supported > field to true. A valid aperture window will need to be provided. > > Signed-off-by: Eric Auger > > --- > v12 -> v13: > - reword the commit message > > v8 -> v9: > - reword the title and patch description > > v7 -> v8: > - use DOMAIN_ATTR_MSI_GEOMETRY > > v4 -> v5: > - don't handle fsl_pamu_domain anymore > - handle arm-smmu-v3 > --- > drivers/iommu/arm-smmu-v3.c | 2 ++ > drivers/iommu/arm-smmu.c | 3 +++ > 2 files changed, 5 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index 15c01c3..f82eec3 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -1382,6 +1382,7 @@ static bool arm_smmu_capable(enum iommu_cap cap) > static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > { > struct arm_smmu_domain *smmu_domain; > + struct iommu_domain_msi_geometry msi_geometry = {0, 0, true}; nit, this initialization makes it difficult to search for who sets iommu_msi_supported, could we perhaps be more explicit in the initialization, ie. { .aperture_start = 0, .aperture_end = 0, .iommu_msi_supported = true }; No change to the compiled version, but easier to find in the source. > > if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) > return NULL; > @@ -1400,6 +1401,7 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > kfree(smmu_domain); > return NULL; > } > + smmu_domain->domain.msi_geometry = msi_geometry; > > mutex_init(&smmu_domain->init_mutex); > spin_lock_init(&smmu_domain->pgtbl_lock); > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index ac4aab9..97ff1b4 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -1002,6 +1002,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain) > static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > { > struct arm_smmu_domain *smmu_domain; > + struct iommu_domain_msi_geometry msi_geometry = {0, 0, true}; > > if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) > return NULL; > @@ -1020,6 +1021,8 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > return NULL; > } > > + smmu_domain->domain.msi_geometry = msi_geometry; > + > mutex_init(&smmu_domain->init_mutex); > spin_lock_init(&smmu_domain->pgtbl_lock); > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH v13 02/15] iommu/arm-smmu: Initialize the msi geometry Date: Thu, 6 Oct 2016 14:16:48 -0600 Message-ID: <20161006141648.0eda1648@t450s.home> References: <1475743531-4780-1-git-send-email-eric.auger@redhat.com> <1475743531-4780-3-git-send-email-eric.auger@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: yehuday-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org, drjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, marc.zyngier-5wv7dgnIgG8@public.gmane.org, p.fedin-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org, will.deacon-5wv7dgnIgG8@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, pranav.sawargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org, Manish.Jaggi-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org, christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, eric.auger.pro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org To: Eric Auger Return-path: In-Reply-To: <1475743531-4780-3-git-send-email-eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 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 On Thu, 6 Oct 2016 08:45:18 +0000 Eric Auger wrote: > On ARM, MSI write transactions also are translated by the smmu. > Let's report that specificity by setting the iommu_msi_supported > field to true. A valid aperture window will need to be provided. > > Signed-off-by: Eric Auger > > --- > v12 -> v13: > - reword the commit message > > v8 -> v9: > - reword the title and patch description > > v7 -> v8: > - use DOMAIN_ATTR_MSI_GEOMETRY > > v4 -> v5: > - don't handle fsl_pamu_domain anymore > - handle arm-smmu-v3 > --- > drivers/iommu/arm-smmu-v3.c | 2 ++ > drivers/iommu/arm-smmu.c | 3 +++ > 2 files changed, 5 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index 15c01c3..f82eec3 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -1382,6 +1382,7 @@ static bool arm_smmu_capable(enum iommu_cap cap) > static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > { > struct arm_smmu_domain *smmu_domain; > + struct iommu_domain_msi_geometry msi_geometry = {0, 0, true}; nit, this initialization makes it difficult to search for who sets iommu_msi_supported, could we perhaps be more explicit in the initialization, ie. { .aperture_start = 0, .aperture_end = 0, .iommu_msi_supported = true }; No change to the compiled version, but easier to find in the source. > > if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) > return NULL; > @@ -1400,6 +1401,7 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > kfree(smmu_domain); > return NULL; > } > + smmu_domain->domain.msi_geometry = msi_geometry; > > mutex_init(&smmu_domain->init_mutex); > spin_lock_init(&smmu_domain->pgtbl_lock); > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index ac4aab9..97ff1b4 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -1002,6 +1002,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain) > static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > { > struct arm_smmu_domain *smmu_domain; > + struct iommu_domain_msi_geometry msi_geometry = {0, 0, true}; > > if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) > return NULL; > @@ -1020,6 +1021,8 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > return NULL; > } > > + smmu_domain->domain.msi_geometry = msi_geometry; > + > mutex_init(&smmu_domain->init_mutex); > spin_lock_init(&smmu_domain->pgtbl_lock); > From mboxrd@z Thu Jan 1 00:00:00 1970 From: alex.williamson@redhat.com (Alex Williamson) Date: Thu, 6 Oct 2016 14:16:48 -0600 Subject: [PATCH v13 02/15] iommu/arm-smmu: Initialize the msi geometry In-Reply-To: <1475743531-4780-3-git-send-email-eric.auger@redhat.com> References: <1475743531-4780-1-git-send-email-eric.auger@redhat.com> <1475743531-4780-3-git-send-email-eric.auger@redhat.com> Message-ID: <20161006141648.0eda1648@t450s.home> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, 6 Oct 2016 08:45:18 +0000 Eric Auger wrote: > On ARM, MSI write transactions also are translated by the smmu. > Let's report that specificity by setting the iommu_msi_supported > field to true. A valid aperture window will need to be provided. > > Signed-off-by: Eric Auger > > --- > v12 -> v13: > - reword the commit message > > v8 -> v9: > - reword the title and patch description > > v7 -> v8: > - use DOMAIN_ATTR_MSI_GEOMETRY > > v4 -> v5: > - don't handle fsl_pamu_domain anymore > - handle arm-smmu-v3 > --- > drivers/iommu/arm-smmu-v3.c | 2 ++ > drivers/iommu/arm-smmu.c | 3 +++ > 2 files changed, 5 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index 15c01c3..f82eec3 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -1382,6 +1382,7 @@ static bool arm_smmu_capable(enum iommu_cap cap) > static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > { > struct arm_smmu_domain *smmu_domain; > + struct iommu_domain_msi_geometry msi_geometry = {0, 0, true}; nit, this initialization makes it difficult to search for who sets iommu_msi_supported, could we perhaps be more explicit in the initialization, ie. { .aperture_start = 0, .aperture_end = 0, .iommu_msi_supported = true }; No change to the compiled version, but easier to find in the source. > > if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) > return NULL; > @@ -1400,6 +1401,7 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > kfree(smmu_domain); > return NULL; > } > + smmu_domain->domain.msi_geometry = msi_geometry; > > mutex_init(&smmu_domain->init_mutex); > spin_lock_init(&smmu_domain->pgtbl_lock); > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index ac4aab9..97ff1b4 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -1002,6 +1002,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain) > static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > { > struct arm_smmu_domain *smmu_domain; > + struct iommu_domain_msi_geometry msi_geometry = {0, 0, true}; > > if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) > return NULL; > @@ -1020,6 +1021,8 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) > return NULL; > } > > + smmu_domain->domain.msi_geometry = msi_geometry; > + > mutex_init(&smmu_domain->init_mutex); > spin_lock_init(&smmu_domain->pgtbl_lock); >