diff mbox

[v2,08/13] iommu/arm: Misc fixes for arch specific part

Message ID 1501003615-15274-9-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>

1. Add missing return in case if IOMMU ops have been already set.
2. Add check for shared IOMMU before returning an error.

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

---
   Changes in V1:
      -

   Changes in V2:
      -
---
 xen/drivers/passthrough/arm/iommu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

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

On 25/07/17 18:26, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>
> 1. Add missing return in case if IOMMU ops have been already set.
> 2. Add check for shared IOMMU before returning an error.

Technically 1. is a fix, 2. is a new feature as sharing IOMMU is not 
supported today. I am ok for you to keep both in the same patch this 
time, but in the future please avoid mixing fixes and new feature.

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

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

On Thu, Aug 3, 2017 at 2:31 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>
>>
>> 1. Add missing return in case if IOMMU ops have been already set.
>> 2. Add check for shared IOMMU before returning an error.
>
>
> Technically 1. is a fix, 2. is a new feature as sharing IOMMU is not
> supported today. I am ok for you to keep both in the same patch this time,
> but in the future please avoid mixing fixes and new feature.
ok

>
> Reviewed-by: Julien Grall <julien.grall@arm.com>
Thank you!

>
> Cheers,
>
> --
> Julien Grall
diff mbox

Patch

diff --git a/xen/drivers/passthrough/arm/iommu.c b/xen/drivers/passthrough/arm/iommu.c
index 95b1abb..6f01c13 100644
--- a/xen/drivers/passthrough/arm/iommu.c
+++ b/xen/drivers/passthrough/arm/iommu.c
@@ -32,7 +32,10 @@  void __init iommu_set_ops(const struct iommu_ops *ops)
     BUG_ON(ops == NULL);
 
     if ( iommu_ops && iommu_ops != ops )
+    {
         printk("WARNING: Cannot set IOMMU ops, already set to a different value\n");
+        return;
+    }
 
     iommu_ops = ops;
 }
@@ -70,6 +73,6 @@  void arch_iommu_domain_destroy(struct domain *d)
 
 int arch_iommu_populate_page_table(struct domain *d)
 {
-    /* The IOMMU shares the p2m with the CPU */
-    return -ENOSYS;
+    /* Return an error if the IOMMU shares the p2m with the CPU */
+    return iommu_use_hap_pt(d) ? -ENOSYS : 0;
 }