Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp208248imm; Wed, 29 Aug 2018 18:39:51 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda+eMqT/BxWuVhsyls00LEe//Z3lUT4qXMH5iBL1Ga1H3kUm+H8Yw9V0rU8HODP3l7W8tLn X-Received: by 2002:a17:902:127:: with SMTP id 36-v6mr8365337plb.178.1535593191354; Wed, 29 Aug 2018 18:39:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535593191; cv=none; d=google.com; s=arc-20160816; b=zhzrkY+OWuG1ie95vMnYnEeL03bI/eexklw0GTv29sQLieBJZskN57Rc053MWqPEGE xKQtdoJgJ+1Ru9DZJvf6fvMYOtpMJjzc5QiF3WEWySxVwjiZk9iXgSQBtVATZLar9yzk PQHMXGoU9z4me9hsfmlrhVg1FBCWgS052aUet8jNr9nXAPdNtToFNek6v51kQoAfXbbc X9rBK36HqXqaHeManaYkZGNMZtcwKBRsJ6GqKif2wwyXAUg7beHvdWr9gPmdr8Kk2rAq sRXLhx9dau7evn39gBcVj9h3St/Rsq/Rc4463/dZ6mR1rQe1lOudOTlixPsYer98N6Rn ne2g== 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=Dn3B1KBhME9Sp84YfkKGq7IqAYBIYwshRRPprffkGxs=; b=Ufm3KKwHQLTpndBpqzVx2xxHMdt+AKvcSt0xRhMNYGyTu7pZViRGaup9YBrru7ocET juqtGhqqzc3uuYXRuhYpvP04/u5BivewQ2BB8ddQLACuicn2840x4wiWpXP5FDu4d3mC fUjv4UnFHl6tXot+I+vuePBk3+3sSJAPv0QciQzVnMBt/vdnXZqVl1wCYgGmaqSnq8Dn 5+NL1pHOd6dHvfrI9LcQmuVlczV5u4VEPTP9aoEZ8pxudQeBpkc8NM/Jrrkqj5d8QZJd 8ds+N6WjwckZFoIswkDuuTgaSozz+k68WpEicWzWtfHcR31hw2yrtBucwOkVp88w8NGu Ko8A== 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 81-v6si5370141pgd.57.2018.08.29.18.38.52; Wed, 29 Aug 2018 18:39:51 -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 S1727450AbeH3Fge (ORCPT + 99 others); Thu, 30 Aug 2018 01:36:34 -0400 Received: from mga11.intel.com ([192.55.52.93]:9350 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727438AbeH3Fgd (ORCPT ); Thu, 30 Aug 2018 01:36:33 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Aug 2018 18:36:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,305,1531810800"; d="scan'208";a="79442300" Received: from allen-box.sh.intel.com ([10.239.161.122]) by orsmga003.jf.intel.com with ESMTP; 29 Aug 2018 18:36:53 -0700 From: Lu Baolu To: Joerg Roedel , David Woodhouse Cc: ashok.raj@intel.com, sanjay.k.kumar@intel.com, jacob.jun.pan@intel.com, kevin.tian@intel.com, yi.l.liu@intel.com, yi.y.sun@intel.com, peterx@redhat.com, Jean-Philippe Brucker , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Lu Baolu , Jacob Pan Subject: [PATCH v2 08/12] iommu/vt-d: Pass pasid table to context mapping Date: Thu, 30 Aug 2018 09:35:20 +0800 Message-Id: <20180830013524.28743-9-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180830013524.28743-1-baolu.lu@linux.intel.com> References: <20180830013524.28743-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 So that the pasid related info, such as the pasid table and the maximum of pasid could be used during setting up scalable mode context. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-iommu.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c3bf2ccf094d..33642dd3d6ba 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -1942,6 +1942,7 @@ static void domain_exit(struct dmar_domain *domain) static int domain_context_mapping_one(struct dmar_domain *domain, struct intel_iommu *iommu, + struct pasid_table *table, u8 bus, u8 devfn) { u16 did = domain->iommu_did[iommu->seq_id]; @@ -2064,6 +2065,7 @@ static int domain_context_mapping_one(struct dmar_domain *domain, struct domain_context_mapping_data { struct dmar_domain *domain; struct intel_iommu *iommu; + struct pasid_table *table; }; static int domain_context_mapping_cb(struct pci_dev *pdev, @@ -2072,25 +2074,31 @@ static int domain_context_mapping_cb(struct pci_dev *pdev, struct domain_context_mapping_data *data = opaque; return domain_context_mapping_one(data->domain, data->iommu, - PCI_BUS_NUM(alias), alias & 0xff); + data->table, PCI_BUS_NUM(alias), + alias & 0xff); } static int domain_context_mapping(struct dmar_domain *domain, struct device *dev) { + struct domain_context_mapping_data data; + struct pasid_table *table; struct intel_iommu *iommu; u8 bus, devfn; - struct domain_context_mapping_data data; iommu = device_to_iommu(dev, &bus, &devfn); if (!iommu) return -ENODEV; + table = intel_pasid_get_table(dev); + if (!dev_is_pci(dev)) - return domain_context_mapping_one(domain, iommu, bus, devfn); + return domain_context_mapping_one(domain, iommu, table, + bus, devfn); data.domain = domain; data.iommu = iommu; + data.table = table; return pci_for_each_dma_alias(to_pci_dev(dev), &domain_context_mapping_cb, &data); -- 2.17.1