Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7470264ybl; Tue, 24 Dec 2019 03:13:16 -0800 (PST) X-Google-Smtp-Source: APXvYqylEaSpexNdwRYzVxfXi5ey/2gT8vKWtauABNKcj1+bd/2aAbDx9GwTsWDBnc7mhil2ZKlv X-Received: by 2002:a05:6830:1f13:: with SMTP id u19mr12026335otg.237.1577185996830; Tue, 24 Dec 2019 03:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577185996; cv=none; d=google.com; s=arc-20160816; b=zbjAwlbQYoJk1itLT7djW3vQiLAAArGitUncbUwkZksse08/HspxNuvsssDYcmKGIq UD4QXfzs47ahNEKlhU2Qhpl8rZgYHXuNgvuuBxeK34JNBKQSLTl8udy9jpHUHAFG3ZWm ZEuhsxxsTSn6LkZOPBwY121xbHF/AMTNFEic9LYWMNanckKLsLYD7QgkvAdRKq+Tk4/w coKGLraz7SRFhuusTwplr4PGTix500uyuXcQ/R+0HVwOo2UVUwXctroL+5yZzz2eTxfV pBMO17SVKO+RhuKTRDgcny/1zyOGV9JDPr6bEWHixAISEUDp4ftGOFn/Jh2za3xTR/Kh +81g== 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=IvkTRULHNk4agQPo8DkryQMy1FCpxLDH3U9PMAT4/hE=; b=HJ+x//jKz774+LJbje81Fzv8E5ZJlxfYiyuB6iPgBCRaNiCk7H3DzIEnIl4lps4w6a ZSgBwxMRjph1+GD3b8a5Vnv22EdV+YSlg9Ei1KPnUQWQfLX30XrQvR5gBkuH1H23EOi1 gLHmHqxGCC1eXH7tssmfsCTJyNA/WFDSIwBLTW+q7BogTvZhFB2x0Fi5Y6Azc4XWVsDI Tx9I0zoXeBDkh1CEdkP4ujQRi+wgCQG5AP3oTA0fwtAnXidi7SlR8OniFH4O5k7V7hhF cHVlWSZYYEJBRliWPSx34W0mcACCWudIaWiGf8xfv+cot9FUkqYD9O4JJD/ZFsZQvih1 0TEA== 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 h11si11773980otr.197.2019.12.24.03.13.05; Tue, 24 Dec 2019 03:13:16 -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 S1726885AbfLXLLR (ORCPT + 99 others); Tue, 24 Dec 2019 06:11:17 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:39650 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726298AbfLXLLO (ORCPT ); Tue, 24 Dec 2019 06:11:14 -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 1iji5o-000169-J4; Tue, 24 Dec 2019 12:11:12 +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 04/32] irqchip/gic-v3: Use SGIs without active state if offered Date: Tue, 24 Dec 2019 11:10:27 +0000 Message-Id: <20191224111055.11836-5-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 If running under control of a hypervisor that implements GICv4.1 SGIs, allow the hypervisor to use them at the expense of loosing the Active state (which we don't care about for SGIs). This is trivially done by checking for GICD_TYPER2.nASSGIcap, and setting GICD_CTLR.nASSGIreq when enabling Group-1 interrupts. Signed-off-by: Marc Zyngier --- drivers/irqchip/irq-gic-v3.c | 10 ++++++++-- include/linux/irqchip/arm-gic-v3.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 640d4db65b78..624f351c0362 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -724,6 +724,7 @@ static void __init gic_dist_init(void) unsigned int i; u64 affinity; void __iomem *base = gic_data.dist_base; + u32 val; /* Disable the distributor */ writel_relaxed(0, base + GICD_CTLR); @@ -756,9 +757,14 @@ static void __init gic_dist_init(void) /* Now do the common stuff, and wait for the distributor to drain */ gic_dist_config(base, GIC_LINE_NR, gic_dist_wait_for_rwp); + val = GICD_CTLR_ARE_NS | GICD_CTLR_ENABLE_G1A | GICD_CTLR_ENABLE_G1; + if (gic_data.rdists.gicd_typer2 & GICD_TYPER2_nASSGIcap) { + pr_info("Enabling SGIs without active state\n"); + val |= GICD_CTLR_nASSGIreq; + } + /* Enable distributor with ARE, Group1 */ - writel_relaxed(GICD_CTLR_ARE_NS | GICD_CTLR_ENABLE_G1A | GICD_CTLR_ENABLE_G1, - base + GICD_CTLR); + writel_relaxed(val, base + GICD_CTLR); /* * Set all global interrupts to the boot CPU only. ARE must be diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index 9dfe64189d99..72b69f4e6c7b 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h @@ -57,6 +57,7 @@ #define GICD_SPENDSGIR 0x0F20 #define GICD_CTLR_RWP (1U << 31) +#define GICD_CTLR_nASSGIreq (1U << 8) #define GICD_CTLR_DS (1U << 6) #define GICD_CTLR_ARE_NS (1U << 4) #define GICD_CTLR_ENABLE_G1A (1U << 1) @@ -90,6 +91,7 @@ #define GICD_TYPER_ESPIS(typer) \ (((typer) & GICD_TYPER_ESPI) ? GICD_TYPER_SPIS((typer) >> 27) : 0) +#define GICD_TYPER2_nASSGIcap (1U << 8) #define GICD_TYPER2_VIL (1U << 7) #define GICD_TYPER2_VID GENMASK(4, 0) -- 2.20.1