Lines Matching full:bbm

50  * * Big Block Mode (BBM): A Big Block (BB) spans 1..X Linux memory blocks.
86 * State of a Big Block (BB) in BBM, covering 1..X Linux memory blocks.
154 /* If set, the driver is in SBM, otherwise in BBM. */
219 } bbm; member
224 * sbm.sb_states, bbm.bb_count, and bbm.bb_states
339 return addr / vm->bbm.bb_size; in virtio_mem_phys_to_bb_id()
348 return bb_id * vm->bbm.bb_size; in virtio_mem_bb_id_to_phys()
370 const unsigned long idx = bb_id - vm->bbm.first_bb_id; in virtio_mem_bbm_set_bb_state()
373 old_state = vm->bbm.bb_states[idx]; in virtio_mem_bbm_set_bb_state()
374 vm->bbm.bb_states[idx] = state; in virtio_mem_bbm_set_bb_state()
376 BUG_ON(vm->bbm.bb_count[old_state] == 0); in virtio_mem_bbm_set_bb_state()
377 vm->bbm.bb_count[old_state]--; in virtio_mem_bbm_set_bb_state()
378 vm->bbm.bb_count[state]++; in virtio_mem_bbm_set_bb_state()
387 return vm->bbm.bb_states[bb_id - vm->bbm.first_bb_id]; in virtio_mem_bbm_get_bb_state()
395 unsigned long old_bytes = vm->bbm.next_bb_id - vm->bbm.first_bb_id; in virtio_mem_bbm_bb_states_prepare_next_bb()
401 if (vm->bbm.bb_states && old_pages == new_pages) in virtio_mem_bbm_bb_states_prepare_next_bb()
409 if (vm->bbm.bb_states) in virtio_mem_bbm_bb_states_prepare_next_bb()
410 memcpy(new_array, vm->bbm.bb_states, old_pages * PAGE_SIZE); in virtio_mem_bbm_bb_states_prepare_next_bb()
411 vfree(vm->bbm.bb_states); in virtio_mem_bbm_bb_states_prepare_next_bb()
412 vm->bbm.bb_states = new_array; in virtio_mem_bbm_bb_states_prepare_next_bb()
419 for (_bb_id = vm->bbm.first_bb_id; \
420 _bb_id < vm->bbm.next_bb_id && _vm->bbm.bb_count[_state]; \
425 for (_bb_id = vm->bbm.next_bb_id - 1; \
426 _bb_id >= vm->bbm.first_bb_id && _vm->bbm.bb_count[_state]; \
679 const uint64_t size = vm->bbm.bb_size; in virtio_mem_bbm_add_bb()
811 const uint64_t size = vm->bbm.bb_size; in virtio_mem_bbm_offline_and_remove_bb()
1010 * In BBM, we only care about onlining/offlining happening in virtio_mem_memory_notifier_cb()
1538 const uint64_t size = vm->bbm.bb_size; in virtio_mem_bbm_unplug_bb()
1551 const uint64_t size = vm->bbm.bb_size; in virtio_mem_bbm_plug_bb()
1839 if (vm->bbm.next_bb_id > vm->bbm.last_usable_bb_id) in virtio_mem_bbm_prepare_next_bb()
1847 vm->bbm.bb_count[VIRTIO_MEM_BBM_BB_UNUSED]++; in virtio_mem_bbm_prepare_next_bb()
1848 *bb_id = vm->bbm.next_bb_id; in virtio_mem_bbm_prepare_next_bb()
1849 vm->bbm.next_bb_id++; in virtio_mem_bbm_prepare_next_bb()
1855 uint64_t nb_bb = diff / vm->bbm.bb_size; in virtio_mem_bbm_plug_request()
1864 if (!virtio_mem_could_add_memory(vm, vm->bbm.bb_size)) in virtio_mem_bbm_plug_request()
1877 if (!virtio_mem_could_add_memory(vm, vm->bbm.bb_size)) in virtio_mem_bbm_plug_request()
2137 const unsigned long nr_pages = PFN_DOWN(vm->bbm.bb_size); in virtio_mem_bbm_offline_remove_and_unplug_bb()
2203 const unsigned long nr_pages = PFN_DOWN(vm->bbm.bb_size); in virtio_mem_bbm_bb_is_offline()
2222 const unsigned long nr_pages = PFN_DOWN(vm->bbm.bb_size); in virtio_mem_bbm_bb_is_movable()
2240 uint64_t nb_bb = diff / vm->bbm.bb_size; in virtio_mem_bbm_unplug_request()
2367 vm->bbm.last_usable_bb_id = virtio_mem_phys_to_bb_id(vm, in virtio_mem_refresh_config()
2369 if (!IS_ALIGNED(end_addr + 1, vm->bbm.bb_size)) in virtio_mem_refresh_config()
2370 vm->bbm.last_usable_bb_id--; in virtio_mem_refresh_config()
2552 /* BBM: At least one Linux memory block. */ in virtio_mem_init_hotplug()
2553 vm->bbm.bb_size = max_t(uint64_t, vm->device_block_size, in virtio_mem_init_hotplug()
2560 } else if (bbm_block_size < vm->bbm.bb_size) { in virtio_mem_init_hotplug()
2564 vm->bbm.bb_size = bbm_block_size; in virtio_mem_init_hotplug()
2570 vm->bbm.bb_size - 1; in virtio_mem_init_hotplug()
2571 vm->bbm.first_bb_id = virtio_mem_phys_to_bb_id(vm, addr); in virtio_mem_init_hotplug()
2572 vm->bbm.next_bb_id = vm->bbm.first_bb_id; in virtio_mem_init_hotplug()
2575 vm->offline_threshold = max_t(uint64_t, 2 * vm->bbm.bb_size, in virtio_mem_init_hotplug()
2586 (unsigned long long)vm->bbm.bb_size); in virtio_mem_init_hotplug()
2597 unit_pages = PHYS_PFN(vm->bbm.bb_size); in virtio_mem_init_hotplug()
2921 vfree(vm->bbm.bb_states); in virtio_mem_deinit_hotplug()