Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3300DC433EF for ; Sun, 31 Oct 2021 16:58:45 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22A8660E98 for ; Sun, 31 Oct 2021 16:58:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 22A8660E98 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 454C4835DB; Sun, 31 Oct 2021 17:58:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=walle.cc header.i=@walle.cc header.b="r1g/YLTS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9305B835F9; Sun, 31 Oct 2021 17:58:38 +0100 (CET) Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5D442835D4 for ; Sun, 31 Oct 2021 17:58:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@walle.cc Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 4418C22236; Sun, 31 Oct 2021 17:58:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1635699505; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/t/A3vwBpAYNJmjYMk6350R2AkGzjjqKAqildFxlPJw=; b=r1g/YLTS2EQFqnHspQ4ApqTemrCSTBeWWCM89P1VWeDY2AvvqPPICDdMQPly1QTRrUdtsq wajAfiMFeYgN9cMV9aeNDY7nk5UvQEO787G69H91xL4ntHKL91g7vtWef0xoNcyxyKlOvN QN6fT022gzKkwJELjBGQEGiTRIWifCs= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Sun, 31 Oct 2021 17:58:24 +0100 From: Michael Walle To: "Z.Q. Hou" Cc: Marc Zyngier , u-boot@lists.denx.de, Vladimir Oltean , Bharat Gooty , Rayagonda Kokatanur , Simon Glass , Priyanka Jain , Tom Rini Subject: Re: [PATCH 2/2] Revert "arch: arm: use dt and UCLASS_SYSCON to get gic lpi details" In-Reply-To: References: <20211027165454.1501398-1-michael@walle.cc> <20211027165454.1501398-3-michael@walle.cc> <87k0hwua9m.wl-maz@kernel.org> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <8377f174f39e229b3e1fa114e3efb0a7@walle.cc> X-Sender: michael@walle.cc X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi, Am 2021-10-31 17:45, schrieb Z.Q. Hou: >> -----Original Message----- >> From: Marc Zyngier [mailto:maz@kernel.org] >> Sent: 2021年10月29日 5:09 >> To: Michael Walle >> Cc: u-boot@lists.denx.de; Vladimir Oltean ; >> Z.Q. Hou >> ; Bharat Gooty ; >> Rayagonda Kokatanur ; Simon Glass >> ; Priyanka Jain ; Tom Rini >> >> Subject: Re: [PATCH 2/2] Revert "arch: arm: use dt and UCLASS_SYSCON >> to get gic >> lpi details" >> >> On Wed, 27 Oct 2021 17:54:54 +0100, >> Michael Walle wrote: >> > >> > Stop using the device tree as a source for ad-hoc information. >> > >> > This reverts commit 2ae7adc659f7fca9ea65df4318e5bca2b8274310. >> > >> > Signed-off-by: Michael Walle >> > --- >> > arch/arm/Kconfig | 2 - >> > arch/arm/cpu/armv8/fsl-layerscape/soc.c | 27 +++++++++- >> > arch/arm/include/asm/gic-v3.h | 4 +- >> > arch/arm/lib/gic-v3-its.c | 66 +++---------------------- >> > 4 files changed, 36 insertions(+), 63 deletions(-) >> > >> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index >> > 02f8306f15..86c1ebde05 100644 >> > --- a/arch/arm/Kconfig >> > +++ b/arch/arm/Kconfig >> > @@ -82,8 +82,6 @@ config GICV3 >> > >> > config GIC_V3_ITS >> > bool "ARM GICV3 ITS" >> > - select REGMAP >> > - select SYSCON >> > select IRQ >> > help >> > ARM GICV3 Interrupt translation service (ITS). >> > diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c >> > b/arch/arm/cpu/armv8/fsl-layerscape/soc.c >> > index c0e100d21c..a08ed3f544 100644 >> > --- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c >> > +++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c >> >> Why is this FSL specific? >> >> > @@ -41,11 +41,36 @@ DECLARE_GLOBAL_DATA_PTR; #endif >> > >> > #ifdef CONFIG_GIC_V3_ITS >> > +#define PENDTABLE_MAX_SZ ALIGN(BIT(ITS_MAX_LPI_NRBITS), SZ_64K) >> > +#define PROPTABLE_MAX_SZ ALIGN(BIT(ITS_MAX_LPI_NRBITS) / 8, >> SZ_64K) >> >> This looks completely wrong. >> >> The pending table needs one bit per LPI, and the property table one >> byte per LPI. >> Here, you have it the other way around. > > It's a typo, will fix after the revert patch applied. Please keep me on CC. .. >> Finally, ITS_MAX_LPI_NRBITS is hardcoded to 16, while it can actually >> vary from 14 >> to 32 (and even further limited by some hypervisors), depending on the >> implementation. Granted, this was broken before this patch, and in >> most cases, >> 64k is more than enough. >> > > This is only for Layerscape platforms, so hardcoded to 16 bit works. But why is this layerscape only? Can't we make it so it works on any platform. If I understand Marc correctly, it should be possible. .. >> > + ret = gic_lpi_tables_init(gic_lpi_base, cpu_numcores()); >> >> This really should fetch the number of CPUs from the DT rather then >> some SoC >> specific black magic... > > Currently in most Layerscape platforms' DTS file there isn't cpu > nodes. On Layerscape platforms the implemented core number can be get > from GUT register. So this would be the perfect time to actually sync the device trees with linux. -michael