From patchwork Fri Oct 27 08:34:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10029431 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 78C9160249 for ; Fri, 27 Oct 2017 08:52:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68CD428EC6 for ; Fri, 27 Oct 2017 08:52:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C65828F02; Fri, 27 Oct 2017 08:52:50 +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 E87AE28EC6 for ; Fri, 27 Oct 2017 08:52:49 +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=dfP+ZA3+oCOlxNYfkTMEhKxWeHOfQIzSuXoW7GOp5sI=; b=AM9JdC+25vzAgmneb/2ddG63Va 2yB4JTYei6HI3KidGVu/wZZPPry34tUrl3pGiJ/tTTUWPEnHRk28uwCULyF9bWRjZHWD0jSC2gUzt r1CV09bzIpePPWVlWbD5PpxdaQ/r4PoIjad528ixrbw28ZfFfQ4i+Ox5ZkJTuqscxOwmD+eO9wWWp xOC5FHtvp/AMOoKgdH77ut7BkXXsgLfDWeGFiiVqf2nn+ump/WNTPJQX2PDBZLOZ18kW+2ottolDP O5L6UNfL7gTXMzvuq82Z6D1VlX2Br1wdeHq5s5OQveQoAabbCaQC+sqRWlRRdDOgUtU8UAI8Skr7G Tv53i8dw==; 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 1e80Nf-0002nG-VE; Fri, 27 Oct 2017 08:52:43 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e80NN-0002QE-HQ for linux-arm-kernel@bombadil.infradead.org; Fri, 27 Oct 2017 08:52:25 +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=vC/HlT7w2b51mfSsElXBlfQddMFgLdnz4kYAp8rucn8=; b=OxW85iNsudG0oaAVuz5CYgi6j OEZakqa3Tz8W1YGOIoaF2hIm3oZht/f/vd2X5O9pS0hCnIIqSC5m7AMH0tCvuMPI4wcoXNuonU3+h pxGhDzwukv6nKVWzq7UJWqcZ3V+GhKDNOkPYVGLlq1fcYNX+mfK4DY8i16NvM05TbPZ4x0LsIFJWo lGqjc/7U7PK/wNWHer0648NY1g6W3mSpvA8ABUcHO8suA8XBuKVXCqTjaPFMJIeOQonf+MZbqXEYm MPeyT/wLBimdxH+Hn7vf19Xnqo9YJ/h+DQNFRj08T2MJ1bJ6sE/2DCvkyIe0uQ4nQjxgqt++KKLzq gqdwk7bhw==; Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e808T-0006kr-QO for linux-arm-kernel@lists.infradead.org; Fri, 27 Oct 2017 08:37:04 +0000 Received: by mail-lf0-x242.google.com with SMTP id w21so6555621lfc.6 for ; Fri, 27 Oct 2017 01:36:41 -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=vC/HlT7w2b51mfSsElXBlfQddMFgLdnz4kYAp8rucn8=; b=AyTS6N+gFFpXd6CJrEdwNTvTA26DzCHPdJ2MUpjPA7oePaMvb8Q+ozSyBAROne7uPD VZJoqSUyFp8dM9HQ3STY2/J4Pj55LO+TC8UHA5k6R6fPW3BkepxgJLzamWN4kaSxHyoS TjfPyOm2YCxRJst3so/+rZVAGvoCa35kjfYic= 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=vC/HlT7w2b51mfSsElXBlfQddMFgLdnz4kYAp8rucn8=; b=m/TT+jPVTllyQTNYBJ4xS8L8HnVJxXQJSO3xMfMo03+sSM1emD5XTcH9qg/zaoGUW9 NGSr0EI7zKTNAr5amCDrkAELnLBTSuUHibpdMm/N9Jure+CkHHjI7VIJ6JFgZyYImwLx /yEOP5PyazCT7Evh05tgirbzAO6zROlSFbMrOfp0OWjwfmqXG8z8hAC29k1oyBNippun Crhc7oLHWrSRlcvqsZeFipszc79hvGooFLVuAuuQs8Iv3okbFBl9wtmZK4+xAaDWceLI b9W696/gORlmW6dA13N2ps4NKIBVOaJOxDRpG6GA4kHtpA7CuhSXDHoGqWwlTO/QfLXB RqLA== X-Gm-Message-State: AMCzsaXtX4FLMf6YfUdfZCNziWZXJOjKdfRrMwo9M+padIcAHZhvIbsl +Gi8/a1DtIbynTPH2MjYaUMN3g== X-Google-Smtp-Source: ABhQp+SAqYFwCDhJSRUQDiu7EYTgJL4FwCltD3bSnITLkpt/QQTHnC5+Xib0Wd/Rcud3KHWOGtXu2g== X-Received: by 10.25.233.81 with SMTP id g78mr9654595lfh.197.1509093400054; Fri, 27 Oct 2017 01:36:40 -0700 (PDT) Received: from localhost.localdomain (212.27.17.163.bredband.3.dk. [212.27.17.163]) by smtp.gmail.com with ESMTPSA id d204sm1471957lfe.73.2017.10.27.01.36.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Oct 2017 01:36:39 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 19/20] KVM: arm/arm64: Get rid of kvm_timer_flush_hwstate Date: Fri, 27 Oct 2017 10:34:40 +0200 Message-Id: <1509093281-15225-20-git-send-email-cdall@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509093281-15225-1-git-send-email-cdall@linaro.org> References: <1509093281-15225-1-git-send-email-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171027_093701_905103_C1DED4FD X-CRM114-Status: GOOD ( 18.20 ) 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: Christoffer Dall , kvm@vger.kernel.org, Marc Zyngier , Catalin Marinas , Will Deacon , Eric Auger 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 c538f70..2352f3a 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 20e56c4..53d9bd4 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 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); /*