Lines Matching refs:cxled

134 		struct cxl_endpoint_decoder *cxled = p->targets[i];  in cxl_region_decode_reset()  local
135 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in cxl_region_decode_reset()
136 struct cxl_port *iter = cxled_to_port(cxled); in cxl_region_decode_reset()
156 rc = cxled->cxld.reset(&cxled->cxld); in cxl_region_decode_reset()
186 struct cxl_endpoint_decoder *cxled = p->targets[i]; in cxl_region_decode_commit() local
187 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in cxl_region_decode_commit()
194 for (iter = cxled_to_port(cxled); !is_cxl_root(iter); in cxl_region_decode_commit()
213 cxled->cxld.reset(&cxled->cxld); in cxl_region_decode_commit()
624 struct cxl_endpoint_decoder *cxled; in show_targetN() local
638 cxled = p->targets[pos]; in show_targetN()
639 if (!cxled) in show_targetN()
642 rc = sysfs_emit(buf, "%s\n", dev_name(&cxled->cxld.dev)); in show_targetN()
760 struct cxl_endpoint_decoder *cxled) in cxl_rr_ep_add() argument
766 struct cxl_ep *ep = cxl_ep_load(port, cxled_to_memdev(cxled)); in cxl_rr_ep_add()
769 rc = xa_insert(&cxl_rr->endpoints, (unsigned long)cxled, ep, in cxl_rr_ep_add()
785 struct cxl_endpoint_decoder *cxled, in cxl_rr_alloc_decoder() argument
790 if (port == cxled_to_port(cxled)) in cxl_rr_alloc_decoder()
791 cxld = &cxled->cxld; in cxl_rr_alloc_decoder()
837 struct cxl_endpoint_decoder *cxled, int pos) in cxl_port_attach_region() argument
839 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in cxl_port_attach_region()
887 rc = cxl_rr_alloc_decoder(port, cxlr, cxled, cxl_rr); in cxl_port_attach_region()
893 rc = cxl_rr_ep_add(cxl_rr, cxled); in cxl_port_attach_region()
906 dev_name(&cxled->cxld.dev), pos, in cxl_port_attach_region()
923 struct cxl_endpoint_decoder *cxled) in cxl_port_detach_region() argument
938 if (cxl_rr->decoder == &cxled->cxld) in cxl_port_detach_region()
941 ep = xa_erase(&cxl_rr->endpoints, (unsigned long)cxled); in cxl_port_detach_region()
962 static int check_last_peer(struct cxl_endpoint_decoder *cxled, in check_last_peer() argument
966 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in check_last_peer()
973 int pos = cxled->pos; in check_last_peer()
983 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), pos); in check_last_peer()
993 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), pos, in check_last_peer()
1004 struct cxl_endpoint_decoder *cxled) in cxl_port_setup_targets() argument
1007 int parent_iw, parent_ig, ig, iw, rc, inc = 0, pos = cxled->pos; in cxl_port_setup_targets()
1010 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in cxl_port_setup_targets()
1043 rc = check_last_peer(cxled, ep, cxl_rr, in cxl_port_setup_targets()
1152 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), pos); in cxl_port_setup_targets()
1172 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), pos); in cxl_port_setup_targets()
1201 struct cxl_endpoint_decoder *cxled; in cxl_region_teardown_targets() local
1215 cxled = p->targets[i]; in cxl_region_teardown_targets()
1216 cxlmd = cxled_to_memdev(cxled); in cxl_region_teardown_targets()
1218 iter = cxled_to_port(cxled); in cxl_region_teardown_targets()
1231 struct cxl_endpoint_decoder *cxled; in cxl_region_setup_targets() local
1238 cxled = p->targets[i]; in cxl_region_setup_targets()
1239 cxlmd = cxled_to_memdev(cxled); in cxl_region_setup_targets()
1241 iter = cxled_to_port(cxled); in cxl_region_setup_targets()
1251 rc = cxl_port_setup_targets(iter, cxlr, cxled); in cxl_region_setup_targets()
1263 struct cxl_endpoint_decoder *cxled, in cxl_region_validate_position() argument
1266 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in cxl_region_validate_position()
1276 if (p->targets[pos] == cxled) in cxl_region_validate_position()
1312 struct cxl_endpoint_decoder *cxled, in cxl_region_attach_position() argument
1315 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in cxl_region_attach_position()
1321 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), in cxl_region_attach_position()
1326 for (iter = cxled_to_port(cxled); !is_cxl_root(iter); in cxl_region_attach_position()
1328 rc = cxl_port_attach_region(iter, cxlr, cxled, pos); in cxl_region_attach_position()
1336 for (iter = cxled_to_port(cxled); !is_cxl_root(iter); in cxl_region_attach_position()
1338 cxl_port_detach_region(iter, cxlr, cxled); in cxl_region_attach_position()
1343 struct cxl_endpoint_decoder *cxled, int pos) in cxl_region_attach_auto() argument
1347 if (cxled->state != CXL_DECODER_STATE_AUTO) { in cxl_region_attach_auto()
1350 dev_name(&cxled->cxld.dev)); in cxl_region_attach_auto()
1356 dev_name(&cxled->cxld.dev), pos); in cxl_region_attach_auto()
1362 dev_name(&cxled->cxld.dev)); in cxl_region_attach_auto()
1373 p->targets[pos] = cxled; in cxl_region_attach_auto()
1374 cxled->pos = pos; in cxl_region_attach_auto()
1389 struct cxl_endpoint_decoder *cxled = data; in decoder_match_range() local
1396 return range_contains(&cxlsd->cxld.hpa_range, &cxled->cxld.hpa_range); in decoder_match_range()
1510 struct cxl_endpoint_decoder *cxled = p->targets[i]; in cxl_region_sort_targets() local
1518 if (cxled->pos < 0) in cxl_region_sort_targets()
1520 cxled->pos = i; in cxl_region_sort_targets()
1528 struct cxl_endpoint_decoder *cxled, int pos) in cxl_region_attach() argument
1531 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in cxl_region_attach()
1537 if (cxled->mode != cxlr->mode) { in cxl_region_attach()
1539 dev_name(&cxled->cxld.dev), cxlr->mode, cxled->mode); in cxl_region_attach()
1543 if (cxled->mode == CXL_DECODER_DEAD) { in cxl_region_attach()
1544 dev_dbg(&cxlr->dev, "%s dead\n", dev_name(&cxled->cxld.dev)); in cxl_region_attach()
1557 ep_port = cxled_to_port(cxled); in cxl_region_attach()
1562 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), in cxl_region_attach()
1567 if (cxled->cxld.target_type != cxlr->type) { in cxl_region_attach()
1569 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), in cxl_region_attach()
1570 cxled->cxld.target_type, cxlr->type); in cxl_region_attach()
1574 if (!cxled->dpa_res) { in cxl_region_attach()
1576 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev)); in cxl_region_attach()
1580 if (resource_size(cxled->dpa_res) * p->interleave_ways != in cxl_region_attach()
1584 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), in cxl_region_attach()
1585 (u64)resource_size(cxled->dpa_res), p->interleave_ways, in cxl_region_attach()
1593 rc = cxl_region_attach_auto(cxlr, cxled, pos); in cxl_region_attach()
1611 cxled = p->targets[i]; in cxl_region_attach()
1612 ep_port = cxled_to_port(cxled); in cxl_region_attach()
1615 rc = cxl_region_attach_position(cxlr, cxlrd, cxled, in cxl_region_attach()
1634 rc = cxl_region_validate_position(cxlr, cxled, pos); in cxl_region_attach()
1638 rc = cxl_region_attach_position(cxlr, cxlrd, cxled, dport, pos); in cxl_region_attach()
1642 p->targets[pos] = cxled; in cxl_region_attach()
1643 cxled->pos = pos; in cxl_region_attach()
1653 cxled->cxld.interleave_ways = p->interleave_ways; in cxl_region_attach()
1654 cxled->cxld.interleave_granularity = p->interleave_granularity; in cxl_region_attach()
1655 cxled->cxld.hpa_range = (struct range) { in cxl_region_attach()
1664 cxled->pos = -1; in cxl_region_attach()
1669 static int cxl_region_detach(struct cxl_endpoint_decoder *cxled) in cxl_region_detach() argument
1671 struct cxl_port *iter, *ep_port = cxled_to_port(cxled); in cxl_region_detach()
1672 struct cxl_region *cxlr = cxled->cxld.region; in cxl_region_detach()
1697 cxl_port_detach_region(iter, cxlr, cxled); in cxl_region_detach()
1699 if (cxled->pos < 0 || cxled->pos >= p->interleave_ways || in cxl_region_detach()
1700 p->targets[cxled->pos] != cxled) { in cxl_region_detach()
1701 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in cxl_region_detach()
1704 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), in cxl_region_detach()
1705 cxled->pos); in cxl_region_detach()
1713 p->targets[cxled->pos] = NULL; in cxl_region_detach()
1715 cxled->cxld.hpa_range = (struct range) { in cxl_region_detach()
1729 void cxl_decoder_kill_region(struct cxl_endpoint_decoder *cxled) in cxl_decoder_kill_region() argument
1732 cxled->mode = CXL_DECODER_DEAD; in cxl_decoder_kill_region()
1733 cxl_region_detach(cxled); in cxl_decoder_kill_region()
1738 struct cxl_endpoint_decoder *cxled, int pos, in attach_target() argument
1751 rc = cxl_region_attach(cxlr, cxled, pos); in attach_target()
2245 struct cxl_endpoint_decoder *cxled = p->targets[i]; in cxl_pmem_region_alloc() local
2246 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in cxl_pmem_region_alloc()
2263 m->start = cxled->dpa_res->start; in cxl_pmem_region_alloc()
2264 m->size = resource_size(cxled->dpa_res); in cxl_pmem_region_alloc()
2508 struct cxl_endpoint_decoder *cxled) in construct_region() argument
2510 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in construct_region()
2512 struct range *hpa = &cxled->cxld.hpa_range; in construct_region()
2519 cxlr = __create_region(cxlrd, cxled->mode, in construct_region()
2526 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), in construct_region()
2536 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), in construct_region()
2560 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), in construct_region()
2565 p->interleave_ways = cxled->cxld.interleave_ways; in construct_region()
2566 p->interleave_granularity = cxled->cxld.interleave_granularity; in construct_region()
2574 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), __func__, in construct_region()
2590 int cxl_add_to_region(struct cxl_port *root, struct cxl_endpoint_decoder *cxled) in cxl_add_to_region() argument
2592 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled); in cxl_add_to_region()
2593 struct range *hpa = &cxled->cxld.hpa_range; in cxl_add_to_region()
2594 struct cxl_decoder *cxld = &cxled->cxld; in cxl_add_to_region()
2622 cxlr = construct_region(cxlrd, cxled); in cxl_add_to_region()
2632 attach_target(cxlr, cxled, -1, TASK_UNINTERRUPTIBLE); in cxl_add_to_region()