From patchwork Thu May 22 11:18:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 30591 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f200.google.com (mail-yk0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7A78D20369 for ; Thu, 22 May 2014 11:20:18 +0000 (UTC) Received: by mail-yk0-f200.google.com with SMTP id q9sf7229798ykb.11 for ; Thu, 22 May 2014 04:20:18 -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=0fB0nh7agocE7s0TmwdTVCbykAVUtXK7AvtX7xJWvAs=; b=CsODzYFnhClugtg9lizlCRHDaDQY2m2/M0+tVh9g7hg+jrslSibuf98SMRjkgxBExO J93cOkgkCjq6WqdGv/FBbfPrXqbtfjuYEvYAaLpjCIkgAcHo15ldGGs5SJcbJUw0Ax6D VtzXqb2tThKTic4cbbw3WqALBN7LvADHzKnmUevdHZZuhMoliuknO/D1sKSMgCGM3Hb9 IgSO8sm6emyKqJil+Um2azCwVxvPoNkBlc6Oo56UV7PgChdLXvyQN0keOl+9I/nU0pL7 nc5E0QU1dveYX4tzL/SxNpUes1sHABn3WvuO6VjjS3RPLrUsKdKimDzhrDFpliH30c5l 6XHQ== X-Gm-Message-State: ALoCoQm8Uze1xAwdShQHWCXWy98sJLNQTqN31lrLWoEIzy1xo4wWkcHzRiv1JkJtcYYyhjGpSKTL X-Received: by 10.236.128.112 with SMTP id e76mr22082286yhi.38.1400757618286; Thu, 22 May 2014 04:20:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.72 with SMTP id j66ls1285787qge.99.gmail; Thu, 22 May 2014 04:20:18 -0700 (PDT) X-Received: by 10.58.182.129 with SMTP id ee1mr43574591vec.14.1400757618102; Thu, 22 May 2014 04:20:18 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id qb7si4642568vcb.43.2014.05.22.04.20.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 04:20:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id ik5so830093vcb.31 for ; Thu, 22 May 2014 04:20:18 -0700 (PDT) X-Received: by 10.53.5.67 with SMTP id ck3mr781835vdd.45.1400757618013; Thu, 22 May 2014 04:20:18 -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 ib8csp189680vcb; Thu, 22 May 2014 04:20:17 -0700 (PDT) X-Received: by 10.229.112.5 with SMTP id u5mr78761735qcp.3.1400757617403; Thu, 22 May 2014 04:20:17 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d3si8986926qca.34.2014.05.22.04.20.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 May 2014 04:20:17 -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]:36719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnR2m-0003Mk-Tv for patch@linaro.org; Thu, 22 May 2014 07:20:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnR1e-00022c-Lv for qemu-devel@nongnu.org; Thu, 22 May 2014 07:19:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnR1Y-000591-5K for qemu-devel@nongnu.org; Thu, 22 May 2014 07:19:06 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:60355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnR1Y-00058n-0W for qemu-devel@nongnu.org; Thu, 22 May 2014 07:19:00 -0400 Received: by mail-pa0-f45.google.com with SMTP id ey11so2409312pad.18 for ; Thu, 22 May 2014 04:18:59 -0700 (PDT) X-Received: by 10.68.166.36 with SMTP id zd4mr67058447pbb.54.1400757539141; Thu, 22 May 2014 04:18:59 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id xr9sm118782087pab.5.2014.05.22.04.18.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 04:18:58 -0700 (PDT) From: Pranavkumar Sawargaonkar To: qemu-devel@nongnu.org Date: Thu, 22 May 2014 16:48:01 +0530 Message-Id: <1400757486-2860-4-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400757486-2860-1-git-send-email-pranavkumar@linaro.org> References: <1400757486-2860-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] [PATCH V6 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.220.172 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 a343ede..f87c1d5 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1713,6 +1713,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);