From patchwork Fri Aug 11 07:14:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Liu X-Patchwork-Id: 134363 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp933167vqi; Fri, 11 Aug 2023 01:17:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUiTC+ffR2s/YN5HJTi0xd+Md5CULNcXwdcfCsHyJ6UBpalRH3vLfQA5LBXOTDW2kLh9GN X-Received: by 2002:a17:906:3f48:b0:99d:6eea:8e34 with SMTP id f8-20020a1709063f4800b0099d6eea8e34mr1018829ejj.75.1691741830520; Fri, 11 Aug 2023 01:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691741830; cv=none; d=google.com; s=arc-20160816; b=ra0swq/K/DD1VSx84HdPcdafnEl42byP6td7Nr2U88icoxejVbYuBNrKQMguegWmOQ TLocfvuhzNp2OdM6ZwmnPRYO7WMbT2bIIy4okTE7PGKq6z6KXFNVs+/ndz9FhEKObNsS rDXFLQOl66IG2XLh7LeDaMAMyLR8oTaM9r04Rem34YtG2CMItVPwDL2RKctXXKP3YZeJ AIchZVWyuZFW56uGhCnvUSX6qfODLI5n2DuNt7CCOPqoH17vfjVNNMQ+YCDJnulFkSu9 LHQXBE4ObYscqEqWzXnc3qsA0snKtSA55SD3DvyW17u5N2pvyFh6R9YzuXjLkY+t5hY7 D/nw== 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=yU0KgAJKjqH59ZUhUJ3ppTamQLVeRZP/c8XwYoIlnqiOd9lgvrd8Qx85yC0kbQw1PV bL9oxS2Oa25Vr8ivDXB9TLWx2dSaJSn5Y25frDR5pw+u2A3SxJ3AKhtqxmrMTlc6aLNi VH24lZmtJZqfnLiSFQLgrS0t5s9uoyBIftI95ZbQaWjAZboj+b75fdMFdbwPiIXU5SGa sTW6K5Tj9u5DjM2kbtGvrL2oB+cUArnWJlnLk34bFQmIBGaQC5ZtLDMiHK95sm1YLHWE eDpRKAKBFqKC71DjVfQwph9z41ybZxhPsDJfiK2H0cYtMYy8ajXs12nEVb101hn7dlv8 i8Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S0yfxAE+; 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 y20-20020a1709064b1400b00991ece4c959si3024031eju.532.2023.08.11.01.16.37; Fri, 11 Aug 2023 01:17:10 -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=S0yfxAE+; 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 S233580AbjHKHPM (ORCPT + 99 others); Fri, 11 Aug 2023 03:15:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233418AbjHKHPH (ORCPT ); Fri, 11 Aug 2023 03:15:07 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30F31271B; Fri, 11 Aug 2023 00:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691738107; x=1723274107; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jyeuaCSwcnEpIvAt6SkFbJoVnSmQjh1HrN7Z4gQT92w=; b=S0yfxAE+mmtb4WARnpjgczDTEfkshOo+I3gyHKLq/Gsk5IKYv7EJrmxD 42v/Ax2MjY8uFJiK0mGCGM3eyRh1ne5n8ytvg6B5VN/+fxCDiDMn0CD6L NhwM/XyepEKJ1CnhEkVWMWOXmZi/szVn92uQtvrGtPlCgIeEqky9HzmpW Ey2Av4COYfT2OMto/lFuMs/O9PI4e95FKVIanD9Z3tB01wbBBJ9EIz1jQ 8gF0abBQkafm3UdKSZNV8Ha7SVBkHB82iD1ovm6S+vWOY1zsgCwxzJbWm 7yWFHQzWsNNWTIh3JxKKdq0xNCBef3cA3VOiELncUlI5NtXEdb52K7khQ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="351937632" X-IronPort-AV: E=Sophos;i="6.01,164,1684825200"; d="scan'208";a="351937632" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2023 00:15:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="979142000" X-IronPort-AV: E=Sophos;i="6.01,164,1684825200"; d="scan'208";a="979142000" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by fmsmga006.fm.intel.com with ESMTP; 11 Aug 2023 00:15:03 -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 v7 1/4] iommu: Move dev_iommu_ops() to private header Date: Fri, 11 Aug 2023 00:14:58 -0700 Message-Id: <20230811071501.4126-2-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230811071501.4126-1-yi.l.liu@intel.com> References: <20230811071501.4126-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: 1773919881582960382 X-GMAIL-MSGID: 1773919881582960382 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);