public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: x86 team <x86@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arjan van de Veen <arjan@infradead.org>,
	Avi Kivity <avi@redhat.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Alok N Kataria <akataria@vmware.com>,
	Pan Jacob jun <jacob.jun.pan@intel.com>
Subject: [RFC patch 18/32] x86: Move paravirt pagetable_setup to platform
Date: Fri, 21 Aug 2009 21:30:57 -0000	[thread overview]
Message-ID: <20090821205602.678425431@linutronix.de> (raw)
In-Reply-To: 20090821205008.518392436@linutronix.de

[-- Attachment #1: x86-move-pagetable-setup-start-done-to-platform.patch --]
[-- Type: text/plain, Size: 8168 bytes --]

Replace more paravirt hackery by proper platform setup.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/include/asm/paravirt.h      |   19 -------------------
 arch/x86/include/asm/pgtable.h       |   10 ----------
 arch/x86/include/asm/pgtable_types.h |    4 ++--
 arch/x86/include/asm/platform.h      |   13 +++++++++++++
 arch/x86/kernel/paravirt.c           |    7 -------
 arch/x86/kernel/platform_setup.c     |    6 ++++++
 arch/x86/kernel/setup.c              |    4 ++--
 arch/x86/xen/enlighten.c             |    2 +-
 arch/x86/xen/mmu.c                   |   11 +++++++----
 arch/x86/xen/mmu.h                   |    2 +-
 10 files changed, 32 insertions(+), 46 deletions(-)

Index: linux-2.6/arch/x86/include/asm/paravirt.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/paravirt.h
+++ linux-2.6/arch/x86/include/asm/paravirt.h
@@ -241,15 +241,6 @@ struct pv_apic_ops {
 };
 
 struct pv_mmu_ops {
-	/*
-	 * Called before/after init_mm pagetable setup. setup_start
-	 * may reset %cr3, and may pre-install parts of the pagetable;
-	 * pagetable setup is expected to preserve any existing
-	 * mapping.
-	 */
-	void (*pagetable_setup_start)(pgd_t *pgd_base);
-	void (*pagetable_setup_done)(pgd_t *pgd_base);
-
 	unsigned long (*read_cr2)(void);
 	void (*write_cr2)(unsigned long);
 
@@ -1025,16 +1016,6 @@ static inline void paravirt_post_allocat
 		(*pv_init_ops.post_allocator_init)();
 }
 
-static inline void paravirt_pagetable_setup_start(pgd_t *base)
-{
-	(*pv_mmu_ops.pagetable_setup_start)(base);
-}
-
-static inline void paravirt_pagetable_setup_done(pgd_t *base)
-{
-	(*pv_mmu_ops.pagetable_setup_done)(base);
-}
-
 #ifdef CONFIG_SMP
 static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
 				    unsigned long start_esp)
Index: linux-2.6/arch/x86/include/asm/pgtable.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/pgtable.h
+++ linux-2.6/arch/x86/include/asm/pgtable.h
@@ -55,16 +55,6 @@ extern struct list_head pgd_list;
 #define pte_update(mm, addr, ptep)              do { } while (0)
 #define pte_update_defer(mm, addr, ptep)        do { } while (0)
 
-static inline void __init paravirt_pagetable_setup_start(pgd_t *base)
-{
-	native_pagetable_setup_start(base);
-}
-
-static inline void __init paravirt_pagetable_setup_done(pgd_t *base)
-{
-	native_pagetable_setup_done(base);
-}
-
 #define pgd_val(x)	native_pgd_val(x)
 #define __pgd(x)	native_make_pgd(x)
 
Index: linux-2.6/arch/x86/include/asm/pgtable_types.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/pgtable_types.h
+++ linux-2.6/arch/x86/include/asm/pgtable_types.h
@@ -299,8 +299,8 @@ void set_pte_vaddr(unsigned long vaddr, 
 extern void native_pagetable_setup_start(pgd_t *base);
 extern void native_pagetable_setup_done(pgd_t *base);
 #else
-static inline void native_pagetable_setup_start(pgd_t *base) {}
-static inline void native_pagetable_setup_done(pgd_t *base) {}
+#define native_pagetable_setup_start platform_setup_pgd_noop
+#define native_pagetable_setup_done  platform_setup_pgd_noop
 #endif
 
 struct seq_file;
Index: linux-2.6/arch/x86/include/asm/platform.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/platform.h
+++ linux-2.6/arch/x86/include/asm/platform.h
@@ -1,6 +1,8 @@
 #ifndef _ASM_X86_PLATFORM_H
 #define _ASM_X86_PLATFORM_H
 
+#include <asm/pgtable_types.h>
+
 struct mpc_bus;
 struct mpc_cpu;
 struct mpc_table;
@@ -73,6 +75,16 @@ struct platform_setup_oem {
 };
 
 /**
+ * struct platform_setup_paging - platform specific paging functions
+ * @pagetable_setup_start:	platform specific pre paging_init() call
+ * @pagetable_setup_done:	platform specific post paging_init() call
+ */
+struct platform_setup_paging {
+	void (*pagetable_setup_start)(pgd_t *base);
+	void (*pagetable_setup_done)(pgd_t *base);
+};
+
+/**
  * struct platform_setup_ops - functions for platform specific setup
  *
  */
@@ -81,6 +93,7 @@ struct platform_setup_ops {
 	struct platform_setup_mpparse mpparse;
 	struct platform_setup_irqs irqs;
 	struct platform_setup_oem oem;
+	struct platform_setup_paging paging;
 	struct platform_setup_quirks quirks;
 };
 
Index: linux-2.6/arch/x86/kernel/paravirt.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/paravirt.c
+++ linux-2.6/arch/x86/kernel/paravirt.c
@@ -402,13 +402,6 @@ struct pv_apic_ops pv_apic_ops = {
 #endif
 
 struct pv_mmu_ops pv_mmu_ops = {
-#ifndef CONFIG_X86_64
-	.pagetable_setup_start = native_pagetable_setup_start,
-	.pagetable_setup_done = native_pagetable_setup_done,
-#else
-	.pagetable_setup_start = paravirt_nop,
-	.pagetable_setup_done = paravirt_nop,
-#endif
 
 	.read_cr2 = native_read_cr2,
 	.write_cr2 = native_write_cr2,
Index: linux-2.6/arch/x86/kernel/platform_setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/platform_setup.c
+++ linux-2.6/arch/x86/kernel/platform_setup.c
@@ -13,6 +13,7 @@
 
 void __cpuinit platform_setup_noop(void) { }
 void __init platform_setup_uint_noop(unsigned int unused) { }
+void __init platform_setup_pgd_noop(pgd_t *unused) { }
 
 /*
  * The platform setup functions are preset with the default functions
@@ -47,6 +48,11 @@ struct __initdata platform_setup_ops pla
 		.banner = default_banner,
 	},
 
+	.paging = {
+		.pagetable_setup_start = native_pagetable_setup_start,
+		.pagetable_setup_done = native_pagetable_setup_done,
+	},
+
 	.quirks = {
 		.mpc_record = platform_setup_uint_noop,
 	},
Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -959,9 +959,9 @@ void __init setup_arch(char **cmdline_p)
 	kvmclock_init();
 #endif
 
-	paravirt_pagetable_setup_start(swapper_pg_dir);
+	platform_setup.paging.pagetable_setup_start(swapper_pg_dir);
 	paging_init();
-	paravirt_pagetable_setup_done(swapper_pg_dir);
+	platform_setup.paging.pagetable_setup_done(swapper_pg_dir);
 	paravirt_post_allocator_init();
 
 #ifdef CONFIG_X86_64
Index: linux-2.6/arch/x86/xen/enlighten.c
===================================================================
--- linux-2.6.orig/arch/x86/xen/enlighten.c
+++ linux-2.6/arch/x86/xen/enlighten.c
@@ -981,12 +981,12 @@ asmlinkage void __init xen_start_kernel(
 	pv_time_ops = xen_time_ops;
 	pv_cpu_ops = xen_cpu_ops;
 	pv_apic_ops = xen_apic_ops;
-	pv_mmu_ops = xen_mmu_ops;
 
 	platform_setup.resources.memory_setup = xen_memory_setup;
 	platform_setup.oem.arch_setup = xen_arch_setup;
 	platform_setup.oem.banner = xen_banner;
 
+	xen_init_mmu_ops();
 	xen_init_irq_ops();
 
 	xen_init_cpuid_mask();
Index: linux-2.6/arch/x86/xen/mmu.c
===================================================================
--- linux-2.6.orig/arch/x86/xen/mmu.c
+++ linux-2.6/arch/x86/xen/mmu.c
@@ -1875,10 +1875,7 @@ static void xen_leave_lazy_mmu(void)
 	preempt_enable();
 }
 
-const struct pv_mmu_ops xen_mmu_ops __initdata = {
-	.pagetable_setup_start = xen_pagetable_setup_start,
-	.pagetable_setup_done = xen_pagetable_setup_done,
-
+static const struct pv_mmu_ops xen_mmu_ops __initdata = {
 	.read_cr2 = xen_read_cr2,
 	.write_cr2 = xen_write_cr2,
 
@@ -1954,6 +1951,12 @@ const struct pv_mmu_ops xen_mmu_ops __in
 	.set_fixmap = xen_set_fixmap,
 };
 
+void __init xen_init_mmu_ops(void)
+{
+	platform_setup.paging.pagetable_setup_start = xen_pagetable_setup_start;
+	platform_setup.paging.pagetable_setup_done = xen_pagetable_setup_done;
+	pv_mmu_ops = xen_mmu_ops;
+}
 
 #ifdef CONFIG_XEN_DEBUG_FS
 
Index: linux-2.6/arch/x86/xen/mmu.h
===================================================================
--- linux-2.6.orig/arch/x86/xen/mmu.h
+++ linux-2.6/arch/x86/xen/mmu.h
@@ -59,5 +59,5 @@ void  xen_ptep_modify_prot_commit(struct
 
 unsigned long xen_read_cr2_direct(void);
 
-extern const struct pv_mmu_ops xen_mmu_ops;
+extern void xen_init_mmu_ops(void);
 #endif	/* _XEN_MMU_H */



  parent reply	other threads:[~2009-08-21 21:33 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-21 21:29 [RFC patch 00/32] x86: Refactor the setup code to provide a base for embedded platforms Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 01/32] x86: Add platform_setup infrastructure Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 02/32] x86: Add probe_roms to platform_setup Thomas Gleixner
2009-08-21 22:23   ` Jeremy Fitzhardinge
2009-08-21 22:36     ` Thomas Gleixner
2009-08-28 21:52       ` [RFC PATCH 0/7] x86/boot: Moorestown patch set based on platform_set abstraction Pan, Jacob jun
2009-08-29 16:59         ` Thomas Gleixner
2009-08-28 21:52       ` [RFC PATCH 2/7] x86: introduce a set of platform feature flags Pan, Jacob jun
2009-08-28 21:52       ` [RFC PATCH 3/7] x86: add moorestown specific platform setup code Pan, Jacob jun
2009-08-29 17:20         ` Thomas Gleixner
2009-08-28 21:53       ` [RFC PATCH 4/7] x86/apbt: Moorestown APB system timer driver Pan, Jacob jun
2009-08-28 21:53       ` [RFC PATCH 5/7] x86/apic: decouple legacy irq handling in ioapic Pan, Jacob jun
2009-08-28 21:53       ` [RFC PATCH 6/7] x86/apic: Early setup IOAPIC for APB timer Pan, Jacob jun
2009-08-28 21:53       ` [RFC PATCH 7/7] x86: add more platform_setup functions Pan, Jacob jun
2009-08-29 17:31         ` Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 03/32] x86: Add request_standard_resources to platform_setup Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 04/32] x86: Add reserve_ebda_region " Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 05/32] x86: Move memory_setup to platform Thomas Gleixner
2009-08-21 21:29 ` [RFC patch 06/32] x86: Sanitize smp_record and move it to platform_setup Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 07/32] x86: Move ioapic_ids_setup " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 08/32] x86: Move mpc_apic_id " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 09/32] x86: Move smp_read_mpc_oem " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 10/32] x86: Move mpc_oem_pci_bus " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 11/32] x86: Move oem_bus_info " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 12/32] x86: Move get/find_smp_config " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 13/32] x86: Move pre_intr_init " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 14/32] x86: Move irq_init " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 15/32] x86: Move traps_init " Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 16/32] x86: Replace ARCH_SETUP by a proper platform function Thomas Gleixner
2009-08-21 22:30   ` Jeremy Fitzhardinge
2009-08-21 23:42     ` Thomas Gleixner
2009-08-28 21:52       ` [PATCH 1/7] x86/boot: adding hw subarch ID for Moorestown Pan, Jacob jun
2009-08-29 16:58         ` Thomas Gleixner
2009-08-21 21:30 ` [RFC patch 17/32] x86: Move paravirt banner printout to platform Thomas Gleixner
2009-08-21 21:30 ` Thomas Gleixner [this message]
2009-08-21 21:31 ` [RFC patch 19/32] x86: Move xen_post_allocator_init into xen_pagetable_setup_done Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 20/32] x86: Move percpu clockevents setup to platform Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 21/32] x86: Add timer_init " Thomas Gleixner
2009-08-24  6:48   ` Andrey Panin
2009-08-21 21:31 ` [RFC patch 22/32] x86: Remove do_timer hook Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 23/32] x86: Prepare unification of time_32/64.c Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 24/32] x86: Simplify timer_ack magic in time_32.c Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 25/32] x86: Remove mca bus ifdef from timer interrupt Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 26/32] x86: Make timer setup and global variables the same in time_32/64.c Thomas Gleixner
2009-08-21 21:31 ` [RFC patch 27/32] x86: Move calibrate_cpu to tsc.c Thomas Gleixner
2009-08-21 21:32 ` [RFC patch 28/32] x86: time_32/64.c unify profile_pc Thomas Gleixner
2009-08-21 21:32 ` [RFC patch 29/32] x86: Replace the now identical time_32/64.c by time.c Thomas Gleixner
2009-08-21 21:32 ` [RFC patch 30/32] x86: Move tsc_calibration to platform Thomas Gleixner
2009-08-21 21:32 ` [RFC patch 31/32] init: Move sched_clock_init after late_time_init Thomas Gleixner
2009-08-21 21:32 ` [RFC patch 32/32] x86: Move tsc_init to late_time_init Thomas Gleixner
2009-08-21 22:19 ` [RFC patch 00/32] x86: Refactor the setup code to provide a base for embedded platforms Jeremy Fitzhardinge
2009-08-22 10:57 ` Ingo Molnar
2009-08-23  9:15   ` Thomas Gleixner

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=20090821205602.678425431@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=akataria@vmware.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=avi@redhat.com \
    --cc=jacob.jun.pan@intel.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    --cc=x86@kernel.org \
    /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