hem 334 drivers/infiniband/hw/hns/hns_roce_device.h struct hns_roce_hem **hem; hem 87 drivers/infiniband/hw/hns/hns_roce_hem.c static bool hns_roce_check_hem_null(struct hns_roce_hem **hem, u64 start_idx, hem 94 drivers/infiniband/hw/hns/hns_roce_hem.c if (hem[i]) hem 283 drivers/infiniband/hw/hns/hns_roce_hem.c struct hns_roce_hem *hem; hem 290 drivers/infiniband/hw/hns/hns_roce_hem.c hem = kmalloc(sizeof(*hem), hem 292 drivers/infiniband/hw/hns/hns_roce_hem.c if (!hem) hem 295 drivers/infiniband/hw/hns/hns_roce_hem.c hem->refcount = 0; hem 296 drivers/infiniband/hw/hns/hns_roce_hem.c INIT_LIST_HEAD(&hem->chunk_list); hem 311 drivers/infiniband/hw/hns/hns_roce_hem.c list_add_tail(&chunk->list, &hem->chunk_list); hem 335 drivers/infiniband/hw/hns/hns_roce_hem.c return hem; hem 338 drivers/infiniband/hw/hns/hns_roce_hem.c hns_roce_free_hem(hr_dev, hem); hem 342 drivers/infiniband/hw/hns/hns_roce_hem.c void hns_roce_free_hem(struct hns_roce_dev *hr_dev, struct hns_roce_hem *hem) hem 347 drivers/infiniband/hw/hns/hns_roce_hem.c if (!hem) hem 350 drivers/infiniband/hw/hns/hns_roce_hem.c list_for_each_entry_safe(chunk, tmp, &hem->chunk_list, list) { hem 359 drivers/infiniband/hw/hns/hns_roce_hem.c kfree(hem); hem 399 drivers/infiniband/hw/hns/hns_roce_hem.c for (hns_roce_hem_first(table->hem[i], &iter); hem 498 drivers/infiniband/hw/hns/hns_roce_hem.c if (table->hem[hem_idx]) { hem 499 drivers/infiniband/hw/hns/hns_roce_hem.c ++table->hem[hem_idx]->refcount; hem 555 drivers/infiniband/hw/hns/hns_roce_hem.c table->hem[hem_idx] = hns_roce_alloc_hem(hr_dev, hem 560 drivers/infiniband/hw/hns/hns_roce_hem.c if (!table->hem[hem_idx]) { hem 565 drivers/infiniband/hw/hns/hns_roce_hem.c hns_roce_hem_first(table->hem[hem_idx], &iter); hem 592 drivers/infiniband/hw/hns/hns_roce_hem.c ++table->hem[hem_idx]->refcount; hem 629 drivers/infiniband/hw/hns/hns_roce_hem.c if (table->hem[i]) { hem 630 drivers/infiniband/hw/hns/hns_roce_hem.c ++table->hem[i]->refcount; hem 634 drivers/infiniband/hw/hns/hns_roce_hem.c table->hem[i] = hns_roce_alloc_hem(hr_dev, hem 639 drivers/infiniband/hw/hns/hns_roce_hem.c if (!table->hem[i]) { hem 646 drivers/infiniband/hw/hns/hns_roce_hem.c hns_roce_free_hem(hr_dev, table->hem[i]); hem 647 drivers/infiniband/hw/hns/hns_roce_hem.c table->hem[i] = NULL; hem 653 drivers/infiniband/hw/hns/hns_roce_hem.c ++table->hem[i]->refcount; hem 705 drivers/infiniband/hw/hns/hns_roce_hem.c if (check_refcount && (--table->hem[hem_idx]->refcount > 0)) { hem 726 drivers/infiniband/hw/hns/hns_roce_hem.c hns_roce_free_hem(hr_dev, table->hem[hem_idx]); hem 727 drivers/infiniband/hw/hns/hns_roce_hem.c table->hem[hem_idx] = NULL; hem 731 drivers/infiniband/hw/hns/hns_roce_hem.c if (hns_roce_check_hem_null(table->hem, start_idx, hem 745 drivers/infiniband/hw/hns/hns_roce_hem.c if (hns_roce_check_hem_null(table->hem, start_idx, hem 789 drivers/infiniband/hw/hns/hns_roce_hem.c if (--table->hem[i]->refcount == 0) { hem 794 drivers/infiniband/hw/hns/hns_roce_hem.c hns_roce_free_hem(hr_dev, table->hem[i]); hem 795 drivers/infiniband/hw/hns/hns_roce_hem.c table->hem[i] = NULL; hem 807 drivers/infiniband/hw/hns/hns_roce_hem.c struct hns_roce_hem *hem; hem 824 drivers/infiniband/hw/hns/hns_roce_hem.c hem = table->hem[(obj & (table->num_obj - 1)) / obj_per_chunk]; hem 841 drivers/infiniband/hw/hns/hns_roce_hem.c hem = table->hem[hem_idx]; hem 848 drivers/infiniband/hw/hns/hns_roce_hem.c if (!hem) hem 851 drivers/infiniband/hw/hns/hns_roce_hem.c list_for_each_entry(chunk, &hem->chunk_list, list) { hem 938 drivers/infiniband/hw/hns/hns_roce_hem.c table->hem = kcalloc(num_hem, sizeof(*table->hem), GFP_KERNEL); hem 939 drivers/infiniband/hw/hns/hns_roce_hem.c if (!table->hem) hem 963 drivers/infiniband/hw/hns/hns_roce_hem.c table->hem = kcalloc(num_hem, sizeof(*table->hem), hem 965 drivers/infiniband/hw/hns/hns_roce_hem.c if (!table->hem) hem 1024 drivers/infiniband/hw/hns/hns_roce_hem.c kfree(table->hem); hem 1025 drivers/infiniband/hw/hns/hns_roce_hem.c table->hem = NULL; hem 1046 drivers/infiniband/hw/hns/hns_roce_hem.c if (table->hem[i]) hem 1050 drivers/infiniband/hw/hns/hns_roce_hem.c kfree(table->hem); hem 1051 drivers/infiniband/hw/hns/hns_roce_hem.c table->hem = NULL; hem 1074 drivers/infiniband/hw/hns/hns_roce_hem.c if (table->hem[i]) { hem 1079 drivers/infiniband/hw/hns/hns_roce_hem.c hns_roce_free_hem(hr_dev, table->hem[i]); hem 1082 drivers/infiniband/hw/hns/hns_roce_hem.c kfree(table->hem); hem 1133 drivers/infiniband/hw/hns/hns_roce_hem.c struct roce_hem_item *hem; hem 1135 drivers/infiniband/hw/hns/hns_roce_hem.c hem = kzalloc(sizeof(*hem), GFP_KERNEL); hem 1136 drivers/infiniband/hw/hns/hns_roce_hem.c if (!hem) hem 1140 drivers/infiniband/hw/hns/hns_roce_hem.c hem->addr = dma_alloc_coherent(hr_dev->dev, hem 1142 drivers/infiniband/hw/hns/hns_roce_hem.c &hem->dma_addr, GFP_KERNEL); hem 1143 drivers/infiniband/hw/hns/hns_roce_hem.c if (!hem->addr) { hem 1144 drivers/infiniband/hw/hns/hns_roce_hem.c kfree(hem); hem 1149 drivers/infiniband/hw/hns/hns_roce_hem.c hem->count = count; hem 1150 drivers/infiniband/hw/hns/hns_roce_hem.c hem->start = start; hem 1151 drivers/infiniband/hw/hns/hns_roce_hem.c hem->end = end; hem 1152 drivers/infiniband/hw/hns/hns_roce_hem.c INIT_LIST_HEAD(&hem->list); hem 1153 drivers/infiniband/hw/hns/hns_roce_hem.c INIT_LIST_HEAD(&hem->sibling); hem 1155 drivers/infiniband/hw/hns/hns_roce_hem.c return hem; hem 1159 drivers/infiniband/hw/hns/hns_roce_hem.c struct roce_hem_item *hem, bool exist_bt) hem 1162 drivers/infiniband/hw/hns/hns_roce_hem.c dma_free_coherent(hr_dev->dev, hem->count * BA_BYTE_LEN, hem 1163 drivers/infiniband/hw/hns/hns_roce_hem.c hem->addr, hem->dma_addr); hem 1164 drivers/infiniband/hw/hns/hns_roce_hem.c kfree(hem); hem 1170 drivers/infiniband/hw/hns/hns_roce_hem.c struct roce_hem_item *hem, *temp_hem; hem 1172 drivers/infiniband/hw/hns/hns_roce_hem.c list_for_each_entry_safe(hem, temp_hem, head, list) { hem 1173 drivers/infiniband/hw/hns/hns_roce_hem.c list_del(&hem->list); hem 1174 drivers/infiniband/hw/hns/hns_roce_hem.c hem_list_free_item(hr_dev, hem, exist_bt); hem 1186 drivers/infiniband/hw/hns/hns_roce_hem.c struct roce_hem_item *hem, void *cpu_addr, hem 1189 drivers/infiniband/hw/hns/hns_roce_hem.c hem->addr = cpu_addr; hem 1190 drivers/infiniband/hw/hns/hns_roce_hem.c hem->dma_addr = (dma_addr_t)phy_addr; hem 1193 drivers/infiniband/hw/hns/hns_roce_hem.c static inline bool hem_list_page_is_in_range(struct roce_hem_item *hem, hem 1196 drivers/infiniband/hw/hns/hns_roce_hem.c return (hem->start <= offset && offset <= hem->end); hem 1202 drivers/infiniband/hw/hns/hns_roce_hem.c struct roce_hem_item *hem, *temp_hem; hem 1205 drivers/infiniband/hw/hns/hns_roce_hem.c list_for_each_entry_safe(hem, temp_hem, ba_list, list) { hem 1206 drivers/infiniband/hw/hns/hns_roce_hem.c if (hem_list_page_is_in_range(hem, page_offset)) { hem 1207 drivers/infiniband/hw/hns/hns_roce_hem.c found = hem; hem 1378 drivers/infiniband/hw/hns/hns_roce_hem.c struct roce_hem_item *hem, *temp_hem, *root_hem; hem 1426 drivers/infiniband/hw/hns/hns_roce_hem.c hem = hem_list_alloc_item(hr_dev, r->offset, hem 1429 drivers/infiniband/hw/hns/hns_roce_hem.c if (!hem) { hem 1433 drivers/infiniband/hw/hns/hns_roce_hem.c hem_list_assign_bt(hr_dev, hem, cpu_base, phy_base); hem 1434 drivers/infiniband/hw/hns/hns_roce_hem.c list_add(&hem->list, &temp_list[i]); hem 1435 drivers/infiniband/hw/hns/hns_roce_hem.c list_add(&hem->sibling, &temp_btm); hem 1444 drivers/infiniband/hw/hns/hns_roce_hem.c list_for_each_entry_safe(hem, temp_hem, hem 1446 drivers/infiniband/hw/hns/hns_roce_hem.c offset = hem->start / step * BA_BYTE_LEN; hem 1448 drivers/infiniband/hw/hns/hns_roce_hem.c hem->dma_addr); hem 1554 drivers/infiniband/hw/hns/hns_roce_hem.c struct roce_hem_item *hem, *temp_hem; hem 1559 drivers/infiniband/hw/hns/hns_roce_hem.c list_for_each_entry_safe(hem, temp_hem, head, sibling) { hem 1560 drivers/infiniband/hw/hns/hns_roce_hem.c if (hem_list_page_is_in_range(hem, offset)) { hem 1561 drivers/infiniband/hw/hns/hns_roce_hem.c nr = offset - hem->start; hem 1562 drivers/infiniband/hw/hns/hns_roce_hem.c cpu_base = hem->addr + nr * BA_BYTE_LEN; hem 1563 drivers/infiniband/hw/hns/hns_roce_hem.c phy_base = hem->dma_addr + nr * BA_BYTE_LEN; hem 1564 drivers/infiniband/hw/hns/hns_roce_hem.c nr = hem->end + 1 - offset; hem 95 drivers/infiniband/hw/hns/hns_roce_hem.h struct hns_roce_hem *hem; hem 110 drivers/infiniband/hw/hns/hns_roce_hem.h void hns_roce_free_hem(struct hns_roce_dev *hr_dev, struct hns_roce_hem *hem); hem 150 drivers/infiniband/hw/hns/hns_roce_hem.h static inline void hns_roce_hem_first(struct hns_roce_hem *hem, hem 153 drivers/infiniband/hw/hns/hns_roce_hem.h iter->hem = hem; hem 154 drivers/infiniband/hw/hns/hns_roce_hem.h iter->chunk = list_empty(&hem->chunk_list) ? NULL : hem 155 drivers/infiniband/hw/hns/hns_roce_hem.h list_entry(hem->chunk_list.next, hem 168 drivers/infiniband/hw/hns/hns_roce_hem.h if (iter->chunk->list.next == &iter->hem->chunk_list) { hem 3043 drivers/infiniband/hw/hns/hns_roce_hw_v2.c struct hns_roce_hem *hem; hem 3086 drivers/infiniband/hw/hns/hns_roce_hw_v2.c hem = table->hem[hem_idx]; hem 3087 drivers/infiniband/hw/hns/hns_roce_hw_v2.c for (hns_roce_hem_first(hem, &iter);