Skip to contentSkip to conversation

amd iommu: Fix a return value of guest_iommu_set_base()

PATCH In review Wei Wang 2 participants 3 messages Feb 3, 2012 – Feb 6, 2012

lore
Share & tools
lore

Wei Wang

author
#0 lore raw

PATCH 1/1 amd iommu: Fix a return value of guest_iommu_set_base()

# HG changeset patch
# User Wei Wang <[email protected]>
# 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()

xen/drivers/passthrough/amd/iommu_guest.c +1 -4
diff -r 3432abcf9380 -r 58a2281581a4 xen/drivers/passthrough/amd/iommu_guest.c
@@ -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;
#1 lore raw
Quoted 16 lines
Quoted 1 line
Quoted 1 line · Wei Wang

# HG changeset patch
# User Wei Wang <[email protected]>
# 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()

diff -r 3432abcf9380 -r 58a2281581a4 xen/drivers/passthrough/amd/iommu_guest.c

xen/drivers/passthrough/amd/iommu_guest.c +1 -0
+0100

xen/drivers/passthrough/amd/iommu_guest.c int guest_iommu_set_base(struct domain * · line 809

Quoted 5 lines
xen/drivers/passthrough/amd/iommu_guest.c +1 -1
@@ -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

Quoted 13 lines
xen/drivers/passthrough/amd/iommu_guest.c +0 -3
     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;
author
#2 lore raw
Quoted 18 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · Wei Wang

# HG changeset patch
# User Wei Wang<[email protected]>
# 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()

diff -r 3432abcf9380 -r 58a2281581a4 xen/drivers/passthrough/amd/iommu_guest.c

xen/drivers/passthrough/amd/iommu_guest.c +1 -0
+0100
@@ -806,7 +806,7 @@ int guest_iommu_set_base(struct domain *
      struct guest_iommu *iommu = domain_iommu(d);
 
Quoted 7 lines

xen/drivers/passthrough/amd/iommu_guest.c int guest_iommu_set_base(struct domain * · line 809

Quoted 3 lines
xen/drivers/passthrough/amd/iommu_guest.c +1 -1
      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

Quoted 19 lines

Jan

Quoted 13 lines
xen/drivers/passthrough/amd/iommu_guest.c +0 -3
      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;