mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Linux PM List <linux-pm@lists.linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Magnus Damm <damm@igel.co.jp>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Wu Fengguang <fengguang.wu@intel.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Sergio Luis <sergio@larces.uece.br>,
	Lauro Salmito <laurosalmito@gmail.com>,
	Jaswinder Singh Rajput <jaswinder@kernel.org>,
	Ingo Molnar <mingo@elte.hu>,
	Nigel Cunningham <nigel@tuxonice.net>
Subject: Re: [PATCH 07/19] x86: unify power/cpu_(32|64).c
Date: Fri, 12 Jun 2009 12:50:49 +0200	[thread overview]
Message-ID: <20090612105049.GI18682@elf.ucw.cz> (raw)
In-Reply-To: <S4AoGnG.A.DG.2cYMKB@chimera>

On Thu 2009-06-11 22:35:11, Rafael J. Wysocki wrote:
> From: Sergio Luis <sergio@larces.uece.br>
> 
> This is the last unification step. Here we do remove one of the files
> and rename the left one as cpu.c, as both are now the same.
> Also update power/Makefile, telling it to build cpu.o, instead of
> cpu_(32|64).o
> 
> Signed-off-by: Sergio Luis <sergio@larces.uece.br>
> Signed-off-by: Lauro Salmito <laurosalmito@gmail.com>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>


> +#ifdef CONFIG_X86_32
> +	store_gdt(&ctxt->gdt);
> +	store_idt(&ctxt->idt);
> +#else
> +/* CONFIG_X86_64 */
> +	store_gdt((struct desc_ptr *)&ctxt->gdt_limit);
> +	store_idt((struct desc_ptr *)&ctxt->idt_limit);
> +#endif

I'd slightly prefer /* CONFIG_X86_64 */ to be moved to line above, or
dropped at all. it seems unneccessarily verbose.


> +	store_tr(ctxt->tr);
> +
> +	/* XMM0..XMM15 should be handled by kernel_fpu_begin(). */
> +	/*
> +	 * segment registers
> +	 */
> +#ifdef CONFIG_X86_32
> +	savesegment(es, ctxt->es);
> +	savesegment(fs, ctxt->fs);
> +	savesegment(gs, ctxt->gs);
> +	savesegment(ss, ctxt->ss);
> +#else
> +/* CONFIG_X86_64 */
> +	asm volatile ("movw %%ds, %0" : "=m" (ctxt->ds));
> +	asm volatile ("movw %%es, %0" : "=m" (ctxt->es));
> +	asm volatile ("movw %%fs, %0" : "=m" (ctxt->fs));
> +	asm volatile ("movw %%gs, %0" : "=m" (ctxt->gs));
> +	asm volatile ("movw %%ss, %0" : "=m" (ctxt->ss));
> +
> +	rdmsrl(MSR_FS_BASE, ctxt->fs_base);
> +	rdmsrl(MSR_GS_BASE, ctxt->gs_base);
> +	rdmsrl(MSR_KERNEL_GS_BASE, ctxt->gs_kernel_base);
> +	mtrr_save_fixed_ranges(NULL);
> +
> +	rdmsrl(MSR_EFER, ctxt->efer);
> +#endif

Can i386's mtrr_save_fixed_ranges() be moved to similar place?

> +	/*
> +	 * control registers
> +	 */
> +	ctxt->cr0 = read_cr0();
> +	ctxt->cr2 = read_cr2();
> +	ctxt->cr3 = read_cr3();
> +#ifdef CONFIG_X86_32
> +	ctxt->cr4 = read_cr4_safe();
> +#else
> +/* CONFIG_X86_64 */
> +	ctxt->cr4 = read_cr4();
> +	ctxt->cr8 = read_cr8();
> +#endif

Could we use read_cr4_safe on x86-64, too? Why the difference?

Should we be saving cr8 on 32-bit machines that have it? (That was
interrupt priority, IIRC?)

> +	/* cr4 was introduced in the Pentium CPU */
> +#ifdef CONFIG_X86_32
> +	if (ctxt->cr4)
> +		write_cr4(ctxt->cr4);
> +#else

Aha, is read_cr4_safe() needed because i486 does not have cr4?

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2009-06-12 10:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0615007ad8090a890586d530b5d3bb98da566014.1244752872.git.rjw@sisk.pl>
2009-06-11 22:06 ` [PATCH 00/19] What's in the suspend tree for 2.6.31 Pavel Machek
2009-06-11 22:24   ` Rafael J. Wysocki
     [not found] ` <S4AoGnG.A.D7H.mZXMKB@chimera>
2009-06-12 10:37   ` [PATCH 01/19] PM: Warn if interrupts are enabled during suspend-resume of sysdevs Pavel Machek
     [not found] ` <S4AoGnG.A.xE.8UYMKB@chimera>
2009-06-12 10:37   ` [PATCH 02/19] x86: unify power/cpu_(32|64) headers Pavel Machek
     [not found] ` <S4AoGnG.A.aF.zaYMKB@chimera>
2009-06-12 10:44   ` [PATCH 03/19] x86: unify power/cpu_(32|64) global variables Pavel Machek
     [not found] ` <S4AoGnG.A.DG.2cYMKB@chimera>
2009-06-12 10:50   ` Pavel Machek [this message]
     [not found] ` <S4AoGnG.A.cG.6eYMKB@chimera>
2009-06-12 10:51   ` [PATCH 09/19] PM: Rename device_power_down/up() Pavel Machek
     [not found] ` <S4AoGnG.A.mG.jfYMKB@chimera>
2009-06-12 10:55   ` [PATCH 10/19] PM core: rename suspend and resume functions Pavel Machek
     [not found] ` <S4AoGnG.A.6G.dgYMKB@chimera>
2009-06-12 11:02   ` [PATCH 12/19] PM/Suspend: Do not shrink memory before suspend Pavel Machek
2009-06-12 19:04     ` Rafael J. Wysocki
     [not found] ` <S4AoGnG.A.OH.VhYMKB@chimera>
2009-06-12 11:03   ` [PATCH 14/19] PM: Remove device_type suspend()/resume() Pavel Machek
     [not found] ` <S4AoGnG.A.YH.yhYMKB@chimera>
2009-06-12 11:10   ` [PATCH 15/19] Driver Core: Rework platform suspend/resume, print warning Pavel Machek
     [not found] ` <S4AoGnG.A.AI.ZjYMKB@chimera>
2009-06-12 11:13   ` [PATCH 19/19] PM: Add empty suspend/resume device irq functions Pavel Machek
2009-06-12 11:32     ` Heiko Carstens
2009-06-12 11:36       ` Pavel Machek

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=20090612105049.GI18682@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=cornelia.huck@de.ibm.com \
    --cc=damm@igel.co.jp \
    --cc=fengguang.wu@intel.com \
    --cc=gregkh@suse.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jaswinder@kernel.org \
    --cc=laurosalmito@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mingo@elte.hu \
    --cc=nigel@tuxonice.net \
    --cc=rjw@sisk.pl \
    --cc=sergio@larces.uece.br \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®