From: Gleb Natapov <gleb@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: jan.kiszka@siemens.com, mtosatti@redhat.com,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH uq/master 2/2] kvm: forward INIT signals coming from the chipset
Date: Sun, 10 Mar 2013 13:54:39 +0200 [thread overview]
Message-ID: <20130310115439.GN11223@redhat.com> (raw)
In-Reply-To: <1362811730-6716-3-git-send-email-pbonzini@redhat.com>
On Sat, Mar 09, 2013 at 07:48:50AM +0100, Paolo Bonzini wrote:
> CPU_INTERRUPT_INIT can also be generated if you have an internal APIC,
> since the keyboard controller and the southbridge can also pulse the
> CPU's INIT# pin.
>
> Exit the VCPU is one is received, and process it by changing the
> mp_state to KVM_MP_STATE_INIT_RECEIVED.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> target-i386/kvm.c | 34 +++++++++++++++++++++++-----------
> 1 file changed, 23 insertions(+), 11 deletions(-)
>
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 0cf413d..56de77c 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -1772,14 +1772,15 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run)
> }
> }
>
> - if (!kvm_irqchip_in_kernel()) {
> - /* Force the VCPU out of its inner loop to process any INIT requests
> - * or pending TPR access reports. */
> - if (env->interrupt_request &
> - (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) {
> - cpu->exit_request = 1;
> - }
> + /* Force the VCPU out of its inner loop to process any INIT requests
> + * or (for userspace APIC, but it is cheap to combine the checks here)
> + * pending TPR access reports.
> + */
> + if (env->interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) {
> + cpu->exit_request = 1;
> + }
>
> + if (!kvm_irqchip_in_kernel()) {
> /* Try to inject an interrupt if the guest can accept it */
> if (run->ready_for_interrupt_injection &&
> (env->interrupt_request & CPU_INTERRUPT_HARD) &&
> @@ -1835,6 +1836,7 @@ int kvm_arch_process_async_events(CPUState *cs)
> {
> X86CPU *cpu = X86_CPU(cs);
> CPUX86State *env = &cpu->env;
> + int ret;
>
> if (env->interrupt_request & CPU_INTERRUPT_MCE) {
> /* We must not raise CPU_INTERRUPT_MCE if it's not supported. */
> @@ -1859,6 +1861,20 @@ int kvm_arch_process_async_events(CPUState *cs)
> }
> }
>
> + if (env->interrupt_request & CPU_INTERRUPT_INIT) {
> + kvm_cpu_synchronize_state(env);
> + if (kvm_irqchip_in_kernel()) {
> + env->mp_state = KVM_MP_STATE_INIT_RECEIVED;
> + env->interrupt_request = 0;
> + ret = kvm_put_mp_state(cpu);
> + if (ret < 0) {
> + return ret;
> + }
> + } else {
> + do_cpu_init(cpu);
> + }
> + }
> +
Why not move INIT case from below as is? Vcpu is reset to correct sate
by QEMU just like during system_reset.
> if (kvm_irqchip_in_kernel()) {
> return 0;
> }
> @@ -1872,10 +1888,6 @@ int kvm_arch_process_async_events(CPUState *cs)
> (env->interrupt_request & CPU_INTERRUPT_NMI)) {
> env->halted = 0;
> }
> - if (env->interrupt_request & CPU_INTERRUPT_INIT) {
> - kvm_cpu_synchronize_state(env);
> - do_cpu_init(cpu);
> - }
> if (env->interrupt_request & CPU_INTERRUPT_SIPI) {
> kvm_cpu_synchronize_state(env);
> do_cpu_sipi(cpu);
> --
> 1.8.1.4
--
Gleb.
next prev parent reply other threads:[~2013-03-10 11:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-09 6:48 [Qemu-devel] [PATCH uq/master 0/2] CPU reset (INIT#) support for KVM Paolo Bonzini
2013-03-09 6:48 ` [Qemu-devel] [PATCH uq/master 1/2] kvm: detect errors from kvm_arch_process_async_events Paolo Bonzini
2013-03-09 6:48 ` [Qemu-devel] [PATCH uq/master 2/2] kvm: forward INIT signals coming from the chipset Paolo Bonzini
2013-03-10 11:54 ` Gleb Natapov [this message]
2013-03-10 14:28 ` Paolo Bonzini
2013-03-10 14:55 ` Gleb Natapov
2013-03-10 15:04 ` Paolo Bonzini
2013-03-10 15:24 ` Gleb Natapov
2013-03-11 7:35 ` Paolo Bonzini
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=20130310115439.GN11223@redhat.com \
--to=gleb@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.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).