Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Arnaud Patard <apatard@mandriva.com>, huhb@lemote.com
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
	Yan Hua <yanh@lemote.com>, Philippe Vachon <philippe@cowpig.ca>,
	Zhang Le <r0bertz@gentoo.org>, Zhang Fuxin <zhangfx@lemote.com>,
	loongson-dev <loongson-dev@googlegroups.com>,
	Nicholas Mc Guire <der.herr@hofr.at>,
	Liu Junliang <liujl@lemote.com>, Erwan Lerale <erwan@thiscow.com>
Subject: Re: [loongson-PATCH-v2 23/23] Hibernation Support in mips system
Date: Thu, 28 May 2009 02:52:19 +0800	[thread overview]
Message-ID: <1243450339.11263.125.camel@falcon> (raw)
In-Reply-To: <m3my8yoovk.fsf@anduin.mandriva.com>

Hi,

On Wed, 2009-05-27 at 11:51 +0200, Arnaud Patard wrote:
> > +LEAF(swsusp_arch_resume)
> > +	PTR_L t0, restore_pblist
> > +0:
> > +	PTR_L t1, PBE_ADDRESS(t0)   /* source */
> > +	PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */
> > +	PTR_ADDIU t3, t1, _PAGE_SIZE
> > +1:
> > +	REG_L t8, (t1)
> > +	REG_S t8, (t2)
> > +	PTR_ADDIU t1, t1, SZREG
> > +	PTR_ADDIU t2, t2, SZREG
> > +	bne t1, t3, 1b
> > +	PTR_L t0, PBE_NEXT(t0)
> > +	bnez t0, 0b
> 
> you really need to flush cache/tlb here. If you don't do that you'll get
> some weird bugs.
> 

is this okay?

diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S
index 9dbe48e..1f06fd5 100644
--- a/arch/mips/power/hibernate.S
+++ b/arch/mips/power/hibernate.S
@@ -2,6 +2,14 @@
 #include <asm/asm-offsets.h>
 #include <asm/regdef.h>
 #include <asm/asm.h>
+
+       .extern flush_cache_all
+#ifdef CONFIG_SMP
+       .extern flush_tlb_all
+#else
+       .extern local_flush_tlb_all
+#define flush_tlb_all local_flush_tlb_all
+#endif
 
 .text
 LEAF(swsusp_arch_suspend)
@@ -39,6 +47,16 @@ LEAF(swsusp_arch_resume)
        bne t1, t3, 1b
        PTR_L t0, PBE_NEXT(t0)
        bnez t0, 0b
+       /* flush caches to make sure context is in memory */
+       PTR_LA t1, flush_cache_all
+       PTR_L t0, 0(t1)
+       jalr t0
+       nop
+       /* flush tlb entries */
+       PTR_LA t1, flush_tlb_all
+       PTR_L t0, 0(t1)
+       jalr t0
+       nop
        PTR_LA t0, saved_regs
        PTR_L ra, PT_R31(t0)
        PTR_L sp, PT_R29(t0)

to Hongbing Hu,
 
    could you please help to test it? i do not have a Yeeloong laptop
currently. the above patch is applied to the latest git branch:
   
   git://dev.lemote.com/rt4ls.git linux-loongson-dev-to-ralf

thx!
Wu Zhangjin

  reply	other threads:[~2009-05-27 18:52 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26 18:59 [loongson-PATCH-v2 00/23] loongson-based machines support wuzhangjin
2009-05-26 19:01 ` [loongson-PATCH-v2 01/23] fix-warning: incompatible argument type of pci_fixup_irqs wuzhangjin
2009-05-26 19:02 ` [loongson-PATCH-v2 02/23] fix-warning: incompatible argument type of virt_to_phys wuzhangjin
2009-05-26 19:02 ` [loongson-PATCH-v2 03/23] change the naming methods wuzhangjin
2009-05-26 19:03 ` [loongson-PATCH-v2 04/23] remove reference to bonito64.h wuzhangjin
2009-05-26 19:04 ` [loongson-PATCH-v2 05/23] divide the files to the smallest logic unit wuzhangjin
2009-05-26 19:04 ` [loongson-PATCH-v2 06/23] replace tons of magic numbers by understandable symbols wuzhangjin
2009-05-27  9:27   ` Arnaud Patard
2009-05-27 15:26     ` Wu Zhangjin
2009-05-26 19:05 ` [loongson-PATCH-v2 07/23] clean up the early printk support for fuloong(2e) wuzhangjin
2009-05-26 19:05 ` [loongson-PATCH-v2 08/23] enable Real Time Clock Support " wuzhangjin
2009-05-26 19:05 ` [loongson-PATCH-v2 09/23] split the loongson-specific part out wuzhangjin
2009-05-26 19:06 ` [loongson-PATCH-v2 10/23] add basic loongson-2f support wuzhangjin
2009-05-26 19:06 ` [loongson-PATCH-v2 11/23] add basic fuloong(2f) support wuzhangjin
2009-05-26 19:07 ` [loongson-PATCH-v2 12/23] enable serial port support of loongson-based machines wuzhangjin
2009-05-26 19:07 ` [loongson-PATCH-v2 13/23] add basic yeeloong(2f) laptop support wuzhangjin
2009-05-26 19:07 ` [loongson-PATCH-v2 14/23] Add Siliconmotion 712 framebuffer driver wuzhangjin
2009-05-26 21:10   ` Geert Uytterhoeven
2009-05-26 21:10     ` Geert Uytterhoeven
2009-05-26 19:07 ` [loongson-PATCH-v2 15/23] define Loongson2F arch specific phys prot access wuzhangjin
2009-05-26 19:08 ` [loongson-PATCH-v2 16/23] Loongson2 specific OProfile driver wuzhangjin
2009-05-26 19:08 ` [loongson-PATCH-v2 17/23] flush posted write to irq wuzhangjin
2009-05-26 19:08 ` [loongson-PATCH-v2 18/23] CS5536 MFGPT as system clock source support wuzhangjin
2009-05-26 19:08 ` [loongson-PATCH-v2 19/23] Loongson2F cpufreq support wuzhangjin
2009-05-27  9:46   ` Arnaud Patard
2009-05-27 17:37     ` Wu Zhangjin
2009-05-27 17:37       ` Wu Zhangjin
2009-05-27 19:18       ` Arnaud Patard
2009-05-27 19:18         ` Arnaud Patard
2009-05-27 10:01   ` Manuel Lauss
2009-05-27 18:28     ` Wu Zhangjin
2009-05-26 19:09 ` [loongson-PATCH-v2 20/23] add gcc 4.4 support for MIPS and loongson wuzhangjin
2009-05-27  9:22   ` Arnaud Patard
2009-05-27 14:23     ` Wu Zhangjin
2009-05-26 19:09 ` [loongson-PATCH-v2 21/23] add default kernel config file for loongson-based machines wuzhangjin
2009-05-26 19:09 ` [loongson-PATCH-v2 22/23] add a default kernel configration for yeeloong-7inch laptop wuzhangjin
2009-05-26 19:10 ` [loongson-PATCH-v2 23/23] Hibernation Support in mips system wuzhangjin
2009-05-27  9:51   ` Arnaud Patard
2009-05-27 18:52     ` Wu Zhangjin [this message]
2009-05-28 15:44       ` Atsushi Nemoto
2009-05-28 17:06         ` Wu Zhangjin
2009-05-28 15:32     ` Atsushi Nemoto
2009-05-28 17:10   ` Wu Zhangjin
2009-05-29 16:12     ` Atsushi Nemoto
2009-05-29 19:12       ` Wu Zhangjin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1243450339.11263.125.camel@falcon \
    --to=wuzhangjin@gmail.com \
    --cc=apatard@mandriva.com \
    --cc=der.herr@hofr.at \
    --cc=erwan@thiscow.com \
    --cc=huhb@lemote.com \
    --cc=linux-mips@linux-mips.org \
    --cc=liujl@lemote.com \
    --cc=loongson-dev@googlegroups.com \
    --cc=philippe@cowpig.ca \
    --cc=r0bertz@gentoo.org \
    --cc=ralf@linux-mips.org \
    --cc=yanh@lemote.com \
    --cc=zhangfx@lemote.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox