From patchwork Mon May 4 01:25:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47921 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1132820553 for ; Mon, 4 May 2015 01:27:15 +0000 (UTC) Received: by lamp14 with SMTP id p14sf42239130lam.3 for ; Sun, 03 May 2015 18:27:13 -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:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=kaXQirmx8JTVZlJ8O3JjeR4PZa3R+vL6DYTdehCC+NA=; b=V51qrpZLiBiCil0y+EAaKjmSDOfB99b2hfXnA43XhQEIUby319PjalBCG4uBhoi+Dm tDYQgbxjNdkI6iCfoIkQ+oPEQNKn3YTUg2OV3CiMq2+7gNtj1hq3MRDDOGdxO2YV8CCw TlJDxPVwBvfo4a7JAlkBsN6AE6ePsZ9KqPimrnPuRom2G8vOUtMEHI14rKhKS9kI83MH p00n0TFI8XHhPunbc5So2mwVA0bCSQjMLQwOyPgbP0EDMgIOZg1Cgp8Z1FAWPHaf6lF2 xUJ5GVby0Nlrzp9cLr0g7hAxD165DEoYx2guUei8bFPS9JLDaTO2a/qxvs9aMSAkPS8O dwjg== X-Gm-Message-State: ALoCoQnjji5zJXFYWgZVLwdCe44+c/tXXV2XdEjEWbJ2OtIdLGPI4EGEEkbPdjM9bCJ1Mn/RCcDj X-Received: by 10.112.26.5 with SMTP id h5mr17085765lbg.4.1430702833482; Sun, 03 May 2015 18:27:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.8.171 with SMTP id dl11ls643930lad.55.gmail; Sun, 03 May 2015 18:27:13 -0700 (PDT) X-Received: by 10.152.164.166 with SMTP id yr6mr17404360lab.6.1430702833331; Sun, 03 May 2015 18:27:13 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id es16si9045083lbc.122.2015.05.03.18.27.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 May 2015 18:27:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by labbd9 with SMTP id bd9so94860111lab.2 for ; Sun, 03 May 2015 18:27:13 -0700 (PDT) X-Received: by 10.112.204.72 with SMTP id kw8mr17581561lbc.88.1430702833052; Sun, 03 May 2015 18:27:13 -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.112.67.65 with SMTP id l1csp1405856lbt; Sun, 3 May 2015 18:27:11 -0700 (PDT) X-Received: by 10.67.8.71 with SMTP id di7mr38504858pad.46.1430702830488; Sun, 03 May 2015 18:27:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id es7si17680936pbd.123.2015.05.03.18.27.09; Sun, 03 May 2015 18:27:10 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751647AbbEDB1J (ORCPT + 2 others); Sun, 3 May 2015 21:27:09 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:33311 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751718AbbEDB1I (ORCPT ); Sun, 3 May 2015 21:27:08 -0400 Received: by pdbnk13 with SMTP id nk13so149550650pdb.0 for ; Sun, 03 May 2015 18:27:08 -0700 (PDT) X-Received: by 10.68.219.101 with SMTP id pn5mr38275072pbc.77.1430702828066; Sun, 03 May 2015 18:27:08 -0700 (PDT) Received: from localhost ([180.150.153.1]) by mx.google.com with ESMTPSA id sw4sm10970558pbc.64.2015.05.03.18.27.05 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 03 May 2015 18:27:06 -0700 (PDT) From: shannon.zhao@linaro.org To: stable@vger.kernel.org Cc: sasha.levin@oracle.com, christoffer.dall@linaro.org, shannon.zhao@linaro.org Subject: [PATCH for 3.18.y stable 05/22] arm/arm64: KVM: Correct KVM_ARM_VCPU_INIT power off option Date: Mon, 4 May 2015 09:25:09 +0800 Message-Id: <1430702726-2056-6-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1430702726-2056-1-git-send-email-shannon.zhao@linaro.org> References: <1430702726-2056-1-git-send-email-shannon.zhao@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shannon.zhao@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.215.44 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Christoffer Dall commit 3ad8b3de526a76fbe9466b366059e4958957b88f upstream. The implementation of KVM_ARM_VCPU_INIT is currently not doing what userspace expects, namely making sure that a vcpu which may have been turned off using PSCI is returned to its initial state, which would be powered on if userspace does not set the KVM_ARM_VCPU_POWER_OFF flag. Implement the expected functionality and clarify the ABI. Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall Signed-off-by: Shannon Zhao --- Documentation/virtual/kvm/api.txt | 3 ++- arch/arm/kvm/arm.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 7610eaa..bb82a90 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2455,7 +2455,8 @@ should be created before this ioctl is invoked. Possible features: - KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state. - Depends on KVM_CAP_ARM_PSCI. + Depends on KVM_CAP_ARM_PSCI. If not set, the CPU will be powered on + and execute guest code when KVM_RUN is called. - KVM_ARM_VCPU_EL1_32BIT: Starts the CPU in a 32bit mode. Depends on KVM_CAP_ARM_EL1_32BIT (arm64 only). - KVM_ARM_VCPU_PSCI_0_2: Emulate PSCI v0.2 for the CPU. diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index b160bea..edc1964 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -663,6 +663,8 @@ static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu, */ if (test_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features)) vcpu->arch.pause = true; + else + vcpu->arch.pause = false; return 0; }