From patchwork Thu Apr 10 11:46:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 28159 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9856520671 for ; Thu, 10 Apr 2014 11:49:02 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id x10sf11104999pdj.10 for ; Thu, 10 Apr 2014 04:49:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=xGAfmghJcjbcwBzwrnR7aISCeToadd246/xIVyn51h4=; b=BzFRy70J1XzSZH/MDcOm0+Ur0dc+fiI8rCF74dyGhgXLGK6wdXmB4qqfT/KPPxb6yA kXsgnjIue9GKaC8kv5c8tIHpOxu6QFMGSCHrzii9YZf1pnt9YocH63YxZ/4kDcipXErt 3o+NWKE0M8DCDqA6szKjCm1liRVhtDdZh+E6Bb9F0FGdmZDXO+zNGmSpZupi9TYx7si5 8AuYH707XaZMhcMrVWEuc2vMdedIH3ETGMRGFdSSUkskK82Q4EUrTTrV60Gq8UedVON/ NeR5vhATNyfVNNAYOyH+SNEnOgjrAPkCnZXCSwDuOAvJzG5odhCq8EsszoIfSBVxFgZ8 tddA== X-Gm-Message-State: ALoCoQniPIzA9mWRF/JlIFLrERdGHWAWZUcSfeZnf4WNnJ1CT6REhAM8ZCpegSXyzl+YudrZLVXz X-Received: by 10.69.29.33 with SMTP id jt1mr7898742pbd.7.1397130541767; Thu, 10 Apr 2014 04:49:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.38 with SMTP id 35ls1184487qgw.77.gmail; Thu, 10 Apr 2014 04:49:01 -0700 (PDT) X-Received: by 10.58.1.5 with SMTP id 5mr14346931vei.8.1397130541594; Thu, 10 Apr 2014 04:49:01 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id tv3si643344vdc.126.2014.04.10.04.49.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Apr 2014 04:49:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id sa20so3211826veb.22 for ; Thu, 10 Apr 2014 04:49:01 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr14235216vcb.0.1397130541521; Thu, 10 Apr 2014 04:49:01 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp52562vcb; Thu, 10 Apr 2014 04:49:01 -0700 (PDT) X-Received: by 10.224.40.71 with SMTP id j7mr1643929qae.98.1397130541052; Thu, 10 Apr 2014 04:49:01 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f33si1763485qgf.100.2014.04.10.04.49.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 10 Apr 2014 04:49:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:50414 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYDTY-0003tF-JP for patch@linaro.org; Thu, 10 Apr 2014 07:49:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYDSW-0002cK-2Z for qemu-devel@nongnu.org; Thu, 10 Apr 2014 07:48:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYDSM-0002Sf-Dl for qemu-devel@nongnu.org; Thu, 10 Apr 2014 07:47:56 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:43858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYDSM-0002SQ-8h for qemu-devel@nongnu.org; Thu, 10 Apr 2014 07:47:46 -0400 Received: by mail-pa0-f52.google.com with SMTP id rd3so3913946pab.11 for ; Thu, 10 Apr 2014 04:47:45 -0700 (PDT) X-Received: by 10.68.143.231 with SMTP id sh7mr19230700pbb.7.1397130465359; Thu, 10 Apr 2014 04:47:45 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id kt8sm19638002pab.7.2014.04.10.04.47.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Apr 2014 04:47:44 -0700 (PDT) From: Pranavkumar Sawargaonkar To: qemu-devel@nongnu.org Date: Thu, 10 Apr 2014 17:16:49 +0530 Message-Id: <1397130414-5551-3-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1397130414-5551-1-git-send-email-pranavkumar@linaro.org> References: <1397130414-5551-1-git-send-email-pranavkumar@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.52 Cc: peter.maydell@linaro.org, Anup Patel , patches@apm.com, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, Pranavkumar Sawargaonkar Subject: [Qemu-devel] [RFC PATCH V3 2/7] kvm: Handle exit reason KVM_EXIT_SYSTEM_EVENT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pranavkumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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_cpu_exec() to handle KVM_SYSTEM_EVENT_SHUTDOWN and KVM_SYSTEM_EVENT_RESET system-level events from QEMU-side. Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Anup Patel --- kvm-all.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kvm-all.c b/kvm-all.c index cd4111d..53edbc9 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1724,6 +1724,22 @@ int kvm_cpu_exec(CPUState *cpu) case KVM_EXIT_INTERNAL_ERROR: ret = kvm_handle_internal_error(cpu, run); break; + 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: + DPRINTF("kvm_arch_handle_exit\n"); + ret = kvm_arch_handle_exit(cpu, run); + break; + } + break; default: DPRINTF("kvm_arch_handle_exit\n"); ret = kvm_arch_handle_exit(cpu, run);