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=-17.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, 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 6FF06C47096 for ; Thu, 3 Jun 2021 17:01:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D39461159 for ; Thu, 3 Jun 2021 17:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230300AbhFCRCo (ORCPT ); Thu, 3 Jun 2021 13:02:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbhFCRCm (ORCPT ); Thu, 3 Jun 2021 13:02:42 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33285C06174A for ; Thu, 3 Jun 2021 10:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=Lp4IX8ac6vnef/I1ayxIo0SkojWoNqyo+RY9PrlOTJY=; b=49qoomEpvq2032jf8PA3bwkUHj lwGa0PH17D5GtVo8274LPi/C3yjj5jpeQ2vCNFNSO0WEbUgCQQ/Ygs9VtJjFUiaV4fAhQr81sAXr+ DVl6EN0mwf9OWl5Uzz+zCaZCxGj96JpTZxK+I3002uhxMz1KPp93RlS42kE2opFmujSAnIY63tsGR 5/m4Kt/wTpQjnhazcrtYgfwnwzuzME4hH3Vzjx0qEvtFQbIxjjH3CJXmAZq+v3370PWEccam5I7S+ ntNdjMzwfPY/HXd/xynxm17nnglDNkkHrzGfQi8UH2K7f/mUQoxtxafyEr4VosGMAtUroo6O8dGIQ BxBT/wow==; Received: from [2601:1c0:6280:3f0::ce7d] by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1loqiA-009gxg-MQ; Thu, 03 Jun 2021 17:00:51 +0000 Subject: Re: [PATCH v10 1/3] iommu: Enhance IOMMU default DMA mode build options To: John Garry , joro@8bytes.org, will@kernel.org, dwmw2@infradead.org, baolu.lu@linux.intel.com, robin.murphy@arm.com Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linuxarm@huawei.com, thunder.leizhen@huawei.com, chenxiang66@hisilicon.com References: <1622728715-209296-1-git-send-email-john.garry@huawei.com> <1622728715-209296-2-git-send-email-john.garry@huawei.com> From: Randy Dunlap Message-ID: Date: Thu, 3 Jun 2021 10:00:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <1622728715-209296-2-git-send-email-john.garry@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/3/21 6:58 AM, John Garry wrote: > From: Zhen Lei > > First, add build options IOMMU_DEFAULT_{LAZY|STRICT}, so that we have the > opportunity to set {lazy|strict} mode as default at build time. Then put > the two config options in an choice, as they are mutually-exclusive. > > [jpg: Make choice between strict and lazy only (and not passthrough)] > Signed-off-by: Zhen Lei > Signed-off-by: John Garry > --- > drivers/iommu/Kconfig | 34 ++++++++++++++++++++++++++++++++++ > drivers/iommu/iommu.c | 3 ++- > 2 files changed, 36 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > index 1f111b399bca..12ef90256df8 100644 > --- a/drivers/iommu/Kconfig > +++ b/drivers/iommu/Kconfig > @@ -90,6 +90,40 @@ config IOMMU_DEFAULT_PASSTHROUGH > > If unsure, say N here. > > +choice > + prompt "IOMMU default DMA mode" > + depends on IOMMU_API > + > + default IOMMU_DEFAULT_STRICT > + help > + This option allows an IOMMU DMA mode to be chosen at build time, to > + override the default DMA mode of each ARCH, removing the need to > + pass in kernel parameters through command line. It is still possible > + to provide ARCH-specific or common boot options to override this > + option. > + > + If unsure, keep the default. > + > +config IOMMU_DEFAULT_LAZY > + bool "lazy" > + help > + Support lazy mode, where for every IOMMU DMA unmap operation, the > + flush operation of IOTLB and the free operation of IOVA are deferred. > + They are only guaranteed to be done before the related IOVA will be > + reused. > + > +config IOMMU_DEFAULT_STRICT > + bool "strict" > + help > + For every IOMMU DMA unmap operation, the flush operation of IOTLB and > + the free operation of IOVA are guaranteed to be done in the unmap > + function. > + > + This mode is safer than the two above, but it maybe slower in some There don't seem to be two above? > + high performace scenarios. performance > + > +endchoice thanks. -- ~Randy