From patchwork Fri May 29 00:30:33 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: 6503181 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 283BEC0020 for ; Fri, 29 May 2015 00:35:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33B25206FF for ; Fri, 29 May 2015 00:35:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD792206FE for ; Fri, 29 May 2015 00:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755160AbbE2AfC (ORCPT ); Thu, 28 May 2015 20:35:02 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:34892 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752568AbbE2AfB (ORCPT ); Thu, 28 May 2015 20:35:01 -0400 Received: by pdea3 with SMTP id a3so53154917pde.2; Thu, 28 May 2015 17:35:00 -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=xwKVbvHv6xqZG8tha3YY773nIxtF9d2ThyQFVApAwrg=; b=xcGOpVPwF8G1/spH2r0oMmcI9WLCH0CjSdBmwq4zpn9BcIAybLEOm/oQ1G8zBQesiK lPZwdKRq6KuFwhXU3/LJTpF25EwIO7/yVyp/CU8japgYb2XFtnRe/HqQrBi59tZ3LjMp /5JOIfwnFIz42lmIGIlGIDBbvV+8eMr/RcWsfgOsId6pyb61n1ufaDauUXdF5SUDeuDs dT0K3Bqw4AUMf7p6lGLdfmggn6ZVyUDoBKXwGy33Fwky+Skt3xHamlvfZOt3A6iAAiUf vTVKaUD5Ew9gXGm4Mk+CqSwn6i27ZrL6iqFzAJ3sTJi8HpoQwJfnQsFuuEmSWzsCXjzV o7gg== X-Received: by 10.68.103.164 with SMTP id fx4mr10158701pbb.125.1432859700854; Thu, 28 May 2015 17:35:00 -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 qo1sm2287308pbc.89.2015.05.28.17.34.58 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 May 2015 17:34:59 -0700 (PDT) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Thu, 28 May 2015 17:32:50 -0700 From: "Luis R. Rodriguez" To: tomi.valkeinen@ti.com Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, "Luis R. Rodriguez" , Thomas Gleixner , Juergen Gross , Jingoo Han , Daniel Vetter , Masanari Iida , Suresh Siddha , Ingo Molnar , Andy Lutomirski , Dave Airlie , Antonino Daplas , Jean-Christophe Plagniol-Villard Subject: [PATCH v4 2/17] video: fbdev: gbefb: add missing mtrr_del() calls Date: Thu, 28 May 2015 17:30:33 -0700 Message-Id: <1432859434-17821-2-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1432859434-17821-1-git-send-email-mcgrof@do-not-panic.com> References: <1432859434-17821-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=ham 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" This driver never removed the MTRRs. Fix that. Cc: Thomas Gleixner Cc: Juergen Gross Cc: Jingoo Han Cc: Daniel Vetter Cc: Masanari Iida Cc: Suresh Siddha Cc: Ingo Molnar 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/gbefb.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c index 6d9ef39..4e54faa06 100644 --- a/drivers/video/fbdev/gbefb.c +++ b/drivers/video/fbdev/gbefb.c @@ -38,6 +38,7 @@ static struct sgi_gbe *gbe; struct gbefb_par { struct fb_var_screeninfo var; struct gbe_timing_info timing; + int wc_cookie; int valid; }; @@ -1198,8 +1199,10 @@ static int gbefb_probe(struct platform_device *p_dev) gbe_mem_phys = (unsigned long) gbe_dma_addr; } + par = info->par; #ifdef CONFIG_X86 - mtrr_add(gbe_mem_phys, gbe_mem_size, MTRR_TYPE_WRCOMB, 1); + par->wc_cookie = mtrr_add(gbe_mem_phys, gbe_mem_size, + MTRR_TYPE_WRCOMB, 1); #endif /* map framebuffer memory into tiles table */ @@ -1215,7 +1218,6 @@ static int gbefb_probe(struct platform_device *p_dev) /* reset GBE */ gbe_reset(); - par = info->par; /* turn on default video mode */ if (fb_find_mode(&par->var, info, mode_option, NULL, 0, default_mode, 8) == 0) @@ -1240,6 +1242,10 @@ static int gbefb_probe(struct platform_device *p_dev) return 0; out_gbe_unmap: +#ifdef CONFIG_MTRR + if (par->wc_cookie >= 0) + mtrr_del(par->wc_cookie, 0, 0); +#endif if (gbe_dma_addr) dma_free_coherent(NULL, gbe_mem_size, gbe_mem, gbe_mem_phys); out_tiles_free: @@ -1256,9 +1262,14 @@ out_release_framebuffer: static int gbefb_remove(struct platform_device* p_dev) { struct fb_info *info = platform_get_drvdata(p_dev); + struct gbefb_par *par = info->par; unregister_framebuffer(info); gbe_turn_off(); +#ifdef CONFIG_MTRR + if (par->wc_cookie >= 0) + mtrr_del(par->wc_cookie, 0, 0); +#endif if (gbe_dma_addr) dma_free_coherent(NULL, gbe_mem_size, gbe_mem, gbe_mem_phys); dma_free_coherent(NULL, GBE_TLB_SIZE * sizeof(uint16_t),