From owner-freebsd-amd64@FreeBSD.ORG Wed Dec 3 23:14:40 2008 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE4391065676 for ; Wed, 3 Dec 2008 23:14:40 +0000 (UTC) (envelope-from bahamasfranks@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.29]) by mx1.freebsd.org (Postfix) with ESMTP id 6E6968FC0A for ; Wed, 3 Dec 2008 23:14:40 +0000 (UTC) (envelope-from bahamasfranks@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so1600875ywe.13 for ; Wed, 03 Dec 2008 15:14:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=anH9nzfzhkJ+9cr+2S0bGgX75Bixv1ocsiqGYi6EkkI=; b=ujbokqAyIquOWTEr+/Xb18K7ezotrOyW/MdsnOh3IXkMFzTPgR5mJa23KA1hFHNXge luhx3O9TENNQ2OTBTr0PZZvS1VKYAeAZO1zJmPgJf2CM5+aNz3hzZYLoC8RDd+xVXgHP OUFihHUl3pgQMHieOv27sL8G26JbHv36/WYg4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=b1EYR8rmgahoyj14svRqTnlhNvfjyUVSd3YvGG7dlbN8Jc+ITbwPYZljb9hK2+WTEc yW+RQj89b6+lnn7v37leXKV15TCMpa7nanxmwCBqRzd/l6xAiRgxoe5bjNB5tex6MWt8 b8j4ZHN/R8cO1U9+4XMmIm9wtMUZs7kByEAAk= Received: by 10.100.126.19 with SMTP id y19mr8141178anc.2.1228346079657; Wed, 03 Dec 2008 15:14:39 -0800 (PST) Received: by 10.101.70.6 with HTTP; Wed, 3 Dec 2008 15:14:39 -0800 (PST) Message-ID: <539c60b90812031514x3246ca09ua2febc879f8a7fcf@mail.gmail.com> Date: Wed, 3 Dec 2008 16:14:39 -0700 From: "Steve Franks" Sender: bahamasfranks@gmail.com To: "Jung-uk Kim" In-Reply-To: <539c60b90812031334kfe23981s35b965b12462a5b2@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1224616985.00027652.1224606603@10.7.7.3> <1224728582.00028075.1224715806@10.7.7.3> <4932F34C.1040804@FreeBSD.org> <200812021243.08513.jkim@FreeBSD.org> <539c60b90812031334kfe23981s35b965b12462a5b2@mail.gmail.com> X-Google-Sender-Auth: 2cb7c6f041201683 X-Mailman-Approved-At: Wed, 03 Dec 2008 23:15:53 +0000 Cc: freebsd-acpi@freebsd.org, peter@freebsd.org, freebsd-amd64@freebsd.org Subject: Re: Semi-working patch for amd64 suspend/resume X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2008 23:14:41 -0000 > On Tue, Dec 2, 2008 at 10:43 AM, Jung-uk Kim wrote: >> On Sunday 30 November 2008 03:10 pm, Alexander Motin wrote: >>> Hi. >>> >>> Alexander Motin wrote: >>> > Jung-uk Kim wrote: >>> >> I was working on suspend/resume support for amd64 and this is >>> >> the result. It works with a modified QEMU (QEMU does not >>> >> support S3) but real boxes that I have don't seem to like it >>> >> (e.g., broken BIOSes). If there is someone interested in >>> >> finishing it off or giving it a try, the patch is here: >>> >> >>> >> http://people.freebsd.org/~jkim/amd64_suspend.diff >>> > >>> > I have tried it on my Acer TM6292. S1/S2 are unsupported. On S3 >>> > system successfully got down, but on wakeup button, two seconds >>> > after power up, even without video initialization, it shut down, >>> > reset and then started usual boot. I have tried both original and >>> > updated BIOS, without any difference. >>> > >>> > Can I give you any other help? >>> >>> I have spent a day investigating the problem. I was inserting empty >>> infinite loop into the different points of wakeup process trying to >>> find the place where system reboots. I just haven't found any other >>> feedback channel as video is not initialized and beeper is not >>> working for some reason. >>> >>> As result, I have found, that if I am inserting: >>> qqq: >>> >>> jmp qqq >>> lines before line 98 of acpi_switch.S: >>> movl $MSR_MTRRdefType, %ecx >>> >>> movl WAKEUP_CTX(mtrr), %eax >>> >>> wrmsr >>> system hangs, but if I insert it just after them - system reboots. >>> >>> With just commenting this three lines I was able to get successful >>> suspend/resume with UP amd64 kernel!!! >> >> Good catch! I can confirm this is a correct bandaid. We cannot >> restore this MSR without restoring entire MTRR map. Actually, I >> should have written separate functions to save/restore all global >> MSRs. Only per-CPU MSRs should be embedded like that. >> >>> Here is problems I still have now: >>> - SMP kernel resume is not working, system reboots while doing >>> acpi_wakeup_cpus(); >> >> My dual-core CPU seems to resume okay but quite unstable. Can you try >> something like the following in amd64/mp_machdep.c and tell me if it >> helps? >> >> ------------ >> @@ -57,6 +57,7 @@ >> #include >> >> #include >> +#include >> #include >> #include >> #include >> @@ -1121,6 +1121,8 @@ >> int cpumask = PCPU_GET(cpumask); >> >> if (savectx2(&stopxpcbs[cpu])) { >> + /* Flush CPU cache. */ >> + wbinvd(); >> /* Indicate that we are suspended. */ >> atomic_set_int(&stopped_cpus, cpumask); >> } else { >> ------------ >> >>> - text mode video does not restores on resume, while Xorg graphic >>> one does. hw.acpi.reset_video=1 does not help, it just hanging >>> resume process. >> >> It is very common problem for modern video cards. We cannot do much >> here without help of GPU-specific routines (e.g., ATI ATOM BIOS >> parser for RadeonHD) or in-kernel realmode emulation[1] (e.g., >> NetBSD). >> >> Thanks for the feedback! >> >> Jung-uk Kim >> >> [1] http://cvsweb.netbsd.org/bsdweb.cgi/src/common/lib/libx86emu/ >> http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/x86/x86/vga_post.c >> _______________________________________________ >> freebsd-acpi@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-acpi >> To unsubscribe, send any mail to "freebsd-acpi-unsubscribe@freebsd.org" >> > Do you believe these patches should work against 6.4? I should like to try it out on my trusty 'ol desktop. Best, Steve