From patchwork Mon Jul 24 10:59:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Liu X-Patchwork-Id: 124799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp1720439vqg; Mon, 24 Jul 2023 04:07:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlFV3COVHB7r8fvqT7VWlI2l86zkaAdiq/ifsRnCoVCrubtEQFwYl2lo42TivGfsMoDRq+cx X-Received: by 2002:a05:6512:15a8:b0:4fd:faf0:6591 with SMTP id bp40-20020a05651215a800b004fdfaf06591mr1076575lfb.10.1690196820500; Mon, 24 Jul 2023 04:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690196820; cv=none; d=google.com; s=arc-20160816; b=PqCh/ieqWx2/5hX/vIvsu1b1IbYBTtcen+Xm+3I8l/BKM7PvCSJBCPfYMVF/nsTwYa 2STfF7r0KHViKWxdvtZ5dmDj9Q2LPswQH3Lm6uFGS43M8a0KaW/nQnc7U+8KIlUyva37 XW40627R9qEzJjR9GNkZ+l4rNF7s9Ff7gGMVsNxyQtvKdtAaASy+NIOYm5hsxbl6/5T/ vq6gm8XNXzfMu7EirVAUySZvXZLBUh2U6wGFEZjP2nkFKGoGR6PcUAwbtjJHUQsiX10k qLNxU1NFINSKDZmdaL+5DvYWv3hasB6qnx4qIBy1JZ5Eh8hv5c1Exvmlemn43HVES73u KuuQ== 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=CDsuqG2ZhAB0lHkv68+rCVRRKEJhl8sTyIkOySnUbK0=; fh=25kVo4cotgMzE250R6E3K5ES7E7C2JawiavlW0h5mKU=; b=xo/tIAZmAkrw1Link0fYYf6cTa3Asuw3/j3Cr6FUDuX1DOcxBGH3Vi+PYLAV7P2Kpj +qKmVQJ4f4nIP8//7x36vaVx0IgWr4HwuLCjZJC8WKxriSHpd9+uWiDx/G2VnXf4DUUB SOYefbSZEzuyHczX4ctxXZgULq7Xz5BtNxjZ0OK7bVzXpqBCKMA6srppdePhkAKI5d88 SDnUiWcBPsL/twJ9oYuBJIW67cefgCfMXRLdeLmHVVGsv4B5/gzPfxvB58KBQsYrvEVE n85rpOl+EFwbk6h7EruUxE08dnC/fLjfO48tZtYSPtofkU72nSykwoljNXraoIHMJW9T hd3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Haq5k38q; 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 bt16-20020a170906b15000b00988796c2019si6504758ejb.591.2023.07.24.04.06.16; Mon, 24 Jul 2023 04:07:00 -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=Haq5k38q; 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 S233290AbjGXK7u (ORCPT + 99 others); Mon, 24 Jul 2023 06:59:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233272AbjGXK7n (ORCPT ); Mon, 24 Jul 2023 06:59:43 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C59187; Mon, 24 Jul 2023 03:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690196380; x=1721732380; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FmV1cSHGwjqcdyH4/YjGjjiaeF0uPb8tHeku/Oi1wN8=; b=Haq5k38qn5wR+CG4ZYNmKnQQdmnlS+ME81yhJlHjB+MW0N4+mskilhuD 7Y8hj0lSVKvROfCg1KDTcrb/yJIICfeumF3fhFrYsz+RpoXwE40a1bZpN Dbd1dEAQTi1I5xx7WKFxNetWy7GwMoEpumhvxjbUrikSPea7xyIDmL/cY qlp/XxkCJERPzjc8S7unuAit7TLVT0BeAFXGIYsq35oLJvqfWpv6NymaX HX5dWJmFb9g0pX4ekUCz/yOBbmhnKcxSls77tcnoA+g5Vvd6hiRYZo8dA 0bAyfhU2hw/nOwMQuFttLSTK5HfKU5qSkkaOvVPzkbiMVO2dNWmBhyQDx w==; X-IronPort-AV: E=McAfee;i="6600,9927,10780"; a="347012214" X-IronPort-AV: E=Sophos;i="6.01,228,1684825200"; d="scan'208";a="347012214" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2023 03:59:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10780"; a="839409012" X-IronPort-AV: E=Sophos;i="6.01,228,1684825200"; d="scan'208";a="839409012" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by fmsmga002.fm.intel.com with ESMTP; 24 Jul 2023 03:59:38 -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 v4 1/4] iommu: Move dev_iommu_ops() to private header Date: Mon, 24 Jul 2023 03:59:33 -0700 Message-Id: <20230724105936.107042-2-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230724105936.107042-1-yi.l.liu@intel.com> References: <20230724105936.107042-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, SPF_HELO_PASS,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: 1772299821154630452 X-GMAIL-MSGID: 1772299821154630452 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 Signed-off-by: Yi Liu Reviewed-by: Jason Gunthorpe --- 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);