From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com> To: tomi.valkeinen@ti.com Cc: plagnioj@jcrosoft.com, bp@suse.de, hpa@zytor.com, linux-fbdev@vger.kernel.org, luto@amacapital.net, toshi.kani@hp.com, sbsiddha@gmail.com, mingo@elte.hu, tglx@linutronix.de, jgross@suse.com, daniel.vetter@ffwll.ch, airlied@redhat.com, adaplas@gmail.com, robdclark@gmail.com, jg1.han@samsung.com, wsa@the-dreams.de, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" <mcgrof@suse.com>, Linus Torvalds <torvalds@linux-foundation.org> Subject: [PATCH v4 1/3] video: fbdev: vesafb: only support MTRR_TYPE_WRCOMB Date: Thu, 4 Jun 2015 09:44:46 -0700 [thread overview] Message-ID: <1433436288-16792-2-git-send-email-mcgrof@do-not-panic.com> (raw) In-Reply-To: <1433436288-16792-1-git-send-email-mcgrof@do-not-panic.com> From: "Luis R. Rodriguez" <mcgrof@suse.com> No other video driver uses MTRR types except for MTRR_TYPE_WRCOMB, the other MTRR types were implemented and supported here but with no real good reason. The ioremap() APIs are architecture agnostic and at least on x86 PAT is a new design that extends MTRRs and can replace it in a much cleaner way, where so long as the proper ioremap_wc() or variant API is used the right thing will be done behind the scenes. This is the only driver left using the other MTRR types -- and since there is no good reason for it now rip them out. Cc: Toshi Kani <toshi.kani@hp.com> Cc: Suresh Siddha <sbsiddha@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Linus Torvalds <torvalds@linux-foundation.org> 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: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Jingoo Han <jg1.han@samsung.com> Cc: Wolfram Sang <wsa@the-dreams.de> 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 | 62 ++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 46 deletions(-) diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c index d79a0ac..191156b 100644 --- a/drivers/video/fbdev/vesafb.c +++ b/drivers/video/fbdev/vesafb.c @@ -404,60 +404,30 @@ static int vesafb_probe(struct platform_device *dev) * region already (FIXME) */ request_region(0x3c0, 32, "vesafb"); + if (mtrr == 3) { #ifdef CONFIG_MTRR - if (mtrr) { unsigned int temp_size = size_total; - unsigned int type = 0; + int rc; - switch (mtrr) { - case 1: - type = MTRR_TYPE_UNCACHABLE; - break; - case 2: - type = MTRR_TYPE_WRBACK; - break; - case 3: - type = MTRR_TYPE_WRCOMB; - break; - case 4: - type = MTRR_TYPE_WRTHROUGH; - break; - default: - type = 0; - break; - } - - if (type) { - int rc; - - /* Find the largest power-of-two */ - temp_size = roundup_pow_of_two(temp_size); + /* 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, - type, 1); - temp_size >>= 1; - } while (temp_size >= PAGE_SIZE && rc == -EINVAL); - } - } + /* Try and find a power of two to add */ + do { + rc = mtrr_add(vesafb_fix.smem_start, temp_size, + MTRR_TYPE_WRCOMB, 1); + temp_size >>= 1; + } while (temp_size >= PAGE_SIZE && rc == -EINVAL); #endif - - switch (mtrr) { - case 1: /* uncachable */ - info->screen_base = ioremap_nocache(vesafb_fix.smem_start, vesafb_fix.smem_len); - break; - case 2: /* write-back */ - info->screen_base = ioremap_cache(vesafb_fix.smem_start, vesafb_fix.smem_len); - break; - case 3: /* write-combining */ info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len); - break; - case 4: /* write-through */ - default: + } else { +#ifdef CONFIG_MTRR + if (mtrr && mtrr != 3) + WARN_ONCE(1, "Only MTRR_TYPE_WRCOMB (3) make sense\n"); +#endif info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len); - break; } + if (!info->screen_base) { printk(KERN_ERR "vesafb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n", -- 2.3.2.209.gd67f9d5.dirty
WARNING: multiple messages have this Message-ID (diff)
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com> To: tomi.valkeinen@ti.com Cc: plagnioj@jcrosoft.com, bp@suse.de, hpa@zytor.com, linux-fbdev@vger.kernel.org, luto@amacapital.net, toshi.kani@hp.com, sbsiddha@gmail.com, mingo@elte.hu, tglx@linutronix.de, jgross@suse.com, daniel.vetter@ffwll.ch, airlied@redhat.com, adaplas@gmail.com, robdclark@gmail.com, jg1.han@samsung.com, wsa@the-dreams.de, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" <mcgrof@suse.com>, Linus Torvalds <torvalds@linux-foundation.org> Subject: [PATCH v4 1/3] video: fbdev: vesafb: only support MTRR_TYPE_WRCOMB Date: Thu, 04 Jun 2015 16:44:46 +0000 [thread overview] Message-ID: <1433436288-16792-2-git-send-email-mcgrof@do-not-panic.com> (raw) In-Reply-To: <1433436288-16792-1-git-send-email-mcgrof@do-not-panic.com> From: "Luis R. Rodriguez" <mcgrof@suse.com> No other video driver uses MTRR types except for MTRR_TYPE_WRCOMB, the other MTRR types were implemented and supported here but with no real good reason. The ioremap() APIs are architecture agnostic and at least on x86 PAT is a new design that extends MTRRs and can replace it in a much cleaner way, where so long as the proper ioremap_wc() or variant API is used the right thing will be done behind the scenes. This is the only driver left using the other MTRR types -- and since there is no good reason for it now rip them out. Cc: Toshi Kani <toshi.kani@hp.com> Cc: Suresh Siddha <sbsiddha@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Linus Torvalds <torvalds@linux-foundation.org> 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: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Jingoo Han <jg1.han@samsung.com> Cc: Wolfram Sang <wsa@the-dreams.de> 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 | 62 ++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 46 deletions(-) diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c index d79a0ac..191156b 100644 --- a/drivers/video/fbdev/vesafb.c +++ b/drivers/video/fbdev/vesafb.c @@ -404,60 +404,30 @@ static int vesafb_probe(struct platform_device *dev) * region already (FIXME) */ request_region(0x3c0, 32, "vesafb"); + if (mtrr = 3) { #ifdef CONFIG_MTRR - if (mtrr) { unsigned int temp_size = size_total; - unsigned int type = 0; + int rc; - switch (mtrr) { - case 1: - type = MTRR_TYPE_UNCACHABLE; - break; - case 2: - type = MTRR_TYPE_WRBACK; - break; - case 3: - type = MTRR_TYPE_WRCOMB; - break; - case 4: - type = MTRR_TYPE_WRTHROUGH; - break; - default: - type = 0; - break; - } - - if (type) { - int rc; - - /* Find the largest power-of-two */ - temp_size = roundup_pow_of_two(temp_size); + /* 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, - type, 1); - temp_size >>= 1; - } while (temp_size >= PAGE_SIZE && rc = -EINVAL); - } - } + /* Try and find a power of two to add */ + do { + rc = mtrr_add(vesafb_fix.smem_start, temp_size, + MTRR_TYPE_WRCOMB, 1); + temp_size >>= 1; + } while (temp_size >= PAGE_SIZE && rc = -EINVAL); #endif - - switch (mtrr) { - case 1: /* uncachable */ - info->screen_base = ioremap_nocache(vesafb_fix.smem_start, vesafb_fix.smem_len); - break; - case 2: /* write-back */ - info->screen_base = ioremap_cache(vesafb_fix.smem_start, vesafb_fix.smem_len); - break; - case 3: /* write-combining */ info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len); - break; - case 4: /* write-through */ - default: + } else { +#ifdef CONFIG_MTRR + if (mtrr && mtrr != 3) + WARN_ONCE(1, "Only MTRR_TYPE_WRCOMB (3) make sense\n"); +#endif info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len); - break; } + if (!info->screen_base) { printk(KERN_ERR "vesafb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n", -- 2.3.2.209.gd67f9d5.dirty
next prev parent reply other threads:[~2015-06-04 16:49 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-04 16:44 [PATCH v4 0/3] vesafb: remove theoretical MTRR uses Luis R. Rodriguez 2015-06-04 16:44 ` Luis R. Rodriguez 2015-06-04 16:44 ` Luis R. Rodriguez [this message] 2015-06-04 16:44 ` [PATCH v4 1/3] video: fbdev: vesafb: only support MTRR_TYPE_WRCOMB Luis R. Rodriguez 2015-06-04 16:44 ` [PATCH v4 2/3] video: fbdev: vesafb: add missing mtrr_del() for added MTRR Luis R. Rodriguez 2015-06-04 16:44 ` Luis R. Rodriguez 2015-06-04 16:44 ` [PATCH v4 3/3] video: fbdev: vesafb: use arch_phys_wc_add() Luis R. Rodriguez 2015-06-04 16:44 ` Luis R. Rodriguez 2015-06-12 9:04 ` Tomi Valkeinen 2015-06-12 9:04 ` Tomi Valkeinen 2015-06-15 22:27 ` Luis R. Rodriguez 2015-06-15 22:27 ` Luis R. Rodriguez 2015-06-16 6:43 ` Tomi Valkeinen 2015-06-16 6:43 ` Tomi Valkeinen
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=1433436288-16792-2-git-send-email-mcgrof@do-not-panic.com \ --to=mcgrof@do-not-panic.com \ --cc=adaplas@gmail.com \ --cc=airlied@redhat.com \ --cc=bp@suse.de \ --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@suse.com \ --cc=mingo@elte.hu \ --cc=plagnioj@jcrosoft.com \ --cc=robdclark@gmail.com \ --cc=sbsiddha@gmail.com \ --cc=tglx@linutronix.de \ --cc=tomi.valkeinen@ti.com \ --cc=torvalds@linux-foundation.org \ --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: linkBe 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.