From patchwork Fri Feb 17 09:47:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 58460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp799886wrn; Fri, 17 Feb 2023 02:02:18 -0800 (PST) X-Google-Smtp-Source: AK7set8gwgFZemh7SLoyGlw+RCVjGyo16Maz5YTXKLd+WK2L5EnOxBHzZ8Nph/al8ubpJhdGYNsd X-Received: by 2002:a17:906:4750:b0:885:8f79:d6d7 with SMTP id j16-20020a170906475000b008858f79d6d7mr7991535ejs.61.1676628137823; Fri, 17 Feb 2023 02:02:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676628137; cv=none; d=google.com; s=arc-20160816; b=OSVw9PSWJxg/oBfddjB+OTsEYl7hOI92lFWVRlH6el0JIoGQGPJtPK5Xe1KaTZ5aI6 00cCYY7wqN7yhOnEaJ574GSXyo+ajWL1stZ+pA509mUkswp5GLbLYiFwEA5Vt67aEtcT 5Ot3KB5J4nTouDIcVQpk80hq6vb9nLDIf7lDdGB4KfDEzCqgdPnVY0UI3NyQDNuuTuVc 9fVuS8GeJbPaqYqhdgC7RQ2KWXzB7DxdXa0TpYOr6m1TsrkTOPWpSxvkFE1FBs2ifP8F st9h1KnE42s7FFZnodye0FPh2oqArnJqMaYEme6KEGxnCKFH2+kQFfqBeFwq6c2SFhOi PSHQ== 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=VzokOA6lRbeXG40a/NI2nzs8kNEKaJ2IbcsS0G1iuX8=; b=DUB5N5O5S1+s4yCakcJpGHlaubC162J+Decxw36WD+BIw0TG0b+AljvK5VustID1/r l/GVEnMUjo180leCBUC/ObukI9lqdbgO0jLah4FtpDuOrCBNbKzhcwG7AuiqZ8/FOxK8 K8bClB6dVc6VWapPuIb8D5S48pIV24GcYhjLxGyVnuhahTswnzY0MJshlvFLQtz0NHLo Z6nB4v3lhh5CUL1FPDchQsk39HyX8q/te/9DuTbrFcOPgazXoj6kLSwWXLsgOQOVesiC XoG46yNb9E7DejT8Zaos+gNzuE8H5EBUAUlgnwayWdHp5qeYuNTO7/QO167gN6tgLLXh i1NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GsHYdIRb; 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 a22-20020aa7d756000000b004acbd499461si5109016eds.178.2023.02.17.02.01.54; Fri, 17 Feb 2023 02:02:17 -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=GsHYdIRb; 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 S230200AbjBQJ4S (ORCPT + 99 others); Fri, 17 Feb 2023 04:56:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbjBQJ4N (ORCPT ); Fri, 17 Feb 2023 04:56:13 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 371425F82B for ; Fri, 17 Feb 2023 01:56:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676627773; x=1708163773; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=soshgH1no5hycuBrP/dpzD8rbmx7eoXwNiXBGFJYNPk=; b=GsHYdIRbjYiVUumDzC3kI9t05iLXB+kWd30OPADqvqsc8LtppruAKYMW EvRVICFvW9mBmks6tKTCOSM25oqoVQHqor4JJL084gH4POm0wBRT4zknD FFuT0lJGttVKu4Md3WDbvs8OppX/77gz5PU5ANBh558yAfcuzXnyzA6ip mWqMatvOdxBKKyLWVMyZf/b2Nzg3JHlSexNSCWH/v1ClaqKKhT+bmRt9V Q35OI30KLBhNSecpZFmTGa9q4v6BYx2u1/WC94djAtLnBwXeeDDXSCHJ/ 5oeWHMI+Lo9MI3sjVt65xw+tmngOGND6CjUa267hOiuexPqe7z1jthGAi A==; X-IronPort-AV: E=McAfee;i="6500,9779,10623"; a="331955179" X-IronPort-AV: E=Sophos;i="5.97,304,1669104000"; d="scan'208";a="331955179" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2023 01:56:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10623"; a="999391208" X-IronPort-AV: E=Sophos;i="5.97,304,1669104000"; d="scan'208";a="999391208" Received: from allen-box.sh.intel.com ([10.239.159.48]) by fmsmga005.fm.intel.com with ESMTP; 17 Feb 2023 01:56:08 -0800 From: Lu Baolu To: iommu@lists.linux.dev Cc: Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , Kevin Tian , Will Deacon , Robin Murphy , linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v2 1/6] ARM/dma-mapping: Remove iommu_detach_device() Date: Fri, 17 Feb 2023 17:47:31 +0800 Message-Id: <20230217094736.159005-2-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230217094736.159005-1-baolu.lu@linux.intel.com> References: <20230217094736.159005-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?1758072026158125534?= X-GMAIL-MSGID: =?utf-8?q?1758072026158125534?= iommu_detach_device() attaches the default domain to the device, or if default domain is not supported by the IOMMU driver, it calls its set_platform_dma_ops callback. If the default domain is supported or the IOMMU driver is not iommu-dma aware, iommu_detach_device() is actually a noop. The 64-bit ARM drivers always support default domain and iommu-dma is even not enabled for 32-bit ARM. This turns out that iommu_detach_device() is always a noop in arm_iommu_detach_device(). Remove it to avoid dead code. The bonus is that it also removes a obstacle of arm_iommu_detach_device() re-entering the iommu core during release_device. With this removed, the iommu core code could be simplified a lot. Signed-off-by: Lu Baolu --- arch/arm/mm/dma-mapping.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 8bc01071474a..dcbc2f4586d4 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1699,7 +1699,6 @@ void arm_iommu_detach_device(struct device *dev) return; } - iommu_detach_device(mapping->domain, dev); kref_put(&mapping->kref, release_iommu_mapping); to_dma_iommu_mapping(dev) = NULL; set_dma_ops(dev, NULL);