From patchwork Sun May 25 18:18:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 30902 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A992F203AC for ; Sun, 25 May 2014 18:21:50 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id 29sf30355484yhl.6 for ; Sun, 25 May 2014 11:21:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=UoMX0yhQXWmFx+oOIJ72Qyh6TaieIzzedR87eACPbJA=; b=jEmthTpEZGGtARSogcPUXf9mjkBhIKt3jsNY7S6uu8C0lmoq/qDcYrps+y+pSkKmHT miXIz21AmUEqpv4LHs4VajAibGWov6OEZenCMQg4NIGtsfkoW9zxw3Y6JY1zAlVco4Sa dy7mRkecLGZ1Fml/CU19QeA8VKE4qO3WqbYZjgRRtOOZ4zyzbcrhH2uxL5bBaax+id5w S9wNGUpIPABkMOkdiv/q9cg2OdwgjgSlfAL60wRX+Drg6I+V2KL4XQIvCKQyDcwqt1K1 fYNmJEgcSwRiAJwZBrCYmPxbkDFnBeb1c8ArPi8nPKsEhC2nahSWBMZ5ODF1waoKdnqd x37g== X-Gm-Message-State: ALoCoQm44BEjmjeedxrRDub7Cf88lV7eB2A5DJlU2/rxFrASWfmKpD3zlh+lBOtXcX5EJkBQdJ+Z X-Received: by 10.52.4.164 with SMTP id l4mr7090941vdl.3.1401042110489; Sun, 25 May 2014 11:21:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.28.195 with SMTP id 61ls1312109qgz.77.gmail; Sun, 25 May 2014 11:21:50 -0700 (PDT) X-Received: by 10.220.81.194 with SMTP id y2mr8253622vck.29.1401042110377; Sun, 25 May 2014 11:21:50 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id c10si5063567vdg.83.2014.05.25.11.21.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 25 May 2014 11:21:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id im17so8370042vcb.10 for ; Sun, 25 May 2014 11:21:50 -0700 (PDT) X-Received: by 10.52.13.41 with SMTP id e9mr13956491vdc.21.1401042110289; Sun, 25 May 2014 11:21:50 -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 ib8csp52467vcb; Sun, 25 May 2014 11:21:50 -0700 (PDT) X-Received: by 10.224.0.138 with SMTP id 10mr9993722qab.37.1401042109845; Sun, 25 May 2014 11:21:49 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id s90si10643713qga.18.2014.05.25.11.21.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 May 2014 11:21:49 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wod20-0006AJ-BR; Sun, 25 May 2014 18:20:24 +0000 Received: from mail-lb0-f169.google.com ([209.85.217.169]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wod1M-0004oA-83 for linux-arm-kernel@lists.infradead.org; Sun, 25 May 2014 18:19:44 +0000 Received: by mail-lb0-f169.google.com with SMTP id s7so3838602lbd.28 for ; Sun, 25 May 2014 11:19:21 -0700 (PDT) X-Received: by 10.152.18.133 with SMTP id w5mr2693001lad.60.1401041961367; Sun, 25 May 2014 11:19:21 -0700 (PDT) Received: from localhost.localdomain (x1-6-b8-c7-5d-cb-5a-ca.cpe.webspeed.dk. [2.104.6.253]) by mx.google.com with ESMTPSA id o1sm9683895lbw.27.2014.05.25.11.19.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 25 May 2014 11:19:20 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , Gleb Natapov Subject: [PATCH 06/16] KVM: Add KVM_EXIT_SYSTEM_EVENT to user space API header Date: Sun, 25 May 2014 20:18:52 +0200 Message-Id: <1401041942-23471-7-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1401041942-23471-1-git-send-email-christoffer.dall@linaro.org> References: <1401041942-23471-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140525_111944_485948_0B1078C2 X-CRM114-Status: GOOD ( 14.46 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.169 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Cc: Peter Maydell , Anup Patel , kvm@vger.kernel.org, Marc Zyngier , Ashwin Chaugule , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Pranavkumar Sawargaonkar X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@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.179 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 From: Anup Patel Currently, we don't have an exit reason to notify user space about a system-level event (for e.g. system reset or shutdown) triggered by the VCPU. This patch adds exit reason KVM_EXIT_SYSTEM_EVENT for this purpose. We can also inform user space about the 'type' and architecture specific 'flags' of a system-level event using the kvm_run structure. This newly added KVM_EXIT_SYSTEM_EVENT will be used by KVM ARM/ARM64 in-kernel PSCI v0.2 support to reset/shutdown VMs. Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar Reviewed-by: Christoffer Dall Reviewed-by: Marc Zyngier Signed-off-by: Christoffer Dall --- Documentation/virtual/kvm/api.txt | 15 +++++++++++++++ include/uapi/linux/kvm.h | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 556d056..6a5de56 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2740,6 +2740,21 @@ It gets triggered whenever both KVM_CAP_PPC_EPR are enabled and an external interrupt has just been delivered into the guest. User space should put the acknowledged interrupt vector into the 'epr' field. + /* KVM_EXIT_SYSTEM_EVENT */ + struct { +#define KVM_SYSTEM_EVENT_SHUTDOWN 1 +#define KVM_SYSTEM_EVENT_RESET 2 + __u32 type; + __u64 flags; + } system_event; + +If exit_reason is KVM_EXIT_SYSTEM_EVENT then the vcpu has triggered +a system-level event using some architecture specific mechanism (hypercall +or some special instruction). In case of ARM/ARM64, this is triggered using +HVC instruction based PSCI call from the vcpu. The 'type' field describes +the system-level event type. The 'flags' field describes architecture +specific flags for the system-level event. + /* Fix the size of the union. */ char padding[256]; }; diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index f3252b1..16cb1a1 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -171,6 +171,7 @@ struct kvm_pit_config { #define KVM_EXIT_WATCHDOG 21 #define KVM_EXIT_S390_TSCH 22 #define KVM_EXIT_EPR 23 +#define KVM_EXIT_SYSTEM_EVENT 24 /* For KVM_EXIT_INTERNAL_ERROR */ /* Emulate instruction failed. */ @@ -301,6 +302,13 @@ struct kvm_run { struct { __u32 epr; } epr; + /* KVM_EXIT_SYSTEM_EVENT */ + struct { +#define KVM_SYSTEM_EVENT_SHUTDOWN 1 +#define KVM_SYSTEM_EVENT_RESET 2 + __u32 type; + __u64 flags; + } system_event; /* Fix the size of the union. */ char padding[256]; };