Skip to content

Commit

Permalink
[IA64] pvops: define initialization hooks, pv_init_ops, for paravirtu…
Browse files Browse the repository at this point in the history
…alized environment.

define pv_init_ops hooks which represents various initialization
hooks for paravirtualized environment. and add hooks.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Tony Luck <tony.luck@intel.com>
  • Loading branch information
Isaku Yamahata authored and Tony Luck committed May 27, 2008
1 parent 213060a commit e51835d
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/ia64/kernel/paravirt.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ struct pv_info pv_info = {
.name = "bare hardware"
};

/***************************************************************************
* pv_init_ops
* initialization hooks.
*/

struct pv_init_ops pv_init_ops;

/***************************************************************************
* pv_cpu_ops
* intrinsics hooks.
Expand Down
10 changes: 10 additions & 0 deletions arch/ia64/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <asm/mca.h>
#include <asm/meminit.h>
#include <asm/page.h>
#include <asm/paravirt.h>
#include <asm/patch.h>
#include <asm/pgtable.h>
#include <asm/processor.h>
Expand Down Expand Up @@ -341,6 +342,8 @@ reserve_memory (void)
rsvd_region[n].end = (unsigned long) ia64_imva(_end);
n++;

n += paravirt_reserve_memory(&rsvd_region[n]);

#ifdef CONFIG_BLK_DEV_INITRD
if (ia64_boot_param->initrd_start) {
rsvd_region[n].start = (unsigned long)__va(ia64_boot_param->initrd_start);
Expand Down Expand Up @@ -519,6 +522,8 @@ setup_arch (char **cmdline_p)
{
unw_init();

paravirt_arch_setup_early();

ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);

*cmdline_p = __va(ia64_boot_param->command_line);
Expand Down Expand Up @@ -584,6 +589,9 @@ setup_arch (char **cmdline_p)
acpi_boot_init();
#endif

paravirt_banner();
paravirt_arch_setup_console(cmdline_p);

#ifdef CONFIG_VT
if (!conswitchp) {
# if defined(CONFIG_DUMMY_CONSOLE)
Expand All @@ -603,6 +611,8 @@ setup_arch (char **cmdline_p)
#endif

/* enable IA-64 Machine Check Abort Handling unless disabled */
if (paravirt_arch_setup_nomca())
nomca = 1;
if (!nomca)
ia64_mca_init();

Expand Down
2 changes: 2 additions & 0 deletions arch/ia64/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <asm/machvec.h>
#include <asm/mca.h>
#include <asm/page.h>
#include <asm/paravirt.h>
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
#include <asm/processor.h>
Expand Down Expand Up @@ -642,6 +643,7 @@ void __devinit smp_prepare_boot_cpu(void)
cpu_set(smp_processor_id(), cpu_online_map);
cpu_set(smp_processor_id(), cpu_callin_map);
per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
paravirt_post_smp_prepare_boot_cpu();
}

#ifdef CONFIG_HOTPLUG_CPU
Expand Down
70 changes: 70 additions & 0 deletions include/asm-ia64/paravirt.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,81 @@ static inline unsigned int get_kernel_rpl(void)
return pv_info.kernel_rpl;
}

/******************************************************************************
* initialization hooks.
*/
struct rsvd_region;

struct pv_init_ops {
void (*banner)(void);

int (*reserve_memory)(struct rsvd_region *region);

void (*arch_setup_early)(void);
void (*arch_setup_console)(char **cmdline_p);
int (*arch_setup_nomca)(void);

void (*post_smp_prepare_boot_cpu)(void);
};

extern struct pv_init_ops pv_init_ops;

static inline void paravirt_banner(void)
{
if (pv_init_ops.banner)
pv_init_ops.banner();
}

static inline int paravirt_reserve_memory(struct rsvd_region *region)
{
if (pv_init_ops.reserve_memory)
return pv_init_ops.reserve_memory(region);
return 0;
}

static inline void paravirt_arch_setup_early(void)
{
if (pv_init_ops.arch_setup_early)
pv_init_ops.arch_setup_early();
}

static inline void paravirt_arch_setup_console(char **cmdline_p)
{
if (pv_init_ops.arch_setup_console)
pv_init_ops.arch_setup_console(cmdline_p);
}

static inline int paravirt_arch_setup_nomca(void)
{
if (pv_init_ops.arch_setup_nomca)
return pv_init_ops.arch_setup_nomca();
return 0;
}

static inline void paravirt_post_smp_prepare_boot_cpu(void)
{
if (pv_init_ops.post_smp_prepare_boot_cpu)
pv_init_ops.post_smp_prepare_boot_cpu();
}

#endif /* !__ASSEMBLY__ */

#else
/* fallback for native case */

#ifndef __ASSEMBLY__

#define paravirt_banner() do { } while (0)
#define paravirt_reserve_memory(region) 0

#define paravirt_arch_setup_early() do { } while (0)
#define paravirt_arch_setup_console(cmdline_p) do { } while (0)
#define paravirt_arch_setup_nomca() 0
#define paravirt_post_smp_prepare_boot_cpu() do { } while (0)

#endif /* __ASSEMBLY__ */


#endif /* CONFIG_PARAVIRT_GUEST */

#endif /* __ASM_PARAVIRT_H */

0 comments on commit e51835d

Please sign in to comment.