Lines Matching refs:bbm

221 		} bbm;  member
344 return addr / vm->bbm.bb_size; in virtio_mem_phys_to_bb_id()
353 return bb_id * vm->bbm.bb_size; in virtio_mem_bb_id_to_phys()
375 const unsigned long idx = bb_id - vm->bbm.first_bb_id; in virtio_mem_bbm_set_bb_state()
378 old_state = vm->bbm.bb_states[idx]; in virtio_mem_bbm_set_bb_state()
379 vm->bbm.bb_states[idx] = state; in virtio_mem_bbm_set_bb_state()
381 BUG_ON(vm->bbm.bb_count[old_state] == 0); in virtio_mem_bbm_set_bb_state()
382 vm->bbm.bb_count[old_state]--; in virtio_mem_bbm_set_bb_state()
383 vm->bbm.bb_count[state]++; in virtio_mem_bbm_set_bb_state()
392 return vm->bbm.bb_states[bb_id - vm->bbm.first_bb_id]; in virtio_mem_bbm_get_bb_state()
400 unsigned long old_bytes = vm->bbm.next_bb_id - vm->bbm.first_bb_id; in virtio_mem_bbm_bb_states_prepare_next_bb()
406 if (vm->bbm.bb_states && old_pages == new_pages) in virtio_mem_bbm_bb_states_prepare_next_bb()
414 if (vm->bbm.bb_states) in virtio_mem_bbm_bb_states_prepare_next_bb()
415 memcpy(new_array, vm->bbm.bb_states, old_pages * PAGE_SIZE); in virtio_mem_bbm_bb_states_prepare_next_bb()
416 vfree(vm->bbm.bb_states); in virtio_mem_bbm_bb_states_prepare_next_bb()
417 vm->bbm.bb_states = new_array; in virtio_mem_bbm_bb_states_prepare_next_bb()
424 for (_bb_id = vm->bbm.first_bb_id; \
425 _bb_id < vm->bbm.next_bb_id && _vm->bbm.bb_count[_state]; \
430 for (_bb_id = vm->bbm.next_bb_id - 1; \
431 _bb_id >= vm->bbm.first_bb_id && _vm->bbm.bb_count[_state]; \
684 const uint64_t size = vm->bbm.bb_size; in virtio_mem_bbm_add_bb()
816 const uint64_t size = vm->bbm.bb_size; in virtio_mem_bbm_offline_and_remove_bb()
1561 const uint64_t size = vm->bbm.bb_size; in virtio_mem_bbm_unplug_bb()
1574 const uint64_t size = vm->bbm.bb_size; in virtio_mem_bbm_plug_bb()
1862 if (vm->bbm.next_bb_id > vm->bbm.last_usable_bb_id) in virtio_mem_bbm_prepare_next_bb()
1870 vm->bbm.bb_count[VIRTIO_MEM_BBM_BB_UNUSED]++; in virtio_mem_bbm_prepare_next_bb()
1871 *bb_id = vm->bbm.next_bb_id; in virtio_mem_bbm_prepare_next_bb()
1872 vm->bbm.next_bb_id++; in virtio_mem_bbm_prepare_next_bb()
1878 uint64_t nb_bb = diff / vm->bbm.bb_size; in virtio_mem_bbm_plug_request()
1887 if (!virtio_mem_could_add_memory(vm, vm->bbm.bb_size)) in virtio_mem_bbm_plug_request()
1900 if (!virtio_mem_could_add_memory(vm, vm->bbm.bb_size)) in virtio_mem_bbm_plug_request()
2160 const unsigned long nr_pages = PFN_DOWN(vm->bbm.bb_size); in virtio_mem_bbm_offline_remove_and_unplug_bb()
2226 const unsigned long nr_pages = PFN_DOWN(vm->bbm.bb_size); in virtio_mem_bbm_bb_is_offline()
2245 const unsigned long nr_pages = PFN_DOWN(vm->bbm.bb_size); in virtio_mem_bbm_bb_is_movable()
2263 uint64_t nb_bb = diff / vm->bbm.bb_size; in virtio_mem_bbm_unplug_request()
2390 vm->bbm.last_usable_bb_id = virtio_mem_phys_to_bb_id(vm, in virtio_mem_refresh_config()
2392 if (!IS_ALIGNED(end_addr + 1, vm->bbm.bb_size)) in virtio_mem_refresh_config()
2393 vm->bbm.last_usable_bb_id--; in virtio_mem_refresh_config()
2576 vm->bbm.bb_size = max_t(uint64_t, vm->device_block_size, in virtio_mem_init_hotplug()
2583 } else if (bbm_block_size < vm->bbm.bb_size) { in virtio_mem_init_hotplug()
2587 vm->bbm.bb_size = bbm_block_size; in virtio_mem_init_hotplug()
2593 vm->bbm.bb_size - 1; in virtio_mem_init_hotplug()
2594 vm->bbm.first_bb_id = virtio_mem_phys_to_bb_id(vm, addr); in virtio_mem_init_hotplug()
2595 vm->bbm.next_bb_id = vm->bbm.first_bb_id; in virtio_mem_init_hotplug()
2598 vm->offline_threshold = max_t(uint64_t, 2 * vm->bbm.bb_size, in virtio_mem_init_hotplug()
2609 (unsigned long long)vm->bbm.bb_size); in virtio_mem_init_hotplug()
2620 unit_pages = PHYS_PFN(vm->bbm.bb_size); in virtio_mem_init_hotplug()
2953 vfree(vm->bbm.bb_states); in virtio_mem_deinit_hotplug()