xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] amd iommu: Fix a return value of guest_iommu_set_base()
@ 2012-02-03 15:29 Wei Wang
  2012-02-03 16:35 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Wang @ 2012-02-03 15:29 UTC (permalink / raw)
  To: JBeulich, Ian.Campbell, Ian.Jackson, keir; +Cc: xen-devel

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1328282938 -3600
# Node ID 58a2281581a4c4171ca52549b3e8062b9733ec2b
# Parent  3432abcf9380d3840ca38439a304f74a37d155fc
amd iommu: Fix a return value of guest_iommu_set_base()
Remove a unnecessary check in guest_iommu_destroy()

Signed-off-by: Wei Wang <wei.wang2@amd.com>

diff -r 3432abcf9380 -r 58a2281581a4 xen/drivers/passthrough/amd/iommu_guest.c
--- a/xen/drivers/passthrough/amd/iommu_guest.c	Thu Feb 02 15:47:26 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_guest.c	Fri Feb 03 16:28:58 2012 +0100
@@ -806,7 +806,7 @@ int guest_iommu_set_base(struct domain *
     struct guest_iommu *iommu = domain_iommu(d);
 
     if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
-        return 0;
+        return -EACCES;
 
     if ( !iommu )
         return -EACCES;
@@ -896,9 +896,6 @@ void guest_iommu_destroy(struct domain *
 {
     struct guest_iommu *iommu;
 
-    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
-        return;
-
     iommu = domain_iommu(d);
     if ( !iommu )
         return;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] amd iommu: Fix a return value of guest_iommu_set_base()
  2012-02-03 15:29 [PATCH] amd iommu: Fix a return value of guest_iommu_set_base() Wei Wang
@ 2012-02-03 16:35 ` Jan Beulich
  2012-02-06 12:29   ` Wei Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2012-02-03 16:35 UTC (permalink / raw)
  To: Wei Wang; +Cc: keir, xen-devel, Ian.Jackson, Ian.Campbell

>>> On 03.02.12 at 16:29, Wei Wang <wei.wang2@amd.com> wrote:
> # HG changeset patch
> # User Wei Wang <wei.wang2@amd.com>
> # Date 1328282938 -3600
> # Node ID 58a2281581a4c4171ca52549b3e8062b9733ec2b
> # Parent  3432abcf9380d3840ca38439a304f74a37d155fc
> amd iommu: Fix a return value of guest_iommu_set_base()
> Remove a unnecessary check in guest_iommu_destroy()
> 
> Signed-off-by: Wei Wang <wei.wang2@amd.com>
> 
> diff -r 3432abcf9380 -r 58a2281581a4 xen/drivers/passthrough/amd/iommu_guest.c
> --- a/xen/drivers/passthrough/amd/iommu_guest.c	Thu Feb 02 15:47:26 2012 +0000
> +++ b/xen/drivers/passthrough/amd/iommu_guest.c	Fri Feb 03 16:28:58 2012 
> +0100
> @@ -806,7 +806,7 @@ int guest_iommu_set_base(struct domain *
>      struct guest_iommu *iommu = domain_iommu(d);
>  
>      if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
> -        return 0;
> +        return -EACCES;

But as indicated before, all three checks above are redundant with
the one check below. Hence I suggested to remove the checks above,
and if you wish put an ASSERT() past the !iommu check below.

Jan

>  
>      if ( !iommu )
>          return -EACCES;
> @@ -896,9 +896,6 @@ void guest_iommu_destroy(struct domain *
>  {
>      struct guest_iommu *iommu;
>  
> -    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
> -        return;
> -
>      iommu = domain_iommu(d);
>      if ( !iommu )
>          return;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] amd iommu: Fix a return value of guest_iommu_set_base()
  2012-02-03 16:35 ` Jan Beulich
@ 2012-02-06 12:29   ` Wei Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Wang @ 2012-02-06 12:29 UTC (permalink / raw)
  To: Jan Beulich; +Cc: keir, xen-devel, Ian.Jackson, Ian.Campbell

On 02/03/2012 05:35 PM, Jan Beulich wrote:
>>>> On 03.02.12 at 16:29, Wei Wang<wei.wang2@amd.com>  wrote:
>> # HG changeset patch
>> # User Wei Wang<wei.wang2@amd.com>
>> # Date 1328282938 -3600
>> # Node ID 58a2281581a4c4171ca52549b3e8062b9733ec2b
>> # Parent  3432abcf9380d3840ca38439a304f74a37d155fc
>> amd iommu: Fix a return value of guest_iommu_set_base()
>> Remove a unnecessary check in guest_iommu_destroy()
>>
>> Signed-off-by: Wei Wang<wei.wang2@amd.com>
>>
>> diff -r 3432abcf9380 -r 58a2281581a4 xen/drivers/passthrough/amd/iommu_guest.c
>> --- a/xen/drivers/passthrough/amd/iommu_guest.c	Thu Feb 02 15:47:26 2012 +0000
>> +++ b/xen/drivers/passthrough/amd/iommu_guest.c	Fri Feb 03 16:28:58 2012
>> +0100
>> @@ -806,7 +806,7 @@ int guest_iommu_set_base(struct domain *
>>       struct guest_iommu *iommu = domain_iommu(d);
>>
>>       if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
>> -        return 0;
>> +        return -EACCES;
>
> But as indicated before, all three checks above are redundant with
> the one check below. Hence I suggested to remove the checks above,
> and if you wish put an ASSERT() past the !iommu check below.

OK,then I remove them all. I will send a new thread for the patch.
Thanks,
Wei

> Jan
>
>>
>>       if ( !iommu )
>>           return -EACCES;
>> @@ -896,9 +896,6 @@ void guest_iommu_destroy(struct domain *
>>   {
>>       struct guest_iommu *iommu;
>>
>> -    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
>> -        return;
>> -
>>       iommu = domain_iommu(d);
>>       if ( !iommu )
>>           return;
>
>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-06 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-03 15:29 [PATCH] amd iommu: Fix a return value of guest_iommu_set_base() Wei Wang
2012-02-03 16:35 ` Jan Beulich
2012-02-06 12:29   ` Wei Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).