From patchwork Fri Oct 17 09:32:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhuyijun X-Patchwork-Id: 38850 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4EF5E202DB for ; Fri, 17 Oct 2014 09:33:11 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id b13sf253089wgh.0 for ; Fri, 17 Oct 2014 02:33:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=KKuK1IR8oCqXPua9vfBufZwYTe+kBXFCq7uAKCr6Ct4=; b=ensGKDJPANn1TynCrjYgVS+jRvmYRq4YUFfcLuuY6oHdmx7DLkxxf4ZQ3F5wgFr9+u KejcbHsvw+e1fQbbDHqOQS16s9SPH8Mc9808Zlr2PbooUxhiFKjPlrEgMFo1ckIGnhIV TY+x8G1Wp1CdYYMAy5NWH+2oFui4J3Y3/hagA1EZF/itnxG4BN7M2COqgzTyxNVNDWl9 5b8k25X2ZxB0uipMtj268h6rfB3zoGpRSV2MCxmz5hiUb0ibI7dNNMkMfv4TSk2Nwb6g 9xYR+0ImWpVt2M7oQdGHRFNBzGD5YsDq9ImLLE3N0t8EJsKeSzDFNsVvhJmyfc/79tFI D1hw== X-Gm-Message-State: ALoCoQnVQ3FTuYW5qxxi3K08lq5UejfS4YcznDhvIzOemVmFYvH8NX/S0o7JIXRxU5nAvthiZ+mT X-Received: by 10.112.140.132 with SMTP id rg4mr229203lbb.12.1413538390188; Fri, 17 Oct 2014 02:33:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.224.161 with SMTP id rd1ls229459lac.95.gmail; Fri, 17 Oct 2014 02:33:10 -0700 (PDT) X-Received: by 10.152.88.105 with SMTP id bf9mr7587655lab.30.1413538390074; Fri, 17 Oct 2014 02:33:10 -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 ud4si1133574lac.101.2014.10.17.02.33.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 02:33:10 -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 mail-lb0-f182.google.com with SMTP id z11so344255lbi.41 for ; Fri, 17 Oct 2014 02:33:10 -0700 (PDT) X-Received: by 10.112.167.38 with SMTP id zl6mr7505189lbb.34.1413538389805; Fri, 17 Oct 2014 02:33:09 -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.84.229 with SMTP id c5csp192946lbz; Fri, 17 Oct 2014 02:33:09 -0700 (PDT) X-Received: by 10.70.100.6 with SMTP id eu6mr7162053pdb.120.1413538388058; Fri, 17 Oct 2014 02:33:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi14si571593pdb.245.2014.10.17.02.33.07 for ; Fri, 17 Oct 2014 02:33:08 -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 S1751350AbaJQJdG (ORCPT + 1 other); Fri, 17 Oct 2014 05:33:06 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:5370 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750891AbaJQJdF (ORCPT ); Fri, 17 Oct 2014 05:33:05 -0400 Received: from 172.24.2.119 (EHLO szxeml407-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AVR51142; Fri, 17 Oct 2014 17:32:43 +0800 (CST) Received: from localhost (10.177.25.253) by szxeml407-hub.china.huawei.com (10.82.67.94) with Microsoft SMTP Server id 14.3.158.1; Fri, 17 Oct 2014 17:32:31 +0800 From: zhuyijun To: CC: , Christoffer Dall , , Ard Biesheuvel Subject: [PATCH 02/20] arm/arm64: KVM: Complete WFI/WFE instructions Date: Fri, 17 Oct 2014 17:32:06 +0800 Message-ID: <1413538344-11920-3-git-send-email-zhuyijun@huawei.com> X-Mailer: git-send-email 1.8.5.2.msysgit.0 In-Reply-To: <1413538344-11920-1-git-send-email-zhuyijun@huawei.com> References: <1413538344-11920-1-git-send-email-zhuyijun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.25.253] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.5440E23F.0045, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 222c8935a1a962d3a2285915ca45fdc7 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 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 --- arch/arm/kvm/handle_exit.c | 2 ++ arch/arm64/kvm/handle_exit.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c index 4c979d4..a96a804 100644 --- a/arch/arm/kvm/handle_exit.c +++ b/arch/arm/kvm/handle_exit.c @@ -93,6 +93,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 182415e..2ca885c 100644 --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c @@ -66,6 +66,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; }