WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [xen-devel][PATCH][VTD] Fix apic pin to interrupt remapping table in

To: 'Isaku Yamahata' <yamahata@xxxxxxxxxxxxx>, 'Keir Fraser' <keir.fraser@xxxxxxxxxxxxx>
Subject: RE: [xen-devel][PATCH][VTD] Fix apic pin to interrupt remapping table index
From: "Han, Weidong" <weidong.han@xxxxxxxxx>
Date: Thu, 4 Jun 2009 13:39:42 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: 'xen-devel' <xen-devel@xxxxxxxxxxxxxxxxxxx>, 'Jan Beulich' <JBeulich@xxxxxxxxxx>
Delivery-date: Wed, 03 Jun 2009 22:42:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20090604035904.GN9176%yamahata@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <715D42877B251141A38726ABF5CABF2C054590BA1C@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <C64C2503.71D3%keir.fraser@xxxxxxxxxxxxx> <20090604035904.GN9176%yamahata@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcnkyNM3VhUovWdsSS6E6o9aWWLmVAADYroQ
Thread-topic: [xen-devel][PATCH][VTD] Fix apic pin to interrupt remapping table index
Look fine for me. Thanks.

Regards,
Weidong

Isaku Yamahata wrote:
> On Wed, Jun 03, 2009 at 01:02:59PM +0100, Keir Fraser wrote:
>> Wasteful of memory, so I checked in a modified version as c/s 19707,
>> which dynamically sizes the array. Please take a look and check it's
>> okay. 
>> 
>> It probably breaks ia64 build due to undefined nr_ioapics and
>> nr_ioapic_registers[], but I think yours broke ia64 too so we're
>> even. :-) 
>> 
>> Isaku: can you suggest ia64 equivalents for nr_ioapics and
>> nr_ioapic_registers[]? We can do some ifdef magic at the top of
>> intremap.c, including defining a nr_ioapic_registers() macro, if
>> that helps. 
> 
> Here is the patch. I'm going to test it, though.
> 
> [] operator is an obstacle to use CPP magic.
> So I did just quick hack to send this patch as soon as possible.
> You may want to wrap it with a function.
> 
> thanks,
> 
> vtd: ia64 fix of intremap.c
> 
> 19707:07cf79dfb59c caused compilation error on ia64.
> This patch fixes it.
> 
> Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
> 
> diff --git a/xen/arch/ia64/linux-xen/iosapic.c
> b/xen/arch/ia64/linux-xen/iosapic.c ---
> a/xen/arch/ia64/linux-xen/iosapic.c +++
> b/xen/arch/ia64/linux-xen/iosapic.c @@ -1275,4 +1275,22 @@ int
>       iosapic_guest_write(unsigned long ph
>       spin_unlock_irqrestore(&irq_descp(vec)->lock, flags); return 0;
>  }
> +
> +/* for vtd interrupt remapping. xen/drivers/vtd/intremap.c */
> +int iosapic_get_nr_iosapics(void)
> +{
> +     int index;
> +
> +     for (index = NR_IOSAPICS - 1; index >= 0; index--) {
> +             if (iosapic_lists[index].addr)
> +                     break;
> +     }
> +
> +     return index + 1;
> +}
> +
> +int iosapic_get_nr_pins(int index)
> +{
> +     return iosapic_lists[index].num_rte;
> +}
>  #endif /* XEN */
> diff --git a/xen/drivers/passthrough/vtd/intremap.c
> b/xen/drivers/passthrough/vtd/intremap.c ---
> a/xen/drivers/passthrough/vtd/intremap.c +++
> b/xen/drivers/passthrough/vtd/intremap.c @@ -33,6 +33,10 @@
> 
>  #ifdef __ia64__
>  #define dest_SMI -1
> +#define nr_ioapics              iosapic_get_nr_iosapics()
> +#define nr_ioapic_registers(i)  iosapic_get_nr_pins(i)
> +#else
> +#define nr_ioapic_registers(i)  nr_ioapic_registers[i]
>  #endif
> 
>  /* apic_pin_2_ir_idx[apicid][pin] = interrupt remapping table index
> */ @@ -45,7 +49,7 @@ static int init_apic_pin_2_ir_idx(void)
> 
>      nr_pins = 0;
>      for ( i = 0; i < nr_ioapics; i++ )
> -        nr_pins += nr_ioapic_registers[i];
> +        nr_pins += nr_ioapic_registers(i);
> 
>      _apic_pin_2_ir_idx = xmalloc_array(unsigned int, nr_pins);
>      apic_pin_2_ir_idx = xmalloc_array(unsigned int *, nr_ioapics);
> @@ -63,7 +67,7 @@ static int init_apic_pin_2_ir_idx(void)
>      for ( i = 0; i < nr_ioapics; i++ )
>      {
>          apic_pin_2_ir_idx[i] = &_apic_pin_2_ir_idx[nr_pins];
> -        nr_pins += nr_ioapic_registers[i];
> +        nr_pins += nr_ioapic_registers(i);
>      }
> 
>      return 0;
> diff --git a/xen/include/asm-ia64/linux-xen/asm/iosapic.h
> b/xen/include/asm-ia64/linux-xen/asm/iosapic.h ---
> a/xen/include/asm-ia64/linux-xen/asm/iosapic.h +++
> b/xen/include/asm-ia64/linux-xen/asm/iosapic.h @@ -186,6 +186,9 @@
>  struct rte_entry { #define IOSAPIC_RTEINDEX(reg)     (((reg) - 0x10) >>
>  1) extern unsigned long ia64_vector_mask[];
>  extern unsigned long ia64_xen_vector[];
> +
> +int iosapic_get_nr_iosapics(void);
> +int iosapic_get_nr_pins(int index);
>  #endif /* XEN */
> 
>  #define IO_APIC_BASE(idx) ((unsigned int *)iosapic_lists[idx].addr)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel