From patchwork Wed Jan 4 12:57:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 38913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5135390wrt; Wed, 4 Jan 2023 05:12:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXudPqbYuDJT/fySr91VScCC1ZKZafTASsJbQow3PDr83o03SNwv1IPq3TV435MQ5MU+8jlc X-Received: by 2002:a17:906:308b:b0:7ae:cda1:76d0 with SMTP id 11-20020a170906308b00b007aecda176d0mr39120746ejv.15.1672837929658; Wed, 04 Jan 2023 05:12:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672837929; cv=none; d=google.com; s=arc-20160816; b=fX1bFxaZwAGVn2XeNwREuMBZsYG8kOS1pzE3V1D1mUNRfLqvCLVXOq4NzW4irOmQRH 86XZU38LYn9i/Q2KgqN71E+fwEmPoroUOMajBrSMMhTMWZA8rqub/f51MDzkmEjR8t5D 367e1OLxbagnK6lYA88/nGGBwG2Q2EbUeanJVgb5yXizfIpR5ZeN1GMoeslwFB9LCeQ6 3dQn3fYptfzMBkOwW73YZDV75kis2n/x3UnOvZEuu/NUg9FtqNyEGopRG/StKNEHG1pJ a4JNqfiU+dGDVKNgJvZ5T/4lMRwmar1nElZpn/awtNa46lsIrsL83iwFSrnHikbiVnuF 3YfQ== 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=k4JsrtVNApeGintkdJThbjhKhAnHnCkgdHzhn8eXcrw=; b=Z6G9352XF1xkDdsItQjjf4dRYBkHn8EA2OVfKNeO/aUUh5xPnzKZTPUq4k8ZktCHoX 5QIKkTXt5GAKJ8Wh5j8zGNz8HHvk1iGZciyHGWSFo0PZStxZIlTdG7R+jbYd2VFEJNBD CBOhr7faz9vMprDI8ekctTq1+zAFL/iA8DxRHzoHomuVltb0UTv9xqvgzwxj9rOItj8q 1TYPxEtYh7bSk3T8kIotPwzolARZ5GVy/cHypglNoKFi4Bs14IcJ98Dblb11UeGGdKpU TaTC9UzNEeF6lKCAjtFd2a9xRb8CYYizAbE3e8qc289mHPYwiepnJ6xVkD0tN7wlmMxz w5GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KGG6mN+8; 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 xa8-20020a170906fd8800b007b8b7da6480si28959667ejb.659.2023.01.04.05.11.45; Wed, 04 Jan 2023 05:12:09 -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=KGG6mN+8; 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 S239315AbjADNI5 (ORCPT + 99 others); Wed, 4 Jan 2023 08:08:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239321AbjADNIV (ORCPT ); Wed, 4 Jan 2023 08:08:21 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5427A3E0F7 for ; Wed, 4 Jan 2023 05:07:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672837652; x=1704373652; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xleto1bNcJbkoJR+rItuVcszZ5LEAV28VIm/LQTaL2s=; b=KGG6mN+8e5MPITVi6+TTaycglDqIk8rdmnQBtz5eyjFryRSn0WYo7YPO mwyLCmLTSCSnKR5s1Bfof9kcdLOpqF02OpkOqN4t/YH5PmGZoMlZfMGTb GCjsbtx0EOqVn+g2Y2IRyCn25BS13P9SZajq7cgOgZ0s4DlZhzhwpN6bn IzHVvV9aBTy5tQUtkYTfhTp8qddDZjl3P/hEQ6AoCv7Ilxv5PtpEhx/nN YoUdIeCq3nsxHtj/i7Bwk71jInHEq4N7F/ZzpSvBGS19wai5SsJG0Cpkq 6gkwvwkXWDYKvQfJFsf/ydyxawbq8VOrCcVSaW8dkVpHqb046Kly6/ZC6 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="320640234" X-IronPort-AV: E=Sophos;i="5.96,300,1665471600"; d="scan'208";a="320640234" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2023 05:07:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="797529180" X-IronPort-AV: E=Sophos;i="5.96,299,1665471600"; d="scan'208";a="797529180" Received: from allen-box.sh.intel.com ([10.239.159.48]) by fmsmga001.fm.intel.com with ESMTP; 04 Jan 2023 05:07:00 -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 v4 16/19] iommu/gart: Add set_platform_dma_ops callback Date: Wed, 4 Jan 2023 20:57:22 +0800 Message-Id: <20230104125725.271850-17-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104125725.271850-1-baolu.lu@linux.intel.com> References: <20230104125725.271850-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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?1754097704900021981?= X-GMAIL-MSGID: =?utf-8?q?1754097704900021981?= This IOMMU driver doesn't support default domain. Add the implementation of set_platform_dma_ops callback so that the IOMMU core could return the DMA control. With set_platform_dma_ops implemented, there's no need for detach_dev. Remove it to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe --- drivers/iommu/tegra-gart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index ed53279d1106..a482ff838b53 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@ -124,9 +124,9 @@ static int gart_iommu_attach_dev(struct iommu_domain *domain, return ret; } -static void gart_iommu_detach_dev(struct iommu_domain *domain, - struct device *dev) +static void gart_iommu_set_platform_dma(struct device *dev) { + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); struct gart_device *gart = gart_handle; spin_lock(&gart->dom_lock); @@ -270,11 +270,11 @@ static const struct iommu_ops gart_iommu_ops = { .domain_alloc = gart_iommu_domain_alloc, .probe_device = gart_iommu_probe_device, .device_group = generic_device_group, + .set_platform_dma_ops = gart_iommu_set_platform_dma, .pgsize_bitmap = GART_IOMMU_PGSIZES, .of_xlate = gart_iommu_of_xlate, .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = gart_iommu_attach_dev, - .detach_dev = gart_iommu_detach_dev, .map = gart_iommu_map, .unmap = gart_iommu_unmap, .iova_to_phys = gart_iommu_iova_to_phys,