From patchwork Sat Sep 23 00:42:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9967363 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 54B08600C5 for ; Sat, 23 Sep 2017 00:53:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4631229A7D for ; Sat, 23 Sep 2017 00:53:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A78D29A7F; Sat, 23 Sep 2017 00:53:53 +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 ADD2329A7D for ; Sat, 23 Sep 2017 00:53:52 +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=htEXENSHWplnBS88kE7CgwVj3eJk6B/DNTbTWBlEz+0=; b=N4DmYfVZZlEgS9fi7hsXikKJct ViTH/WgCLpzF71JPOsfAaHPBJJEhTjmmVKFsK5MsxHMqEdtOwo0UiBLVWUqX9GEPF2hN6uvBcV2Q1 cBWgJ8K2NeGwdpG2D8p0msppdbAuNKZ6CPAZIMwzGQUtiHTXsDcZF0YAdeiq6pwrOQNfcGJGsI0UY SfYeslUhXhEI+UY9Mej9vpL4zNSYhefptqG1x48VNIRWnni3pPjacdKG7uD9AyIXLmXY53TQYWFOp X5EqJfHAa6/IzutlPNZF60mQVZt1g+oYVnUi7CyXhhXUYwrmIOiwXSron2OzZUIjwW9qxfmsdxl2b Xj437T6g==; 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 1dvYhU-0004pK-1c; Sat, 23 Sep 2017 00:53:44 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dvYXC-00047Y-2r for linux-arm-kernel@bombadil.infradead.org; Sat, 23 Sep 2017 00:43:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+Pg5+jP2obVmDdklg8Ejxq49rqOSFqNl2b6JSplpk2w=; b=syxDQzJC8tRM5dw5WkZIiukIf uTOC/nkjnI+pQq44+w7dUaC1C27ikkxv60CQi5mV7WO7gZu18tSdXMDtLEc7DEmcS0vzygl4EjmFg 4xPHihP/WZYc1LvOA9nGtzGDxoAdxM9efIlmnhp8bBF7xqjJEZ4HqbIGMrsDwc0XfySZ2AmAUT0yA gWhxXHIP1TZL5L2jx02aVFnxeCnjCHDKDNOaCOgNw4F6Bg+gjEUrfkGNmFYOn2XL+s4SnjoJFnRng nk7kHc/yGPZXw0GBqW3ECAW/NLR/GswfIaUGwKclzqyKz2Szj3ow8EtG0lBnnKpa4BFQznEdtIqhU ubf733rTQ==; Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dvYX5-0004u9-AC for linux-arm-kernel@lists.infradead.org; Sat, 23 Sep 2017 00:43:04 +0000 Received: by mail-wm0-x22b.google.com with SMTP id r74so7646546wme.4 for ; Fri, 22 Sep 2017 17:42:38 -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=+Pg5+jP2obVmDdklg8Ejxq49rqOSFqNl2b6JSplpk2w=; b=MlLsBugXDMvsK0hewg6d7w+DvmAWfj2Nb+sCFomW8NTiikwzI1CHY5brWsxwge9SCz BpKGQeEE5OJ2b+VTEXTee8fAKniYeQAFaVkHaVBLr8mL1fmoL/UxOiuc2D/IJqJSH975 yy1L+NK3npjHGAyioze56KPN/3qgkRtY8ukwU= 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=+Pg5+jP2obVmDdklg8Ejxq49rqOSFqNl2b6JSplpk2w=; b=bD0tA4l3luca3z+TSvWPvOyS7OAQLO6TBnRkX0h7VtZUQoXBMel4Et1dd9LQvuBWwQ BcBOzsv0XvyDD1n/a1zv3ArfeWakVijOMnHTd8hB/TuZwqBuKbQQNvZTWudTh3gYKJa5 Z4rZ6AF/UGu6GV/TtMVHkcKwC73/GhMGeUoTn9i3yQNgNt7RhHvNkzoSKe6ncljPGjFe YcOXWvQxDr4Mw8Ry9cfjD8duLf8y6MJSdNiV26wrVxj5pyP+TymLu9arr5ovUu/rXPrr rH4aVNjEQ8tgmapumj6yo+LlulS009nO6zi4jVvtuUozrSODANjT9CZ9Q5OoFA8fi/Fu DGyA== X-Gm-Message-State: AHPjjUigCfJRojk8jXPKryvnor6s0cz6tknX7RX6wzgR5kRUXiQKMyMW BZObeD4YkjsJGe2bma8PUVWMLg== X-Google-Smtp-Source: AOwi7QCzr+wU7YzRhRuCYSqbEWLM/gi6S1VMb1lG3UUxv3+1yETn/Ivcdldxi/Lb1SFvNNJep4g/PQ== X-Received: by 10.80.196.3 with SMTP id v3mr6337470edf.272.1506127352964; Fri, 22 Sep 2017 17:42:32 -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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 17:42:31 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 19/20] KVM: arm/arm64: Get rid of kvm_timer_flush_hwstate Date: Sat, 23 Sep 2017 02:42:06 +0200 Message-Id: <20170923004207.22356-20-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-20170923_014259_462535_3890E732 X-CRM114-Status: GOOD ( 18.15 ) 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 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 | 24 ------------------------ virt/kvm/arm/arm.c | 1 - 3 files changed, 26 deletions(-) diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index 8e5ed54..af29563 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h @@ -61,7 +61,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 aa18a5d..f92459a 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -302,12 +302,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; @@ -493,24 +487,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; - struct arch_timer_context *ptimer = vcpu_ptimer(vcpu); - - 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 132d39a..14c50d1 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); /*