From patchwork Fri Oct 20 11:49:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10019981 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 D0126602CB for ; Fri, 20 Oct 2017 11:56:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5EB728EC0 for ; Fri, 20 Oct 2017 11:56:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA88428ED0; Fri, 20 Oct 2017 11:56: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=-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 29FED28EC0 for ; Fri, 20 Oct 2017 11:56:44 +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=9dOsBaR1K0baTpuGgrejSDO9EJyKF1BUonGIz5De1vE=; b=BjqaQPO/H5dyLQGJqqO9HuMLGJ DcnHiGnB1tH4yLMzHqVj87dXOoNzmw3OLJHS3jMrfc51JRB4ACa2YVvJf72BoUut/wFut/950CV2c xlKZ+fhIar5a/T1SACXJCvJR05ae3lXIw2YdCCOqa1F90ZuxVOY7Ea/JezMqDI98ZjYdpeuW4NGyK ii4Nv7DrQZZ2e0PQKzYOexwLsoBgfY7kzcuGEZnofz8Au4WmJRrignNPGsQGiscI/i8I9LCk01uvf 9TGhw23C8fFmOW/Q0UWuGUVk5mj6YZZ+8YOMYPws1HsgmJKkXxzWUX4Q1V62jvM+iWzCqgZErUrV6 RuLD6o3Q==; 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 1e5Vul-00076v-EU; Fri, 20 Oct 2017 11:56:35 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e5Von-0000Kk-NV for linux-arm-kernel@lists.infradead.org; Fri, 20 Oct 2017 11:50:35 +0000 Received: by mail-wm0-x244.google.com with SMTP id b189so21243609wmd.4 for ; Fri, 20 Oct 2017 04:50:10 -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=SWnsET7OJsrLlp2mpeN1I2rFn/cVWrrIzzyKvjJ5u9k=; b=gfvryC6VJ0ncgbslPyQFAKTvVDlOKcOceHAjObChh4CXwilI0aK+TsaenM/8qoQg9M 36Ed7Vg+b3I9MhkYcdvAFNSXQ5LrFxDWy10vNO/cv2ETQ5h1W/cP06439MoW90OZrQfv 04YKJsNhuKWq7YPoMF4xVN65MbT17kccnqJMI= 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=SWnsET7OJsrLlp2mpeN1I2rFn/cVWrrIzzyKvjJ5u9k=; b=EfuSScqm9JxvKzyqSpWtCxKcuCXZ4/uH4iWLwV+aVxy8RnxHOkz95Wv35VJG3RDsoU TEA5uk2EM6VzDXFttuo8AfvzEWRVW9Putv6OYku21aOQ0umEvAITiOhp8PdW26sj7UZJ 7J6no5xBFLGJCCo/WG6LPOVbbeHLJ/q4pGExfb/Apjaaa2N2ayvOY6taopREPVXKYlNt QjjhpQYL1KRqiRoCiv0mdwhJX5DWaLTC7rbNS5+1X001+EKJiPVkdx+U5bcKi8xsO45f 4Sasa18EeXlDeHa+m4KD0ZRwaNoaaPAwhFjx2E095FmoVk+iG/XHR5HgW8VmsYkzoyrG hT5g== X-Gm-Message-State: AMCzsaVpS7ZglQOLOOlLeTZ3DtDPk/AQW9thHk7ozq1rgb/+yVMWV7gg 1nD0tmnqXtCBlgCz+ouxq/zClw== X-Google-Smtp-Source: ABhQp+SAa7GCnL8qxRLqvsAZRnOo/ca30FJFMjA0HavE1g3SRnAC7BW7E803grtmVUriXQYkw2jS1g== X-Received: by 10.80.153.205 with SMTP id n13mr6219013edb.281.1508500209020; Fri, 20 Oct 2017 04:50:09 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Oct 2017 04:50:08 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 19/20] KVM: arm/arm64: Get rid of kvm_timer_flush_hwstate Date: Fri, 20 Oct 2017 13:49:38 +0200 Message-Id: <20171020114939.12554-20-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_045026_602027_AEF4D910 X-CRM114-Status: GOOD ( 13.06 ) 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 Now when both the vtimer and the ptimer when using both the in-kernel vgic emulation and a userspace IRQ chip are driven by the timer signals and at the vcpu load/put boundaries, instead of recomputing the timer state at every entry/exit to/from the guest, we can get entirely rid of the flush hwstate function. Signed-off-by: Christoffer Dall Acked-by: Marc Zyngier --- include/kvm/arm_arch_timer.h | 1 - virt/kvm/arm/arch_timer.c | 23 ----------------------- virt/kvm/arm/arm.c | 1 - 3 files changed, 25 deletions(-) diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index c538f707e1c1..2352f3a4e88b 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h @@ -66,7 +66,6 @@ int kvm_timer_hyp_init(void); int kvm_timer_enable(struct kvm_vcpu *vcpu); int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); -void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu); void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu); bool kvm_timer_should_notify_user(struct kvm_vcpu *vcpu); void kvm_timer_update_run(struct kvm_vcpu *vcpu); diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index c7499364f2ed..53d9bd4a734f 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -305,12 +305,6 @@ static void kvm_timer_update_state(struct kvm_vcpu *vcpu) struct arch_timer_context *vtimer = vcpu_vtimer(vcpu); struct arch_timer_context *ptimer = vcpu_ptimer(vcpu); - /* - * If userspace modified the timer registers via SET_ONE_REG before - * the vgic was initialized, we mustn't set the vtimer->irq.level value - * because the guest would never see the interrupt. Instead wait - * until we call this function from kvm_timer_flush_hwstate. - */ if (unlikely(!timer->enabled)) return; @@ -489,23 +483,6 @@ bool kvm_timer_should_notify_user(struct kvm_vcpu *vcpu) ptimer->irq.level != plevel; } -/** - * kvm_timer_flush_hwstate - prepare timers before running the vcpu - * @vcpu: The vcpu pointer - * - * Check if the virtual timer has expired while we were running in the host, - * and inject an interrupt if that was the case, making sure the timer is - * masked or disabled on the host so that we keep executing. Also schedule a - * software timer for the physical timer if it is enabled. - */ -void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) -{ - struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; - - if (unlikely(!timer->enabled)) - return; -} - void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu) { struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 132d39ae13d2..14c50d142c67 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -656,7 +656,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) local_irq_disable(); - kvm_timer_flush_hwstate(vcpu); kvm_vgic_flush_hwstate(vcpu); /*