[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20090612105049.GI18682@elf.ucw.cz>
Date: Fri, 12 Jun 2009 12:50:49 +0200
From: Pavel Machek <pavel@....cz>
To: "Rafael J. Wysocki" <rjw@...k.pl>
Cc: Linux PM List <linux-pm@...ts.linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Cornelia Huck <cornelia.huck@...ibm.com>,
Magnus Damm <damm@...l.co.jp>,
Greg Kroah-Hartman <gregkh@...e.de>,
Wu Fengguang <fengguang.wu@...el.com>,
Alan Stern <stern@...land.harvard.edu>,
Sergio Luis <sergio@...ces.uece.br>,
Lauro Salmito <laurosalmito@...il.com>,
Jaswinder Singh Rajput <jaswinder@...nel.org>,
Ingo Molnar <mingo@...e.hu>,
Nigel Cunningham <nigel@...onice.net>
Subject: Re: [PATCH 07/19] x86: unify power/cpu_(32|64).c
On Thu 2009-06-11 22:35:11, Rafael J. Wysocki wrote:
> From: Sergio Luis <sergio@...ces.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@...ces.uece.br>
> Signed-off-by: Lauro Salmito <laurosalmito@...il.com>
> Signed-off-by: Rafael J. Wysocki <rjw@...k.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists