qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH 3/7] target-arm: Handle exit reason KVM_EXIT


From: Peter Maydell
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

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

On 14 March 2014 03:43, Christoffer Dall <address@hidden> 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 <address@hidden>
>> Signed-off-by: Anup Patel <address@hidden>
>> ---
>>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]