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: 9845269 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 9C92760386 for ; Mon, 17 Jul 2017 14:27:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FEC02851D for ; Mon, 17 Jul 2017 14:27:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84D3A28520; Mon, 17 Jul 2017 14:27:56 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 294832851D for ; Mon, 17 Jul 2017 14:27:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751546AbdGQO1y (ORCPT ); Mon, 17 Jul 2017 10:27:54 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:36230 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751507AbdGQO1l (ORCPT ); Mon, 17 Jul 2017 10:27:41 -0400 Received: by mail-wm0-f43.google.com with SMTP id t70so17262678wmt.1 for ; Mon, 17 Jul 2017 07:27:41 -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=s1kLm9P/M9nDsoja/2ZOUGNaGAk4XQ+nYcSwtd41/Yua1UOZCmcBTKpfT/sXXpxfVJ dYVLALg7Y2oRdmYqqVhRXsbMVA7j4G3eUk3892ZSUru6WEDtt9D9poZUjLKl1RHXbjsT uFDKZAqZ7Yin50iF5HvQ9ZM7kJ/QQvOtk4mDDxjgrXfRdzUmZqxIHXdcLRJfnSn/P60j oXzopsJJHQQ7atfDTAuTKrN50XEkAwunR+5oZIxJiEVsJHTiTJ4/tIyJ+Ldm/hY4Mrc4 rTADr4YKimwA8zpSzI0s/LfXW0+3K0rMErQyXQrtoXyPUEgjblTpum7AjPz76LWOpjJm 0+mA== X-Gm-Message-State: AIVw111ZoxUOUrmFcrfkqpV2/wGMYgjVa4n9JEP+mFN36Jf6EW+zRz6c /5I5Eats7Y3EhJV3rp7f4A== 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 Cc: kvm@vger.kernel.org, Marc Zyngier , Christoffer Dall 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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;