From owner-svn-src-stable@FreeBSD.ORG Tue Sep 2 19:36:19 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33E2F6E0; Tue, 2 Sep 2014 19:36:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 052D019C7; Tue, 2 Sep 2014 19:36:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s82JaI3r017767; Tue, 2 Sep 2014 19:36:18 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s82JaIad017766; Tue, 2 Sep 2014 19:36:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201409021936.s82JaIad017766@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 Sep 2014 19:36:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270978 - stable/10/sys/dev/vt/hw/efifb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Sep 2014 19:36:19 -0000 Author: emaste Date: Tue Sep 2 19:36:18 2014 New Revision: 270978 URL: http://svnweb.freebsd.org/changeset/base/270978 Log: MFC r268624 by nwhitehorn: On my Lenovo laptop, the firmware maps the EFI framebuffer with MTRRs set to uncacheable. This leads to execrable console performance. Once PMAP is up, remap the framebuffer as write-combining. This reduces boot time on my laptop by 60% when booting with EFI. Modified: stable/10/sys/dev/vt/hw/efifb/efifb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vt/hw/efifb/efifb.c ============================================================================== --- stable/10/sys/dev/vt/hw/efifb/efifb.c Tue Sep 2 19:14:33 2014 (r270977) +++ stable/10/sys/dev/vt/hw/efifb/efifb.c Tue Sep 2 19:36:18 2014 (r270978) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); static vd_init_t vt_efifb_init; static vd_probe_t vt_efifb_probe; +static void vt_efifb_remap(void *efifb_data); static struct vt_driver vt_efifb_driver = { .vd_name = "efifb", @@ -68,6 +69,8 @@ static struct vt_driver vt_efifb_driver static struct fb_info local_info; VT_DRIVER_DECLARE(vt_efifb, vt_efifb_driver); +SYSINIT(efifb_remap, SI_SUB_KMEM, SI_ORDER_ANY, vt_efifb_remap, &local_info); + static int vt_efifb_probe(struct vt_device *vd) { @@ -133,9 +136,9 @@ vt_efifb_init(struct vt_device *vd) info->fb_size = info->fb_height * info->fb_stride; info->fb_pbase = efifb->fb_addr; /* - * We could use pmap_mapdev here except that the kernel pmap - * hasn't been created yet and hence any attempt to lock it will - * fail. + * Use the direct map as a crutch until pmap is available. Once pmap + * is online, the framebuffer will be remapped by vt_efifb_remap() + * using pmap_mapdev_attr(). */ info->fb_vbase = PHYS_TO_DMAP(efifb->fb_addr); @@ -163,3 +166,22 @@ vt_efifb_init(struct vt_device *vd) return (CN_INTERNAL); } + +static void +vt_efifb_remap(void *xinfo) +{ + struct fb_info *info = xinfo; + + if (info->fb_pbase == 0) + return; + + /* + * Remap as write-combining. This massively improves performance and + * happens very early in kernel initialization, when everything is + * still single-threaded and interrupts are off, so replacing the + * mapping address is safe. + */ + info->fb_vbase = (intptr_t)pmap_mapdev_attr(info->fb_pbase, + info->fb_size, VM_MEMATTR_WRITE_COMBINING); +} +