Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp247409imu; Sun, 4 Nov 2018 23:38:01 -0800 (PST) X-Google-Smtp-Source: AJdET5cb/MudnRy0Rj+EMMPrp4P9q48nVLnSdHhobWClA4OFRVLChcp/wj85HvE7nhtH9B68yt6p X-Received: by 2002:a63:d70e:: with SMTP id d14mr16616052pgg.159.1541403481684; Sun, 04 Nov 2018 23:38:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541403481; cv=none; d=google.com; s=arc-20160816; b=BD25q1fQqbdQyB3zmNlYU4NIvnNYO4QqAp168IBQogO4GlY449iYqeDgPh+IT5Ur/E 7Vwgfw1S7ozsKnY1QvkEAMhCnL8v1atR8bhh5qHsfs7ZVRy6rsiXblgyB47WhhnScdNL qRHStHPOxvrShjkFmW1GowZkqTQ1zBe84ff6/Dl0PD4+TkgBqKGRyXMG3dm1wSOguhjg 1NPLo7FnLMH0GEVU0L1yiDZSTILQNm1cjabmit138YKhGEUk01WWvhL23P9n6S55EurY Bfs5KIfn6H0szlVQEno/sBpRSxBg1KShXMxEIuyQmXn49+QjM3ou7NCrnzBYZqDk9Yx5 pONw== 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=akYut+aeU+8CIRkzAoMDF4fpvYBypuH9dBpgJCcF3h0=; b=kmzFjxiUw1cxhpJ3x6KwUCnh/GCZEotHq9HdOzfhSD2PaqobeGXbnPwnhxVeHufgSa HBB7MsKFmiS69z6MRHALIoHiKTxCwYtfBjijntc9GXuz6b4MXqk2NSenVFXXZhDGzgQ/ aGoAWJS0oxaoUanmT95H9hiNwm4OxnfBEoydQuEH5nn3J0ZykjcuAI+NkbWtMpMlIXfu wSUMpDFOMNHHJ08iP39KrcLc/9gn+lCtBNaAc0lXiNt9W9VWZHo76LrQcvDy0Szq3KBT D6zvWqBd+iPnPgRArjhJ4/0VWW3lHkuStfWxnOnS06uXe0gpl3pv5sR6hN+MfxBKkbKY /fyw== 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 g7-v6si42442670pgj.116.2018.11.04.23.37.46; Sun, 04 Nov 2018 23:38:01 -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 S1729633AbeKEQz2 (ORCPT + 99 others); Mon, 5 Nov 2018 11:55:28 -0500 Received: from mga05.intel.com ([192.55.52.43]:47529 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729293AbeKEQz2 (ORCPT ); Mon, 5 Nov 2018 11:55:28 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2018 23:37:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,467,1534834800"; d="scan'208";a="88618134" Received: from allen-box.sh.intel.com ([10.239.161.122]) by orsmga006.jf.intel.com with ESMTP; 04 Nov 2018 23:37:04 -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, Zeng Xin , iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu , Jacob Pan Subject: [PATCH v4 5/8] iommu/vt-d: Return ID associated with an auxiliary domain Date: Mon, 5 Nov 2018 15:34:05 +0800 Message-Id: <20181105073408.21815-6-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105073408.21815-1-baolu.lu@linux.intel.com> References: <20181105073408.21815-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: Lu Baolu Signed-off-by: Liu Yi L --- 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 a61b25ad0d3b..49a278a699b0 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -5576,6 +5576,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, @@ -5592,6 +5613,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