From patchwork Mon May 12 12:37:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 29970 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 07E2F238EB for ; Mon, 12 May 2014 12:39:21 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf41170824pab.7 for ; Mon, 12 May 2014 05:39:21 -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=QXwsc2T/wzd7WVw29Lwg/t0thfd2DTcRWVftC92y+Cg=; b=YWE0j5TYNE02Z1ZYY3y+2WeAjCkjJS+Vkv3kMAqxNPyrhq3H5QPGgpoUHHcEY6fbFy R6lZqopOuuWZ/KDzG1aqFRWJkoFjH0eltn32vqtMBpGMV6XJHyLBqcTOzfz/LrdrSnH9 GFflCIFM3EUoKCFD0Sh0rzbAZBniJyRoCq2Ga7pQV4+5lMewiPPvFin0W2uyVYdGQb2+ prohbVruvG1X0bF4lDI0nZBdm7fAx0EWp2X+frxD3pirTlrD9BhY/gCxklMR2w18PC9V WL2v9Pk3KJtIoUztrOr3HqlssU39Sn7dyXNW2gcXh/dJmIHXSru1og/ZQq+UD8b0ga8l gTvA== X-Gm-Message-State: ALoCoQlq0CRE+yCpA2Dcr9mlXzBBOkAfn+3pdgyREVpx4IuhWRvOFWOC3+gLfDjtfs18HJ1p+VOY X-Received: by 10.66.188.238 with SMTP id gd14mr13427405pac.18.1399898361263; Mon, 12 May 2014 05:39:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.163 with SMTP id c32ls1286825qga.49.gmail; Mon, 12 May 2014 05:39:21 -0700 (PDT) X-Received: by 10.58.97.243 with SMTP id ed19mr347326veb.62.1399898361052; Mon, 12 May 2014 05:39:21 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id ww7si2044292vec.210.2014.05.12.05.39.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 May 2014 05:39:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id jw12so8568068veb.5 for ; Mon, 12 May 2014 05:39:21 -0700 (PDT) X-Received: by 10.52.185.72 with SMTP id fa8mr179081vdc.12.1399898360983; Mon, 12 May 2014 05:39:20 -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 ib8csp65689vcb; Mon, 12 May 2014 05:39:20 -0700 (PDT) X-Received: by 10.224.92.144 with SMTP id r16mr38171778qam.10.1399898360485; Mon, 12 May 2014 05:39:20 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x1si5900032qal.142.2014.05.12.05.39.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 12 May 2014 05:39:20 -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]:37446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjpVo-00023b-2n for patch@linaro.org; Mon, 12 May 2014 08:39:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjpUj-0000nz-LT for qemu-devel@nongnu.org; Mon, 12 May 2014 08:38:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjpUd-0002K8-IG for qemu-devel@nongnu.org; Mon, 12 May 2014 08:38:13 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:33637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjpUd-0002K2-DS for qemu-devel@nongnu.org; Mon, 12 May 2014 08:38:07 -0400 Received: by mail-pa0-f49.google.com with SMTP id lj1so8446428pab.36 for ; Mon, 12 May 2014 05:38:06 -0700 (PDT) X-Received: by 10.66.246.229 with SMTP id xz5mr55042212pac.119.1399898286795; Mon, 12 May 2014 05:38:06 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id ek2sm22718531pbd.30.2014.05.12.05.38.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 May 2014 05:38:06 -0700 (PDT) From: Pranavkumar Sawargaonkar To: qemu-devel@nongnu.org Date: Mon, 12 May 2014 18:07:21 +0530 Message-Id: <1399898246-4831-4-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1399898246-4831-1-git-send-email-pranavkumar@linaro.org> References: <1399898246-4831-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.49 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 V5 3/8] 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) 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 Reviewed-by: Peter Maydell --- kvm-all.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kvm-all.c b/kvm-all.c index 5cb7f26..d038b46 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);