ia64/xen-unstable

changeset 2784:58a1c7dcf446

bitkeeper revision 1.1159.1.313 (4183a753sZaTRnFt62Hatj2K05Alhw)

Always disable interrupts before running PCI-BIOS code. Some BIOSes misalign
teh stack pointer while they run, for example, which can confuse Xen
interrupt handlers.
author kaf24@freefall.cl.cam.ac.uk
date Sat Oct 30 14:38:11 2004 +0000 (2004-10-30)
parents 86d715dd8522
children 209dc445dc31 b185ccca653c
files xen/arch/x86/pci-pc.c xen/arch/x86/traps.c
line diff
     1.1 --- a/xen/arch/x86/pci-pc.c	Sat Oct 30 11:42:28 2004 +0000
     1.2 +++ b/xen/arch/x86/pci-pc.c	Sat Oct 30 14:38:11 2004 +0000
     1.3 @@ -682,7 +682,9 @@ static int __devinit pci_bios_find_devic
     1.4  {
     1.5  	unsigned short bx;
     1.6  	unsigned short ret;
     1.7 +	unsigned long flags;
     1.8  
     1.9 +	__save_flags(flags); __cli();
    1.10  	__asm__("lcall *(%%edi); cld\n\t"
    1.11  		"jc 1f\n\t"
    1.12  		"xor %%ah, %%ah\n"
    1.13 @@ -694,6 +696,7 @@ static int __devinit pci_bios_find_devic
    1.14  		  "d" (vendor),
    1.15  		  "S" ((int) index),
    1.16  		  "D" (&pci_indirect));
    1.17 +	__restore_flags(flags);
    1.18  	*bus = (bx >> 8) & 0xff;
    1.19  	*device_fn = bx & 0xff;
    1.20  	return (int) (ret & 0xff00) >> 8;
    1.21 @@ -1000,6 +1003,7 @@ struct irq_routing_table * __devinit pci
    1.22  	struct irq_routing_table *rt = NULL;
    1.23  	int ret, map;
    1.24  	unsigned long page;
    1.25 +	unsigned long flags;
    1.26  
    1.27  	if (!pci_bios_present)
    1.28  		return NULL;
    1.29 @@ -1011,6 +1015,7 @@ struct irq_routing_table * __devinit pci
    1.30  	opt.segment = __KERNEL_DS;
    1.31  
    1.32  	DBG("PCI: Fetching IRQ routing table... ");
    1.33 +	__save_flags(flags); __cli();
    1.34  	__asm__("push %%es\n\t"
    1.35  		"push %%ds\n\t"
    1.36  		"pop  %%es\n\t"
    1.37 @@ -1026,6 +1031,7 @@ struct irq_routing_table * __devinit pci
    1.38  		  "D" (&opt),
    1.39  		  "S" (&pci_indirect)
    1.40                  : "memory");
    1.41 +	__restore_flags(flags);
    1.42  	DBG("OK  ret=%d, size=%d, map=%x\n", ret, opt.size, map);
    1.43  	if (ret & 0xff00)
    1.44  		printk(KERN_ERR "PCI: Error %02x when fetching IRQ routing table.\n", (ret >> 8) & 0xff);
    1.45 @@ -1047,7 +1053,9 @@ struct irq_routing_table * __devinit pci
    1.46  int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq)
    1.47  {
    1.48  	int ret;
    1.49 +	unsigned long flags;
    1.50  
    1.51 +	__save_flags(flags); __cli();
    1.52  	__asm__("lcall *(%%esi); cld\n\t"
    1.53  		"jc 1f\n\t"
    1.54  		"xor %%ah, %%ah\n"
    1.55 @@ -1057,6 +1065,7 @@ int pcibios_set_irq_routing(struct pci_d
    1.56  		  "b" ((dev->bus->number << 8) | dev->devfn),
    1.57  		  "c" ((irq << 8) | (pin + 10)),
    1.58  		  "S" (&pci_indirect));
    1.59 +	__restore_flags(flags);
    1.60  	return !(ret & 0xff00);
    1.61  }
    1.62  
     2.1 --- a/xen/arch/x86/traps.c	Sat Oct 30 11:42:28 2004 +0000
     2.2 +++ b/xen/arch/x86/traps.c	Sat Oct 30 14:38:11 2004 +0000
     2.3 @@ -63,8 +63,6 @@ static struct tss_struct doublefault_tss
     2.4  static unsigned char doublefault_stack[DOUBLEFAULT_STACK_SIZE];
     2.5  
     2.6  asmlinkage int hypercall(void);
     2.7 -asmlinkage void lcall7(void);
     2.8 -asmlinkage void lcall27(void);
     2.9  
    2.10  /* Master table, and the one used by CPU0. */
    2.11  struct desc_struct idt_table[256] = { {0, 0}, };