Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4882155ybf; Wed, 4 Mar 2020 12:37:03 -0800 (PST) X-Google-Smtp-Source: ADFU+vvYN6SrjiZCoc6woZFDCzmopujKDtHwn8f/0datbkpLPp0kYeDiGDn0wLCXd/WLl2eoBVOU X-Received: by 2002:aca:5ad5:: with SMTP id o204mr2960128oib.2.1583354223349; Wed, 04 Mar 2020 12:37:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583354223; cv=none; d=google.com; s=arc-20160816; b=LqZN+ETK+I4KeNS/tKVV1t+xowLsR9OuOU/v6UUDsn74ssYjyxr/wq5t5jEsJQ7CG/ 1wHRJLdE2PFNdim6SM55JggsxVlV1QLMNDJSFJ28hjYChTX8yhQnSB2Isye9sOLa1LIO j5bk386eFMeH26hE0Tdq1ZYYkjnUtRUWd+XZFiRKyXIB7/AVGZjYJrSvmQRily1ZCZDI X0WMFTQ+c6nDdkmI6DEDy4u148w8M+IR9BjKYxlzR41j+fXv9oKM8Ct2xZV132yr6nYR +p3EmxehREYalaTDmzXYI6aOgCU1fbMcNIxg9S9XxhYzgCpbwwSfGHQDIKY6oVSGIMWB KHUw== 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 :dkim-signature; bh=+2YUEvTwGajoJV5Buh68mVFXQ+omzkRAUFr6BUwrGv4=; b=IuyL8B6CUTr5/BEByl5OUB8BS661we0GpDvQKFelAXAgUraaaC8q+zCU85MuPLla9G d/JfK7NZ6ycENpUPc6UGf57SkfBj7M+/X0/LwG12/TEjcX+NOJgob6LAdlIgJscFJAxe BZRf8Nsj5/Mpl0QxuGTMdek3sRRehAgq0oGRWmqNHDh3GFtTyKBWo1Tj3unPRA15rDuu MUwE3QeXMmHSnhGNQbZIJugqxXenQQXkz1D3l5wcLoXdl54zxc8x8wy5ikd6MEhX8AMq ZE8CmZkiyH1LyLEuzKHFF3fTIoiDIjsJ8PrqmATGblP5Fk0vTF+AEF+hDDuWHLUXy/Vm wHIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qHH0IQBP; 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=pass (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 i18si1980360otp.117.2020.03.04.12.36.51; Wed, 04 Mar 2020 12:37:03 -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; dkim=pass header.i=@kernel.org header.s=default header.b=qHH0IQBP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388421AbgCDUgc (ORCPT + 99 others); Wed, 4 Mar 2020 15:36:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:36378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388388AbgCDUgb (ORCPT ); Wed, 4 Mar 2020 15:36:31 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5B17021556; Wed, 4 Mar 2020 20:36:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583354191; bh=JnkgxepdjxdrRmFpIc3nf6/D+CDNPr99CWMmiM/NM2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHH0IQBP0hVolOeTPmygrs6BbiPkawX8dLsTJzRLj0xYSAFy5CGcI3bVMTwIpv0G/ zZTj1U+FszlxewNlndoz1y066JYeFa43hdP9TWLGq690P8DZ7GgLBhgwb7zHareg9p InFKI3fxiGckjbQmcebII+SFr+82z1G7YY+7mEsQ= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j9ajD-00A59R-Nh; Wed, 04 Mar 2020 20:34:51 +0000 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lorenzo Pieralisi , Jason Cooper , Robert Richter , Thomas Gleixner , Zenghui Yu , Eric Auger , James Morse , Julien Thierry , Suzuki K Poulose Subject: [PATCH v5 17/23] KVM: arm64: GICv4.1: Let doorbells be auto-enabled Date: Wed, 4 Mar 2020 20:33:24 +0000 Message-Id: <20200304203330.4967-18-maz@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200304203330.4967-1-maz@kernel.org> References: <20200304203330.4967-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: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, lorenzo.pieralisi@arm.com, jason@lakedaemon.net, rrichter@marvell.com, tglx@linutronix.de, yuzenghui@huawei.com, eric.auger@redhat.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.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