Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp587410ybz; Wed, 15 Apr 2020 14:37:06 -0700 (PDT) X-Google-Smtp-Source: APiQypK8I+Da4VNT94B3Td5ZE8h9IwR7QOYvgzMSelYPkUqbVqDmII3PdoLaohvGeb+sM4mjtL1R X-Received: by 2002:a17:906:6416:: with SMTP id d22mr6861752ejm.221.1586986626476; Wed, 15 Apr 2020 14:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586986626; cv=none; d=google.com; s=arc-20160816; b=rmYs2n5KwGREN7ulZNBpYJblBV8KEucT683tLoDanTmJ3WVRwJ9py7GHtUCmrTBSCq y3mZ6OPYvqtzPYVVwj0bS0eabTwf2jmXTJbe75kyv7qribV8Vq5KISWj6uK5x2cKdDcQ hkoDY6h+jxBonL0a2ge+1LIEzDZv7WBLESXcHOQIh8kHTAWcACuKew9iZQFfrxHy70LQ XB3ZLFT21JTrIzuT77MQHnrvOFghP7g8mjezqeAmCgutP0sfQpABBp0a6BtGvsHNuQLI r5kVxswLRNjH+hgcbhFc5svXtmLCNg8zDvltzQC7C3/i0V+qhD/dW9EvzO2X1gXWUSwd wNxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=0+02+jqdY0ziN4FC2k9iyuy2JbWd9iqLbQGlIpt6tls=; b=NpwHijhqd+3rf+XDeo3LmgRfOa72hu3XyjerEtbsylCxFClOdvfq8wd9Z7RSuTZx71 7BwIBhnB5h9wyGl8gQNuXmSStlNM8VPu5jgo1a4lumNSOQXaYvP2GLrnhPvOychUdW6J WGUh5g4avV/EI/jDc0P20F66vh7hWxke1lMirDcKcYlPTU48rN44Xj4M4wPW5yZ8LRGr nnbkeEZzmsCZLVy2nCFJGLmCSpc3agUF48hmYgPh3/9NtwAtQfawCLtjeMoUl9GxBdCe TCr1PAT6PxEf7nLRjX8z5QCw3jgGOBB913gmhVjxNgihiZfTyXy3cJH1lTwW2YZQtBT5 M11g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si11710794edi.410.2020.04.15.14.36.43; Wed, 15 Apr 2020 14:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728102AbgDNNbK (ORCPT + 99 others); Tue, 14 Apr 2020 09:31:10 -0400 Received: from 8bytes.org ([81.169.241.247]:34726 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502859AbgDNNP5 (ORCPT ); Tue, 14 Apr 2020 09:15:57 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id E0C7D45B; Tue, 14 Apr 2020 15:15:51 +0200 (CEST) From: Joerg Roedel To: Joerg Roedel , Will Deacon , Robin Murphy , Marek Szyprowski , Kukjin Kim , Krzysztof Kozlowski , David Woodhouse , Lu Baolu , Andy Gross , Bjorn Andersson , Matthias Brugger , Rob Clark , Heiko Stuebner , Gerald Schaefer , Thierry Reding , Jonathan Hunter , Jean-Philippe Brucker Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org, linux-tegra@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel Subject: [PATCH v2 03/33] iommu/amd: Implement iommu_ops->def_domain_type call-back Date: Tue, 14 Apr 2020 15:15:12 +0200 Message-Id: <20200414131542.25608-4-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200414131542.25608-1-joro@8bytes.org> References: <20200414131542.25608-1-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel Implement the new def_domain_type call-back for the AMD IOMMU driver. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 20cce366e951..73b4f84cf449 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -2661,6 +2661,20 @@ static void amd_iommu_iotlb_sync(struct iommu_domain *domain, amd_iommu_flush_iotlb_all(domain); } +static int amd_iommu_def_domain_type(struct device *dev) +{ + struct iommu_dev_data *dev_data; + + dev_data = get_dev_data(dev); + if (!dev_data) + return 0; + + if (dev_data->iommu_v2) + return IOMMU_DOMAIN_IDENTITY; + + return 0; +} + const struct iommu_ops amd_iommu_ops = { .capable = amd_iommu_capable, .domain_alloc = amd_iommu_domain_alloc, @@ -2680,6 +2694,7 @@ const struct iommu_ops amd_iommu_ops = { .pgsize_bitmap = AMD_IOMMU_PGSIZES, .flush_iotlb_all = amd_iommu_flush_iotlb_all, .iotlb_sync = amd_iommu_iotlb_sync, + .def_domain_type = amd_iommu_def_domain_type, }; /***************************************************************************** -- 2.17.1