Lines Matching +full:p +full:- +full:tile
1 // SPDX-License-Identifier: MIT
28 * Configfs is a filesystem-based manager of kernel objects. XE KMD registers a
73 * -------------------
83 * ----------------
87 * considered on each tile. Examples:
97 * Note that the engine names are the per-GT hardware names. On multi-tile
99 * and copy engines on each tile.
109 * ----
121 * ------------------
134 * <engine-class> cmd <instr> [[dword0] [dword1] [...]]
138 * <engine-class> reg <address> <value>
240 return &to_xe_config_group_device(item)->config; in to_xe_config_device()
250 lockdep_assert_held(&dev->lock); in is_bound()
252 name = dev->group.cg_item.ci_name; in is_bound()
273 return sprintf(page, "%d\n", dev->survivability_mode); in survivability_mode_show()
286 guard(mutex)(&dev->lock); in survivability_mode_store()
288 return -EBUSY; in survivability_mode_store()
290 dev->config.survivability_mode = survivability_mode; in survivability_mode_store()
298 char *p = page; in engines_allowed_show() local
303 if ((dev->engines_allowed & mask) == mask) { in engines_allowed_show()
304 p += sprintf(p, "%s*\n", engine_info[i].cls); in engines_allowed_show()
305 } else if (mask & dev->engines_allowed) { in engines_allowed_show()
308 mask &= dev->engines_allowed; in engines_allowed_show()
311 p += sprintf(p, "%s%u\n", engine_info[i].cls, in engines_allowed_show()
312 bit - bit0); in engines_allowed_show()
316 return p - page; in engines_allowed_show()
324 * - lookup_engine_info("rcs0", &mask): return "rcs" entry from @engine_info and
326 * - lookup_engine_info("rcs*", &mask): return "rcs" entry from @engine_info and
328 * - lookup_engine_info("rcs", NULL): return "rcs" entry from @engine_info
371 return -EINVAL; in parse_engine()
378 return -ENOENT; in parse_engine()
390 ssize_t patternlen, p; in engines_allowed_store() local
393 for (p = 0; p < len; p += patternlen + 1) { in engines_allowed_store()
394 patternlen = parse_engine(page + p, ",\n", &mask, NULL); in engines_allowed_store()
396 return -EINVAL; in engines_allowed_store()
401 guard(mutex)(&dev->lock); in engines_allowed_store()
403 return -EBUSY; in engines_allowed_store()
405 dev->config.engines_allowed = val; in engines_allowed_store()
414 return sprintf(page, "%d\n", dev->enable_psmi); in enable_psmi_show()
427 guard(mutex)(&dev->lock); in enable_psmi_store()
429 return -EBUSY; in enable_psmi_store()
431 dev->config.enable_psmi = val; in enable_psmi_store()
436 static bool wa_bb_read_advance(bool dereference, char **p, in wa_bb_read_advance() argument
443 *max_size -= len; in wa_bb_read_advance()
445 memcpy(*p, append, len); in wa_bb_read_advance()
448 *p += len; in wa_bb_read_advance()
457 char *p = data; in wa_bb_show() local
459 guard(mutex)(&dev->lock); in wa_bb_show()
468 len = snprintf(p, sz, "%s:", engine_info[i].cls); in wa_bb_show()
469 if (!wa_bb_read_advance(data, &p, NULL, len, &sz)) in wa_bb_show()
470 return -ENOBUFS; in wa_bb_show()
473 len = snprintf(p, sz, " %08x", wa_bb[ec].cs[j]); in wa_bb_show()
474 if (!wa_bb_read_advance(data, &p, NULL, len, &sz)) in wa_bb_show()
475 return -ENOBUFS; in wa_bb_show()
478 if (!wa_bb_read_advance(data, &p, "\n", 1, &sz)) in wa_bb_show()
479 return -ENOBUFS; in wa_bb_show()
482 if (!wa_bb_read_advance(data, &p, "", 1, &sz)) in wa_bb_show()
483 return -ENOBUFS; in wa_bb_show()
487 p++; in wa_bb_show()
489 return p - data; in wa_bb_show()
496 return wa_bb_show(dev, dev->config.ctx_restore_mid_bb, page, SZ_4K); in ctx_restore_mid_bb_show()
503 return wa_bb_show(dev, dev->config.ctx_restore_post_bb, page, SZ_4K); in ctx_restore_post_bb_show()
508 if (wa_bb->cs) in wa_bb_append()
509 wa_bb->cs[wa_bb->len] = val; in wa_bb_append()
511 wa_bb->len++; in wa_bb_append()
517 const char *p; in parse_hex() local
520 p = line + strspn(line, " \t"); in parse_hex()
521 if (!*p || *p == '\n') in parse_hex()
524 numlen = strcspn(p, " \t\n"); in parse_hex()
525 if (!numlen || numlen >= sizeof(numstr) - 1) in parse_hex()
526 return -EINVAL; in parse_hex()
528 memcpy(numstr, p, numlen); in parse_hex()
530 p += numlen; in parse_hex()
533 return -EINVAL; in parse_hex()
535 return p - line; in parse_hex()
541 * <engine-class> cmd <u32> <u32...>
542 * <engine-class> reg <u32_addr> <u32_val>
544 * and optionally save them in @wa_bb[i].cs is non-NULL.
552 const char *p; in parse_wa_bb_lines() local
554 for (p = lines; *p; p++) { in parse_wa_bb_lines()
559 p += strspn(p, " \t\n"); in parse_wa_bb_lines()
560 if (!*p) in parse_wa_bb_lines()
563 ret = parse_engine(p, " \t\n", NULL, &info); in parse_wa_bb_lines()
567 p += ret; in parse_wa_bb_lines()
568 p += strspn(p, " \t"); in parse_wa_bb_lines()
570 if (str_has_prefix(p, "cmd")) { in parse_wa_bb_lines()
571 for (p += strlen("cmd"); *p;) { in parse_wa_bb_lines()
572 ret = parse_hex(p, &val); in parse_wa_bb_lines()
574 return -EINVAL; in parse_wa_bb_lines()
578 p += ret; in parse_wa_bb_lines()
580 wa_bb_append(&wa_bb[info->engine_class], val); in parse_wa_bb_lines()
582 } else if (str_has_prefix(p, "reg")) { in parse_wa_bb_lines()
583 p += strlen("reg"); in parse_wa_bb_lines()
584 ret = parse_hex(p, &val); in parse_wa_bb_lines()
586 return -EINVAL; in parse_wa_bb_lines()
588 p += ret; in parse_wa_bb_lines()
589 ret = parse_hex(p, &val2); in parse_wa_bb_lines()
591 return -EINVAL; in parse_wa_bb_lines()
593 p += ret; in parse_wa_bb_lines()
595 wa_bb_append(&wa_bb[info->engine_class], in parse_wa_bb_lines()
597 wa_bb_append(&wa_bb[info->engine_class], val); in parse_wa_bb_lines()
598 wa_bb_append(&wa_bb[info->engine_class], val2); in parse_wa_bb_lines()
600 return -EINVAL; in parse_wa_bb_lines()
616 /* 1. Count dwords - wa_bb[i].cs is NULL for all classes */ in wa_bb_store()
621 guard(mutex)(&dev->lock); in wa_bb_store()
624 return -EBUSY; in wa_bb_store()
632 return -ENOMEM; in wa_bb_store()
660 return wa_bb_store(dev->config.ctx_restore_mid_bb, dev, data, sz); in ctx_restore_mid_bb_store()
668 return wa_bb_store(dev->config.ctx_restore_post_bb, dev, data, sz); in ctx_restore_post_bb_store()
690 mutex_destroy(&dev->lock); in xe_config_device_release()
692 kfree(dev->config.ctx_restore_post_bb[0].cs); in xe_config_device_release()
706 if (!dev->desc->is_dgfx || dev->desc->platform < XE_BATTLEMAGE) in xe_config_device_is_visible()
728 const struct pci_device_id *ids = drv ? drv->id_table : NULL; in xe_match_desc()
731 return found ? (const void *)found->driver_data : NULL; in xe_match_desc()
756 return ERR_PTR(-EINVAL); in xe_config_make_device_group()
762 return ERR_PTR(-EINVAL); in xe_config_make_device_group()
770 return ERR_PTR(-ENODEV); in xe_config_make_device_group()
772 if (PCI_DEVFN(slot, function) != pdev->devfn) { in xe_config_make_device_group()
774 vfnumber = PCI_DEVFN(slot, function) - pdev->devfn; in xe_config_make_device_group()
775 if (!dev_is_pf(&pdev->dev) || vfnumber > pci_sriov_get_totalvfs(pdev)) { in xe_config_make_device_group()
777 return ERR_PTR(-ENODEV); in xe_config_make_device_group()
782 if (match && vfnumber && !match->has_sriov) { in xe_config_make_device_group()
792 return ERR_PTR(-ENOENT); in xe_config_make_device_group()
796 return ERR_PTR(-ENOMEM); in xe_config_make_device_group()
798 dev->desc = match; in xe_config_make_device_group()
799 set_device_defaults(&dev->config); in xe_config_make_device_group()
801 config_group_init_type_name(&dev->group, name, &xe_config_device_type); in xe_config_make_device_group()
803 mutex_init(&dev->lock); in xe_config_make_device_group()
805 return &dev->group; in xe_config_make_device_group()
844 if (dev->config.attr_ != device_defaults.attr_) \ in dump_custom_dev_config()
846 dev->config.attr_); \ in dump_custom_dev_config()
857 * xe_configfs_check_device() - Test if device was configured by configfs
870 /* memcmp here is safe as both are zero-initialized */ in xe_configfs_check_device()
871 if (memcmp(&dev->config, &device_defaults, sizeof(dev->config))) { in xe_configfs_check_device()
876 config_group_put(&dev->group); in xe_configfs_check_device()
880 * xe_configfs_get_survivability_mode - get configfs survivability mode attribute
893 mode = dev->config.survivability_mode; in xe_configfs_get_survivability_mode()
894 config_group_put(&dev->group); in xe_configfs_get_survivability_mode()
900 * xe_configfs_get_engines_allowed - get engine allowed mask from configfs
913 engines_allowed = dev->config.engines_allowed; in xe_configfs_get_engines_allowed()
914 config_group_put(&dev->group); in xe_configfs_get_engines_allowed()
920 * xe_configfs_get_psmi_enabled - get configfs enable_psmi setting
933 ret = dev->config.enable_psmi; in xe_configfs_get_psmi_enabled()
934 config_group_put(&dev->group); in xe_configfs_get_psmi_enabled()
940 * xe_configfs_get_ctx_restore_mid_bb - get configfs ctx_restore_mid_bb setting
943 * @cs: pointer to the bb to use - only valid during probe
958 *cs = dev->config.ctx_restore_mid_bb[class].cs; in xe_configfs_get_ctx_restore_mid_bb()
960 len = dev->config.ctx_restore_mid_bb[class].len; in xe_configfs_get_ctx_restore_mid_bb()
961 config_group_put(&dev->group); in xe_configfs_get_ctx_restore_mid_bb()
967 * xe_configfs_get_ctx_restore_post_bb - get configfs ctx_restore_post_bb setting
970 * @cs: pointer to the bb to use - only valid during probe
984 *cs = dev->config.ctx_restore_post_bb[class].cs; in xe_configfs_get_ctx_restore_post_bb()
985 len = dev->config.ctx_restore_post_bb[class].len; in xe_configfs_get_ctx_restore_post_bb()
986 config_group_put(&dev->group); in xe_configfs_get_ctx_restore_post_bb()