Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3461865pxb; Mon, 24 Jan 2022 10:03:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyAQw8EeOPCD9JyPsCmdXxks1O/9cjFJ8qypcMmsXyrJWGNByHQ2/F+xZR/xhaNiuWU+scU X-Received: by 2002:a17:903:2307:b0:14b:60d5:935a with SMTP id d7-20020a170903230700b0014b60d5935amr2998076plh.149.1643047390352; Mon, 24 Jan 2022 10:03:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643047390; cv=none; d=google.com; s=arc-20160816; b=l+6F5y9o0y1X7uYZtyy8gCBDoCX2ZrgzIUbjpjtco+N31PuBBweV/C51PDi4EOrYZG SfYqnQ7kR6ytqwuAutUf40XkswWEs0wg6SVt66F0+M3slOD/t7JzwMoPoXbFu4JG8Ff6 MDrxRYqREsTb/Y9XA2RzpTNrkKbuiX/lOY7EfKgtWjLbzfcGgE2cM/1L8ZTNiAa1vo5V AnkaIC7ul1cpcLuz0Jioi9Fmz8dr7eKmzXYQadQoL5eGBdedX9qN68cVTdETPU2hSfG8 +29fxE0U03Qw7nR2kJhkjjfTRvBpEfE769/IsY0mg70F911k5V7mqwI4aw5SYtaVhTix VccQ== 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=aUEuOIwRLrsYklMbYKk9YNR/rVGLbq09/LS4xDe/+NE=; b=ylsiCQVKwhtwJaOphpkirnTuXlTwXSe6vxIoSLb5Ns0E2V3mWQc38hg9iP7X6Set10 mDpGOoxVQWDLh/deg86TLeM7l8H76cG72DWvHmvuPyto5DUGBaqt0RuyOjWzFzzyvMUA vHb1WsOq8ka4GLldqpcOlr/zquejkau5BIfPDqk6Rc7zus0p2f97CGRejlO2w5M2yohG Ii/aOK1L6TV1LwcJ0M5IirIQKgrG3KH8GgsVLbHu60/U1vuxdDmtW6P3u5Sd/TC8l/Vn j7yEE0g0yniwaXyO5JLlP+7w5CzpJXOwX2R0mpbx5r3ctLQo94r6u/g4cDZQTt1AfZaV 7cwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="hx1e6vN/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si11169716pgn.333.2022.01.24.10.02.56; Mon, 24 Jan 2022 10:03:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="hx1e6vN/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S241694AbiAXHMp (ORCPT + 99 others); Mon, 24 Jan 2022 02:12:45 -0500 Received: from mga04.intel.com ([192.55.52.120]:53043 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241669AbiAXHMn (ORCPT ); Mon, 24 Jan 2022 02:12:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643008363; x=1674544363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=myozgp5rClIulQWfOzXhlzBn+QmoxWk4myrNFXlAjzg=; b=hx1e6vN/YgIeC0jts/fM8imLCankgKk4Gla2RjMERCal3NMTDdTS7Vb0 sTmifWvD7A3BPh+kkRqyV+9xGcJ+4aoUgGcwVnowv+sdPy3sEnDona1kX bJCK5wFMvfQEfzkSDbSuQdRXGo7TaUsyBgEKLzymr+paxed4uxFFuxu6a EOKzMs3eRlLW4ldQR7Qik0z+Jgf078WZMclqlO+pkdGpe3w4qm5YJk2Ys JpEi/SynofR90oNuTlpAHuJ32dCLS4aVjUg1ELknMU7loC3uwGbBaD+Hx f78hP6RsgI1iQNAiSSac4QOZJ7RLPV7DERjXPjcMIDbdvzmCdEKqpHigL Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10236"; a="244814232" X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="244814232" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jan 2022 23:12:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="627387795" Received: from allen-box.sh.intel.com ([10.239.159.118]) by orsmga004.jf.intel.com with ESMTP; 23 Jan 2022 23:12:38 -0800 From: Lu Baolu To: Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , Ben Skeggs , Kevin Tian , Ashok Raj , Will Deacon , Robin Murphy Cc: Alex Williamson , Eric Auger , Liu Yi L , Jacob jun Pan , David Airlie , Daniel Vetter , Thierry Reding , Jonathan Hunter , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH 4/7] iommu: Remove aux-domain related interfaces and iommu_ops Date: Mon, 24 Jan 2022 15:10:59 +0800 Message-Id: <20220124071103.2097118-5-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220124071103.2097118-1-baolu.lu@linux.intel.com> References: <20220124071103.2097118-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The aux-domain related interfaces and iommu_ops are not referenced anywhere in the tree. We've also reached a consensus to redesign it based the new iommufd framework. Remove them to avoid dead code. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 29 --------------------------- drivers/iommu/iommu.c | 46 ------------------------------------------- 2 files changed, 75 deletions(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index d1e9c3d73966..aa5486243892 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -144,7 +144,6 @@ struct iommu_resv_region { /** * enum iommu_dev_features - Per device IOMMU features - * @IOMMU_DEV_FEAT_AUX: Auxiliary domain feature * @IOMMU_DEV_FEAT_SVA: Shared Virtual Addresses * @IOMMU_DEV_FEAT_IOPF: I/O Page Faults such as PRI or Stall. Generally * enabling %IOMMU_DEV_FEAT_SVA requires @@ -157,7 +156,6 @@ struct iommu_resv_region { * iommu_dev_has_feature(), and enable it using iommu_dev_enable_feature(). */ enum iommu_dev_features { - IOMMU_DEV_FEAT_AUX, IOMMU_DEV_FEAT_SVA, IOMMU_DEV_FEAT_IOPF, }; @@ -223,8 +221,6 @@ struct iommu_iotlb_gather { * @dev_has/enable/disable_feat: per device entries to check/enable/disable * iommu specific features. * @dev_feat_enabled: check enabled feature - * @aux_attach/detach_dev: aux-domain specific attach/detach entries. - * @aux_get_pasid: get the pasid given an aux-domain * @sva_bind: Bind process address space to device * @sva_unbind: Unbind process address space from device * @sva_get_pasid: Get PASID associated to a SVA handle @@ -285,11 +281,6 @@ struct iommu_ops { int (*dev_enable_feat)(struct device *dev, enum iommu_dev_features f); int (*dev_disable_feat)(struct device *dev, enum iommu_dev_features f); - /* Aux-domain specific attach/detach entries */ - int (*aux_attach_dev)(struct iommu_domain *domain, struct device *dev); - void (*aux_detach_dev)(struct iommu_domain *domain, struct device *dev); - int (*aux_get_pasid)(struct iommu_domain *domain, struct device *dev); - struct iommu_sva *(*sva_bind)(struct device *dev, struct mm_struct *mm, void *drvdata); void (*sva_unbind)(struct iommu_sva *handle); @@ -656,9 +647,6 @@ void iommu_release_device(struct device *dev); int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features f); int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features f); bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features f); -int iommu_aux_attach_device(struct iommu_domain *domain, struct device *dev); -void iommu_aux_detach_device(struct iommu_domain *domain, struct device *dev); -int iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev); struct iommu_sva *iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, @@ -1003,23 +991,6 @@ iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat) return -ENODEV; } -static inline int -iommu_aux_attach_device(struct iommu_domain *domain, struct device *dev) -{ - return -ENODEV; -} - -static inline void -iommu_aux_detach_device(struct iommu_domain *domain, struct device *dev) -{ -} - -static inline int -iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev) -{ - return -ENODEV; -} - static inline struct iommu_sva * iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, void *drvdata) { diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 5672beb061ea..5230c6d90ece 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2746,8 +2746,6 @@ EXPORT_SYMBOL_GPL(iommu_dev_enable_feature); /* * The device drivers should do the necessary cleanups before calling this. - * For example, before disabling the aux-domain feature, the device driver - * should detach all aux-domains. Otherwise, this will return -EBUSY. */ int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat) { @@ -2775,50 +2773,6 @@ bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat) } EXPORT_SYMBOL_GPL(iommu_dev_feature_enabled); -/* - * Aux-domain specific attach/detach. - * - * Only works if iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX) returns - * true. Also, as long as domains are attached to a device through this - * interface, any tries to call iommu_attach_device() should fail - * (iommu_detach_device() can't fail, so we fail when trying to re-attach). - * This should make us safe against a device being attached to a guest as a - * whole while there are still pasid users on it (aux and sva). - */ -int iommu_aux_attach_device(struct iommu_domain *domain, struct device *dev) -{ - int ret = -ENODEV; - - if (domain->ops->aux_attach_dev) - ret = domain->ops->aux_attach_dev(domain, dev); - - if (!ret) - trace_attach_device_to_domain(dev); - - return ret; -} -EXPORT_SYMBOL_GPL(iommu_aux_attach_device); - -void iommu_aux_detach_device(struct iommu_domain *domain, struct device *dev) -{ - if (domain->ops->aux_detach_dev) { - domain->ops->aux_detach_dev(domain, dev); - trace_detach_device_from_domain(dev); - } -} -EXPORT_SYMBOL_GPL(iommu_aux_detach_device); - -int iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev) -{ - int ret = -ENODEV; - - if (domain->ops->aux_get_pasid) - ret = domain->ops->aux_get_pasid(domain, dev); - - return ret; -} -EXPORT_SYMBOL_GPL(iommu_aux_get_pasid); - /** * iommu_sva_bind_device() - Bind a process address space to a device * @dev: the device -- 2.25.1