From patchwork Tue Apr 21 20:40:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 6253711 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 223B29F32B for ; Tue, 21 Apr 2015 20:41:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9581820306 for ; Tue, 21 Apr 2015 20:41:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4CD8320328 for ; Tue, 21 Apr 2015 20:41:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756272AbbDUUk7 (ORCPT ); Tue, 21 Apr 2015 16:40:59 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:35190 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756338AbbDUUk6 (ORCPT ); Tue, 21 Apr 2015 16:40:58 -0400 Received: by pabtp1 with SMTP id tp1so251589288pab.2; Tue, 21 Apr 2015 13:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=o9aCcxssuYbS98QZCkDeOMmaQWpXYcSC3BMkSrbYt+w=; b=hgZYyQePquA1cVnNrmvdfyCXTjG8SYajxjhrYnAxYnPYTe83NqO4cqsGy91jiibYkc s8xf4AXJNkHQx2pTDuqGJysjXpHGe63jknSeWEwL6ZigZNdGkkaqvDzG7Ju5gNgJ2+L3 N+h//XkkqDy46bTheuduLrdM7fC7ZYQ+eYXmLwJzvvpzeN+g0zZyEm5KiTzl6KNQ8Hni Cdtd1JMFlbzQm0PMFizfyoTkLt+Vg8r0xMALmmahAYuTbN1tWz5ax4nNXm3tYvlQUGbE Ml90L/1WDgo2n6AwEJipOgJDkhOaune/XBx/vJ5osq3NU5orbvmpkYPTeAZrAeLvMonU Efew== X-Received: by 10.68.132.169 with SMTP id ov9mr8440933pbb.109.1429648858377; Tue, 21 Apr 2015 13:40:58 -0700 (PDT) Received: from mcgrof@gmail.com (c-98-234-145-61.hsd1.ca.comcast.net. [98.234.145.61]) by mx.google.com with ESMTPSA id bo2sm2873130pbb.1.2015.04.21.13.40.55 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 21 Apr 2015 13:40:57 -0700 (PDT) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Tue, 21 Apr 2015 13:40:55 -0700 From: "Luis R. Rodriguez" To: plagnioj@jcrosoft.com, tomi.valkeinen@ti.com, hpa@zytor.com Cc: linux-fbdev@vger.kernel.org, luto@amacapital.net, cocci@systeme.lip6.fr, "Luis R. Rodriguez" , Toshi Kani , Suresh Siddha , Ingo Molnar , Linus Torvalds , Thomas Gleixner , Juergen Gross , Daniel Vetter , Dave Airlie , Antonino Daplas , Rob Clark , Jingoo Han , Wolfram Sang , linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] video: fbdev: vesafb: only support MTRR_TYPE_WRCOMB Date: Tue, 21 Apr 2015 13:40:48 -0700 Message-Id: <1429648850-17902-2-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1429648850-17902-1-git-send-email-mcgrof@do-not-panic.com> References: <1429648850-17902-1-git-send-email-mcgrof@do-not-panic.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Luis R. Rodriguez" 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 Cc: Suresh Siddha Cc: Ingo Molnar Cc: Linus Torvalds Cc: Thomas Gleixner Cc: Juergen Gross Cc: Daniel Vetter Cc: Andy Lutomirski Cc: Dave Airlie Cc: Antonino Daplas Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: Rob Clark Cc: Jingoo Han Cc: Wolfram Sang Cc: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Luis R. Rodriguez --- 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",