From patchwork Tue Jul 23 11:55:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 11054395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4480B1399 for ; Tue, 23 Jul 2019 11:56:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32A3A1FFBD for ; Tue, 23 Jul 2019 11:56:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26B8B20134; Tue, 23 Jul 2019 11:56:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CB6EA1FFBD for ; Tue, 23 Jul 2019 11:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=UjMsTupRoz0zXFiW4tGpp8Es3q5yEZ4/ulkedXG+Qa0=; b=BK1 2xGoKm8ihrHjXOITi+D3gMlCGs1z4sq3XGwOvK5ylVDMjtWCf2jgoM9lLEMzQacH0pJPqK5D3uDv4 tHka1JkwOvQWSSeT0ArXAMSOBjKBoDTADt9TyjeipK9rDg0X1+ZG/vc0HyvqDLDdKyiDASapZ1I2V 4CDaDIXVzBkCj5jwHSv7o1N7Cg4t3QnZQ+0ExeXuy7pnSBfjCqnNDaTjk6p/Gr5CHUxG/GwFI3sMd +S8CGMymGcLCruBLapilLlEhXzniPd7CLRZt+uOlteqiz5VyTbm3llhBnOfoqgXFEi5Jsj8ilbygk 91N8ElBPbHiW0m0ONGi5B1VMYJtSxeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hptOm-00083W-D1; Tue, 23 Jul 2019 11:56:04 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hptOh-00082p-VM for linux-arm-kernel@lists.infradead.org; Tue, 23 Jul 2019 11:56:01 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 18ACF337; Tue, 23 Jul 2019 04:55:59 -0700 (PDT) Received: from approximate.arm.com. (approximate.cambridge.arm.com [10.1.196.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9C69D3F71A; Tue, 23 Jul 2019 04:55:58 -0700 (PDT) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org Subject: [BOOTWRAPPER][PATCH] Make GICv3.1 extended ranges available to non-secure Date: Tue, 23 Jul 2019 12:55:45 +0100 Message-Id: <20190723115545.1506-1-marc.zyngier@arm.com> X-Mailer: git-send-email 2.18.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190723_045600_050269_5EB07A4B X-CRM114-Status: GOOD ( 11.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If we have a GICv3.1-capable system, configure the EPPI/ESPI ranges to be accessible from the non-secure world. Signed-off-by: Marc Zyngier --- gic-v3.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gic-v3.c b/gic-v3.c index 476f703..4b733ba 100644 --- a/gic-v3.c +++ b/gic-v3.c @@ -17,6 +17,8 @@ #define GICD_TYPER 0x4 #define GICD_IGROUP0 0x80 #define GICD_IGRPMOD0 0xd00 +#define GICD_IGROUPR0E 0x1000 +#define GICD_IGRPMODR0E 0x3400 #define GICD_CTLR_EnableGrp0 (1 << 0) #define GICD_CTLR_EnableGrp1ns (1 << 1) @@ -57,6 +59,7 @@ void gic_secure_init_primary(void) * ChildrenAsleep to be 0. */ uint32_t waker = raw_readl(gicr_ptr + GICR_WAKER); + uint32_t regs; waker &= ~GICR_WAKER_ProcessorSleep; raw_writel(waker, gicr_ptr + GICR_WAKER); dsb(st); @@ -72,8 +75,11 @@ void gic_secure_init_primary(void) typer = raw_readl(gicr_ptr + GICR_TYPER); gicr_ptr += 0x10000; /* Go to SGI_Base */ - raw_writel(~0x0, gicr_ptr + GICR_IGROUP0); - raw_writel(0x0, gicr_ptr + GICR_IGRPMOD0); + regs = 1 + ((typer >> 27) & 0x1f); + for (i = 0; i < regs; i++) { + raw_writel(~0x0, gicr_ptr + GICR_IGROUP0 + i * 4); + raw_writel(0x0, gicr_ptr + GICR_IGRPMOD0 + i * 4); + } /* Next redist */ gicr_ptr += 0x10000; @@ -87,6 +93,10 @@ void gic_secure_init_primary(void) raw_writel(~0x0, gicd_base + GICD_IGROUP0 + i * 4); raw_writel(0x0, gicd_base + GICD_IGRPMOD0 + i * 4); } + for (i = 0; i < ((typer >> 27) & GICD_TYPER_ITLineNumber); i++) { + raw_writel(~0x0, gicd_base + GICD_IGROUPR0E + i * 4); + raw_writel(0x0, gicd_base + GICD_IGRPMODR0E + i * 4); + } } void gic_secure_init(void)