From patchwork Fri Aug 29 09:59:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 36274 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3CA452054D for ; Fri, 29 Aug 2014 09:59:31 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf34554694pab.4 for ; Fri, 29 Aug 2014 02:59:30 -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=f4EwyxdkkDq9O8pv7T3dZ7hTBALyITH599ocX+2PTAw=; b=go53d6+r0muZbM9yxKcgwOK9HHtq68ZfSIjtPmlRVhD2zFfXqQSQ7zfSlTptW4azty 5Q0znWoeQhLKWWNbpm27whBFdhv3HhbZcA92W5fePULFOcc2GHld+hW+XQ5AtJ37rW8p GYEEx8o8ian52nQUFFX31zmHrIXrqnlfIypYjLQU1s62jUCekJ41fVmnSDggldxY3B6L LPcaskPCq2lgR/arf+VnjKBvk6XsD3Q1fHM+vUBu0D8wb3yBJdxwQ6xR43GPD/8VUA0p 3/WXCQ3F+GwbHblJwnmJfm6yAX1ow8vApo7LupfqMy1+qEWik8r9P/6fAUTUaUGxEHpw R1tg== X-Gm-Message-State: ALoCoQnplFxJfLOGA67R5oPS9er06CcdRDeCxa3+ilU7V0MF9OobMrwfPyP2sR3HYvi0QsOZ4LsI X-Received: by 10.66.249.197 with SMTP id yw5mr5198892pac.34.1409306370570; Fri, 29 Aug 2014 02:59:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.230 with SMTP id j93ls945250qgd.40.gmail; Fri, 29 Aug 2014 02:59:30 -0700 (PDT) X-Received: by 10.52.36.176 with SMTP id r16mr1243vdj.70.1409306370305; Fri, 29 Aug 2014 02:59:30 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id g8si5955886vdu.82.2014.08.29.02.59.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Aug 2014 02:59:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id la4so2209049vcb.15 for ; Fri, 29 Aug 2014 02:59:30 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr9385049vcn.16.1409306370191; Fri, 29 Aug 2014 02:59:30 -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.221.45.67 with SMTP id uj3csp364536vcb; Fri, 29 Aug 2014 02:59:29 -0700 (PDT) X-Received: by 10.66.193.37 with SMTP id hl5mr13877997pac.135.1409306369092; Fri, 29 Aug 2014 02:59:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id on2si11287913pdb.143.2014.08.29.02.59.28 for ; Fri, 29 Aug 2014 02:59:29 -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 S1752716AbaH2J7Y (ORCPT + 1 other); Fri, 29 Aug 2014 05:59:24 -0400 Received: from mail-la0-f53.google.com ([209.85.215.53]:33822 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752727AbaH2J7X (ORCPT ); Fri, 29 Aug 2014 05:59:23 -0400 Received: by mail-la0-f53.google.com with SMTP id s18so2396266lam.26 for ; Fri, 29 Aug 2014 02:59:21 -0700 (PDT) X-Received: by 10.112.114.202 with SMTP id ji10mr9619992lbb.92.1409306361646; Fri, 29 Aug 2014 02:59:21 -0700 (PDT) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id e9sm4199066laf.36.2014.08.29.02.59.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Aug 2014 02:59:20 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , Gleb Natapov Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Marc Zyngier , Christoffer Dall , , Ard Biesheuvel Subject: [GIT PULL 2/2] arm/arm64: KVM: Complete WFI/WFE instructions Date: Fri, 29 Aug 2014 11:59:16 +0200 Message-Id: <1409306356-11170-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1409306356-11170-1-git-send-email-christoffer.dall@linaro.org> References: <1409306356-11170-1-git-send-email-christoffer.dall@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: christoffer.dall@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.220.170 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: , 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(+) 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 e28be51..34b8bd0 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; }