From owner-svn-src-all@FreeBSD.ORG Tue Mar 18 16:20:34 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D2D04C6; Tue, 18 Mar 2014 16:20:34 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 698A6960; Tue, 18 Mar 2014 16:20:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2IGKYnO029468; Tue, 18 Mar 2014 16:20:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2IGKYGa029467; Tue, 18 Mar 2014 16:20:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201403181620.s2IGKYGa029467@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 18 Mar 2014 16:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263305 - head/sys/x86/iommu X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Mar 2014 16:20:34 -0000 Author: kib Date: Tue Mar 18 16:20:33 2014 New Revision: 263305 URL: http://svnweb.freebsd.org/changeset/base/263305 Log: It is not uncommon for BIOSes to report wrong RMRR entries in DMAR table. Among them, some (old AMI ?) BIOSes report entries with range like (bf7ec000, bf7ebfff). Attempts to ignore the bogus entries result in faults, so the range must be covered somehow. Provide a workaround by identity mapping the 32 pages after the bogus entry start, which seems to be enough for the reported BIOS. Reported and tested by: Jason Harmening Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/x86/iommu/intel_ctx.c Modified: head/sys/x86/iommu/intel_ctx.c ============================================================================== --- head/sys/x86/iommu/intel_ctx.c Tue Mar 18 15:59:06 2014 (r263304) +++ head/sys/x86/iommu/intel_ctx.c Tue Mar 18 16:20:33 2014 (r263305) @@ -182,6 +182,15 @@ ctx_init_rmrr(struct dmar_ctx *ctx, devi end = entry->end; entry->start = trunc_page(start); entry->end = round_page(end); + if (entry->start == entry->end) { + /* Workaround for some AMI (?) BIOSes */ + if (bootverbose) { + device_printf(dev, "BIOS bug: dmar%d RMRR " + "region (%jx, %jx) corrected\n", + ctx->dmar->unit, start, end); + } + entry->end += DMAR_PAGE_SIZE * 0x20; + } size = OFF_TO_IDX(entry->end - entry->start); ma = malloc(sizeof(vm_page_t) * size, M_TEMP, M_WAITOK); for (i = 0; i < size; i++) {