Skip to content

Commit

Permalink
paravirt: add a hook for once the allocator is ready
Browse files Browse the repository at this point in the history
Add a hook so that the paravirt backend knows when the allocator is
ready.  This is useful for the obvious reason that the allocator is
available, but the other side-effect of having the bootmem allocator
available is that each page now has an associated "struct page".

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
  • Loading branch information
Jeremy Fitzhardinge authored and Jeremy Fitzhardinge committed Jul 18, 2007
1 parent fdb4c33 commit 6996d3b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/i386/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,8 @@ void __init setup_arch(char **cmdline_p)
* NOTE: at this point the bootmem allocator is fully available.
*/

paravirt_post_allocator_init();

dmi_scan_machine();

#ifdef CONFIG_X86_GENERICARCH
Expand Down
8 changes: 8 additions & 0 deletions include/asm-i386/paravirt.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ struct paravirt_ops
/* Basic arch-specific setup */
void (*arch_setup)(void);
char *(*memory_setup)(void);
void (*post_allocator_init)(void);

void (*init_IRQ)(void);
void (*time_init)(void);

Expand Down Expand Up @@ -669,6 +671,12 @@ static inline void setup_secondary_clock(void)
}
#endif

static inline void paravirt_post_allocator_init(void)
{
if (paravirt_ops.post_allocator_init)
(*paravirt_ops.post_allocator_init)();
}

static inline void paravirt_pagetable_setup_start(pgd_t *base)
{
if (paravirt_ops.pagetable_setup_start)
Expand Down
4 changes: 4 additions & 0 deletions include/asm-i386/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ void __init add_memory_region(unsigned long long start,

extern unsigned long init_pg_tables_end;

#ifndef CONFIG_PARAVIRT
#define paravirt_post_allocator_init() do {} while (0)
#endif

#endif /* __ASSEMBLY__ */

#endif /* __KERNEL__ */
Expand Down

0 comments on commit 6996d3b

Please sign in to comment.