From patchwork Mon Nov 28 06:46:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 26552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5475959wrr; Sun, 27 Nov 2022 22:59:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf5CieMbzhnFMz585lRf5b8jpd9dJb8clev98dQOWEe74gLhA4PxuTaGnFOW0tpaK0DVj+vj X-Received: by 2002:a05:6402:401:b0:461:5b2f:2d8f with SMTP id q1-20020a056402040100b004615b2f2d8fmr32613319edv.348.1669618758258; Sun, 27 Nov 2022 22:59:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669618758; cv=none; d=google.com; s=arc-20160816; b=jxONDkxH3A77L7EV4G+6bjfybvTgfvSOFL3VWwpzi6nsKSTyDxiGzOnzXwiEhBpO6E Za4F+JxbW+SiOekWxgFEk3drjoz6TfD3tuBkKTjUH4ovfJUCJbxLOq5I1sbNstpek7Ly cUn6kXr/082v+jQ9fbK3GWKc8wOI9rWvzhs14+Wf+lCM+6YV9llZ+u3q3AFkPO0Qp3cQ Va0XElOX7jU/ZvS9qxyWgSaf7ru/9UMVDecuAH93zUBOVz1acBrZ0gvsjBcO7Ftd4grM yNb1AZ5xjYFP7NZNXfJysNl90mGp3yQzUTEgQAyatUVMl5bhu401Aw0rK9SkiwSZJplv +wvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FFu2TiaTa8GmIVNtEKrfpPbsEVRu0OhaBKJi05VjQEI=; b=DvVg2O6BNCl5IM3tUkC9oZQFrMdfPm6NAHDkIDXsgwWpDFEadvNNmltpQc/K0BaMWL 6Gb/tXVuXEpIYpCRls0t9BGq5WenRowMPv1S3Bb9ZwfstwjJzELKNlAOaB2ql6Fx9bRV FsmOSRAkIiBGe0jjmtuYn/e3XPMWZXRwiwbJdZupq42oyTZoB4UwfAIEGiNWn671mKTL h6aK8Jq8l/PDYd4enZw0YKSiHf5/xf3h9ii8ts+u/L9P4Itzwx+NpDf+OMAOLdS8vnWN XJ9F7zy7fy6dQ/SeNyNU1CMJzCj6cMS6h9xdeGibs1eYhUu4xBLkDxCdZ4HraRKTNjzU pI+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FWuIz94d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a05640240d100b00468468cd389si10697723edb.205.2022.11.27.22.58.55; Sun, 27 Nov 2022 22:59:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FWuIz94d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229589AbiK1G44 (ORCPT + 99 others); Mon, 28 Nov 2022 01:56:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbiK1G4Q (ORCPT ); Mon, 28 Nov 2022 01:56:16 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAECE1572B for ; Sun, 27 Nov 2022 22:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618565; x=1701154565; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2uZWB31+7BHbXDhpDwxdAHkoChULgPE00ii//Ntnb2A=; b=FWuIz94duB0Lv0Hi9yCaWVq/VwoJQxjJ7YSUzk7x48eLgTAMkKANyaGu ApCKC9kdHbMyJ3SyS95qnxlijeIQN02CziESzPggKtOFlsCmkC4Ej2XLX KpXRBo3jLae5nKzYhci7PDB3elz0T4ikbq3oiAtu4nAiWHHfO476Ck1QP MD9Fc8hyLl/5jfvESixVVJHlv2an/SO7NT+9NjZe/nQz/TJNoWJGRsDYd +fFKIzzTtzBWnGkW5pNAnek86Rn9iVGsCSXPvfli/e5tDAgELlHgcIJ5b 1/9bVwc/CnCVODDL7f4qoD0L5h1q+8vReZpvhGsI/9c7cvMlOJL8+AX2Z A==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="312395267" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="312395267" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:56:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121278" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121278" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:58 -0800 From: Lu Baolu To: Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , Kevin Tian , Will Deacon , Robin Murphy , Jean-Philippe Brucker Cc: Suravee Suthikulpanit , Hector Martin , Sven Peter , Rob Clark , Marek Szyprowski , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Yong Wu , Matthias Brugger , Heiko Stuebner , Matthew Rosato , Orson Zhai , Baolin Wang , Chunyan Zhang , Chen-Yu Tsai , Thierry Reding , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v3 17/20] iommu/tegra: Add set_platform_dma callback Date: Mon, 28 Nov 2022 14:46:45 +0800 Message-Id: <20221128064648.1934720-18-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750722159438009046?= X-GMAIL-MSGID: =?utf-8?q?1750722159438009046?= This IOMMU driver doesn't support default domain. Add the implementation of set_platform_dma callback so that the IOMMU core could return the DMA control. Signed-off-by: Lu Baolu --- drivers/iommu/tegra-smmu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 5b1af40221ec..a36e163e5cc1 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -527,6 +527,14 @@ static void tegra_smmu_detach_dev(struct iommu_domain *domain, struct device *de } } +static void tegra_smmu_set_platform_dma(struct device *dev) +{ + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); + + if (domain) + tegra_smmu_detach_dev(domain, dev); +} + static void tegra_smmu_set_pde(struct tegra_smmu_as *as, unsigned long iova, u32 value) { @@ -965,6 +973,7 @@ static const struct iommu_ops tegra_smmu_ops = { .domain_alloc = tegra_smmu_domain_alloc, .probe_device = tegra_smmu_probe_device, .device_group = tegra_smmu_device_group, + .set_platform_dma = tegra_smmu_set_platform_dma, .of_xlate = tegra_smmu_of_xlate, .pgsize_bitmap = SZ_4K, .default_domain_ops = &(const struct iommu_domain_ops) {