From: Yazen Ghannam <yazen.ghannam@amd.com>
To: Dinh Nguyen <dinguyen@kernel.org>
Cc: bp@alien8.de, tony.luck@intel.com, rounakdas2025@gmail.com,
linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
Niravkumar L Rabara <niravkumarlaxmidas.rabara@altera.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] EDAC/altera: Fix Port B error injection in altr_edac_a10_device_trig
Date: Wed, 25 Nov 2026 16:26:22 -0500 [thread overview]
Message-ID: <20261125212622.GR2156781@yaz-khff2.amd.com> (raw)
In-Reply-To: <20261116131641.3064859-1-dinguyen@kernel.org>
On Mon, Nov 16, 2026 at 07:16:41AM -0600, Dinh Nguyen wrote:
> From: Niravkumar L Rabara <niravkumarlaxmidas.rabara@altera.com>
>
> The INTTEST register on SoCFPGA only supports 16-bit writes; a 32-bit
> write triggers an SError to the CPU. altr_edac_a10_device_trig() was
> already using writew() correctly, but Port B test bits (TSERRB at
> BIT(16), TDERRB at BIT(24)) live in the upper half of the 32-bit
> register. Writing them to the base address silently truncates the
> value to zero, so no test interrupt is ever asserted.
>
> Write only the 16-bit half that holds the trigger bits, and leave the
> zero half untouched.
>
> Fixes: e5ef4cd2a47f ("EDAC/altera: Use correct write width with the INTTEST register")
> Cc: stable@vger.kernel.org
> Signed-off-by: Niravkumar L Rabara <niravkumarlaxmidas.rabara@altera.com>
> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
> ---
> drivers/edac/altera_edac.c | 16 +++++++++++++---
> drivers/edac/altera_edac.h | 3 +++
> 2 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
> index bb95dab847b3c..37ce2a87443e2 100644
> --- a/drivers/edac/altera_edac.c
> +++ b/drivers/edac/altera_edac.c
> @@ -1741,16 +1741,26 @@ altr_edac_a10_device_trig(struct file *file, const char __user *user_buf,
> const struct edac_device_prv_data *priv = drvdata->data;
> void __iomem *set_addr = (drvdata->base + priv->set_err_ofst);
> unsigned long flags;
> + u32 mask;
> + u16 half;
> u8 trig_type;
When adding or modifying variable declarations, consider ordering the
lines from longest to shortest.
>
> if (!user_buf || get_user(trig_type, user_buf))
> return -EFAULT;
>
> - local_irq_save(flags);
> if (trig_type == ALTR_UE_TRIGGER_CHAR)
> - writew(priv->ue_set_mask, set_addr);
> + mask = priv->ue_set_mask;
> else
> - writew(priv->ce_set_mask, set_addr);
> + mask = priv->ce_set_mask;
> +
> + local_irq_save(flags);
> + half = lower_16_bits(mask);
> + if (half)
> + writew(half, set_addr);
> +
> + half = upper_16_bits(mask);
> + if (half)
> + writew(half, set_addr + ALTR_A10_ECC_INTTEST_PORTB_OFST);
>
> /* Ensure the interrupt test bits are set */
> wmb();
> diff --git a/drivers/edac/altera_edac.h b/drivers/edac/altera_edac.h
> index 9387056fd65e3..fe6d0289f5c35 100644
> --- a/drivers/edac/altera_edac.h
> +++ b/drivers/edac/altera_edac.h
> @@ -244,6 +244,9 @@ struct altr_sdram_mc_data {
> #define ALTR_A10_ECC_TSERRB BIT(16)
> #define ALTR_A10_ECC_TDERRB BIT(24)
>
> +/* Byte offset of bits[31:16] of INTTEST for a 16-bit write */
> +#define ALTR_A10_ECC_INTTEST_PORTB_OFST 2
> +
> /* ECC Manager Defines */
> #define A10_SYSMGR_ECC_INTMASK_SET_OFST 0x94
> #define A10_SYSMGR_ECC_INTMASK_CLR_OFST 0x98
> --
Overall, looks good to me.
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Thanks,
Yazen
prev parent reply other threads:[~2026-11-25 21:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 13:16 Dinh Nguyen
2026-11-25 21:26 ` Yazen Ghannam [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261125212622.GR2156781@yaz-khff2.amd.com \
--to=yazen.ghannam@amd.com \
--cc=bp@alien8.de \
--cc=dinguyen@kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=niravkumarlaxmidas.rabara@altera.com \
--cc=rounakdas2025@gmail.com \
--cc=stable@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®