From owner-freebsd-acpi@FreeBSD.ORG Tue Feb 27 05:55:16 2007 Return-Path: X-Original-To: acpi@FreeBSD.org Delivered-To: freebsd-acpi@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8DD1916A400 for ; Tue, 27 Feb 2007 05:55:16 +0000 (UTC) (envelope-from nate@root.org) Received: from root.org (root.org [67.118.192.226]) by mx1.freebsd.org (Postfix) with ESMTP id 767C913C47E for ; Tue, 27 Feb 2007 05:55:16 +0000 (UTC) (envelope-from nate@root.org) Received: (qmail 38788 invoked from network); 27 Feb 2007 05:41:43 -0000 Received: from ppp-71-139-18-69.dsl.snfc21.pacbell.net (HELO ?10.0.5.55?) (nate-mail@71.139.18.69) by root.org with ESMTPA; 27 Feb 2007 05:41:43 -0000 Message-ID: <45E3C49E.2030507@root.org> Date: Mon, 26 Feb 2007 21:41:50 -0800 From: Nate Lawson User-Agent: Thunderbird 1.5.0.9 (X11/20070214) MIME-Version: 1.0 To: acpi@FreeBSD.org X-Enigmail-Version: 0.94.2.0 Content-Type: multipart/mixed; boundary="------------080406040105080506050906" Cc: Subject: PATCH - panic on resume in pmap_invalidate X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Feb 2007 05:55:16 -0000 This is a multi-part message in MIME format. --------------080406040105080506050906 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Attached is a patch by Alan Cox (alc@) that changes how we map memory for acpi wake code. It should solve a problem that was reported of a panic after resume in pmap_invalidate(). It should work on 7.x or 6.x. If you have that problem, please report if it works. -- Nate --------------080406040105080506050906 Content-Type: text/plain; name="wake_page.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="wake_page.diff" Index: sys/i386/acpica/acpi_wakeup.c =================================================================== RCS file: /home/ncvs/src/sys/i386/acpica/acpi_wakeup.c,v retrieving revision 1.45 diff -u -r1.45 acpi_wakeup.c --- sys/i386/acpica/acpi_wakeup.c 8 Aug 2006 01:30:54 -0000 1.45 +++ sys/i386/acpica/acpi_wakeup.c 27 Feb 2007 05:28:53 -0000 @@ -192,11 +192,9 @@ { ACPI_STATUS status; struct pmap *pm; - vm_page_t page; int ret; uint32_t cr3; u_long ef; - struct proc *p; ret = 0; if (sc->acpi_wakeaddr == 0) @@ -206,10 +204,12 @@ ef = read_eflags(); - /* Create Identity Mapping */ - if ((p = curproc) == NULL) - p = &proc0; - pm = vmspace_pmap(p->p_vmspace); + /* + * Temporarily switch to the kernel pmap because it provides an + * identity mapping (setup at boot) for the low physical memory + * region containing the wakeup code. + */ + pm = kernel_pmap; cr3 = rcr3(); #ifdef PAE load_cr3(vtophys(pm->pm_pdpt)); @@ -217,10 +217,6 @@ load_cr3(vtophys(pm->pm_pdir)); #endif - page = PHYS_TO_VM_PAGE(sc->acpi_wakephys); - pmap_enter(pm, sc->acpi_wakephys, page, - VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE, 1); - ret_addr = 0; ACPI_DISABLE_IRQS(); if (acpi_savecpu()) { @@ -283,7 +279,6 @@ } out: - pmap_remove(pm, sc->acpi_wakephys, sc->acpi_wakephys + PAGE_SIZE); load_cr3(cr3); write_eflags(ef); Index: sys/i386/i386/pmap.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/pmap.c,v retrieving revision 1.581 diff -u -r1.581 pmap.c --- sys/i386/i386/pmap.c 18 Feb 2007 06:33:02 -0000 1.581 +++ sys/i386/i386/pmap.c 27 Feb 2007 05:26:22 -0000 @@ -422,6 +422,13 @@ /* Turn on PG_G on kernel page(s) */ pmap_set_pg(); + + /* + * Create an identity mapping (virt == phys) for the low 1 MB + * physical memory region that is used by the ACPI wakeup code. + * This mapping must not have PG_G set. + */ + kernel_pmap->pm_pdir[0] = PG_PS | PG_RW | PG_V; } /* --------------080406040105080506050906--