diff mbox series

[v4,10/15] intel-iommu: Implement IOMMU_ATTR_MAX_IOVA get_attr() attribute

Message ID 20230622214845.3980-11-joao.m.martins@oracle.com (mailing list archive)
State New, archived
Headers show
Series vfio: VFIO migration support with vIOMMU | expand

Commit Message

Joao Martins June 22, 2023, 9:48 p.m. UTC
From: Avihai Horon <avihaih@nvidia.com>

Implement get_attr() method and use the address width property to report
the IOMMU_ATTR_MAX_IOVA attribute.

Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
 hw/i386/intel_iommu.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Avihai Horon July 9, 2023, 3:17 p.m. UTC | #1
On 23/06/2023 0:48, Joao Martins wrote:
> External email: Use caution opening links or attachments
>
>
> From: Avihai Horon <avihaih@nvidia.com>
>
> Implement get_attr() method and use the address width property to report
> the IOMMU_ATTR_MAX_IOVA attribute.

Nit: get_attr() method was already implemented in patch #6.
Maybe just "Use address width property to report IOMMU_ATTR_MAX_IOVA 
attribute"?

Thanks.

>
> Signed-off-by: Avihai Horon <avihaih@nvidia.com>
> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
> ---
>   hw/i386/intel_iommu.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> index ed2a46e008df..989993e303a6 100644
> --- a/hw/i386/intel_iommu.c
> +++ b/hw/i386/intel_iommu.c
> @@ -3876,6 +3876,13 @@ static int vtd_iommu_get_attr(IOMMUMemoryRegion *iommu_mr,
>           *enabled = s->dma_translation;
>           break;
>       }
> +    case IOMMU_ATTR_MAX_IOVA:
> +    {
> +        hwaddr *max_iova = (hwaddr *)(uintptr_t) data;
> +
> +        *max_iova = MAKE_64BIT_MASK(0, s->aw_bits);;
> +        break;
> +    }
>       default:
>           ret = -EINVAL;
>           break;
> --
> 2.17.2
>
Joao Martins July 10, 2023, 1:44 p.m. UTC | #2
On 09/07/2023 16:17, Avihai Horon wrote:
> 
> On 23/06/2023 0:48, Joao Martins wrote:
>> External email: Use caution opening links or attachments
>>
>>
>> From: Avihai Horon <avihaih@nvidia.com>
>>
>> Implement get_attr() method and use the address width property to report
>> the IOMMU_ATTR_MAX_IOVA attribute.
> 
> Nit: get_attr() method was already implemented in patch #6.
> Maybe just "Use address width property to report IOMMU_ATTR_MAX_IOVA attribute"?
> 
Yeap, makes sense.

> Thanks.
> 
>>
>> Signed-off-by: Avihai Horon <avihaih@nvidia.com>
>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>> ---
>>   hw/i386/intel_iommu.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
>> index ed2a46e008df..989993e303a6 100644
>> --- a/hw/i386/intel_iommu.c
>> +++ b/hw/i386/intel_iommu.c
>> @@ -3876,6 +3876,13 @@ static int vtd_iommu_get_attr(IOMMUMemoryRegion *iommu_mr,
>>           *enabled = s->dma_translation;
>>           break;
>>       }
>> +    case IOMMU_ATTR_MAX_IOVA:
>> +    {
>> +        hwaddr *max_iova = (hwaddr *)(uintptr_t) data;
>> +
>> +        *max_iova = MAKE_64BIT_MASK(0, s->aw_bits);;
>> +        break;
>> +    }
>>       default:
>>           ret = -EINVAL;
>>           break;
>> -- 
>> 2.17.2
>>
Cédric Le Goater Oct. 2, 2023, 3:42 p.m. UTC | #3
On 7/10/23 15:44, Joao Martins wrote:
> 
> 
> On 09/07/2023 16:17, Avihai Horon wrote:
>>
>> On 23/06/2023 0:48, Joao Martins wrote:
>>> External email: Use caution opening links or attachments
>>>
>>>
>>> From: Avihai Horon <avihaih@nvidia.com>
>>>
>>> Implement get_attr() method and use the address width property to report
>>> the IOMMU_ATTR_MAX_IOVA attribute.
>>
>> Nit: get_attr() method was already implemented in patch #6.
>> Maybe just "Use address width property to report IOMMU_ATTR_MAX_IOVA attribute"?
>>
> Yeap, makes sense.

I would merge with the previous patch also.

> 
>> Thanks.
>>
>>>
>>> Signed-off-by: Avihai Horon <avihaih@nvidia.com>
>>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>>> ---
>>>    hw/i386/intel_iommu.c | 7 +++++++
>>>    1 file changed, 7 insertions(+)
>>>
>>> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
>>> index ed2a46e008df..989993e303a6 100644
>>> --- a/hw/i386/intel_iommu.c
>>> +++ b/hw/i386/intel_iommu.c
>>> @@ -3876,6 +3876,13 @@ static int vtd_iommu_get_attr(IOMMUMemoryRegion *iommu_mr,
>>>            *enabled = s->dma_translation;
>>>            break;
>>>        }
>>> +    case IOMMU_ATTR_MAX_IOVA:
>>> +    {
>>> +        hwaddr *max_iova = (hwaddr *)(uintptr_t) data;
>>> +
>>> +        *max_iova = MAKE_64BIT_MASK(0, s->aw_bits);;

one ; is enough.

Thanks,

C.

>>> +        break;
>>> +    }
>>>        default:
>>>            ret = -EINVAL;
>>>            break;
>>> -- 
>>> 2.17.2
>>>
>
Joao Martins Oct. 6, 2023, 8:43 a.m. UTC | #4
On 02/10/2023 16:42, Cédric Le Goater wrote:
> On 7/10/23 15:44, Joao Martins wrote:
>>
>>
>> On 09/07/2023 16:17, Avihai Horon wrote:
>>>
>>> On 23/06/2023 0:48, Joao Martins wrote:
>>>> External email: Use caution opening links or attachments
>>>>
>>>>
>>>> From: Avihai Horon <avihaih@nvidia.com>
>>>>
>>>> Implement get_attr() method and use the address width property to report
>>>> the IOMMU_ATTR_MAX_IOVA attribute.
>>>
>>> Nit: get_attr() method was already implemented in patch #6.
>>> Maybe just "Use address width property to report IOMMU_ATTR_MAX_IOVA attribute"?
>>>
>> Yeap, makes sense.
> 
> I would merge with the previous patch also.
> 

OK

>>
>>> Thanks.
>>>
>>>>
>>>> Signed-off-by: Avihai Horon <avihaih@nvidia.com>
>>>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>>>> ---
>>>>    hw/i386/intel_iommu.c | 7 +++++++
>>>>    1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
>>>> index ed2a46e008df..989993e303a6 100644
>>>> --- a/hw/i386/intel_iommu.c
>>>> +++ b/hw/i386/intel_iommu.c
>>>> @@ -3876,6 +3876,13 @@ static int vtd_iommu_get_attr(IOMMUMemoryRegion
>>>> *iommu_mr,
>>>>            *enabled = s->dma_translation;
>>>>            break;
>>>>        }
>>>> +    case IOMMU_ATTR_MAX_IOVA:
>>>> +    {
>>>> +        hwaddr *max_iova = (hwaddr *)(uintptr_t) data;
>>>> +
>>>> +        *max_iova = MAKE_64BIT_MASK(0, s->aw_bits);;
> 
> one ; is enough.
> 
Oh, spurious one, let me remove it.

> Thanks,
> 
> C.
> 
>>>> +        break;
>>>> +    }
>>>>        default:
>>>>            ret = -EINVAL;
>>>>            break;
>>>> -- 
>>>> 2.17.2
>>>>
>>
>
diff mbox series

Patch

diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index ed2a46e008df..989993e303a6 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3876,6 +3876,13 @@  static int vtd_iommu_get_attr(IOMMUMemoryRegion *iommu_mr,
         *enabled = s->dma_translation;
         break;
     }
+    case IOMMU_ATTR_MAX_IOVA:
+    {
+        hwaddr *max_iova = (hwaddr *)(uintptr_t) data;
+
+        *max_iova = MAKE_64BIT_MASK(0, s->aw_bits);;
+        break;
+    }
     default:
         ret = -EINVAL;
         break;