direct-io.hg

changeset 12338:452010ddef24

[HVM] Change vlapic printk()s into appropriate gdprintk()s.
Simplify apic_round_robin().
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Nov 09 18:14:53 2006 +0000 (2006-11-09)
parents 617c187322ab
children 08b38d041269
files xen/arch/ia64/vmx/vlsapic.c xen/arch/x86/hvm/vioapic.c xen/arch/x86/hvm/vlapic.c xen/include/asm-ia64/vmx_platform.h xen/include/asm-x86/hvm/vlapic.h
line diff
     1.1 --- a/xen/arch/ia64/vmx/vlsapic.c	Thu Nov 09 17:53:05 2006 +0000
     1.2 +++ b/xen/arch/ia64/vmx/vlsapic.c	Thu Nov 09 18:14:53 2006 +0000
     1.3 @@ -330,7 +330,6 @@ int vlapic_match_logical_addr(struct vla
     1.4  }
     1.5  
     1.6  struct vlapic* apic_round_robin(struct domain *d,
     1.7 -				uint8_t dest_mode,
     1.8  				uint8_t vector,
     1.9  				uint32_t bitmap)
    1.10  {
     2.1 --- a/xen/arch/x86/hvm/vioapic.c	Thu Nov 09 17:53:05 2006 +0000
     2.2 +++ b/xen/arch/x86/hvm/vioapic.c	Thu Nov 09 18:14:53 2006 +0000
     2.3 @@ -403,7 +403,7 @@ static void ioapic_deliver(struct vioapi
     2.4          }
     2.5          else
     2.6  #endif
     2.7 -            target = apic_round_robin(vioapic_domain(vioapic), dest_mode,
     2.8 +            target = apic_round_robin(vioapic_domain(vioapic),
     2.9                                        vector, deliver_bitmask);
    2.10          if ( target != NULL )
    2.11          {
     3.1 --- a/xen/arch/x86/hvm/vlapic.c	Thu Nov 09 17:53:05 2006 +0000
     3.2 +++ b/xen/arch/x86/hvm/vlapic.c	Thu Nov 09 18:14:53 2006 +0000
     3.3 @@ -246,8 +246,8 @@ static int vlapic_match_dest(struct vcpu
     3.4                       (dest == 0xff) )
     3.5                  {
     3.6                      /* What shall we do now? */
     3.7 -                    printk("Broadcast IPI with lowest priority "
     3.8 -                           "delivery mode\n");
     3.9 +                    gdprintk(XENLOG_ERR, "Broadcast IPI with lowest priority "
    3.10 +                             "delivery mode\n");
    3.11                      domain_crash_synchronous();
    3.12                  }
    3.13                  result = ((GET_APIC_LOGICAL_ID(ldr) == (dest & 0xf)) ?
    3.14 @@ -287,7 +287,8 @@ static int vlapic_accept_irq(struct vcpu
    3.15      int result = 0;
    3.16      struct vlapic *vlapic = vcpu_vlapic(v);
    3.17  
    3.18 -    switch ( delivery_mode ) {
    3.19 +    switch ( delivery_mode )
    3.20 +    {
    3.21      case APIC_DM_FIXED:
    3.22      case APIC_DM_LOWEST:
    3.23          /* FIXME add logic for vcpu on reset */
    3.24 @@ -314,13 +315,12 @@ static int vlapic_accept_irq(struct vcpu
    3.25          break;
    3.26  
    3.27      case APIC_DM_REMRD:
    3.28 -        printk("Ignore deliver mode 3 in vlapic_accept_irq\n");
    3.29 +        gdprintk(XENLOG_WARNING, "Ignoring delivery mode 3\n");
    3.30          break;
    3.31  
    3.32      case APIC_DM_SMI:
    3.33      case APIC_DM_NMI:
    3.34 -        /* Fixme */
    3.35 -        printk("TODO: for guest SMI/NMI\n");
    3.36 +        gdprintk(XENLOG_WARNING, "Ignoring guest SMI/NMI\n");
    3.37          break;
    3.38  
    3.39      case APIC_DM_INIT:
    3.40 @@ -348,7 +348,7 @@ static int vlapic_accept_irq(struct vcpu
    3.41  
    3.42          if ( test_bit(_VCPUF_initialised, &v->vcpu_flags) )
    3.43          {
    3.44 -            printk("SIPI for initialized vcpu vcpuid %x\n", v->vcpu_id);
    3.45 +            gdprintk(XENLOG_ERR, "SIPI for initialized vcpu %x\n", v->vcpu_id);
    3.46              domain_crash_synchronous();
    3.47          }
    3.48  
    3.49 @@ -357,7 +357,8 @@ static int vlapic_accept_irq(struct vcpu
    3.50          break;
    3.51  
    3.52      default:
    3.53 -        printk("TODO: not support interrupt type %x\n", delivery_mode);
    3.54 +        gdprintk(XENLOG_ERR, "TODO: unsupported delivery mode %x\n",
    3.55 +                 delivery_mode);
    3.56          domain_crash_synchronous();
    3.57          break;
    3.58      }
    3.59 @@ -365,52 +366,31 @@ static int vlapic_accept_irq(struct vcpu
    3.60      return result;
    3.61  }
    3.62  
    3.63 -/*
    3.64 - * This function is used by both ioapic and local APIC
    3.65 - * The bitmap is for vcpu_id
    3.66 - */
    3.67 -struct vlapic *apic_round_robin(struct domain *d,
    3.68 -                                uint8_t dest_mode,
    3.69 -                                uint8_t vector,
    3.70 -                                uint32_t bitmap)
    3.71 +/* This function is used by both ioapic and lapic.The bitmap is for vcpu_id. */
    3.72 +struct vlapic *apic_round_robin(
    3.73 +    struct domain *d, uint8_t vector, uint32_t bitmap)
    3.74  {
    3.75      int next, old;
    3.76 -    struct vlapic* target = NULL;
    3.77 -
    3.78 -    if ( dest_mode == 0 ) /* Physical mode */
    3.79 -    {
    3.80 -        printk("<apic_round_robin> lowest priority for physical mode.\n");
    3.81 -        return NULL;
    3.82 -    }
    3.83 -
    3.84 -    if ( !bitmap )
    3.85 -    {
    3.86 -        printk("<apic_round_robin> no bit set in bitmap.\n");
    3.87 -        return NULL;
    3.88 -    }
    3.89 +    struct vlapic *target = NULL;
    3.90  
    3.91      spin_lock(&d->arch.hvm_domain.round_robin_lock);
    3.92  
    3.93      old = next = d->arch.hvm_domain.round_info[vector];
    3.94  
    3.95      /* the vcpu array is arranged according to vcpu_id */
    3.96 -    do
    3.97 -    {
    3.98 +    do {
    3.99          if ( ++next == MAX_VIRT_CPUS ) 
   3.100              next = 0;
   3.101 -        if ( d->vcpu[next] == NULL ||
   3.102 +        if ( (d->vcpu[next] == NULL) ||
   3.103               !test_bit(_VCPUF_initialised, &d->vcpu[next]->vcpu_flags) )
   3.104              continue;
   3.105  
   3.106          if ( test_bit(next, &bitmap) )
   3.107          {
   3.108              target = vcpu_vlapic(d->vcpu[next]);
   3.109 -            if ( target == NULL || !vlapic_enabled(target) )
   3.110 -            {
   3.111 -                printk("warning: targe round robin local apic disabled\n");
   3.112 -                /* XXX should we domain crash?? Or should we return NULL */
   3.113 -            }
   3.114 -            break;
   3.115 +            if ( vlapic_enabled(target) )
   3.116 +                break;
   3.117 +            target = NULL;
   3.118          }
   3.119      } while ( next != old );
   3.120  
   3.121 @@ -471,10 +451,9 @@ static void vlapic_ipi(struct vlapic *vl
   3.122          }
   3.123      }
   3.124  
   3.125 -    if ( delivery_mode == APIC_DM_LOWEST)
   3.126 +    if ( delivery_mode == APIC_DM_LOWEST )
   3.127      {
   3.128 -        target = apic_round_robin(vlapic_domain(v), dest_mode,
   3.129 -                                  vector, lpr_map);
   3.130 +        target = apic_round_robin(vlapic_domain(v), vector, lpr_map);
   3.131          if ( target != NULL )
   3.132              vlapic_accept_irq(vlapic_vcpu(target), delivery_mode,
   3.133                                vector, level, trig_mode);
   3.134 @@ -543,17 +522,12 @@ static void vlapic_read_aligned(struct v
   3.135  {
   3.136      ASSERT((len == 4) && (offset > 0) && (offset <= APIC_TDCR));
   3.137  
   3.138 -    *result = 0;
   3.139 -
   3.140 -    switch ( offset ) {
   3.141 +    switch ( offset )
   3.142 +    {
   3.143      case APIC_PROCPRI:
   3.144          *result = vlapic_get_ppr(vlapic);
   3.145          break;
   3.146  
   3.147 -    case APIC_ARBPRI:
   3.148 -        printk("access local APIC ARBPRI register which is for P6\n");
   3.149 -        break;
   3.150 -
   3.151      case APIC_TMCCT: /* Timer CCR */
   3.152          *result = vlapic_get_tmcct(vlapic);
   3.153          break;
   3.154 @@ -585,7 +559,8 @@ static unsigned long vlapic_read(struct 
   3.155      alignment = offset & 0x3;
   3.156  
   3.157      vlapic_read_aligned(vlapic, offset & ~0x3, 4, &tmp);
   3.158 -    switch ( len ) {
   3.159 +    switch ( len )
   3.160 +    {
   3.161      case 1:
   3.162          result = *((unsigned char *)&tmp + alignment);
   3.163          break;
   3.164 @@ -601,7 +576,8 @@ static unsigned long vlapic_read(struct 
   3.165          break;
   3.166  
   3.167      default:
   3.168 -        printk("Local APIC read with len=0x%lx, should be 4 instead.\n", len);
   3.169 +        gdprintk(XENLOG_ERR, "Local APIC read with len=0x%lx, "
   3.170 +                 "should be 4 instead.\n", len);
   3.171          domain_crash_synchronous();
   3.172          break;
   3.173      }
   3.174 @@ -929,9 +905,8 @@ void vlapic_post_injection(struct vcpu *
   3.175          }
   3.176          break;
   3.177  
   3.178 -    /*XXX deal with these later */
   3.179      case APIC_DM_REMRD:
   3.180 -        printk("Ignore deliver mode 3 in vlapic_post_injection\n");
   3.181 +        gdprintk(XENLOG_WARNING, "Ignoring delivery mode 3.\n");
   3.182          break;
   3.183  
   3.184      case APIC_DM_SMI:
   3.185 @@ -941,7 +916,7 @@ void vlapic_post_injection(struct vcpu *
   3.186          break;
   3.187  
   3.188      default:
   3.189 -        printk("<vlapic_post_injection> invalid deliver mode\n");
   3.190 +        gdprintk(XENLOG_WARNING, "Invalid delivery mode\n");
   3.191          break;
   3.192      }
   3.193  }
   3.194 @@ -989,7 +964,8 @@ int vlapic_init(struct vcpu *v)
   3.195      vlapic->regs_page = alloc_domheap_page(NULL);
   3.196      if ( vlapic->regs_page == NULL )
   3.197      {
   3.198 -        printk("malloc vlapic regs error for vcpu %x\n", v->vcpu_id);
   3.199 +        dprintk(XENLOG_ERR, "malloc vlapic regs error for vcpu %x\n",
   3.200 +                v->vcpu_id);
   3.201          xfree(vlapic);
   3.202          return -ENOMEM;
   3.203      }
     4.1 --- a/xen/include/asm-ia64/vmx_platform.h	Thu Nov 09 17:53:05 2006 +0000
     4.2 +++ b/xen/include/asm-ia64/vmx_platform.h	Thu Nov 09 18:14:53 2006 +0000
     4.3 @@ -55,7 +55,7 @@ typedef struct vlapic {
     4.4  extern uint64_t dummy_tmr[];
     4.5  #define VLAPIC_ID(l) (uint16_t)(((l)->vcpu->arch.privregs->lid) >> 16)
     4.6  #define VLAPIC_IRR(l) ((l)->vcpu->arch.privregs->irr[0])
     4.7 -struct vlapic* apic_round_robin(struct domain *d, uint8_t dest_mode, uint8_t vector, uint32_t bitmap);
     4.8 +struct vlapic *apic_round_robin(struct domain *d, uint8_t vector, uint32_t bitmap);
     4.9  extern int vmx_vcpu_pend_interrupt(struct vcpu *vcpu, uint8_t vector);
    4.10  static inline int vlapic_set_irq(struct vlapic *t, uint8_t vec, uint8_t trig)
    4.11  {
     5.1 --- a/xen/include/asm-x86/hvm/vlapic.h	Thu Nov 09 17:53:05 2006 +0000
     5.2 +++ b/xen/include/asm-x86/hvm/vlapic.h	Thu Nov 09 18:14:53 2006 +0000
     5.3 @@ -85,10 +85,8 @@ void vlapic_msr_set(struct vlapic *vlapi
     5.4  
     5.5  int vlapic_accept_pic_intr(struct vcpu *v);
     5.6  
     5.7 -struct vlapic *apic_round_robin(struct domain *d,
     5.8 -                                uint8_t dest_mode,
     5.9 -                                uint8_t vector,
    5.10 -                                uint32_t bitmap);
    5.11 +struct vlapic *apic_round_robin(
    5.12 +    struct domain *d, uint8_t vector, uint32_t bitmap);
    5.13  
    5.14  s_time_t get_apictime_scheduled(struct vcpu *v);
    5.15