All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Zachary Amsden <zamsden@redhat.com>
Cc: kvm <kvm@vger.kernel.org>, Avi Kivity <avi@redhat.com>,
	Gleb Natapov <gleb@redhat.com>
Subject: Re: [PATCH 4/4] Hack around IOMMU changes
Date: Wed, 26 May 2010 09:40:13 +0200	[thread overview]
Message-ID: <4BFCD05D.4000603@web.de> (raw)
In-Reply-To: <4BFC9765.6070200@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1934 bytes --]

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.
> 
> 
> From 97b9230f699aba1c5f47972032b2d4d935a83054 Mon Sep 17 00:00:00 2001
> From: Zachary Amsden <zamsden@redhat.com>
> Date: Tue, 25 May 2010 17:17:32 -1000
> Subject: [PATCH 4/5] IOMMU API changed
> 
> 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.
> 
> Signed-off-by: Zachary Amsden <zamsden@redhat.com>
> ---
>  external-module-compat-comm.h |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/external-module-compat-comm.h b/external-module-compat-comm.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 = iommu_map_range(domain, iova, paddr, PAGE_SIZE, prot); \

This should be (PAGE_SIZE << gfp_order) according to my current
understanding.

> +	page_size = 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 

Besides that, putting this under CONFIG_IOMMU_API and making the
functions static inline would be preferred.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

  reply	other threads:[~2010-05-26  7:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26  3:36 [PATCH 4/4] Hack around IOMMU changes Zachary Amsden
2010-05-26  3:37 ` Zachary Amsden
2010-05-26  7:40   ` Jan Kiszka [this message]
2010-05-26 18:28     ` Zachary Amsden
2010-05-26 19:22       ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BFCD05D.4000603@web.de \
    --to=jan.kiszka@web.de \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=zamsden@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.