From patchwork Tue Dec 17 11:35:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 22564 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7027A23FC6 for ; Tue, 17 Dec 2013 11:36:13 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id oz11sf12029619veb.0 for ; Tue, 17 Dec 2013 03:36:13 -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=BMJeDLPte2yO7G8ejh4q0K+V/NSCYbojBn7cET/H6meTa561aaiUUe4mJbtnx0o+Tr ALk5j51Xd8CCYCh9blYfL60kauAgXLivVfQXvQdEeRylZAbve5qzA6htFSmv3KPcLN+p FvnDmdEFh3IzhRpM4u3vaHDtatjW7BONPU8raFOhPnIF/EKbAKlLlSfBj2iCaK9zD1aj mbw8jbQG/RV5wc1ZtTYuO6/09M9L/RK0j3hcPlUtCq4oH4ekhqJZW4k+QuNOzsNMV/Tw 5bumuAm3sPjUk7l9PeOwHRvysw7OahDD0KDbWhyZYI27Ch5VwafNmqUAvFAN4htJHqyh znmA== X-Gm-Message-State: ALoCoQkpaDklMxI0O+Uzj9AHWtiI4TW0xJiv5ld/6f62y9MIg2QVJC/tI9uxqb4Ho/Y1EMOzZhAy X-Received: by 10.58.186.202 with SMTP id fm10mr620530vec.37.1387280173048; Tue, 17 Dec 2013 03:36:13 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.120.164 with SMTP id ld4ls2421445qeb.51.gmail; Tue, 17 Dec 2013 03:36:12 -0800 (PST) X-Received: by 10.220.66.200 with SMTP id o8mr5537409vci.7.1387280172952; Tue, 17 Dec 2013 03:36:12 -0800 (PST) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id qy6si4812514vcb.76.2013.12.17.03.36.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 03:36:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.171 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.171; Received: by mail-vc0-f171.google.com with SMTP id ik5so4044035vcb.16 for ; Tue, 17 Dec 2013 03:36:12 -0800 (PST) X-Received: by 10.52.0.174 with SMTP id 14mr64460vdf.86.1387280172841; Tue, 17 Dec 2013 03:36:12 -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 u4csp62547vcz; Tue, 17 Dec 2013 03:36:12 -0800 (PST) X-Received: by 10.68.217.194 with SMTP id pa2mr26403585pbc.1.1387280171775; Tue, 17 Dec 2013 03:36:11 -0800 (PST) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by mx.google.com with ESMTPS id ye6si11533006pbc.170.2013.12.17.03.36.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 03:36:11 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.176 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.192.176; Received: by mail-pd0-f176.google.com with SMTP id w10so6676650pde.7 for ; Tue, 17 Dec 2013 03:36:11 -0800 (PST) X-Received: by 10.68.236.133 with SMTP id uu5mr26361794pbc.153.1387280171382; Tue, 17 Dec 2013 03:36:11 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id hw10sm33249682pbc.24.2013.12.17.03.36.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 03:36:09 -0800 (PST) From: Anup Patel To: kvmarm@lists.cs.columbia.edu Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, patches@apm.com, linux-arm-kernel@lists.infradead.org, Marc Zyngier , Christoffer Dall , Gleb Natapov , Paolo Bonzini , Pranavkumar Sawargaonkar , Anup Patel Subject: [PATCH v3 1/2] KVM: Add KVM_EXIT_SYSTEM_EVENT to user space API header Date: Tue, 17 Dec 2013 17:05:35 +0530 Message-Id: <1387280136-13622-2-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1387280136-13622-1-git-send-email-anup.patel@linaro.org> References: <1387280136-13622-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.171 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 --- 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]; };