Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1832306ybb; Sun, 29 Mar 2020 14:42:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsuyLeC24AGfkOc/25rtJy73W78/oLZI3N8vwHmbvqQKlTT4C/KLBqGgtKjRjnIThyviRgY X-Received: by 2002:a4a:e144:: with SMTP id p4mr2376851oot.55.1585518168956; Sun, 29 Mar 2020 14:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585518168; cv=none; d=google.com; s=arc-20160816; b=IFaAaogNJtG2yN9M1YXF1xK6I8YmMcL/mYb+j6qJuvD8fHCdcIvTsJmpn/v8mQ0mjz VGBdp7ag/Ss9moQ0F0Kvg1NApwwi4w39ibMFXV3X2z2Z2zmAzq+yK4vGkf4A9s+n5U38 row6t9+0+3QHdK6O8ZwWuqQL9MohAJJHPz46neVb50Rvg1e4V+SibssPd/f8Rkl3svwV imeqn+tKCb+zPVqyyGOdn56d2SIyPpFqDzmW2a5bhdmC3h1Dq5iyLllPdWE9va61Z2EY Z4gHqI9d8MVJmpayPTd/zjl+cHt+tMrND2KM/Qc92tZ/LIyHYXF1k+HuOrmMY/1Iqcus ECGQ== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=3qN8yogF677oE9AYmxIYVvRylJX4hHM8cFaMPbcxuaI=; b=FKvEY0R89Jz6B4ABNMGM2hMBX9stXnihn5jicPjil/BwHe3r0B9cC5kcavBQibtMEx 4z8l+FeDI+i6fo1Ot9/pE+YAPe7F+r6BIthAs5wZPPLYkqaWycO8Wb3AUxi3Nygd6ztR jWypS1dpfdsAZ63Qgai2XZACPnOTSko0MlGhs2D2hQ+mhK9zA6zbizWYgLZfnQqP6EFc P9BCJ/nFFk5huFGUU/L73Qpy8SmenDEt99FhsNX3kfmX25J+TIOutVUROONm9qN061cc g31oDcqtvxCj+5oNIg5Gp/CodYs+zpLTS4vzp/1UQQPF8LJpVOgGP+eTQMyNEs7aa/Zp cJ6g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r70si5600588oor.49.2020.03.29.14.42.36; Sun, 29 Mar 2020 14:42:48 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729059AbgC2U1R (ORCPT + 99 others); Sun, 29 Mar 2020 16:27:17 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:57028 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728881AbgC2U03 (ORCPT ); Sun, 29 Mar 2020 16:26:29 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jIeVh-0001Rf-NT; Sun, 29 Mar 2020 22:26:21 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 9E73D1C0470; Sun, 29 Mar 2020 22:26:17 +0200 (CEST) Date: Sun, 29 Mar 2020 20:26:17 -0000 From: "tip-bot2 for Marc Zyngier" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] irqchip/gic-v3: Use SGIs without active state if offered Cc: Marc Zyngier , Zenghui Yu , x86 , LKML In-Reply-To: <20200304203330.4967-2-maz@kernel.org> References: <20200304203330.4967-2-maz@kernel.org> MIME-Version: 1.0 Message-ID: <158551357719.28353.15287980899679490964.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/core branch of tip: Commit-ID: 0b04758b002bde9434053be2fff8064ac3d9d8bb Gitweb: https://git.kernel.org/tip/0b04758b002bde9434053be2fff8064ac3d9d8bb Author: Marc Zyngier AuthorDate: Wed, 04 Mar 2020 20:33:08 Committer: Marc Zyngier CommitterDate: Thu, 19 Mar 2020 11:11:21 irqchip/gic-v3: Use SGIs without active state if offered To allow the direct injection of SGIs into a guest, the GICv4.1 architecture has to sacrifice the Active state so that SGIs look a lot like LPIs (they are injected by the same mechanism). In order not to break existing software, the architecture gives offers guests OSs the choice: SGIs with or without an active state. It is the hypervisors duty to honor the guest's choice. For this, the architecture offers a discovery bit indicating whether the GIC supports GICv4.1 SGIs (GICD_TYPER2.nASSGIcap), and another bit indicating whether the guest wants Active-less SGIs or not (controlled by GICD_CTLR.nASSGIreq). A hypervisor not supporting GICv4.1 SGIs would leave nASSGIcap clear, and a guest not knowing about GICv4.1 SGIs (or definitely wanting an Active state) would leave nASSGIreq clear (both being thankfully backward compatible with older revisions of the GIC). Since Linux is perfectly happy without an active state on SGIs, inform the hypervisor that we'll use that if offered. Signed-off-by: Marc Zyngier Reviewed-by: Zenghui Yu Link: https://lore.kernel.org/r/20200304203330.4967-2-maz@kernel.org --- 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 c1f7af9..b6b0f86 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -723,6 +723,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); @@ -755,9 +756,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 83439bf..c29a026 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)