btt 56 arch/s390/kernel/traps.c enum bug_trap_type btt; btt 58 arch/s390/kernel/traps.c btt = report_bug(regs->psw.addr, regs); btt 59 arch/s390/kernel/traps.c if (btt == BUG_TRAP_TYPE_WARN) btt 255 drivers/nvdimm/btt.c static void btt_debugfs_init(struct btt *btt) btt 260 drivers/nvdimm/btt.c btt->debugfs_dir = debugfs_create_dir(dev_name(&btt->nd_btt->dev), btt 262 drivers/nvdimm/btt.c if (IS_ERR_OR_NULL(btt->debugfs_dir)) btt 265 drivers/nvdimm/btt.c list_for_each_entry(arena, &btt->arena_list, list) { btt 266 drivers/nvdimm/btt.c arena_debugfs_init(arena, btt->debugfs_dir, i); btt 745 drivers/nvdimm/btt.c static struct arena_info *alloc_arena(struct btt *btt, size_t size, btt 755 drivers/nvdimm/btt.c arena->nd_btt = btt->nd_btt; btt 756 drivers/nvdimm/btt.c arena->sector_size = btt->sector_size; btt 764 drivers/nvdimm/btt.c arena->external_lbasize = btt->lbasize; btt 768 drivers/nvdimm/btt.c arena->version_major = btt->nd_btt->version_major; btt 769 drivers/nvdimm/btt.c arena->version_minor = btt->nd_btt->version_minor; btt 802 drivers/nvdimm/btt.c static void free_arenas(struct btt *btt) btt 806 drivers/nvdimm/btt.c list_for_each_entry_safe(arena, next, &btt->arena_list, list) { btt 846 drivers/nvdimm/btt.c static int discover_arenas(struct btt *btt) btt 851 drivers/nvdimm/btt.c size_t remaining = btt->rawsize; btt 862 drivers/nvdimm/btt.c arena = alloc_arena(btt, 0, 0, 0); btt 873 drivers/nvdimm/btt.c if (!nd_btt_arena_is_valid(btt->nd_btt, super)) { btt 874 drivers/nvdimm/btt.c if (remaining == btt->rawsize) { btt 875 drivers/nvdimm/btt.c btt->init_state = INIT_NOTFOUND; btt 908 drivers/nvdimm/btt.c list_add_tail(&arena->list, &btt->arena_list); btt 918 drivers/nvdimm/btt.c btt->num_arenas = num_arenas; btt 919 drivers/nvdimm/btt.c btt->nlba = cur_nlba; btt 920 drivers/nvdimm/btt.c btt->init_state = INIT_READY; btt 927 drivers/nvdimm/btt.c free_arenas(btt); btt 933 drivers/nvdimm/btt.c static int create_arenas(struct btt *btt) btt 935 drivers/nvdimm/btt.c size_t remaining = btt->rawsize; btt 946 drivers/nvdimm/btt.c arena = alloc_arena(btt, arena_size, btt->nlba, cur_off); btt 948 drivers/nvdimm/btt.c free_arenas(btt); btt 951 drivers/nvdimm/btt.c btt->nlba += arena->external_nlba; btt 957 drivers/nvdimm/btt.c list_add_tail(&arena->list, &btt->arena_list); btt 1025 drivers/nvdimm/btt.c static int btt_meta_init(struct btt *btt) btt 1030 drivers/nvdimm/btt.c mutex_lock(&btt->init_lock); btt 1031 drivers/nvdimm/btt.c list_for_each_entry(arena, &btt->arena_list, list) { btt 1049 drivers/nvdimm/btt.c btt->init_state = INIT_READY; btt 1052 drivers/nvdimm/btt.c mutex_unlock(&btt->init_lock); btt 1056 drivers/nvdimm/btt.c static u32 btt_meta_size(struct btt *btt) btt 1058 drivers/nvdimm/btt.c return btt->lbasize - btt->sector_size; btt 1068 drivers/nvdimm/btt.c static int lba_to_arena(struct btt *btt, sector_t sector, __u32 *premap, btt 1072 drivers/nvdimm/btt.c __u64 lba = div_u64(sector << SECTOR_SHIFT, btt->sector_size); btt 1074 drivers/nvdimm/btt.c list_for_each_entry(arena_list, &btt->arena_list, list) { btt 1141 drivers/nvdimm/btt.c static int btt_rw_integrity(struct btt *btt, struct bio_integrity_payload *bip, btt 1144 drivers/nvdimm/btt.c unsigned int len = btt_meta_size(btt); btt 1151 drivers/nvdimm/btt.c meta_nsoff = to_namespace_offset(arena, postmap) + btt->sector_size; btt 1190 drivers/nvdimm/btt.c static int btt_rw_integrity(struct btt *btt, struct bio_integrity_payload *bip, btt 1197 drivers/nvdimm/btt.c static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip, btt 1209 drivers/nvdimm/btt.c lane = nd_region_acquire_lane(btt->nd_region); btt 1211 drivers/nvdimm/btt.c ret = lba_to_arena(btt, sector, &premap, &arena); btt 1215 drivers/nvdimm/btt.c cur_len = min(btt->sector_size, len); btt 1273 drivers/nvdimm/btt.c ret = btt_rw_integrity(btt, bip, arena, postmap, READ); btt 1279 drivers/nvdimm/btt.c nd_region_release_lane(btt->nd_region, lane); btt 1283 drivers/nvdimm/btt.c sector += btt->sector_size >> SECTOR_SHIFT; btt 1291 drivers/nvdimm/btt.c nd_region_release_lane(btt->nd_region, lane); btt 1300 drivers/nvdimm/btt.c static bool btt_is_badblock(struct btt *btt, struct arena_info *arena, btt 1307 drivers/nvdimm/btt.c return is_bad_pmem(btt->phys_bb, phys_sector, arena->internal_lbasize); btt 1310 drivers/nvdimm/btt.c static int btt_write_pg(struct btt *btt, struct bio_integrity_payload *bip, btt 1325 drivers/nvdimm/btt.c lane = nd_region_acquire_lane(btt->nd_region); btt 1327 drivers/nvdimm/btt.c ret = lba_to_arena(btt, sector, &premap, &arena); btt 1330 drivers/nvdimm/btt.c cur_len = min(btt->sector_size, len); btt 1337 drivers/nvdimm/btt.c if (btt_is_badblock(btt, arena, arena->freelist[lane].block)) btt 1342 drivers/nvdimm/btt.c nd_region_release_lane(btt->nd_region, lane); btt 1370 drivers/nvdimm/btt.c ret = btt_rw_integrity(btt, bip, arena, new_postmap, btt 1403 drivers/nvdimm/btt.c nd_region_release_lane(btt->nd_region, lane); btt 1413 drivers/nvdimm/btt.c sector += btt->sector_size >> SECTOR_SHIFT; btt 1421 drivers/nvdimm/btt.c nd_region_release_lane(btt->nd_region, lane); btt 1425 drivers/nvdimm/btt.c static int btt_do_bvec(struct btt *btt, struct bio_integrity_payload *bip, btt 1432 drivers/nvdimm/btt.c ret = btt_read_pg(btt, bip, page, off, sector, len); btt 1436 drivers/nvdimm/btt.c ret = btt_write_pg(btt, bip, sector, page, off, len); btt 1445 drivers/nvdimm/btt.c struct btt *btt = q->queuedata; btt 1459 drivers/nvdimm/btt.c if (len > PAGE_SIZE || len < btt->sector_size || btt 1460 drivers/nvdimm/btt.c len % btt->sector_size) { btt 1461 drivers/nvdimm/btt.c dev_err_ratelimited(&btt->nd_btt->dev, btt 1467 drivers/nvdimm/btt.c err = btt_do_bvec(btt, bip, bvec.bv_page, len, bvec.bv_offset, btt 1470 drivers/nvdimm/btt.c dev_err(&btt->nd_btt->dev, btt 1489 drivers/nvdimm/btt.c struct btt *btt = bdev->bd_disk->private_data; btt 1494 drivers/nvdimm/btt.c rc = btt_do_bvec(btt, NULL, page, len, 0, op, sector); btt 1518 drivers/nvdimm/btt.c static int btt_blk_init(struct btt *btt) btt 1520 drivers/nvdimm/btt.c struct nd_btt *nd_btt = btt->nd_btt; btt 1524 drivers/nvdimm/btt.c btt->btt_queue = blk_alloc_queue(GFP_KERNEL); btt 1525 drivers/nvdimm/btt.c if (!btt->btt_queue) btt 1528 drivers/nvdimm/btt.c btt->btt_disk = alloc_disk(0); btt 1529 drivers/nvdimm/btt.c if (!btt->btt_disk) { btt 1530 drivers/nvdimm/btt.c blk_cleanup_queue(btt->btt_queue); btt 1534 drivers/nvdimm/btt.c nvdimm_namespace_disk_name(ndns, btt->btt_disk->disk_name); btt 1535 drivers/nvdimm/btt.c btt->btt_disk->first_minor = 0; btt 1536 drivers/nvdimm/btt.c btt->btt_disk->fops = &btt_fops; btt 1537 drivers/nvdimm/btt.c btt->btt_disk->private_data = btt; btt 1538 drivers/nvdimm/btt.c btt->btt_disk->queue = btt->btt_queue; btt 1539 drivers/nvdimm/btt.c btt->btt_disk->flags = GENHD_FL_EXT_DEVT; btt 1540 drivers/nvdimm/btt.c btt->btt_disk->queue->backing_dev_info->capabilities |= btt 1543 drivers/nvdimm/btt.c blk_queue_make_request(btt->btt_queue, btt_make_request); btt 1544 drivers/nvdimm/btt.c blk_queue_logical_block_size(btt->btt_queue, btt->sector_size); btt 1545 drivers/nvdimm/btt.c blk_queue_max_hw_sectors(btt->btt_queue, UINT_MAX); btt 1546 drivers/nvdimm/btt.c blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_queue); btt 1547 drivers/nvdimm/btt.c btt->btt_queue->queuedata = btt; btt 1549 drivers/nvdimm/btt.c if (btt_meta_size(btt)) { btt 1550 drivers/nvdimm/btt.c int rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt)); btt 1553 drivers/nvdimm/btt.c del_gendisk(btt->btt_disk); btt 1554 drivers/nvdimm/btt.c put_disk(btt->btt_disk); btt 1555 drivers/nvdimm/btt.c blk_cleanup_queue(btt->btt_queue); btt 1559 drivers/nvdimm/btt.c set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9); btt 1560 drivers/nvdimm/btt.c device_add_disk(&btt->nd_btt->dev, btt->btt_disk, NULL); btt 1561 drivers/nvdimm/btt.c btt->nd_btt->size = btt->nlba * (u64)btt->sector_size; btt 1562 drivers/nvdimm/btt.c revalidate_disk(btt->btt_disk); btt 1567 drivers/nvdimm/btt.c static void btt_blk_cleanup(struct btt *btt) btt 1569 drivers/nvdimm/btt.c del_gendisk(btt->btt_disk); btt 1570 drivers/nvdimm/btt.c put_disk(btt->btt_disk); btt 1571 drivers/nvdimm/btt.c blk_cleanup_queue(btt->btt_queue); btt 1591 drivers/nvdimm/btt.c static struct btt *btt_init(struct nd_btt *nd_btt, unsigned long long rawsize, btt 1595 drivers/nvdimm/btt.c struct btt *btt; btt 1599 drivers/nvdimm/btt.c btt = devm_kzalloc(dev, sizeof(struct btt), GFP_KERNEL); btt 1600 drivers/nvdimm/btt.c if (!btt) btt 1603 drivers/nvdimm/btt.c btt->nd_btt = nd_btt; btt 1604 drivers/nvdimm/btt.c btt->rawsize = rawsize; btt 1605 drivers/nvdimm/btt.c btt->lbasize = lbasize; btt 1606 drivers/nvdimm/btt.c btt->sector_size = ((lbasize >= 4096) ? 4096 : 512); btt 1607 drivers/nvdimm/btt.c INIT_LIST_HEAD(&btt->arena_list); btt 1608 drivers/nvdimm/btt.c mutex_init(&btt->init_lock); btt 1609 drivers/nvdimm/btt.c btt->nd_region = nd_region; btt 1611 drivers/nvdimm/btt.c btt->phys_bb = &nsio->bb; btt 1613 drivers/nvdimm/btt.c ret = discover_arenas(btt); btt 1619 drivers/nvdimm/btt.c if (btt->init_state != INIT_READY && nd_region->ro) { btt 1623 drivers/nvdimm/btt.c } else if (btt->init_state != INIT_READY) { btt 1624 drivers/nvdimm/btt.c btt->num_arenas = (rawsize / ARENA_MAX_SIZE) + btt 1627 drivers/nvdimm/btt.c btt->num_arenas, rawsize); btt 1629 drivers/nvdimm/btt.c ret = create_arenas(btt); btt 1635 drivers/nvdimm/btt.c ret = btt_meta_init(btt); btt 1642 drivers/nvdimm/btt.c ret = btt_blk_init(btt); btt 1648 drivers/nvdimm/btt.c btt_debugfs_init(btt); btt 1650 drivers/nvdimm/btt.c return btt; btt 1662 drivers/nvdimm/btt.c static void btt_fini(struct btt *btt) btt 1664 drivers/nvdimm/btt.c if (btt) { btt 1665 drivers/nvdimm/btt.c btt_blk_cleanup(btt); btt 1666 drivers/nvdimm/btt.c free_arenas(btt); btt 1667 drivers/nvdimm/btt.c debugfs_remove_recursive(btt->debugfs_dir); btt 1676 drivers/nvdimm/btt.c struct btt *btt; btt 1704 drivers/nvdimm/btt.c btt = btt_init(nd_btt, rawsize, nd_btt->lbasize, nd_btt->uuid, btt 1706 drivers/nvdimm/btt.c if (!btt) btt 1708 drivers/nvdimm/btt.c nd_btt->btt = btt; btt 1716 drivers/nvdimm/btt.c struct btt *btt = nd_btt->btt; btt 1718 drivers/nvdimm/btt.c btt_fini(btt); btt 1719 drivers/nvdimm/btt.c nd_btt->btt = NULL; btt 180 drivers/nvdimm/nd.h struct btt; btt 184 drivers/nvdimm/nd.h struct btt *btt; btt 1021 drivers/scsi/aic7xxx/aic79xx.h uint8_t *btt;