From patchwork Sat Sep 23 00:42:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9967313 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 87C87602CB for ; Sat, 23 Sep 2017 00:42:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79F1D299C9 for ; Sat, 23 Sep 2017 00:42:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6ED02299CD; Sat, 23 Sep 2017 00:42:44 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 F17E8299C9 for ; Sat, 23 Sep 2017 00:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752645AbdIWAml (ORCPT ); Fri, 22 Sep 2017 20:42:41 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:51116 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752642AbdIWAma (ORCPT ); Fri, 22 Sep 2017 20:42:30 -0400 Received: by mail-wm0-f50.google.com with SMTP id b195so7636975wmb.5 for ; Fri, 22 Sep 2017 17:42:30 -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=OO05rnst6nXOyuVkQ4xVYjok4kI/gEG383kRj8NF67b4ygO5AlGwlBQ9jFxhbOpy1E sqexxkn+/6XClGpKn9nmmVCrH+uxp/Zy4OOv3SzSQKnebtgVhXQCAJxBiGzdarGEzyK7 gBOc3fKI/tkQ14N/iyQsT34j8lRM8XB1b2TWs= 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=pN171fABEfhC4dzjERyHkKgN19mgl+Ib9aLtftLqmsF+AQc65WBcuUdwcyIAwyyWqK 6t7Q//RUrVVYEvj7sd178Z8la+H1ena1iPYDFV0Sl07gRWccMvOzzH0sLOG1blczozpR XFkSLzlN9kGf9rWVPJwEcDezt+BWsI1A/aNz1W+zGa9JrchknwUtpZfTEC+egXkJOzRv 2ID4kEvhngkAvsgVnRXMfXuD1/Kqms7Jkxl75AvqTOLzVLIOKWvS0zqiVslxtBTloP/a ClOVKkHaM0a17tRDy841MoBXC7Phyj8OdJNkw4+tVMFmXuCC7UXMiCikZYCzOupQC0UU OkkA== X-Gm-Message-State: AHPjjUjsm7Y3aR+Bby4nTofVgXaVB0ix8j0SsbdpeMnj9Vu0fhaD75BT JYEkYo+dFKujbspco8YD3Vfnvw== X-Google-Smtp-Source: AOwi7QClUeQ45L7yCvl074LmgoRqI2mKOAS4wihg6mgNI+Zpn45mND1znP9kW2waWhPbCheuySg5+Q== X-Received: by 10.80.191.2 with SMTP id f2mr6538455edk.82.1506127349585; Fri, 22 Sep 2017 17:42:29 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id c25sm646085edb.57.2017.09.22.17.42.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 17:42:28 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Marc Zyngier , Will Deacon , Catalin Marinas , Christoffer Dall Subject: [PATCH v3 17/20] KVM: arm/arm64: Move phys_timer_emulate function Date: Sat, 23 Sep 2017 02:42:04 +0200 Message-Id: <20170923004207.22356-18-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170923004207.22356-1-cdall@linaro.org> References: <20170923004207.22356-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 Acked-by: Marc Zyngier --- 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;