linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: eric.auger@linaro.org (Eric Auger)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] iommu/arm-smmu: Don't allocate resources for bypass domains
Date: Fri, 15 Apr 2016 17:09:41 +0200	[thread overview]
Message-ID: <57110435.8030104@linaro.org> (raw)
In-Reply-To: <491c885f61c509d959b04cfb63676bd07e481dea.1460558667.git.robin.murphy@arm.com>

Hi Robin,
On 04/13/2016 04:46 PM, Robin Murphy wrote:
> Until we get fully plumbed into of_iommu_configure, our default
> IOMMU_DOMAIN_DMA domains just bypass translation. Since we achieve that
> by leaving the stream table entries set to bypass instead of pointing at
> a translation context, the context bank we allocate for the domain is
> completely wasted. Context banks are typically a rather limited
> resource, so don't hog ones we don't need.
> 
Thanks for this fix. I recovered the ability to assign more than VFs on
Overdrive HW.

Tested-by: Eric Auger <eric.auger@linaro.org>

Best Regards

Eric
> Reported-by: Eric Auger <eric.auger@linaro.org>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/iommu/arm-smmu.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index 5158feb..7c39ac4 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -826,6 +826,12 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
>  	if (smmu_domain->smmu)
>  		goto out_unlock;
>  
> +	/* We're bypassing these SIDs, so don't allocate an actual context */
> +	if (domain->type == IOMMU_DOMAIN_DMA) {
> +		smmu_domain->smmu = smmu;
> +		goto out_unlock;
> +	}
> +
>  	/*
>  	 * Mapping the requested stage onto what we support is surprisingly
>  	 * complicated, mainly because the spec allows S1+S2 SMMUs without
> @@ -948,7 +954,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain)
>  	void __iomem *cb_base;
>  	int irq;
>  
> -	if (!smmu)
> +	if (!smmu || domain->type == IOMMU_DOMAIN_DMA)
>  		return;
>  
>  	/*
> 

  parent reply	other threads:[~2016-04-15 15:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 16:19 [PATCH] iommu/arm-smmu: Fix stream-match conflict with IOMMU_DOMAIN_DMA Will Deacon
2016-04-04  9:40 ` Eric Auger
2016-04-07 14:46   ` Will Deacon
2016-04-07 14:50     ` Eric Auger
2016-04-05 10:48 ` Robin Murphy
2016-04-05 11:33   ` Eric Auger
2016-04-13 14:46     ` [PATCH] iommu/arm-smmu: Don't allocate resources for bypass domains Robin Murphy
2016-04-15 13:05       ` Will Deacon
2016-04-15 15:11         ` Eric Auger
2016-04-15 15:09       ` Eric Auger [this message]
2016-04-15 15:09 ` [PATCH] iommu/arm-smmu: Fix stream-match conflict with IOMMU_DOMAIN_DMA Eric Auger
2016-04-15 17:53   ` Shi, Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57110435.8030104@linaro.org \
    --to=eric.auger@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).