From patchwork Thu Apr 30 12:12:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 47832 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2333A2121F for ; Thu, 30 Apr 2015 12:26:47 +0000 (UTC) Received: by wgin8 with SMTP id n8sf14537035wgi.0 for ; Thu, 30 Apr 2015 05:26:46 -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: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=cmagf1npJWffuMOH+x7iSlUfNWi7p8TReVWFqvCmJ6E=; b=luqkJmqfwj6twKj9lkScVyT8R+Dha/u2WeC1wiVy3s1gJafihDlCOydfPHufxAdtND pWnvBxdPnVcwPeDz4+W93X7vnBWlK4f6Qkh99DvmV+owiVG8KSUw12Dr/8ID4S4ieiDY jS7c9a9b1gOI3tEGeUMOy/PoZ1+mKvp3J2LjoMHBSENouw60WVcRhApkDo6hLK7/QZE0 UP+YGFABlbwsprEwHcl8SuH1sQSoDJKfFj79ILEeoY6NQmHq5+SC3BkEhTVRk4ktQM/n FI+XVwobLTHhsnIlDUalRgU2SzCh3JG2WA8NgEqenvh+4JAuzzSagiWmvbDM80+Y3fIe /WVA== X-Gm-Message-State: ALoCoQm5ur2SxkoYEYjUpBp0UgdYnixHSh9QMflsc5d1+39VhkA8igUxQw9SVE/FuXvHU01XDoFP X-Received: by 10.152.116.115 with SMTP id jv19mr2398491lab.9.1430396806395; Thu, 30 Apr 2015 05:26:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.10.208 with SMTP id k16ls387038lab.42.gmail; Thu, 30 Apr 2015 05:26:46 -0700 (PDT) X-Received: by 10.152.42.211 with SMTP id q19mr3696911lal.78.1430396806207; Thu, 30 Apr 2015 05:26:46 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id q10si1665131laq.33.2015.04.30.05.26.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 05:26:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbcga7 with SMTP id ga7so43160322lbc.1 for ; Thu, 30 Apr 2015 05:26:46 -0700 (PDT) X-Received: by 10.112.16.196 with SMTP id i4mr3576116lbd.72.1430396805030; Thu, 30 Apr 2015 05:26:45 -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 l1csp3081863lbt; Thu, 30 Apr 2015 05:26:43 -0700 (PDT) X-Received: by 10.66.121.164 with SMTP id ll4mr7568525pab.131.1430396452778; Thu, 30 Apr 2015 05:20:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2si3234120par.230.2015.04.30.05.20.50; Thu, 30 Apr 2015 05:20:52 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-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 S1751149AbbD3MUq (ORCPT + 28 others); Thu, 30 Apr 2015 08:20:46 -0400 Received: from ip4-83-240-67-251.cust.nbox.cz ([83.240.67.251]:53663 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751428AbbD3MMe (ORCPT ); Thu, 30 Apr 2015 08:12:34 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.85) (envelope-from ) id 1YnnKT-0008Ct-A9; Thu, 30 Apr 2015 14:12:33 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Christoffer Dall , Ard Biesheuvel , Shannon Zhao , Jiri Slaby Subject: [PATCH 3.12 45/63] arm/arm64: KVM: Complete WFI/WFE instructions Date: Thu, 30 Apr 2015 14:12:14 +0200 Message-Id: X-Mailer: git-send-email 2.3.5 In-Reply-To: <45aaf85687dd6ac119c55c5ec0dbe0bef0e62235.1430387326.git.jslaby@suse.cz> References: <45aaf85687dd6ac119c55c5ec0dbe0bef0e62235.1430387326.git.jslaby@suse.cz> In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linux-kernel-owner@vger.kernel.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.217.175 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 3.12-stable review patch. If anyone has any objections, please let me know. =============== commit 05e0127f9e362b36aa35f17b1a3d52bca9322a3a upstream. The architecture specifies that when the processor wakes up from a WFE or WFI instruction, the instruction is considered complete, however we currrently return to EL1 (or EL0) at the WFI/WFE instruction itself. While most guests may not be affected by this because their local exception handler performs an exception returning setting the event bit or with an interrupt pending, some guests like UEFI will get wedged due this little mishap. Simply skip the instruction when we have completed the emulation. Cc: Acked-by: Marc Zyngier Cc: Ard Biesheuvel Signed-off-by: Christoffer Dall Signed-off-by: Shannon Zhao Signed-off-by: Jiri Slaby --- arch/arm/kvm/handle_exit.c | 2 ++ arch/arm64/kvm/handle_exit.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c index 0de91fc6de0f..ec4fa868a7ba 100644 --- a/arch/arm/kvm/handle_exit.c +++ b/arch/arm/kvm/handle_exit.c @@ -89,6 +89,8 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) else kvm_vcpu_block(vcpu); + kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); + return 1; } diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c index df84d7bcc7df..ab1ec62dd3e5 100644 --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c @@ -62,6 +62,8 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) else kvm_vcpu_block(vcpu); + kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); + return 1; }