From: Robert Reif <reif@earthlink.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] sparc32: make number of per CPU timers match number of CPUs
Date: Sun, 16 Dec 2007 18:19:32 -0500 [thread overview]
Message-ID: <4765B284.4000101@earthlink.net> (raw)
In-Reply-To: <4765AD87.4050702@earthlink.net>
[-- Attachment #1: Type: text/plain, Size: 109 bytes --]
Robert Reif wrote:
> Only create as many per CPU timers as there are CPUs.
This time with the right patch.
[-- Attachment #2: timer.diff.txt --]
[-- Type: text/plain, Size: 3327 bytes --]
Index: hw/slavio_timer.c
===================================================================
RCS file: /sources/qemu/qemu/hw/slavio_timer.c,v
retrieving revision 1.21
diff -p -u -r1.21 slavio_timer.c
--- hw/slavio_timer.c 1 Dec 2007 15:58:22 -0000 1.21
+++ hw/slavio_timer.c 16 Dec 2007 23:14:34 -0000
@@ -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
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
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,14 +353,16 @@ static SLAVIO_TIMERState *slavio_timer_i
}
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);
- for (i = 0; i < MAX_CPUS; i++) {
+ master->num_slaves = num_cpus;
+
+ for (i = 0; i < master->num_slaves; i++) {
master->slave[i] = slavio_timer_init(base + (target_phys_addr_t)
CPU_TIMER_OFFSET(i),
cpu_irqs[i], master, i);
Index: hw/sun4m.c
===================================================================
RCS file: /sources/qemu/qemu/hw/sun4m.c,v
retrieving revision 1.69
diff -p -u -r1.69 sun4m.c
--- hw/sun4m.c 10 Dec 2007 20:00:11 -0000 1.69
+++ hw/sun4m.c 16 Dec 2007 23:14:35 -0000
@@ -436,7 +436,7 @@ static void sun4m_hw_init(const struct h
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);
Index: hw/sun4m.h
===================================================================
RCS file: /sources/qemu/qemu/hw/sun4m.h,v
retrieving revision 1.4
diff -p -u -r1.4 sun4m.h
--- hw/sun4m.h 9 Dec 2007 17:03:50 -0000 1.4
+++ hw/sun4m.h 16 Dec 2007 23:14:35 -0000
@@ -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,
next prev parent reply other threads:[~2007-12-16 23:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-16 22:58 [Qemu-devel] [PATCH] sparc32: make number of per CPU timers match number of CPUs Robert Reif
2007-12-16 23:19 ` Robert Reif [this message]
2007-12-17 18:23 ` Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4765B284.4000101@earthlink.net \
--to=reif@earthlink.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.