Lines Matching refs:mod

75 topo_zen_enum_cleanup_sock(topo_mod_t *mod, zen_topo_enum_sock_t *sock)  in topo_zen_enum_cleanup_sock()  argument
99 topo_mod_free(mod, sock->ztes_tn_ccd, sock->ztes_nccd * in topo_zen_enum_cleanup_sock()
105 topo_mod_free(mod, sock->ztes_ccd, sock->ztes_nccd * in topo_zen_enum_cleanup_sock()
112 topo_zen_enum_chip_gather_ccd(topo_mod_t *mod, const zen_topo_t *zen, in topo_zen_enum_chip_gather_ccd() argument
123 topo_mod_dprintf(mod, "failed to get CCD information " in topo_zen_enum_chip_gather_ccd()
126 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_gather_ccd()
142 topo_mod_dprintf(mod, "DF CCM fabric 0x%x, CCD 0x%x " in topo_zen_enum_chip_gather_ccd()
145 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_gather_ccd()
170 topo_zen_enum_chip_gather(topo_mod_t *mod, const zen_topo_t *zen, in topo_zen_enum_chip_gather() argument
184 topo_mod_dprintf(mod, "no CCDs found! Not much more we can " in topo_zen_enum_chip_gather()
186 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_gather()
190 sock->ztes_ccd = topo_mod_zalloc(mod, sizeof (amdzen_topo_ccd_t) * in topo_zen_enum_chip_gather()
193 topo_mod_dprintf(mod, "failed to allocate memory for " in topo_zen_enum_chip_gather()
195 return (topo_mod_seterrno(mod, EMOD_NOMEM)); in topo_zen_enum_chip_gather()
198 sock->ztes_tn_ccd = topo_mod_zalloc(mod, sizeof (zen_topo_enum_ccd_t) * in topo_zen_enum_chip_gather()
216 if (topo_zen_enum_chip_gather_ccd(mod, zen, sock, dfe, in topo_zen_enum_chip_gather()
225 topo_mod_dprintf(mod, "found %u CCDs\n", sock->ztes_nccd_valid); in topo_zen_enum_chip_gather()
227 topo_mod_dprintf(mod, "somehow we ended up with no CCDs with " in topo_zen_enum_chip_gather()
229 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_gather()
234 topo_mod_dprintf(mod, "failed to open FMD agent: %s\n", in topo_zen_enum_chip_gather()
236 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_gather()
241 topo_mod_dprintf(mod, "failed to get FM agent CPU " in topo_zen_enum_chip_gather()
244 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_gather()
247 topo_mod_dprintf(mod, "got %u CPUs worth of data from the FM agent\n", in topo_zen_enum_chip_gather()
251 topo_mod_dprintf(mod, "failed to get FM agent cache " in topo_zen_enum_chip_gather()
254 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_gather()
258 topo_mod_dprintf(mod, "/dev/fm gave us %u CPUs, but %u CPUs " in topo_zen_enum_chip_gather()
261 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_gather()
266 topo_mod_dprintf(mod, "failed to open kstat driver: %s\n", in topo_zen_enum_chip_gather()
268 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_gather()
299 zen_topo_determine_cache(topo_mod_t *mod, uint32_t level, uint32_t type, in zen_topo_determine_cache() argument
302 zen_topo_t *zen = topo_mod_getspecific(mod); in zen_topo_determine_cache()
337 topo_zen_map_caches(topo_mod_t *mod, zen_topo_enum_sock_t *sock, in topo_zen_map_caches() argument
369 topo_mod_dprintf(mod, "missing required nvlist fields " in topo_zen_map_caches()
374 ct = zen_topo_determine_cache(mod, level, type, shift); in topo_zen_map_caches()
377 topo_mod_dprintf(mod, "failed to map CPU %u cache %u " in topo_zen_map_caches()
403 topo_mod_dprintf(mod, "wanted to map CPU %u cache %u " in topo_zen_map_caches()
416 topo_zen_map_logcpu_to_phys(topo_mod_t *mod, zen_topo_enum_sock_t *sock, in topo_zen_map_logcpu_to_phys() argument
462 topo_mod_dprintf(mod, "APIC ID " in topo_zen_map_logcpu_to_phys()
480 return (topo_zen_map_caches(mod, sock, in topo_zen_map_logcpu_to_phys()
487 topo_mod_dprintf(mod, "failed to find a CPU for apic 0x%x\n", in topo_zen_map_logcpu_to_phys()
500 topo_zen_map_common_chip_info(topo_mod_t *mod, zen_topo_enum_sock_t *sock, in topo_zen_map_common_chip_info() argument
518 topo_mod_dprintf(mod, "missing required nvlist fields " in topo_zen_map_common_chip_info()
520 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_map_common_chip_info()
545 topo_mod_dprintf(mod, "failed to construct kstat name: " in topo_zen_map_common_chip_info()
547 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_map_common_chip_info()
552 topo_mod_dprintf(mod, "failed to find 'cpu_info:%d:%s': %s", in topo_zen_map_common_chip_info()
554 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_map_common_chip_info()
558 topo_mod_dprintf(mod, "failed to read kstat 'cpu_info:%d:%s': " in topo_zen_map_common_chip_info()
560 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_map_common_chip_info()
565 topo_mod_dprintf(mod, "failed to find 'cpu_info:%d:%s:brand\n", in topo_zen_map_common_chip_info()
567 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_map_common_chip_info()
578 topo_mod_dprintf(mod, "failed to find 'cpu_info:%d:%s:" in topo_zen_map_common_chip_info()
580 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_map_common_chip_info()
588 topo_zen_enum_chip_map(topo_mod_t *mod, zen_topo_enum_sock_t *sock) in topo_zen_enum_chip_map() argument
604 topo_mod_dprintf(mod, "missing required nvlist fields " in topo_zen_enum_chip_map()
606 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_map()
616 if (!topo_zen_map_logcpu_to_phys(mod, sock, cpu_nvl, i, in topo_zen_enum_chip_map()
618 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_map()
633 topo_mod_dprintf(mod, "missing required nvlist fields " in topo_zen_enum_chip_map()
635 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_map()
645 return (topo_zen_map_common_chip_info(mod, sock, cpu_nvl)); in topo_zen_enum_chip_map()
648 topo_mod_dprintf(mod, "no logical CPUs match our target socket %u!\n", in topo_zen_enum_chip_map()
650 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum_chip_map()
654 topo_zen_enum(topo_mod_t *mod, tnode_t *pnode, const char *name, in topo_zen_enum() argument
658 zen_topo_t *zen = topo_mod_getspecific(mod); in topo_zen_enum()
663 topo_mod_dprintf(mod, "asked to enum %s [%" PRIu64 ", %" PRIu64 "] on " in topo_zen_enum()
671 topo_mod_dprintf(mod, "cannot enumerate %s: unknown type\n", in topo_zen_enum()
677 topo_mod_dprintf(mod, "cannot enumerate %s: missing required " in topo_zen_enum()
679 return (topo_mod_seterrno(mod, EMOD_METHOD_INVAL)); in topo_zen_enum()
683 topo_mod_dprintf(mod, "cannot enumerate %s: multiple instances " in topo_zen_enum()
685 return (topo_mod_seterrno(mod, EMOD_METHOD_INVAL)); in topo_zen_enum()
697 topo_mod_dprintf(mod, "no matching DF with socket %u", in topo_zen_enum()
699 return (topo_mod_seterrno(mod, EMOD_METHOD_INVAL)); in topo_zen_enum()
709 topo_mod_dprintf(mod, "DF base revision is unknown, cannot " in topo_zen_enum()
711 return (topo_mod_seterrno(mod, EMOD_UKNOWN_ENUM)); in topo_zen_enum()
715 topo_mod_dprintf(mod, "DFv2 multiple dies are not currently " in topo_zen_enum()
717 return (topo_mod_seterrno(mod, EMOD_METHOD_NOTSUP)); in topo_zen_enum()
730 if ((ret = topo_zen_enum_chip_gather(mod, zen, df, &sock)) != 0) { in topo_zen_enum()
731 topo_zen_enum_cleanup_sock(mod, &sock); in topo_zen_enum()
739 if ((ret = topo_zen_enum_chip_map(mod, &sock)) != 0) { in topo_zen_enum()
743 ret = topo_zen_build_chip(mod, pnode, min, &sock); in topo_zen_enum()
744 topo_zen_enum_cleanup_sock(mod, &sock); in topo_zen_enum()
759 topo_zen_cleanup(topo_mod_t *mod, zen_topo_t *zen) in topo_zen_cleanup() argument
769 topo_mod_free(mod, zen->zt_dfs[i].atd_df_ents, in topo_zen_cleanup()
772 topo_mod_free(mod, zen->zt_dfs, sizeof (amdzen_topo_df_t) * in topo_zen_cleanup()
780 topo_mod_free(mod, zen, sizeof (zen_topo_t)); in topo_zen_cleanup()
784 topo_zen_init(topo_mod_t *mod, zen_topo_t *zen) in topo_zen_init() argument
788 topo_mod_dprintf(mod, "failed to open %s: %s\n", topo_zen_dev, in topo_zen_init()
794 topo_mod_dprintf(mod, "failed to get base Zen topology " in topo_zen_init()
802 zen->zt_dfs = topo_mod_zalloc(mod, sizeof (amdzen_topo_df_t) * in topo_zen_init()
805 topo_mod_dprintf(mod, "failed to allocate space for %u DF " in topo_zen_init()
814 topo_df->atd_df_ents = topo_mod_zalloc(mod, in topo_zen_init()
817 topo_mod_dprintf(mod, "failed to allocate space for " in topo_zen_init()
826 topo_mod_dprintf(mod, "failed to get information for " in topo_zen_init()
836 _topo_init(topo_mod_t *mod, topo_version_t version) in _topo_init() argument
841 topo_mod_setdebug(mod); in _topo_init()
843 topo_mod_dprintf(mod, "module initializing\n"); in _topo_init()
845 zen = topo_mod_zalloc(mod, sizeof (zen_topo_t)); in _topo_init()
847 topo_mod_dprintf(mod, "failed to allocate zen_topo_t: %s\n", in _topo_init()
852 if (topo_zen_init(mod, zen) != 0) { in _topo_init()
853 topo_zen_cleanup(mod, zen); in _topo_init()
857 if (topo_mod_register(mod, &topo_zen_mod, TOPO_VERSION) != 0) { in _topo_init()
858 topo_zen_cleanup(mod, zen); in _topo_init()
862 topo_mod_setspecific(mod, zen); in _topo_init()
867 _topo_fini(topo_mod_t *mod) in _topo_fini() argument
871 if ((zen = topo_mod_getspecific(mod)) == NULL) { in _topo_fini()
875 topo_mod_setspecific(mod, NULL); in _topo_fini()
876 topo_zen_cleanup(mod, zen); in _topo_fini()
877 topo_mod_unregister(mod); in _topo_fini()