Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7495179ybl; Tue, 24 Dec 2019 03:41:08 -0800 (PST) X-Google-Smtp-Source: APXvYqzlmCbivPouguAlQ/k8pxpv823wogPaxSlFHzslB2LVQc2n9KU1W736ochRhIHcV0x0Tarm X-Received: by 2002:a9d:7315:: with SMTP id e21mr25924795otk.255.1577187668344; Tue, 24 Dec 2019 03:41:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577187668; cv=none; d=google.com; s=arc-20160816; b=TAFRkLFtavDRY6VpBwBee0BHVJjZ2s7LffBo+ABGh9/Sb7Bc6IMvjV3iG4rbD/MEtD SgPBSZ/TykdMhJn2+w9/o/Ft+QfYT60Cwo7lqqEwOemRD1lT7/Fsu/UQ1hip9Eokp9Nm eDwxJ2u8zGx3orb76qoJf7NYjT5NMFqDAB6xPcvkyD4bvmc0nZxEOkiOA7RTLJoNa0hA 4Q3W+HjfgnUR5NAy/1Ut94UiKmgf/bsbj5I2PjpEuz4Zz31yrDE5xPBm5QB/6dikOWL+ STk5cLhs7XEVdYHbQRN5yzb7g/D0zTmRNnDZO+Vm+Wauf/sfS1R+7Yhb/Xqzo5kXWW3F GI+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+2YUEvTwGajoJV5Buh68mVFXQ+omzkRAUFr6BUwrGv4=; b=QMPmnG+qMhTIKpB2vGQWZvPWwoeGYc03/Kfai4pim5ZgcoczgMrSy8yjW+An47u500 0YnXaDD71dHp+FQxU00LFXVNVoYbotZShPgfIhEnyk3umbv5klBm/MBA8KCT1tbVhq5s FFU+B8YikNNon1ZpahTf9TWl09ej2N43E1KDMpHjXr1H0+l1Qh06S+jvX9F/dsCnhdDY dwmmLbwsSnj61C8Z257K+Q2TDO505k1NxFiPrj9uivIrPsWa3JgA+BcOo96I60LXU/zg JanoQiXGhtTlxMyCT4QFlEbmm0yAxq7ZGOil/pZ1t+2HfCKUqNa/YoaUsGS+28vaoNKm gKPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si6396036otr.245.2019.12.24.03.40.55; Tue, 24 Dec 2019 03:41:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726237AbfLXLkM (ORCPT + 99 others); Tue, 24 Dec 2019 06:40:12 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:37550 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbfLXLkM (ORCPT ); Tue, 24 Dec 2019 06:40:12 -0500 Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:DHE-RSA-AES128-GCM-SHA256:128) (Exim 4.80) (envelope-from ) id 1iji6C-000169-Na; Tue, 24 Dec 2019 12:11:37 +0100 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 , Robert Richter Subject: [PATCH v3 27/32] KVM: arm64: GICv4.1: Let doorbells be auto-enabled Date: Tue, 24 Dec 2019 11:10:50 +0000 Message-Id: <20191224111055.11836-28-maz@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191224111055.11836-1-maz@kernel.org> References: <20191224111055.11836-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, eric.auger@redhat.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, tglx@linutronix.de, jason@lakedaemon.net, lorenzo.pieralisi@arm.com, Andrew.Murray@arm.com, yuzenghui@huawei.com, rrichter@marvell.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false 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 1eb0f8c76219..c2fcde104ea2 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