From patchwork Wed Jan 4 12:57:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 38905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5133346wrt; Wed, 4 Jan 2023 05:08:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXuzoN11yj7dKb96Tn2bgS91kASB/tbOewaanw9y28Xuc3XHeUZ4RGIb6a4YkoOa06f1E5nO X-Received: by 2002:a05:6a20:a682:b0:af:fcb6:2ef6 with SMTP id ba2-20020a056a20a68200b000affcb62ef6mr67141902pzb.23.1672837687952; Wed, 04 Jan 2023 05:08:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672837687; cv=none; d=google.com; s=arc-20160816; b=joTPd2l9WqLn1YSi+cOgSnPa3teHbZCfIpLb1oM7wMHFLnKzVEBGO9VCOzeJEVTBwW WidYL/DiW4v8lHouYXbpg/Pbk/fk5pKZWBHPsgJjQkO7tYN1SgTslaVPs6ijTBOcIVr5 /i5/uUiB0LiXxoNy3tbYtcuRsA+Madna3cIJ/btdrXhoD665d1dZzlS13UiMsC8jks9C XQuOi+px24k4eOB6piej64lIChrF27NRzqnMHidGk4j9mTElOblWTl7h5Fyxdeu1KKAZ Dkt3dRm6Ttj7/B9OgTOWo736al7RrlJVsWAI3im1OteJxOR8Jb0e9n3YVyH0hci18Dpn OZzw== 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=v9S2bLYP0UdoEHacmDarVc/XBB05QvZ1ofSmXEl9HAY=; b=qTQAwa+Itq1G+yZfZ6CEuXatq9ooYeI2iJXuVlKVUjFFqKgr/l+X7Ed5yCZB6wD8R9 m20xIAjbYaRDzBK34OyMqWca5EfnrUFxc6d8rqMEJL79EECUuMk8FZkTAR9AEn3uo/1M tuJMKNK6n2om9WqW1LyxukeXq+ykUzkISG7ieQC8vZVx+wqq5A9wgSJx2KRDDJtMTpiq DQf4ecoW4IyeP+PoDHM3JLsgPfF+teFOOnfwYOJGVCQrJ8Grn058TINh3fOIqHIakLFc JBa7vk/zCZfimA64qMQwqEUvvpGwzZ7565H5NpEU1iiqBhjuJIWJYolGboWA6TQ9Wp+J l2BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QGhIfr59; 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 p24-20020a63e658000000b004787004c8dasi35924293pgj.123.2023.01.04.05.07.54; Wed, 04 Jan 2023 05:08:07 -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=QGhIfr59; 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 S234884AbjADNHJ (ORCPT + 99 others); Wed, 4 Jan 2023 08:07:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239303AbjADNGu (ORCPT ); Wed, 4 Jan 2023 08:06:50 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA7A61E3F7 for ; Wed, 4 Jan 2023 05:06:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672837594; x=1704373594; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W4kgWJ13KkfOnFNvqJ626ui344bVCUNFAhn6AsaS62k=; b=QGhIfr59Z4JHsKb9iSPsKMKvWoStPG80Ok0uApMWd29pRD2lTN93muVt 1QqJJEgC7ZU+eaGKkeLsP5JA/DGZssim5v52MTpHRV9ubS9Rb/BYS9sJ0 hoMdZYkPp8T8KenP4osrmXpKv6C6+kpUHux0bAQ4BtWsRSpxWbyMnpn6V PX+JPzJBhtF79NXFkC/X5w9ngdIV1xkMJOcJtY6r1CwHUIA5hV+vJS6fz To7D6Mlkex2bYXtZdu8AvfG6WhwSicRYlF3mlWMkxTM2yyQqWIBCkUNjI qvUtzcP7UbtWE9cPv6tofJbILUftqn1LSWw31/cydGXEQeJNk4h2+8bJ3 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="320639997" X-IronPort-AV: E=Sophos;i="5.96,299,1665471600"; d="scan'208";a="320639997" 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:06:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="797529117" X-IronPort-AV: E=Sophos;i="5.96,299,1665471600"; d="scan'208";a="797529117" Received: from allen-box.sh.intel.com ([10.239.159.48]) by fmsmga001.fm.intel.com with ESMTP; 04 Jan 2023 05:06:27 -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 11/19] iommu/fsl_pamu: Add set_platform_dma_ops callback Date: Wed, 4 Jan 2023 20:57:17 +0800 Message-Id: <20230104125725.271850-12-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?1754097451347455602?= X-GMAIL-MSGID: =?utf-8?q?1754097451347455602?= 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 the 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/fsl_pamu_domain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index 4408ac3c49b6..e123161c211a 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c @@ -283,9 +283,9 @@ static int fsl_pamu_attach_device(struct iommu_domain *domain, return ret; } -static void fsl_pamu_detach_device(struct iommu_domain *domain, - struct device *dev) +static void fsl_pamu_set_platform_dma(struct device *dev) { + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); struct fsl_dma_domain *dma_domain = to_fsl_dma_domain(domain); const u32 *prop; int len; @@ -452,9 +452,9 @@ static const struct iommu_ops fsl_pamu_ops = { .domain_alloc = fsl_pamu_domain_alloc, .probe_device = fsl_pamu_probe_device, .device_group = fsl_pamu_device_group, + .set_platform_dma_ops = fsl_pamu_set_platform_dma; .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = fsl_pamu_attach_device, - .detach_dev = fsl_pamu_detach_device, .iova_to_phys = fsl_pamu_iova_to_phys, .free = fsl_pamu_domain_free, }