Re: [RFC PATCH 3/7] target-arm: Handle exit reason KVM_EXIT_SYSTEM_EVENT

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

 



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@xxxxxxxxxx>
> Signed-off-by: Anup Patel <anup.patel@xxxxxxxxxx>
> ---
>  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?

-Christoffer
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux