Lines Matching refs:hbus

558 	struct hv_pcibus_device *hbus;  member
617 struct hv_pcibus_device *hbus; in hv_arch_irq_unmask() local
630 hbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata); in hv_arch_irq_unmask()
633 dev_warn(&hbus->hdev->device, "%s() can not unmask irq %u\n", in hv_arch_irq_unmask()
646 params->device_id = (hbus->hdev->dev_instance.b[5] << 24) | in hv_arch_irq_unmask()
647 (hbus->hdev->dev_instance.b[4] << 16) | in hv_arch_irq_unmask()
648 (hbus->hdev->dev_instance.b[7] << 8) | in hv_arch_irq_unmask()
649 (hbus->hdev->dev_instance.b[6] & 0xf8) | in hv_arch_irq_unmask()
660 if (hbus->protocol_version >= PCI_PROTOCOL_VERSION_1_2) { in hv_arch_irq_unmask()
720 if (!hv_result_success(res) && hbus->state != hv_pcibus_removing) in hv_arch_irq_unmask()
721 dev_err(&hbus->hdev->device, in hv_arch_irq_unmask()
966 static struct hv_pci_dev *get_pcichild_wslot(struct hv_pcibus_device *hbus,
1117 struct hv_pcibus_device *hbus = hpdev->hbus; in _hv_pcifront_read_config() local
1118 struct device *dev = &hbus->hdev->device; in _hv_pcifront_read_config()
1149 spin_lock_irqsave(&hbus->config_lock, flags); in _hv_pcifront_read_config()
1150 if (hbus->use_calls) { in _hv_pcifront_read_config()
1151 phys_addr_t addr = hbus->mem_config->start + offset; in _hv_pcifront_read_config()
1153 hv_pci_write_mmio(dev, hbus->mem_config->start, 4, in _hv_pcifront_read_config()
1157 void __iomem *addr = hbus->cfg_addr + offset; in _hv_pcifront_read_config()
1160 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in _hv_pcifront_read_config()
1181 spin_unlock_irqrestore(&hbus->config_lock, flags); in _hv_pcifront_read_config()
1189 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pcifront_get_vendor_id() local
1190 struct device *dev = &hbus->hdev->device; in hv_pcifront_get_vendor_id()
1195 spin_lock_irqsave(&hbus->config_lock, flags); in hv_pcifront_get_vendor_id()
1197 if (hbus->use_calls) { in hv_pcifront_get_vendor_id()
1198 phys_addr_t addr = hbus->mem_config->start + in hv_pcifront_get_vendor_id()
1201 hv_pci_write_mmio(dev, hbus->mem_config->start, 4, in hv_pcifront_get_vendor_id()
1206 void __iomem *addr = hbus->cfg_addr + CFG_PAGE_OFFSET + in hv_pcifront_get_vendor_id()
1209 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in hv_pcifront_get_vendor_id()
1220 spin_unlock_irqrestore(&hbus->config_lock, flags); in hv_pcifront_get_vendor_id()
1235 struct hv_pcibus_device *hbus = hpdev->hbus; in _hv_pcifront_write_config() local
1236 struct device *dev = &hbus->hdev->device; in _hv_pcifront_write_config()
1244 spin_lock_irqsave(&hbus->config_lock, flags); in _hv_pcifront_write_config()
1246 if (hbus->use_calls) { in _hv_pcifront_write_config()
1247 phys_addr_t addr = hbus->mem_config->start + offset; in _hv_pcifront_write_config()
1249 hv_pci_write_mmio(dev, hbus->mem_config->start, 4, in _hv_pcifront_write_config()
1253 void __iomem *addr = hbus->cfg_addr + offset; in _hv_pcifront_write_config()
1256 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in _hv_pcifront_write_config()
1277 spin_unlock_irqrestore(&hbus->config_lock, flags); in _hv_pcifront_write_config()
1297 struct hv_pcibus_device *hbus = in hv_pcifront_read_config() local
1301 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn)); in hv_pcifront_read_config()
1325 struct hv_pcibus_device *hbus = in hv_pcifront_write_config() local
1329 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(devfn)); in hv_pcifront_write_config()
1426 struct hv_pcibus_device *hbus = in hv_read_config_block() local
1453 ret = vmbus_sendpacket(hbus->hdev->channel, read_blk, in hv_read_config_block()
1460 ret = wait_for_response(hbus->hdev, &comp_pkt.comp_pkt.host_event); in hv_read_config_block()
1466 dev_err(&hbus->hdev->device, in hv_read_config_block()
1506 struct hv_pcibus_device *hbus = in hv_write_config_block() local
1543 ret = vmbus_sendpacket(hbus->hdev->channel, write_blk, pkt_size, in hv_write_config_block()
1549 ret = wait_for_response(hbus->hdev, &comp_pkt.host_event); in hv_write_config_block()
1554 dev_err(&hbus->hdev->device, in hv_write_config_block()
1576 struct hv_pcibus_device *hbus = in hv_register_block_invalidate() local
1581 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_register_block_invalidate()
1613 vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt, sizeof(*int_pkt), in hv_int_desc_free()
1632 struct hv_pcibus_device *hbus; in hv_msi_free() local
1640 hbus = info->data; in hv_msi_free()
1646 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_msi_free()
1821 struct hv_pcibus_device *hbus; in hv_compose_msi_msg() local
1866 hbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata); in hv_compose_msi_msg()
1867 channel = hbus->hdev->channel; in hv_compose_msi_msg()
1868 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_compose_msi_msg()
1925 switch (hbus->protocol_version) { in hv_compose_msi_msg()
1955 dev_err(&hbus->hdev->device, in hv_compose_msi_msg()
1960 ret = vmbus_sendpacket_getid(hpdev->hbus->hdev->channel, &ctxt.int_pkts, in hv_compose_msi_msg()
1965 dev_err(&hbus->hdev->device, in hv_compose_msi_msg()
1986 dev_err_once(&hbus->hdev->device, in hv_compose_msi_msg()
2003 hv_pci_onchannelcallback(hbus); in hv_compose_msi_msg()
2012 dev_err(&hbus->hdev->device, in hv_compose_msi_msg()
2087 static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus) in hv_pcie_init_irq_domain() argument
2089 hbus->msi_info.chip = &hv_msi_irq_chip; in hv_pcie_init_irq_domain()
2090 hbus->msi_info.ops = &hv_msi_ops; in hv_pcie_init_irq_domain()
2091 hbus->msi_info.flags = (MSI_FLAG_USE_DEF_DOM_OPS | in hv_pcie_init_irq_domain()
2094 hbus->msi_info.handler = FLOW_HANDLER; in hv_pcie_init_irq_domain()
2095 hbus->msi_info.handler_name = FLOW_NAME; in hv_pcie_init_irq_domain()
2096 hbus->msi_info.data = hbus; in hv_pcie_init_irq_domain()
2097 hbus->irq_domain = pci_msi_create_irq_domain(hbus->fwnode, in hv_pcie_init_irq_domain()
2098 &hbus->msi_info, in hv_pcie_init_irq_domain()
2100 if (!hbus->irq_domain) { in hv_pcie_init_irq_domain()
2101 dev_err(&hbus->hdev->device, in hv_pcie_init_irq_domain()
2106 dev_set_msi_domain(&hbus->bridge->dev, hbus->irq_domain); in hv_pcie_init_irq_domain()
2135 static void survey_child_resources(struct hv_pcibus_device *hbus) in survey_child_resources() argument
2145 event = xchg(&hbus->survey_event, NULL); in survey_child_resources()
2150 if (hbus->low_mmio_space || hbus->high_mmio_space) { in survey_child_resources()
2155 spin_lock_irqsave(&hbus->device_list_lock, flags); in survey_child_resources()
2162 list_for_each_entry(hpdev, &hbus->children, list_entry) { in survey_child_resources()
2165 dev_err(&hbus->hdev->device, in survey_child_resources()
2184 hbus->high_mmio_space += bar_size; in survey_child_resources()
2186 hbus->low_mmio_space += bar_size; in survey_child_resources()
2191 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in survey_child_resources()
2207 static void prepopulate_bars(struct hv_pcibus_device *hbus) in prepopulate_bars() argument
2221 if (hbus->low_mmio_space) { in prepopulate_bars()
2222 low_size = 1ULL << (63 - __builtin_clzll(hbus->low_mmio_space)); in prepopulate_bars()
2223 low_base = hbus->low_mmio_res->start; in prepopulate_bars()
2226 if (hbus->high_mmio_space) { in prepopulate_bars()
2228 (63 - __builtin_clzll(hbus->high_mmio_space)); in prepopulate_bars()
2229 high_base = hbus->high_mmio_res->start; in prepopulate_bars()
2232 spin_lock_irqsave(&hbus->device_list_lock, flags); in prepopulate_bars()
2245 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
2253 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
2311 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in prepopulate_bars()
2323 static void hv_pci_assign_slots(struct hv_pcibus_device *hbus) in hv_pci_assign_slots() argument
2329 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_assign_slots()
2335 hpdev->pci_slot = pci_create_slot(hbus->bridge->bus, slot_nr, in hv_pci_assign_slots()
2347 static void hv_pci_remove_slots(struct hv_pcibus_device *hbus) in hv_pci_remove_slots() argument
2351 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_remove_slots()
2362 static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) in hv_pci_assign_numa_node() argument
2365 struct pci_bus *bus = hbus->bridge->bus; in hv_pci_assign_numa_node()
2369 hv_dev = get_pcichild_wslot(hbus, devfn_to_wslot(dev->devfn)); in hv_pci_assign_numa_node()
2395 static int create_root_hv_pci_bus(struct hv_pcibus_device *hbus) in create_root_hv_pci_bus() argument
2398 struct pci_host_bridge *bridge = hbus->bridge; in create_root_hv_pci_bus()
2400 bridge->dev.parent = &hbus->hdev->device; in create_root_hv_pci_bus()
2401 bridge->sysdata = &hbus->sysdata; in create_root_hv_pci_bus()
2409 hv_pci_assign_numa_node(hbus); in create_root_hv_pci_bus()
2411 hv_pci_assign_slots(hbus); in create_root_hv_pci_bus()
2414 hbus->state = hv_pcibus_installed; in create_root_hv_pci_bus()
2443 dev_err(&completion->hpdev->hbus->hdev->device, in q_resource_requirements()
2467 static struct hv_pci_dev *new_pcichild_device(struct hv_pcibus_device *hbus, in new_pcichild_device() argument
2484 hpdev->hbus = hbus; in new_pcichild_device()
2495 ret = vmbus_sendpacket(hbus->hdev->channel, res_req, in new_pcichild_device()
2503 if (wait_for_response(hbus->hdev, &comp_pkt.host_event)) in new_pcichild_device()
2509 spin_lock_irqsave(&hbus->device_list_lock, flags); in new_pcichild_device()
2511 list_add_tail(&hpdev->list_entry, &hbus->children); in new_pcichild_device()
2512 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in new_pcichild_device()
2533 static struct hv_pci_dev *get_pcichild_wslot(struct hv_pcibus_device *hbus, in get_pcichild_wslot() argument
2539 spin_lock_irqsave(&hbus->device_list_lock, flags); in get_pcichild_wslot()
2540 list_for_each_entry(iter, &hbus->children, list_entry) { in get_pcichild_wslot()
2547 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in get_pcichild_wslot()
2581 struct hv_pcibus_device *hbus; in pci_devices_present_work() local
2588 hbus = dr_wrk->bus; in pci_devices_present_work()
2594 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2595 while (!list_empty(&hbus->dr_list)) { in pci_devices_present_work()
2596 dr = list_first_entry(&hbus->dr_list, struct hv_dr_state, in pci_devices_present_work()
2601 if (!list_empty(&hbus->dr_list)) { in pci_devices_present_work()
2606 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2611 mutex_lock(&hbus->state_lock); in pci_devices_present_work()
2614 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2615 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2618 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2625 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2626 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2635 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2638 hpdev = new_pcichild_device(hbus, new_desc); in pci_devices_present_work()
2640 dev_err(&hbus->hdev->device, in pci_devices_present_work()
2646 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2649 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2658 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2672 switch (hbus->state) { in pci_devices_present_work()
2679 pci_scan_child_bus(hbus->bridge->bus); in pci_devices_present_work()
2680 hv_pci_assign_numa_node(hbus); in pci_devices_present_work()
2681 hv_pci_assign_slots(hbus); in pci_devices_present_work()
2687 survey_child_resources(hbus); in pci_devices_present_work()
2694 mutex_unlock(&hbus->state_lock); in pci_devices_present_work()
2706 static int hv_pci_start_relations_work(struct hv_pcibus_device *hbus, in hv_pci_start_relations_work() argument
2713 if (hbus->state == hv_pcibus_removing) { in hv_pci_start_relations_work()
2714 dev_info(&hbus->hdev->device, in hv_pci_start_relations_work()
2724 dr_wrk->bus = hbus; in hv_pci_start_relations_work()
2726 spin_lock_irqsave(&hbus->device_list_lock, flags); in hv_pci_start_relations_work()
2732 pending_dr = !list_empty(&hbus->dr_list); in hv_pci_start_relations_work()
2733 list_add_tail(&dr->list_entry, &hbus->dr_list); in hv_pci_start_relations_work()
2734 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in hv_pci_start_relations_work()
2739 queue_work(hbus->wq, &dr_wrk->wrk); in hv_pci_start_relations_work()
2753 static void hv_pci_devices_present(struct hv_pcibus_device *hbus, in hv_pci_devices_present() argument
2777 if (hv_pci_start_relations_work(hbus, dr)) in hv_pci_devices_present()
2788 static void hv_pci_devices_present2(struct hv_pcibus_device *hbus, in hv_pci_devices_present2() argument
2815 if (hv_pci_start_relations_work(hbus, dr)) in hv_pci_devices_present2()
2831 struct hv_pcibus_device *hbus; in hv_eject_device_work() local
2842 hbus = hpdev->hbus; in hv_eject_device_work()
2844 mutex_lock(&hbus->state_lock); in hv_eject_device_work()
2853 pdev = pci_get_domain_bus_and_slot(hbus->bridge->domain_nr, 0, wslot); in hv_eject_device_work()
2861 spin_lock_irqsave(&hbus->device_list_lock, flags); in hv_eject_device_work()
2863 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in hv_eject_device_work()
2872 vmbus_sendpacket(hbus->hdev->channel, ejct_pkt, in hv_eject_device_work()
2883 mutex_unlock(&hbus->state_lock); in hv_eject_device_work()
2896 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pci_eject_device() local
2897 struct hv_device *hdev = hbus->hdev; in hv_pci_eject_device()
2899 if (hbus->state == hv_pcibus_removing) { in hv_pci_eject_device()
2906 queue_work(hbus->wq, &hpdev->wrk); in hv_pci_eject_device()
2920 struct hv_pcibus_device *hbus = context; in hv_pci_onchannelcallback() local
2921 struct vmbus_channel *chan = hbus->hdev->channel; in hv_pci_onchannelcallback()
2975 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3006 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3011 hv_pci_devices_present(hbus, bus_rel); in hv_pci_onchannelcallback()
3021 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3026 hv_pci_devices_present2(hbus, bus_rel2); in hv_pci_onchannelcallback()
3033 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3037 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
3049 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3053 hpdev = get_pcichild_wslot(hbus, in hv_pci_onchannelcallback()
3066 dev_warn(&hbus->hdev->device, in hv_pci_onchannelcallback()
3074 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3107 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_protocol_negotiation() local
3147 hbus->protocol_version = version[i]; in hv_pci_protocol_negotiation()
3150 hbus->protocol_version); in hv_pci_protocol_negotiation()
3179 static void hv_pci_free_bridge_windows(struct hv_pcibus_device *hbus) in hv_pci_free_bridge_windows() argument
3186 if (hbus->low_mmio_space && hbus->low_mmio_res) { in hv_pci_free_bridge_windows()
3187 hbus->low_mmio_res->flags |= IORESOURCE_BUSY; in hv_pci_free_bridge_windows()
3188 vmbus_free_mmio(hbus->low_mmio_res->start, in hv_pci_free_bridge_windows()
3189 resource_size(hbus->low_mmio_res)); in hv_pci_free_bridge_windows()
3192 if (hbus->high_mmio_space && hbus->high_mmio_res) { in hv_pci_free_bridge_windows()
3193 hbus->high_mmio_res->flags |= IORESOURCE_BUSY; in hv_pci_free_bridge_windows()
3194 vmbus_free_mmio(hbus->high_mmio_res->start, in hv_pci_free_bridge_windows()
3195 resource_size(hbus->high_mmio_res)); in hv_pci_free_bridge_windows()
3224 static int hv_pci_allocate_bridge_windows(struct hv_pcibus_device *hbus) in hv_pci_allocate_bridge_windows() argument
3229 if (hbus->low_mmio_space) { in hv_pci_allocate_bridge_windows()
3230 align = 1ULL << (63 - __builtin_clzll(hbus->low_mmio_space)); in hv_pci_allocate_bridge_windows()
3231 ret = vmbus_allocate_mmio(&hbus->low_mmio_res, hbus->hdev, 0, in hv_pci_allocate_bridge_windows()
3233 hbus->low_mmio_space, in hv_pci_allocate_bridge_windows()
3236 dev_err(&hbus->hdev->device, in hv_pci_allocate_bridge_windows()
3238 hbus->low_mmio_space); in hv_pci_allocate_bridge_windows()
3243 hbus->low_mmio_res->flags |= IORESOURCE_WINDOW; in hv_pci_allocate_bridge_windows()
3244 hbus->low_mmio_res->flags &= ~IORESOURCE_BUSY; in hv_pci_allocate_bridge_windows()
3245 pci_add_resource(&hbus->bridge->windows, hbus->low_mmio_res); in hv_pci_allocate_bridge_windows()
3248 if (hbus->high_mmio_space) { in hv_pci_allocate_bridge_windows()
3249 align = 1ULL << (63 - __builtin_clzll(hbus->high_mmio_space)); in hv_pci_allocate_bridge_windows()
3250 ret = vmbus_allocate_mmio(&hbus->high_mmio_res, hbus->hdev, in hv_pci_allocate_bridge_windows()
3252 hbus->high_mmio_space, align, in hv_pci_allocate_bridge_windows()
3255 dev_err(&hbus->hdev->device, in hv_pci_allocate_bridge_windows()
3257 hbus->high_mmio_space); in hv_pci_allocate_bridge_windows()
3262 hbus->high_mmio_res->flags |= IORESOURCE_WINDOW; in hv_pci_allocate_bridge_windows()
3263 hbus->high_mmio_res->flags &= ~IORESOURCE_BUSY; in hv_pci_allocate_bridge_windows()
3264 pci_add_resource(&hbus->bridge->windows, hbus->high_mmio_res); in hv_pci_allocate_bridge_windows()
3270 if (hbus->low_mmio_res) { in hv_pci_allocate_bridge_windows()
3271 vmbus_free_mmio(hbus->low_mmio_res->start, in hv_pci_allocate_bridge_windows()
3272 resource_size(hbus->low_mmio_res)); in hv_pci_allocate_bridge_windows()
3287 static int hv_allocate_config_window(struct hv_pcibus_device *hbus) in hv_allocate_config_window() argument
3295 ret = vmbus_allocate_mmio(&hbus->mem_config, hbus->hdev, 0, -1, in hv_allocate_config_window()
3308 hbus->mem_config->flags |= IORESOURCE_BUSY; in hv_allocate_config_window()
3313 static void hv_free_config_window(struct hv_pcibus_device *hbus) in hv_free_config_window() argument
3315 vmbus_free_mmio(hbus->mem_config->start, PCI_CONFIG_MMIO_LENGTH); in hv_free_config_window()
3328 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_enter_d0() local
3351 d0_entry->mmio_base = hbus->mem_config->start; in hv_pci_enter_d0()
3382 hbus->wslot_res_allocated = 255; in hv_pci_enter_d0()
3418 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_query_relations() local
3425 if (cmpxchg(&hbus->survey_event, NULL, &comp)) in hv_pci_query_relations()
3452 flush_workqueue(hbus->wq); in hv_pci_query_relations()
3476 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_send_resources_allocated() local
3486 size_res = (hbus->protocol_version < PCI_PROTOCOL_VERSION_1_2) in hv_send_resources_allocated()
3496 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_allocated()
3505 if (hbus->protocol_version < PCI_PROTOCOL_VERSION_1_2) { in hv_send_resources_allocated()
3537 hbus->wslot_res_allocated = wslot; in hv_send_resources_allocated()
3553 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_send_resources_released() local
3559 for (wslot = hbus->wslot_res_allocated; wslot >= 0; wslot--) { in hv_send_resources_released()
3560 hpdev = get_pcichild_wslot(hbus, wslot); in hv_send_resources_released()
3575 hbus->wslot_res_allocated = wslot - 1; in hv_send_resources_released()
3578 hbus->wslot_res_allocated = -1; in hv_send_resources_released()
3636 struct hv_pcibus_device *hbus; in hv_pci_probe() local
3645 hbus = kzalloc(sizeof(*hbus), GFP_KERNEL); in hv_pci_probe()
3646 if (!hbus) in hv_pci_probe()
3649 hbus->bridge = bridge; in hv_pci_probe()
3650 mutex_init(&hbus->state_lock); in hv_pci_probe()
3651 hbus->state = hv_pcibus_init; in hv_pci_probe()
3652 hbus->wslot_res_allocated = -1; in hv_pci_probe()
3682 hbus->bridge->domain_nr = dom; in hv_pci_probe()
3684 hbus->sysdata.domain = dom; in hv_pci_probe()
3685 hbus->use_calls = !!(ms_hyperv.hints & HV_X64_USE_MMIO_HYPERCALLS); in hv_pci_probe()
3694 hbus->sysdata.parent = hdev->device.parent; in hv_pci_probe()
3695 hbus->use_calls = false; in hv_pci_probe()
3698 hbus->hdev = hdev; in hv_pci_probe()
3699 INIT_LIST_HEAD(&hbus->children); in hv_pci_probe()
3700 INIT_LIST_HEAD(&hbus->dr_list); in hv_pci_probe()
3701 spin_lock_init(&hbus->config_lock); in hv_pci_probe()
3702 spin_lock_init(&hbus->device_list_lock); in hv_pci_probe()
3703 hbus->wq = alloc_ordered_workqueue("hv_pci_%x", 0, in hv_pci_probe()
3704 hbus->bridge->domain_nr); in hv_pci_probe()
3705 if (!hbus->wq) { in hv_pci_probe()
3715 hv_pci_onchannelcallback, hbus); in hv_pci_probe()
3719 hv_set_drvdata(hdev, hbus); in hv_pci_probe()
3726 ret = hv_allocate_config_window(hbus); in hv_pci_probe()
3730 hbus->cfg_addr = ioremap(hbus->mem_config->start, in hv_pci_probe()
3732 if (!hbus->cfg_addr) { in hv_pci_probe()
3745 hbus->fwnode = irq_domain_alloc_named_fwnode(name); in hv_pci_probe()
3747 if (!hbus->fwnode) { in hv_pci_probe()
3752 ret = hv_pcie_init_irq_domain(hbus); in hv_pci_probe()
3760 mutex_lock(&hbus->state_lock); in hv_pci_probe()
3766 ret = hv_pci_allocate_bridge_windows(hbus); in hv_pci_probe()
3774 prepopulate_bars(hbus); in hv_pci_probe()
3776 hbus->state = hv_pcibus_probed; in hv_pci_probe()
3778 ret = create_root_hv_pci_bus(hbus); in hv_pci_probe()
3782 mutex_unlock(&hbus->state_lock); in hv_pci_probe()
3786 hv_pci_free_bridge_windows(hbus); in hv_pci_probe()
3790 mutex_unlock(&hbus->state_lock); in hv_pci_probe()
3792 irq_domain_remove(hbus->irq_domain); in hv_pci_probe()
3794 irq_domain_free_fwnode(hbus->fwnode); in hv_pci_probe()
3796 iounmap(hbus->cfg_addr); in hv_pci_probe()
3798 hv_free_config_window(hbus); in hv_pci_probe()
3802 destroy_workqueue(hbus->wq); in hv_pci_probe()
3804 hv_put_dom_num(hbus->bridge->domain_nr); in hv_pci_probe()
3806 kfree(hbus); in hv_pci_probe()
3812 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_bus_exit() local
3836 spin_lock_irqsave(&hbus->device_list_lock, flags); in hv_pci_bus_exit()
3837 list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) in hv_pci_bus_exit()
3839 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in hv_pci_bus_exit()
3895 struct hv_pcibus_device *hbus; in hv_pci_remove() local
3897 hbus = hv_get_drvdata(hdev); in hv_pci_remove()
3898 if (hbus->state == hv_pcibus_installed) { in hv_pci_remove()
3900 hbus->state = hv_pcibus_removing; in hv_pci_remove()
3902 destroy_workqueue(hbus->wq); in hv_pci_remove()
3903 hbus->wq = NULL; in hv_pci_remove()
3912 pci_stop_root_bus(hbus->bridge->bus); in hv_pci_remove()
3913 hv_pci_remove_slots(hbus); in hv_pci_remove()
3914 pci_remove_root_bus(hbus->bridge->bus); in hv_pci_remove()
3922 iounmap(hbus->cfg_addr); in hv_pci_remove()
3923 hv_free_config_window(hbus); in hv_pci_remove()
3924 hv_pci_free_bridge_windows(hbus); in hv_pci_remove()
3925 irq_domain_remove(hbus->irq_domain); in hv_pci_remove()
3926 irq_domain_free_fwnode(hbus->fwnode); in hv_pci_remove()
3928 hv_put_dom_num(hbus->bridge->domain_nr); in hv_pci_remove()
3930 kfree(hbus); in hv_pci_remove()
3935 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_suspend() local
3960 old_state = hbus->state; in hv_pci_suspend()
3961 if (hbus->state == hv_pcibus_installed) in hv_pci_suspend()
3962 hbus->state = hv_pcibus_removing; in hv_pci_suspend()
3969 flush_workqueue(hbus->wq); in hv_pci_suspend()
4011 static void hv_pci_restore_msi_state(struct hv_pcibus_device *hbus) in hv_pci_restore_msi_state() argument
4013 pci_walk_bus(hbus->bridge->bus, hv_pci_restore_msi_msg, NULL); in hv_pci_restore_msi_state()
4018 struct hv_pcibus_device *hbus = hv_get_drvdata(hdev); in hv_pci_resume() local
4022 hbus->state = hv_pcibus_init; in hv_pci_resume()
4029 hv_pci_onchannelcallback, hbus); in hv_pci_resume()
4034 version[0] = hbus->protocol_version; in hv_pci_resume()
4043 mutex_lock(&hbus->state_lock); in hv_pci_resume()
4053 prepopulate_bars(hbus); in hv_pci_resume()
4055 hv_pci_restore_msi_state(hbus); in hv_pci_resume()
4057 hbus->state = hv_pcibus_installed; in hv_pci_resume()
4058 mutex_unlock(&hbus->state_lock); in hv_pci_resume()
4062 mutex_unlock(&hbus->state_lock); in hv_pci_resume()