Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp4213651pxp; Tue, 15 Mar 2022 15:27:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyumjxILbI4+sDzusDs6THqOKrypveeaRdwO/wvAxrPgcl5pF9GWjioQsXVq726UQ4CapGe X-Received: by 2002:a17:906:7d83:b0:6ce:fee:9256 with SMTP id v3-20020a1709067d8300b006ce0fee9256mr25361925ejo.647.1647383257020; Tue, 15 Mar 2022 15:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647383257; cv=none; d=google.com; s=arc-20160816; b=PI+ZZ4y9cec+86lTMmx1b47O6HqrBOWj5IT/ISZ7dAJ6JuhymmxUU0fYUnhcoDaWME 66C2CZ9ev+F1CIdLEqFc4UHkaulNPGONr2ftPAYK3sxJptNyrsYhfhv/Y9Nn+ETSQe2E bwi8PYUOQEtyclkTEpuW5yAYJkVG4OPORoC5n5WAZRvgjWhbiRQBuganjuDAOT7ZMGX6 4JScDb0g7qpWVOSnvkIrEWZ3XA3pvlI9xYbhQ3QTdfdRuLNft0Tv5yWEyCmVhdo5aVZ+ dWDWNqiXucwhQayOOBM1lNxHVFuAfjoNJo9wuSYXEf5oDwKdfJRQxDU9FbS+puPQ6JKS a7PA== 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=iRrUTLZ1Zwp6NlCRSkebjtv4dXGobAA9Zw2+iR5kagU=; b=sYVaHu92IxP/xGpaFt43vWJtQkwrkMcwDqMlOISIl8adEJBt46EHnUBemBARoUChNs qjcpFKSbEK1gVAa+v27J7K0+hg6/MT6OSHYmwnY/myYc1mcfY4mFtD/cBho6zBNlxKup AgWA1lXH4+nAV8X/b/qtSyRGsEE//uIWlu2PRDnf6KUoJbWFFGEybGa96CWeDlfc9G1D c3LqrEBVak+zGnSIPVmrtbqkQPnuTEzMvWhFGOGdZfLAiHEdT7MGCFcsDxJq5edzT83/ zq5Yj3hbmoIhStGi6IQof1ApErckd02pASNEbQvYB7l069i5mgab5OjJo3hp6dFmomRD aDFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lC5d9QQv; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c19-20020a170906171300b006cf6b54b376si159995eje.455.2022.03.15.15.27.11; Tue, 15 Mar 2022 15:27:37 -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=lC5d9QQv; 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 S1345014AbiCOFNH (ORCPT + 99 others); Tue, 15 Mar 2022 01:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344848AbiCOFMU (ORCPT ); Tue, 15 Mar 2022 01:12:20 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8879749249 for ; Mon, 14 Mar 2022 22:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647321069; x=1678857069; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6bPP85I/X2JN+a+CF0RYCDiAmljsVzkxdKPwz9WA20I=; b=lC5d9QQvyIDKpkS1oew0pMOQwQl5BS2eJg+Hk6wScABUpV5HWII4G8FH 7+lSf4pWdarjAFGFx5duayzLd8kmuSkjgvTk9yDU08jW5GIrR1YMPpKmD Mc9FvB6PqOHjlrjNuQWLQqjbH4JHgchsGlMuyWQ0ia7TFoj2vLZjkXvfx MBSiufVsCoReLUbR8fz9/69CI3G9jnX63T4wEm/i3VKNsLH/QKZNF9M4Q jNXnwrP2lA5lCJHnaw4T4FSlpXzNUYV9y1BEqepnOH1dwLwM84qBPVPWM 0lC+8JNXxEEqyLj+NnxGebS1umCM1ryOe1Fwut1e6HJeJkCrh+3SDcmtA Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10286"; a="236159107" X-IronPort-AV: E=Sophos;i="5.90,182,1643702400"; d="scan'208";a="236159107" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2022 22:03:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,182,1643702400"; d="scan'208";a="580383590" Received: from otc-wp-03.jf.intel.com (HELO jacob-builder.jf.intel.com) ([10.54.39.79]) by orsmga001.jf.intel.com with ESMTP; 14 Mar 2022 22:03:59 -0700 From: Jacob Pan To: iommu@lists.linux-foundation.org, LKML , Joerg Roedel , Jason Gunthorpe , "Christoph Hellwig" , "Lu Baolu" , Jean-Philippe Brucker Cc: Jacob Pan , Raj Ashok , "Kumar, Sanjay K" , Dave Jiang , Tony Luck , "Zanussi, Tom" , Dan Williams , "Tian, Kevin" , Yi Liu Subject: [PATCH v2 7/8] iommu/vt-d: Delete supervisor/kernel SVA Date: Mon, 14 Mar 2022 22:07:11 -0700 Message-Id: <20220315050713.2000518-8-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220315050713.2000518-1-jacob.jun.pan@linux.intel.com> References: <20220315050713.2000518-1-jacob.jun.pan@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 In-kernel DMA with PASID should use DMA API now, remove supervisor PASID SVA support. Remove special cases in bind mm and page request service. Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 42 ++++++++------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index 2c53689da461..37d6218f173b 100644 --- a/drivers/iommu/intel/svm.c +++ b/drivers/iommu/intel/svm.c @@ -516,11 +516,10 @@ static void intel_svm_free_pasid(struct mm_struct *mm) static struct iommu_sva *intel_svm_bind_mm(struct intel_iommu *iommu, struct device *dev, - struct mm_struct *mm, - unsigned int flags) + struct mm_struct *mm) { struct device_domain_info *info = get_domain_info(dev); - unsigned long iflags, sflags; + unsigned long iflags, sflags = 0; struct intel_svm_dev *sdev; struct intel_svm *svm; int ret = 0; @@ -533,16 +532,13 @@ static struct iommu_sva *intel_svm_bind_mm(struct intel_iommu *iommu, svm->pasid = mm->pasid; svm->mm = mm; - svm->flags = flags; INIT_LIST_HEAD_RCU(&svm->devs); - if (!(flags & SVM_FLAG_SUPERVISOR_MODE)) { - svm->notifier.ops = &intel_mmuops; - ret = mmu_notifier_register(&svm->notifier, mm); - if (ret) { - kfree(svm); - return ERR_PTR(ret); - } + svm->notifier.ops = &intel_mmuops; + ret = mmu_notifier_register(&svm->notifier, mm); + if (ret) { + kfree(svm); + return ERR_PTR(ret); } ret = pasid_private_add(svm->pasid, svm); @@ -583,8 +579,6 @@ static struct iommu_sva *intel_svm_bind_mm(struct intel_iommu *iommu, } /* Setup the pasid table: */ - sflags = (flags & SVM_FLAG_SUPERVISOR_MODE) ? - PASID_FLAG_SUPERVISOR_MODE : 0; sflags |= cpu_feature_enabled(X86_FEATURE_LA57) ? PASID_FLAG_FL5LP : 0; spin_lock_irqsave(&iommu->lock, iflags); ret = intel_pasid_setup_first_level(iommu, dev, mm->pgd, mm->pasid, @@ -957,7 +951,7 @@ static irqreturn_t prq_event_thread(int irq, void *d) * to unbind the mm while any page faults are outstanding. */ svm = pasid_private_find(req->pasid); - if (IS_ERR_OR_NULL(svm) || (svm->flags & SVM_FLAG_SUPERVISOR_MODE)) + if (IS_ERR_OR_NULL(svm)) goto bad_req; } @@ -1011,29 +1005,9 @@ static irqreturn_t prq_event_thread(int irq, void *d) struct iommu_sva *intel_svm_bind(struct device *dev, struct mm_struct *mm, void *drvdata) { struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL); - unsigned int flags = 0; struct iommu_sva *sva; int ret; - if (drvdata) - flags = *(unsigned int *)drvdata; - - if (flags & SVM_FLAG_SUPERVISOR_MODE) { - if (!ecap_srs(iommu->ecap)) { - dev_err(dev, "%s: Supervisor PASID not supported\n", - iommu->name); - return ERR_PTR(-EOPNOTSUPP); - } - - if (mm) { - dev_err(dev, "%s: Supervisor PASID with user provided mm\n", - iommu->name); - return ERR_PTR(-EINVAL); - } - - mm = &init_mm; - } - mutex_lock(&pasid_mutex); ret = intel_svm_alloc_pasid(dev, mm, flags); if (ret) { -- 2.25.1