Lines Matching refs:dm_device
577 static struct hv_dynmem_device dm_device; variable
613 list_for_each_entry(has, &dm_device.ha_region_list, list) { in hv_page_offline_check()
645 if (dm_device.ha_waiting) { in hv_memory_notifier()
646 dm_device.ha_waiting = false; in hv_memory_notifier()
647 complete(&dm_device.ol_waitevent); in hv_memory_notifier()
652 spin_lock_irqsave(&dm_device.ha_lock, flags); in hv_memory_notifier()
655 if (pfn_count <= dm_device.num_pages_onlined) { in hv_memory_notifier()
656 dm_device.num_pages_onlined -= pfn_count; in hv_memory_notifier()
664 dm_device.num_pages_onlined = 0; in hv_memory_notifier()
666 spin_unlock_irqrestore(&dm_device.ha_lock, flags); in hv_memory_notifier()
692 WARN_ON_ONCE(!spin_is_locked(&dm_device.ha_lock)); in hv_page_online_one()
693 dm_device.num_pages_onlined++; in hv_page_online_one()
720 spin_lock_irqsave(&dm_device.ha_lock, flags); in hv_mem_hot_add()
732 spin_unlock_irqrestore(&dm_device.ha_lock, flags); in hv_mem_hot_add()
734 init_completion(&dm_device.ol_waitevent); in hv_mem_hot_add()
735 dm_device.ha_waiting = !memhp_auto_online; in hv_mem_hot_add()
753 spin_lock_irqsave(&dm_device.ha_lock, flags); in hv_mem_hot_add()
756 spin_unlock_irqrestore(&dm_device.ha_lock, flags); in hv_mem_hot_add()
767 if (dm_device.ha_waiting) in hv_mem_hot_add()
768 wait_for_completion_timeout(&dm_device.ol_waitevent, in hv_mem_hot_add()
770 post_status(&dm_device); in hv_mem_hot_add()
780 spin_lock_irqsave(&dm_device.ha_lock, flags); in hv_online_page()
781 list_for_each_entry(has, &dm_device.ha_region_list, list) { in hv_online_page()
789 spin_unlock_irqrestore(&dm_device.ha_lock, flags); in hv_online_page()
800 spin_lock_irqsave(&dm_device.ha_lock, flags); in pfn_covered()
801 list_for_each_entry(has, &dm_device.ha_region_list, list) { in pfn_covered()
847 spin_unlock_irqrestore(&dm_device.ha_lock, flags); in pfn_covered()
866 spin_lock_irqsave(&dm_device.ha_lock, flags); in handle_pg_range()
867 list_for_each_entry(has, &dm_device.ha_region_list, list) { in handle_pg_range()
917 spin_unlock_irqrestore(&dm_device.ha_lock, flags); in handle_pg_range()
919 spin_lock_irqsave(&dm_device.ha_lock, flags); in handle_pg_range()
928 spin_unlock_irqrestore(&dm_device.ha_lock, flags); in handle_pg_range()
945 if (!dm_device.host_specified_ha_region) { in process_hot_add()
972 spin_lock_irqsave(&dm_device.ha_lock, flags); in process_hot_add()
973 list_add_tail(&ha_region->list, &dm_device.ha_region_list); in process_hot_add()
974 spin_unlock_irqrestore(&dm_device.ha_lock, flags); in process_hot_add()
994 struct hv_dynmem_device *dm = &dm_device; in hot_add_req()
1258 unsigned int num_pages = dm_device.balloon_wrk.num_pages; in balloon_up()
1298 num_ballooned = alloc_balloon_pages(&dm_device, num_pages, in balloon_up()
1308 num_pages, dm_device.balloon_wrk.num_pages); in balloon_up()
1312 dm_device.state = DM_INITIALIZED; in balloon_up()
1323 ret = vmbus_sendpacket(dm_device.dev->channel, in balloon_up()
1331 post_status(&dm_device); in balloon_up()
1341 free_balloon_pages(&dm_device, in balloon_up()
1361 complete(&dm_device.config_event); in balloon_down()
1375 vmbus_sendpacket(dm_device.dev->channel, &resp, in balloon_down()
1391 &dm_device.config_event, 1*HZ); in dm_thread_func()
1396 reinit_completion(&dm_device.config_event); in dm_thread_func()
1512 dm_device.balloon_wrk.num_pages = bal_msg->num_pages; in balloon_onchannelcallback()
1513 schedule_work(&dm_device.balloon_wrk.wrk); in balloon_onchannelcallback()
1548 schedule_work(&dm_device.ha_wrk.wrk); in balloon_onchannelcallback()
1591 dm_device.dev = dev; in balloon_probe()
1592 dm_device.state = DM_INITIALIZING; in balloon_probe()
1593 dm_device.next_version = DYNMEM_PROTOCOL_VERSION_WIN8; in balloon_probe()
1594 init_completion(&dm_device.host_event); in balloon_probe()
1595 init_completion(&dm_device.config_event); in balloon_probe()
1596 INIT_LIST_HEAD(&dm_device.ha_region_list); in balloon_probe()
1597 spin_lock_init(&dm_device.ha_lock); in balloon_probe()
1598 INIT_WORK(&dm_device.balloon_wrk.wrk, balloon_up); in balloon_probe()
1599 INIT_WORK(&dm_device.ha_wrk.wrk, hot_add_req); in balloon_probe()
1600 dm_device.host_specified_ha_region = false; in balloon_probe()
1602 dm_device.thread = in balloon_probe()
1603 kthread_run(dm_thread_func, &dm_device, "hv_balloon"); in balloon_probe()
1604 if (IS_ERR(dm_device.thread)) { in balloon_probe()
1605 ret = PTR_ERR(dm_device.thread); in balloon_probe()
1614 hv_set_drvdata(dev, &dm_device); in balloon_probe()
1627 dm_device.version = version_req.version.version; in balloon_probe()
1636 t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ); in balloon_probe()
1646 if (dm_device.state == DM_INIT_ERROR) { in balloon_probe()
1652 DYNMEM_MAJOR_VERSION(dm_device.version), in balloon_probe()
1653 DYNMEM_MINOR_VERSION(dm_device.version)); in balloon_probe()
1687 t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ); in balloon_probe()
1697 if (dm_device.state == DM_INIT_ERROR) { in balloon_probe()
1702 dm_device.state = DM_INITIALIZED; in balloon_probe()
1711 kthread_stop(dm_device.thread); in balloon_probe()
1740 spin_lock_irqsave(&dm_device.ha_lock, flags); in balloon_remove()
1749 spin_unlock_irqrestore(&dm_device.ha_lock, flags); in balloon_remove()