Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp322611rwe; Fri, 26 Aug 2022 05:50:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR6H8mxf24b7FppOyw8f5gnob03xJ4eJvilpqlaVVH5ClHh6IKzUNVgllTB42/keC+TRCGNl X-Received: by 2002:a17:907:2e01:b0:730:a098:7257 with SMTP id ig1-20020a1709072e0100b00730a0987257mr5516978ejc.705.1661518246313; Fri, 26 Aug 2022 05:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661518246; cv=none; d=google.com; s=arc-20160816; b=sMOD0iuIgZi7FwV1fuo2JyC8aXrV5pZICZUjj0c9AFx7NwBZQbzZ0TAteMhkernLIn 68QSC4oClLJN8H7CKy+zHKN/arvUWukk2lxp6jcPT+1alEW1q6gz88oICil+fhcZPcp7 9CGg3FlBTIaPYUuaIwqHKPeBiVJq4DC24WYeZUIb6G+1qHCqD6x32w/SZwng5u/Oz/eq Ocy55pZSrbiBjrtn7mSFTAWQTQkLP9sRO52+xWi/GLyLCTL7wMOmhQtVG3j2lbBkIsPK Xqc7WEGypPftS6XFCuZ9vEPHCJB8WfiQfa8xQpLZalULZuTRfrQJE4gEl+xNjbxA+ukI Ar3g== 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=eksYjHZEi/OcOnSVt0n/ijI9hjlCDEYKsci+wUTBtaM=; b=j/8E8wFt3MaQHpVDtRf+jdpICZJ0aCih5KwPJD9JODXSLohOCnm4yOle7AkDDjc6Qo o02JKfVKZxSQn0/Hl2H8XND9ruILGVMfJA2PAwDGfHESl/aLMUon9u/uXgUBIIYAROx/ 8glLlljY//dMez42CFgHtd9T6HKTFRNtlReml9UNowzPrazzBWGK9W7FeUCsDlIAmIiv fDtvFxZHk8cFZR3zf2xeiLQUb6CtaDX1Nf8Lfaltn7oerUpYnuiZEWSXkUHVFx8QTWov ckSf5Dmbrh07G7cN8MsQg7kR9zLZwb6kdRQBYczoSs5ghHfsEH2qWzupox+FDCh0gfUY egWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a5EG4pNN; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ka12-20020a170907990c00b0073cd4bc7214si1032223ejc.340.2022.08.26.05.50.19; Fri, 26 Aug 2022 05:50:46 -0700 (PDT) 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=a5EG4pNN; 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 S1344059AbiHZMSZ (ORCPT + 99 others); Fri, 26 Aug 2022 08:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343951AbiHZMSB (ORCPT ); Fri, 26 Aug 2022 08:18:01 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9AC9DDB50; Fri, 26 Aug 2022 05:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661516279; x=1693052279; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p46IW5hB0frkoIsI5N8rinjwV0JyL0jp2/821fQMZm0=; b=a5EG4pNNsWbLCiuLNl6xBrHyZ/0TS8xZWOMjsWsi2XFoYe7HZoMgZq99 hsyiHGNn2y5GEGtf+tcuwsZBjc9ypcP1/ANJjZ4l0Q0otzfiqiQDd4Qyw WG86IYtFWiY1sqLPK09jx+NEEA2bbAhZEDArMI/zzS8RSu2KHgMereYZX YzO54FJ/hT6OpWZ/icpdOaj62ldlrjRe3ktQwYOXZ1/PttcIJIbAqyD+L jDgb4HgWDa9yEQgtHUilz5cmG6lcQQaqFhoLK11jV0Uwd5377x26JchT0 ot2b7cHaoAm80GiyaAZHyliuTKC6+6Sbb69BooJBXsYMkMzBzALHJDc2X w==; X-IronPort-AV: E=McAfee;i="6500,9779,10450"; a="292072151" X-IronPort-AV: E=Sophos;i="5.93,265,1654585200"; d="scan'208";a="292072151" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Aug 2022 05:17:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,265,1654585200"; d="scan'208";a="606747682" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga007.jf.intel.com with ESMTP; 26 Aug 2022 05:17:54 -0700 From: Lu Baolu To: Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , Bjorn Helgaas , Kevin Tian , Ashok Raj , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Dave Jiang , Fenghua Yu , Vinod Koul Cc: Eric Auger , Liu Yi L , Jacob jun Pan , Zhangfei Gao , Zhu Tony , iommu@lists.linux.dev, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v12 08/17] iommu: Make free of iommu_domain_ops optional Date: Fri, 26 Aug 2022 20:11:32 +0800 Message-Id: <20220826121141.50743-9-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220826121141.50743-1-baolu.lu@linux.intel.com> References: <20220826121141.50743-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,T_SCC_BODY_TEXT_LINE 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 So that the drivers are able to implement static singleton instance for some special domains. The blocking domain is an example. The driver has no need to allocate different memory for each blocking domain allocation request. Hence, no need for a free callback. Signed-off-by: Lu Baolu Tested-by: Zhangfei Gao Tested-by: Tony Zhu --- drivers/iommu/iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index e985f4d5895f..630e1b64ed89 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1972,7 +1972,8 @@ void iommu_domain_free(struct iommu_domain *domain) if (domain->type == IOMMU_DOMAIN_SVA) mmdrop(domain->mm); iommu_put_dma_cookie(domain); - domain->ops->free(domain); + if (domain->ops->free) + domain->ops->free(domain); } EXPORT_SYMBOL_GPL(iommu_domain_free); -- 2.25.1