@@ -409,7 +409,8 @@ static void ghes_clear_estatus(struct ghes *ghes)
409409 ghes -> flags &= ~GHES_TO_CLEAR ;
410410}
411411
412- static void ghes_do_proc (const struct acpi_hest_generic_status * estatus )
412+ static void ghes_do_proc (struct ghes * ghes ,
413+ const struct acpi_hest_generic_status * estatus )
413414{
414415 int sev , sec_sev ;
415416 struct acpi_hest_generic_data * gdata ;
@@ -421,6 +422,8 @@ static void ghes_do_proc(const struct acpi_hest_generic_status *estatus)
421422 CPER_SEC_PLATFORM_MEM )) {
422423 struct cper_sec_mem_err * mem_err ;
423424 mem_err = (struct cper_sec_mem_err * )(gdata + 1 );
425+ ghes_edac_report_mem_error (ghes , sev , mem_err );
426+
424427#ifdef CONFIG_X86_MCE
425428 apei_mce_report_mem_error (sev == GHES_SEV_CORRECTED ,
426429 mem_err );
@@ -639,7 +642,7 @@ static int ghes_proc(struct ghes *ghes)
639642 if (ghes_print_estatus (NULL , ghes -> generic , ghes -> estatus ))
640643 ghes_estatus_cache_add (ghes -> generic , ghes -> estatus );
641644 }
642- ghes_do_proc (ghes -> estatus );
645+ ghes_do_proc (ghes , ghes -> estatus );
643646out :
644647 ghes_clear_estatus (ghes );
645648 return 0 ;
@@ -732,7 +735,7 @@ static void ghes_proc_in_irq(struct irq_work *irq_work)
732735 estatus = GHES_ESTATUS_FROM_NODE (estatus_node );
733736 len = apei_estatus_len (estatus );
734737 node_len = GHES_ESTATUS_NODE_LEN (len );
735- ghes_do_proc (estatus );
738+ ghes_do_proc (estatus_node -> ghes , estatus );
736739 if (!ghes_estatus_cached (estatus )) {
737740 generic = estatus_node -> generic ;
738741 if (ghes_print_estatus (NULL , generic , estatus ))
@@ -821,6 +824,7 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs)
821824 estatus_node = (void * )gen_pool_alloc (ghes_estatus_pool ,
822825 node_len );
823826 if (estatus_node ) {
827+ estatus_node -> ghes = ghes ;
824828 estatus_node -> generic = ghes -> generic ;
825829 estatus = GHES_ESTATUS_FROM_NODE (estatus_node );
826830 memcpy (estatus , ghes -> estatus , len );
@@ -899,6 +903,11 @@ static int ghes_probe(struct platform_device *ghes_dev)
899903 ghes = NULL ;
900904 goto err ;
901905 }
906+
907+ rc = ghes_edac_register (ghes , & ghes_dev -> dev );
908+ if (rc < 0 )
909+ goto err ;
910+
902911 switch (generic -> notify .type ) {
903912 case ACPI_HEST_NOTIFY_POLLED :
904913 ghes -> timer .function = ghes_poll_func ;
@@ -911,13 +920,13 @@ static int ghes_probe(struct platform_device *ghes_dev)
911920 if (acpi_gsi_to_irq (generic -> notify .vector , & ghes -> irq )) {
912921 pr_err (GHES_PFX "Failed to map GSI to IRQ for generic hardware error source: %d\n" ,
913922 generic -> header .source_id );
914- goto err ;
923+ goto err_edac_unreg ;
915924 }
916925 if (request_irq (ghes -> irq , ghes_irq_func ,
917926 0 , "GHES IRQ" , ghes )) {
918927 pr_err (GHES_PFX "Failed to register IRQ for generic hardware error source: %d\n" ,
919928 generic -> header .source_id );
920- goto err ;
929+ goto err_edac_unreg ;
921930 }
922931 break ;
923932 case ACPI_HEST_NOTIFY_SCI :
@@ -943,6 +952,8 @@ static int ghes_probe(struct platform_device *ghes_dev)
943952 platform_set_drvdata (ghes_dev , ghes );
944953
945954 return 0 ;
955+ err_edac_unreg :
956+ ghes_edac_unregister (ghes );
946957err :
947958 if (ghes ) {
948959 ghes_fini (ghes );
@@ -995,6 +1006,9 @@ static int ghes_remove(struct platform_device *ghes_dev)
9951006 }
9961007
9971008 ghes_fini (ghes );
1009+
1010+ ghes_edac_unregister (ghes );
1011+
9981012 kfree (ghes );
9991013
10001014 platform_set_drvdata (ghes_dev , NULL );
0 commit comments