Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp26897imm; Wed, 5 Sep 2018 20:21:34 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaJvIxZaRNoGxjSbfGc2frkw3CoMI1q9cc38aIpZCROzoEjr2yoBQEgpCg9hHDB/Y72cqBs X-Received: by 2002:a17:902:18a:: with SMTP id b10-v6mr792992plb.62.1536204093994; Wed, 05 Sep 2018 20:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536204093; cv=none; d=google.com; s=arc-20160816; b=pZJPBNZEa8TCufYkwLIiVh9POtAA6sMnS584ilmWlu/Q5aOhcrlpEmDEjm2swlZlUr djQ+j5MVdi4z/9ojpYq1FcwwbeIOJ/0yXZaUNqW2KB99+j+vbQIQt2aeKP+ZfUA2VMH1 r1IWeWpUoLKJKn7hj61wZaAnRMGt1cWlTAJJxh+zHzaZgaq7VkrlBWvXtzXCEgJAH5V9 7DHtOpM+i7XvFzQ53wE6+qpVrjiolonhQJMUCTlf3wBziUJlNmPUoqlBr+b6r+UapKUJ EmGJwGJlo2pCR9u4NZg5SL0fgav/y0AU6dSSeZu7eHNRgAW7TYVt65BQjoHc56AjM/3a lU+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=MDzL7xGWWlig3dU1oRF0ZH6zxaKI/48OHRM7QrSRRtw=; b=nXWYLFef8UA6CCyUOxJ8wofbtQeMUjgv/GRH9BivwbnDtewBuw2sFPZjntlwYT8D2P L+LoXcJQbdLltjlxGL85hPZ8FAcxWeWhLF76uPqVwrLVlpJNJSorTBve7FMjl/aT7Cf7 CqtHsCZlmU7nU3fuxF0D0VodBKxEc2snvhys1lYjTAY4GXgdSyDZmcr4RrbxYD29txTu COpQua0dywByQe7kqMreipRbNAg7hOqd7riT81GvcSTVoiiKTWAtRjx68xlxqbnt+X2R YACPYS7C0OZ9AaHJHWn0WydfKagL3+bjo6c0tsvKIobj1eH9Oivcu3KOO86krCEYI9du M06w== 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 k13-v6si4225397pgh.213.2018.09.05.20.21.17; Wed, 05 Sep 2018 20:21:33 -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 S1727787AbeIFHvH convert rfc822-to-8bit (ORCPT + 99 others); Thu, 6 Sep 2018 03:51:07 -0400 Received: from mga11.intel.com ([192.55.52.93]:5691 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbeIFHvH (ORCPT ); Thu, 6 Sep 2018 03:51:07 -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; 05 Sep 2018 20:17:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,334,1531810800"; d="scan'208";a="81270503" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 05 Sep 2018 20:17:55 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 5 Sep 2018 20:17:54 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.205]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.240]) with mapi id 14.03.0319.002; Thu, 6 Sep 2018 11:17:52 +0800 From: "Tian, Kevin" To: Lu Baolu , Joerg Roedel , David Woodhouse CC: "Raj, Ashok" , "Kumar, Sanjay K" , "Pan, Jacob jun" , "Liu, Yi L" , "Sun, Yi Y" , "peterx@redhat.com" , Jean-Philippe Brucker , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , Jacob Pan Subject: RE: [PATCH v2 08/12] iommu/vt-d: Pass pasid table to context mapping Thread-Topic: [PATCH v2 08/12] iommu/vt-d: Pass pasid table to context mapping Thread-Index: AQHUQAHyCLZbYhUF8Ey0UZ5yXAs9X6TioEYg Date: Thu, 6 Sep 2018 03:17:52 +0000 Message-ID: References: <20180830013524.28743-1-baolu.lu@linux.intel.com> <20180830013524.28743-9-baolu.lu@linux.intel.com> In-Reply-To: <20180830013524.28743-9-baolu.lu@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmIxMGMzNTItNTUxNi00Njc1LTg3OTUtOTkyZmQ2OWI2ZDA2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicnRXRXBqVWdVNGZIbjBtRWpGVWJYZUpRNkc1dGF4SFwvUUEyNE00TkU4N3lLUDRNM1lnQUx0aEtOWVR6Q2RsUVoifQ== dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Lu Baolu [mailto:baolu.lu@linux.intel.com] > Sent: Thursday, August 30, 2018 9:35 AM > > 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 Reviewed-by: Kevin Tian > --- > 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