linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH 0/3] EDAC/versal: Driver updates
@ 2024-04-25 12:19 Shubhrajyoti Datta
  2024-04-25 12:19 ` [RESEND PATCH 1/3] EDAC/versal: Do not register for the NOC errors Shubhrajyoti Datta
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Shubhrajyoti Datta @ 2024-04-25 12:19 UTC (permalink / raw)
  To: linux-edac
  Cc: git, rric, mchehab, james.morse, tony.luck, bp, sai.krishna.potthuri


Include a NULL check for the user-passed function.
Eliminate unnecessary NOC error registration.
Avoid sending cumulative values in the EDAC.



Shubhrajyoti Datta (3):
  EDAC/versal: Do not register for the NOC errors
  EDAC/versal: Add a NULL check for the user passed values
  EDAC/versal: Do not send the cumulative values

 drivers/edac/versal_edac.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RESEND PATCH 1/3] EDAC/versal: Do not register for the NOC errors
  2024-04-25 12:19 [RESEND PATCH 0/3] EDAC/versal: Driver updates Shubhrajyoti Datta
@ 2024-04-25 12:19 ` Shubhrajyoti Datta
  2024-04-25 12:19 ` [RESEND PATCH 2/3] EDAC/versal: Add a NULL check for the user passed values Shubhrajyoti Datta
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Shubhrajyoti Datta @ 2024-04-25 12:19 UTC (permalink / raw)
  To: linux-edac
  Cc: git, rric, mchehab, james.morse, tony.luck, bp, sai.krishna.potthuri

The NOC errors are not handled in the driver. Remove the request for
registration.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 drivers/edac/versal_edac.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/edac/versal_edac.c b/drivers/edac/versal_edac.c
index fb231d0a3673..710325381d5d 100644
--- a/drivers/edac/versal_edac.c
+++ b/drivers/edac/versal_edac.c
@@ -1245,8 +1245,7 @@ static int mc_probe(struct platform_device *pdev)
 	}
 
 	rc = xlnx_register_event(PM_NOTIFY_CB, VERSAL_EVENT_ERROR_PMC_ERR1,
-				 XPM_EVENT_ERROR_MASK_DDRMC_CR | XPM_EVENT_ERROR_MASK_DDRMC_NCR |
-				 XPM_EVENT_ERROR_MASK_NOC_CR | XPM_EVENT_ERROR_MASK_NOC_NCR,
+				 XPM_EVENT_ERROR_MASK_DDRMC_CR | XPM_EVENT_ERROR_MASK_DDRMC_NCR,
 				 false, err_callback, mci);
 	if (rc) {
 		if (rc == -EACCES)
@@ -1283,8 +1282,6 @@ static int mc_remove(struct platform_device *pdev)
 
 	xlnx_unregister_event(PM_NOTIFY_CB, VERSAL_EVENT_ERROR_PMC_ERR1,
 			      XPM_EVENT_ERROR_MASK_DDRMC_CR |
-			      XPM_EVENT_ERROR_MASK_NOC_CR |
-			      XPM_EVENT_ERROR_MASK_NOC_NCR |
 			      XPM_EVENT_ERROR_MASK_DDRMC_NCR, err_callback, mci);
 	edac_mc_del_mc(&pdev->dev);
 	edac_mc_free(mci);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RESEND PATCH 2/3] EDAC/versal: Add a NULL check for the user passed values
  2024-04-25 12:19 [RESEND PATCH 0/3] EDAC/versal: Driver updates Shubhrajyoti Datta
  2024-04-25 12:19 ` [RESEND PATCH 1/3] EDAC/versal: Do not register for the NOC errors Shubhrajyoti Datta
@ 2024-04-25 12:19 ` Shubhrajyoti Datta
  2024-04-25 12:19 ` [RESEND PATCH 3/3] EDAC/versal: Do not send the cumulative values Shubhrajyoti Datta
  2024-04-25 16:11 ` [RESEND PATCH 0/3] EDAC/versal: Driver updates Borislav Petkov
  3 siblings, 0 replies; 5+ messages in thread
From: Shubhrajyoti Datta @ 2024-04-25 12:19 UTC (permalink / raw)
  To: linux-edac
  Cc: git, rric, mchehab, james.morse, tony.luck, bp, sai.krishna.potthuri

The function inject_data_ue_store() lacks a NULL check for the
user passed values. To prevent below kernel crash include a NULL check.

Call trace:

kstrtoull+0xc/0x28
kstrtou8+0x2c/0x7c
inject_data_ue_store+0x10c/0x24c
full_proxy_write+0x60/0xb4
vfs_write+0xb0/0x374
ksys_write+0x6c/0x100
__arm64_sys_write+0x1c/0x28
invoke_syscall+0x54/0x124
el0_svc_common.constprop.0+0xc0/0xe0
do_el0_svc+0x1c/0x28
el0_svc+0x34/0xb8
el0t_64_sync_handler+0x100/0x12c
el0t_64_sync+0x190/0x194

Fixes: 83bf24051a60 ("EDAC/versal: Make the bit position of injected errors configurable")
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 drivers/edac/versal_edac.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/edac/versal_edac.c b/drivers/edac/versal_edac.c
index 710325381d5d..a1407a399ed9 100644
--- a/drivers/edac/versal_edac.c
+++ b/drivers/edac/versal_edac.c
@@ -975,6 +975,9 @@ static ssize_t inject_data_ue_store(struct file *file, const char __user *data,
 	for (i = 0; i < NUM_UE_BITPOS; i++)
 		token[i] = strsep(&pbuf, ",");
 
+	if (!token[0] || !token[1])
+		return -EFAULT;
+
 	ret = kstrtou8(token[0], 0, &ue0);
 	if (ret)
 		return ret;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RESEND PATCH 3/3] EDAC/versal: Do not send the cumulative values
  2024-04-25 12:19 [RESEND PATCH 0/3] EDAC/versal: Driver updates Shubhrajyoti Datta
  2024-04-25 12:19 ` [RESEND PATCH 1/3] EDAC/versal: Do not register for the NOC errors Shubhrajyoti Datta
  2024-04-25 12:19 ` [RESEND PATCH 2/3] EDAC/versal: Add a NULL check for the user passed values Shubhrajyoti Datta
@ 2024-04-25 12:19 ` Shubhrajyoti Datta
  2024-04-25 16:11 ` [RESEND PATCH 0/3] EDAC/versal: Driver updates Borislav Petkov
  3 siblings, 0 replies; 5+ messages in thread
From: Shubhrajyoti Datta @ 2024-04-25 12:19 UTC (permalink / raw)
  To: linux-edac
  Cc: git, rric, mchehab, james.morse, tony.luck, bp, sai.krishna.potthuri

Currently collective errors are reported. Change it to
intantaneous values. The cumulative values can be got from the
debug prints.

Fixes: 6f15b178cd63 ("EDAC/versal: Add a Xilinx Versal memory controller driver")
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>

---

 drivers/edac/versal_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/versal_edac.c b/drivers/edac/versal_edac.c
index a1407a399ed9..08e9f155d7e3 100644
--- a/drivers/edac/versal_edac.c
+++ b/drivers/edac/versal_edac.c
@@ -506,7 +506,7 @@ static void handle_error(struct mem_ctl_info *mci, struct ecc_status *stat)
 		e->type = HW_EVENT_ERR_CORRECTED;
 		
 		edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci,
-				     priv->ce_cnt, 0, 0, 0, 0, 0, -1,
+				     1, 0, 0, 0, 0, 0, -1,
 				     priv->message, "");
 	}
 
@@ -520,7 +520,7 @@ static void handle_error(struct mem_ctl_info *mci, struct ecc_status *stat)
 		e->type = HW_EVENT_ERR_UNCORRECTED;
 
 		edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci,
-				     priv->ue_cnt, 0, 0, 0, 0, 0, -1,
+				     1, 0, 0, 0, 0, 0, -1,
 				     priv->message, "");
 	}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH 0/3] EDAC/versal: Driver updates
  2024-04-25 12:19 [RESEND PATCH 0/3] EDAC/versal: Driver updates Shubhrajyoti Datta
                   ` (2 preceding siblings ...)
  2024-04-25 12:19 ` [RESEND PATCH 3/3] EDAC/versal: Do not send the cumulative values Shubhrajyoti Datta
@ 2024-04-25 16:11 ` Borislav Petkov
  3 siblings, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2024-04-25 16:11 UTC (permalink / raw)
  To: Shubhrajyoti Datta
  Cc: linux-edac, git, rric, mchehab, james.morse, tony.luck,
	sai.krishna.potthuri

On Thu, Apr 25, 2024 at 05:49:39PM +0530, Shubhrajyoti Datta wrote:
> 
> Include a NULL check for the user-passed function.
> Eliminate unnecessary NOC error registration.
> Avoid sending cumulative values in the EDAC.
> 
> 
> 
> Shubhrajyoti Datta (3):
>   EDAC/versal: Do not register for the NOC errors
>   EDAC/versal: Add a NULL check for the user passed values
>   EDAC/versal: Do not send the cumulative values
> 
>  drivers/edac/versal_edac.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-25 16:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25 12:19 [RESEND PATCH 0/3] EDAC/versal: Driver updates Shubhrajyoti Datta
2024-04-25 12:19 ` [RESEND PATCH 1/3] EDAC/versal: Do not register for the NOC errors Shubhrajyoti Datta
2024-04-25 12:19 ` [RESEND PATCH 2/3] EDAC/versal: Add a NULL check for the user passed values Shubhrajyoti Datta
2024-04-25 12:19 ` [RESEND PATCH 3/3] EDAC/versal: Do not send the cumulative values Shubhrajyoti Datta
2024-04-25 16:11 ` [RESEND PATCH 0/3] EDAC/versal: Driver updates Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).