aboutsummaryrefslogtreecommitdiffstats
path: root/xen
diff options
context:
space:
mode:
Diffstat (limited to 'xen')
-rw-r--r--xen/arch/i386/io_apic.c2
-rw-r--r--xen/arch/i386/irq.c4
-rw-r--r--xen/arch/i386/setup.c8
-rw-r--r--xen/common/kernel.c3
-rw-r--r--xen/common/keyhandler.c61
-rw-r--r--xen/common/perfc.c8
-rw-r--r--xen/drivers/block/xen_block.c20
-rw-r--r--xen/drivers/block/xen_segment.c12
-rw-r--r--xen/drivers/char/xen_kbd.c3
-rw-r--r--xen/drivers/char/xen_serial.c2
-rw-r--r--xen/drivers/ide/ide-xeno.c7
-rw-r--r--xen/drivers/net/tg3.c6
-rw-r--r--xen/drivers/scsi/scsi.c1
-rw-r--r--xen/drivers/scsi/sd.c10
-rw-r--r--xen/include/asm-i386/irq.h1
-rw-r--r--xen/include/asm-i386/pci.h12
-rw-r--r--xen/include/asm-i386/smpboot.h11
17 files changed, 96 insertions, 75 deletions
diff --git a/xen/arch/i386/io_apic.c b/xen/arch/i386/io_apic.c
index 878c189afb..6ad37f2399 100644
--- a/xen/arch/i386/io_apic.c
+++ b/xen/arch/i386/io_apic.c
@@ -826,7 +826,6 @@ void __init print_IO_APIC(void)
UNEXPECTED_IO_APIC();
}
-#if 0
printk(KERN_DEBUG ".... IRQ redirection table:\n");
printk(KERN_DEBUG " NR Log Phy Mask Trig IRR Pol"
@@ -871,7 +870,6 @@ void __init print_IO_APIC(void)
entry = irq_2_pin + entry->next;
}
printk("\n");
-#endif
}
printk(KERN_INFO ".................................... done.\n");
diff --git a/xen/arch/i386/irq.c b/xen/arch/i386/irq.c
index 312cfe7970..6485b6ba15 100644
--- a/xen/arch/i386/irq.c
+++ b/xen/arch/i386/irq.c
@@ -537,7 +537,9 @@ asmlinkage unsigned int do_IRQ(struct pt_regs regs)
do_softirq();
rdtscl(cc_end);
- perfc_adda(irq_time, cpu, cc_end - cc_start);
+
+ if(!action || (!(action->flags & SA_NOPROFILE)) )
+ perfc_adda(irq_time, cpu, cc_end - cc_start);
return 1;
}
diff --git a/xen/arch/i386/setup.c b/xen/arch/i386/setup.c
index f4f62c2b02..1e5f35a73e 100644
--- a/xen/arch/i386/setup.c
+++ b/xen/arch/i386/setup.c
@@ -292,7 +292,7 @@ void __init start_of_day(void)
extern void initialize_keytable();
extern void initialize_serial(void);
extern void initialize_keyboard(void);
-
+ extern int opt_nosmp;
unsigned long low_mem_size;
/*
@@ -327,7 +327,11 @@ void __init start_of_day(void)
#ifndef CONFIG_SMP
APIC_init_uniprocessor();
#else
- smp_boot_cpus(); /*
+ if( opt_nosmp )
+ APIC_init_uniprocessor();
+ else
+ smp_boot_cpus();
+ /*
* Does loads of stuff, including kicking the local
* APIC, and the IO APIC after other CPUs are booted.
* Each IRQ is preferably handled by IO-APIC, but
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 344eae59c2..28eaae9b51 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -41,7 +41,7 @@ unsigned int opt_ser_baud = 9600; /* default baud for COM1 */
unsigned int opt_dom0_mem = 16000; /* default kbytes for DOM0 */
unsigned int opt_ne_base = 0; /* NE2k NICs cannot be probed */
unsigned char opt_ifname[10] = "eth0";
-int opt_noht=0, opt_noacpi=0;
+int opt_noht=0, opt_noacpi=0, opt_nosmp;
enum { OPT_IP, OPT_STR, OPT_UINT, OPT_BOOL };
static struct {
unsigned char *name;
@@ -55,6 +55,7 @@ static struct {
{ "ifname", OPT_STR, &opt_ifname },
{ "noht", OPT_BOOL, &opt_noht },
{ "noacpi", OPT_BOOL, &opt_noacpi },
+ { "nosmp", OPT_BOOL, &opt_nosmp },
{ NULL, 0, NULL }
};
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index e9f99fcf89..dde9e0ff10 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -17,18 +17,18 @@ void add_key_handler(u_char key, key_handler *handler, char *desc)
char *str;
if(key_table[key].handler != NULL)
- printk("Warning: overwriting handler for key 0x%x\n", key);
+ printk("Warning: overwriting handler for key 0x%x\n", key);
key_table[key].handler = handler;
str = key_table[key].desc;
for(i = 0; i < STR_MAX; i++) {
- if(*desc)
- *str++ = *desc++;
- else break;
+ if(*desc)
+ *str++ = *desc++;
+ else break;
}
if (i == STR_MAX)
- key_table[key].desc[STR_MAX-1] = '\0';
+ key_table[key].desc[STR_MAX-1] = '\0';
return;
}
@@ -39,21 +39,21 @@ key_handler *get_key_handler(u_char key)
}
-void show_handlers(u_char key, void *dev_id, struct pt_regs *regs)
+static void show_handlers(u_char key, void *dev_id, struct pt_regs *regs)
{
int i;
printk("'%c' pressed -> showing installed handlers\n", key);
for(i=0; i < KEY_MAX; i++)
- if(key_table[i].handler)
- printk(" key '%c' (ascii '%02x') => %s\n",
- (i<33 || i>126)?(' '):(i),i,
- key_table[i].desc);
+ if(key_table[i].handler)
+ printk(" key '%c' (ascii '%02x') => %s\n",
+ (i<33 || i>126)?(' '):(i),i,
+ key_table[i].desc);
return;
}
-void dump_registers(u_char key, void *dev_id, struct pt_regs *regs)
+static void dump_registers(u_char key, void *dev_id, struct pt_regs *regs)
{
extern void show_registers(struct pt_regs *regs);
@@ -62,13 +62,21 @@ void dump_registers(u_char key, void *dev_id, struct pt_regs *regs)
return;
}
-void halt_machine(u_char key, void *dev_id, struct pt_regs *regs)
+static void halt_machine(u_char key, void *dev_id, struct pt_regs *regs)
{
printk("'%c' pressed -> rebooting machine\n", key);
machine_restart(NULL);
return;
}
+static void kill_dom0(u_char key, void *dev_id, struct pt_regs *regs)
+{
+ printk("'%c' pressed -> gracefully rebooting machine\n", key);
+ kill_other_domain(0, 0);
+ return;
+}
+
+
/* XXX SMH: this is keir's fault */
static char *task_states[] =
{
@@ -90,16 +98,16 @@ void do_task_queues(u_char key, void *dev_id, struct pt_regs *regs)
p = &idle0_task;
do {
printk("Xen: DOM %d, CPU %d [has=%c], state = %s, "
- "hyp_events = %08x\n",
- p->domain, p->processor, p->has_cpu ? 'T':'F',
- task_states[p->state], p->hyp_events);
- s = p->shared_info;
- if(!is_idle_task(p)) {
- printk("Guest: events = %08lx, event_enable = %08lx\n",
- s->events, s->events_enable);
- printk("Notifying guest...\n");
- set_bit(_EVENT_DEBUG, &s->events);
- }
+ "hyp_events = %08x\n",
+ p->domain, p->processor, p->has_cpu ? 'T':'F',
+ task_states[p->state], p->hyp_events);
+ s = p->shared_info;
+ if(!is_idle_task(p)) {
+ printk("Guest: events = %08lx, event_enable = %08lx\n",
+ s->events, s->events_enable);
+ printk("Notifying guest...\n");
+ set_bit(_EVENT_DEBUG, &s->events);
+ }
} while ( (p = p->next_task) != &idle0_task );
read_unlock_irqrestore(&tasklist_lock, flags);
@@ -118,16 +126,17 @@ void initialize_keytable()
/* first initialize key handler table */
for(i = 0; i < KEY_MAX; i++)
- key_table[i].handler = (key_handler *)NULL;
-
+ key_table[i].handler = (key_handler *)NULL;
+
/* setup own handlers */
add_key_handler('a', dump_timerq, "dump ac_timer queues");
add_key_handler('d', dump_registers, "dump registers");
- add_key_handler('h', show_handlers, "show this message");
+ add_key_handler('h', show_handlers, "show this message");
add_key_handler('p', perfc_printall, "print performance counters");
add_key_handler('P', perfc_reset, "reset performance counters");
add_key_handler('q', do_task_queues, "dump task queues + guest state");
- add_key_handler('r', dump_runq, "dump run queue");
+ add_key_handler('r', dump_runq, "dump run queues");
+ add_key_handler('B', kill_dom0, "reboot machine gracefully");
add_key_handler('R', halt_machine, "reboot machine ungracefully");
return;
diff --git a/xen/common/perfc.c b/xen/common/perfc.c
index cc277a914a..704bef1d3b 100644
--- a/xen/common/perfc.c
+++ b/xen/common/perfc.c
@@ -47,18 +47,18 @@ void __perfc_print (unsigned long counter[], int offset)
return;
}
if (element_size == 0) { /* single counter */
- printf ("%10ld 0x%08lx %s\n", counter[0], counter[0],
+ printf ("%10lu 0x%08lx %s\n", counter[0], counter[0],
perfc_name[loop] + 2 + num);
} else if (cpus) { /* counter per CPU */
for (loop = 0; loop < smp_num_cpus; loop++) {
- printf ("%10ld 0x%08lx cpu[%02d] %s\n",
+ printf ("%10lu 0x%08lx cpu[%02d] %s\n",
counter[loop], counter[loop],
loop, perfc_name[loop]);
}
} else { /* show entire array */
for (loop = 0; loop < element_size; loop++) {
- printf ("%10ld 0x%08lx %s:%d\n",
+ printf ("%10lu 0x%08lx %s:%d\n",
counter[loop], counter[loop],
perfc_name[loop] + 2 + num, loop);
}
@@ -103,6 +103,8 @@ void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs)
}
}
+ //perfc_reset( key, dev_id, regs );
+
return;
}
diff --git a/xen/drivers/block/xen_block.c b/xen/drivers/block/xen_block.c
index bf9cfd7431..a49817d46f 100644
--- a/xen/drivers/block/xen_block.c
+++ b/xen/drivers/block/xen_block.c
@@ -17,10 +17,8 @@
#include <xeno/keyhandler.h>
#include <xeno/interrupt.h>
#include <xeno/segment.h>
-#include <asm/domain_page.h> /* TEST_READ_VALIDITY */
-#if 1
-#define TEST_READ_VALIDITY
+#if 0
#define DPRINTK(_f, _a...) printk( _f , ## _a )
#else
#define DPRINTK(_f, _a...) ((void)0)
@@ -206,16 +204,6 @@ static void end_block_io_op(struct buffer_head *bh, int uptodate)
DPRINTK("Buffer not up-to-date at end of operation\n");
pending_req->status = 1;
}
-#ifdef TEST_READ_VALIDITY
- else if ( pending_req->operation == READ )
- {
- unsigned long *buff = map_domain_mem(virt_to_phys(bh->b_data));
- if ( (buff[ 0] == 0xdeadbeef) &&
- (buff[127] == 0xdeadbeef) )
- printk("An unmodified buffer at sector %ld\n", bh->b_rsector);
- unmap_domain_mem(buff);
- }
-#endif
unlock_buffer(pending_req->domain,
virt_to_phys(bh->b_data),
@@ -616,12 +604,6 @@ static void dispatch_rw_block_io(struct task_struct *p, int index)
}
else
{
-#ifdef TEST_READ_VALIDITY
- unsigned long *buff = map_domain_mem(phys_seg[i].buffer);
- buff[ 0] = 0xdeadbeef;
- buff[127] = 0xdeadbeef;
- unmap_domain_mem(buff);
-#endif
bh->b_state = (1 << BH_Mapped) | (1 << BH_Read);
}
diff --git a/xen/drivers/block/xen_segment.c b/xen/drivers/block/xen_segment.c
index 4a09f511a6..dbfe699030 100644
--- a/xen/drivers/block/xen_segment.c
+++ b/xen/drivers/block/xen_segment.c
@@ -101,6 +101,7 @@ void xen_segment_probe(struct task_struct *p, xen_disk_info_t *raw_xdi)
{
int loop, i;
xen_disk_info_t *xdi = map_domain_mem(virt_to_phys(raw_xdi));
+ unsigned long capacity = 0, device;
for ( loop = 0; loop < XEN_MAX_SEGMENTS; loop++ )
{
@@ -108,13 +109,12 @@ void xen_segment_probe(struct task_struct *p, xen_disk_info_t *raw_xdi)
(xsegments[loop].domain != p->domain) )
continue;
- xdi->disks[xdi->count].device =
- MK_VIRTUAL_XENDEV(xsegments[loop].segment_number);
+ device = MK_VIRTUAL_XENDEV(xsegments[loop].segment_number);
for ( i = 0; i < xsegments[loop].num_extents; i++ )
- {
- xdi->disks[xdi->count].capacity +=
- xsegments[loop].extents[i].size;
- }
+ capacity += xsegments[loop].extents[i].size;
+
+ xdi->disks[xdi->count].device = device;
+ xdi->disks[xdi->count].capacity = capacity;
xdi->count++;
}
diff --git a/xen/drivers/char/xen_kbd.c b/xen/drivers/char/xen_kbd.c
index dc9379a06c..b103f2fb4e 100644
--- a/xen/drivers/char/xen_kbd.c
+++ b/xen/drivers/char/xen_kbd.c
@@ -1,4 +1,5 @@
#include <asm-i386/io.h>
+#include <asm-i386/irq.h>
#include <xeno/sched.h> /* this has request_irq() proto for some reason */
#include <xeno/keyhandler.h>
@@ -183,7 +184,7 @@ static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
void initialize_keyboard()
{
- if(request_irq(KEYBOARD_IRQ, keyboard_interrupt, 0, "keyboard", NULL))
+ if(request_irq(KEYBOARD_IRQ, keyboard_interrupt, SA_NOPROFILE, "keyboard", NULL))
printk("initialize_keyboard: failed to alloc IRQ %d\n", KEYBOARD_IRQ);
return;
diff --git a/xen/drivers/char/xen_serial.c b/xen/drivers/char/xen_serial.c
index 4fba991997..95107e587d 100644
--- a/xen/drivers/char/xen_serial.c
+++ b/xen/drivers/char/xen_serial.c
@@ -85,6 +85,6 @@ void initialize_serial()
outb(NS16550_MCR_OUT2, SERIAL_BASE + NS16550_MCR); /* Modem control */
outb(NS16550_IER_ERDAI, SERIAL_BASE + NS16550_IER ); /* Setup interrupts */
- if((rc = request_irq(4, serial_rx_int, 0, "serial", 0)))
+ if((rc = request_irq(4, serial_rx_int, SA_NOPROFILE, "serial", 0)))
printk("initialize_serial: failed to get IRQ4, rc=%d\n", rc);
}
diff --git a/xen/drivers/ide/ide-xeno.c b/xen/drivers/ide/ide-xeno.c
index 49ecde74e4..351e2cbcf5 100644
--- a/xen/drivers/ide/ide-xeno.c
+++ b/xen/drivers/ide/ide-xeno.c
@@ -12,7 +12,7 @@ void ide_probe_devices(xen_disk_info_t* xdi)
int loop;
unsigned int unit;
xen_disk_info_t *xen_xdi = map_domain_mem(virt_to_phys(xdi));
- unsigned long capacity;
+ unsigned long capacity, device;
ide_drive_t *drive;
for ( loop = 0; loop < MAX_HWIFS; loop++ )
@@ -25,9 +25,10 @@ void ide_probe_devices(xen_disk_info_t* xdi)
drive = &hwif->drives[unit];
if ( !drive->present ) continue;
+ device = MK_IDE_XENDEV((loop * MAX_DRIVES) + unit);
capacity = current_capacity(drive);
- xen_xdi->disks[xen_xdi->count].device =
- MK_IDE_XENDEV((loop * MAX_DRIVES) + unit);
+
+ xen_xdi->disks[xen_xdi->count].device = device;
xen_xdi->disks[xen_xdi->count].capacity = capacity;
xen_xdi->count++;
diff --git a/xen/drivers/net/tg3.c b/xen/drivers/net/tg3.c
index 41f680904b..3e50ba408b 100644
--- a/xen/drivers/net/tg3.c
+++ b/xen/drivers/net/tg3.c
@@ -2099,6 +2099,12 @@ static void tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
int budget = 1000;
tg3_poll( dev, &budget );
+
+ tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
+ 0x00000000);
+ tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW);
+
+
}
#endif
diff --git a/xen/drivers/scsi/scsi.c b/xen/drivers/scsi/scsi.c
index 3217be195d..82e8ce78ee 100644
--- a/xen/drivers/scsi/scsi.c
+++ b/xen/drivers/scsi/scsi.c
@@ -855,6 +855,7 @@ void scsi_wait_req (Scsi_Request * SRpnt, const void *cmnd ,
*(int *)(SRpnt->sr_request.waiting) = 0;
}
}
+printk("*");
#endif
diff --git a/xen/drivers/scsi/sd.c b/xen/drivers/scsi/sd.c
index a2a245fddc..88e7ce814a 100644
--- a/xen/drivers/scsi/sd.c
+++ b/xen/drivers/scsi/sd.c
@@ -1320,17 +1320,21 @@ void scsi_probe_devices(xen_disk_info_t *xdi)
Scsi_Disk *sd;
int i;
xen_disk_info_t *xen_xdi = map_domain_mem(virt_to_phys(xdi));
+ unsigned long capacity, device;
for ( sd = rscsi_disks, i = 0; i < sd_template.dev_max; i++, sd++ )
{
if ( sd->device == NULL ) continue;
- xen_xdi->disks[xen_xdi->count].device = MK_SCSI_XENDEV(i);
- xen_xdi->disks[xen_xdi->count].capacity = sd->capacity;
+ device = MK_SCSI_XENDEV(i);
+ capacity = sd->capacity;
+
+ xen_xdi->disks[xen_xdi->count].device = device;
+ xen_xdi->disks[xen_xdi->count].capacity = capacity;
xen_xdi->count++;
printk("Disk %d: SCSI-XENO capacity %dkB (%dMB)\n",
- xen_xdi->count, sd->capacity>>1, sd->capacity>>11);
+ xen_xdi->count, capacity>>1, capacity>>11);
}
unmap_domain_mem(xen_xdi);
diff --git a/xen/include/asm-i386/irq.h b/xen/include/asm-i386/irq.h
index 41049e71b2..21c24f4483 100644
--- a/xen/include/asm-i386/irq.h
+++ b/xen/include/asm-i386/irq.h
@@ -8,6 +8,7 @@
#define SA_INTERRUPT 0x20000000
#define SA_SHIRQ 0x04000000
+#define SA_NOPROFILE 0x02000000
#define SA_SAMPLE_RANDOM 0 /* Linux driver compatibility */
diff --git a/xen/include/asm-i386/pci.h b/xen/include/asm-i386/pci.h
index 1ffade8914..a38bef4986 100644
--- a/xen/include/asm-i386/pci.h
+++ b/xen/include/asm-i386/pci.h
@@ -151,17 +151,17 @@ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
for (i = 0; i < nents; i++ ) {
if (sg[i].address && sg[i].page)
out_of_line_bug();
-
- /* not worth checking since NULL is ok says SMH */
#if 0
- else if (!sg[i].address && !sg[i].page)
+ /* Invalid check, since address==0 is valid. */
+ else if (!sg[i].address && !sg[i].page)
out_of_line_bug();
#endif
- if (sg[i].address)
- sg[i].dma_address = virt_to_bus(sg[i].address);
- else
+ /* XXX Switched round, since address==0 is valid. */
+ if (sg[i].page)
sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
+ else
+ sg[i].dma_address = virt_to_bus(sg[i].address);
}
flush_write_buffers();
diff --git a/xen/include/asm-i386/smpboot.h b/xen/include/asm-i386/smpboot.h
index ece215fab0..3ca484d531 100644
--- a/xen/include/asm-i386/smpboot.h
+++ b/xen/include/asm-i386/smpboot.h
@@ -116,6 +116,15 @@ static inline int target_cpus(void)
return cpu_online_map;
}
#else
-#define target_cpus() (0x01)
+/* KAF Xen: Round-robin allocate IRQs to CPUs. */
+static inline int target_cpus(void)
+{
+ static unsigned int cpu_field = 1;
+ do {
+ cpu_field <<= 1;
+ if ( cpu_field == 0x100 ) cpu_field = 1; /* logical field == 8 bits */
+ } while ( (cpu_field & cpu_online_map) == 0 );
+ return cpu_field;
+}
#endif
#endif