linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
	plagnioj@jcrosoft.com, hpa@zytor.com
Cc: linux-fbdev@vger.kernel.org, luto@amacapital.net,
	cocci@systeme.lip6.fr, "Luis R. Rodriguez" <mcgrof@suse.com>,
	Toshi Kani <toshi.kani@hp.com>,
	Suresh Siddha <sbsiddha@gmail.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Juergen Gross <jgross@suse.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Dave Airlie <airlied@redhat.com>,
	Antonino Daplas <adaplas@gmail.com>,
	Rob Clark <robdclark@gmail.com>, Jingoo Han <jg1.han@samsung.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] video: fbdev: vesafb: add missing mtrr_del() for added MTRR
Date: Wed, 20 May 2015 09:52:14 +0000	[thread overview]
Message-ID: <555C594E.1010607@ti.com> (raw)
In-Reply-To: <1429648850-17902-3-git-send-email-mcgrof@do-not-panic.com>

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

Hi Luis,

On 21/04/15 23:40, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
> 
> The MTRR added was never being deleted.
> 
> Cc: Toshi Kani <toshi.kani@hp.com>
> Cc: Suresh Siddha <sbsiddha@gmail.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Antonino Daplas <adaplas@gmail.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Jingoo Han <jg1.han@samsung.com>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: linux-fbdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> ---
>  drivers/video/fbdev/vesafb.c | 30 ++++++++++++++++++++++++------
>  1 file changed, 24 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c
> index 191156b..a2261d0 100644
> --- a/drivers/video/fbdev/vesafb.c
> +++ b/drivers/video/fbdev/vesafb.c
> @@ -29,6 +29,10 @@
>  
>  /* --------------------------------------------------------------------- */
>  
> +struct vesafb_par {
> +	int wc_cookie;
> +};
> +
>  static struct fb_var_screeninfo vesafb_defined = {
>  	.activate	= FB_ACTIVATE_NOW,
>  	.height		= -1,
> @@ -175,7 +179,16 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
>  
>  static void vesafb_destroy(struct fb_info *info)
>  {
> +#ifdef CONFIG_MTRR
> +	struct vesafb_par *par = info->par;
> +#endif
> +
>  	fb_dealloc_cmap(&info->cmap);
> +
> +#ifdef CONFIG_MTRR
> +	if (par->wc_cookie >= 0)
> +		mtrr_del(par->wc_cookie, 0, 0);
> +#endif
>  	if (info->screen_base)
>  		iounmap(info->screen_base);
>  	release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
> @@ -228,6 +241,7 @@ static int vesafb_setup(char *options)
>  static int vesafb_probe(struct platform_device *dev)
>  {
>  	struct fb_info *info;
> +	struct vesafb_par *par;
>  	int i, err;
>  	unsigned int size_vmode;
>  	unsigned int size_remap;
> @@ -297,8 +311,8 @@ static int vesafb_probe(struct platform_device *dev)
>  		return -ENOMEM;
>  	}
>  	platform_set_drvdata(dev, info);
> -	info->pseudo_palette = info->par;
> -	info->par = NULL;
> +	info->pseudo_palette = NULL;
> +	par = info->par;
>  
>  	/* set vesafb aperture size for generic probing */
>  	info->apertures = alloc_apertures(1);
> @@ -407,17 +421,17 @@ static int vesafb_probe(struct platform_device *dev)
>  	if (mtrr == 3) {
>  #ifdef CONFIG_MTRR
>  		unsigned int temp_size = size_total;
> -		int rc;
>  
>  		/* Find the largest power-of-two */
>  		temp_size = roundup_pow_of_two(temp_size);
>  
>  		/* Try and find a power of two to add */
>  		do {
> -			rc = mtrr_add(vesafb_fix.smem_start, temp_size,
> -				      MTRR_TYPE_WRCOMB, 1);
> +			par->wc_cookie = mtrr_add(vesafb_fix.smem_start,
> +						  temp_size,
> +						  MTRR_TYPE_WRCOMB, 1);
>  			temp_size >>= 1;
> -		} while (temp_size >= PAGE_SIZE && rc == -EINVAL);
> +		} while (temp_size >= PAGE_SIZE && par->wc_cookie == -EINVAL);
>  #endif
>  		info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len);
>  	} else {
> @@ -462,6 +476,10 @@ static int vesafb_probe(struct platform_device *dev)
>  	fb_info(info, "%s frame buffer device\n", info->fix.id);
>  	return 0;
>  err:
> +#ifdef CONFIG_MTRR
> +	if (par->wc_cookie >= 0)
> +		mtrr_del(par->wc_cookie, 0, 0);
> +#endif
>  	if (info->screen_base)
>  		iounmap(info->screen_base);
>  	framebuffer_release(info);

Hmm, this looks a bit odd... You're removing the pseudo_palette, and
using its memory for mtrr cookie?

 Tomi


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

  reply	other threads:[~2015-05-20  9:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21 20:40 [PATCH v3 0/3] vesafb: remove theoretical MTRR uses Luis R. Rodriguez
2015-04-21 20:40 ` [PATCH v3 1/3] video: fbdev: vesafb: only support MTRR_TYPE_WRCOMB Luis R. Rodriguez
2015-04-21 20:40 ` [PATCH v3 2/3] video: fbdev: vesafb: add missing mtrr_del() for added MTRR Luis R. Rodriguez
2015-05-20  9:52   ` Tomi Valkeinen [this message]
2015-05-20 19:46     ` Luis R. Rodriguez
2015-06-04  5:55       ` Tomi Valkeinen
2015-06-04 16:24         ` Luis R. Rodriguez
2015-04-21 20:40 ` [PATCH v3 3/3] video: fbdev: vesafb: use arch_phys_wc_add() Luis R. Rodriguez

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=555C594E.1010607@ti.com \
    --to=tomi.valkeinen@ti.com \
    --cc=adaplas@gmail.com \
    --cc=airlied@redhat.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=daniel.vetter@ffwll.ch \
    --cc=hpa@zytor.com \
    --cc=jg1.han@samsung.com \
    --cc=jgross@suse.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mcgrof@do-not-panic.com \
    --cc=mcgrof@suse.com \
    --cc=mingo@elte.hu \
    --cc=plagnioj@jcrosoft.com \
    --cc=robdclark@gmail.com \
    --cc=sbsiddha@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=toshi.kani@hp.com \
    --cc=wsa@the-dreams.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 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).