From: Wei Wang2 Subject: RE: [PATCH 1/5] AMD IOMMU: bug fix and code cleanup Date: Thu, 31 Jul 2008 15:37:21 +0200 Message-ID: <1217511441.27350.131.camel@osrc57.amd.com> References: <1217507265.27350.121.camel@osrc57.amd.com> <0B53E02A2965CE4F9ADB38B34501A3A10840A68C@orsmsx505.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-+Z70LF0NzgfcR5j/glGq" Return-path: In-Reply-To: <0B53E02A2965CE4F9ADB38B34501A3A10840A68C@orsmsx505.amr.corp.intel.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: "Nakajima, Jun" Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org --=-+Z70LF0NzgfcR5j/glGq Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thu, 2008-07-31 at 06:25 -0700, Nakajima, Jun wrote:=20 > On 7/31/2008 5:27:45 AM, Wei Wang2 wrote: > > init.patch: Since device id covered by each iommu can never overlap, > > use a global device table instead of allocating private tables for > > each iommu. Migrate a few functions from pci_amd_iommu.c > > > > -Wei >=20 > +void __init enable_iommu(struct amd_iommu *iommu) > +{ > + unsigned long flags; > + > spin_lock_irqsave(&iommu->lock, flags); >=20 > - amd_iommu_msi_data_init (iommu, vector); > + if ( iommu->enabled ) > + return; >=20 > I just scanned the code for a second, but you might want to add > spin_unlock_irqrestore(&iommu->lock, flags) before returning? Yes, that is a bug, attached is a fix for that, Thanks a lot -Wei Signed-off-by: Wei Wang --=20 AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Gesch=C3=A4ftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplement=C3=A4r: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Gesch=C3=A4ftsf=C3=BChrer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy=20 >=20 > > > > Signed-off-by: Wei Wang > > -- > > AMD Saxony, Dresden, Germany > > Operating System Research Center > > > > Legal Information: > > AMD Saxony Limited Liability Company & Co. KG Sitz (Gesch=C3=A4ftsansch= rift): > > Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht > > Dresden: HRA 4896 vertretungsberechtigter Komplement=C3=A4r: AMD Saxony= LLC > > (Sitz Wilmington, Delaware, USA) Gesch=C3=A4ftsf=C3=BChrer der AMD Saxo= ny LLC: Dr. > > Hans-R. Deppe, Thomas McCoy > . > Jun Nakajima | Intel Open Source Technology Center --=-+Z70LF0NzgfcR5j/glGq Content-Disposition: attachment; filename="fix.patch" Content-Type: text/x-patch; name="fix.patch"; charset="utf-8" Content-Transfer-Encoding: 7bit diff -r 09ee974e722f xen/drivers/passthrough/amd/iommu_init.c --- a/xen/drivers/passthrough/amd/iommu_init.c Thu Jul 31 13:37:29 2008 +0100 +++ b/xen/drivers/passthrough/amd/iommu_init.c Thu Jul 31 15:34:03 2008 +0200 @@ -477,7 +477,10 @@ void __init enable_iommu(struct amd_iomm spin_lock_irqsave(&iommu->lock, flags); if ( iommu->enabled ) - return; + { + spin_unlock_irqrestore(&iommu->lock, flags); + return; + } iommu->dev_table.alloc_size = device_table.alloc_size; iommu->dev_table.entries = device_table.entries; --=-+Z70LF0NzgfcR5j/glGq Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-+Z70LF0NzgfcR5j/glGq--