From patchwork Fri Mar 20 23:18:07 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: 6061941 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 11BE6BF90F for ; Fri, 20 Mar 2015 23:58:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A35D20395 for ; Fri, 20 Mar 2015 23:58:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0EF6A202F2 for ; Fri, 20 Mar 2015 23:58:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751151AbbCTX6X (ORCPT ); Fri, 20 Mar 2015 19:58:23 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:36076 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751163AbbCTX6W (ORCPT ); Fri, 20 Mar 2015 19:58:22 -0400 Received: by pdbcz9 with SMTP id cz9so122477181pdb.3; Fri, 20 Mar 2015 16:58:22 -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=O3lSzy4hnXDNX4DGQQ8WBZlEmFhjzUo2/El/+Pwov20=; b=WPHmKOWmoRPCvgWW0hOTqZhPas4Wvp76aHjfpGG3rCk1IGCnHFOtE1MK71J4uOWhco iIyKHW9LFX4vsAPIRrMwR1LclhTvEaLy/+ubNbm7LTTmN/gh/AmrTud4i2FGkdtu//Xf WX5FTUecNv9QYgunDSHfH9pK0ywWbCQTNvAH7PsM6f46AUyeN3CzcP6x9NFvS+WgzaAT 2afZqRnkMtC4WxyRj0fZ5ryAR5ul8JW1WxRwgo7FihZ1fkW+AOkDDxRZ+oqrIqnSJH/t Cgo3gmwnIb3iJHuwcV4B1gjmh3F75bDydNZEmN9KYgHuFaR5yRBgDyCyQT1tkmNKrcMH 6eiA== X-Received: by 10.70.30.225 with SMTP id v1mr68089415pdh.104.1426895902041; Fri, 20 Mar 2015 16:58:22 -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 nj5sm9835353pdb.35.2015.03.20.16.58.18 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 20 Mar 2015 16:58:20 -0700 (PDT) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Fri, 20 Mar 2015 16:56:10 -0700 From: "Luis R. Rodriguez" To: luto@amacapital.net, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, jgross@suse.com, JBeulich@suse.com, bp@suse.de, suresh.b.siddha@intel.com, venkatesh.pallipadi@intel.com, airlied@redhat.com Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, x86@kernel.org, xen-devel@lists.xenproject.org, "Luis R. Rodriguez" , Ingo Molnar , Linus Torvalds , Daniel Vetter , Antonino Daplas , Jean-Christophe Plagniol-Villard , Tomi Valkeinen Subject: [PATCH v1 17/47] video: fbdev: vesafb: only support MTRR_TYPE_WRCOMB Date: Fri, 20 Mar 2015 16:18:07 -0700 Message-Id: <1426893517-2511-18-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1426893517-2511-1-git-send-email-mcgrof@do-not-panic.com> References: <1426893517-2511-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: Suresh Siddha Cc: Venkatesh Pallipadi 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: 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",