All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: Thomas Schlichter <thomas.schlichter@web.de>
Cc: Michal Januszewski <spock@gentoo.org>,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] uvesafb,vesafb: create write-combining or write-back PAT entries
Date: Tue, 30 Nov 2010 06:10:51 +0000	[thread overview]
Message-ID: <20101130061051.GD17114@linux-sh.org> (raw)
In-Reply-To: <201011271437.38126.thomas.schlichter@web.de>

On Sat, Nov 27, 2010 at 02:37:37PM +0100, Thomas Schlichter wrote:
> diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
> index 52ec095..5a34bc8 100644
> --- a/drivers/video/uvesafb.c
> +++ b/drivers/video/uvesafb.c
...

> -	info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
> +	uvesafb_init_mtrr(info);
> +
> +	switch (mtrr) {
> +	case 1: /* uncachable */
> +		info->screen_base = ioremap_nocache(info->fix.smem_start, info->fix.smem_len);
> +		break;
> +	case 2: /* write-back */
> +		info->screen_base = ioremap_cache(info->fix.smem_start, info->fix.smem_len);
> +		break;
> +	case 3: /* write-combining */
> +		info->screen_base = ioremap_wc(info->fix.smem_start, info->fix.smem_len);
> +		break;
> +	case 4: /* write-through */
> +	default:
> +		info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
> +		break;
> +	}
>  
>  	if (!info->screen_base) {
>  		printk(KERN_ERR

uvesafb presently has no special architecture dependencies, but
ioremap_wc() is not as of yet a wholly generic interface. Some
architectures that don't set ARCH_HAS_IOREMAP_WC get it by virtue of the
asm-generic/iomap.h include, and most of the nommu architectures will
stub it in via asm-generic/io.h, but this still leaves quite a long list
of platforms that don't handle it at all.

Your options at this point are either to establish ioremap_wc() as a
generic API, and layer this patch on top of that, or rework
uvesafb_init_mtrr() to do the actual broken-out remapping and rework it
in to something like a uvesafb_remap(), where you bury the MTRR details
under CONFIG_MTRR.

While there's probably value in exposing ioremap_wc() as a generic
interface, you're never going to hit any of the non-default ioremap()
calls on platforms lacking MTRRs anyways, so special-casing it is ok.

WARNING: multiple messages have this Message-ID (diff)
From: Paul Mundt <lethal@linux-sh.org>
To: Thomas Schlichter <thomas.schlichter@web.de>
Cc: Michal Januszewski <spock@gentoo.org>,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] uvesafb,vesafb: create write-combining or write-back PAT entries
Date: Tue, 30 Nov 2010 15:10:51 +0900	[thread overview]
Message-ID: <20101130061051.GD17114@linux-sh.org> (raw)
In-Reply-To: <201011271437.38126.thomas.schlichter@web.de>

On Sat, Nov 27, 2010 at 02:37:37PM +0100, Thomas Schlichter wrote:
> diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
> index 52ec095..5a34bc8 100644
> --- a/drivers/video/uvesafb.c
> +++ b/drivers/video/uvesafb.c
...

> -	info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
> +	uvesafb_init_mtrr(info);
> +
> +	switch (mtrr) {
> +	case 1: /* uncachable */
> +		info->screen_base = ioremap_nocache(info->fix.smem_start, info->fix.smem_len);
> +		break;
> +	case 2: /* write-back */
> +		info->screen_base = ioremap_cache(info->fix.smem_start, info->fix.smem_len);
> +		break;
> +	case 3: /* write-combining */
> +		info->screen_base = ioremap_wc(info->fix.smem_start, info->fix.smem_len);
> +		break;
> +	case 4: /* write-through */
> +	default:
> +		info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
> +		break;
> +	}
>  
>  	if (!info->screen_base) {
>  		printk(KERN_ERR

uvesafb presently has no special architecture dependencies, but
ioremap_wc() is not as of yet a wholly generic interface. Some
architectures that don't set ARCH_HAS_IOREMAP_WC get it by virtue of the
asm-generic/iomap.h include, and most of the nommu architectures will
stub it in via asm-generic/io.h, but this still leaves quite a long list
of platforms that don't handle it at all.

Your options at this point are either to establish ioremap_wc() as a
generic API, and layer this patch on top of that, or rework
uvesafb_init_mtrr() to do the actual broken-out remapping and rework it
in to something like a uvesafb_remap(), where you bury the MTRR details
under CONFIG_MTRR.

While there's probably value in exposing ioremap_wc() as a generic
interface, you're never going to hit any of the non-default ioremap()
calls on platforms lacking MTRRs anyways, so special-casing it is ok.

  reply	other threads:[~2010-11-30  6:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-27 13:37 [PATCH] uvesafb,vesafb: create write-combining or write-back PAT entries Thomas Schlichter
2010-11-27 13:37 ` Thomas Schlichter
2010-11-30  6:10 ` Paul Mundt [this message]
2010-11-30  6:10   ` Paul Mundt
2011-02-06 11:02   ` Thomas Schlichter
2011-02-06 11:02     ` Thomas Schlichter
2011-02-06 11:11     ` [PATCH 1/3] uvesafb,vesafb: create WC or WB " Thomas Schlichter
2011-02-06 11:11       ` Thomas Schlichter
2011-02-06 11:12     ` [PATCH 2/3] Add ioremap_cache and ioremap_wc to all architectures Thomas Schlichter
2011-02-06 11:12       ` Thomas Schlichter
2011-02-06 12:34       ` Geert Uytterhoeven
2011-02-06 12:34         ` Geert Uytterhoeven
2011-02-06 11:14     ` [PATCH 3/3] uvesafb: remove-ifdef-CONFIG_X86-around-ioremap Thomas Schlichter
2011-02-06 11:14       ` Thomas Schlichter

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=20101130061051.GD17114@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spock@gentoo.org \
    --cc=thomas.schlichter@web.de \
    /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.