ia64/xen-unstable

changeset 9805:42358db788fd

Propagate information about bad (or good) REGSEL register
of chipset IO-APICs to Xen. If REGSEL is bad (some old SiS
chipsets) then we have a slower read-modify-write routine.
Loosely based on an original patch from Jan Beulich.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Apr 21 10:44:54 2006 +0100 (2006-04-21)
parents 29e9a0313c09
children 6af7b456e684
files linux-2.6-xen-sparse/arch/i386/kernel/io_apic-xen.c xen/arch/x86/dom0_ops.c xen/arch/x86/io_apic.c xen/include/asm-x86/io_apic.h xen/include/public/dom0_ops.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/io_apic-xen.c	Fri Apr 21 10:11:00 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/io_apic-xen.c	Fri Apr 21 10:44:54 2006 +0100
     1.3 @@ -2483,6 +2483,12 @@ static int __init io_apic_bug_finalize(v
     1.4  {
     1.5  	if(sis_apic_bug == -1)
     1.6  		sis_apic_bug = 0;
     1.7 +	if (xen_start_info->flags & SIF_INITDOMAIN) {
     1.8 +		dom0_op_t op = { .cmd = DOM0_PLATFORM_QUIRK };
     1.9 +		op.u.platform_quirk.quirk_id = sis_apic_bug ?
    1.10 +			QUIRK_IOAPIC_BAD_REGSEL : QUIRK_IOAPIC_GOOD_REGSEL;
    1.11 +		HYPERVISOR_dom0_op(&op);
    1.12 +	}
    1.13  	return 0;
    1.14  }
    1.15  
     2.1 --- a/xen/arch/x86/dom0_ops.c	Fri Apr 21 10:11:00 2006 +0100
     2.2 +++ b/xen/arch/x86/dom0_ops.c	Fri Apr 21 10:44:54 2006 +0100
     2.3 @@ -379,13 +379,24 @@ long arch_do_dom0_op(struct dom0_op *op,
     2.4      case DOM0_PLATFORM_QUIRK:
     2.5      {
     2.6          extern int opt_noirqbalance;
     2.7 -        switch ( op->u.platform_quirk.quirk_id )
     2.8 +        int quirk_id = op->u.platform_quirk.quirk_id;
     2.9 +        switch ( quirk_id )
    2.10          {
    2.11          case QUIRK_NOIRQBALANCING:
    2.12              printk("Platform quirk -- Disabling IRQ balancing/affinity.\n");
    2.13              opt_noirqbalance = 1;
    2.14              setup_ioapic_dest();
    2.15              break;
    2.16 +        case QUIRK_IOAPIC_BAD_REGSEL:
    2.17 +        case QUIRK_IOAPIC_GOOD_REGSEL:
    2.18 +#ifndef sis_apic_bug
    2.19 +            sis_apic_bug = (quirk_id == QUIRK_IOAPIC_BAD_REGSEL);
    2.20 +            printk("Platform info -- IO-APIC REGSEL is %s\n",
    2.21 +                   sis_apic_bug ? "bad" : "good");
    2.22 +#else
    2.23 +            BUG_ON(sis_apic_bug == (quirk_id == QUIRK_IOAPIC_BAD_REGSEL));
    2.24 +#endif
    2.25 +            break;
    2.26          default:
    2.27              ret = -EINVAL;
    2.28              break;
     3.1 --- a/xen/arch/x86/io_apic.c	Fri Apr 21 10:11:00 2006 +0100
     3.2 +++ b/xen/arch/x86/io_apic.c	Fri Apr 21 10:44:54 2006 +0100
     3.3 @@ -52,6 +52,14 @@ static DEFINE_SPINLOCK(vector_lock);
     3.4  
     3.5  int skip_ioapic_setup;
     3.6  
     3.7 +#ifndef sis_apic_bug
     3.8 +/*
     3.9 + * Is the SiS APIC rmw bug present?
    3.10 + * -1 = don't know, 0 = no, 1 = yes
    3.11 + */
    3.12 +int sis_apic_bug = -1;
    3.13 +#endif
    3.14 +
    3.15  /*
    3.16   * # of IRQ routing registers
    3.17   */
     4.1 --- a/xen/include/asm-x86/io_apic.h	Fri Apr 21 10:11:00 2006 +0100
     4.2 +++ b/xen/include/asm-x86/io_apic.h	Fri Apr 21 10:44:54 2006 +0100
     4.3 @@ -139,7 +139,11 @@ static inline void io_apic_write(unsigne
     4.4   *
     4.5   * Older SiS APIC requires we rewrite the index regiser
     4.6   */
     4.7 -#define sis_apic_bug 0 /* This may need propagating from domain0. */
     4.8 +#ifdef __i386__
     4.9 +extern int sis_apic_bug;
    4.10 +#else
    4.11 +#define sis_apic_bug 0
    4.12 +#endif
    4.13  static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value)
    4.14  {
    4.15  	if (sis_apic_bug)
     5.1 --- a/xen/include/public/dom0_ops.h	Fri Apr 21 10:11:00 2006 +0100
     5.2 +++ b/xen/include/public/dom0_ops.h	Fri Apr 21 10:44:54 2006 +0100
     5.3 @@ -404,7 +404,9 @@ typedef struct dom0_getdomaininfolist {
     5.4  DEFINE_GUEST_HANDLE(dom0_getdomaininfolist_t);
     5.5  
     5.6  #define DOM0_PLATFORM_QUIRK      39
     5.7 -#define QUIRK_NOIRQBALANCING  1
     5.8 +#define QUIRK_NOIRQBALANCING      1 /* Do not restrict IO-APIC RTE targets */
     5.9 +#define QUIRK_IOAPIC_BAD_REGSEL   2 /* IO-APIC REGSEL forgets its value    */
    5.10 +#define QUIRK_IOAPIC_GOOD_REGSEL  3 /* IO-APIC REGSEL behaves properly     */
    5.11  typedef struct dom0_platform_quirk {
    5.12      /* IN variables. */
    5.13      uint32_t quirk_id;