diff mbox

[Xen-devel,RFC,13/19] xen/iommu: arm: Wire iommu DOMCTL for ARM

Message ID 1402935486-29136-14-git-send-email-julien.grall@linaro.org
State Superseded, archived
Headers show

Commit Message

Julien Grall June 16, 2014, 4:18 p.m. UTC
The call iommu_do_domctl is similar as the x86 one. Move this code to
the common code and protected by HAS_PASSTHROUGH.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Keir Fraser <keir@xen.org>
Cc: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domctl.c |    2 +-
 xen/common/domctl.c   |    4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Jan Beulich June 17, 2014, 8:24 a.m. UTC | #1
>>> On 16.06.14 at 18:18, <julien.grall@linaro.org> wrote:
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -1320,7 +1320,7 @@ long arch_do_domctl(
>      break;
>  
>      default:
> -        ret = iommu_do_domctl(domctl, d, u_domctl);
> +        ret = -ENOSYS;
>          break;
>      }
>  
> diff --git a/xen/common/domctl.c b/xen/common/domctl.c
> index 5d3ac87..85866b7 100644
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -1028,6 +1028,10 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
>  
>      default:
>          ret = arch_do_domctl(op, d, u_domctl);
> +#ifdef HAS_PASSTHROUGH
> +        if ( ret == -ENOSYS )
> +            ret = iommu_do_domctl(op, d, u_domctl);
> +#endif
>          break;
>      }
>  

To be honest I'm not convinced of this approach. I'd prefer ARM's
arch_do_domctl() to invoke iommu_do_domctl() just like x86's does.
In particular I'm neither in favor of checking for specific error codes
before chaining, nor do I think that - despite there being a number
of such cases in the tree - ENOSYS is the right error value for not
implemented sub-hypercalls (to me only top level hypercalls may
produce this).

Jan
Julien Grall June 17, 2014, 1:05 p.m. UTC | #2
Hi Jan,

On 06/17/2014 09:24 AM, Jan Beulich wrote:
>>>> On 16.06.14 at 18:18, <julien.grall@linaro.org> wrote:
>> --- a/xen/arch/x86/domctl.c
>> +++ b/xen/arch/x86/domctl.c
>> @@ -1320,7 +1320,7 @@ long arch_do_domctl(
>>      break;
>>  
>>      default:
>> -        ret = iommu_do_domctl(domctl, d, u_domctl);
>> +        ret = -ENOSYS;
>>          break;
>>      }
>>  
>> diff --git a/xen/common/domctl.c b/xen/common/domctl.c
>> index 5d3ac87..85866b7 100644
>> --- a/xen/common/domctl.c
>> +++ b/xen/common/domctl.c
>> @@ -1028,6 +1028,10 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
>>  
>>      default:
>>          ret = arch_do_domctl(op, d, u_domctl);
>> +#ifdef HAS_PASSTHROUGH
>> +        if ( ret == -ENOSYS )
>> +            ret = iommu_do_domctl(op, d, u_domctl);
>> +#endif
>>          break;
>>      }
>>  
> 
> To be honest I'm not convinced of this approach. I'd prefer ARM's
> arch_do_domctl() to invoke iommu_do_domctl() just like x86's does.
> In particular I'm neither in favor of checking for specific error codes
> before chaining, nor do I think that - despite there being a number
> of such cases in the tree - ENOSYS is the right error value for not
> implemented sub-hypercalls (to me only top level hypercalls may
> produce this).

Ok. I will add the iommu_do_domctl call directh in arch_do_domctl.

Regards,
diff mbox

Patch

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 437ba11..ffecc15 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1320,7 +1320,7 @@  long arch_do_domctl(
     break;
 
     default:
-        ret = iommu_do_domctl(domctl, d, u_domctl);
+        ret = -ENOSYS;
         break;
     }
 
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 5d3ac87..85866b7 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -1028,6 +1028,10 @@  long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
 
     default:
         ret = arch_do_domctl(op, d, u_domctl);
+#ifdef HAS_PASSTHROUGH
+        if ( ret == -ENOSYS )
+            ret = iommu_do_domctl(op, d, u_domctl);
+#endif
         break;
     }