From patchwork Tue Nov 7 10:47:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10046469 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 D858B60247 for ; Tue, 7 Nov 2017 11:07:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2A1629CE0 for ; Tue, 7 Nov 2017 11:07:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A717029D03; Tue, 7 Nov 2017 11:07:15 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable 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 3EA3F29CE0 for ; Tue, 7 Nov 2017 11:07:15 +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=Cg7UAdBoJhCv/0Bv6ps53LnUTROc1aat87BJj88htgw=; b=dO1VNSUbhyfzp6DZ+/xY1/2JZA Z1eVA4KSeGe6uvdFvx5lK3aGla7ayh9x+X4wc4gS3ju5f/+mc2+PjcUv6FBtrStZ5iyKTPdJ5n2lb 5shoWI7Zdpq7XHFS81PZ563ha2FDqHOMAntkEkAi+Z+XOz9bQHORy9H9Xs2svCP1qmJgH0VtM8aCI DFrERo5UT75ZJwgvKoqtTFgk4wbqsfeFxu6Rfnuqa8C+a/G7fH+rgqYSiNHOI4PXLJLBbpDiHAe9h ODu3/n8/HiR8nD0gZk5Hh2sWKNPg6kAvu7EX9p18g365q5j62gcrJXuooqbG8AvZhuF7Wa33f0TXL sr/78uDw==; 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 1eC1ii-0003Nh-HE; Tue, 07 Nov 2017 11:07:04 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eC1R7-00010d-In for linux-arm-kernel@lists.infradead.org; Tue, 07 Nov 2017 10:49:12 +0000 Received: by mail-wm0-x242.google.com with SMTP id t139so2850388wmt.1 for ; Tue, 07 Nov 2017 02:48:33 -0800 (PST) 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=0g0qSUTyB3FEeaP+1sgc2QkEskD0JbnOFJeyCfjnQiE=; b=eEoiFJnBZUBiPb32aam2xxsfPTKjTa6UbiF77B3L0IGltZEpb5uud5w1WiU9hVoBXQ BBUVL1i0t3i7Z/+SQEjgb/AMwBFdSylzBvQCSFcVFW7IlzqiROJR6pyi82WgKC4iTQWx abKPCup5Yi2USUJsVsllCPKFwJal6he9VHj7I= 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=0g0qSUTyB3FEeaP+1sgc2QkEskD0JbnOFJeyCfjnQiE=; b=FKkahDNep6vVG6nkPo5tkKDHZJJpSLDQYBYoHZTOwgAbQWzQ6Jh/InOpVrRnZRNRkQ tvaL1QiU0QnaLMKRr48VIX49JP3MetgHoLcMeKaum7BKB8TH2J6Vfx6MB8NVyBqgFkyH qWqtvMSO5krGEZDBLQnrS+HjeQcXSTiuyO+xNGEshTHdwySiHwVPu6f36LjV2sAjbPMU oVZivkHfBKemGbW3+qlA4a3IvAIdgN4vda8P7SNmOIti0eK987RIQwoHQ4BerEDqgX1J k5rmj9vBKF6MPh7wkAiGyYyY0I++hF4UM0WkfsE72epGnxjGoW+nDAYRGinWJMPWW9+y z1Ww== X-Gm-Message-State: AMCzsaUCva5IIB6ZefXlaUTvHG/HqLmlwGGs9Hqi1SfOz9BqLNwAAy/y w0OQbGgRR+7qulA9CznLhV7a/A== X-Google-Smtp-Source: ABhQp+RWFAKrG4ltpKlFzqCcgRwoFyVY1/yxyPGX8UHYIt4GmoglGwArvS9bnm8cipkiX5DpUvMFPg== X-Received: by 10.80.224.7 with SMTP id e7mr24891674edl.117.1510051711673; Tue, 07 Nov 2017 02:48:31 -0800 (PST) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id q12sm1044958edj.29.2017.11.07.02.48.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Nov 2017 02:48:30 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 15/26] KVM: arm/arm64: Move phys_timer_emulate function Date: Tue, 7 Nov 2017 11:47:48 +0100 Message-Id: <20171107104800.30021-16-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171107104800.30021-1-christoffer.dall@linaro.org> References: <20171107104800.30021-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171107_024854_261386_353B7665 X-CRM114-Status: GOOD ( 12.65 ) 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 , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.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 From: Christoffer Dall 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 d1a6fb12121f..7f4f12d48a1a 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -255,6 +255,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). @@ -281,22 +297,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;