Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1086316imp; Thu, 21 Feb 2019 18:26:55 -0800 (PST) X-Google-Smtp-Source: AHgI3IajmqmhV1JHoURqdhP1wNuG5niApllurVWV03GerdRNBDsobtMF/unNjb01JQ27w5PkHmho X-Received: by 2002:a17:902:b902:: with SMTP id bf2mr1801435plb.286.1550802414986; Thu, 21 Feb 2019 18:26:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550802414; cv=none; d=google.com; s=arc-20160816; b=0HGBBIwLqmeQE2XpeTLDpFoFCcJ1uSgxSA8d9Hm9dplje7SYrAD8PUrCER7LtBhUa7 0tmvMZdRUFlzxzYHY3xp4X5BUkOBTPtWJqcCuGjh84rVUx7JhE/CsIyE5EKVJ2xe9RLz SBqLz6Z8KHDa/d9FUMRpWIvvSfNi/56wpkjVidd9LlgiOd/sMEJtqF1GkYVY2pLjeEhr 50cbtd3+Vk13vYM6AVYxp54juKsb9cDmI+GPl7ehAPHdavE1uG314/npRwmI51R8KjEh GE4japyrjQKG+fISig6GR4EKMOT2zP7+r9Xs22KHfxVtf9XdMX6uwfeMFhZ+G+Tx5yO7 lp1g== 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; bh=ziPzEH1R1JWbHGBZewaO+cUUpJ6+OsjnF1iLY70BHBI=; b=S3/xWGsGjSwvolMwytd+OPBcq6EziILUPlyK6C/+zZWIPvmDXqCwadj2x2CpnUEc6Y U9IXnYgsxDzV28EzIbXxifWrj4XqUoFBh5i83XrHGh/J/XVZeBk+drukEBTkTwDzWo2+ JjCQtiSy4K9zKhjDhAD5uw65Bt6iXfO5teqQUpFyY3sS01ziFcGGGTVtW4sFjtCXQgwi wPCXlNNgc88jf0vUbhP8SMHsU+VB7y7j6b4DE39e190GEL41rAW68lw5bfNJxDJu5cqg sArW+rJkpleD9SOUIGYGLCMiuJE18OUoVczd1qsbo55c68I3+AoZMNFRfHpMlYe2eJDU 5Yug== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s80si187236pgs.165.2019.02.21.18.26.39; Thu, 21 Feb 2019 18:26:54 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727215AbfBVCZU (ORCPT + 99 others); Thu, 21 Feb 2019 21:25:20 -0500 Received: from mga01.intel.com ([192.55.52.88]:59159 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727198AbfBVCZR (ORCPT ); Thu, 21 Feb 2019 21:25:17 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2019 18:25:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,397,1544515200"; d="scan'208";a="116855208" Received: from allen-box.sh.intel.com ([10.239.159.136]) by orsmga007.jf.intel.com with ESMTP; 21 Feb 2019 18:25:13 -0800 From: Lu Baolu To: Joerg Roedel , David Woodhouse , Alex Williamson , Kirti Wankhede Cc: ashok.raj@intel.com, sanjay.k.kumar@intel.com, jacob.jun.pan@intel.com, kevin.tian@intel.com, Jean-Philippe Brucker , yi.l.liu@intel.com, yi.y.sun@intel.com, peterx@redhat.com, tiwei.bie@intel.com, xin.zeng@intel.com, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu , Jacob Pan Subject: [PATCH v7 6/9] iommu/vt-d: Return ID associated with an auxiliary domain Date: Fri, 22 Feb 2019 10:19:24 +0800 Message-Id: <20190222021927.13132-7-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190222021927.13132-1-baolu.lu@linux.intel.com> References: <20190222021927.13132-1-baolu.lu@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds support to return the default pasid associated with an auxiliary domain. The PCI device which is bound with this domain should use this value as the pasid for all DMA requests of the subset of device which is isolated and protected with this domain. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 8ecf09db6047..b79c72cc5931 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -5684,6 +5684,15 @@ intel_iommu_dev_feat_enabled(struct device *dev, enum iommu_dev_features feat) return false; } +static int +intel_iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev) +{ + struct dmar_domain *dmar_domain = to_dmar_domain(domain); + + return dmar_domain->default_pasid > 0 ? + dmar_domain->default_pasid : -EINVAL; +} + const struct iommu_ops intel_iommu_ops = { .capable = intel_iommu_capable, .domain_alloc = intel_iommu_domain_alloc, @@ -5692,6 +5701,7 @@ const struct iommu_ops intel_iommu_ops = { .detach_dev = intel_iommu_detach_device, .aux_attach_dev = intel_iommu_aux_attach_device, .aux_detach_dev = intel_iommu_aux_detach_device, + .aux_get_pasid = intel_iommu_aux_get_pasid, .map = intel_iommu_map, .unmap = intel_iommu_unmap, .iova_to_phys = intel_iommu_iova_to_phys, -- 2.17.1