Lines Matching refs:ghes

99 static inline bool is_hest_type_generic_v2(struct ghes *ghes)  in is_hest_type_generic_v2()  argument
101 return ghes->generic->header.type == ACPI_HEST_TYPE_GENERIC_ERROR_V2; in is_hest_type_generic_v2()
111 static inline bool is_hest_sync_notify(struct ghes *ghes) in is_hest_sync_notify() argument
113 u8 notify_type = ghes->generic->notify.type; in is_hest_sync_notify()
240 static int map_gen_v2(struct ghes *ghes) in map_gen_v2() argument
242 return apei_map_generic_address(&ghes->generic_v2->read_ack_register); in map_gen_v2()
245 static void unmap_gen_v2(struct ghes *ghes) in unmap_gen_v2() argument
247 apei_unmap_generic_address(&ghes->generic_v2->read_ack_register); in unmap_gen_v2()
265 static struct ghes *ghes_new(struct acpi_hest_generic *generic) in ghes_new()
267 struct ghes *ghes; in ghes_new() local
271 ghes = kzalloc(sizeof(*ghes), GFP_KERNEL); in ghes_new()
272 if (!ghes) in ghes_new()
275 ghes->generic = generic; in ghes_new()
276 if (is_hest_type_generic_v2(ghes)) { in ghes_new()
277 rc = map_gen_v2(ghes); in ghes_new()
293 ghes->estatus = kmalloc(error_block_length, GFP_KERNEL); in ghes_new()
294 if (!ghes->estatus) { in ghes_new()
299 return ghes; in ghes_new()
304 if (is_hest_type_generic_v2(ghes)) in ghes_new()
305 unmap_gen_v2(ghes); in ghes_new()
307 kfree(ghes); in ghes_new()
311 static void ghes_fini(struct ghes *ghes) in ghes_fini() argument
313 kfree(ghes->estatus); in ghes_fini()
314 apei_unmap_generic_address(&ghes->generic->error_status_address); in ghes_fini()
315 if (is_hest_type_generic_v2(ghes)) in ghes_fini()
316 unmap_gen_v2(ghes); in ghes_fini()
361 static int __ghes_check_estatus(struct ghes *ghes, in __ghes_check_estatus() argument
371 if (len > ghes->generic->error_block_length) { in __ghes_check_estatus()
385 static int __ghes_peek_estatus(struct ghes *ghes, in __ghes_peek_estatus() argument
389 struct acpi_hest_generic *g = ghes->generic; in __ghes_peek_estatus()
427 static int ghes_read_estatus(struct ghes *ghes, in ghes_read_estatus() argument
433 rc = __ghes_peek_estatus(ghes, estatus, buf_paddr, fixmap_idx); in ghes_read_estatus()
437 rc = __ghes_check_estatus(ghes, estatus); in ghes_read_estatus()
445 static void ghes_clear_estatus(struct ghes *ghes, in ghes_clear_estatus() argument
462 if (is_hest_type_generic_v2(ghes)) in ghes_clear_estatus()
463 ghes_ack_error(ghes->generic_v2); in ghes_clear_estatus()
676 static bool ghes_do_proc(struct ghes *ghes, in ghes_do_proc() argument
685 bool sync = is_hest_sync_notify(ghes); in ghes_do_proc()
898 static void __ghes_panic(struct ghes *ghes, in __ghes_panic() argument
902 __ghes_print_estatus(KERN_EMERG, ghes->generic, estatus); in __ghes_panic()
904 ghes_clear_estatus(ghes, estatus, buf_paddr, fixmap_idx); in __ghes_panic()
912 static int ghes_proc(struct ghes *ghes) in ghes_proc() argument
914 struct acpi_hest_generic_status *estatus = ghes->estatus; in ghes_proc()
918 rc = ghes_read_estatus(ghes, estatus, &buf_paddr, FIX_APEI_GHES_IRQ); in ghes_proc()
923 __ghes_panic(ghes, estatus, buf_paddr, FIX_APEI_GHES_IRQ); in ghes_proc()
926 if (ghes_print_estatus(NULL, ghes->generic, estatus)) in ghes_proc()
927 ghes_estatus_cache_add(ghes->generic, estatus); in ghes_proc()
929 ghes_do_proc(ghes, estatus); in ghes_proc()
932 ghes_clear_estatus(ghes, estatus, buf_paddr, FIX_APEI_GHES_IRQ); in ghes_proc()
937 static void ghes_add_timer(struct ghes *ghes) in ghes_add_timer() argument
939 struct acpi_hest_generic *g = ghes->generic; in ghes_add_timer()
948 ghes->timer.expires = round_jiffies_relative(expire); in ghes_add_timer()
949 add_timer(&ghes->timer); in ghes_add_timer()
954 struct ghes *ghes = from_timer(ghes, t, timer); in ghes_poll_func() local
958 ghes_proc(ghes); in ghes_poll_func()
960 if (!(ghes->flags & GHES_EXITING)) in ghes_poll_func()
961 ghes_add_timer(ghes); in ghes_poll_func()
966 struct ghes *ghes = data; in ghes_irq_func() local
971 rc = ghes_proc(ghes); in ghes_irq_func()
982 struct ghes *ghes; in ghes_notify_hed() local
988 list_for_each_entry_rcu(ghes, &ghes_hed, list) { in ghes_notify_hed()
989 if (!ghes_proc(ghes)) in ghes_notify_hed()
1039 task_work_pending = ghes_do_proc(estatus_node->ghes, estatus); in ghes_proc_in_irq()
1086 static int ghes_in_nmi_queue_one_entry(struct ghes *ghes, in ghes_in_nmi_queue_one_entry() argument
1098 rc = __ghes_peek_estatus(ghes, &tmp_header, &buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1100 ghes_clear_estatus(ghes, &tmp_header, buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1104 rc = __ghes_check_estatus(ghes, &tmp_header); in ghes_in_nmi_queue_one_entry()
1106 ghes_clear_estatus(ghes, &tmp_header, buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1116 estatus_node->ghes = ghes; in ghes_in_nmi_queue_one_entry()
1117 estatus_node->generic = ghes->generic; in ghes_in_nmi_queue_one_entry()
1122 ghes_clear_estatus(ghes, estatus, buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1130 __ghes_panic(ghes, estatus, buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1133 ghes_clear_estatus(ghes, &tmp_header, buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1154 struct ghes *ghes; in ghes_in_nmi_spool_from_list() local
1157 list_for_each_entry_rcu(ghes, rcu_list, list) { in ghes_in_nmi_spool_from_list()
1158 if (!ghes_in_nmi_queue_one_entry(ghes, fixmap_idx)) in ghes_in_nmi_spool_from_list()
1188 static void ghes_sea_add(struct ghes *ghes) in ghes_sea_add() argument
1191 list_add_rcu(&ghes->list, &ghes_sea); in ghes_sea_add()
1195 static void ghes_sea_remove(struct ghes *ghes) in ghes_sea_remove() argument
1198 list_del_rcu(&ghes->list); in ghes_sea_remove()
1203 static inline void ghes_sea_add(struct ghes *ghes) { } in ghes_sea_add() argument
1204 static inline void ghes_sea_remove(struct ghes *ghes) { } in ghes_sea_remove() argument
1233 static void ghes_nmi_add(struct ghes *ghes) in ghes_nmi_add() argument
1238 list_add_rcu(&ghes->list, &ghes_nmi); in ghes_nmi_add()
1242 static void ghes_nmi_remove(struct ghes *ghes) in ghes_nmi_remove() argument
1245 list_del_rcu(&ghes->list); in ghes_nmi_remove()
1256 static inline void ghes_nmi_add(struct ghes *ghes) { } in ghes_nmi_add() argument
1257 static inline void ghes_nmi_remove(struct ghes *ghes) { } in ghes_nmi_remove() argument
1265 static int __ghes_sdei_callback(struct ghes *ghes, in __ghes_sdei_callback() argument
1268 if (!ghes_in_nmi_queue_one_entry(ghes, fixmap_idx)) { in __ghes_sdei_callback()
1281 struct ghes *ghes = arg; in ghes_sdei_normal_callback() local
1285 err = __ghes_sdei_callback(ghes, FIX_APEI_GHES_SDEI_NORMAL); in ghes_sdei_normal_callback()
1295 struct ghes *ghes = arg; in ghes_sdei_critical_callback() local
1299 err = __ghes_sdei_callback(ghes, FIX_APEI_GHES_SDEI_CRITICAL); in ghes_sdei_critical_callback()
1305 static int apei_sdei_register_ghes(struct ghes *ghes) in apei_sdei_register_ghes() argument
1310 return sdei_register_ghes(ghes, ghes_sdei_normal_callback, in apei_sdei_register_ghes()
1314 static int apei_sdei_unregister_ghes(struct ghes *ghes) in apei_sdei_unregister_ghes() argument
1319 return sdei_unregister_ghes(ghes); in apei_sdei_unregister_ghes()
1325 struct ghes *ghes = NULL; in ghes_probe() local
1381 ghes = ghes_new(generic); in ghes_probe()
1382 if (IS_ERR(ghes)) { in ghes_probe()
1383 rc = PTR_ERR(ghes); in ghes_probe()
1384 ghes = NULL; in ghes_probe()
1390 timer_setup(&ghes->timer, ghes_poll_func, 0); in ghes_probe()
1391 ghes_add_timer(ghes); in ghes_probe()
1395 rc = acpi_gsi_to_irq(generic->notify.vector, &ghes->irq); in ghes_probe()
1401 rc = request_irq(ghes->irq, ghes_irq_func, IRQF_SHARED, in ghes_probe()
1402 "GHES IRQ", ghes); in ghes_probe()
1416 list_add_rcu(&ghes->list, &ghes_hed); in ghes_probe()
1421 ghes_sea_add(ghes); in ghes_probe()
1424 ghes_nmi_add(ghes); in ghes_probe()
1427 rc = apei_sdei_register_ghes(ghes); in ghes_probe()
1435 platform_set_drvdata(ghes_dev, ghes); in ghes_probe()
1437 ghes->dev = &ghes_dev->dev; in ghes_probe()
1440 list_add_tail(&ghes->elist, &ghes_devs); in ghes_probe()
1445 ghes_proc(ghes); in ghes_probe()
1451 if (ghes) { in ghes_probe()
1452 ghes_fini(ghes); in ghes_probe()
1453 kfree(ghes); in ghes_probe()
1461 struct ghes *ghes; in ghes_remove() local
1464 ghes = platform_get_drvdata(ghes_dev); in ghes_remove()
1465 generic = ghes->generic; in ghes_remove()
1467 ghes->flags |= GHES_EXITING; in ghes_remove()
1470 timer_shutdown_sync(&ghes->timer); in ghes_remove()
1473 free_irq(ghes->irq, ghes); in ghes_remove()
1480 list_del_rcu(&ghes->list); in ghes_remove()
1488 ghes_sea_remove(ghes); in ghes_remove()
1491 ghes_nmi_remove(ghes); in ghes_remove()
1494 rc = apei_sdei_unregister_ghes(ghes); in ghes_remove()
1503 ghes_fini(ghes); in ghes_remove()
1506 list_del(&ghes->elist); in ghes_remove()
1509 kfree(ghes); in ghes_remove()