From patchwork Mon Nov 13 09:17:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10055381 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 3180E60586 for ; Mon, 13 Nov 2017 09:23:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E61028EA4 for ; Mon, 13 Nov 2017 09:23:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20D94291E6; Mon, 13 Nov 2017 09:23:43 +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 938ED28EA4 for ; Mon, 13 Nov 2017 09:23:42 +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=agmaESlCYIJDcsg+9ZcjetzE6KbCJcvfGNSU7Y1W5gw=; b=jsdi4tth7CTGooNI0UAurmhymi gACE1khdqGnEydRdCiUbdwId+ru/RUZE8cHGAIp2MXhAeVCvzdsWs8khVaMqmRsneL2WcpU8SqYQ6 QC3acRPKFOT9+eeS2+KZN6M3BLngaJG+FtkYgDMmmvDB0NHVx+h1B2LpGm08Z+ww/sOU2HWTUJ7ve Ie6Awk/p/Ou0vlFg93Szi0BLY+oJQGguFKDTX1rIjAyH35oQ5TRlKqWuniLnyVC6EWAP2T4xekgxc slrvQUjDXm/FENXhPuvsL23bKK9XJcbuCuBDUchigA4i23F9zTGu2dWqp4LDCmJHn9z4A/ecFxZ2U 3l3fFxHg==; 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 1eEAxx-0008Ac-Np; Mon, 13 Nov 2017 09:23:41 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eEAtE-0002Pf-WF for linux-arm-kernel@lists.infradead.org; Mon, 13 Nov 2017 09:18:54 +0000 Received: by mail-wr0-x243.google.com with SMTP id j15so13762246wre.8 for ; Mon, 13 Nov 2017 01:18:28 -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=0EcSvfUXiMnuLQfwK1oBGV5dTPWsQFjw6WjbymzDffs=; b=REeQd7gV0eBEPGCK2MRvxlSD30PzI88MaOoQ7W5tuxlyYUllqePyRGTXKa94StTv/N 9esFTdEuucnSdPRYeuAiF7caq4Fvr4eSIRIT6cB1UM9iIhQ+LygIZeVh5C092XOs/tdW HRQd0jKH3x4Hm710a2JMnZxeamHsifZEnMpQ8= 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=0EcSvfUXiMnuLQfwK1oBGV5dTPWsQFjw6WjbymzDffs=; b=rFheEoGmPtN/Rq4ZgI0TCFrxktrxg3Lpol4vu21ltr/XChrh2v1VLwhFrVqfvUmZQx b/vESzKJw7iubwjRwULqhKnYpt6oKuwS24CX4ZjN/hU148DDk+Nvb2RfXVRu6bg8w5Nd UcZDQA77MR0cnuMv3tZMi8pNHPArWdjfjMx+ISEKw0bvGBaTG0KV2Y7u6P98HCrHHfgB n01V3Xl+ko/XYFZQVGo/asZ33avIAcGrUJGt9B7xzLiVvoCFqb8Dh6dmFdNaqTHhbAQ9 Hawaq4SRN0xaVmE0yYKXvRJpImCxihonvL39hIc7+tcwSOdmuWuLcw0EeLcbKBH26Z4r mQbA== X-Gm-Message-State: AJaThX7PN2ugNdrkPm4h7p/KYU7Mc3wZZh3aNt6WLLgOMSeMRvCKwmvp u5lDs5P/LyfI0KqRMfYgGvMd5g== X-Google-Smtp-Source: AGs4zMYLmnZhpBlNCJ0oo7QNWgW+M/CszKkcOA0/rokoSNKsCPcSFHxfidjVHA6DJ2uIzIMmOa4k4g== X-Received: by 10.223.129.247 with SMTP id 110mr6386536wra.208.1510564707457; Mon, 13 Nov 2017 01:18:27 -0800 (PST) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id x63sm9651399wma.39.2017.11.13.01.18.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Nov 2017 01:18:26 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 21/27] KVM: arm/arm64: GICv4: Enable virtual cpuif if VLPIs can be delivered Date: Mon, 13 Nov 2017 10:17:46 +0100 Message-Id: <20171113091752.10663-22-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171113091752.10663-1-christoffer.dall@linaro.org> References: <20171113091752.10663-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171113_011849_794088_97271916 X-CRM114-Status: GOOD ( 11.33 ) 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, linux-arm-kernel@lists.infradead.org, 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: Marc Zyngier In order for VLPIs to be delivered to the guest, we must make sure that the virtual cpuif is always enabled, irrespective of the presence of virtual interrupt in the LRs. Acked-by: Christoffer Dall Reviewed-by: Eric Auger Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/hyp/vgic-v3-sr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/virt/kvm/arm/hyp/vgic-v3-sr.c b/virt/kvm/arm/hyp/vgic-v3-sr.c index 91728faa13fd..f5c3d6d7019e 100644 --- a/virt/kvm/arm/hyp/vgic-v3-sr.c +++ b/virt/kvm/arm/hyp/vgic-v3-sr.c @@ -258,7 +258,8 @@ void __hyp_text __vgic_v3_save_state(struct kvm_vcpu *vcpu) cpu_if->vgic_ap1r[0] = __vgic_v3_read_ap1rn(0); } } else { - if (static_branch_unlikely(&vgic_v3_cpuif_trap)) + if (static_branch_unlikely(&vgic_v3_cpuif_trap) || + cpu_if->its_vpe.its_vm) write_gicreg(0, ICH_HCR_EL2); cpu_if->vgic_elrsr = 0xffff; @@ -337,9 +338,11 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu) /* * If we need to trap system registers, we must write * ICH_HCR_EL2 anyway, even if no interrupts are being - * injected, + * injected. Same thing if GICv4 is used, as VLPI + * delivery is gated by ICH_HCR_EL2.En. */ - if (static_branch_unlikely(&vgic_v3_cpuif_trap)) + if (static_branch_unlikely(&vgic_v3_cpuif_trap) || + cpu_if->its_vpe.its_vm) write_gicreg(cpu_if->vgic_hcr, ICH_HCR_EL2); }