Re: [PATCH v2 08/12] iommu/vt-d: Pass pasid table to context mapping

2018-09-06 Thread Lu Baolu

Hi,

On 09/06/2018 11:17 AM, Tian, Kevin wrote:

From: Lu Baolu [mailto:baolu...@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 



Thank you, Kevin.

Best regards,
Lu Baolu


---
  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, , );
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),
  _context_mapping_cb, );
--
2.17.1




___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


RE: [PATCH v2 08/12] iommu/vt-d: Pass pasid table to context mapping

2018-09-05 Thread Tian, Kevin
> From: Lu Baolu [mailto:baolu...@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, , );
>   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),
> _context_mapping_cb, );
> --
> 2.17.1

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH v2 08/12] iommu/vt-d: Pass pasid table to context mapping

2018-08-29 Thread Lu Baolu
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, , );
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),
  _context_mapping_cb, );
-- 
2.17.1

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu