linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jungseok Lee <jays.lee@samsung.com>
Cc: linux-kernel@vger.kernel.org, sungjinn.chung@samsung.com,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>
Subject: Re: [PATCH] swiotlb: Correct kernel command line handler
Date: Tue, 1 Apr 2014 08:46:06 -0400	[thread overview]
Message-ID: <20140401124606.GA7135@phenom.dumpdata.com> (raw)
In-Reply-To: <011801cf4d4c$f7ba51f0$e72ef5d0$@samsung.com>

On Tue, Apr 01, 2014 at 10:51:58AM +0900, Jungseok Lee wrote:
> This patch corrects kernel command line handler when io_tlb_nslabs
> is set to 0.
> 
> A current implementation allocates default size memory (64MB) when
> 0 is given to io_tlb_nslabs ("swiotlb=0") by kernel command line.
> In other words, memory is allocated unintentionally.

What are the other IOMMUs that end up taking over the DMA ops?
Or do you end up with no DMA ops?

> 
> Signed-off-by: Jungseok Lee <jays.lee@samsung.com>
> Signed-off-by: Sungjinn Chung <sungjinn.chung@samsung.com>
> ---
>  lib/swiotlb.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/swiotlb.c b/lib/swiotlb.c
> index b604b83..9fe9f71 100644
> --- a/lib/swiotlb.c
> +++ b/lib/swiotlb.c
> @@ -55,6 +55,8 @@
>  
>  int swiotlb_force;
>  
> +static int swiotlb_no_use;
> +
>  /*
>   * Used to do a quick range check in swiotlb_tbl_unmap_single and
>   * swiotlb_tbl_sync_single_*, to see if the memory was in fact allocated by this
> @@ -102,6 +104,8 @@ setup_io_tlb_npages(char *str)
>  		io_tlb_nslabs = simple_strtoul(str, &str, 0);
>  		/* avoid tail segment of size < IO_TLB_SEGSIZE */
>  		io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE);
> +		if (!io_tlb_nslabs)
> +			swiotlb_no_use = 1;
>  	}
>  	if (*str == ',')
>  		++str;
> @@ -212,7 +216,7 @@ swiotlb_init(int verbose)
>  	unsigned char *vstart;
>  	unsigned long bytes;
>  
> -	if (!io_tlb_nslabs) {
> +	if (!swiotlb_no_use && !io_tlb_nslabs) {
>  		io_tlb_nslabs = (default_size >> IO_TLB_SHIFT);
>  		io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE);
>  	}
> @@ -244,7 +248,7 @@ swiotlb_late_init_with_default_size(size_t default_size)
>  	unsigned int order;
>  	int rc = 0;
>  
> -	if (!io_tlb_nslabs) {
> +	if (!swiotlb_no_use && !io_tlb_nslabs) {
>  		io_tlb_nslabs = (default_size >> IO_TLB_SHIFT);
>  		io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE);
>  	}
> -- 
> 1.7.10.4
> 
> 

  reply	other threads:[~2014-04-01 12:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01  1:51 [PATCH] swiotlb: Correct kernel command line handler Jungseok Lee
2014-04-01 12:46 ` Konrad Rzeszutek Wilk [this message]
2014-04-02  4:36   ` Jungseok Lee
2014-06-20 20:20     ` Konrad Rzeszutek Wilk

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=20140401124606.GA7135@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=jays.lee@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=sungjinn.chung@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).