[dpdk-dev,v3,03/11] bsdapp/eal_pci: get iommu class

Message ID 20170711061631.5018-4-santosh.shukla@caviumnetworks.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Santosh Shukla July 11, 2017, 6:16 a.m. UTC
  Introducing rte_pci_get_iommu_class API which helps to get iommu class
of PCI device on the bus and returns preferred iova mapping mode for
PCI bus.

Bsdapp case returns default iova mode.

Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 lib/librte_eal/bsdapp/eal/eal_pci.c           | 10 ++++++++++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map |  1 +
 lib/librte_eal/common/include/rte_bus.h       |  9 +++++++++
 lib/librte_eal/common/include/rte_pci.h       | 11 +++++++++++
 4 files changed, 31 insertions(+)
  

Comments

Maxime Coquelin July 11, 2017, 9:15 a.m. UTC | #1
On 07/11/2017 08:16 AM, Santosh Shukla wrote:
>   
> diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
> index af9f0e13f..7a0cfb165 100644
> --- a/lib/librte_eal/common/include/rte_bus.h
> +++ b/lib/librte_eal/common/include/rte_bus.h
> @@ -55,6 +55,15 @@ extern "C" {
>   /** Double linked list of buses */
>   TAILQ_HEAD(rte_bus_list, rte_bus);
>   
> +
> +/**
> + * IOVA mapping mode.
> + */
> +enum rte_iova_mode {
> +	RTE_IOVA_PA = 1,
> +	RTE_IOVA_VA
> +};
> +
>   /**
>    * Bus specific scan for devices attached on the bus.
>    * For each bus object, the scan would be responsible for finding devices and
> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> index 4a485674e..c58361132 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -383,6 +383,17 @@ int
>   rte_pci_match(const struct rte_pci_driver *pci_drv,
>   	      const struct rte_pci_device *pci_dev);
>   
> +
> +/**
> + * Get iommu class of PCI devices on the bus.
> + * And return their preferred iova mapping mode.
> + *
> + * @return
> + *   - enum rte_iova_mode.
> + */
> +enum rte_iova_mode
> +rte_pci_get_iommu_class(void);
> +
>   /**
>    * Map the PCI device resources in user space virtual memory address
>    *

I would have put this in a separate patch, as not bsd specifics.

Maxime
  
Santosh Shukla July 11, 2017, 10:41 a.m. UTC | #2
On Tuesday 11 July 2017 02:45 PM, Maxime Coquelin wrote:

>
> On 07/11/2017 08:16 AM, Santosh Shukla wrote:
>>   diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
>> index af9f0e13f..7a0cfb165 100644
>> --- a/lib/librte_eal/common/include/rte_bus.h
>> +++ b/lib/librte_eal/common/include/rte_bus.h
>> @@ -55,6 +55,15 @@ extern "C" {
>>   /** Double linked list of buses */
>>   TAILQ_HEAD(rte_bus_list, rte_bus);
>>   +
>> +/**
>> + * IOVA mapping mode.
>> + */
>> +enum rte_iova_mode {
>> +    RTE_IOVA_PA = 1,
>> +    RTE_IOVA_VA
>> +};
>> +
>>   /**
>>    * Bus specific scan for devices attached on the bus.
>>    * For each bus object, the scan would be responsible for finding devices and
>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
>> index 4a485674e..c58361132 100644
>> --- a/lib/librte_eal/common/include/rte_pci.h
>> +++ b/lib/librte_eal/common/include/rte_pci.h
>> @@ -383,6 +383,17 @@ int
>>   rte_pci_match(const struct rte_pci_driver *pci_drv,
>>             const struct rte_pci_device *pci_dev);
>>   +
>> +/**
>> + * Get iommu class of PCI devices on the bus.
>> + * And return their preferred iova mapping mode.
>> + *
>> + * @return
>> + *   - enum rte_iova_mode.
>> + */
>> +enum rte_iova_mode
>> +rte_pci_get_iommu_class(void);
>> +
>>   /**
>>    * Map the PCI device resources in user space virtual memory address
>>    *
>
> I would have put this in a separate patch, as not bsd specifics.
>
I'll pull that out in v4, and perhaps squash into [01/11], as both changes (RTE_PCI_DRV_ and this one) 
are on same rte_pci.h file. Is it Ok with you? or you prefer separate patch for both
(RTE_PCI_DRV_ and this one)?

> Maxime
  
Maxime Coquelin July 11, 2017, 12:09 p.m. UTC | #3
On 07/11/2017 12:41 PM, santosh wrote:
> On Tuesday 11 July 2017 02:45 PM, Maxime Coquelin wrote:
> 
>>
>> On 07/11/2017 08:16 AM, Santosh Shukla wrote:
>>>    diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
>>> index af9f0e13f..7a0cfb165 100644
>>> --- a/lib/librte_eal/common/include/rte_bus.h
>>> +++ b/lib/librte_eal/common/include/rte_bus.h
>>> @@ -55,6 +55,15 @@ extern "C" {
>>>    /** Double linked list of buses */
>>>    TAILQ_HEAD(rte_bus_list, rte_bus);
>>>    +
>>> +/**
>>> + * IOVA mapping mode.
>>> + */
>>> +enum rte_iova_mode {
>>> +    RTE_IOVA_PA = 1,
>>> +    RTE_IOVA_VA
>>> +};
>>> +
>>>    /**
>>>     * Bus specific scan for devices attached on the bus.
>>>     * For each bus object, the scan would be responsible for finding devices and
>>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
>>> index 4a485674e..c58361132 100644
>>> --- a/lib/librte_eal/common/include/rte_pci.h
>>> +++ b/lib/librte_eal/common/include/rte_pci.h
>>> @@ -383,6 +383,17 @@ int
>>>    rte_pci_match(const struct rte_pci_driver *pci_drv,
>>>              const struct rte_pci_device *pci_dev);
>>>    +
>>> +/**
>>> + * Get iommu class of PCI devices on the bus.
>>> + * And return their preferred iova mapping mode.
>>> + *
>>> + * @return
>>> + *   - enum rte_iova_mode.
>>> + */
>>> +enum rte_iova_mode
>>> +rte_pci_get_iommu_class(void);
>>> +
>>>    /**
>>>     * Map the PCI device resources in user space virtual memory address
>>>     *
>>
>> I would have put this in a separate patch, as not bsd specifics.
>>
> I'll pull that out in v4, and perhaps squash into [01/11], as both changes (RTE_PCI_DRV_ and this one)
> are on same rte_pci.h file. Is it Ok with you? or you prefer separate patch for both
> (RTE_PCI_DRV_ and this one)?

I'm fine you squash this part in patch 1.

Thanks,
Maxime

>> Maxime
>
  

Patch

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index e321461d8..40a951e31 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -405,6 +405,16 @@  rte_pci_scan(void)
 	return -1;
 }
 
+/*
+ * Get iommu class of pci devices on the bus.
+ */
+enum rte_iova_mode
+rte_pci_get_iommu_class(void)
+{
+	/* Supports only RTE_KDRV_NIC_UIO */
+	return RTE_IOVA_PA;
+}
+
 int
 pci_update_device(const struct rte_pci_addr *addr)
 {
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 8d43df0bb..33c2c32c0 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -201,6 +201,7 @@  DPDK_17.08 {
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
 	rte_pci_match;
+	rte_pci_get_iommu_class;
 
 } DPDK_17.05;
 
diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
index af9f0e13f..7a0cfb165 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -55,6 +55,15 @@  extern "C" {
 /** Double linked list of buses */
 TAILQ_HEAD(rte_bus_list, rte_bus);
 
+
+/**
+ * IOVA mapping mode.
+ */
+enum rte_iova_mode {
+	RTE_IOVA_PA = 1,
+	RTE_IOVA_VA
+};
+
 /**
  * Bus specific scan for devices attached on the bus.
  * For each bus object, the scan would be responsible for finding devices and
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 4a485674e..c58361132 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -383,6 +383,17 @@  int
 rte_pci_match(const struct rte_pci_driver *pci_drv,
 	      const struct rte_pci_device *pci_dev);
 
+
+/**
+ * Get iommu class of PCI devices on the bus.
+ * And return their preferred iova mapping mode.
+ *
+ * @return
+ *   - enum rte_iova_mode.
+ */
+enum rte_iova_mode
+rte_pci_get_iommu_class(void);
+
 /**
  * Map the PCI device resources in user space virtual memory address
  *