From patchwork Fri Apr 24 05:27:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47530 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 815CB20553 for ; Fri, 24 Apr 2015 05:33:54 +0000 (UTC) Received: by wghm4 with SMTP id m4sf9145817wgh.2 for ; Thu, 23 Apr 2015 22:33:53 -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=h/mGtxDDfLxT4pMTqWrjy99V6bL8fqVTq4hHBBLegVQ=; b=DQGB7tDZmxJXqKDlIFKFkY1qPVzp2I+QzLzXe626vVyAHGILg/N06pHeLESA9Mn+1R gKdLNrWESxAexTaSRKdpicnJo8iP5Sr0icZHDiF4OCB1shF7oiQ5CAsTkSx3q/9CXQHH zU3xFs0A6agigq4z9FBq72U75oqYfNz3q17NjsVjX65It2sGY6zoegKm1zgiH4jfbvE2 cygVwjSxLwb/AZ7qY6EtwN5QTnM7yf0TRFb/d61KlkpBKLk/xXhL6BuOPPhKFH+mWfRI DA+xkCvN/aUAvHZ7N5nw7Mvh2lmkJfODPzaBzpMWkCBaYtBBWU3sbZFO6CrTzcqmdRf1 crvg== X-Gm-Message-State: ALoCoQk9Lv15i43PRNwQsAD03l106c/dawrdCPQNgJWQEl/KfHKRVdsql8KwmcrikCkzEWJsFp8u X-Received: by 10.152.37.101 with SMTP id x5mr3206305laj.5.1429853633830; Thu, 23 Apr 2015 22:33:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.41 with SMTP id t9ls447511lal.82.gmail; Thu, 23 Apr 2015 22:33:53 -0700 (PDT) X-Received: by 10.112.189.102 with SMTP id gh6mr5355344lbc.115.1429853633691; Thu, 23 Apr 2015 22:33:53 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id yj8si7476790lab.53.2015.04.23.22.33.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 22:33:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by laat2 with SMTP id t2so27581241laa.1 for ; Thu, 23 Apr 2015 22:33:53 -0700 (PDT) X-Received: by 10.152.19.199 with SMTP id h7mr5631491lae.32.1429853633590; Thu, 23 Apr 2015 22:33:53 -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 l1csp978584lbt; Thu, 23 Apr 2015 22:33:52 -0700 (PDT) X-Received: by 10.70.129.17 with SMTP id ns17mr3059760pdb.12.1429853631864; Thu, 23 Apr 2015 22:33:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bd10si15800741pdb.178.2015.04.23.22.33.51; Thu, 23 Apr 2015 22:33:51 -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 S1754563AbbDXFdu (ORCPT + 2 others); Fri, 24 Apr 2015 01:33:50 -0400 Received: from mail-oi0-f51.google.com ([209.85.218.51]:33197 "EHLO mail-oi0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754554AbbDXFdu (ORCPT ); Fri, 24 Apr 2015 01:33:50 -0400 Received: by oica37 with SMTP id a37so32481587oic.0 for ; Thu, 23 Apr 2015 22:33:49 -0700 (PDT) X-Received: by 10.202.173.144 with SMTP id w138mr5476304oie.100.1429853629831; Thu, 23 Apr 2015 22:33:49 -0700 (PDT) Received: from localhost ([167.160.116.36]) by mx.google.com with ESMTPSA id 19sm6100506oie.5.2015.04.23.22.33.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 23 Apr 2015 22:33:48 -0700 (PDT) From: shannon.zhao@linaro.org To: stable@vger.kernel.org Cc: jslaby@suse.cz, christoffer.dall@linaro.org, shannon.zhao@linaro.org, Ard Biesheuvel Subject: [PATCH for 3.12.y stable 45/63] arm/arm64: KVM: Complete WFI/WFE instructions Date: Fri, 24 Apr 2015 13:27:43 +0800 Message-Id: <1429853281-6136-46-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1429853281-6136-1-git-send-email-shannon.zhao@linaro.org> References: <1429853281-6136-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.46 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 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 --- 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 0de91fc..ec4fa86 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 df84d7b..ab1ec62 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; }