From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65C37C433DB for ; Thu, 11 Mar 2021 15:27:30 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BFFE864FE9 for ; Thu, 11 Mar 2021 15:27:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFFE864FE9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 509654ECC5; Thu, 11 Mar 2021 15:27:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IlXpNW6CZPKr; Thu, 11 Mar 2021 15:27:28 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTP id D91A04ECBF; Thu, 11 Mar 2021 15:27:27 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BADEAC000B; Thu, 11 Mar 2021 15:27:27 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7B392C0001 for ; Thu, 11 Mar 2021 15:27:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 62E004303C for ; Thu, 11 Mar 2021 15:27:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pvazr6tJqV8r for ; Thu, 11 Mar 2021 15:27:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id F381E42FB1 for ; Thu, 11 Mar 2021 15:27:23 +0000 (UTC) Received: from fraeml705-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4DxCKD1tw1z67y1w; Thu, 11 Mar 2021 23:19:12 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml705-chm.china.huawei.com (10.206.15.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2106.2; Thu, 11 Mar 2021 16:27:18 +0100 Received: from [10.47.4.196] (10.47.4.196) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 11 Mar 2021 15:27:17 +0000 Subject: Re: [PATCH] iommu/dma: Resurrect the "forcedac" option To: Robin Murphy , References: <7eece8e0ea7bfbe2cd0e30789e0d46df573af9b0.1614961776.git.robin.murphy@arm.com> From: John Garry Message-ID: Date: Thu, 11 Mar 2021 15:25:14 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <7eece8e0ea7bfbe2cd0e30789e0d46df573af9b0.1614961776.git.robin.murphy@arm.com> Content-Language: en-US X-Originating-IP: [10.47.4.196] X-ClientProxiedBy: lhreml715-chm.china.huawei.com (10.201.108.66) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Cc: dwmw2@infradead.org, linux-kernel@vger.kernel.org, murphyt7@tcd.ie, iommu@lists.linux-foundation.org, will@kernel.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" 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 If it's worth anything: Reviewed-by: John Garry > --- > 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