From patchwork Thu May 30 03:48:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 165393 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp413333ili; Wed, 29 May 2019 20:49:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcaX8IdYajVwRr4OJsJxtGU8bkiD7K/UDou41yxKV2T5Ica1FkzLeiyjDYGtnKquHY1Rm3 X-Received: by 2002:a63:6841:: with SMTP id d62mr1753912pgc.17.1559188185372; Wed, 29 May 2019 20:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559188185; cv=none; d=google.com; s=arc-20160816; b=oZiOfNrKzxU2RYvjkhacLGtXMwYeAExMItp6LTyoEFnZkSp7VQfRBwXJutRwA9MwzC 2rIdqNAKiknz3pu6LA6KycRv6jB9T/73w9f+rq6k62ecepFOco+JcOj+8o7N99HOehZI X7+FL2+5xDL75Ts/3aCIN3X1pE5362prx6JObTY8ROREr0nCN3liz+TGytbh5MDJANpl Xyd5KuIBLivgt7VveU/wSX7kvK4PzRzzf56hXXn0sNcYC66XpyXpWeKph/+XjpG9sGi7 uXw8FjmvzyRD7QcaMdzwy+J38tPSPtGNd61T2ZSmCfm8PkLseeebWubdpLdQYuzCYe4o aIqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/hwmLTx5iCv46ZfOHgI+oe2n74rdKHKJa/P1RJ4lpsE=; b=K/GgBvZxGP3NmUNw3EYh8lEWynt84HetjcJ4QJC/1+iPaPmu71vCoS1rfu2FPbtGki HiFUzX35q/ld7IXn+N2NGJ5QlRKoT5U6yfEnvkR/Q/oBNrtF0/LRW/CGlB+RSn3R9I9o eDVp7ntJWPgf0+T40beIJfi8A91BLORs1qSC47MCHE8QytoxsHTbVlLlCKbqzDK3kIfw P1Q7PlVXoqD05RjlELKZgdomOn+1UJf4kd7TzXoYXwBXuajmbkk5k6uzmAuOG3uNjyx9 jkcleNtVD2uAhMehRdtm31tXCw1w221Cg3jW3zo/sl5ZLyPgQIbeBE3dKAItcmMYK3GI jlfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i11si1945835plt.92.2019.05.29.20.49.45; Wed, 29 May 2019 20:49:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733266AbfE3Dto (ORCPT + 30 others); Wed, 29 May 2019 23:49:44 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:53288 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387743AbfE3Dtc (ORCPT ); Wed, 29 May 2019 23:49:32 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C7C93B2D6DC8094364CD; Thu, 30 May 2019 11:49:27 +0800 (CST) Received: from HGHY4L002753561.china.huawei.com (10.133.215.186) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Thu, 30 May 2019 11:49:19 +0800 From: Zhen Lei To: Jean-Philippe Brucker , John Garry , Robin Murphy , Will Deacon , Joerg Roedel , Jonathan Corbet , linux-doc , Sebastian Ott , Gerald Schaefer , "Martin Schwidefsky" , Heiko Carstens , Benjamin Herrenschmidt , Paul Mackerras , "Michael Ellerman" , Tony Luck , Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , David Woodhouse , iommu , linux-kernel , linux-s390 , linuxppc-dev , x86 , linux-ia64 CC: Zhen Lei , Hanjun Guo Subject: [PATCH v8 6/7] iommu/amd: add support for IOMMU default DMA mode build options Date: Thu, 30 May 2019 11:48:30 +0800 Message-ID: <20190530034831.4184-7-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190530034831.4184-1-thunder.leizhen@huawei.com> References: <20190530034831.4184-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.133.215.186] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The default DMA mode of AMD IOMMU is LAZY, this patch make it can be set to STRICT at build time. It can be overridden by boot option. There is no functional change. Signed-off-by: Zhen Lei --- drivers/iommu/Kconfig | 2 +- drivers/iommu/amd_iommu_init.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) -- 1.8.3 diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index af580274b7c5270..f6c030433d38048 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -79,7 +79,7 @@ choice prompt "IOMMU default DMA mode" depends on IOMMU_API default IOMMU_DEFAULT_PASSTHROUGH if (PPC_POWERNV && PCI) - default IOMMU_DEFAULT_LAZY if (INTEL_IOMMU || S390_IOMMU) + default IOMMU_DEFAULT_LAZY if (AMD_IOMMU || INTEL_IOMMU || S390_IOMMU) default IOMMU_DEFAULT_STRICT help This option allows IOMMU DMA mode to be chose at build time, to diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index f977df90d2a4912..6b0bfa43f6faa32 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -166,7 +166,8 @@ struct ivmd_header { to handle */ LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings we find in ACPI */ -bool amd_iommu_unmap_flush; /* if true, flush on every unmap */ +bool amd_iommu_unmap_flush = IS_ENABLED(CONFIG_IOMMU_DEFAULT_STRICT); + /* if true, flush on every unmap */ LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the system */