From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Wang Subject: Re: [PATCH] amd iommu: Fix a return value of guest_iommu_set_base() Date: Mon, 6 Feb 2012 13:29:33 +0100 Message-ID: <4F2FC7AD.5080300@amd.com> References: <58a2281581a4c4171ca5.1328282951@gran.amd.com> <4F2C1ADC0200007800071232@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4F2C1ADC0200007800071232@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich Cc: keir@xen.org, xen-devel@lists.xensource.com, Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org On 02/03/2012 05:35 PM, Jan Beulich wrote: >>>> On 03.02.12 at 16:29, Wei Wang wrote: >> # HG changeset patch >> # User Wei Wang >> # 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 >> >> 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; > > > >