From patchwork Thu Oct 12 10:41:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10001575 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 AC034602BF for ; Thu, 12 Oct 2017 10:43:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EC7128BEC for ; Thu, 12 Oct 2017 10:43:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93EC828D6E; Thu, 12 Oct 2017 10:43:21 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 425AE28D4E for ; Thu, 12 Oct 2017 10:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756248AbdJLKmJ (ORCPT ); Thu, 12 Oct 2017 06:42:09 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:54809 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752691AbdJLKmE (ORCPT ); Thu, 12 Oct 2017 06:42:04 -0400 Received: by mail-wm0-f49.google.com with SMTP id i124so12074979wmf.3 for ; Thu, 12 Oct 2017 03:42:04 -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=3BnvLnHet483I57bAqzNjq+Fij/p4EDz2QkbPHNLS4Y=; b=YIZErXjLyV24GnvwcXT007JtPZm7pNa5ud69N86Z7uqr1C1fvi8Pd3IRGHz+QMSi0U MT1nCtq0BB9MqEkxHSAmWOghPDWgbWGAamQvTeCohGwirUoG/tN+tALs18dfhfUW6jg5 BSjj8nH9hAiSKQ/aAhCqDjZMFhRPw4bgT/Tmw= 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=3BnvLnHet483I57bAqzNjq+Fij/p4EDz2QkbPHNLS4Y=; b=R+KwLBT2oKBjq/f4ZW3MqMczPL1qfenQbynifJEwq6DsOAI2L7NtaKUZpe6YXYHw/r BJKY04Q49iYLzFnngKOyGR2sR6KK8h0YhDX6TW7KvA0Gb9uulpA7sj8xfF24qRTmhfm6 nM6HZJ8txmbOWjWiKZ8+ELKUF2Acy+UTZcwRv2bsrzMOUHztfbHtusXGSpLJMwBqL26L F4sVx2/pW6yt7eHi7B33c1MqqZD6e3n3iG5WojY8oHkF+gs85E2QksUJiudPeVH3dfoO yd47NkZJ2g/49IGG7kjp2i5hfYM+BqZBRNwldgvfIvqaKGX36jukoP9PUb/g0KXANanQ v4vg== X-Gm-Message-State: AMCzsaUai66d3rhMtwbRGDz8cATa2IGZHEJfcacsEUCy2g/hrkEc5Z1E 9l6kPZc/eVzyZ9F961OZmPYJ/A== X-Google-Smtp-Source: AOwi7QDZM9Hmv1pMEvUzBEqome/BZ8dJUKsIMflTpMnZiHYRuYWmHpiwbkS9bGER6QyRuTitZEOJgw== X-Received: by 10.80.137.212 with SMTP id h20mr2377714edh.295.1507804923525; Thu, 12 Oct 2017 03:42:03 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id g49sm4798603edc.31.2017.10.12.03.42.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 03:42:02 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Marc Zyngier , Shih-Wei Li , Christoffer Dall Subject: [PATCH 16/37] KVM: arm64: Remove noop calls to timer save/restore from VHE switch Date: Thu, 12 Oct 2017 12:41:20 +0200 Message-Id: <20171012104141.26902-17-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171012104141.26902-1-christoffer.dall@linaro.org> References: <20171012104141.26902-1-christoffer.dall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The VHE switch function calls __timer_enable_traps and __timer_disable_traps which don't do anything on VHE systems. Therefore, simply remove these calls from the VHE switch function and make the functions non-conditional as they are now only called from the non-VHE switch path. Signed-off-by: Christoffer Dall --- arch/arm64/kvm/hyp/switch.c | 2 -- virt/kvm/arm/hyp/timer-sr.c | 10 ++-------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index 2cedf12..b98b73b 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -336,7 +336,6 @@ int kvm_vcpu_run(struct kvm_vcpu *vcpu) __activate_vm(vcpu); __vgic_restore_state(vcpu); - __timer_enable_traps(vcpu); /* * We must restore the 32-bit state before the sysregs, thanks @@ -356,7 +355,6 @@ int kvm_vcpu_run(struct kvm_vcpu *vcpu) __sysreg_save_guest_state(guest_ctxt); __sysreg32_save_state(vcpu); - __timer_disable_traps(vcpu); __vgic_save_state(vcpu); __deactivate_traps(vcpu); diff --git a/virt/kvm/arm/hyp/timer-sr.c b/virt/kvm/arm/hyp/timer-sr.c index f398616..82c217e 100644 --- a/virt/kvm/arm/hyp/timer-sr.c +++ b/virt/kvm/arm/hyp/timer-sr.c @@ -53,16 +53,10 @@ void __hyp_text disable_el1_phys_timer_access(void) void __hyp_text __timer_disable_traps(struct kvm_vcpu *vcpu) { - /* - * We don't need to do this for VHE since the host kernel runs in EL2 - * with HCR_EL2.TGE ==1, which makes those bits have no impact. - */ - if (!has_vhe()) - enable_el1_phys_timer_access(); + enable_el1_phys_timer_access(); } void __hyp_text __timer_enable_traps(struct kvm_vcpu *vcpu) { - if (!has_vhe()) - disable_el1_phys_timer_access(); + disable_el1_phys_timer_access(); }