From: Glauber Costa <glommer@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH 3/4] move halted state setting to inside of cpu_x86_init
Date: Thu, 7 May 2009 14:51:02 -0400 [thread overview]
Message-ID: <1241722263-26541-4-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1241722263-26541-3-git-send-email-glommer@redhat.com>
cpus other than the first one starting at the halted state
is a safe assumption to anyone. Move it to exec.c, in common
cpu initialization code. Also, we need to keep this state when
we reset the cpu.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
exec.c | 4 ++++
hw/pc.c | 2 --
hw/sun4m.c | 2 --
target-i386/helper.c | 4 ++++
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/exec.c b/exec.c
index c5c9280..84a8e48 100644
--- a/exec.c
+++ b/exec.c
@@ -567,6 +567,10 @@ void cpu_exec_init(CPUState *env)
register_savevm("cpu", cpu_index, CPU_SAVE_VERSION,
cpu_save, cpu_load, env);
#endif
+#if !defined(CONFIG_USER_ONLY)
+ /* cpu 0 can run, others start at halted state */
+ env->halted = !!cpu_index;
+#endif
}
static inline void invalidate_page_bitmap(PageDesc *p)
diff --git a/hw/pc.c b/hw/pc.c
index b726c17..06d1fca 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -849,8 +849,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
fprintf(stderr, "Unable to find x86 CPU definition\n");
exit(1);
}
- if (i != 0)
- env->halted = 1;
if (pci_enabled) {
apic_init(env);
}
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 1f1efd0..856b636 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -403,7 +403,6 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
qemu_register_reset(main_cpu_reset, env);
} else {
qemu_register_reset(secondary_cpu_reset, env);
- env->halted = 1;
}
cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS);
env->prom_addr = hwdef->slavio_base;
@@ -1193,7 +1192,6 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
qemu_register_reset(main_cpu_reset, env);
} else {
qemu_register_reset(secondary_cpu_reset, env);
- env->halted = 1;
}
cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS);
env->prom_addr = hwdef->slavio_base;
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 2c11cd3..3131757 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -506,6 +506,10 @@ void cpu_reset(CPUX86State *env)
env->dr[7] = DR7_FIXED_1;
cpu_breakpoint_remove_all(env, BP_CPU);
cpu_watchpoint_remove_all(env, BP_CPU);
+#if !defined(CONFIG_USER_ONLY)
+ /* cpu 0 can run, others start at halted state */
+ env->halted = !!env->cpu_index;
+#endif
}
static void main_cpu_reset(void *_env)
--
1.5.6.6
next prev parent reply other threads:[~2009-05-07 18:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-07 18:50 [Qemu-devel] [PATCH 0/4] Simplify cpu_init Glauber Costa
2009-05-07 18:51 ` [Qemu-devel] [PATCH 1/4] move registering of cpu_reset to inside cpu_init Glauber Costa
2009-05-07 18:51 ` [Qemu-devel] [PATCH 2/4] move CPUID_APIC flag to where it belongs Glauber Costa
2009-05-07 18:51 ` Glauber Costa [this message]
2009-05-07 18:51 ` [Qemu-devel] [PATCH 4/4] move apic functions to a separate apic.h header Glauber Costa
2009-05-07 19:12 ` malc
2009-05-07 19:22 ` Glauber Costa
-- strict thread matches above, loose matches on Subject: below --
2009-05-06 14:49 [Qemu-devel] [PATCH 0/4] Simplify cpu initialization Glauber Costa
2009-05-06 14:49 ` [Qemu-devel] [PATCH 1/4] move registering of cpu_reset to inside cpu_init Glauber Costa
2009-05-06 14:49 ` [Qemu-devel] [PATCH 2/4] move CPUID_APIC flag to where it belongs Glauber Costa
2009-05-06 14:49 ` [Qemu-devel] [PATCH 3/4] move halted state setting to inside of cpu_x86_init Glauber Costa
2009-05-06 19:31 ` Blue Swirl
2009-05-06 21:42 ` Glauber Costa
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=1241722263-26541-4-git-send-email-glommer@redhat.com \
--to=glommer@redhat.com \
--cc=aliguori@us.ibm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).