aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-17 18:17:17 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-17 18:17:17 +0000
commit19f8e5dd2bf6f4093988b13c424a7ba35f39071d (patch)
treeb2841f06b202bd249c76cdb0c139f41231bfc821 /hw
parent4fddf62a74c26f8da3c5ee61600e4d61052b0610 (diff)
Only create as many per CPU timers as there are CPUs. (Robert Reif)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3833 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r--hw/slavio_timer.c9
-rw-r--r--hw/sun4m.c2
-rw-r--r--hw/sun4m.h2
3 files changed, 8 insertions, 5 deletions
diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c
index 7d9ee4b2ae..1018f70a9f 100644
--- a/hw/slavio_timer.c
+++ b/hw/slavio_timer.c
@@ -61,6 +61,7 @@ typedef struct SLAVIO_TIMERState {
struct SLAVIO_TIMERState *master;
int slave_index;
// system only
+ unsigned int num_slaves;
struct SLAVIO_TIMERState *slave[MAX_CPUS];
uint32_t slave_mode;
} SLAVIO_TIMERState;
@@ -230,7 +231,7 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr,
if (s->master == NULL) {
unsigned int i;
- for (i = 0; i < MAX_CPUS; i++) {
+ for (i = 0; i < s->num_slaves; i++) {
if (val & (1 << i)) {
qemu_irq_lower(s->slave[i]->irq);
s->slave[i]->limit = -1ULL;
@@ -244,7 +245,7 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr,
ptimer_run(s->slave[i]->timer, 0);
}
}
- s->slave_mode = val & ((1 << MAX_CPUS) - 1);
+ s->slave_mode = val & ((1 << s->num_slaves) - 1);
} else
DPRINTF("not system timer\n");
break;
@@ -352,13 +353,15 @@ static SLAVIO_TIMERState *slavio_timer_init(target_phys_addr_t addr,
}
void slavio_timer_init_all(target_phys_addr_t base, qemu_irq master_irq,
- qemu_irq *cpu_irqs)
+ qemu_irq *cpu_irqs, unsigned int num_cpus)
{
SLAVIO_TIMERState *master;
unsigned int i;
master = slavio_timer_init(base + SYS_TIMER_OFFSET, master_irq, NULL, 0);
+ master->num_slaves = num_cpus;
+
for (i = 0; i < MAX_CPUS; i++) {
master->slave[i] = slavio_timer_init(base + (target_phys_addr_t)
CPU_TIMER_OFFSET(i),
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 693fa696ac..5a07283583 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -436,7 +436,7 @@ static void sun4m_hw_init(const struct hwdef *hwdef, int RAM_size,
hwdef->nvram_size, 8);
slavio_timer_init_all(hwdef->counter_base, slavio_irq[hwdef->clock1_irq],
- slavio_cpu_irq);
+ slavio_cpu_irq, smp_cpus);
slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[hwdef->ms_kb_irq],
nographic);
diff --git a/hw/sun4m.h b/hw/sun4m.h
index 0a38897bba..269ca392bd 100644
--- a/hw/sun4m.h
+++ b/hw/sun4m.h
@@ -36,7 +36,7 @@ void slavio_irq_info(void *opaque);
/* slavio_timer.c */
void slavio_timer_init_all(target_phys_addr_t base, qemu_irq master_irq,
- qemu_irq *cpu_irqs);
+ qemu_irq *cpu_irqs, unsigned int num_cpus);
/* slavio_serial.c */
SerialState *slavio_serial_init(target_phys_addr_t base, qemu_irq irq,