Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2014546imm; Mon, 16 Jul 2018 00:02:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdXmCD2hfAiJuDCfWr2bjXJhYYdDNrQxrrY6/jV/mpBy0mY845T903C9DNcFonVmAL/Uwhk X-Received: by 2002:a17:902:9689:: with SMTP id n9-v6mr1361786plp.128.1531724560633; Mon, 16 Jul 2018 00:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531724560; cv=none; d=google.com; s=arc-20160816; b=T8oSwB4hbW/91iaRVbWLfQy/opgBRPLGPlll+MlXzs5SZyBBGDpDDA1VTwULxjKlkW 7jVEZbfuMq9c3MIGtPgcD4ukEHgnPkdeFcg1Q5DqttMf9aER/X1319miElh/u6DI/4T/ WnW7dhuVdrDNCTPkTo9cvsGCJqyI9wyrkkwuTV0IThWL418YbK01T/SiX1i8r4KNeP9z H2dIW138XOMSDFwFnmWopDyRaR9kBFQEjrZWysGVqz4d5wDC0LWOQCuduz1qtO2RhoMS A5M4ORO3BcJWK2brhkMWgY9v4ydJaaKSAbrrBy5rtsoOTmp0rF8EyiRzzbRqFa4agH3E Ra3A== 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=zV4k35mZ9QsMbxIc4jovZXtFJrPmoX8bhFbJ0mMbII8=; b=s9Kdx5e7NxHbfMULIz72sxihZpt+G9niCJ2K7erZ41HBAfrqtiOMCCRanbeoCZCx/z CwvyUgA/ee8W/Xria2g36QKBVhKi/dhq4KoFvkvuxfjdFvL0IiWW2jC9FcZmsxctOz6c jzTfhrFHIutBM03nLcWBMXrkbvAnNBlYhnzdffXfVaJvbjOhxNaEI9mQj3vhmzZmDklK l+JOr2OiLzFEDIQJbiHDAhOfsIwtp/MBs1V/4DKqssDbFFje+L/AfElxBH3JXAtGBXRB neR21PfMjdR8CemgBpbkUd4ASTiX1HNAjStU7RoKu6TifbSvVazX1XVWr58R7IavIT/y 60ew== 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 b18-v6si28517140pge.666.2018.07.16.00.02.25; Mon, 16 Jul 2018 00:02:40 -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 S1729983AbeGPH0U (ORCPT + 99 others); Mon, 16 Jul 2018 03:26:20 -0400 Received: from mga14.intel.com ([192.55.52.115]:45301 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727540AbeGPH0S (ORCPT ); Mon, 16 Jul 2018 03:26:18 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2018 00:00:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,360,1526367600"; d="scan'208";a="72647303" Received: from allen-box.sh.intel.com ([10.239.48.172]) by fmsmga001.fm.intel.com with ESMTP; 16 Jul 2018 00:00:24 -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, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Lu Baolu , Jacob Pan Subject: [PATCH 06/10] iommu/vt-d: Pass pasid table to context mapping Date: Mon, 16 Jul 2018 14:49:49 +0800 Message-Id: <1531723793-14607-7-git-send-email-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531723793-14607-1-git-send-email-baolu.lu@linux.intel.com> References: <1531723793-14607-1-git-send-email-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 62e9579..add7e3e 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -1918,6 +1918,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]; @@ -2040,6 +2041,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, @@ -2048,25 +2050,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.7.4