Received: by 10.192.165.156 with SMTP id m28csp1133136imm; Mon, 16 Apr 2018 14:49:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/u4CScS/e7d8Ta+U0/CdN93Q3WfxvkL4Bq/RL65AXpuic24Ys1hNryGrvgtjtr67ILKkVO X-Received: by 10.98.196.11 with SMTP id y11mr6980369pff.117.1523915388583; Mon, 16 Apr 2018 14:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523915388; cv=none; d=google.com; s=arc-20160816; b=pi+c8CIj30/Zqn0SaIGNsf4vHnxlnc4EPDZdiASDuidUBbk7CiRIqNy6DoOz3u0EmB b2ZnKAkrAYeS+WwU/D5qBrFVUbrKyzzfeQPiYQBPHt3Ef4/WloICND70FqdKZJX8Z9nC PDasIfdBk2vn5/bHqKKXLS7CsnyIEvmUiRS/rqN4A+ZmK61PVmG5oZhof8bAl9kYz4nl p2NXlRg9/tIxZ4sXbGw008GwFWiOAn5S0aSR4Q67jKLbup35xC0b4T4OQWgK6E247rjR qUVDPWdNQgaTYllj0lobnLu6Nd6WmcivM5jYDZoXnDs6mSGOLDZSLidQSHTiQAJypAfq lfNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=pUMg7dkK+Ip/6yGTfmcAj52Jb1gH/zKClS+cbz7vDeE=; b=I6eGEumweBR7I/J9AG/kEcYZFiAWrpaH41AWy5/yOWEFzTWD2CHr64unCgz4RLS5z7 mGFAGRy+veDSGS/D4qcymq+rRfRxMANRDOdHlmFHRBB2QcWVdaB3+V9iAdkFjgGQiZFk Do+g8DdXiW5HR9GHo+vYDOFDe03Qkk8+jGyVdMZM6yn9GCFh8PnL4RmUTT0zkop9Pe/I 3dXUZI/iPERuKCDj/+Q+RZxhduxF9VYBE9LAueMqxz60vqlX6cvXa+91d2dyH2nBnhYi YtEELPCfc2feFgRMnvz7t7rXBdV+mvQ5lbpcumDb5RQDp+tcfmK1lGxmM/kfVLmNRVJA mlCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12-v6si13297334plr.379.2018.04.16.14.49.34; Mon, 16 Apr 2018 14:49:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753269AbeDPVro (ORCPT + 99 others); Mon, 16 Apr 2018 17:47:44 -0400 Received: from mga09.intel.com ([134.134.136.24]:12292 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753012AbeDPVqu (ORCPT ); Mon, 16 Apr 2018 17:46:50 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Apr 2018 14:46:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,460,1517904000"; d="scan'208";a="34740191" Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by orsmga006.jf.intel.com with ESMTP; 16 Apr 2018 14:46:43 -0700 From: Jacob Pan To: iommu@lists.linux-foundation.org, LKML , Joerg Roedel , David Woodhouse , Greg Kroah-Hartman , Alex Williamson , Jean-Philippe Brucker Cc: Rafael Wysocki , "Liu, Yi L" , "Tian, Kevin" , Raj Ashok , Jean Delvare , "Christoph Hellwig" , "Lu Baolu" , Jacob Pan Subject: [PATCH v4 18/22] iommu/intel-svm: replace dev ops with fault report API Date: Mon, 16 Apr 2018 14:49:07 -0700 Message-Id: <1523915351-54415-19-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523915351-54415-1-git-send-email-jacob.jun.pan@linux.intel.com> References: <1523915351-54415-1-git-send-email-jacob.jun.pan@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the introduction of generic IOMMU device fault reporting API, we can replace the private fault callback functions with standard function and event data. Signed-off-by: Jacob Pan --- drivers/iommu/intel-svm.c | 7 +------ include/linux/intel-svm.h | 20 +++----------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index a8186f8..bdda1b6 100644 --- a/drivers/iommu/intel-svm.c +++ b/drivers/iommu/intel-svm.c @@ -299,7 +299,7 @@ static const struct mmu_notifier_ops intel_mmuops = { static DEFINE_MUTEX(pasid_mutex); -int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ops *ops) +int intel_svm_bind_mm(struct device *dev, int *pasid, int flags) { struct intel_iommu *iommu = intel_svm_device_to_iommu(dev); struct intel_svm_dev *sdev; @@ -346,10 +346,6 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ list_for_each_entry(sdev, &svm->devs, list) { if (dev == sdev->dev) { - if (sdev->ops != ops) { - ret = -EBUSY; - goto out; - } sdev->users++; goto success; } @@ -375,7 +371,6 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ } /* Finish the setup now we know we're keeping it */ sdev->users = 1; - sdev->ops = ops; init_rcu_head(&sdev->rcu); if (!svm) { diff --git a/include/linux/intel-svm.h b/include/linux/intel-svm.h index 99bc5b3..a39a502 100644 --- a/include/linux/intel-svm.h +++ b/include/linux/intel-svm.h @@ -18,18 +18,6 @@ struct device; -struct svm_dev_ops { - void (*fault_cb)(struct device *dev, int pasid, u64 address, - u32 private, int rwxp, int response); -}; - -/* Values for rxwp in fault_cb callback */ -#define SVM_REQ_READ (1<<3) -#define SVM_REQ_WRITE (1<<2) -#define SVM_REQ_EXEC (1<<1) -#define SVM_REQ_PRIV (1<<0) - - /* * The SVM_FLAG_PRIVATE_PASID flag requests a PASID which is *not* the "main" * PASID for the current process. Even if a PASID already exists, a new one @@ -60,7 +48,6 @@ struct svm_dev_ops { * @dev: Device to be granted acccess * @pasid: Address for allocated PASID * @flags: Flags. Later for requesting supervisor mode, etc. - * @ops: Callbacks to device driver * * This function attempts to enable PASID support for the given device. * If the @pasid argument is non-%NULL, a PASID is allocated for access @@ -82,8 +69,7 @@ struct svm_dev_ops { * Multiple calls from the same process may result in the same PASID * being re-used. A reference count is kept. */ -extern int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, - struct svm_dev_ops *ops); +extern int intel_svm_bind_mm(struct device *dev, int *pasid, int flags); /** * intel_svm_unbind_mm() - Unbind a specified PASID @@ -120,7 +106,7 @@ extern int intel_svm_is_pasid_valid(struct device *dev, int pasid); #else /* CONFIG_INTEL_IOMMU_SVM */ static inline int intel_svm_bind_mm(struct device *dev, int *pasid, - int flags, struct svm_dev_ops *ops) + int flags) { return -ENOSYS; } @@ -136,6 +122,6 @@ static int intel_svm_is_pasid_valid(struct device *dev, int pasid) } #endif /* CONFIG_INTEL_IOMMU_SVM */ -#define intel_svm_available(dev) (!intel_svm_bind_mm((dev), NULL, 0, NULL)) +#define intel_svm_available(dev) (!intel_svm_bind_mm((dev), NULL, 0)) #endif /* __INTEL_SVM_H__ */ -- 2.7.4