From patchwork Tue Apr 1 11:53:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 27532 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C4E4F20341 for ; Tue, 1 Apr 2014 11:55:37 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf33530193obc.1 for ; Tue, 01 Apr 2014 04:55:37 -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=eBGkGliZZw41s1odcxxmF9fEtD8Nll0XmlwGsl0leDJGE/8FTSO+9wpPNl/4CajSZk SiLnmOe0sSLgAyfGj094XszKIH6gCftC2WbiBYH0fqGNHLxiqdAFX6O11JhpKfaK20tE yA4KNw6ZP0PEkF3FCN6yx+RciDcwv29Aq9WMi+icE5fAq8j7OfLf+AWJzyaus6dpsorN OW+NcQKSMtCtQop3t1Sv22wzlFE4fwdTf/6EL5KgEQFLwUyu0RS4FHTuTHEK7ATujeLP oBr/FWk4mFu2LmIBMJ6eu2fE6tbUDvPzymZhz5ze3Vindh7KeX5CacXK5aPcmhODEvz9 k6IA== X-Gm-Message-State: ALoCoQl/+24mFMNRVEJRmB9DSzuz1Aw3tLyMrR56XIUJzP1b2D9h16ZywsHY82jUZTEPjj5oJDPq X-Received: by 10.182.125.134 with SMTP id mq6mr12755003obb.1.1396353337216; Tue, 01 Apr 2014 04:55:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.112 with SMTP id p103ls2866115qga.41.gmail; Tue, 01 Apr 2014 04:55:37 -0700 (PDT) X-Received: by 10.221.4.66 with SMTP id ob2mr930866vcb.28.1396353337121; Tue, 01 Apr 2014 04:55:37 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id x18si3452799vcf.207.2014.04.01.04.55.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Apr 2014 04:55:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id il7so9346138vcb.4 for ; Tue, 01 Apr 2014 04:55:37 -0700 (PDT) X-Received: by 10.52.104.33 with SMTP id gb1mr143952vdb.45.1396353337041; Tue, 01 Apr 2014 04:55:37 -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.12.8 with SMTP id v8csp229846vcv; Tue, 1 Apr 2014 04:55:36 -0700 (PDT) X-Received: by 10.224.115.68 with SMTP id h4mr34776103qaq.35.1396353336493; Tue, 01 Apr 2014 04:55:36 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d10si7448669qaf.101.2014.04.01.04.55.36 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 01 Apr 2014 04:55:36 -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]:59744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUxI0-0008KF-3V for patch@linaro.org; Tue, 01 Apr 2014 07:55:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUxGu-0006ti-Uj for qemu-devel@nongnu.org; Tue, 01 Apr 2014 07:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUxGl-0007WZ-ER for qemu-devel@nongnu.org; Tue, 01 Apr 2014 07:54:28 -0400 Received: from mail-pb0-f44.google.com ([209.85.160.44]:41252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUxGl-0007WL-8U for qemu-devel@nongnu.org; Tue, 01 Apr 2014 07:54:19 -0400 Received: by mail-pb0-f44.google.com with SMTP id rp16so9726540pbb.31 for ; Tue, 01 Apr 2014 04:54:18 -0700 (PDT) X-Received: by 10.68.217.10 with SMTP id ou10mr9578641pbc.140.1396353258480; Tue, 01 Apr 2014 04:54:18 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id ix2sm49532958pbc.45.2014.04.01.04.54.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Apr 2014 04:54:17 -0700 (PDT) From: Pranavkumar Sawargaonkar To: qemu-devel@nongnu.org Date: Tue, 1 Apr 2014 17:23:48 +0530 Message-Id: <1396353232-3835-3-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1396353232-3835-1-git-send-email-pranavkumar@linaro.org> References: <1396353232-3835-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.160.44 Cc: peter.maydell@linaro.org, Anup Patel , patches@apm.com, kvmarm@list.cs.columbia.edu, christoffer.dall@linaro.org, Pranavkumar Sawargaonkar Subject: [Qemu-devel] [RFC PATCH V2 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: 209.85.220.173 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);