Lines Matching refs:dm

580 static void post_status(struct hv_dynmem_device *dm);
996 struct hv_dynmem_device *dm = &dm_device; in hot_add_req() local
1003 pg_start = dm->ha_wrk.ha_page_range.finfo.start_page; in hot_add_req()
1004 pfn_cnt = dm->ha_wrk.ha_page_range.finfo.page_cnt; in hot_add_req()
1006 rg_start = dm->ha_wrk.ha_region_range.finfo.start_page; in hot_add_req()
1007 rg_sz = dm->ha_wrk.ha_region_range.finfo.page_cnt; in hot_add_req()
1009 if ((rg_start == 0) && (!dm->host_specified_ha_region)) { in hot_add_req()
1034 dm->num_pages_added += resp.page_count; in hot_add_req()
1066 dm->state = DM_INITIALIZED; in hot_add_req()
1068 vmbus_sendpacket(dm->dev->channel, &resp, in hot_add_req()
1074 static void process_info(struct hv_dynmem_device *dm, struct dm_info_msg *msg) in process_info() argument
1087 dm->max_dynamic_page_count = *max_page_count; in process_info()
1130 static unsigned long get_pages_committed(struct hv_dynmem_device *dm) in get_pages_committed() argument
1133 dm->num_pages_ballooned + in get_pages_committed()
1134 (dm->num_pages_added > dm->num_pages_onlined ? in get_pages_committed()
1135 dm->num_pages_added - dm->num_pages_onlined : 0) + in get_pages_committed()
1149 static void post_status(struct hv_dynmem_device *dm) in post_status() argument
1180 num_pages_committed = get_pages_committed(dm); in post_status()
1183 vm_memory_committed(), dm->num_pages_ballooned, in post_status()
1184 dm->num_pages_added, dm->num_pages_onlined); in post_status()
1206 vmbus_sendpacket(dm->dev->channel, &status, in post_status()
1213 static void free_balloon_pages(struct hv_dynmem_device *dm, in free_balloon_pages() argument
1225 dm->num_pages_ballooned--; in free_balloon_pages()
1232 static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm, in alloc_balloon_pages() argument
1256 dm->num_pages_ballooned += alloc_unit; in alloc_balloon_pages()
1373 static void balloon_down(struct hv_dynmem_device *dm, in balloon_down() argument
1380 unsigned int prev_pages_ballooned = dm->num_pages_ballooned; in balloon_down()
1383 free_balloon_pages(dm, &range_array[i]); in balloon_down()
1388 prev_pages_ballooned - dm->num_pages_ballooned); in balloon_down()
1403 dm->state = DM_INITIALIZED; in balloon_down()
1410 struct hv_dynmem_device *dm = dm_dev; in dm_thread_func() local
1420 post_status(dm); in dm_thread_func()
1427 static void version_resp(struct hv_dynmem_device *dm, in version_resp() argument
1439 complete(&dm->host_event); in version_resp()
1449 if (dm->next_version == 0) in version_resp()
1456 version_req.version.version = dm->next_version; in version_resp()
1457 dm->version = version_req.version.version; in version_resp()
1465 dm->next_version = DYNMEM_PROTOCOL_VERSION_WIN7; in version_resp()
1469 dm->next_version = 0; in version_resp()
1473 ret = vmbus_sendpacket(dm->dev->channel, &version_req, in version_resp()
1484 dm->state = DM_INIT_ERROR; in version_resp()
1485 complete(&dm->host_event); in version_resp()
1488 static void cap_resp(struct hv_dynmem_device *dm, in cap_resp() argument
1493 dm->state = DM_INIT_ERROR; in cap_resp()
1495 complete(&dm->host_event); in cap_resp()
1505 struct hv_dynmem_device *dm = hv_get_drvdata(dev); in balloon_onchannelcallback() local
1521 version_resp(dm, in balloon_onchannelcallback()
1526 cap_resp(dm, in balloon_onchannelcallback()
1536 if (dm->state == DM_BALLOON_UP) in balloon_onchannelcallback()
1539 dm->state = DM_BALLOON_UP; in balloon_onchannelcallback()
1550 dm->state = DM_BALLOON_DOWN; in balloon_onchannelcallback()
1551 balloon_down(dm, in balloon_onchannelcallback()
1556 if (dm->state == DM_HOT_ADD) in balloon_onchannelcallback()
1558 dm->state = DM_HOT_ADD; in balloon_onchannelcallback()
1565 dm->host_specified_ha_region = false; in balloon_onchannelcallback()
1567 dm->ha_wrk.ha_page_range = *ha_pg_range; in balloon_onchannelcallback()
1568 dm->ha_wrk.ha_region_range.page_range = 0; in balloon_onchannelcallback()
1575 dm->host_specified_ha_region = true; in balloon_onchannelcallback()
1578 dm->ha_wrk.ha_page_range = *ha_pg_range; in balloon_onchannelcallback()
1579 dm->ha_wrk.ha_region_range = *ha_region; in balloon_onchannelcallback()
1585 process_info(dm, (struct dm_info_msg *)dm_msg); in balloon_onchannelcallback()
1842 struct hv_dynmem_device *dm = f->private; in hv_balloon_debug_show() local
1846 DYNMEM_MAJOR_VERSION(dm->version), in hv_balloon_debug_show()
1847 DYNMEM_MINOR_VERSION(dm->version)); in hv_balloon_debug_show()
1858 seq_printf(f, "%-22s: %u", "state", dm->state); in hv_balloon_debug_show()
1859 switch (dm->state) { in hv_balloon_debug_show()
1887 seq_printf(f, "%-22s: %u\n", "pages_added", dm->num_pages_added); in hv_balloon_debug_show()
1890 seq_printf(f, "%-22s: %u\n", "pages_onlined", dm->num_pages_onlined); in hv_balloon_debug_show()
1893 seq_printf(f, "%-22s: %u\n", "pages_ballooned", dm->num_pages_ballooned); in hv_balloon_debug_show()
1896 get_pages_committed(dm)); in hv_balloon_debug_show()
1899 dm->max_dynamic_page_count); in hv_balloon_debug_show()
1995 struct hv_dynmem_device *dm = hv_get_drvdata(dev); in balloon_remove() local
2000 if (dm->num_pages_ballooned != 0) in balloon_remove()
2001 pr_warn("Ballooned pages: %d\n", dm->num_pages_ballooned); in balloon_remove()
2003 hv_balloon_debugfs_exit(dm); in balloon_remove()
2005 cancel_work_sync(&dm->balloon_wrk.wrk); in balloon_remove()
2006 cancel_work_sync(&dm->ha_wrk.wrk); in balloon_remove()
2008 kthread_stop(dm->thread); in balloon_remove()
2025 list_for_each_entry_safe(has, tmp, &dm->ha_region_list, list) { in balloon_remove()
2040 struct hv_dynmem_device *dm = hv_get_drvdata(hv_dev); in balloon_suspend() local
2044 cancel_work_sync(&dm->balloon_wrk.wrk); in balloon_suspend()
2045 cancel_work_sync(&dm->ha_wrk.wrk); in balloon_suspend()
2047 if (dm->thread) { in balloon_suspend()
2048 kthread_stop(dm->thread); in balloon_suspend()
2049 dm->thread = NULL; in balloon_suspend()