From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 754C2CA9EAF for ; Sun, 27 Oct 2019 14:46:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4811921D80 for ; Sun, 27 Oct 2019 14:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572187593; bh=FYlDbIFh5b/0C2W3OiBNU9F9i6Y1G6GI0tp0Fll66W0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=p1m4lBOmMFQ41x015cU/nWghljpgI7H+vBHUTrmSF+loA6ZhXcuQos6sgzF0tZ3e5 1jk2ldfzveDQL/Vtio29wVqud+Y3+Hyv+Eq+FuXkhPcClTtcSxdrOVEvg1uUwC9D1p Ongh1NKACNmb/NeYCEUH3C4X5jN2M2g8tR14DYhI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727526AbfJ0Oqc (ORCPT ); Sun, 27 Oct 2019 10:46:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:39120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbfJ0Oqb (ORCPT ); Sun, 27 Oct 2019 10:46:31 -0400 Received: from localhost.localdomain (82-132-239-15.dab.02.net [82.132.239.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6818221850; Sun, 27 Oct 2019 14:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572187590; bh=FYlDbIFh5b/0C2W3OiBNU9F9i6Y1G6GI0tp0Fll66W0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vpp9sIeDQe2ZKZmhpPEfjNqRemOSxtVWMCjxYNCIpMJcxPCLQJ6Zd+wrz+89kHcBQ fFWXnikTkKAr7/TQ+B5r3DPUIfLDs6u6vnE/wc68VPpG/R8VMo9LEP0l8LQPFQiBFz sXpW1UvnpX39gtIfl2sSJUPWI9bFvQXHtojg4wDo= From: Marc Zyngier To: kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Cc: Eric Auger , James Morse , Julien Thierry , Suzuki K Poulose , Thomas Gleixner , Jason Cooper , Lorenzo Pieralisi , Andrew Murray , Zenghui Yu , Jayachandran C , Robert Richter Subject: [PATCH v2 33/36] KVM: arm64: GICv4.1: Let doorbells be auto-enabled Date: Sun, 27 Oct 2019 14:42:31 +0000 Message-Id: <20191027144234.8395-34-maz@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191027144234.8395-1-maz@kernel.org> References: <20191027144234.8395-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As GICv4.1 understands the life cycle of doorbells (instead of just randomly firing them at the most inconvenient time), just enable them at irq_request time, and be done with it. Signed-off-by: Marc Zyngier --- virt/kvm/arm/vgic/vgic-v4.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic/vgic-v4.c b/virt/kvm/arm/vgic/vgic-v4.c index 50f84f4ce903..e61c7a149515 100644 --- a/virt/kvm/arm/vgic/vgic-v4.c +++ b/virt/kvm/arm/vgic/vgic-v4.c @@ -141,6 +141,7 @@ int vgic_v4_init(struct kvm *kvm) kvm_for_each_vcpu(i, vcpu, kvm) { int irq = dist->its_vm.vpes[i]->irq; + unsigned long irq_flags = DB_IRQ_FLAGS; /* * Don't automatically enable the doorbell, as we're @@ -148,8 +149,14 @@ int vgic_v4_init(struct kvm *kvm) * blocked. Also disable the lazy disabling, as the * doorbell could kick us out of the guest too * early... + * + * On GICv4.1, the doorbell is managed in HW and must + * be left enabled. */ - irq_set_status_flags(irq, DB_IRQ_FLAGS); + if (kvm_vgic_global_state.has_gicv4_1) + irq_flags &= ~IRQ_NOAUTOEN; + irq_set_status_flags(irq, irq_flags); + ret = request_irq(irq, vgic_v4_doorbell_handler, 0, "vcpu", vcpu); if (ret) { -- 2.20.1