amd iommu: Fix a return value of guest_iommu_set_base()
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
@@ -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 ;
Quoted 16 lines
Quoted 1 line
Quoted 1 line · Wei Wang
# HG changeset patch
# User Wei Wang <[email protected]>
# Date 1328282938 -3600
# Node ID58a2281581a4c4171ca52549b3e8062b9733ec2b# Parent3432abcf9380d3840ca38439a304f74a37d155fcamd iommu: Fix a return value ofguest_iommu_set_base()Remove a unnecessary check inguest_iommu_destroy()Signed-off-by Wei Wang <[email protected]>diff -r
3432abcf9380-r58a2281581a4xen/drivers/passthrough/amd/iommu_guest.cxen/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
-3if ( !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 ;
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 ID58a2281581a4c4171ca52549b3e8062b9733ec2b# Parent3432abcf9380d3840ca38439a304f74a37d155fcamd iommu: Fix a return value ofguest_iommu_set_base()Remove a unnecessary check inguest_iommu_destroy()Signed-off-by Wei Wang<[email protected]>diff -r
3432abcf9380-r58a2281581a4xen/drivers/passthrough/amd/iommu_guest.cxen/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
-1if ( !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
-3if ( !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 ;