From patchwork Tue Nov 7 10:47:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10046449 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 526DD60360 for ; Tue, 7 Nov 2017 10:55:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 279732932E for ; Tue, 7 Nov 2017 10:55:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B9D12960A; Tue, 7 Nov 2017 10:55:33 +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 B2D862932E for ; Tue, 7 Nov 2017 10:55:32 +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=pmOEOuXkNevxV28HrFcvLRhA4yhgRFY/hqZvubgzfRk=; b=ID49KCmoUXzEV3Wc3EblB2v4xx P0P/RvF742ofglrkvhqBa7xGWDvCdD1GNAp8wLa0TUeCeMYboAw60DcZqJnCPC/g8WQTaGb9sKOnh eUt8MkvcI/kD0KsP6XZZECmW36W3IMIlb/baeajADNv4OHx98RQ/vUMom/K9AFoOQOO3XMyMdYtZI 8Tj00UlOniPOeBBEgTAlrMVxZZ80WeXrbAoeOMRaBTDbqZqbB39oGyZW1hIHR+oyu28EkcpnAccqp GSRerlJLv9Cy9a483CoKWF8t1mP/RkoujZ23Hyni4bIuiXheCC5MfxpHMEAh64SSnYXonieRjCAlj TtxXWnyw==; 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 1eC1XY-0001Rq-3n; Tue, 07 Nov 2017 10:55:32 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eC1R5-00011F-5C for linux-arm-kernel@lists.infradead.org; Tue, 07 Nov 2017 10:49:12 +0000 Received: by mail-wm0-x243.google.com with SMTP id z3so2810083wme.5 for ; Tue, 07 Nov 2017 02:48:35 -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=mrpokMoNQ3EDpno0JeGFR5UV2PPtRCd8vzb2WUsIDMg=; b=Cw/CBr102Vm8KHoOeeRpP5qb4yJfDmXDsFPEy8QM1N5VKqGQgKX2BrupMnVjauSwNr 52waJFalnIwZT4LpcJ5D1uXGkTBhQSB6CH7wJQOeYZJ8QU5XpCH7VmOzhgj8BnzX5JpQ 6x1KfJCh810+KMtNRHyuHP2WsLn1pyqpghi3E= 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=mrpokMoNQ3EDpno0JeGFR5UV2PPtRCd8vzb2WUsIDMg=; b=SWPkvi0O/f3bdYosesDnywe9mq2Kccm6NV7p/J/UmfFpDmhHrA6DngxB6KBuDpcJdt Za6HgdfP+NzhQX5u1F41vpz17kcLhVE71zibRNI5f+37fj5fFc7ZqBNHZ/A0zuEF8jhL PDkaF5vnqf8T1j79ZTIway8aT4zgVL15oEOO7NOY7RJAxnfhcu/3dZaWv1VtgJTLJOnf ebUqfleH7HTJ9pOidfLhDmPZrhvc4xx+P9LRzKlitf6xeqECmaQT9ohUkW6WHLLO7Cnk +wuKvLWd4zC8Pr3DU9FP80y404NQqXmAAuHIMLyMrNOBoAtTG1LtYXHYMMzfVIPLslMp rYTw== X-Gm-Message-State: AMCzsaVF7f1lk31PGMbwigFtydijy9dgsWrZWirF9F4di3hCA7pQc6Qt 0EEHAaHeHrLt9wJcXMe/RgNKkQ== X-Google-Smtp-Source: ABhQp+T29WIpaExoCdrUBOH8NsOf0qaWDEKeuBaOzI74TGmnqdLZhpYLiBKqr4FF2nvZFLGpqnfr9A== X-Received: by 10.80.167.37 with SMTP id h34mr24011506edc.223.1510051714335; Tue, 07 Nov 2017 02:48:34 -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.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Nov 2017 02:48:33 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 17/26] KVM: arm/arm64: Get rid of kvm_timer_flush_hwstate Date: Tue, 7 Nov 2017 11:47:50 +0100 Message-Id: <20171107104800.30021-18-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_024852_205494_685F0874 X-CRM114-Status: GOOD ( 12.95 ) 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 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 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 20e56c420632..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,24 +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; - 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 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); /*