Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp346996imm; Thu, 11 Oct 2018 22:19:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV61LhE1cCOLLGPD1T6G+jZG6h9n0QZU34SwuBH+iZNJ7qY/Rb+DQ6tjDOcK5Usn2Ew5+xrj1 X-Received: by 2002:a63:1555:: with SMTP id 21-v6mr4097018pgv.383.1539321592434; Thu, 11 Oct 2018 22:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539321592; cv=none; d=google.com; s=arc-20160816; b=t0jIWJGg8uun/Pcw/WY4URAdNtr1nl5hrxT4n9QaDRCCWUGzft0jJ7EmHUj+SjdQDq 9dVZQ7rFnK47VHAIXSpkl1twhcpioIxNPxpxl8dC41w4vYBK+ILoDHiNazOg6z+e46GN yox+OdNVsI9Ios/EpX+TP+NZy2bbyQlGT6Q/3K6itnkp4d3Kou3xPpdWXadwU0W3GREz CAUfiNIpSwP2k9BU0RD9jc0HQk7JBz3gSuhniaO3vqmKzEbH6pPkk8EaapwXzNGWMO2C rc2zukfHH4y6qB3sBE/mf729ZrNSMfnjKEb0QUNohV8LrV7ZbtJxfhtmsK+/42PnNk2v ACZw== 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=D3kMUegoIt7b7DTnc9v1PAjGIKdo6Rqce8jV9bG9Nm4=; b=qhrEfd5aYMSxG/rI87tlhe+S9KdEUVI3h4jkXIiydmvwbOT1PrAvMxzcJiC13rvxM/ ipIcyQcegZUM7o66Kj1yWxhUiInL42BIkjSlW///9K5SRBPRfHFbLSd1NiRvy/6gUSN2 Myc0qBKN/3jvGEiIaJ4TRe8wWQ0R53E6bZSC+Oo+j68AHx/YCdeexlhgJppXFjaqhgo0 ZF5tiYbmURtzODdqPdJ9vmctyMfmlcc26ktxqurdHoJ/i3VbfoBcl+wQ9raYL6RUSNZ/ 3UBw/PowWqVNt+vNI8XMfDl1xPHOJ+1qZ8vp/yQkJtv+n6+XHih06cyp2SMzGiqypjzd 1lGg== 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 k20-v6si100775pgm.574.2018.10.11.22.19.37; Thu, 11 Oct 2018 22:19:52 -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 S1727596AbeJLMtj (ORCPT + 99 others); Fri, 12 Oct 2018 08:49:39 -0400 Received: from mga11.intel.com ([192.55.52.93]:62493 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726969AbeJLMti (ORCPT ); Fri, 12 Oct 2018 08:49:38 -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 fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 22:18:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,371,1534834800"; d="scan'208";a="80842247" Received: from allen-box.sh.intel.com ([10.239.161.122]) by orsmga008.jf.intel.com with ESMTP; 11 Oct 2018 22:18:55 -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, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu , Jacob Pan Subject: [PATCH v3 5/8] iommu/vt-d: Return ID associated with an auxiliary domain Date: Fri, 12 Oct 2018 13:16:29 +0800 Message-Id: <20181012051632.26064-6-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181012051632.26064-1-baolu.lu@linux.intel.com> References: <20181012051632.26064-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 Cc: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 3ca42b0e80df..4dc41232a0d6 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -5553,6 +5553,27 @@ static int intel_iommu_set_dev_attr(struct device *dev, return ret; } +static int intel_iommu_domain_get_attr(struct iommu_domain *domain, + enum iommu_attr attr, void *data) +{ + struct dmar_domain *dmar_domain = to_dmar_domain(domain); + int ret = -EINVAL, *id; + + switch (attr) { + case DOMAIN_ATTR_AUXD_ID: + if (dmar_domain->default_pasid > 0) { + ret = 0; + id = data; + *id = dmar_domain->default_pasid; + } + break; + default: + break; + } + + return ret; +} + const struct iommu_ops intel_iommu_ops = { .capable = intel_iommu_capable, .domain_alloc = intel_iommu_domain_alloc, @@ -5567,6 +5588,7 @@ const struct iommu_ops intel_iommu_ops = { .get_resv_regions = intel_iommu_get_resv_regions, .put_resv_regions = intel_iommu_put_resv_regions, .device_group = pci_device_group, + .domain_get_attr = intel_iommu_domain_get_attr, .get_dev_attr = intel_iommu_get_dev_attr, .set_dev_attr = intel_iommu_set_dev_attr, .pgsize_bitmap = INTEL_IOMMU_PGSIZES, -- 2.17.1