[dpdk-dev] [PATCH] eal: pick IOVA as PA if IOMMU is not available

Burakov, Anatoly anatoly.burakov at intel.com
Thu Jul 25 11:31:33 CEST 2019


On 25-Jul-19 9:05 AM, David Marchand wrote:
> On Wed, Jul 24, 2019 at 6:46 PM Anatoly Burakov
> <anatoly.burakov at intel.com> wrote:
>>
>> When IOMMU is not available, /sys/kernel/iommu_groups will not be
>> populated. This is happening since at least 3.6 when VFIO support
>> was added. If the directory is empty, EAL should not pick IOVA as
>> VA as the default IOVA mode.
>>
>> We also assume that VFIO equals IOMMU, so if VFIO support is not
>> compiled, we always assume IOMMU support is not available.
> 
> Not sure I agree with this statement.
> What about unknown (from eal pov) kernel drivers?

Are there any cases where we can use IOVA as VA mode without having VFIO 
compiled?

> 
> 
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
>> ---
>>   lib/librte_eal/linux/eal/eal.c      | 11 ++++++--
>>   lib/librte_eal/linux/eal/eal_vfio.c | 39 +++++++++++++++++++++++++++++
>>   lib/librte_eal/linux/eal/eal_vfio.h |  2 ++
>>   3 files changed, 50 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
>> index 34db78753..584f97a96 100644
>> --- a/lib/librte_eal/linux/eal/eal.c
>> +++ b/lib/librte_eal/linux/eal/eal.c
>> @@ -1061,8 +1061,15 @@ rte_eal_init(int argc, char **argv)
>>                  enum rte_iova_mode iova_mode = rte_bus_get_iommu_class();
>>
>>                  if (iova_mode == RTE_IOVA_DC) {
>> -                       iova_mode = RTE_IOVA_VA;
>> -                       RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode, select IOVA as VA mode.\n");
>> +                       /* if we have an IOMMU, pick IOVA as VA mode */
>> +                       if (vfio_iommu_enabled()) {
>> +                               iova_mode = RTE_IOVA_VA;
>> +                               RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode, selecting IOVA as VA mode.\n");
>> +                       } else {
>> +                               iova_mode = RTE_IOVA_PA;
>> +                               RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode, but IOMMU is not available.\n");
>> +                               RTE_LOG(DEBUG, EAL, "Selecting IOVA as PA mode.\n");
>> +                       }
> 
> Here, since the buses don't care, we can check for physical address
> availability.
> 

Good point, if PA are not available, we can't use IOVA as PA mode.

-- 
Thanks,
Anatoly


More information about the dev mailing list