From patchwork Fri Oct 20 11:49:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10020029 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 A8D3060234 for ; Fri, 20 Oct 2017 12:09:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EAFC28DD9 for ; Fri, 20 Oct 2017 12:09:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 914CD28E9F; Fri, 20 Oct 2017 12:09:17 +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=-3.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM 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 4F53928DD9 for ; Fri, 20 Oct 2017 12:09:17 +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=onQzztRqbyZnsHnwh0hSwzgrMi /Lr4RnVkfBAfcQaK3N4X3gqSfsKVr+olU0A+FXXEtYNb+FLCDGIL2VnqATGjsfXcUjbU0srg6LC0D PWblteNeQRPu8dSPc41I9pJnr2ICRo4YzP0Lj7Mw1exFrOo8GWJNcjcPP6mUtpBRIdluKUjf0La70 wA0Zis6dBzkff/BTrXq7KQ87VF922LpWHQ0cxiUSP883FUm6iaTt+N4ypQBKeQBkqf0HrqPIQ/wxZ KXTXmGMURT+evOaW8PFPAEBTSc2Ndol9YZT5IVLpq0GzQHbIHg1z3qom6iPCT+dAPx+LpjNK0YoML N5lK5c0Q==; 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 1e5W72-0006rL-PH; Fri, 20 Oct 2017 12:09:16 +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 1e5Vol-0008TC-KG for linux-arm-kernel@lists.infradead.org; Fri, 20 Oct 2017 11:50:30 +0000 Received: by mail-wm0-x242.google.com with SMTP id l68so21956523wmd.5 for ; Fri, 20 Oct 2017 04:50:07 -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=0g0qSUTyB3FEeaP+1sgc2QkEskD0JbnOFJeyCfjnQiE=; b=IhQ20bnt3azHT7rN4cjV/4aACWFfC2JvpeC15idtG0zwPrH4v6ZhHp1/cGdzcMTXEr TF6DbPBD2ughYnUZnRx2sOzNjscEPrES+ktgNC0wyoWkwYcL6RsCO+Dlvfbo71yV5oHA i1edmkoETHDQqIUIxeo76lzNCD9wD86WH6zJM= 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=a6BAspYyDCPuu7t9JRs7UBaphf99kzaBP0dJIjKK7XYWntIX/T+FqC/qAIYQcKhkuv xiWJ5MO9yZRGxKiPD0dPOaEMCfLMxCjhIM+YP79WzAZUhZWpqte7mf43UQB4kj+uaVhA l3hUciQYyB+Z2B4W9EK/4JLX4NzRbamfSSZkbW85ITzREjJfk2cqrGmuT42Evv+QtBHj 4mSIUWHt3GNlmsvE85gn50RU3atVcJdKGVF1QxuMkpqyZEbQqeQCJLc46PyJS5YQ28i+ nBUhUiL8Q8P7zrfXGUN5ck05wahdC85cLOAMViZiVvu/1jfsvgP60pF/vjljAUqIKCit 2aTg== X-Gm-Message-State: AMCzsaWyM3t7KSU6ql/p6dhR0XY4r/1ho8e3H53W/QFL5cBwsPYhewlO CoV9C5CQUb2qfFQa7bf2HR+xyg== X-Google-Smtp-Source: ABhQp+Ru6TQGzzZgUg+ZubKfZYo6A0HaS+8+lLSImapYVbeGGECBSqDuzvXnbHcoBQG6gE/Wn5Vwxw== X-Received: by 10.80.190.131 with SMTP id b3mr6041816edk.243.1508500206349; Fri, 20 Oct 2017 04:50:06 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id f53sm872234ede.63.2017.10.20.04.50.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Oct 2017 04:50:05 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 17/20] KVM: arm/arm64: Move phys_timer_emulate function Date: Fri, 20 Oct 2017 13:49:36 +0200 Message-Id: <20171020114939.12554-18-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171020114939.12554-1-christoffer.dall@linaro.org> References: <20171020114939.12554-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171020_045024_244295_8813B066 X-CRM114-Status: GOOD ( 12.75 ) 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 , Shih-Wei Li , 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 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;