From patchwork Thu Dec 12 16:12:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 22299 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8309F23FC7 for ; Thu, 12 Dec 2013 16:13:30 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id j5sf4145233qaq.1 for ; Thu, 12 Dec 2013 08:13:30 -0800 (PST) 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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=uiQ2JFUAy61BbhBkQWvuYDm4FOUqkCyeywysHtQrkJM=; b=TLKAeBuBh/GZjskzbeSuXdCZ530Al88lfwtJK+rBCx1hQhyADV5GQbqAEcihvxsGg2 wcje8ldRX4rvabFg4kPKJmnbYEBsfdjTEo6H3EoDvtoO4nWktftwsZR4v/RtJKeiVhfo W+3uDa0pW06Iy2Nm1x9lGcd0GtDqIt5MTe2ooE4B7m3+Tm8xCy0pQdfSiS/WNopsoeck lWP0ruMTT3VzJE7VDpwdt8kxfABnlMeLbZrnq/nfXwZV1Y/UDfTocizJHTSYom+obGKJ LH58l5D1zGFqC5zBGuKippK/UXdDGn9AyjvnI/y4sZEIIt/M3ZWFHbg05mQW9Iml+D3z JDkw== X-Gm-Message-State: ALoCoQl2XOpbUDQTgfVjH/kLxWt/5sc380k6oD2ZmVHbcMOR62GbOLsjDo0kQRG7W2Iz/xMg3/b5 X-Received: by 10.52.244.136 with SMTP id xg8mr2802993vdc.7.1386864810341; Thu, 12 Dec 2013 08:13:30 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.103.136 with SMTP id fw8ls541367qeb.20.gmail; Thu, 12 Dec 2013 08:13:30 -0800 (PST) X-Received: by 10.220.91.10 with SMTP id k10mr4386985vcm.7.1386864810185; Thu, 12 Dec 2013 08:13:30 -0800 (PST) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id lw10si7861794vec.119.2013.12.12.08.13.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 08:13:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.182 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.182; Received: by mail-vc0-f182.google.com with SMTP id lc6so430232vcb.41 for ; Thu, 12 Dec 2013 08:13:30 -0800 (PST) X-Received: by 10.52.162.74 with SMTP id xy10mr23409vdb.65.1386864810097; Thu, 12 Dec 2013 08:13:30 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp366985vcz; Thu, 12 Dec 2013 08:13:29 -0800 (PST) X-Received: by 10.68.189.101 with SMTP id gh5mr13798803pbc.39.1386864809160; Thu, 12 Dec 2013 08:13:29 -0800 (PST) Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by mx.google.com with ESMTPS id pt8si16907603pac.250.2013.12.12.08.13.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 08:13:29 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.43 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.160.43; Received: by mail-pb0-f43.google.com with SMTP id rq2so762882pbb.30 for ; Thu, 12 Dec 2013 08:13:28 -0800 (PST) X-Received: by 10.68.209.133 with SMTP id mm5mr13453160pbc.157.1386864808753; Thu, 12 Dec 2013 08:13:28 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id jk16sm41193694pbb.34.2013.12.12.08.13.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 08:13:27 -0800 (PST) From: Anup Patel To: kvmarm@lists.cs.columbia.edu Cc: linux-arm-kernel@lists.infradead.org, patches@linaro.org, patches@apm.com, linaro-kernel@lists.linaro.org, Christoffer Dall , Marc Zyngier , Pranavkumar Sawargaonkar , Anup Patel Subject: [PATCH v2 1/2] KVM: Add KVM_EXIT_SYSTEM_EVENT to user space API header Date: Thu, 12 Dec 2013 21:42:26 +0530 Message-Id: <1386864747-29006-5-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386864747-29006-1-git-send-email-anup.patel@linaro.org> References: <1386864747-29006-1-git-send-email-anup.patel@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: anup.patel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 support to reset/shutdown VMs. Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar Reviewed-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 aad3244..4ef180e 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2699,6 +2699,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 902f124..bb13faa 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]; };