All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: avi@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH] Use upstream QEMU apic init/sipi handling
Date: Sun, 28 Jun 2009 18:46:08 +0300	[thread overview]
Message-ID: <20090628154608.GP20289@redhat.com> (raw)

Remove KVM specific init/sipi handling from hw/apic.c. Now when
upstream QEMU handles init/sipi in a cpu loop KVM can do the same.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/cpu-defs.h b/cpu-defs.h
index e17209a..7570096 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -140,8 +140,6 @@ typedef struct CPUWatchpoint {
 struct qemu_work_item;
 
 struct KVMCPUState {
-    int sipi_needed;
-    int init;
     pthread_t thread;
     int signalled;
     int stop;
diff --git a/hw/apic.c b/hw/apic.c
index 7ac926a..1a0d38b 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -492,9 +492,6 @@ void apic_init_reset(CPUState *env)
     s->wait_for_sipi = 1;
 
     env->halted = !(s->apicbase & MSR_IA32_APICBASE_BSP);
-
-    if (kvm_enabled() && !qemu_kvm_irqchip_in_kernel())
-        kvm_apic_init(s->cpu_env);
 }
 
 static void apic_startup(APICState *s, int vector_num)
@@ -517,8 +514,6 @@ void apic_sipi(CPUState *env)
                            0xffff, 0);
     env->halted = 0;
     s->wait_for_sipi = 0;
-    if (kvm_enabled() && !qemu_kvm_irqchip_in_kernel())
-	kvm_update_after_sipi(env);
 }
 
 static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode,
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index a78073e..1eb147e 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -1576,45 +1576,10 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
     return kvm_get_supported_cpuid(kvm_context, function, reg);
 }
 
-void kvm_update_after_sipi(CPUState *env)
-{
-    env->kvm_cpu_state.sipi_needed = 1;
-    kvm_update_interrupt_request(env);
-}
-
-void kvm_apic_init(CPUState *env)
-{
-    if (!cpu_is_bsp(env))
-	env->kvm_cpu_state.init = 1;
-    kvm_update_interrupt_request(env);
-}
-
-static void update_regs_for_sipi(CPUState *env)
-{
-    kvm_arch_update_regs_for_sipi(env);
-    env->kvm_cpu_state.sipi_needed = 0;
-}
-
-static void update_regs_for_init(CPUState *env)
-{
-    SegmentCache cs = env->segs[R_CS];
-
-    cpu_reset(env);
-    /* cpu_reset() clears env->halted, cpu should be halted after init */
-    env->halted = 1;
-
-    /* restore SIPI vector */
-    if(env->kvm_cpu_state.sipi_needed)
-        env->segs[R_CS] = cs;
-
-    env->kvm_cpu_state.init = 0;
-    kvm_arch_load_regs(env);
-}
-
 void kvm_arch_process_irqchip_events(CPUState *env)
 {
-    if (env->kvm_cpu_state.init)
-        update_regs_for_init(env);
-    if (env->kvm_cpu_state.sipi_needed)
-        update_regs_for_sipi(env);
+    if (env->interrupt_request & CPU_INTERRUPT_INIT)
+        do_cpu_init(env);
+    if (env->interrupt_request & CPU_INTERRUPT_SIPI)
+        do_cpu_sipi(env);
 }
--
			Gleb.

             reply	other threads:[~2009-06-28 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-28 15:46 Gleb Natapov [this message]
2009-06-29  9:13 ` [PATCH] Use upstream QEMU apic init/sipi handling Avi Kivity

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=20090628154608.GP20289@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.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.