direct-io.hg

changeset 11492:0e02ac68b01b

[POWERPC][XEN] move idle_loop and add a "power save" hook

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Fri Sep 01 12:31:56 2006 -0400 (2006-09-01)
parents 62196a0f3791
children 18b3cbb04dc3
files xen/arch/powerpc/domain.c xen/arch/powerpc/setup.c
line diff
     1.1 --- a/xen/arch/powerpc/domain.c	Fri Sep 01 12:19:41 2006 -0400
     1.2 +++ b/xen/arch/powerpc/domain.c	Fri Sep 01 12:31:56 2006 -0400
     1.3 @@ -29,12 +29,11 @@
     1.4  #include <xen/shutdown.h>
     1.5  #include <xen/shadow.h>
     1.6  #include <xen/mm.h>
     1.7 +#include <xen/softirq.h>
     1.8  #include <asm/htab.h>
     1.9  #include <asm/current.h>
    1.10  #include <asm/hcalls.h>
    1.11  
    1.12 -extern void idle_loop(void);
    1.13 -
    1.14  #define next_arg(fmt, args) ({                                              \
    1.15      unsigned long __arg;                                                    \
    1.16      switch ( *(fmt)++ )                                                     \
    1.17 @@ -47,6 +46,7 @@ extern void idle_loop(void);
    1.18      }                                                                       \
    1.19      __arg;                                                                  \
    1.20  })
    1.21 +extern void idle_loop(void);
    1.22  
    1.23  unsigned long hypercall_create_continuation(unsigned int op,
    1.24          const char *format, ...)
    1.25 @@ -179,7 +179,6 @@ void dump_pageframe_info(struct domain *
    1.26      }
    1.27  }
    1.28  
    1.29 -
    1.30  void context_switch(struct vcpu *prev, struct vcpu *next)
    1.31  {
    1.32      struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
    1.33 @@ -253,3 +252,30 @@ void domain_relinquish_resources(struct 
    1.34  void arch_dump_domain_info(struct domain *d)
    1.35  {
    1.36  }
    1.37 +
    1.38 +extern void sleep(void);
    1.39 +static void safe_halt(void)
    1.40 +{
    1.41 +    int cpu = smp_processor_id();
    1.42 +
    1.43 +    while (!softirq_pending(cpu))
    1.44 +        sleep();
    1.45 +}
    1.46 +
    1.47 +static void default_idle(void)
    1.48 +{
    1.49 +    local_irq_disable();
    1.50 +    if ( !softirq_pending(smp_processor_id()) )
    1.51 +        safe_halt();
    1.52 +    else
    1.53 +        local_irq_enable();
    1.54 +}
    1.55 +
    1.56 +void idle_loop(void)
    1.57 +{
    1.58 +    for ( ; ; ) {
    1.59 +        page_scrub_schedule_work();
    1.60 +        default_idle();
    1.61 +        do_softirq();
    1.62 +    }
    1.63 +}
     2.1 --- a/xen/arch/powerpc/setup.c	Fri Sep 01 12:19:41 2006 -0400
     2.2 +++ b/xen/arch/powerpc/setup.c	Fri Sep 01 12:31:56 2006 -0400
     2.3 @@ -82,7 +82,6 @@ ulong isa_io_base;
     2.4  struct ns16550_defaults ns16550;
     2.5  
     2.6  extern char __per_cpu_start[], __per_cpu_data_end[], __per_cpu_end[];
     2.7 -extern void idle_loop(void);
     2.8  
     2.9  /* move us to a header file */
    2.10  extern void initialize_keytable(void);
    2.11 @@ -102,21 +101,6 @@ unsigned long kernel_text_end(void)
    2.12      return (unsigned long) &_etext;
    2.13  }
    2.14  
    2.15 -void idle_loop(void)
    2.16 -{
    2.17 -    int cpu = smp_processor_id();
    2.18 -
    2.19 -    for ( ; ; )
    2.20 -    {
    2.21 -        while (!softirq_pending(cpu)) {
    2.22 -            void sleep(void);
    2.23 -            page_scrub_schedule_work();
    2.24 -            sleep();
    2.25 -        }
    2.26 -        do_softirq();
    2.27 -    }
    2.28 -}
    2.29 -
    2.30  static void __init do_initcalls(void)
    2.31  {
    2.32      initcall_t *call;
    2.33 @@ -210,6 +194,8 @@ static void __init start_of_day(void)
    2.34      schedulers_start();
    2.35  }
    2.36  
    2.37 +extern void idle_loop(void);
    2.38 +
    2.39  void startup_cpu_idle_loop(void)
    2.40  {
    2.41      struct vcpu *v = current;