From patchwork Thu Aug 3 14:31:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Liu X-Patchwork-Id: 130679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1214400vqx; Thu, 3 Aug 2023 08:10:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlHn8ltvGhqFd3hYrFTd3VOgunTwW5q3Qh22x6jcJ0G5lumYufBUd55eETipQ3wxTd9P8wCp X-Received: by 2002:a17:90b:1102:b0:263:ebab:a152 with SMTP id gi2-20020a17090b110200b00263ebaba152mr15903961pjb.19.1691075425593; Thu, 03 Aug 2023 08:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691075425; cv=none; d=google.com; s=arc-20160816; b=lguHuVZ4Rhgm9vlJjV5JSMA8i07X7xEfwqkhbQ3jq7AHP0RIqolgHG8xp9BX+VZq3/ NbPKvSVH4zKWKgAUa3wB3k7TGafERTc59KmDNjQE0RRoxx9eT/C0UQijVQQU2ci9/roY uW4rvlSiOyhOvAGeV2anhVV0VyvPqRdkHGRKQtGpEN7OeYw/Mn/n8+yhEYVq9251cX7/ fKBWkwOSapHM8QAnFjyl+ynvr5nM1fqETh0E1hY/DtCEPFY3feMbJ5rMvF9fqY73+eO+ QkdPQ4H8dk9aqIIVRaMCvSFIawKsdKwYYLU9EBjXOmSAulK4j0TE5025n5EIWbReN+gT 6WIQ== 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=qYKFcoX/32SqnlHj3mVzs0qaHMvQZg3RhZZ/J0UOMHY=; fh=25kVo4cotgMzE250R6E3K5ES7E7C2JawiavlW0h5mKU=; b=PbLcvkb/O7DAxHyaEWyUwQ7HZLri84e9uK733xw1uIohO15MBJBpawMei4ZtzYDIxZ 9Ydqqq8Lcr+vZtxA4RDI2g2LtEtzkIOH1SHEGablwu6BML0dWPHSnYyOCRopxq01aKBS mdXC2Kqst9gBCei6MHWWxHD5aYfBvSeVWD0sci8mlVcFNhr84okMy1hYQHy/osAuZL6F 8wU3uPgGmfE2kl72l5z/sBdrZPlT9U59KODNUoLO8yU0HZJIQX8XyOrMuU64fe98ILqH idHloApElYiVw5IThD8vKQm2mxwTxgakQa/CS+AcBgPVvm3QeoVGEoo68v73KNN6o3Yo Pm6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aMKcPWGj; 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 e14-20020a63e00e000000b00563fe7f89e9si6308pgh.186.2023.08.03.08.10.10; Thu, 03 Aug 2023 08:10:25 -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=aMKcPWGj; 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 S234849AbjHCOiU (ORCPT + 99 others); Thu, 3 Aug 2023 10:38:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236350AbjHCOhm (ORCPT ); Thu, 3 Aug 2023 10:37:42 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3A60422B; Thu, 3 Aug 2023 07:36:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691073407; x=1722609407; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jyeuaCSwcnEpIvAt6SkFbJoVnSmQjh1HrN7Z4gQT92w=; b=aMKcPWGjKxT80zN9HckQlGpMgH5PJ7QF551Hu+bDbtevA9fHaAjzGGkH +U+7IkPITI06oxeelynJ5FUVadnmqdb74N2ffyVYLN/ljU56mBh1dP88N CyD4I9QKXDDeaRO71vlGvJ0Rx/XknyLOWgcdgl7q+FapdyDJB08Krhl3u NXOtm/84gNW91Gib/FnxsrqiBPUHH9XoOfiHnejvE/EWvxdf0NSnSHBm7 Crub1yoHhq8g7akCFaYJGxwt0/zfPcchV2SvlK++jXO1MLPsUtz2SqiWe Flyj+aZ2WUCHApeaABhRH86wegrVhYazOX4q7Y2XIDBHij2Mt/7PDMOcP Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10791"; a="372643355" X-IronPort-AV: E=Sophos;i="6.01,252,1684825200"; d="scan'208";a="372643355" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2023 07:31:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10791"; a="759153162" X-IronPort-AV: E=Sophos;i="6.01,252,1684825200"; d="scan'208";a="759153162" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by orsmga008.jf.intel.com with ESMTP; 03 Aug 2023 07:31:46 -0700 From: Yi Liu To: joro@8bytes.org, alex.williamson@redhat.com, jgg@nvidia.com, kevin.tian@intel.com, robin.murphy@arm.com, baolu.lu@linux.intel.com Cc: cohuck@redhat.com, eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org, mjrosato@linux.ibm.com, chao.p.peng@linux.intel.com, yi.l.liu@intel.com, yi.y.sun@linux.intel.com, peterx@redhat.com, jasowang@redhat.com, shameerali.kolothum.thodi@huawei.com, lulu@redhat.com, suravee.suthikulpanit@amd.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, zhenzhong.duan@intel.com Subject: [PATCH v5 1/4] iommu: Move dev_iommu_ops() to private header Date: Thu, 3 Aug 2023 07:31:41 -0700 Message-Id: <20230803143144.200945-2-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230803143144.200945-1-yi.l.liu@intel.com> References: <20230803143144.200945-1-yi.l.liu@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773221105669951738 X-GMAIL-MSGID: 1773221105669951738 dev_iommu_ops() is essentially only used in iommu subsystem, so move to a private header to avoid being abused by other drivers. Suggested-by: Jason Gunthorpe Reviewed-by: Kevin Tian Reviewed-by: Lu Baolu Reviewed-by: Jason Gunthorpe Signed-off-by: Yi Liu --- drivers/iommu/iommu-priv.h | 11 +++++++++++ include/linux/iommu.h | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/iommu-priv.h b/drivers/iommu/iommu-priv.h index 7c8011bfd153..a6e694f59f64 100644 --- a/drivers/iommu/iommu-priv.h +++ b/drivers/iommu/iommu-priv.h @@ -4,6 +4,17 @@ #include +static inline const struct iommu_ops *dev_iommu_ops(struct device *dev) +{ + /* + * Assume that valid ops must be installed if iommu_probe_device() + * has succeeded. The device ops are essentially for internal use + * within the IOMMU subsystem itself, so we should be able to trust + * ourselves not to misuse the helper. + */ + return dev->iommu->iommu_dev->ops; +} + int iommu_group_replace_domain(struct iommu_group *group, struct iommu_domain *new_domain); diff --git a/include/linux/iommu.h b/include/linux/iommu.h index d31642596675..e0245aa82b75 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -450,17 +450,6 @@ static inline void iommu_iotlb_gather_init(struct iommu_iotlb_gather *gather) }; } -static inline const struct iommu_ops *dev_iommu_ops(struct device *dev) -{ - /* - * Assume that valid ops must be installed if iommu_probe_device() - * has succeeded. The device ops are essentially for internal use - * within the IOMMU subsystem itself, so we should be able to trust - * ourselves not to misuse the helper. - */ - return dev->iommu->iommu_dev->ops; -} - extern int bus_iommu_probe(const struct bus_type *bus); extern bool iommu_present(const struct bus_type *bus); extern bool device_iommu_capable(struct device *dev, enum iommu_cap cap);