From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 594A6C48BF6 for ; Sat, 24 Feb 2024 10:30:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z9w5XvUh3gXFTf5O7uBMxQGTN1BhHjM2y7eaJxHmbWY=; b=4R9LqZQeYnpChA rHpIfARxtjnKtJ9fgxtriUE/kQmuKMe4qkjUG6ttTPQDeDz2zj6EUqHcwQy+7tslV3AQiUW3EPXvU UlFaiStJSxPXtTIpcWgoPTebRGoTbWt6RKGZ+VWQirrzZFEAm+dGPsPVjaqkAuGzCCf3F2h9am2OT hlLcMJL8Yb0XgFvPvtBqWKWmnNk18NPCPzQvjXu8WEYUUEMtgsTTjXet1O7c83XoBSVT927z8RJDD aoZc4A8WNuVdkz/VzrpU0FmMXjZ6tve/e2a/UXUohv5D66upY5zyzjbUySj/AZ+MEv1BqCbndvuNG heeBazPqJQTQadb/KSgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdpIR-0000000CabQ-3mxJ; Sat, 24 Feb 2024 10:30:19 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdpIO-0000000Caab-2pjb for linux-arm-kernel@lists.infradead.org; Sat, 24 Feb 2024 10:30:18 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id BDF27CE23AD; Sat, 24 Feb 2024 10:30:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0518AC433C7; Sat, 24 Feb 2024 10:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708770610; bh=Q/P2Z+7sh5cDxHvL/Ran0fKCcJPYbJEsm46nDR360jo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UtJM5PGB/yoSdmqduIgAlzNJSsc9xAJsmgvaUVjDN1eagoM9nanvGjcV7lx64ClCE SwSA9FCr7Yih8FNDiKl0TUcIEYV33GPNOz+pA6MYEx5OmEwlFkMRzJKkjCqaQStirO DgbEJEkBI62ujbz3J92MukTO1wTEjJmOk+ZvwPt/aYaN/sHKJkNCFN6arXgfyjqd0a W39sC+qlXNLpW6OVfS3p2gIJzfQU8l/CS2K9xMkPHNedU41OIwxnQyFRhhn/9d2Hy6 pA1/5NTHYPpaan17qft7J2juFIeIbIRRyatdYHsH5lQHpgEaBinbRDtxYglkF5E3t9 o5+9BwBNU0Uzg== Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rdpIF-006LaQ-85; Sat, 24 Feb 2024 10:30:07 +0000 Date: Sat, 24 Feb 2024 10:30:04 +0000 Message-ID: <87cysm9mtv.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: Thomas Gleixner , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, Jing Zhang Subject: Re: [PATCH 2/3] irqchip/gic-v3-its: Spin off GICv4 init into a separate function In-Reply-To: <20240219185809.286724-3-oliver.upton@linux.dev> References: <20240219185809.286724-1-oliver.upton@linux.dev> <20240219185809.286724-3-oliver.upton@linux.dev> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, tglx@linutronix.de, yuzenghui@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, jingzhangos@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240224_023017_101742_2077C727 X-CRM114-Status: GOOD ( 26.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 19 Feb 2024 18:58:07 +0000, Oliver Upton wrote: > > Burying the GICv4 redistributor initialization into the routine for LPIs > is a bit confusing, and can lead to sillies where unexpected codepaths > may not fully initialize the RD. > > Hoist it out of its_cpu_init_lpis() into a dedicated function. > > Signed-off-by: Oliver Upton > --- > drivers/irqchip/irq-gic-v3-its.c | 32 +++++++++++++++++++++----------- > 1 file changed, 21 insertions(+), 11 deletions(-) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > index 0022852ce494..63d1743f08cc 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -3173,8 +3173,25 @@ static void its_cpu_init_lpis(void) > writel_relaxed(val, rbase + GICR_CTLR); > > out: > - if (gic_rdists->has_vlpis && !gic_rdists->has_rvpeid) { > + /* Make sure the GIC has seen the above */ > + dsb(sy); So having hoisted the dsb() here... > + gic_data_rdist()->flags |= RD_LOCAL_LPI_ENABLED; > + pr_info("GICv3: CPU%d: using %s LPI pending table @%pa\n", > + smp_processor_id(), > + gic_data_rdist()->flags & RD_LOCAL_PENDTABLE_PREALLOCATED ? > + "reserved" : "allocated", > + &paddr); > +} > + > +static void its_cpu_init_vlpis(void) > +{ > + /* No vLPIs? No problem. */ > + if (!gic_rdists->has_vlpis) > + return; > + > + if (!gic_rdists->has_rvpeid) { > void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); > + u64 val; > > /* > * It's possible for CPU to receive VLPIs before it is > @@ -3193,7 +3210,8 @@ static void its_cpu_init_lpis(void) > * ancient programming gets left in and has possibility of > * corrupting memory. > */ > - val = its_clear_vpend_valid(vlpi_base, 0, 0); > + its_clear_vpend_valid(vlpi_base, 0, 0); > + return; I'm not sure about the necessity of this return statement. allocate_vpe_l1_table() checks for rvpeid already, so it should be fine to carry on. > } > > if (allocate_vpe_l1_table()) { > @@ -3205,15 +3223,6 @@ static void its_cpu_init_lpis(void) > gic_rdists->has_rvpeid = false; > gic_rdists->has_vlpis = false; > } > - > - /* Make sure the GIC has seen the above */ > - dsb(sy); ... we're now missing a dsb affecting the VPE table programming, as we expect things to take effect immediately. > - gic_data_rdist()->flags |= RD_LOCAL_LPI_ENABLED; > - pr_info("GICv3: CPU%d: using %s LPI pending table @%pa\n", > - smp_processor_id(), > - gic_data_rdist()->flags & RD_LOCAL_PENDTABLE_PREALLOCATED ? > - "reserved" : "allocated", > - &paddr); > } > > static void its_cpu_init_collection(struct its_node *its) > @@ -5265,6 +5274,7 @@ int its_cpu_init(void) > return ret; > > its_cpu_init_lpis(); > + its_cpu_init_vlpis(); > its_cpu_init_collections(); > } > I'm otherwise OK with the idea of splitting things up. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel