[Xen-devel] [PATCH V3 6/8] iommu: Add of_xlate callback

Oleksandr Tyshchenko posted 8 patches 6 years, 5 months ago
There is a newer version of this series
[Xen-devel] [PATCH V3 6/8] iommu: Add of_xlate callback
Posted by Oleksandr Tyshchenko 6 years, 5 months ago
From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

According to the generic IOMMU DT bindings [1] the context of
required properties for IOMMU device/master node (#iommu-cells, iommus)
depends on many factors and is really driver depended thing.

We need some way to provide the driver with DT IOMMU specifier which
describes the IOMMU master interfaces of that device (device IDs, etc)
to let it decide how to interpret them. For that reason we can borrow
Linux's "of_xlate" callback.

All IOMMU drivers which support generic IOMMU DT bindings should use
this callback.

Subsequent patches will use of that support.

[1] https://www.kernel.org/doc/Documentation/devicetree/bindings/iommu/iommu.txt

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
CC: Julien Grall <julien.grall@arm.com>
CC: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/iommu.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 48f8748..79b86ac 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -240,6 +240,16 @@ struct iommu_ops {
     int __must_check (*iotlb_flush_all)(struct domain *d);
     int (*get_reserved_device_memory)(iommu_grdm_t *, void *);
     void (*dump_p2m_table)(struct domain *d);
+
+#ifdef CONFIG_HAS_DEVICE_TREE
+    /*
+     * All IOMMU drivers which support generic IOMMU DT bindings should use
+     * this callback. This is a way for the framework to provide the driver
+     * with DT IOMMU specifier which describes the IOMMU master interfaces of
+     * that device (device IDs, etc).
+     */
+    int (*of_xlate)(device_t *dev, struct dt_phandle_args *args);
+#endif
 };
 
 #include <asm/iommu.h>
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH V3 6/8] iommu: Add of_xlate callback
Posted by Jan Beulich 6 years, 5 months ago
On 20.08.2019 20:09, Oleksandr Tyshchenko wrote:
> --- a/xen/include/xen/iommu.h
> +++ b/xen/include/xen/iommu.h
> @@ -240,6 +240,16 @@ struct iommu_ops {
>       int __must_check (*iotlb_flush_all)(struct domain *d);
>       int (*get_reserved_device_memory)(iommu_grdm_t *, void *);
>       void (*dump_p2m_table)(struct domain *d);
> +
> +#ifdef CONFIG_HAS_DEVICE_TREE
> +    /*
> +     * All IOMMU drivers which support generic IOMMU DT bindings should use
> +     * this callback. This is a way for the framework to provide the driver
> +     * with DT IOMMU specifier which describes the IOMMU master interfaces of
> +     * that device (device IDs, etc).
> +     */
> +    int (*of_xlate)(device_t *dev, struct dt_phandle_args *args);
> +#endif
>   };

I think this should be folded into the first patch using it. Doing
so may also answer my question of what "of" here stands for.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH V3 6/8] iommu: Add of_xlate callback
Posted by Oleksandr 6 years, 5 months ago
Hi Jan

> On 20.08.2019 20:09, Oleksandr Tyshchenko wrote:
>> --- a/xen/include/xen/iommu.h
>> +++ b/xen/include/xen/iommu.h
>> @@ -240,6 +240,16 @@ struct iommu_ops {
>>       int __must_check (*iotlb_flush_all)(struct domain *d);
>>       int (*get_reserved_device_memory)(iommu_grdm_t *, void *);
>>       void (*dump_p2m_table)(struct domain *d);
>> +
>> +#ifdef CONFIG_HAS_DEVICE_TREE
>> +    /*
>> +     * All IOMMU drivers which support generic IOMMU DT bindings 
>> should use
>> +     * this callback. This is a way for the framework to provide the 
>> driver
>> +     * with DT IOMMU specifier which describes the IOMMU master 
>> interfaces of
>> +     * that device (device IDs, etc).
>> +     */
>> +    int (*of_xlate)(device_t *dev, struct dt_phandle_args *args);
>> +#endif
>>   };
>
> I think this should be folded into the first patch using it. Doing
> so may also answer my question of what "of" here stands for.

In Linux, code related to the device-tree is prefixed with "of_". But, 
in Xen, code related to the device-tree is prefixed with "dt_" [1]. 
Looks like, I should have named it "dt_xlate" to be consistent.
There was a preference to introduce callback in a separate patch [2]. 
Anyway, shall I fold it?


[1] 
https://github.com/xen-project/xen/blob/master/xen/include/xen/device_tree.h
[2] 
https://lists.xenproject.org/archives/html/xen-devel/2019-08/msg01393.html


-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH V3 6/8] iommu: Add of_xlate callback
Posted by Jan Beulich 6 years, 5 months ago
On 27.08.2019 16:59, Oleksandr wrote:
> There was a preference to introduce callback in a separate patch [2]. Anyway, shall I fold it?

Hmm, I disagree with Julien here. I don't think we should have unused
hooks in the tree, not even intermediately.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH V3 6/8] iommu: Add of_xlate callback
Posted by Julien Grall 6 years, 5 months ago
Hi,

On 8/27/19 4:11 PM, Jan Beulich wrote:
> On 27.08.2019 16:59, Oleksandr wrote:
>> There was a preference to introduce callback in a separate patch [2]. 
>> Anyway, shall I fold it?
> 
> Hmm, I disagree with Julien here. I don't think we should have unused
> hooks in the tree, not even intermediately.

I have stated my preference before, but this is not a strong one nor a 
must. If this is your condition to get the series accepted, then 
Oleksandr should follow your requested.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH V3 6/8] iommu: Add of_xlate callback
Posted by Oleksandr 6 years, 5 months ago
On 09.09.19 15:37, Julien Grall wrote:
> Hi,

Hi, all.


>
>
> On 8/27/19 4:11 PM, Jan Beulich wrote:
>> On 27.08.2019 16:59, Oleksandr wrote:
>>> There was a preference to introduce callback in a separate patch 
>>> [2]. Anyway, shall I fold it?
>>
>> Hmm, I disagree with Julien here. I don't think we should have unused
>> hooks in the tree, not even intermediately.
>
> I have stated my preference before, but this is not a strong one nor a 
> must. If this is your condition to get the series accepted, then 
> Oleksandr should follow your requested.

Will fold it as requested. And will rename callback to "dt_xlate".


>
> Cheers,
>
-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel