Lines Matching +full:1 +full:ms
49 return 1; in memory_device_addr_sort()
51 return -1; in memory_device_addr_sort()
78 return 1; in memory_device_get_memslots()
85 static unsigned int get_reserved_memslots(MachineState *ms) in get_reserved_memslots() argument
87 if (ms->device_memory->used_memslots > in get_reserved_memslots()
88 ms->device_memory->required_memslots) { in get_reserved_memslots()
92 return ms->device_memory->required_memslots - in get_reserved_memslots()
93 ms->device_memory->used_memslots; in get_reserved_memslots()
113 static unsigned int memory_device_memslot_decision_limit(MachineState *ms, in memory_device_memslot_decision_limit() argument
116 const unsigned int reserved = get_reserved_memslots(ms); in memory_device_memslot_decision_limit()
133 return 1; in memory_device_memslot_decision_limit()
141 ms->device_memory->required_memslots) { in memory_device_memslot_decision_limit()
142 return 1; in memory_device_memslot_decision_limit()
145 ms->device_memory->required_memslots; in memory_device_memslot_decision_limit()
154 if (memslots < 1 || unlikely(free < reserved)) { in memory_device_memslot_decision_limit()
155 return 1; in memory_device_memslot_decision_limit()
159 if (size == ms->maxram_size - ms->ram_size) { in memory_device_memslot_decision_limit()
167 available_space = ms->maxram_size - ms->ram_size - in memory_device_memslot_decision_limit()
168 ms->device_memory->used_region_size; in memory_device_memslot_decision_limit()
170 return memslots < 1 ? 1 : memslots; in memory_device_memslot_decision_limit()
173 static void memory_device_check_addable(MachineState *ms, MemoryDeviceState *md, in memory_device_check_addable() argument
177 const uint64_t used_region_size = ms->device_memory->used_region_size; in memory_device_check_addable()
179 const unsigned int reserved_memslots = get_reserved_memslots(ms); in memory_device_check_addable()
187 memslot_limit = memory_device_memslot_decision_limit(ms, mr); in memory_device_check_addable()
205 used_region_size + size > ms->maxram_size - ms->ram_size) { in memory_device_check_addable()
208 used_region_size, ms->maxram_size - ms->ram_size); in memory_device_check_addable()
214 static uint64_t memory_device_get_free_addr(MachineState *ms, in memory_device_get_free_addr() argument
222 range_init_nofail(&as, ms->device_memory->base, in memory_device_get_free_addr()
223 memory_region_size(&ms->device_memory->mr)); in memory_device_get_free_addr()
255 object_child_foreach(OBJECT(ms), memory_device_build_list, &list); in memory_device_get_free_addr()
277 next_addr = QEMU_ALIGN_UP(range_upb(&tmp) + 1, align); in memory_device_get_free_addr()
307 MemoryDeviceInfo *info = g_new0(MemoryDeviceInfo, 1); in qmp_memory_device_list()
347 void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms, in memory_device_pre_plug() argument
360 if (!ms->device_memory) { in memory_device_pre_plug()
372 memory_device_check_addable(ms, md, mr, &local_err); in memory_device_pre_plug()
379 * region alignment: for example, DIMMs with 1G+1byte size don't make in memory_device_pre_plug()
396 addr = memory_device_get_free_addr(ms, !addr ? NULL : &addr, align, in memory_device_pre_plug()
410 void memory_device_plug(MemoryDeviceState *md, MachineState *ms) in memory_device_plug() argument
429 g_assert(ms->device_memory); in memory_device_plug()
431 ms->device_memory->used_region_size += memory_region_size(mr); in memory_device_plug()
432 ms->device_memory->required_memslots += memslots; in memory_device_plug()
433 if (mdc->decide_memslots && memslots > 1) { in memory_device_plug()
434 ms->device_memory->memslot_auto_decision_active++; in memory_device_plug()
437 memory_region_add_subregion(&ms->device_memory->mr, in memory_device_plug()
438 addr - ms->device_memory->base, mr); in memory_device_plug()
442 void memory_device_unplug(MemoryDeviceState *md, MachineState *ms) in memory_device_unplug() argument
457 g_assert(ms->device_memory); in memory_device_unplug()
459 memory_region_del_subregion(&ms->device_memory->mr, mr); in memory_device_unplug()
461 if (mdc->decide_memslots && memslots > 1) { in memory_device_unplug()
462 ms->device_memory->memslot_auto_decision_active--; in memory_device_unplug()
464 ms->device_memory->used_region_size -= memory_region_size(mr); in memory_device_unplug()
465 ms->device_memory->required_memslots -= memslots; in memory_device_unplug()
510 dms->used_memslots += add ? 1 : -1; in memory_devices_region_mod()
529 void machine_memory_devices_init(MachineState *ms, hwaddr base, uint64_t size) in machine_memory_devices_init() argument
532 g_assert(!ms->device_memory); in machine_memory_devices_init()
533 ms->device_memory = g_new0(DeviceMemoryState, 1); in machine_memory_devices_init()
534 ms->device_memory->base = base; in machine_memory_devices_init()
536 memory_region_init(&ms->device_memory->mr, OBJECT(ms), "device-memory", in machine_memory_devices_init()
538 address_space_init(&ms->device_memory->as, &ms->device_memory->mr, in machine_memory_devices_init()
540 memory_region_add_subregion(get_system_memory(), ms->device_memory->base, in machine_memory_devices_init()
541 &ms->device_memory->mr); in machine_memory_devices_init()
544 ms->device_memory->listener.region_add = memory_devices_region_add; in machine_memory_devices_init()
545 ms->device_memory->listener.region_del = memory_devices_region_del; in machine_memory_devices_init()
546 memory_listener_register(&ms->device_memory->listener, in machine_memory_devices_init()
547 &ms->device_memory->as); in machine_memory_devices_init()