From patchwork Thu Jun 13 08:42:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 166707 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp947434ilk; Thu, 13 Jun 2019 09:11:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsEcic0CwtgtPBaaqTyeOiWBz+LMBs6yFMNJotoCtvUhdMzyjOA3S4T6wLno/xcp3Bc4Co X-Received: by 2002:a62:ae01:: with SMTP id q1mr38629351pff.219.1560442260379; Thu, 13 Jun 2019 09:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560442260; cv=none; d=google.com; s=arc-20160816; b=kW6nEzZFxCsdYu65efSYnTegI2jXgSvF1Y6Dkzu0zUFQSaGPSQa3OsZqfbDT+0rH+3 onL7ZCU18kPRvnC/7mVN1JREYxj11u3G76tLDWadQL/kgF2DUEGrZGSi8WRvBKybDrGG YVFC/Fo7wJDRULi1RmSDH+51DbucXTqw4mWTaTB8wS3NLaY1qjBQ3K0GiWsXmLMADT33 F8w77IpM6zYut9Q1yvFrWrW3Pr5Wlzajw/bmOXHKJ8gRp4PQM4Uz4K3H+VBRVzIlwrQf ORCqiXSBTp2rYRN7aV6JardgYNBNpSL419Q5pMQZv6gWZf/fNGE4I6Ahkfgtxp1PlRQt TlWQ== 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=eKEdWt8MLxHsIXuUYZfWT86sHV5rs18RCJ06nZyjvGM=; b=iwNxpyapFWecShnWXCRNWyRgJOuKOz3J3iy3MVi/E+uxD+WsG8Qu04PHzpBVKJigI5 axOKTKAWLhChmgiHgwkNhv8gBbkaMDIUeamD2efoWcE6rVwG+QVEpUXGBjfo9jewF2RZ tuPSxegoPx7j+dnm3sII4sxEcYwd3d3hkDBudUeYkihp9FFhyoXC6tKEnKKmigJITUmk hJXlka9K/G+Aco+SvAXpNeIjpYrfZrKAjNYDVsyQX2IKjpn4UaAuNNqYErPxSwSkyKz0 pnrQHFjqdyUSlMDuXpFK2GmZXulYgqYd2WCQv6kRycuCZbp/97aLjbn8fctKjc7bLCzC w8GQ== 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 194si166048pga.203.2019.06.13.09.10.59; Thu, 13 Jun 2019 09:11:00 -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 S2391321AbfFMQK7 (ORCPT + 24 others); Thu, 13 Jun 2019 12:10:59 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:18145 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731246AbfFMIno (ORCPT ); Thu, 13 Jun 2019 04:43:44 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E9BFCB3E969C7057F6F3; Thu, 13 Jun 2019 16:43:40 +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, 13 Jun 2019 16:43:32 +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 Subject: [PATCH v9 6/7] iommu/amd: add support for IOMMU default DMA mode build options Date: Thu, 13 Jun 2019 16:42:39 +0800 Message-ID: <20190613084240.16768-7-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190613084240.16768-1-thunder.leizhen@huawei.com> References: <20190613084240.16768-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 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 1.8.3 diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index fd297b0e0330d27..70741fd73b07785 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 an IOMMU DMA mode to be chosen at build time, to diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 07d84dbab564e4d..b7d5c1757425946 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -154,7 +154,7 @@ 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 */