Lines Matching full:hbus

566 	struct hv_pcibus_device *hbus;  member
609 static struct hv_pci_dev *get_pcichild_wslot(struct hv_pcibus_device *hbus,
697 void __iomem *addr = hpdev->hbus->cfg_addr + CFG_PAGE_OFFSET + where; in _hv_pcifront_read_config()
725 spin_lock_irqsave(&hpdev->hbus->config_lock, flags); in _hv_pcifront_read_config()
727 writel(hpdev->desc.win_slot.slot, hpdev->hbus->cfg_addr); in _hv_pcifront_read_config()
747 spin_unlock_irqrestore(&hpdev->hbus->config_lock, flags); in _hv_pcifront_read_config()
749 dev_err(&hpdev->hbus->hdev->device, in _hv_pcifront_read_config()
758 void __iomem *addr = hpdev->hbus->cfg_addr + CFG_PAGE_OFFSET + in hv_pcifront_get_vendor_id()
761 spin_lock_irqsave(&hpdev->hbus->config_lock, flags); in hv_pcifront_get_vendor_id()
764 writel(hpdev->desc.win_slot.slot, hpdev->hbus->cfg_addr); in hv_pcifront_get_vendor_id()
774 spin_unlock_irqrestore(&hpdev->hbus->config_lock, flags); in hv_pcifront_get_vendor_id()
790 void __iomem *addr = hpdev->hbus->cfg_addr + CFG_PAGE_OFFSET + where; in _hv_pcifront_write_config()
796 spin_lock_irqsave(&hpdev->hbus->config_lock, flags); in _hv_pcifront_write_config()
798 writel(hpdev->desc.win_slot.slot, hpdev->hbus->cfg_addr); in _hv_pcifront_write_config()
818 spin_unlock_irqrestore(&hpdev->hbus->config_lock, flags); in _hv_pcifront_write_config()
820 dev_err(&hpdev->hbus->hdev->device, in _hv_pcifront_write_config()
839 struct hv_pcibus_device *hbus = in hv_pcifront_read_config() local
843 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn)); in hv_pcifront_read_config()
867 struct hv_pcibus_device *hbus = in hv_pcifront_write_config() local
871 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn)); in hv_pcifront_write_config()
968 struct hv_pcibus_device *hbus = in hv_read_config_block() local
995 ret = vmbus_sendpacket(hbus->hdev->channel, read_blk, in hv_read_config_block()
1002 ret = wait_for_response(hbus->hdev, &comp_pkt.comp_pkt.host_event); in hv_read_config_block()
1008 dev_err(&hbus->hdev->device, in hv_read_config_block()
1048 struct hv_pcibus_device *hbus = in hv_write_config_block() local
1085 ret = vmbus_sendpacket(hbus->hdev->channel, write_blk, pkt_size, in hv_write_config_block()
1091 ret = wait_for_response(hbus->hdev, &comp_pkt.host_event); in hv_write_config_block()
1096 dev_err(&hbus->hdev->device, in hv_write_config_block()
1118 struct hv_pcibus_device *hbus = in hv_register_block_invalidate() local
1123 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_register_block_invalidate()
1151 vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt, sizeof(*int_pkt), in hv_int_desc_free()
1170 struct hv_pcibus_device *hbus; in hv_msi_free() local
1178 hbus = info->data; in hv_msi_free()
1184 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_msi_free()
1222 struct hv_pcibus_device *hbus; in hv_irq_unmask() local
1235 hbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata); in hv_irq_unmask()
1237 spin_lock_irqsave(&hbus->retarget_msi_interrupt_lock, flags); in hv_irq_unmask()
1239 params = &hbus->retarget_msi_interrupt_params; in hv_irq_unmask()
1244 params->device_id = (hbus->hdev->dev_instance.b[5] << 24) | in hv_irq_unmask()
1245 (hbus->hdev->dev_instance.b[4] << 16) | in hv_irq_unmask()
1246 (hbus->hdev->dev_instance.b[7] << 8) | in hv_irq_unmask()
1247 (hbus->hdev->dev_instance.b[6] & 0xf8) | in hv_irq_unmask()
1258 if (hbus->protocol_version >= PCI_PROTOCOL_VERSION_1_2) { in hv_irq_unmask()
1300 spin_unlock_irqrestore(&hbus->retarget_msi_interrupt_lock, flags); in hv_irq_unmask()
1318 if (!hv_result_success(res) && hbus->state != hv_pcibus_removing) in hv_irq_unmask()
1319 dev_err(&hbus->hdev->device, in hv_irq_unmask()
1423 struct hv_pcibus_device *hbus; in hv_compose_msi_msg() local
1446 hbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata); in hv_compose_msi_msg()
1447 channel = hbus->hdev->channel; in hv_compose_msi_msg()
1448 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_compose_msi_msg()
1468 switch (hbus->protocol_version) { in hv_compose_msi_msg()
1496 dev_err(&hbus->hdev->device, in hv_compose_msi_msg()
1501 ret = vmbus_sendpacket(hpdev->hbus->hdev->channel, &ctxt.int_pkts, in hv_compose_msi_msg()
1506 dev_err(&hbus->hdev->device, in hv_compose_msi_msg()
1527 dev_err_once(&hbus->hdev->device, in hv_compose_msi_msg()
1544 hv_pci_onchannelcallback(hbus); in hv_compose_msi_msg()
1548 dev_err_once(&hbus->hdev->device, in hv_compose_msi_msg()
1559 dev_err(&hbus->hdev->device, in hv_compose_msi_msg()
1610 * @hbus: The root PCI bus
1621 static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus) in hv_pcie_init_irq_domain() argument
1623 hbus->msi_info.chip = &hv_msi_irq_chip; in hv_pcie_init_irq_domain()
1624 hbus->msi_info.ops = &hv_msi_ops; in hv_pcie_init_irq_domain()
1625 hbus->msi_info.flags = (MSI_FLAG_USE_DEF_DOM_OPS | in hv_pcie_init_irq_domain()
1628 hbus->msi_info.handler = handle_edge_irq; in hv_pcie_init_irq_domain()
1629 hbus->msi_info.handler_name = "edge"; in hv_pcie_init_irq_domain()
1630 hbus->msi_info.data = hbus; in hv_pcie_init_irq_domain()
1631 hbus->irq_domain = pci_msi_create_irq_domain(hbus->fwnode, in hv_pcie_init_irq_domain()
1632 &hbus->msi_info, in hv_pcie_init_irq_domain()
1634 if (!hbus->irq_domain) { in hv_pcie_init_irq_domain()
1635 dev_err(&hbus->hdev->device, in hv_pcie_init_irq_domain()
1640 dev_set_msi_domain(&hbus->bridge->dev, hbus->irq_domain); in hv_pcie_init_irq_domain()
1667 * @hbus: Root PCI bus, as understood by this driver
1669 static void survey_child_resources(struct hv_pcibus_device *hbus) in survey_child_resources() argument
1679 event = xchg(&hbus->survey_event, NULL); in survey_child_resources()
1684 if (hbus->low_mmio_space || hbus->high_mmio_space) { in survey_child_resources()
1689 spin_lock_irqsave(&hbus->device_list_lock, flags); in survey_child_resources()
1696 list_for_each_entry(hpdev, &hbus->children, list_entry) { in survey_child_resources()
1699 dev_err(&hbus->hdev->device, in survey_child_resources()
1718 hbus->high_mmio_space += bar_size; in survey_child_resources()
1720 hbus->low_mmio_space += bar_size; in survey_child_resources()
1725 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in survey_child_resources()
1731 * @hbus: Root PCI bus, as understood by this driver
1741 static void prepopulate_bars(struct hv_pcibus_device *hbus) in prepopulate_bars() argument
1755 if (hbus->low_mmio_space) { in prepopulate_bars()
1756 low_size = 1ULL << (63 - __builtin_clzll(hbus->low_mmio_space)); in prepopulate_bars()
1757 low_base = hbus->low_mmio_res->start; in prepopulate_bars()
1760 if (hbus->high_mmio_space) { in prepopulate_bars()
1762 (63 - __builtin_clzll(hbus->high_mmio_space)); in prepopulate_bars()
1763 high_base = hbus->high_mmio_res->start; in prepopulate_bars()
1766 spin_lock_irqsave(&hbus->device_list_lock, flags); in prepopulate_bars()
1779 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
1787 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
1840 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in prepopulate_bars()
1849 * same ordered workqueue. Therefore hbus->children list will not change
1852 static void hv_pci_assign_slots(struct hv_pcibus_device *hbus) in hv_pci_assign_slots() argument
1858 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_assign_slots()
1864 hpdev->pci_slot = pci_create_slot(hbus->bridge->bus, slot_nr, in hv_pci_assign_slots()
1876 static void hv_pci_remove_slots(struct hv_pcibus_device *hbus) in hv_pci_remove_slots() argument
1880 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_remove_slots()
1891 static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) in hv_pci_assign_numa_node() argument
1894 struct pci_bus *bus = hbus->bridge->bus; in hv_pci_assign_numa_node()
1898 hv_dev = get_pcichild_wslot(hbus, devfn_to_wslot(dev->devfn)); in hv_pci_assign_numa_node()
1911 * @hbus: Root PCI bus, as understood by this driver
1915 static int create_root_hv_pci_bus(struct hv_pcibus_device *hbus) in create_root_hv_pci_bus() argument
1918 struct pci_host_bridge *bridge = hbus->bridge; in create_root_hv_pci_bus()
1920 bridge->dev.parent = &hbus->hdev->device; in create_root_hv_pci_bus()
1921 bridge->sysdata = &hbus->sysdata; in create_root_hv_pci_bus()
1929 hv_pci_assign_numa_node(hbus); in create_root_hv_pci_bus()
1931 hv_pci_assign_slots(hbus); in create_root_hv_pci_bus()
1934 hbus->state = hv_pcibus_installed; in create_root_hv_pci_bus()
1961 dev_err(&completion->hpdev->hbus->hdev->device, in q_resource_requirements()
1976 * @hbus: The internal struct tracking this root PCI bus.
1985 static struct hv_pci_dev *new_pcichild_device(struct hv_pcibus_device *hbus, in new_pcichild_device() argument
2002 hpdev->hbus = hbus; in new_pcichild_device()
2013 ret = vmbus_sendpacket(hbus->hdev->channel, res_req, in new_pcichild_device()
2021 if (wait_for_response(hbus->hdev, &comp_pkt.host_event)) in new_pcichild_device()
2027 spin_lock_irqsave(&hbus->device_list_lock, flags); in new_pcichild_device()
2029 list_add_tail(&hpdev->list_entry, &hbus->children); in new_pcichild_device()
2030 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in new_pcichild_device()
2040 * @hbus: Root PCI bus, as understood by this driver
2051 static struct hv_pci_dev *get_pcichild_wslot(struct hv_pcibus_device *hbus, in get_pcichild_wslot() argument
2057 spin_lock_irqsave(&hbus->device_list_lock, flags); in get_pcichild_wslot()
2058 list_for_each_entry(iter, &hbus->children, list_entry) { in get_pcichild_wslot()
2065 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in get_pcichild_wslot()
2091 * because both are pushed to the ordered workqueue hbus->wq.
2099 struct hv_pcibus_device *hbus; in pci_devices_present_work() local
2106 hbus = dr_wrk->bus; in pci_devices_present_work()
2112 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2113 while (!list_empty(&hbus->dr_list)) { in pci_devices_present_work()
2114 dr = list_first_entry(&hbus->dr_list, struct hv_dr_state, in pci_devices_present_work()
2119 if (!list_empty(&hbus->dr_list)) { in pci_devices_present_work()
2124 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2130 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2131 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2134 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2141 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2142 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2151 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2154 hpdev = new_pcichild_device(hbus, new_desc); in pci_devices_present_work()
2156 dev_err(&hbus->hdev->device, in pci_devices_present_work()
2162 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2165 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2174 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2188 switch (hbus->state) { in pci_devices_present_work()
2195 pci_scan_child_bus(hbus->bridge->bus); in pci_devices_present_work()
2196 hv_pci_assign_numa_node(hbus); in pci_devices_present_work()
2197 hv_pci_assign_slots(hbus); in pci_devices_present_work()
2203 survey_child_resources(hbus); in pci_devices_present_work()
2215 * @hbus: Root PCI bus, as understood by this driver
2220 static int hv_pci_start_relations_work(struct hv_pcibus_device *hbus, in hv_pci_start_relations_work() argument
2227 if (hbus->state == hv_pcibus_removing) { in hv_pci_start_relations_work()
2228 dev_info(&hbus->hdev->device, in hv_pci_start_relations_work()
2238 dr_wrk->bus = hbus; in hv_pci_start_relations_work()
2240 spin_lock_irqsave(&hbus->device_list_lock, flags); in hv_pci_start_relations_work()
2246 pending_dr = !list_empty(&hbus->dr_list); in hv_pci_start_relations_work()
2247 list_add_tail(&dr->list_entry, &hbus->dr_list); in hv_pci_start_relations_work()
2248 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in hv_pci_start_relations_work()
2253 queue_work(hbus->wq, &dr_wrk->wrk); in hv_pci_start_relations_work()
2260 * @hbus: Root PCI bus, as understood by this driver
2267 static void hv_pci_devices_present(struct hv_pcibus_device *hbus, in hv_pci_devices_present() argument
2291 if (hv_pci_start_relations_work(hbus, dr)) in hv_pci_devices_present()
2297 * @hbus: Root PCI bus, as understood by this driver
2302 static void hv_pci_devices_present2(struct hv_pcibus_device *hbus, in hv_pci_devices_present2() argument
2329 if (hv_pci_start_relations_work(hbus, dr)) in hv_pci_devices_present2()
2345 struct hv_pcibus_device *hbus; in hv_eject_device_work() local
2356 hbus = hpdev->hbus; in hv_eject_device_work()
2363 * must be done without constructs like pci_domain_nr(hbus->bridge->bus) in hv_eject_device_work()
2364 * because hbus->bridge->bus may not exist yet. in hv_eject_device_work()
2367 pdev = pci_get_domain_bus_and_slot(hbus->bridge->domain_nr, 0, wslot); in hv_eject_device_work()
2375 spin_lock_irqsave(&hbus->device_list_lock, flags); in hv_eject_device_work()
2377 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in hv_eject_device_work()
2386 vmbus_sendpacket(hbus->hdev->channel, ejct_pkt, in hv_eject_device_work()
2408 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pci_eject_device() local
2409 struct hv_device *hdev = hbus->hdev; in hv_pci_eject_device()
2411 if (hbus->state == hv_pcibus_removing) { in hv_pci_eject_device()
2419 queue_work(hbus->wq, &hpdev->wrk); in hv_pci_eject_device()
2433 struct hv_pcibus_device *hbus = context; in hv_pci_onchannelcallback() local
2453 ret = vmbus_recvpacket_raw(hbus->hdev->channel, buffer, in hv_pci_onchannelcallback()
2502 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
2507 hv_pci_devices_present(hbus, bus_rel); in hv_pci_onchannelcallback()
2516 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
2521 hv_pci_devices_present2(hbus, bus_rel2); in hv_pci_onchannelcallback()
2527 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
2538 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
2551 dev_warn(&hbus->hdev->device, in hv_pci_onchannelcallback()
2559 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
2592 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_protocol_negotiation() local
2632 hbus->protocol_version = version[i]; in hv_pci_protocol_negotiation()
2635 hbus->protocol_version); in hv_pci_protocol_negotiation()
2662 * @hbus: Root PCI bus, as understood by this driver
2664 static void hv_pci_free_bridge_windows(struct hv_pcibus_device *hbus) in hv_pci_free_bridge_windows() argument
2671 if (hbus->low_mmio_space && hbus->low_mmio_res) { in hv_pci_free_bridge_windows()
2672 hbus->low_mmio_res->flags |= IORESOURCE_BUSY; in hv_pci_free_bridge_windows()
2673 vmbus_free_mmio(hbus->low_mmio_res->start, in hv_pci_free_bridge_windows()
2674 resource_size(hbus->low_mmio_res)); in hv_pci_free_bridge_windows()
2677 if (hbus->high_mmio_space && hbus->high_mmio_res) { in hv_pci_free_bridge_windows()
2678 hbus->high_mmio_res->flags |= IORESOURCE_BUSY; in hv_pci_free_bridge_windows()
2679 vmbus_free_mmio(hbus->high_mmio_res->start, in hv_pci_free_bridge_windows()
2680 resource_size(hbus->high_mmio_res)); in hv_pci_free_bridge_windows()
2687 * @hbus: Root PCI bus, as understood by this driver
2709 static int hv_pci_allocate_bridge_windows(struct hv_pcibus_device *hbus) in hv_pci_allocate_bridge_windows() argument
2714 if (hbus->low_mmio_space) { in hv_pci_allocate_bridge_windows()
2715 align = 1ULL << (63 - __builtin_clzll(hbus->low_mmio_space)); in hv_pci_allocate_bridge_windows()
2716 ret = vmbus_allocate_mmio(&hbus->low_mmio_res, hbus->hdev, 0, in hv_pci_allocate_bridge_windows()
2718 hbus->low_mmio_space, in hv_pci_allocate_bridge_windows()
2721 dev_err(&hbus->hdev->device, in hv_pci_allocate_bridge_windows()
2723 hbus->low_mmio_space); in hv_pci_allocate_bridge_windows()
2728 hbus->low_mmio_res->flags |= IORESOURCE_WINDOW; in hv_pci_allocate_bridge_windows()
2729 hbus->low_mmio_res->flags &= ~IORESOURCE_BUSY; in hv_pci_allocate_bridge_windows()
2730 pci_add_resource(&hbus->bridge->windows, hbus->low_mmio_res); in hv_pci_allocate_bridge_windows()
2733 if (hbus->high_mmio_space) { in hv_pci_allocate_bridge_windows()
2734 align = 1ULL << (63 - __builtin_clzll(hbus->high_mmio_space)); in hv_pci_allocate_bridge_windows()
2735 ret = vmbus_allocate_mmio(&hbus->high_mmio_res, hbus->hdev, in hv_pci_allocate_bridge_windows()
2737 hbus->high_mmio_space, align, in hv_pci_allocate_bridge_windows()
2740 dev_err(&hbus->hdev->device, in hv_pci_allocate_bridge_windows()
2742 hbus->high_mmio_space); in hv_pci_allocate_bridge_windows()
2747 hbus->high_mmio_res->flags |= IORESOURCE_WINDOW; in hv_pci_allocate_bridge_windows()
2748 hbus->high_mmio_res->flags &= ~IORESOURCE_BUSY; in hv_pci_allocate_bridge_windows()
2749 pci_add_resource(&hbus->bridge->windows, hbus->high_mmio_res); in hv_pci_allocate_bridge_windows()
2755 if (hbus->low_mmio_res) { in hv_pci_allocate_bridge_windows()
2756 vmbus_free_mmio(hbus->low_mmio_res->start, in hv_pci_allocate_bridge_windows()
2757 resource_size(hbus->low_mmio_res)); in hv_pci_allocate_bridge_windows()
2765 * @hbus: Root PCI bus, as understood by this driver
2772 static int hv_allocate_config_window(struct hv_pcibus_device *hbus) in hv_allocate_config_window() argument
2780 ret = vmbus_allocate_mmio(&hbus->mem_config, hbus->hdev, 0, -1, in hv_allocate_config_window()
2793 hbus->mem_config->flags |= IORESOURCE_BUSY; in hv_allocate_config_window()
2798 static void hv_free_config_window(struct hv_pcibus_device *hbus) in hv_free_config_window() argument
2800 vmbus_free_mmio(hbus->mem_config->start, PCI_CONFIG_MMIO_LENGTH); in hv_free_config_window()
2813 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_enter_d0() local
2834 d0_entry->mmio_base = hbus->mem_config->start; in hv_pci_enter_d0()
2869 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_query_relations() local
2876 if (cmpxchg(&hbus->survey_event, NULL, &comp)) in hv_pci_query_relations()
2909 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_send_resources_allocated() local
2919 size_res = (hbus->protocol_version < PCI_PROTOCOL_VERSION_1_2) in hv_send_resources_allocated()
2929 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_allocated()
2938 if (hbus->protocol_version < PCI_PROTOCOL_VERSION_1_2) { in hv_send_resources_allocated()
2970 hbus->wslot_res_allocated = wslot; in hv_send_resources_allocated()
2986 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_send_resources_released() local
2992 for (wslot = hbus->wslot_res_allocated; wslot >= 0; wslot--) { in hv_send_resources_released()
2993 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_released()
3008 hbus->wslot_res_allocated = wslot - 1; in hv_send_resources_released()
3011 hbus->wslot_res_allocated = -1; in hv_send_resources_released()
3069 struct hv_pcibus_device *hbus; in hv_pci_probe() local
3079 BUILD_BUG_ON(sizeof(*hbus) > HV_HYP_PAGE_SIZE); in hv_pci_probe()
3089 * alignment of hbus is important because hbus's field in hv_pci_probe()
3094 * hence kmemleak reports the pointer contained in the hbus buffer in hv_pci_probe()
3096 * is tracked by hbus->children) as memory leak (false positive). in hv_pci_probe()
3099 * used to allocate the hbus buffer and we can avoid the kmemleak false in hv_pci_probe()
3101 * kmemleak to track and scan the hbus buffer. in hv_pci_probe()
3103 hbus = kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL); in hv_pci_probe()
3104 if (!hbus) in hv_pci_probe()
3107 hbus->bridge = bridge; in hv_pci_probe()
3108 hbus->state = hv_pcibus_init; in hv_pci_probe()
3109 hbus->wslot_res_allocated = -1; in hv_pci_probe()
3139 hbus->bridge->domain_nr = dom; in hv_pci_probe()
3141 hbus->sysdata.domain = dom; in hv_pci_probe()
3144 hbus->hdev = hdev; in hv_pci_probe()
3145 INIT_LIST_HEAD(&hbus->children); in hv_pci_probe()
3146 INIT_LIST_HEAD(&hbus->dr_list); in hv_pci_probe()
3147 spin_lock_init(&hbus->config_lock); in hv_pci_probe()
3148 spin_lock_init(&hbus->device_list_lock); in hv_pci_probe()
3149 spin_lock_init(&hbus->retarget_msi_interrupt_lock); in hv_pci_probe()
3150 hbus->wq = alloc_ordered_workqueue("hv_pci_%x", 0, in hv_pci_probe()
3151 hbus->bridge->domain_nr); in hv_pci_probe()
3152 if (!hbus->wq) { in hv_pci_probe()
3158 hv_pci_onchannelcallback, hbus); in hv_pci_probe()
3162 hv_set_drvdata(hdev, hbus); in hv_pci_probe()
3169 ret = hv_allocate_config_window(hbus); in hv_pci_probe()
3173 hbus->cfg_addr = ioremap(hbus->mem_config->start, in hv_pci_probe()
3175 if (!hbus->cfg_addr) { in hv_pci_probe()
3188 hbus->fwnode = irq_domain_alloc_named_fwnode(name); in hv_pci_probe()
3190 if (!hbus->fwnode) { in hv_pci_probe()
3195 ret = hv_pcie_init_irq_domain(hbus); in hv_pci_probe()
3231 hbus->wslot_res_allocated = 255; in hv_pci_probe()
3243 ret = hv_pci_allocate_bridge_windows(hbus); in hv_pci_probe()
3251 prepopulate_bars(hbus); in hv_pci_probe()
3253 hbus->state = hv_pcibus_probed; in hv_pci_probe()
3255 ret = create_root_hv_pci_bus(hbus); in hv_pci_probe()
3262 hv_pci_free_bridge_windows(hbus); in hv_pci_probe()
3266 irq_domain_remove(hbus->irq_domain); in hv_pci_probe()
3268 irq_domain_free_fwnode(hbus->fwnode); in hv_pci_probe()
3270 iounmap(hbus->cfg_addr); in hv_pci_probe()
3272 hv_free_config_window(hbus); in hv_pci_probe()
3276 destroy_workqueue(hbus->wq); in hv_pci_probe()
3278 hv_put_dom_num(hbus->bridge->domain_nr); in hv_pci_probe()
3280 kfree(hbus); in hv_pci_probe()
3286 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_bus_exit() local
3308 spin_lock_irqsave(&hbus->device_list_lock, flags); in hv_pci_bus_exit()
3309 list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) in hv_pci_bus_exit()
3311 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in hv_pci_bus_exit()
3359 struct hv_pcibus_device *hbus; in hv_pci_remove() local
3362 hbus = hv_get_drvdata(hdev); in hv_pci_remove()
3363 if (hbus->state == hv_pcibus_installed) { in hv_pci_remove()
3365 hbus->state = hv_pcibus_removing; in hv_pci_remove()
3367 destroy_workqueue(hbus->wq); in hv_pci_remove()
3368 hbus->wq = NULL; in hv_pci_remove()
3371 * on hbus-wq. We can't race with hv_pci_devices_present() in hv_pci_remove()
3377 pci_stop_root_bus(hbus->bridge->bus); in hv_pci_remove()
3378 hv_pci_remove_slots(hbus); in hv_pci_remove()
3379 pci_remove_root_bus(hbus->bridge->bus); in hv_pci_remove()
3387 iounmap(hbus->cfg_addr); in hv_pci_remove()
3388 hv_free_config_window(hbus); in hv_pci_remove()
3389 hv_pci_free_bridge_windows(hbus); in hv_pci_remove()
3390 irq_domain_remove(hbus->irq_domain); in hv_pci_remove()
3391 irq_domain_free_fwnode(hbus->fwnode); in hv_pci_remove()
3393 hv_put_dom_num(hbus->bridge->domain_nr); in hv_pci_remove()
3395 kfree(hbus); in hv_pci_remove()
3401 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_suspend() local
3411 * items onto hbus->wq in hv_pci_devices_present() and in hv_pci_suspend()
3418 * callback tasklet, sets hbus->state to hv_pcibus_removing, and in hv_pci_suspend()
3421 * hbus->wq and safely closes the vmbus channel. in hv_pci_suspend()
3425 /* Change the hbus state to prevent new work items. */ in hv_pci_suspend()
3426 old_state = hbus->state; in hv_pci_suspend()
3427 if (hbus->state == hv_pcibus_installed) in hv_pci_suspend()
3428 hbus->state = hv_pcibus_removing; in hv_pci_suspend()
3435 flush_workqueue(hbus->wq); in hv_pci_suspend()
3469 static void hv_pci_restore_msi_state(struct hv_pcibus_device *hbus) in hv_pci_restore_msi_state() argument
3471 pci_walk_bus(hbus->bridge->bus, hv_pci_restore_msi_msg, NULL); in hv_pci_restore_msi_state()
3476 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_resume() local
3480 hbus->state = hv_pcibus_init; in hv_pci_resume()
3483 hv_pci_onchannelcallback, hbus); in hv_pci_resume()
3488 version[0] = hbus->protocol_version; in hv_pci_resume()
3505 prepopulate_bars(hbus); in hv_pci_resume()
3507 hv_pci_restore_msi_state(hbus); in hv_pci_resume()
3509 hbus->state = hv_pcibus_installed; in hv_pci_resume()