ia64/xen-unstable

changeset 19727:abdd365e2ec3

vtd: ia64 fix of intremap.c

19707:07cf79dfb59c caused compilation error on ia64.
This patch fixes it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 04 10:48:45 2009 +0100 (2009-06-04)
parents d8b7b51f482b
children 50cf07f42fdd
files xen/arch/ia64/linux-xen/iosapic.c xen/drivers/passthrough/vtd/intremap.c xen/include/asm-ia64/linux-xen/asm/iosapic.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/iosapic.c	Thu Jun 04 10:47:56 2009 +0100
     1.2 +++ b/xen/arch/ia64/linux-xen/iosapic.c	Thu Jun 04 10:48:45 2009 +0100
     1.3 @@ -1275,4 +1275,22 @@ int iosapic_guest_write(unsigned long ph
     1.4  	spin_unlock_irqrestore(&irq_descp(vec)->lock, flags);
     1.5  	return 0;
     1.6  }
     1.7 +
     1.8 +/* for vtd interrupt remapping. xen/drivers/vtd/intremap.c */
     1.9 +int iosapic_get_nr_iosapics(void)
    1.10 +{
    1.11 +	int index;
    1.12 +
    1.13 +	for (index = NR_IOSAPICS - 1; index >= 0; index--) {
    1.14 +		if (iosapic_lists[index].addr)
    1.15 +			break;
    1.16 +	}
    1.17 +
    1.18 +	return index + 1;
    1.19 +}
    1.20 +
    1.21 +int iosapic_get_nr_pins(int index)
    1.22 +{
    1.23 +	return iosapic_lists[index].num_rte;
    1.24 +}
    1.25  #endif /* XEN */
     2.1 --- a/xen/drivers/passthrough/vtd/intremap.c	Thu Jun 04 10:47:56 2009 +0100
     2.2 +++ b/xen/drivers/passthrough/vtd/intremap.c	Thu Jun 04 10:48:45 2009 +0100
     2.3 @@ -33,6 +33,10 @@
     2.4  
     2.5  #ifdef __ia64__
     2.6  #define dest_SMI -1
     2.7 +#define nr_ioapics              iosapic_get_nr_iosapics()
     2.8 +#define nr_ioapic_registers(i)  iosapic_get_nr_pins(i)
     2.9 +#else
    2.10 +#define nr_ioapic_registers(i)  nr_ioapic_registers[i]
    2.11  #endif
    2.12  
    2.13  /* apic_pin_2_ir_idx[apicid][pin] = interrupt remapping table index */
    2.14 @@ -45,7 +49,7 @@ static int init_apic_pin_2_ir_idx(void)
    2.15  
    2.16      nr_pins = 0;
    2.17      for ( i = 0; i < nr_ioapics; i++ )
    2.18 -        nr_pins += nr_ioapic_registers[i];
    2.19 +        nr_pins += nr_ioapic_registers(i);
    2.20  
    2.21      _apic_pin_2_ir_idx = xmalloc_array(unsigned int, nr_pins);
    2.22      apic_pin_2_ir_idx = xmalloc_array(unsigned int *, nr_ioapics);
    2.23 @@ -63,7 +67,7 @@ static int init_apic_pin_2_ir_idx(void)
    2.24      for ( i = 0; i < nr_ioapics; i++ )
    2.25      {
    2.26          apic_pin_2_ir_idx[i] = &_apic_pin_2_ir_idx[nr_pins];
    2.27 -        nr_pins += nr_ioapic_registers[i];
    2.28 +        nr_pins += nr_ioapic_registers(i);
    2.29      }
    2.30  
    2.31      return 0;
     3.1 --- a/xen/include/asm-ia64/linux-xen/asm/iosapic.h	Thu Jun 04 10:47:56 2009 +0100
     3.2 +++ b/xen/include/asm-ia64/linux-xen/asm/iosapic.h	Thu Jun 04 10:48:45 2009 +0100
     3.3 @@ -186,6 +186,9 @@ struct rte_entry {
     3.4  #define IOSAPIC_RTEINDEX(reg)	(((reg) - 0x10) >> 1)
     3.5  extern unsigned long ia64_vector_mask[];
     3.6  extern unsigned long ia64_xen_vector[];
     3.7 +
     3.8 +int iosapic_get_nr_iosapics(void);
     3.9 +int iosapic_get_nr_pins(int index);
    3.10  #endif /* XEN */
    3.11  
    3.12  #define IO_APIC_BASE(idx) ((unsigned int *)iosapic_lists[idx].addr)