From patchwork Fri Apr 24 05:27:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47490 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0E3BA20553 for ; Fri, 24 Apr 2015 05:29:50 +0000 (UTC) Received: by wicmx19 with SMTP id mx19sf1543395wic.3 for ; Thu, 23 Apr 2015 22:29:49 -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=+LDTTofJGexXSVEr8PiVmNcB7iGRBojqm2cqHgFz97c=; b=bS9lmelb1VFmB76Z8waZzjTnkkWiqFVGEfwrmenlRZUR0y1pPs9r0djn+RMI7KhEZg hLyPFAG9rL1Ljmem63FzPQitVwRJ7TtUE/edHPQlrAtrdPAn/ibxyGDgafCYpEKCsxv9 bfHk/SUyzuiAdf9vDA9qd/yyharNVqZli6EBAc4CrVK75RTdP0IGSRPL21HaBtD55OuG rsi3QHCjrB6ht/Qd4FMg0NqIKV6dE/OumG1yN/QrH/CLZgss0+0D8lUgLxOhHMghLNCt DtiFlf0XcG01Iohad9mr87k+4XaQQIx3eBLW9R3nlo9CL2+mK6hCAoM3wdET0vkl4rDw r0HA== X-Gm-Message-State: ALoCoQnLivgCFCES+Dg1ooWPfuI8Oa5cEy2g36Pe27t3gZGCeCKBfHg8KDB8Qv5n6CR/7arey25i X-Received: by 10.152.3.70 with SMTP id a6mr3212889laa.0.1429853389300; Thu, 23 Apr 2015 22:29:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.102 with SMTP id s6ls422720lag.73.gmail; Thu, 23 Apr 2015 22:29:49 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr3658082lbc.19.1429853389115; Thu, 23 Apr 2015 22:29:49 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id x10si4824494lax.97.2015.04.23.22.29.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 22:29:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbbzk7 with SMTP id zk7so28582708lbb.0 for ; Thu, 23 Apr 2015 22:29:48 -0700 (PDT) X-Received: by 10.152.205.6 with SMTP id lc6mr2854668lac.73.1429853388824; Thu, 23 Apr 2015 22:29:48 -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 l1csp976954lbt; Thu, 23 Apr 2015 22:29:47 -0700 (PDT) X-Received: by 10.68.229.136 with SMTP id sq8mr6940017pbc.160.1429853387002; Thu, 23 Apr 2015 22:29:47 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gw3si15799508pac.117.2015.04.23.22.29.45; Thu, 23 Apr 2015 22:29:46 -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 S1752804AbbDXF3p (ORCPT + 2 others); Fri, 24 Apr 2015 01:29:45 -0400 Received: from mail-oi0-f46.google.com ([209.85.218.46]:33082 "EHLO mail-oi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbbDXF3o (ORCPT ); Fri, 24 Apr 2015 01:29:44 -0400 Received: by oica37 with SMTP id a37so32430076oic.0 for ; Thu, 23 Apr 2015 22:29:44 -0700 (PDT) X-Received: by 10.202.49.11 with SMTP id x11mr5397652oix.63.1429853384211; Thu, 23 Apr 2015 22:29:44 -0700 (PDT) Received: from localhost ([167.160.116.36]) by mx.google.com with ESMTPSA id xn9sm6005872oeb.11.2015.04.23.22.29.42 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 23 Apr 2015 22:29:43 -0700 (PDT) From: shannon.zhao@linaro.org To: stable@vger.kernel.org Cc: jslaby@suse.cz, christoffer.dall@linaro.org, shannon.zhao@linaro.org Subject: [PATCH for 3.12.y stable 05/63] KVM: ARM: Update comments for kvm_handle_wfi Date: Fri, 24 Apr 2015 13:27:03 +0800 Message-Id: <1429853281-6136-6-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.217.180 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 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 --- 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 fe395b7..1d3153c 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 c4c496f..a920790 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,