Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp276485imm; Wed, 29 Aug 2018 21:13:43 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY+78WLzKAXx4E0OMjMGaaoAlIOGrvjayrjfT0FggNSodln4WD5cumYlDzbMqDLD+Qm+Kn9 X-Received: by 2002:a63:1d47:: with SMTP id d7-v6mr8156858pgm.180.1535602423459; Wed, 29 Aug 2018 21:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535602423; cv=none; d=google.com; s=arc-20160816; b=hG6dugzh4OBchLnBDubcNxIHDXjqxOWB3NXhI0bs10tB0/BQaUOfU61v0OrLMBG/sg IcKZaXlPuJL8AgCa/DAb5SDZpVpqqGhqnAw65yK0w4HBTPCGa3uTOYBPBQITWEB+6so/ Kep4MxpKqmZzWYzDcbBbShjk5AuFNf9YVH5G519F3Vga74Zg4wuU4/aWtFv10wwhW2kT tCkmrxEtKU/EteF4P0yuFMQOvHtXXozScE52y8I1ifg4PA5bOEDFC37MTeZpD3cRDATs ARZZBYyANPgtT/zzZ1uqGBHk9gdqiPAVSzHHNj5/FNCIMsS7nR+xen00ZpZzuHVOysXC cuaQ== 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:arc-authentication-results; bh=YHIWJyp1aGTsKmTsFEXwLBXm0IVNNwDgAHk9b3iQaZw=; b=GctDYtvZ1/xwMxif83JXyl9GDbCvM4YCacDf1+GoYJOukTDLcN7no0KI16O/9bOPbL jcKGx6e2dKPObOHyZc8pYG+gP2ELW0+kQbuabSrApz1LwPTxiCok36085HdEdY204m0c cddMMziii0mmHu4KwYeWSj0lZNcdY+pSb29jveM+MautdQ/WfuWDNlTBaOKjmiEUbmvu lO1FXQ86G2jYSd3h2fpvqVVK2E3SGXm0HQaKixo2Uh/FAU9OBTgAYR/Y72Prrly7J5z2 Sv+boKE8biDACOKsUMWG1PKHVUD/4LEvcu3H+g5fK0A7YNiEJ4vg9pTgmaTglR+eqANl jZ/Q== 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 a68-v6si3085442pla.361.2018.08.29.21.13.28; Wed, 29 Aug 2018 21:13:43 -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 S1727736AbeH3ILY (ORCPT + 99 others); Thu, 30 Aug 2018 04:11:24 -0400 Received: from mga02.intel.com ([134.134.136.20]:31597 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbeH3ILY (ORCPT ); Thu, 30 Aug 2018 04:11:24 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Aug 2018 21:11:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="68959972" Received: from allen-box.sh.intel.com ([10.239.161.122]) by orsmga007.jf.intel.com with ESMTP; 29 Aug 2018 21:11:01 -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: [RFC PATCH v2 06/10] iommu/vt-d: Return ID associated with an auxiliary domain Date: Thu, 30 Aug 2018 12:09:18 +0800 Message-Id: <20180830040922.30426-7-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180830040922.30426-1-baolu.lu@linux.intel.com> References: <20180830040922.30426-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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 784bd496f316..1ba39f120a38 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -5544,6 +5544,14 @@ static void intel_iommu_disable_auxd(struct device *dev) spin_unlock_irqrestore(&device_domain_lock, flags); } +static int intel_iommu_auxd_id(struct iommu_domain *domain) +{ + 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, @@ -5560,6 +5568,7 @@ const struct iommu_ops intel_iommu_ops = { .device_group = pci_device_group, .enable_auxd = intel_iommu_enable_auxd, .disable_auxd = intel_iommu_disable_auxd, + .auxd_id = intel_iommu_auxd_id, .pgsize_bitmap = INTEL_IOMMU_PGSIZES, }; -- 2.17.1