From: John Garry <john.garry@huawei.com>
To: Robin Murphy <robin.murphy@arm.com>, <joro@8bytes.org>
Cc: dwmw2@infradead.org, linux-kernel@vger.kernel.org,
murphyt7@tcd.ie, iommu@lists.linux-foundation.org,
will@kernel.org
Subject: Re: [PATCH] iommu/dma: Resurrect the "forcedac" option
Date: Thu, 11 Mar 2021 15:25:14 +0000 [thread overview]
Message-ID: <a47a2df2-d6a8-80f0-1c87-ef2eb2fa4174@huawei.com> (raw)
In-Reply-To: <7eece8e0ea7bfbe2cd0e30789e0d46df573af9b0.1614961776.git.robin.murphy@arm.com>
On 05/03/2021 16:32, Robin Murphy wrote:
> In converting intel-iommu over to the common IOMMU DMA ops, it quietly
> lost the functionality of its "forcedac" option. Since this is a handy
> thing both for testing and for performance optimisation on certain
> platforms, reimplement it under the common IOMMU parameter namespace.
>
> For the sake of fixing the inadvertent breakage of the Intel-specific
> parameter, remove the dmar_forcedac remnants and hook it up as an alias
> while documenting the transition to the new common parameter.
>
> Fixes: c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops")
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
If it's worth anything:
Reviewed-by: John Garry <john.garry@huawei.com>
> ---
> Documentation/admin-guide/kernel-parameters.txt | 15 ++++++++-------
> drivers/iommu/dma-iommu.c | 13 ++++++++++++-
> drivers/iommu/intel/iommu.c | 5 ++---
> include/linux/dma-iommu.h | 2 ++
> 4 files changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 04545725f187..835f810f2f26 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1869,13 +1869,6 @@
> bypassed by not enabling DMAR with this option. In
> this case, gfx device will use physical address for
> DMA.
> - forcedac [X86-64]
> - With this option iommu will not optimize to look
> - for io virtual address below 32-bit forcing dual
> - address cycle on pci bus for cards supporting greater
> - than 32-bit addressing. The default is to look
> - for translation below 32-bit and if not available
> - then look in the higher range.
> strict [Default Off]
> With this option on every unmap_single operation will
> result in a hardware IOTLB flush operation as opposed
> @@ -1964,6 +1957,14 @@
> nobypass [PPC/POWERNV]
> Disable IOMMU bypass, using IOMMU for PCI devices.
>
> + iommu.forcedac= [ARM64, X86] Control IOVA allocation for PCI devices.
> + Format: { "0" | "1" }
> + 0 - Try to allocate a 32-bit DMA address first, before
> + falling back to the full range if needed.
> + 1 - Allocate directly from the full usable range,
> + forcing Dual Address Cycle for PCI cards supporting
> + greater than 32-bit addressing.
> +
> iommu.strict= [ARM64] Configure TLB invalidation behaviour
> Format: { "0" | "1" }
> 0 - Lazy mode.
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index 9ab6ee22c110..260bf3de1992 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -52,6 +52,17 @@ struct iommu_dma_cookie {
> };
>
> static DEFINE_STATIC_KEY_FALSE(iommu_deferred_attach_enabled);
> +bool iommu_dma_forcedac __read_mostly;
> +
> +static int __init iommu_dma_forcedac_setup(char *str)
> +{
> + int ret = kstrtobool(str, &iommu_dma_forcedac);
> +
> + if (!ret && iommu_dma_forcedac)
> + pr_info("Forcing DAC for PCI devices\n");
I seem to remember some disagreement on this sort of print some other
time :)
> + return ret;
> +}
> +early_param("iommu.forcedac", iommu_dma_forcedac_setup);
>
> void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
> struct iommu_domain *domain)
> @@ -438,7 +449,7 @@ static dma_addr_t iommu_dma_alloc_iova(struct iommu_domain *domain,
> dma_limit = min(dma_limit, (u64)domain->geometry.aperture_end);
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2021-03-11 15:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 16:32 [PATCH] iommu/dma: Resurrect the "forcedac" option Robin Murphy
2021-03-05 17:41 ` John Garry
2021-03-08 13:08 ` Robin Murphy
2021-03-08 14:54 ` John Garry
2021-03-08 1:51 ` Lu Baolu
2021-03-11 15:25 ` John Garry [this message]
2021-03-18 9:55 ` Joerg Roedel
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=a47a2df2-d6a8-80f0-1c87-ef2eb2fa4174@huawei.com \
--to=john.garry@huawei.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=murphyt7@tcd.ie \
--cc=robin.murphy@arm.com \
--cc=will@kernel.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