From patchwork Mon Nov 28 06:46:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 26547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5475422wrr; Sun, 27 Nov 2022 22:58:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf5gbZzmRTDkE1tjZ40pL5KxVhCkNUUb7xgTiJytBwCv6/nVczKf9MSgZ6mi9+x/KNgWyg8L X-Received: by 2002:aa7:d74c:0:b0:461:b952:8932 with SMTP id a12-20020aa7d74c000000b00461b9528932mr37948597eds.104.1669618686320; Sun, 27 Nov 2022 22:58:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669618686; cv=none; d=google.com; s=arc-20160816; b=hkWYaxekpUWaHBUHsVNR3WiD9ZdS3/L2DXL1szQb9VXgYAeVTsDOCEIZMiZSWjS3h+ sFuTNjZ6m47zyisa58/WJkpiVDu77DLV4x77+Gnl/T5+NheApi2Z1gad7AGQq2JoxLrG kWXFvQvKhIpQSnk2zjo/AYC/RKPLtjZoa9kUTLNJGlKQZqb3WclDiatgoJJF0rVWkIyq kMEEOgIIwJhpOZikFDR2DlxXy3/iry66iIXB6x/Fp7FaqSPBpp6JFHDRm8+S4Zcq91gW Qf8qabWYforH2+FBEU4zL9/TNy+rwpg0J7IojVboXv7Y6l/kOGaun/BZFISuX7YbOI2l j9XQ== 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=RXbdKTA/bUVRNjse77OxG1bwtUCiq2JzbjcdNGtq0RQ=; b=Vx+lT18me8KWaufnkmoEccONFum3WP5/OXBYYkZgtXp5CL52KKxnGBlnEnSJ+5S2xd cQVaMmaXqBpwIK1R76HdZqhS+uEZ7KVrFPkO6vPyYWBew4SPHcXcgdXVZwr/B6Gh/CXf 64bMq7QhcDJdldKegyKHkdR5xe39qPkfmWlK6/7ZiTKvL+qBveacJYuLg5gdR2eusuhT DUYbtTMUZAtPU21uqSDiI86RR3O8EIPXEzL/JX9928aav9fnouUsBQ59MfrlkV/iOAu+ liPwLq/9flrh5siHzRDyBXuo7xm7BRzP9+OSKyKd1bLPwTJ3dO7/1C5gtkFL5FGI6eTn f6rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Oz8jptwm; 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 e16-20020a17090658d000b007be835e8f3esi3730986ejs.582.2022.11.27.22.57.43; Sun, 27 Nov 2022 22:58:06 -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=Oz8jptwm; 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 S229794AbiK1G4W (ORCPT + 99 others); Mon, 28 Nov 2022 01:56:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229936AbiK1Gzz (ORCPT ); Mon, 28 Nov 2022 01:55:55 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B59371582A for ; Sun, 27 Nov 2022 22:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618530; x=1701154530; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9D0XyFvFSOhAEwulu1xI29MelRcePwGMxUZNH4H/TSo=; b=Oz8jptwmIbbvJV2LEPfVub3KC6DSc9pRXanF7etE2MzGOsrZXhhIvzvM d2D1xxFforpFLbzY6z7RH7i2k2TA1ivaCFmpsQXMQgJMNNL357ZFSUSaM /Dy+oWHILmSk3xTYWX2JvgKxblsO+9/k39OGTlXJ5ashlIiAcBrEn8nw2 Nt9Iy++DZPtef+u1N4mxwioijmvwpdSXeAcJXX321PvZjyKGc+co11XD1 ZBC+vD10VKCkxzJAdcE1xePd/SDFXc99VCu/ReLUymbTF8IEvGgGqrQav 7c11GdRroLgGF3zFwmXYBcy5iEw46WbTv0nEtkPkaWtuqrgWw0be6vL2O A==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="379016263" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="379016263" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121106" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121106" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:22 -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 12/20] iommu/msm: Add set_platform_dma callback Date: Mon, 28 Nov 2022 14:46:40 +0800 Message-Id: <20221128064648.1934720-13-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=-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?1750722083593193782?= X-GMAIL-MSGID: =?utf-8?q?1750722083593193782?= 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/msm_iommu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index c60624910872..3eb1bc668cad 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c @@ -470,6 +470,14 @@ static void msm_iommu_detach_dev(struct iommu_domain *domain, spin_unlock_irqrestore(&msm_iommu_lock, flags); } +static void msm_iommu_set_platform_dma(struct device *dev) +{ + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); + + if (domain) + msm_iommu_detach_dev(domain, dev); +} + static int msm_iommu_map(struct iommu_domain *domain, unsigned long iova, phys_addr_t pa, size_t pgsize, size_t pgcount, int prot, gfp_t gfp, size_t *mapped) @@ -678,6 +686,7 @@ static struct iommu_ops msm_iommu_ops = { .domain_alloc = msm_iommu_domain_alloc, .probe_device = msm_iommu_probe_device, .device_group = generic_device_group, + .set_platform_dma = msm_iommu_set_platform_dma, .pgsize_bitmap = MSM_IOMMU_PGSIZES, .of_xlate = qcom_iommu_of_xlate, .default_domain_ops = &(const struct iommu_domain_ops) {