From patchwork Thu Apr 30 09:24:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 47796 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 BDF8D2121F for ; Thu, 30 Apr 2015 09:32:26 +0000 (UTC) Received: by wghm4 with SMTP id m4sf13454682wgh.2 for ; Thu, 30 Apr 2015 02:32:26 -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=PRSkHt9md40qcghtV9xPrF5tKMAxmd7tkK+c9l/LpDg=; b=bp3mWzN2cMG3mLHfiSh2uV07vSeYRsxgl+J56RjW99pd0L3XWOK1N/yKcz+NXzXMky Y3eLvnGPI1VpZS6TYIDwzZS/ZGtNDQpuq7YSdqDppbXlfKq3k3fFOj7zlcS1Mq3W20F0 XUwJ55Bl8ikui5bR8FeCVbDKB5qwnrmuW8YKUBbGzghHncIlIk9k1DAbs89W+z8yAX2e C/+o4Ik7vSUSmXNwKwOaf0L2WCKU0xF3KVykMqhFMvSqg1YgQSWaiE5s86JOPOJhxa0v oczXCO8yIwlrYNc/p+3IfDQZS61Yxl52FpWvWhlFDZXZDK+jJNUN5n7kwPe0rYcAsPxd Pl2w== X-Gm-Message-State: ALoCoQmVcavLqmQwYJ2EQxxuqvbKnGBbHnJvotr3+HibRZO0QxZzOLBbukR1q/Vu8nJjekhPP6HK X-Received: by 10.180.11.101 with SMTP id p5mr1217663wib.3.1430386346113; Thu, 30 Apr 2015 02:32:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.10 with SMTP id p10ls369292lag.29.gmail; Thu, 30 Apr 2015 02:32:26 -0700 (PDT) X-Received: by 10.112.12.68 with SMTP id w4mr2939395lbb.87.1430386345982; Thu, 30 Apr 2015 02:32:25 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id ln2si1335835lac.106.2015.04.30.02.32.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 02:32:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbcga7 with SMTP id ga7so39982249lbc.1 for ; Thu, 30 Apr 2015 02:32:25 -0700 (PDT) X-Received: by 10.112.16.196 with SMTP id i4mr2988568lbd.72.1430386345876; Thu, 30 Apr 2015 02:32:25 -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 l1csp2998171lbt; Thu, 30 Apr 2015 02:32:25 -0700 (PDT) X-Received: by 10.68.185.4 with SMTP id ey4mr6674528pbc.12.1430385978774; Thu, 30 Apr 2015 02:26:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nf2si2640288pbc.149.2015.04.30.02.26.17; Thu, 30 Apr 2015 02:26:18 -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 S1751493AbbD3JZ5 (ORCPT + 2 others); Thu, 30 Apr 2015 05:25:57 -0400 Received: from ip4-83-240-67-251.cust.nbox.cz ([83.240.67.251]:53093 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751554AbbD3JZT (ORCPT ); Thu, 30 Apr 2015 05:25:19 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.85) (envelope-from ) id 1YnkiW-0005On-B1; Thu, 30 Apr 2015 11:25:12 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: Christoffer Dall , Ard Biesheuvel , Shannon Zhao , Jiri Slaby Subject: [patch added to the 3.12 stable tree] arm/arm64: KVM: Complete WFI/WFE instructions Date: Thu, 30 Apr 2015 11:24:53 +0200 Message-Id: <1430385911-20480-45-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1430385911-20480-1-git-send-email-jslaby@suse.cz> References: <1430385911-20480-1-git-send-email-jslaby@suse.cz> 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: patch@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.217.182 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 This patch has been added to the 3.12 stable tree. If you have any objections, please let us 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; }