From patchwork Mon May 5 08:57:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 29618 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1AE4B2055D for ; Mon, 5 May 2014 08:59:27 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id z6sf1462248yhz.8 for ; Mon, 05 May 2014 01:59:27 -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=5zzvmcxq12s5finSrWzD2NYdLWP1lJTXf9lViK1CE/I=; b=T9HZST+qnLCVT9VM6P9W81SLtFOWpG2fM6f4/7z+8yX7lnRXBf0ldHcNEW+w6Jp618 xW5qfzPLOkwmoQ1mVH43Aguz48cEv2uRYy0a/eXtszkBL+ShITCISWIkkolSwwUlNtHQ OL7j1SrJ4Xv6cHrOObDLdtlbzZ6CnbR6KhSEZVdOuHmAxfQyyBZ2a3KQ87N2WfMu20lu BqzVonVOD1EUex8JadsXyDetvA6Zn+uOgWmFieyUDhfBnGsHipxlIRTWqSbKkpCOu84M Vof1iiDOBeq7kiV3weVKnDMnltSDOkIev80cKuTMsefkIru8CU01Kvv2DCeBVahXA58O AuCA== X-Gm-Message-State: ALoCoQl6kmHZ07WXqaO33ANfenKE6TtM883EKK2xNQZOZlCm+mIDVi6oaBDpDolyflHkRiA+SJfZ X-Received: by 10.224.13.12 with SMTP id z12mr16424476qaz.7.1399280367814; Mon, 05 May 2014 01:59:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.203 with SMTP id m69ls2469303qga.84.gmail; Mon, 05 May 2014 01:59:27 -0700 (PDT) X-Received: by 10.220.81.194 with SMTP id y2mr722389vck.29.1399280367649; Mon, 05 May 2014 01:59:27 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id bw7si1418721vcb.51.2014.05.05.01.59.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 01:59:27 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id jx11so8485238veb.0 for ; Mon, 05 May 2014 01:59:27 -0700 (PDT) X-Received: by 10.221.44.73 with SMTP id uf9mr16863446vcb.9.1399280367572; Mon, 05 May 2014 01:59:27 -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 ib8csp123981vcb; Mon, 5 May 2014 01:59:27 -0700 (PDT) X-Received: by 10.140.87.243 with SMTP id r106mr39500884qgd.75.1399280366969; Mon, 05 May 2014 01:59:26 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n7si3082374qas.10.2014.05.05.01.59.26 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 05 May 2014 01:59:26 -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]:56077 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhEkA-00071e-Mr for patch@linaro.org; Mon, 05 May 2014 04:59:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhEjP-0005ze-RH for qemu-devel@nongnu.org; Mon, 05 May 2014 04:58:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhEjJ-000712-T0 for qemu-devel@nongnu.org; Mon, 05 May 2014 04:58:39 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:48150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhEjJ-00070n-LF for qemu-devel@nongnu.org; Mon, 05 May 2014 04:58:33 -0400 Received: by mail-pa0-f45.google.com with SMTP id ey11so3682482pad.32 for ; Mon, 05 May 2014 01:58:32 -0700 (PDT) X-Received: by 10.67.13.226 with SMTP id fb2mr26859935pad.146.1399280312725; Mon, 05 May 2014 01:58:32 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id zv3sm66118407pab.20.2014.05.05.01.58.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 01:58:31 -0700 (PDT) From: Pranavkumar Sawargaonkar To: qemu-devel@nongnu.org Date: Mon, 5 May 2014 14:27:10 +0530 Message-Id: <1399280234-25036-3-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1399280234-25036-1-git-send-email-pranavkumar@linaro.org> References: <1399280234-25036-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.45 Cc: peter.maydell@linaro.org, Anup Patel , patches@apm.com, robherring2@gmail.com, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, Pranavkumar Sawargaonkar Subject: [Qemu-devel] [RFC PATCH V4 2/6] 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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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 82a9119..9335c50 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);