Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2771245img; Sun, 24 Mar 2019 18:40:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFVABFWAmRCihC2Jm6NZinoR7I3oOWmXhxU5SCuDmbnralYuq9MntBsdwXI9GXgli9460T X-Received: by 2002:a65:538b:: with SMTP id x11mr20415087pgq.35.1553478029183; Sun, 24 Mar 2019 18:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553478029; cv=none; d=google.com; s=arc-20160816; b=wfAzuhb1cKmoAsfnYwLon3nY+TJtc+/mzRgPYodtOBLnx9UvOQX96IKaXBDxi+ksne JyV1cw3ezUV5Yo9sXr3ia/ql+iMQ89Xv5lpZybe0xuIK5yeLgpfQmN4dyUH2vsuzwGAI hXr8tvEl77dw/omIVaXEKGtnG9H1SdYLdETjxtoP0oiLl2usHT/HxK8PPp0vzMnFTjfV g7Qe+0AcsaX+eVM+RLh4Ndh2G7Os6oX+ON9oo38w1qnpf6NEBnzut6BJ+KFZOpgUKnY9 LAJTHHBkfmLjI3kt3DtmIbVAZiAGY126gvEC2vb2GTYGHjwDuvrjbvRlNvuhMHus+S5L K5rA== 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=X2O+llJ9VdcgyQ7jmXkGwjgkwAaeVcRLtyF/kqjZN5s=; b=HOGpRWLUUVv4DQN46RlqZscJz1Eo+Fm5dqX9XKaV12VoB/I+opHY8a5Y8AYQ0ZA4oJ f18XLnVYJoglzVoj0Z8oGBF5/haUrEeIIITAYSPypdQMYzIbTMfaWeVoZu/2KnuGjC6K BI6nv/Q39NJv3sHejrjEK5ezN5U7WS5aLRCafdVd/c4CWqCmjKF96VwyEUixypMPllrY drSKt+4F24JDwkJ6t/FZuD3rZTXMFOqIBP2pc4KKLhNVg7gvK2w83pezKUCcA0byIKwF 1pZ+HN6OhtWGOhyXek+ntiWGNaaM2lrVYDRPEgzmEh23KtVNUqpE5uC38wKIrOzqBUTh QUmg== 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 bj7si9501562plb.408.2019.03.24.18.40.14; Sun, 24 Mar 2019 18:40:29 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729441AbfCYBh4 (ORCPT + 99 others); Sun, 24 Mar 2019 21:37:56 -0400 Received: from mga04.intel.com ([192.55.52.120]:35778 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729231AbfCYBhQ (ORCPT ); Sun, 24 Mar 2019 21:37:16 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Mar 2019 18:37:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="128326913" Received: from allen-box.sh.intel.com ([10.239.159.136]) by orsmga008.jf.intel.com with ESMTP; 24 Mar 2019 18:37:12 -0700 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 v8 6/9] iommu/vt-d: Return ID associated with an auxiliary domain Date: Mon, 25 Mar 2019 09:30:33 +0800 Message-Id: <20190325013036.18400-7-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190325013036.18400-1-baolu.lu@linux.intel.com> References: <20190325013036.18400-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 28a998afaf74..c137f0f2cf49 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -5697,6 +5697,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, @@ -5705,6 +5714,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