diff mbox

[v2,10/13] xen/arm: domain_build: Don't expose IOMMU specific properties to the guest

Message ID 1501003615-15274-11-git-send-email-olekstysh@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Oleksandr Tyshchenko July 25, 2017, 5:26 p.m. UTC
From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

We don't passthrough IOMMU device to DOM0 even if it is not used by
Xen. Therefore exposing the properties that describe relationship
between master devices and IOMMUs does not make any sense.

According to the:
1. Documentation/devicetree/bindings/iommu/iommu.txt
2. Documentation/devicetree/bindings/pci/pci-iommu.txt

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
CC: Julien Grall <julien.grall@arm.com>

---
   Changes in v1:
      -

   Changes in v2:
      - Skip optional properties too.
      - Clarify patch description
---
 xen/arch/arm/domain_build.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Julien Grall Aug. 3, 2017, 11:37 a.m. UTC | #1
Hi Oleksandr,

On 25/07/17 18:26, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>
> We don't passthrough IOMMU device to DOM0 even if it is not used by
> Xen. Therefore exposing the properties that describe relationship
> between master devices and IOMMUs does not make any sense.
>
> According to the:
> 1. Documentation/devicetree/bindings/iommu/iommu.txt
> 2. Documentation/devicetree/bindings/pci/pci-iommu.txt
>
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> CC: Julien Grall <julien.grall@arm.com>
>
> ---
>    Changes in v1:
>       -
>
>    Changes in v2:
>       - Skip optional properties too.
>       - Clarify patch description
> ---
>  xen/arch/arm/domain_build.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 3abacc0..fadfbbc 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -432,6 +432,16 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
>              continue;
>          }
>
> +        /* Don't expose IOMMU specific properties to the guest */
> +        if ( dt_property_name_is_equal(prop, "iommus") )
> +            continue;
> +
> +        if ( dt_property_name_is_equal(prop, "iommu-map") )
> +            continue;
> +
> +        if ( dt_property_name_is_equal(prop, "iommu-map-mask") )
> +            continue;
> +

Sadly we don't have some sort of array to blacklist property. This could 
be a good improvement if you have time to look at it.

In any case:

Acked-by: Julien Grall <julien.grall@arm.com>

>          res = fdt_property(kinfo->fdt, prop->name, prop_data, prop_len);
>
>          if ( res )
>

Cheers,
Oleksandr Tyshchenko Aug. 3, 2017, 1:24 p.m. UTC | #2
Hi, Julien

On Thu, Aug 3, 2017 at 2:37 PM, Julien Grall <julien.grall@arm.com> wrote:
> Hi Oleksandr,
>
>
> On 25/07/17 18:26, Oleksandr Tyshchenko wrote:
>>
>> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>
>> We don't passthrough IOMMU device to DOM0 even if it is not used by
>> Xen. Therefore exposing the properties that describe relationship
>> between master devices and IOMMUs does not make any sense.
>>
>> According to the:
>> 1. Documentation/devicetree/bindings/iommu/iommu.txt
>> 2. Documentation/devicetree/bindings/pci/pci-iommu.txt
>>
>> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>> CC: Julien Grall <julien.grall@arm.com>
>>
>> ---
>>    Changes in v1:
>>       -
>>
>>    Changes in v2:
>>       - Skip optional properties too.
>>       - Clarify patch description
>> ---
>>  xen/arch/arm/domain_build.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> index 3abacc0..fadfbbc 100644
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c
>> @@ -432,6 +432,16 @@ static int write_properties(struct domain *d, struct
>> kernel_info *kinfo,
>>              continue;
>>          }
>>
>> +        /* Don't expose IOMMU specific properties to the guest */
>> +        if ( dt_property_name_is_equal(prop, "iommus") )
>> +            continue;
>> +
>> +        if ( dt_property_name_is_equal(prop, "iommu-map") )
>> +            continue;
>> +
>> +        if ( dt_property_name_is_equal(prop, "iommu-map-mask") )
>> +            continue;
>> +
>
>
> Sadly we don't have some sort of array to blacklist property. This could be
> a good improvement if you have time to look at it.
I think, yes. I will have a look when I have free time.

>
> In any case:
>
> Acked-by: Julien Grall <julien.grall@arm.com>
Thank you!

>
>>          res = fdt_property(kinfo->fdt, prop->name, prop_data, prop_len);
>>
>>          if ( res )
>>
>
> Cheers,
>
> --
> Julien Grall
diff mbox

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 3abacc0..fadfbbc 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -432,6 +432,16 @@  static int write_properties(struct domain *d, struct kernel_info *kinfo,
             continue;
         }
 
+        /* Don't expose IOMMU specific properties to the guest */
+        if ( dt_property_name_is_equal(prop, "iommus") )
+            continue;
+
+        if ( dt_property_name_is_equal(prop, "iommu-map") )
+            continue;
+
+        if ( dt_property_name_is_equal(prop, "iommu-map-mask") )
+            continue;
+
         res = fdt_property(kinfo->fdt, prop->name, prop_data, prop_len);
 
         if ( res )