From patchwork Tue Aug 8 15:35:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Liu X-Patchwork-Id: 132798 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2356974vqr; Tue, 8 Aug 2023 12:47:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/LVL5KUS6w2UN9kvCV+aoSrgGH5dQ6+wv9yc+EdVOPtV2Lre8IBWCXSgZrHB1qdjFfJ6i X-Received: by 2002:a17:907:778f:b0:99c:dc3e:f8e3 with SMTP id ky15-20020a170907778f00b0099cdc3ef8e3mr483879ejc.28.1691524023369; Tue, 08 Aug 2023 12:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691524023; cv=none; d=google.com; s=arc-20160816; b=b64go9ncIYwhnPM+pwc6/LMXZCWyBa43152Au3h2UejTtCgWiVOpBvMXfkFwbdFmqC WEpFY25HegDgChmt7RwPy1nSItTXWFnQIYqLNmqiLeiEUV2Nda4Y0Id9ChN6SjQsKRso pOYWjcQ6iv+17HcFYSXzIVnL4/7dqSAO/hu/rlbjbAVz998/wttN48hPm6FHiBbPczxM nZJfScUl3JbjXtBHP1PdTuhsEm1dStjVQjdMz77mAwvPSVGsZMk1fZ3jhEna7uHiHU+T T2dfD4FG1z0lEeEklpBVB+k5z5CJVrpE0slbELMaWnYorz08EQiQy2boo7c7N/pt8Aaq 8gVg== 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=ZPZRLRit0b7Ppsa2uuYpiICSbT1hqSn0YWYKcpQXIJgoQ8LD9XvaqZWrMXqUm/k7OS FEnVc0zpldFfidi5pnUTOuh8HdCDFEESlWfIpXDavZObwyHH+94fazIRSwf0YREi4EQ6 FkAlDJyyd5DaX91+oGNUm2jD1kFSYA9hEt4oXKXDcPw8LouY34HGSElNJ7VgJbR13/JW 6i/K98IdnMsL+eCIeo++dZHxtad9Mc8tQx3oo9bF4pp+RBYQGTicsa4vlIliqIh3//Al 3mcQA0AGkMtWcypGW90l7U/GV3R6bZ6a1lFve6NGtDh1p6M15QlczzonC1W48minAVzV Qzfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B64ETeLk; 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 qq8-20020a17090720c800b00994b9c51cafsi7711561ejb.717.2023.08.08.12.46.39; Tue, 08 Aug 2023 12:47:03 -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=B64ETeLk; 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 S232279AbjHHRD1 (ORCPT + 99 others); Tue, 8 Aug 2023 13:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233810AbjHHRCc (ORCPT ); Tue, 8 Aug 2023 13:02:32 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C977D58FBC; Tue, 8 Aug 2023 09:01:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691510483; x=1723046483; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jyeuaCSwcnEpIvAt6SkFbJoVnSmQjh1HrN7Z4gQT92w=; b=B64ETeLktiBOboRYrdT3iPoe16FCSIwIIfcjm5Y/c9ZKrlq6ebp6+n07 7zd2sDRCh4ob+Lcg2EZIh4z6JZAKfVBBvve1/piul1foBdYGLeEEbG4ED 8P5N1JJmVAMsMdTmYU4Yu7As7qLhtQLnQKLxuOmpBPLJERhcBHti5ldQC 0lROINNy1IuaU7Ez3qHq0ANL8Ij/OAvk3lpPGwGwvou1KSI7DMhhDGVWS jnh2wLN19ZJ+My83DQvxHKj304nn/1wP/ML8pDgYMy8WWiJ2yUvVd+SqN fiP0xM+V7wUwPjcUlDIn4VCteSKrae40TXJBCw2oMy1SIP0iLmRKaVopO A==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="350449287" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="350449287" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2023 08:35:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="855126969" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="855126969" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by orsmga004.jf.intel.com with ESMTP; 08 Aug 2023 08:35:12 -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 v6 1/4] iommu: Move dev_iommu_ops() to private header Date: Tue, 8 Aug 2023 08:35:07 -0700 Message-Id: <20230808153510.4170-2-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808153510.4170-1-yi.l.liu@intel.com> References: <20230808153510.4170-1-yi.l.liu@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED 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: 1773691494777626870 X-GMAIL-MSGID: 1773691494777626870 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);