From patchwork Thu Apr 30 12:11:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 47814 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0A5902121F for ; Thu, 30 Apr 2015 12:12:52 +0000 (UTC) Received: by wizk4 with SMTP id k4sf4052977wiz.2 for ; Thu, 30 Apr 2015 05:12:51 -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=yImDIVo9oP6C87pKpP4v5m8EX//VyLJZYdRMwM26L48=; b=WT2o2C4CAbvNTdG/KUqqfPyvmyDSwLNBdbno42KCU4kdrxzgX+4I/k9Xr5wNBXDtAw 7swNZ9HRjth4DvsyCDpVq1+lsHpwmKTkYhAXPIIwut1rl2hpwdrn1hviKKJ26CCn4+pc IUxBBygVscVR4gkwLXHMrzfdOqWViC2cHuKTsCwFy34JJ9qYUrP+pmp/LFMc/VHdxaXa OZ/m306cXFppDgvDvW7WK7y5t2gAC2svRou10NV/Q8t/UI158AUIebxmtRfXynaSv5WK E7PvNrCE1KxJDMrw0Dcl4rgTJvZMwBFsYpirkkIjNbqx8iXx+Rg6bxDD7XLId5Mbnju+ LugQ== X-Gm-Message-State: ALoCoQmKcEiXmz4eU0W/21qVbrgZTqf8LywfSCCLFtPfVXSHq5fHrwn5KEkjp2j2x1+UVQZm9VqP X-Received: by 10.180.85.129 with SMTP id h1mr1580316wiz.6.1430395971146; Thu, 30 Apr 2015 05:12:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.134 with SMTP id 6ls333439lam.36.gmail; Thu, 30 Apr 2015 05:12:51 -0700 (PDT) X-Received: by 10.152.9.66 with SMTP id x2mr3581612laa.36.1430395970993; Thu, 30 Apr 2015 05:12:50 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id h5si1641293laa.48.2015.04.30.05.12.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 05:12:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbqq2 with SMTP id qq2so42772963lbb.3 for ; Thu, 30 Apr 2015 05:12:50 -0700 (PDT) X-Received: by 10.112.161.226 with SMTP id xv2mr3582306lbb.106.1430395970901; Thu, 30 Apr 2015 05:12:50 -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 l1csp3074561lbt; Thu, 30 Apr 2015 05:12:50 -0700 (PDT) X-Received: by 10.68.216.99 with SMTP id op3mr7720333pbc.69.1430395968996; Thu, 30 Apr 2015 05:12:48 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rd3si3267811pbc.77.2015.04.30.05.12.47; Thu, 30 Apr 2015 05:12:48 -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 S1751611AbbD3MMm (ORCPT + 28 others); Thu, 30 Apr 2015 08:12:42 -0400 Received: from ip4-83-240-67-251.cust.nbox.cz ([83.240.67.251]:53584 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750891AbbD3MMe (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 1YnnKS-00088z-Ok; Thu, 30 Apr 2015 14:12:32 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Christoffer Dall , Shannon Zhao , Jiri Slaby Subject: [PATCH 3.12 05/63] KVM: ARM: Update comments for kvm_handle_wfi Date: Thu, 30 Apr 2015 14:11:34 +0200 Message-Id: <130d0bdf34fb4e7b43683bb9ef27fcb812915e49.1430387326.git.jslaby@suse.cz> 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.179 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 82ea046c95a3c3ddcfa058c8a270b9afb6e93700 upstream. Update comments to reflect what is really going on and add the TWE bit to the comments in kvm_arm.h. Also renames the function to kvm_handle_wfx like is done on arm64 for consistency and uber-correctness. Signed-off-by: Christoffer Dall Signed-off-by: Shannon Zhao Signed-off-by: Jiri Slaby --- arch/arm/include/asm/kvm_arm.h | 1 + arch/arm/kvm/handle_exit.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h index fe395b7b1ce2..1d3153c7eb41 100644 --- a/arch/arm/include/asm/kvm_arm.h +++ b/arch/arm/include/asm/kvm_arm.h @@ -57,6 +57,7 @@ * TSC: Trap SMC * TSW: Trap cache operations by set/way * TWI: Trap WFI + * TWE: Trap WFE * TIDCP: Trap L2CTLR/L2ECTLR * BSU_IS: Upgrade barriers to the inner shareable domain * FB: Force broadcast of all maintainance operations diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c index c4c496f7619c..a92079011a83 100644 --- a/arch/arm/kvm/handle_exit.c +++ b/arch/arm/kvm/handle_exit.c @@ -73,15 +73,17 @@ static int handle_dabt_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run) } /** - * kvm_handle_wfi - handle a wait-for-interrupts instruction executed by a guest + * kvm_handle_wfx - handle a WFI or WFE instructions trapped in guests * @vcpu: the vcpu pointer * @run: the kvm_run structure pointer * - * Simply sets the wait_for_interrupts flag on the vcpu structure, which will - * halt execution of world-switches and schedule other host processes until - * there is an incoming IRQ or FIQ to the VM. + * WFE: Yield the CPU and come back to this vcpu when the scheduler + * decides to. + * WFI: Simply call kvm_vcpu_block(), which will halt execution of + * world-switches and schedule other host processes until there is an + * incoming IRQ or FIQ to the VM. */ -static int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run) +static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) { trace_kvm_wfi(*vcpu_pc(vcpu)); if (kvm_vcpu_get_hsr(vcpu) & HSR_WFI_IS_WFE) @@ -93,7 +95,7 @@ static int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run) } static exit_handle_fn arm_exit_handlers[] = { - [HSR_EC_WFI] = kvm_handle_wfi, + [HSR_EC_WFI] = kvm_handle_wfx, [HSR_EC_CP15_32] = kvm_handle_cp15_32, [HSR_EC_CP15_64] = kvm_handle_cp15_64, [HSR_EC_CP14_MR] = kvm_handle_cp14_access,