From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 4/4] Hack around IOMMU changes Date: Wed, 26 May 2010 09:40:13 +0200 Message-ID: <4BFCD05D.4000603@web.de> References: <4BFC974D.8010206@redhat.com> <4BFC9765.6070200@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig6D70FC64605F116CAD2CABD1" Cc: kvm , Avi Kivity , Gleb Natapov To: Zachary Amsden Return-path: Received: from fmmailgate01.web.de ([217.72.192.221]:45805 "EHLO fmmailgate01.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932728Ab0EZHkP (ORCPT ); Wed, 26 May 2010 03:40:15 -0400 In-Reply-To: <4BFC9765.6070200@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig6D70FC64605F116CAD2CABD1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Zachary Amsden wrote: > On 05/25/2010 05:36 PM, Zachary Amsden wrote: >> Not for the faint of heart, this patch subverts the code by >> reassigning a local variable from a macro. > This time, with patch. >=20 >=20 > From 97b9230f699aba1c5f47972032b2d4d935a83054 Mon Sep 17 00:00:00 2001 > From: Zachary Amsden > Date: Tue, 25 May 2010 17:17:32 -1000 > Subject: [PATCH 4/5] IOMMU API changed >=20 > Ugly, dirty, disease ridden fix for IOMMU changes; the module > is now trying to use larger IOMMU intervals; deny it this, and > stick to page size. This requires forcibly setting page_size > variable through knowledge of the code. Yuck. If you have a > better solution, implement it. >=20 > Signed-off-by: Zachary Amsden > --- > external-module-compat-comm.h | 12 ++++++++++++ > 1 files changed, 12 insertions(+), 0 deletions(-) >=20 > diff --git a/external-module-compat-comm.h b/external-module-compat-com= m.h > index c5284e5..708019e 100644 > --- a/external-module-compat-comm.h > +++ b/external-module-compat-comm.h > @@ -1128,3 +1128,15 @@ perf_unregister_guest_info_callbacks(struct perf= _guest_info_callbacks *cbs) > #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) > #define lockdep_is_held(m) (1) > #endif > + > +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) > +/* This is a dirty, nasty trick */ > +#define iommu_map(domain, iova, paddr, gfp_order, prot) \ > +({ \ > + int _r =3D iommu_map_range(domain, iova, paddr, PAGE_SIZE, prot); \ This should be (PAGE_SIZE << gfp_order) according to my current understanding. > + page_size =3D PAGE_SIZE; \ And what is this for? > + _r; \ > +}) > +#define iommu_unmap(domain, iova, gfp_order) \ > + (iommu_unmap_range(domain, iova, PAGE_SIZE),1) > +#endif > -- 1.7.0.1=20 Besides that, putting this under CONFIG_IOMMU_API and making the functions static inline would be preferred. Jan --------------enig6D70FC64605F116CAD2CABD1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkv80F0ACgkQitSsb3rl5xRKdgCdEuazY5RAlUNotuhBUxz3mHN3 fRAAnikoE0h6DnBsduWR/Y2k8eh5qgye =Ro9E -----END PGP SIGNATURE----- --------------enig6D70FC64605F116CAD2CABD1--