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: 9967351 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 204036035E for ; Sat, 23 Sep 2017 00:50:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 122C328ED3 for ; Sat, 23 Sep 2017 00:50:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 071CE290C8; Sat, 23 Sep 2017 00:50: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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED 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 44CDD299CD for ; Sat, 23 Sep 2017 00:50: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=U8Kjm6517BFH6jtOtScTqPYfiCBEj3XMeH7sojdsvDk=; b=FTzQ2C/6GGglPcqvSPW56enbIi cxsWv4ycl8TimFPbl2jJ0T2NZiYuCD2MMV83iCDHtVun0aG9X2EZBtEpkR8611K2MCKtynn91nu3A XqP/+CZZoXvxO4LPmD/jVIk0LXpuBFQeWKejrOdskz80ocNLnBCWr68WogieeH5Kb+dfEDuhvh+uT Uuy3dubS8kvxCpdhPi7p3eVPt65Y60kjxrdRvvVlOkrw9fdytXAdtpF8okyWvgsGssV67GF1XfwgU KBGaZDcMHlh/TWdTn/9BrCLSPlEG+n+SIKgiGcDOVY2EZuKL1DASeN//+qu4eLdHofXYhY3GrCwKd FSYdyF9Q==; 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 1dvYdY-0001MY-J3; Sat, 23 Sep 2017 00:49:40 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dvYWt-0003rq-NH for linux-arm-kernel@lists.infradead.org; Sat, 23 Sep 2017 00:42:57 +0000 Received: by mail-wm0-x236.google.com with SMTP id r136so7640071wmf.2 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=nbUCAegGxlEx8YqVfMLGtxflImpGQRsqg/Pr2CgdH5AHlEtPwSd+cwD7n++WkljNC5 +1E3s9bfXWR0va0HmV2hxjqe+6Ljd1vG87GcnsMsf02nw4VxBCufscoAjKQiX3mmCa1Q YVCfKLPJXCy+sDP/Kj1douSfa79roKH7Pm9kB7r8hbtF7IQ4FoITDVzfjmaRRbjxqFk9 uV7pFZo5ySv+Oq4Erv3KXcvSZBea7qfYcsmLjBsCPL1+iMTNCsomx+P4eaLUNQ6vpRjr IVwcUI+VtlNyConFOtUPpoBPzZNb9JvA58dJry+5MP1vXRv2CCNX+qlnFlRqpWCi+N7g CbBQ== X-Gm-Message-State: AHPjjUhxHuqip/iKFp9to75uB/uot6ul1FsE53XvpkwWx1OWm9dd6Ts3 nQC1TWl0dSVb17C8No04NzJsWA== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170922_174250_500027_DAF154C7 X-CRM114-Status: GOOD ( 12.69 ) 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 , Catalin Marinas , Will Deacon , kvm@vger.kernel.org, Christoffer Dall 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 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;