EDAC/altera: Fix Port B error injection in altr_edac_a10_device_trig
Subsystems (3)
Dinh Nguyen
maintainerPATCH 1/1 EDAC/altera: Fix Port B error injection in altr_edac_a10_device_trig
From: Niravkumar L Rabara <[email protected]>
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")
Signed-off-by Niravkumar L Rabara <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>
--- drivers/edac/altera_edac.c | 16 +++++++++++++--- drivers/edac/altera_edac.h | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/edac/altera_edac.c +13 -3
@@ -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;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 ();
drivers/edac/altera_edac.h +3 -0
@@ -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
Signature · 1 line
2.42.0.411.g813d9a9188