From patchwork Mon Jul 17 14:27:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9845315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A70D46037F for ; Mon, 17 Jul 2017 14:32:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 997012842E for ; Mon, 17 Jul 2017 14:32:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E53D28509; Mon, 17 Jul 2017 14:32:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 52F862842E for ; Mon, 17 Jul 2017 14:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=U8Kjm6517BFH6jtOtScTqPYfiCBEj3XMeH7sojdsvDk=; b=Wv16tMyBMfm9ZcF5MPlDNQc+PI y5YU+0RC/K2uRIwgfYKHRhYddyxxmVvDQ5zuXgLlc6/c0Oflvo0n1pctVSZtC4z9BuCYbdAP2yMm9 cO6/In6TZSgYBKutzcHNgDsZKdcMnydBHEJU30PM6mc5sW9FrcohP2lCAtjq80JC15CMlVEoYsT1Y t993wfqbcq+gHLW6DSo6nPORe0ULaXxaawWY1E7HesLh8VY46pf8V3gupRdhup2C4tV/7YBnkhjN+ M71LsQO8adA6t2F8soAkMbk9ZkqdJsq7afyYuWiSbGZh8zZZ3N3zX4jNNedhzAWfmNU1FjldcqCiI OgdHcraA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dX74f-00078U-PR; Mon, 17 Jul 2017 14:32:37 +0000 Received: from mail-wm0-f47.google.com ([74.125.82.47]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dX70F-0001Mi-53 for linux-arm-kernel@lists.infradead.org; Mon, 17 Jul 2017 14:28:11 +0000 Received: by mail-wm0-f47.google.com with SMTP id t70so22787410wmt.0 for ; Mon, 17 Jul 2017 07:27:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tLW8R7gbPXS2bADBe55R7Cz+qSSyJbhq0icyPR6fhog=; b=fr/bWMcd95L614rvTDZtA2j6IT1/jpyGVCjEsUa2fDs8UJKQecrq/9pymILT2jCKhb cKjWIHq2b20hw2GVCZbcW97tlovGSgEKwKgjB+qS7gcLFvtiV6cFz1effPn15gOYJyZn A4p0+eFDhG2So1gAepdw0WkpJrhDCnarCM0Sk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tLW8R7gbPXS2bADBe55R7Cz+qSSyJbhq0icyPR6fhog=; b=qGBycFoT55+LZtl8dkJTcjisiLxkIQT24Irvgo27lO0gjk06gBK3n4VjGp5K/r2o/R RSP5yeEHuNta2n92G+6g/VcGAEbfwr4HRQX/zJGyyu6xf55ycUHgsaoaZy7vWpTc+DN7 Hjya+GfP66JjFuTguBpKamwcm6Jgy/FbZh306Ym3pYyjGCbebENUd0FffgPOd4mJURar eW8+y88OsFkvVF6MUAr630OyeJuP5E7bCNJnE/v36o3R0ObU+n6HYKmptru+SWAWKT1t trmS5JIaeDkWhi1f8q2AaA6zBrzD7jsHZg26dAtAG5bbvw6ItjiedcVhHMy8mSlC0vfb Yk5A== X-Gm-Message-State: AIVw110uOofbBxOm9aKqANOOv3J1mmwLt7pbwUtSoFi2AHZt1nwzKHpU HgEjNK6pavgrYuju X-Received: by 10.80.148.118 with SMTP id q51mr18087034eda.28.1500301660675; Mon, 17 Jul 2017 07:27:40 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id b30sm9428952edd.6.2017.07.17.07.27.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 07:27:39 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH v2 16/19] KVM: arm/arm64: Move phys_timer_emulate function Date: Mon, 17 Jul 2017 16:27:15 +0200 Message-Id: <20170717142718.13853-17-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170717142718.13853-1-cdall@linaro.org> References: <20170717142718.13853-1-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170717_072804_294216_28090A29 X-CRM114-Status: GOOD ( 12.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We are about to call phys_timer_emulate() from kvm_timer_update_state() and modify phys_timer_emulate() at the same time. Moving the function and modifying it in a single patch makes the diff hard to read, so do this separately first. No functional change. Signed-off-by: Christoffer Dall --- virt/kvm/arm/arch_timer.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index d5b632d..1f82c21 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -252,6 +252,22 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level, } } +/* Schedule the background timer for the emulated timer. */ +static void phys_timer_emulate(struct kvm_vcpu *vcpu, + struct arch_timer_context *timer_ctx) +{ + struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; + + if (kvm_timer_should_fire(timer_ctx)) + return; + + if (!kvm_timer_irq_can_fire(timer_ctx)) + return; + + /* The timer has not yet expired, schedule a background timer */ + soft_timer_start(&timer->phys_timer, kvm_timer_compute_delta(timer_ctx)); +} + /* * Check if there was a change in the timer state (should we raise or lower * the line level to the GIC). @@ -278,22 +294,6 @@ static void kvm_timer_update_state(struct kvm_vcpu *vcpu) kvm_timer_update_irq(vcpu, !ptimer->irq.level, ptimer); } -/* Schedule the background timer for the emulated timer. */ -static void phys_timer_emulate(struct kvm_vcpu *vcpu, - struct arch_timer_context *timer_ctx) -{ - struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; - - if (kvm_timer_should_fire(timer_ctx)) - return; - - if (!kvm_timer_irq_can_fire(timer_ctx)) - return; - - /* The timer has not yet expired, schedule a background timer */ - soft_timer_start(&timer->phys_timer, kvm_timer_compute_delta(timer_ctx)); -} - static void vtimer_save_state(struct kvm_vcpu *vcpu) { struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;