From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796061867; b=Iw4Ha+uYzb0grcqueNINd0y9BJ8qcsLbR2nAB32LQBHZ1zfkj2GCFmqqa838rQKaaXvi ZOL9cjnbwMH44js41jPryUP40iAYGJ6G0EYpjTgNvnR2qlPb67sqUPdEpea5Lm3miS7oI le184qVB7k+/kWsA2wadkbs6yCDMZJCuUUPImjdJfYQrzUNgatZYSL/QPBYpJLpv2Qc2O 0i8L9AY6laHwPyVim/HDJ3kntCdk3OxybBjWs+T4HoPMzvGAf0MjLyRNH6vU9imV/JhU3 kDW6XVskbKay1gsbO8rnbwKz1CMVE7k1t9mduwrs3SzZGm/nj4dfwW9Vs7Xi76am7YA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796061867; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:Content-Language:To:Cc:References:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=uIHGlyfpeX2tcPibtJUC9qq7G416tRDbf3FNTh/VZ9Q=; b=cn6dBVkGTm5zwmzVWKTWfKd097Ghty1a4boGgte8AEMZDl64saPwE0PzYsVpg9JD5E0z a9u32rxuSdcRcbeYyvag+YEWsx9jJkHdewJ36/i0p1LE6MqL5GMFeqToSR5Hyst6suvu1 8rMjx+5/cIvJwUHgqet79EzcIcRlV/rg83cPdB/6pJjGv4KgaK7yU8Nd3cebs2TIZdgXz JurCJ1lq0+6wjhZZbOtnQX5UUbD9T8cO59R6Be3ZiwdASehfa83jT2v2XkFr8AXhf8BH+ lsabepMNZJcydeHGIkJbc26N7qVXU6W33sUdBfnWKvt/qhIU3Gss1L/4D6r0FNHHkkg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iTYMu71H; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0374606A331; Mon, 30 Nov 2026 18:04:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iTYMu71H Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC1981F00897; Mon, 30 Nov 2026 18:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796061866; bh=uIHGlyfpeX2tcPibtJUC9qq7G416tRDbf3FNTh/VZ9Q=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=iTYMu71HT68Erjnnm+gOapn9IDlvyoKfhaJgjpkCM83dh30ikTkiEzKEZuuYe6yXa dHQ0gu7+zP53HnICFdapBp1z8P92+XA51GD5UZsFTeeIYBViu01SO2kEYQYXhyDcCh mNVv7KjiJmAJLlRAcRtHhKWcIq/Ej3TldFWs3Q95xVxTbKnRFR4d7noXG1fiMOuFrT dr23E9e33ExWA5VCmJzynwyFyBoQoDNhwtSEiPS+g5DwKHZQg18WsgIkibsrjptuLk Lp8IvvJaim8u4UXHMg5zSaTGD+kTadA58aQSeNFoxtvp2C+fjGBDTL55yq8aHHhZqv eEaTOTDGvRCkg== Message-ID: Date: Mon, 30 Nov 2026 12:04:24 -0600 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv4 3/4] EDAC/altera: Add support for Agilex5 ECC manager Content-Language: en-US To: Yazen Ghannam Cc: bp@alien8.de, tony.luck@intel.com, rounakdas2025@gmail.com, niravkumar.l.rabara@altera.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20261116202854.3087673-1-dinguyen@kernel.org> <20261116202854.3087673-3-dinguyen@kernel.org> <20261125205503.GQ2156781@yaz-khff2.amd.com> From: Dinh Nguyen In-Reply-To: <20261125205503.GQ2156781@yaz-khff2.amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Yazen, On 11/25/26 14:55, Yazen Ghannam wrote: > On Mon, Nov 16, 2026 at 02:28:53PM -0600, Dinh Nguyen wrote: >> Add support for the Agilex5 ECC manager, unlike Stratix10/Agilex7, >> Agilex5 exposes 7 named interrupts on its DT node: >> >> global_sbe - aggregate single-bit error (chained, drives IRQ domain) >> global_dbe - aggregate double-bit error (chained; DBE is no longer >> delivered exclusively through Asynchronous SError) >> io96b0 - IO96B0 DRAM controller ECC >> io96b1 - IO96B1 DRAM controller ECC >> sdm_qspi_sbe - SDM QSPI single-bit error >> sdm_qspi_dbe - SDM QSPI double-bit error >> sdm_seu - SDM single-event-upset >> >> Place all seven interrupt's name in a new agilex5_irqs[] array on struct >> altr_arria10_edac so subsequent peripheral support (IO96B, SDM QSPI, CRAM >> SEU) can consume them without re-parsing the DT. >> >> global_sbe is wired up as the chained SBE handler (replacing the legacy >> index-0 lookup). global_dbe is hooked into the same >> altr_edac_a10_irq_handler() so that the existing sb_irq/db_irq demux >> routes DBE events through the manager's IRQ domain. >> >> Legacy A10/S10 probe paths are unchanged. >> >> Signed-off-by: Dinh Nguyen >> --- >> v4: The 7 named irqs for Agilex5 are all required properties >> v3: Use irq_domain_remove() in error path of altr_edac_a10_probe() when >> irq names cannot be found. >> Return -EINVAL for when sbe irq is not found in >> altr_agilex5_get_named_irqs() >> v2: Reorganize db_error so Agilex5 goes last to prevent going into >> default condition for A10 >> Clean up the commit message to be less wordy >> --- >> drivers/edac/altera_edac.c | 71 +++++++++++++++++++++++++++++++++++--- >> drivers/edac/altera_edac.h | 28 +++++++++++++++ >> 2 files changed, 95 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c >> index 78f4a1b0fc64a..c56413cb5c95c 100644 >> --- a/drivers/edac/altera_edac.c >> +++ b/drivers/edac/altera_edac.c >> @@ -2107,11 +2107,49 @@ static int s10_edac_dberr_handler(struct notifier_block *this, >> return NOTIFY_DONE; >> } >> >> +/* >> + * Ordered table of named interrupts published by an >> + * "altr,socfpga-agilex5-ecc-manager" device tree node. Indices match >> + * enum altr_agilex5_irq_idx. Every name is required. >> + */ >> +static const char * const altr_agilex5_irq_names[ALTR_AGILEX5_NUM_IRQS] = { >> + [ALTR_AGILEX5_IRQ_GLOBAL_SBE] = "global_sbe", >> + [ALTR_AGILEX5_IRQ_GLOBAL_DBE] = "global_dbe", >> + [ALTR_AGILEX5_IRQ_IO96B0] = "io96b0", >> + [ALTR_AGILEX5_IRQ_IO96B1] = "io96b1", >> + [ALTR_AGILEX5_IRQ_SDM_QSPI_SBE] = "sdm_qspi_sbe", >> + [ALTR_AGILEX5_IRQ_SDM_QSPI_DBE] = "sdm_qspi_dbe", >> + [ALTR_AGILEX5_IRQ_SDM_SEU] = "sdm_seu", >> +}; >> + >> +/* >> + * Populate edac->agilex5_irqs[] from the named interrupts on the manager >> + * platform device. Every name is required. platform_get_irq_byname() >> + * reports a missing interrupt and returns -EPROBE_DEFER when the parent >> + * irqchip is not yet probed so probe can be retried. >> + */ >> +static int altr_agilex5_get_named_irqs(struct platform_device *pdev, >> + struct altr_arria10_edac *edac) >> +{ >> + int i, irq; >> + >> + for (i = 0; i < ALTR_AGILEX5_NUM_IRQS; i++) { >> + irq = platform_get_irq_byname(pdev, altr_agilex5_irq_names[i]); >> + if (irq < 0) >> + return irq; >> + >> + edac->agilex5_irqs[i] = irq; >> + } >> + >> + return 0; >> +} >> + >> /****************** Arria 10 EDAC Probe Function *********************/ >> static int altr_edac_a10_probe(struct platform_device *pdev) >> { >> struct altr_arria10_edac *edac; >> struct device_node *child; >> + int rc; >> >> edac = devm_kzalloc(&pdev->dev, sizeof(*edac), GFP_KERNEL); >> if (!edac) > > This hunk has a conflict with ras/edac-for-next due to this commit: > 4dd10fbbeb9c "treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family" Have updated in v5. > >> @@ -2147,14 +2185,32 @@ static int altr_edac_a10_probe(struct platform_device *pdev) >> return -ENOMEM; >> } >> >> - edac->sb_irq = platform_get_irq(pdev, 0); >> - if (edac->sb_irq < 0) >> - return edac->sb_irq; >> + if (edac->flag == SOCFPGA_AGILEX5) { >> + rc = altr_agilex5_get_named_irqs(pdev, edac); >> + if (rc) { >> + irq_domain_remove(edac->domain); > > Why remove domain here but not in the failure below? > > Seems like you would want to do the same in both places or have a common > failure path. > Will update in v5. >> + return rc; >> + } >> + >> + edac->sb_irq = edac->agilex5_irqs[ALTR_AGILEX5_IRQ_GLOBAL_SBE]; >> + } else { >> + edac->sb_irq = platform_get_irq(pdev, 0); >> + if (edac->sb_irq < 0) >> + return edac->sb_irq; >> + } >> >> irq_set_chained_handler_and_data(edac->sb_irq, >> altr_edac_a10_irq_handler, >> edac); >> >> + /* >> + * Unlike Stratix10/Agilex7 (which deliver uncorrectable errors as >> + * Asynchronous SError), Agilex5 routes the global double-bit error >> + * through a dedicated SPI ("global_dbe"). Hook it into the same >> + * chained handler so the existing sb_irq/db_irq demux in >> + * altr_edac_a10_irq_handler() routes DBE events through the manager's >> + * IRQ domain. >> + */ > > Is this comment in the correct place? > Will place it in the line where Agilex5 is added. >> if (edac->flag == SOCFPGA_S10) { >> int dberror, err_addr; >> >> @@ -2177,13 +2233,18 @@ static int altr_edac_a10_probe(struct platform_device *pdev) >> regmap_write(edac->ecc_mgr_map, >> S10_SYSMGR_UE_ADDR_OFST, 0); >> } >> - } else { >> + } else if (edac->flag == SOCFPGA_A10) { >> edac->db_irq = platform_get_irq(pdev, 1); >> if (edac->db_irq < 0) >> return edac->db_irq; >> >> irq_set_chained_handler_and_data(edac->db_irq, >> altr_edac_a10_irq_handler, edac); >> + } else if (edac->flag == SOCFPGA_AGILEX5) { >> + edac->db_irq = edac->agilex5_irqs[ALTR_AGILEX5_IRQ_GLOBAL_DBE]; >> + irq_set_chained_handler_and_data(edac->db_irq, >> + altr_edac_a10_irq_handler, >> + edac); >> } >> >> for_each_child_of_node(pdev->dev.of_node, child) { >> @@ -2209,6 +2270,8 @@ static const struct of_device_id altr_edac_a10_of_match[] = { >> .data = (void *)SOCFPGA_A10 }, >> { .compatible = "altr,socfpga-s10-ecc-manager", >> .data = (void *)SOCFPGA_S10 }, >> + { .compatible = "altr,socfpga-agilex5-ecc-manager", >> + .data = (void *)SOCFPGA_AGILEX5 }, >> {}, >> }; >> MODULE_DEVICE_TABLE(of, altr_edac_a10_of_match); >> diff --git a/drivers/edac/altera_edac.h b/drivers/edac/altera_edac.h >> index 4a9da28fa96ba..b769cce6063cd 100644 >> --- a/drivers/edac/altera_edac.h >> +++ b/drivers/edac/altera_edac.h >> @@ -326,6 +326,27 @@ struct altr_sdram_mc_data { >> #define S10_DDR0_IRQ_MASK BIT(16) >> #define S10_DBE_IRQ_MASK 0x3FFFE >> >> +/************* Agilex5 Defines **************/ >> +/* >> + * The Agilex5 ECC manager exposes 7 named interrupts on the manager >> + * node. global_sbe and global_dbe are aggregate single/double-bit error >> + * interrupts that fan-out through the manager's IRQ domain to the child >> + * peripheral ECCs. The remaining named interrupts are routed directly from >> + * dedicated controllers (IO96B memory controllers and Secure Device Manager) >> + * to the GIC. >> + */ >> +#define ALTR_AGILEX5_NUM_IRQS 7 >> + >> +enum altr_agilex5_irq_idx { >> + ALTR_AGILEX5_IRQ_GLOBAL_SBE, >> + ALTR_AGILEX5_IRQ_GLOBAL_DBE, >> + ALTR_AGILEX5_IRQ_IO96B0, >> + ALTR_AGILEX5_IRQ_IO96B1, >> + ALTR_AGILEX5_IRQ_SDM_QSPI_SBE, >> + ALTR_AGILEX5_IRQ_SDM_QSPI_DBE, >> + ALTR_AGILEX5_IRQ_SDM_SEU, >> +}; > > You could add "ALTR_AGILEX5_NUM_IRQS" as the last enum entry. This would > automatically match it to the number of valid entries. > Will do. >> + >> /* Define ECC Block Offsets for peripherals */ >> #define ECC_BLK_ADDRESS_OFST 0x40 >> #define ECC_BLK_RDATA0_OFST 0x44 >> @@ -401,6 +422,13 @@ struct altr_arria10_edac { >> struct list_head a10_ecc_devices; >> struct notifier_block panic_notifier; >> unsigned long flag; >> + >> + /* >> + * Agilex5 ECC manager supports up to 7 named interrupts. Entries >> + * are indexed by the altr_agilex5_irq_idx enum and hold the virtual >> + * IRQ number. >> + */ > > This comment seems redundant. Will remove. Thanks for the review. Dinh