From patchwork Thu Oct 12 10:41:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10001565 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 91EE7602BF for ; Thu, 12 Oct 2017 10:43:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 836C228BEC for ; Thu, 12 Oct 2017 10:43:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7846228D4E; Thu, 12 Oct 2017 10:43:07 +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=ham 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 1968728D6E for ; Thu, 12 Oct 2017 10:43:07 +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=R4xT6AuNqLK4l3MQ2mDG5Nb0k5FUDxVWyKSbXIdFswI=; b=ieSIVMjUo8jJEvxA7Cj5oeCqjY oelNNvJd+KlB05DTonELg4HjuuISZ9tsjrjjom2Vfo3NqkxDhFJndKSXqI3WG+r8DXmTAxprYlDXT DhszAf3nUyKwLQlok2lO6I7s3MdR9YNQNSIc98oV7Rk/kazoIry3N9rwQC7bgSjhPAsgdbBOPdhNM ozJ/pA29QOaQbg7FeGb3NM7lRaPmo0DSPL6AImPvrJRKs2PduZgBN5xx8XmsIgayXKCIQqXmoJy9L 5ahsFYmQx1AjqtRtLikc4F4e/6VSIIP2YZWbAhc/514XC+xqOGpfrnvaP8BBbp1PMPLPAUg8QE0VB TbsCh9Mw==; 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 1e2axC-0008HG-AT; Thu, 12 Oct 2017 10:43:02 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e2awG-0007Tw-Hj for linux-arm-kernel@lists.infradead.org; Thu, 12 Oct 2017 10:42:08 +0000 Received: by mail-wm0-x231.google.com with SMTP id k4so12099165wmc.1 for ; Thu, 12 Oct 2017 03:41:46 -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=19T7ELvcL7jpXRvtIg03SU0J1PYdbLNd7enqL5IyDbk=; b=IxaaE0AucZe+Gc25ZeDaP/XK0XQzc19C76TNoLhMD4wsepfmxcB3ioqTaxIXt4s56V AnZgWbhHy9ZObqwv96kldQNHNXoTBw5t2eRoF1Qhl2C/HW6F/F96zyigvd4IpE6mF/6O qx4FiTzP8uL17pyl/7CNvwqPpF0ZjKcLUOo1U= 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=19T7ELvcL7jpXRvtIg03SU0J1PYdbLNd7enqL5IyDbk=; b=c9aTO+VsHgyeuTCZfp5l71saUc03EONTuAMw9+X6HLVBxngScME1WihD1IU2wSTR9G ZJldO4Wn+MEijn1IYS/KVVDZEW9ynWABA8CsnQoRslyUTrcGaf3dvQ7NkIgcSUYjB8le dmGAIAXLK3+SWXjdbhlRqXNVuaqOIoyiriG6Tn72Rd1mwnjd6quk5knIkpO+5HolQOc+ /q53LKQMfEa4n2M/GHC3pduhhvZ/ByoRR7drq68r+tydhfkr2zMfRbWsleywy0spHs5C 8yZtzes6XJdJA7zL+SswoqVWM+BWxJgAVtCV41fPhWWfmUAh2HR+h0JrfaCy3S0rr4DB hUYQ== X-Gm-Message-State: AMCzsaUQ9L5971hJ/fPwvU0rU8Cqt2o1CUxiQsrPx/5EGRIyG5imIJYi N5quvWXmRMsiKMnfxtDtWdVZMA== X-Google-Smtp-Source: AOwi7QBrnbNWBLkVMxSbJn5SYIangIl9JMUij0px5Q1/696dbg2p5lZ56aIRXdybkAeTMQMQWmeZKw== X-Received: by 10.80.151.47 with SMTP id c44mr2424433edb.139.1507804905481; Thu, 12 Oct 2017 03:41:45 -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.41.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 03:41:44 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH 03/37] KVM: arm64: Move HCR_INT_OVERRIDE to default HCR_EL2 guest flag Date: Thu, 12 Oct 2017 12:41:07 +0200 Message-Id: <20171012104141.26902-4-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171012_034204_826272_BBFB29C3 X-CRM114-Status: GOOD ( 11.96 ) 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: Shih-Wei Li We always set the IMO and FMO bits in the HCR_EL2 when running the guest, regardless if we use the vgic or not. By moving these flags to HCR_GUEST_FLAGS we can avoid one of the extra save/restore operations of HCR_EL2 in the world switch code, and we can also soon get rid of the other one. Signed-off-by: Shih-Wei Li Signed-off-by: Christoffer Dall Reviewed-by: Marc Zyngier --- arch/arm64/include/asm/kvm_arm.h | 4 ++-- arch/arm64/kvm/hyp/switch.c | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index 61d694c..e67e279 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include/asm/kvm_arm.h @@ -79,9 +79,9 @@ */ #define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWE | HCR_TWI | HCR_VM | \ HCR_TVM | HCR_BSU_IS | HCR_FB | HCR_TAC | \ - HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW) + HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW | \ + HCR_FMO | HCR_IMO) #define HCR_VIRT_EXCP_MASK (HCR_VSE | HCR_VI | HCR_VF) -#define HCR_INT_OVERRIDE (HCR_FMO | HCR_IMO) #define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H) /* TCR_EL2 Registers bits */ diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index a50ddf3..bcf1a79 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -164,8 +164,6 @@ static void __hyp_text __vgic_save_state(struct kvm_vcpu *vcpu) __vgic_v3_save_state(vcpu); else __vgic_v2_save_state(vcpu); - - write_sysreg(read_sysreg(hcr_el2) & ~HCR_INT_OVERRIDE, hcr_el2); } static void __hyp_text __vgic_restore_state(struct kvm_vcpu *vcpu) @@ -173,7 +171,6 @@ static void __hyp_text __vgic_restore_state(struct kvm_vcpu *vcpu) u64 val; val = read_sysreg(hcr_el2); - val |= HCR_INT_OVERRIDE; val |= vcpu->arch.irq_lines; write_sysreg(val, hcr_el2);