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()
214 static int map_gen_v2(struct ghes *ghes) in map_gen_v2() argument
216 return apei_map_generic_address(&ghes->generic_v2->read_ack_register); in map_gen_v2()
219 static void unmap_gen_v2(struct ghes *ghes) in unmap_gen_v2() argument
221 apei_unmap_generic_address(&ghes->generic_v2->read_ack_register); in unmap_gen_v2()
239 static struct ghes *ghes_new(struct acpi_hest_generic *generic) in ghes_new()
241 struct ghes *ghes; in ghes_new() local
245 ghes = kzalloc(sizeof(*ghes), GFP_KERNEL); in ghes_new()
246 if (!ghes) in ghes_new()
249 ghes->generic = generic; in ghes_new()
250 if (is_hest_type_generic_v2(ghes)) { in ghes_new()
251 rc = map_gen_v2(ghes); in ghes_new()
267 ghes->estatus = kmalloc(error_block_length, GFP_KERNEL); in ghes_new()
268 if (!ghes->estatus) { in ghes_new()
273 return ghes; in ghes_new()
278 if (is_hest_type_generic_v2(ghes)) in ghes_new()
279 unmap_gen_v2(ghes); in ghes_new()
281 kfree(ghes); in ghes_new()
285 static void ghes_fini(struct ghes *ghes) in ghes_fini() argument
287 kfree(ghes->estatus); in ghes_fini()
288 apei_unmap_generic_address(&ghes->generic->error_status_address); in ghes_fini()
289 if (is_hest_type_generic_v2(ghes)) in ghes_fini()
290 unmap_gen_v2(ghes); in ghes_fini()
335 static int __ghes_check_estatus(struct ghes *ghes, in __ghes_check_estatus() argument
345 if (len > ghes->generic->error_block_length) { in __ghes_check_estatus()
359 static int __ghes_peek_estatus(struct ghes *ghes, in __ghes_peek_estatus() argument
363 struct acpi_hest_generic *g = ghes->generic; in __ghes_peek_estatus()
401 static int ghes_read_estatus(struct ghes *ghes, in ghes_read_estatus() argument
407 rc = __ghes_peek_estatus(ghes, estatus, buf_paddr, fixmap_idx); in ghes_read_estatus()
411 rc = __ghes_check_estatus(ghes, estatus); in ghes_read_estatus()
419 static void ghes_clear_estatus(struct ghes *ghes, in ghes_clear_estatus() argument
436 if (is_hest_type_generic_v2(ghes)) in ghes_clear_estatus()
437 ghes_ack_error(ghes->generic_v2); in ghes_clear_estatus()
641 static bool ghes_do_proc(struct ghes *ghes, in ghes_do_proc() argument
862 static void __ghes_panic(struct ghes *ghes, in __ghes_panic() argument
866 __ghes_print_estatus(KERN_EMERG, ghes->generic, estatus); in __ghes_panic()
868 ghes_clear_estatus(ghes, estatus, buf_paddr, fixmap_idx); in __ghes_panic()
876 static int ghes_proc(struct ghes *ghes) in ghes_proc() argument
878 struct acpi_hest_generic_status *estatus = ghes->estatus; in ghes_proc()
882 rc = ghes_read_estatus(ghes, estatus, &buf_paddr, FIX_APEI_GHES_IRQ); in ghes_proc()
887 __ghes_panic(ghes, estatus, buf_paddr, FIX_APEI_GHES_IRQ); in ghes_proc()
890 if (ghes_print_estatus(NULL, ghes->generic, estatus)) in ghes_proc()
891 ghes_estatus_cache_add(ghes->generic, estatus); in ghes_proc()
893 ghes_do_proc(ghes, estatus); in ghes_proc()
896 ghes_clear_estatus(ghes, estatus, buf_paddr, FIX_APEI_GHES_IRQ); in ghes_proc()
901 static void ghes_add_timer(struct ghes *ghes) in ghes_add_timer() argument
903 struct acpi_hest_generic *g = ghes->generic; in ghes_add_timer()
912 ghes->timer.expires = round_jiffies_relative(expire); in ghes_add_timer()
913 add_timer(&ghes->timer); in ghes_add_timer()
918 struct ghes *ghes = from_timer(ghes, t, timer); in ghes_poll_func() local
922 ghes_proc(ghes); in ghes_poll_func()
924 if (!(ghes->flags & GHES_EXITING)) in ghes_poll_func()
925 ghes_add_timer(ghes); in ghes_poll_func()
930 struct ghes *ghes = data; in ghes_irq_func() local
935 rc = ghes_proc(ghes); in ghes_irq_func()
946 struct ghes *ghes; in ghes_notify_hed() local
952 list_for_each_entry_rcu(ghes, &ghes_hed, list) { in ghes_notify_hed()
953 if (!ghes_proc(ghes)) in ghes_notify_hed()
1003 task_work_pending = ghes_do_proc(estatus_node->ghes, estatus); in ghes_proc_in_irq()
1050 static int ghes_in_nmi_queue_one_entry(struct ghes *ghes, in ghes_in_nmi_queue_one_entry() argument
1062 rc = __ghes_peek_estatus(ghes, &tmp_header, &buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1064 ghes_clear_estatus(ghes, &tmp_header, buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1068 rc = __ghes_check_estatus(ghes, &tmp_header); in ghes_in_nmi_queue_one_entry()
1070 ghes_clear_estatus(ghes, &tmp_header, buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1080 estatus_node->ghes = ghes; in ghes_in_nmi_queue_one_entry()
1081 estatus_node->generic = ghes->generic; in ghes_in_nmi_queue_one_entry()
1086 ghes_clear_estatus(ghes, estatus, buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1094 __ghes_panic(ghes, estatus, buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1097 ghes_clear_estatus(ghes, &tmp_header, buf_paddr, fixmap_idx); in ghes_in_nmi_queue_one_entry()
1118 struct ghes *ghes; in ghes_in_nmi_spool_from_list() local
1121 list_for_each_entry_rcu(ghes, rcu_list, list) { in ghes_in_nmi_spool_from_list()
1122 if (!ghes_in_nmi_queue_one_entry(ghes, fixmap_idx)) in ghes_in_nmi_spool_from_list()
1152 static void ghes_sea_add(struct ghes *ghes) in ghes_sea_add() argument
1155 list_add_rcu(&ghes->list, &ghes_sea); in ghes_sea_add()
1159 static void ghes_sea_remove(struct ghes *ghes) in ghes_sea_remove() argument
1162 list_del_rcu(&ghes->list); in ghes_sea_remove()
1167 static inline void ghes_sea_add(struct ghes *ghes) { } in ghes_sea_add() argument
1168 static inline void ghes_sea_remove(struct ghes *ghes) { } in ghes_sea_remove() argument
1197 static void ghes_nmi_add(struct ghes *ghes) in ghes_nmi_add() argument
1202 list_add_rcu(&ghes->list, &ghes_nmi); in ghes_nmi_add()
1206 static void ghes_nmi_remove(struct ghes *ghes) in ghes_nmi_remove() argument
1209 list_del_rcu(&ghes->list); in ghes_nmi_remove()
1220 static inline void ghes_nmi_add(struct ghes *ghes) { } in ghes_nmi_add() argument
1221 static inline void ghes_nmi_remove(struct ghes *ghes) { } in ghes_nmi_remove() argument
1229 static int __ghes_sdei_callback(struct ghes *ghes, in __ghes_sdei_callback() argument
1232 if (!ghes_in_nmi_queue_one_entry(ghes, fixmap_idx)) { in __ghes_sdei_callback()
1245 struct ghes *ghes = arg; in ghes_sdei_normal_callback() local
1249 err = __ghes_sdei_callback(ghes, FIX_APEI_GHES_SDEI_NORMAL); in ghes_sdei_normal_callback()
1259 struct ghes *ghes = arg; in ghes_sdei_critical_callback() local
1263 err = __ghes_sdei_callback(ghes, FIX_APEI_GHES_SDEI_CRITICAL); in ghes_sdei_critical_callback()
1269 static int apei_sdei_register_ghes(struct ghes *ghes) in apei_sdei_register_ghes() argument
1274 return sdei_register_ghes(ghes, ghes_sdei_normal_callback, in apei_sdei_register_ghes()
1278 static int apei_sdei_unregister_ghes(struct ghes *ghes) in apei_sdei_unregister_ghes() argument
1283 return sdei_unregister_ghes(ghes); in apei_sdei_unregister_ghes()
1289 struct ghes *ghes = NULL; in ghes_probe() local
1345 ghes = ghes_new(generic); in ghes_probe()
1346 if (IS_ERR(ghes)) { in ghes_probe()
1347 rc = PTR_ERR(ghes); in ghes_probe()
1348 ghes = NULL; in ghes_probe()
1354 timer_setup(&ghes->timer, ghes_poll_func, 0); in ghes_probe()
1355 ghes_add_timer(ghes); in ghes_probe()
1359 rc = acpi_gsi_to_irq(generic->notify.vector, &ghes->irq); in ghes_probe()
1365 rc = request_irq(ghes->irq, ghes_irq_func, IRQF_SHARED, in ghes_probe()
1366 "GHES IRQ", ghes); in ghes_probe()
1380 list_add_rcu(&ghes->list, &ghes_hed); in ghes_probe()
1385 ghes_sea_add(ghes); in ghes_probe()
1388 ghes_nmi_add(ghes); in ghes_probe()
1391 rc = apei_sdei_register_ghes(ghes); in ghes_probe()
1399 platform_set_drvdata(ghes_dev, ghes); in ghes_probe()
1401 ghes->dev = &ghes_dev->dev; in ghes_probe()
1404 list_add_tail(&ghes->elist, &ghes_devs); in ghes_probe()
1409 ghes_proc(ghes); in ghes_probe()
1415 if (ghes) { in ghes_probe()
1416 ghes_fini(ghes); in ghes_probe()
1417 kfree(ghes); in ghes_probe()
1425 struct ghes *ghes; in ghes_remove() local
1428 ghes = platform_get_drvdata(ghes_dev); in ghes_remove()
1429 generic = ghes->generic; in ghes_remove()
1431 ghes->flags |= GHES_EXITING; in ghes_remove()
1434 timer_shutdown_sync(&ghes->timer); in ghes_remove()
1437 free_irq(ghes->irq, ghes); in ghes_remove()
1444 list_del_rcu(&ghes->list); in ghes_remove()
1452 ghes_sea_remove(ghes); in ghes_remove()
1455 ghes_nmi_remove(ghes); in ghes_remove()
1458 rc = apei_sdei_unregister_ghes(ghes); in ghes_remove()
1467 ghes_fini(ghes); in ghes_remove()
1470 list_del(&ghes->elist); in ghes_remove()
1473 kfree(ghes); in ghes_remove()