qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Anup Patel <anup.patel@linaro.org>,
	patches@apm.com, Alexander Graf <agraf@suse.de>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	Christoffer Dall <christoffer.dall@linaro.org>,
	Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Subject: Re: [Qemu-devel] [RFC PATCH 3/7] target-arm: Handle exit reason KVM_EXIT_SYSTEM_EVENT
Date: Mon, 17 Mar 2014 19:34:19 +0000	[thread overview]
Message-ID: <CAFEAcA_Go0S8JkMwcxPVuGg3ajuD9PYqTWvyvPFb7H1ox4=dJg@mail.gmail.com> (raw)
In-Reply-To: <20140314034348.GE24808@cbox>

[mail resent for the benefit of qemu-devel; apologies to those
who see it twice.]

On 14 March 2014 03:43, Christoffer Dall <christoffer.dall@linaro.org> wrote:
> On Thu, Feb 27, 2014 at 12:21:04PM +0530, Pranavkumar Sawargaonkar wrote:
>> In-kernel PSCI v0.2 emulation of KVM ARM/ARM64 forwards SYSTEM_OFF
>> and SYSTEM_RESET function calls to QEMU using KVM_EXIT_SYSTEM_EVENT
>> exit reason.
>>
>> This patch updates kvm_arch_handle_exit() to handle KVM_EXIT_SYSTEM_EVENT
>> from QEMU-side for KVM ARM/ARM64.
>>
>> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
>> Signed-off-by: Anup Patel <anup.patel@linaro.org>
>> ---
>>  target-arm/kvm.c |   30 +++++++++++++++++++++++++++++-
>>  1 file changed, 29 insertions(+), 1 deletion(-)
>>
>> diff --git a/target-arm/kvm.c b/target-arm/kvm.c
>> index 1d2688d..7c0aec6 100644
>> --- a/target-arm/kvm.c
>> +++ b/target-arm/kvm.c
>> @@ -325,7 +325,35 @@ void kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
>>
>>  int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
>>  {
>> -    return 0;
>> +    int ret = 0;
>> +
>> +    switch (run->exit_reason) {
>> +    case KVM_EXIT_SYSTEM_EVENT:
>> +        switch (run->system_event.type) {
>> +        case KVM_SYSTEM_EVENT_SHUTDOWN:
>> +            qemu_system_shutdown_request();
>> +            ret = EXCP_INTERRUPT;
>> +            break;
>> +        case KVM_SYSTEM_EVENT_RESET:
>> +            qemu_system_reset_request();
>> +            ret = EXCP_INTERRUPT;
>> +            break;
>> +        default:
>> +            fprintf(stderr, "KVM: unknown system event %d\n",
>> +                    run->system_event.type);
>> +            ret = -1;
>> +            break;
>> +        }
>> +        break;
>> +
>> +    default:
>> +        fprintf(stderr, "KVM: unknown exit reason %d\n",
>> +                run->exit_reason);
>> +        ret = -1;
>> +        break;
>> +    }
>> +
>> +    return ret;
>>  }
>>
>>  bool kvm_arch_stop_on_emulation_error(CPUState *cs)
>> --
>> 1.7.9.5
>>
>
> The KVM_EXIT_SYSTEM_EVENT is not specific to ARM is it?  Should this not
> be handled in generic code and then call out to arch-specific code for
> handlers?

Well, we should just handle this in kvm-all.c:kvm_cpu_exec(),
if the exit code is not architecture specific. The code
above for handling reset and shutdown should work fine
for every arch that implements it.

thanks
-- PMM

  parent reply	other threads:[~2014-03-17 19:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1393483868-6151-1-git-send-email-pranavkumar@linaro.org>
2014-02-27  7:11 ` [Qemu-devel] [RFC PATCH 0/7] PSCI v0.2 support for KVM ARM/ARM64 Pranavkumar Sawargaonkar
     [not found] ` <1393483868-6151-2-git-send-email-pranavkumar@linaro.org>
2014-02-27  7:12   ` [Qemu-devel] [RFC PATCH 1/7] linux-headers: Update KVM headers from v3.14-rc3 Pranavkumar Sawargaonkar
     [not found] ` <1393483868-6151-3-git-send-email-pranavkumar@linaro.org>
2014-02-27  7:13   ` [Qemu-devel] [RFC PATCH 2/7] target-arm: Try X-Gene Potenza target type for KVM Aarch64 Pranavkumar Sawargaonkar
     [not found] ` <1393483868-6151-4-git-send-email-pranavkumar@linaro.org>
2014-02-27  7:14   ` [Qemu-devel] [RFC PATCH 3/7] target-arm: Handle exit reason KVM_EXIT_SYSTEM_EVENT Pranavkumar Sawargaonkar
     [not found]   ` <20140314034348.GE24808@cbox>
2014-03-17 19:34     ` Peter Maydell [this message]
     [not found] ` <1393483868-6151-5-git-send-email-pranavkumar@linaro.org>
2014-02-27  7:15   ` [Qemu-devel] [RFC PATCH 4/7] target-arm: Provide PSCI v0.2 constants to generic QEMU code Pranavkumar Sawargaonkar
     [not found] ` <1393483868-6151-6-git-send-email-pranavkumar@linaro.org>
2014-02-27  7:16   ` [Qemu-devel] [RFC PATCH 5/7] target-arm: Enable KVM_ARM_VCPU_PSCI_0_2 feature when possible Pranavkumar Sawargaonkar
2014-03-17 19:35     ` Peter Maydell
2014-03-17 22:48       ` Christoffer Dall
     [not found] ` <1393483868-6151-7-git-send-email-pranavkumar@linaro.org>
2014-02-27  7:16   ` [Qemu-devel] [RFC PATCH 6/7] hw/arm/virt: Use PSCI v0.2 function IDs when kernel supports its Pranavkumar Sawargaonkar
     [not found]   ` <20140314034926.GF24808@cbox>
2014-03-14  6:53     ` Pranavkumar Sawargaonkar
2014-03-14 10:23       ` Mark Rutland
2014-03-14 17:10         ` Rob Herring
2014-03-17 10:09           ` Mark Rutland
     [not found] ` <1393483868-6151-8-git-send-email-pranavkumar@linaro.org>
2014-02-27  7:17   ` [Qemu-devel] [RFC PATCH 7/7] target-arm: Hacky implementation of kvm_arch_reset_vcpu() for KVM ARM64 Pranavkumar Sawargaonkar
     [not found]   ` <CAFEAcA9VcpVS_FJKYruCaWB=jr9unkor1aAzAAJX_GLC0LBouw@mail.gmail.com>
2014-02-27 10:35     ` Pranavkumar Sawargaonkar
2014-02-27 11:26       ` Peter Maydell
2014-03-14  3:51       ` Christoffer Dall
2014-03-14  6:58         ` Pranavkumar Sawargaonkar

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='CAFEAcA_Go0S8JkMwcxPVuGg3ajuD9PYqTWvyvPFb7H1ox4=dJg@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=agraf@suse.de \
    --cc=anup.patel@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=patches@apm.com \
    --cc=pranavkumar@linaro.org \
    --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).