Lines Matching +full:pci +full:- +full:domain
1 // SPDX-License-Identifier: GPL-2.0
8 * This driver acts as a paravirtual front-end for PCI Express root buses.
9 * When a PCI Express function (either an entire device or an SR-IOV
11 * a new bus to the guest VM. This is modeled as a root PCI bus because
13 * VM within Hyper-V, there may seem to be no PCI bus at all in the VM
16 * Each root PCI bus has its own PCI domain, which is called "Segment" in
17 * the PCI Firmware Specifications. Thus while each device passed through
18 * to the VM using this front-end will appear at "device 0", the domain will
19 * be unique. Typically, each bus will have one PCI function on it, though
23 * this driver also implements an IRQ Domain, which handles interrupts (either
24 * MSI or MSI-X) associated with the functions on the bus. As interrupts are
28 * vector. This driver does not support level-triggered (line-based)
32 * The rest of this driver mostly maps PCI concepts onto underlying Hyper-V
34 * by Hyper-V is mapped into a single page of memory space, and the
37 * the PCI back-end driver in Hyper-V.
42 #include <linux/pci.h>
43 #include <linux/pci-ecam.h>
47 #include <linux/irqchip/irq-msi-lib.h>
73 #define CPU_AFFINITY_ALL -1ULL
76 * Supported protocol versions in the order of probing - highest go
88 #define CFG_PAGE_SIZE (PCI_CONFIG_MMIO_LENGTH - CFG_PAGE_OFFSET)
143 * Structures defining the virtual PCI Express protocol.
155 * Function numbers are 8-bits wide on Express, as interpreted through ARI,
158 * the Hyper-V parent partition.
170 * Pretty much as defined in the PCI Specifications.
211 * occupied by this Message-Signaled
213 * in PCI 2.2, this can be between 1 and
214 * 32. For "MSI-X," as first defined in PCI
215 * 3.0, this must be 1, as each MSI-X table
229 * struct hv_msi_desc2 - 1.2 version of hv_msi_desc
235 * occupied by this Message-Signaled
237 * in PCI 2.2, this can be between 1 and
238 * 32. For "MSI-X," as first defined in PCI
239 * 3.0, this must be 1, as each MSI-X table
253 * struct hv_msi_desc3 - 1.3 version of hv_msi_desc
273 * a message-signaled interrupt, either MSI
274 * or MSI-X.
287 * A generic message format for virtual PCI.
317 * Specific message types supporting the PCI protocol.
337 * bus (PCI Express port) is ready for action.
596 return cfg->vector; in hv_msi_get_int_vector()
602 * hv_irq_retarget_interrupt() - "Unmask" the IRQ by setting its current
608 * is built out of this PCI bus's instance GUID and the function
628 pbus = pdev->bus; in hv_irq_retarget_interrupt()
629 hbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata); in hv_irq_retarget_interrupt()
630 int_desc = data->chip_data; in hv_irq_retarget_interrupt()
632 dev_warn(&hbus->hdev->device, "%s() can not unmask irq %u\n", in hv_irq_retarget_interrupt()
633 __func__, data->irq); in hv_irq_retarget_interrupt()
641 params->partition_id = HV_PARTITION_ID_SELF; in hv_irq_retarget_interrupt()
642 params->int_entry.source = HV_INTERRUPT_SOURCE_MSI; in hv_irq_retarget_interrupt()
643 params->int_entry.msi_entry.address.as_uint32 = int_desc->address & 0xffffffff; in hv_irq_retarget_interrupt()
644 params->int_entry.msi_entry.data.as_uint32 = int_desc->data; in hv_irq_retarget_interrupt()
645 params->device_id = (hbus->hdev->dev_instance.b[5] << 24) | in hv_irq_retarget_interrupt()
646 (hbus->hdev->dev_instance.b[4] << 16) | in hv_irq_retarget_interrupt()
647 (hbus->hdev->dev_instance.b[7] << 8) | in hv_irq_retarget_interrupt()
648 (hbus->hdev->dev_instance.b[6] & 0xf8) | in hv_irq_retarget_interrupt()
649 PCI_FUNC(pdev->devfn); in hv_irq_retarget_interrupt()
650 params->int_target.vector = hv_msi_get_int_vector(data); in hv_irq_retarget_interrupt()
652 if (hbus->protocol_version >= PCI_PROTOCOL_VERSION_1_2) { in hv_irq_retarget_interrupt()
660 params->int_target.flags |= in hv_irq_retarget_interrupt()
669 nr_bank = cpumask_to_vpset(¶ms->int_target.vp_set, tmp); in hv_irq_retarget_interrupt()
678 * var-sized hypercall, var-size starts after vp_mask (thus in hv_irq_retarget_interrupt()
685 params->int_target.vp_mask |= in hv_irq_retarget_interrupt()
701 * refer to cpu_disable_common() -> fixup_irqs() -> in hv_irq_retarget_interrupt()
702 * irq_migrate_all_off_this_cpu() -> migrate_one_irq(). in hv_irq_retarget_interrupt()
707 * into the irqdata data structure in migrate_one_irq() -> in hv_irq_retarget_interrupt()
712 if (!hv_result_success(res) && hbus->state != hv_pcibus_removing) in hv_irq_retarget_interrupt()
713 dev_err(&hbus->hdev->device, in hv_irq_retarget_interrupt()
734 * starting with a power of two to satisfy power of 2 multi-MSI requirement.
737 #define HV_PCI_MSI_SPI_NR (1020 - HV_PCI_MSI_SPI_START)
747 /* Hyper-V vPCI MSI GIC IRQ domain */
750 /* Hyper-V PCI MSI IRQ chip */
761 return irqd->parent_data->hwirq; in hv_msi_get_int_vector()
768 * the parent domain.
770 static void hv_pci_vec_irq_free(struct irq_domain *domain, in hv_pci_vec_irq_free() argument
775 struct hv_pci_chip_data *chip_data = domain->host_data; in hv_pci_vec_irq_free()
776 struct irq_data *d = irq_domain_get_irq_data(domain, virq); in hv_pci_vec_irq_free()
777 int first = d->hwirq - HV_PCI_MSI_SPI_START; in hv_pci_vec_irq_free()
780 mutex_lock(&chip_data->map_lock); in hv_pci_vec_irq_free()
781 bitmap_release_region(chip_data->spi_map, in hv_pci_vec_irq_free()
784 mutex_unlock(&chip_data->map_lock); in hv_pci_vec_irq_free()
787 d = irq_domain_get_irq_data(domain, virq + i); in hv_pci_vec_irq_free()
791 irq_domain_free_irqs_parent(domain, virq, nr_dom_irqs); in hv_pci_vec_irq_free()
794 static void hv_pci_vec_irq_domain_free(struct irq_domain *domain, in hv_pci_vec_irq_domain_free() argument
798 hv_pci_vec_irq_free(domain, virq, nr_irqs, nr_irqs); in hv_pci_vec_irq_domain_free()
801 static int hv_pci_vec_alloc_device_irq(struct irq_domain *domain, in hv_pci_vec_alloc_device_irq() argument
805 struct hv_pci_chip_data *chip_data = domain->host_data; in hv_pci_vec_alloc_device_irq()
809 mutex_lock(&chip_data->map_lock); in hv_pci_vec_alloc_device_irq()
810 index = bitmap_find_free_region(chip_data->spi_map, in hv_pci_vec_alloc_device_irq()
813 mutex_unlock(&chip_data->map_lock); in hv_pci_vec_alloc_device_irq()
815 return -ENOSPC; in hv_pci_vec_alloc_device_irq()
822 static int hv_pci_vec_irq_gic_domain_alloc(struct irq_domain *domain, in hv_pci_vec_irq_gic_domain_alloc() argument
830 fwspec.fwnode = domain->parent->fwnode; in hv_pci_vec_irq_gic_domain_alloc()
835 fwspec.param[1] = hwirq - 32; in hv_pci_vec_irq_gic_domain_alloc()
843 ret = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec); in hv_pci_vec_irq_gic_domain_alloc()
852 d = irq_domain_get_irq_data(domain->parent, virq); in hv_pci_vec_irq_gic_domain_alloc()
854 return d->chip->irq_set_type(d, IRQ_TYPE_EDGE_RISING); in hv_pci_vec_irq_gic_domain_alloc()
857 static int hv_pci_vec_irq_domain_alloc(struct irq_domain *domain, in hv_pci_vec_irq_domain_alloc() argument
865 ret = hv_pci_vec_alloc_device_irq(domain, nr_irqs, &hwirq); in hv_pci_vec_irq_domain_alloc()
870 ret = hv_pci_vec_irq_gic_domain_alloc(domain, virq + i, in hv_pci_vec_irq_domain_alloc()
873 hv_pci_vec_irq_free(domain, virq, nr_irqs, i); in hv_pci_vec_irq_domain_alloc()
877 irq_domain_set_hwirq_and_chip(domain, virq + i, in hv_pci_vec_irq_domain_alloc()
880 domain->host_data); in hv_pci_vec_irq_domain_alloc()
893 static int hv_pci_vec_irq_domain_activate(struct irq_domain *domain, in hv_pci_vec_irq_domain_activate() argument
914 struct irq_domain *domain; in hv_pci_of_irq_domain_parent() local
916 parent = of_irq_find_parent(hv_get_vmbus_root_device()->of_node); in hv_pci_of_irq_domain_parent()
919 domain = irq_find_host(parent); in hv_pci_of_irq_domain_parent()
922 return domain; in hv_pci_of_irq_domain_parent()
947 int ret = -ENOMEM; in hv_pci_irqchip_init()
953 mutex_init(&chip_data->map_lock); in hv_pci_irqchip_init()
959 * IRQ domain once enabled, should not be removed since there is no in hv_pci_irqchip_init()
973 ret = -EINVAL; in hv_pci_irqchip_init()
983 pr_err("Failed to create Hyper-V arm64 vPCI MSI IRQ domain\n"); in hv_pci_irqchip_init()
1003 * SPIs are used for interrupts of PCI devices and SPIs is managed via GICD
1004 * registers which Hyper-V already supports, so no hypercall needed.
1010 * hv_pci_generic_compl() - Invoked for a completion packet
1024 comp_pkt->completion_status = resp->status; in hv_pci_generic_compl()
1025 complete(&comp_pkt->host_event); in hv_pci_generic_compl()
1033 refcount_inc(&hpdev->refs); in get_pcichild()
1038 if (refcount_dec_and_test(&hpdev->refs)) in put_pcichild()
1050 if (hdev->channel->rescind) { in wait_for_response()
1051 dev_warn_once(&hdev->device, "The device is gone.\n"); in wait_for_response()
1052 return -ENODEV; in wait_for_response()
1063 * devfn_to_wslot() - Convert from Linux PCI slot to Windows
1064 * @devfn: The Linux representation of PCI slot
1066 * Windows uses a slightly different representation of PCI slot.
1082 * wslot_to_devfn() - Convert from Windows PCI slot to Linux
1083 * @wslot: The Windows representation of PCI slot
1085 * Windows uses a slightly different representation of PCI slot.
1105 * to use the per-cpu input argument page. Use it for in hv_pci_read_mmio()
1110 in->gpa = gpa; in hv_pci_read_mmio()
1111 in->size = size; in hv_pci_read_mmio()
1117 *val = *(u8 *)(out->data); in hv_pci_read_mmio()
1120 *val = *(u16 *)(out->data); in hv_pci_read_mmio()
1123 *val = *(u32 *)(out->data); in hv_pci_read_mmio()
1138 * to use the per-cpu input argument memory. in hv_pci_write_mmio()
1141 in->gpa = gpa; in hv_pci_write_mmio()
1142 in->size = size; in hv_pci_write_mmio()
1145 *(u8 *)(in->data) = val; in hv_pci_write_mmio()
1148 *(u16 *)(in->data) = val; in hv_pci_write_mmio()
1151 *(u32 *)(in->data) = val; in hv_pci_write_mmio()
1162 * PCI Configuration Space for these root PCI buses is implemented as a pair
1163 * of pages in memory-mapped I/O space. Writing to the first page chooses
1164 * the PCI function being written or read. Once the first page has been
1170 * _hv_pcifront_read_config() - Internal PCI config read
1171 * @hpdev: The PCI driver's representation of the device
1179 struct hv_pcibus_device *hbus = hpdev->hbus; in _hv_pcifront_read_config()
1180 struct device *dev = &hbus->hdev->device; in _hv_pcifront_read_config()
1188 memcpy(val, ((u8 *)&hpdev->desc.v_id) + where, size); in _hv_pcifront_read_config()
1191 memcpy(val, ((u8 *)&hpdev->desc.rev) + where - in _hv_pcifront_read_config()
1195 memcpy(val, (u8 *)&hpdev->desc.subsystem_id + where - in _hv_pcifront_read_config()
1204 * Interrupt Line and Interrupt PIN are hard-wired to zero in _hv_pcifront_read_config()
1205 * because this front-end only supports message-signaled in _hv_pcifront_read_config()
1211 spin_lock_irqsave(&hbus->config_lock, flags); in _hv_pcifront_read_config()
1212 if (hbus->use_calls) { in _hv_pcifront_read_config()
1213 phys_addr_t addr = hbus->mem_config->start + offset; in _hv_pcifront_read_config()
1215 hv_pci_write_mmio(dev, hbus->mem_config->start, 4, in _hv_pcifront_read_config()
1216 hpdev->desc.win_slot.slot); in _hv_pcifront_read_config()
1219 void __iomem *addr = hbus->cfg_addr + offset; in _hv_pcifront_read_config()
1222 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in _hv_pcifront_read_config()
1243 spin_unlock_irqrestore(&hbus->config_lock, flags); in _hv_pcifront_read_config()
1251 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pcifront_get_vendor_id()
1252 struct device *dev = &hbus->hdev->device; in hv_pcifront_get_vendor_id()
1257 spin_lock_irqsave(&hbus->config_lock, flags); in hv_pcifront_get_vendor_id()
1259 if (hbus->use_calls) { in hv_pcifront_get_vendor_id()
1260 phys_addr_t addr = hbus->mem_config->start + in hv_pcifront_get_vendor_id()
1263 hv_pci_write_mmio(dev, hbus->mem_config->start, 4, in hv_pcifront_get_vendor_id()
1264 hpdev->desc.win_slot.slot); in hv_pcifront_get_vendor_id()
1268 void __iomem *addr = hbus->cfg_addr + CFG_PAGE_OFFSET + in hv_pcifront_get_vendor_id()
1271 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in hv_pcifront_get_vendor_id()
1282 spin_unlock_irqrestore(&hbus->config_lock, flags); in hv_pcifront_get_vendor_id()
1288 * _hv_pcifront_write_config() - Internal PCI config write
1289 * @hpdev: The PCI driver's representation of the device
1297 struct hv_pcibus_device *hbus = hpdev->hbus; in _hv_pcifront_write_config()
1298 struct device *dev = &hbus->hdev->device; in _hv_pcifront_write_config()
1304 /* SSIDs and ROM BARs are read-only */ in _hv_pcifront_write_config()
1306 spin_lock_irqsave(&hbus->config_lock, flags); in _hv_pcifront_write_config()
1308 if (hbus->use_calls) { in _hv_pcifront_write_config()
1309 phys_addr_t addr = hbus->mem_config->start + offset; in _hv_pcifront_write_config()
1311 hv_pci_write_mmio(dev, hbus->mem_config->start, 4, in _hv_pcifront_write_config()
1312 hpdev->desc.win_slot.slot); in _hv_pcifront_write_config()
1315 void __iomem *addr = hbus->cfg_addr + offset; in _hv_pcifront_write_config()
1318 writel(hpdev->desc.win_slot.slot, hbus->cfg_addr); in _hv_pcifront_write_config()
1339 spin_unlock_irqrestore(&hbus->config_lock, flags); in _hv_pcifront_write_config()
1346 * hv_pcifront_read_config() - Read configuration space
1347 * @bus: PCI Bus structure
1360 container_of(bus->sysdata, struct hv_pcibus_device, sysdata); in hv_pcifront_read_config()
1374 * hv_pcifront_write_config() - Write configuration space
1375 * @bus: PCI Bus structure
1388 container_of(bus->sysdata, struct hv_pcibus_device, sysdata); in hv_pcifront_write_config()
1410 * Hyper-V SR-IOV provides a backchannel mechanism in software for
1412 * "configuration blocks" are similar in concept to PCI configuration space,
1413 * but instead of doing reads and writes in 32-bit chunks through a very slow
1416 * Nearly every SR-IOV device contains just such a communications channel in
1440 * hv_pci_read_config_compl() - Invoked when a response packet
1456 comp->comp_pkt.completion_status = -1; in hv_pci_read_config_compl()
1460 data_len = resp_packet_size - hdr_len; in hv_pci_read_config_compl()
1461 if (data_len > 0 && read_resp->status == 0) { in hv_pci_read_config_compl()
1462 comp->bytes_returned = min(comp->len, data_len); in hv_pci_read_config_compl()
1463 memcpy(comp->buf, read_resp->bytes, comp->bytes_returned); in hv_pci_read_config_compl()
1465 comp->bytes_returned = 0; in hv_pci_read_config_compl()
1468 comp->comp_pkt.completion_status = read_resp->status; in hv_pci_read_config_compl()
1470 complete(&comp->comp_pkt.host_event); in hv_pci_read_config_compl()
1474 * hv_read_config_block() - Sends a read config block request to
1475 * the back-end driver running in the Hyper-V parent partition.
1476 * @pdev: The PCI driver's representation for this device.
1480 * @bytes_returned: Size which came back from the back-end driver.
1482 * Return: 0 on success, -errno on failure
1489 container_of(pdev->bus->sysdata, struct hv_pcibus_device, in hv_read_config_block()
1500 return -EINVAL; in hv_read_config_block()
1510 read_blk->message_type.type = PCI_READ_BLOCK; in hv_read_config_block()
1511 read_blk->wslot.slot = devfn_to_wslot(pdev->devfn); in hv_read_config_block()
1512 read_blk->block_id = block_id; in hv_read_config_block()
1513 read_blk->bytes_requested = len; in hv_read_config_block()
1515 ret = vmbus_sendpacket(hbus->hdev->channel, read_blk, in hv_read_config_block()
1522 ret = wait_for_response(hbus->hdev, &comp_pkt.comp_pkt.host_event); in hv_read_config_block()
1528 dev_err(&hbus->hdev->device, in hv_read_config_block()
1532 return -EIO; in hv_read_config_block()
1540 * hv_pci_write_config_compl() - Invoked when a response packet for a write
1551 comp_pkt->completion_status = resp->status; in hv_pci_write_config_compl()
1552 complete(&comp_pkt->host_event); in hv_pci_write_config_compl()
1556 * hv_write_config_block() - Sends a write config block request to the
1557 * back-end driver running in the Hyper-V parent partition.
1558 * @pdev: The PCI driver's representation for this device.
1563 * Return: 0 on success, -errno on failure
1569 container_of(pdev->bus->sysdata, struct hv_pcibus_device, in hv_write_config_block()
1582 return -EINVAL; in hv_write_config_block()
1590 write_blk->message_type.type = PCI_WRITE_BLOCK; in hv_write_config_block()
1591 write_blk->wslot.slot = devfn_to_wslot(pdev->devfn); in hv_write_config_block()
1592 write_blk->block_id = block_id; in hv_write_config_block()
1593 write_blk->byte_count = len; in hv_write_config_block()
1594 memcpy(write_blk->bytes, buf, len); in hv_write_config_block()
1601 * specified in write_blk->byte_count. in hv_write_config_block()
1605 ret = vmbus_sendpacket(hbus->hdev->channel, write_blk, pkt_size, in hv_write_config_block()
1611 ret = wait_for_response(hbus->hdev, &comp_pkt.host_event); in hv_write_config_block()
1616 dev_err(&hbus->hdev->device, in hv_write_config_block()
1619 return -EIO; in hv_write_config_block()
1626 * hv_register_block_invalidate() - Invoked when a config block invalidation
1627 * arrives from the back-end driver.
1628 * @pdev: The PCI driver's representation for this device.
1632 * Return: 0 on success, -errno on failure
1639 container_of(pdev->bus->sysdata, struct hv_pcibus_device, in hv_register_block_invalidate()
1643 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_register_block_invalidate()
1645 return -ENODEV; in hv_register_block_invalidate()
1647 hpdev->block_invalidate = block_invalidate; in hv_register_block_invalidate()
1648 hpdev->invalidate_context = context; in hv_register_block_invalidate()
1665 if (!int_desc->vector_count) { in hv_int_desc_free()
1671 int_pkt->message_type.type = in hv_int_desc_free()
1673 int_pkt->wslot.slot = hpdev->desc.win_slot.slot; in hv_int_desc_free()
1674 int_pkt->int_desc = *int_desc; in hv_int_desc_free()
1675 vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt, sizeof(*int_pkt), in hv_int_desc_free()
1681 * hv_msi_free() - Free the MSI.
1682 * @domain: The interrupt domain pointer
1683 * @info: Extra MSI-related context
1686 * The Hyper-V parent partition and hypervisor are tracking the
1691 static void hv_msi_free(struct irq_domain *domain, struct msi_domain_info *info, in hv_msi_free() argument
1698 struct irq_data *irq_data = irq_domain_get_irq_data(domain, irq); in hv_msi_free()
1702 hbus = domain->host_data; in hv_msi_free()
1707 irq_data->chip_data = NULL; in hv_msi_free()
1708 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_msi_free()
1720 if (data->parent_data->chip->irq_mask) in hv_irq_mask()
1728 if (data->parent_data->chip->irq_unmask) in hv_irq_unmask()
1745 comp_pkt->comp_pkt.completion_status = -1; in hv_pci_compose_compl()
1748 comp_pkt->comp_pkt.completion_status = resp->status; in hv_pci_compose_compl()
1749 comp_pkt->int_desc = int_resp->int_desc; in hv_pci_compose_compl()
1751 complete(&comp_pkt->comp_pkt.host_event); in hv_pci_compose_compl()
1758 int_pkt->message_type.type = PCI_CREATE_INTERRUPT_MESSAGE; in hv_compose_msi_req_v1()
1759 int_pkt->wslot.slot = slot; in hv_compose_msi_req_v1()
1760 int_pkt->int_desc.vector = vector; in hv_compose_msi_req_v1()
1761 int_pkt->int_desc.vector_count = vector_count; in hv_compose_msi_req_v1()
1762 int_pkt->int_desc.delivery_mode = DELIVERY_MODE; in hv_compose_msi_req_v1()
1768 int_pkt->int_desc.cpu_mask = CPU_AFFINITY_ALL; in hv_compose_msi_req_v1()
1776 * interrupted is specified later in hv_irq_unmask() and communicated to Hyper-V
1778 * not irrelevant because Hyper-V chooses the physical CPU to handle the
1780 * hv_compose_msi_msg(). Hyper-V's choice of pCPU is not visible to the guest,
1782 * performance bottleneck. So we spread out the dummy vCPUs to influence Hyper-V
1785 * For the single-MSI and MSI-X cases, it's OK for hv_compose_msi_req_get_cpu()
1787 * hv_compose_msi_msg() contains the "real" vCPU, causing Hyper-V to choose a
1788 * new pCPU for the interrupt. But for the multi-MSI case, the second call to
1790 * original dummy vCPU is used. This dummy vCPU must be round-robin'ed so that
1791 * the pCPUs are spread out. All interrupts for a multi-MSI device end up using
1795 * With Hyper-V in Nov 2022, the HVCALL_RETARGET_INTERRUPT hypercall does *not*
1796 * cause Hyper-V to reselect the pCPU based on the specified vCPU. Such an
1798 * dummy vCPU selection won't matter, and interrupts for the same multi-MSI
1812 * Make sure the dummy vCPU values for multi-MSI don't all point to vCPU0.
1818 /* -1 means starting with CPU 0 */ in hv_compose_multi_msi_req_get_cpu()
1819 static int cpu_next = -1; in hv_compose_multi_msi_req_get_cpu()
1838 int_pkt->message_type.type = PCI_CREATE_INTERRUPT_MESSAGE2; in hv_compose_msi_req_v2()
1839 int_pkt->wslot.slot = slot; in hv_compose_msi_req_v2()
1840 int_pkt->int_desc.vector = vector; in hv_compose_msi_req_v2()
1841 int_pkt->int_desc.vector_count = vector_count; in hv_compose_msi_req_v2()
1842 int_pkt->int_desc.delivery_mode = DELIVERY_MODE; in hv_compose_msi_req_v2()
1843 int_pkt->int_desc.processor_array[0] = in hv_compose_msi_req_v2()
1845 int_pkt->int_desc.processor_count = 1; in hv_compose_msi_req_v2()
1854 int_pkt->message_type.type = PCI_CREATE_INTERRUPT_MESSAGE3; in hv_compose_msi_req_v3()
1855 int_pkt->wslot.slot = slot; in hv_compose_msi_req_v3()
1856 int_pkt->int_desc.vector = vector; in hv_compose_msi_req_v3()
1857 int_pkt->int_desc.reserved = 0; in hv_compose_msi_req_v3()
1858 int_pkt->int_desc.vector_count = vector_count; in hv_compose_msi_req_v3()
1859 int_pkt->int_desc.delivery_mode = DELIVERY_MODE; in hv_compose_msi_req_v3()
1860 int_pkt->int_desc.processor_array[0] = in hv_compose_msi_req_v3()
1862 int_pkt->int_desc.processor_count = 1; in hv_compose_msi_req_v3()
1868 * hv_compose_msi_msg() - Supplies a valid MSI address/data
1910 multi_msi = !msi_desc->pci.msi_attrib.is_msix && in hv_compose_msi_msg()
1911 msi_desc->nvec_used > 1; in hv_compose_msi_msg()
1914 if (data->chip_data && multi_msi) { in hv_compose_msi_msg()
1915 int_desc = data->chip_data; in hv_compose_msi_msg()
1916 msg->address_hi = int_desc->address >> 32; in hv_compose_msi_msg()
1917 msg->address_lo = int_desc->address & 0xffffffff; in hv_compose_msi_msg()
1918 msg->data = int_desc->data; in hv_compose_msi_msg()
1924 pbus = pdev->bus; in hv_compose_msi_msg()
1925 hbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata); in hv_compose_msi_msg()
1926 channel = hbus->hdev->channel; in hv_compose_msi_msg()
1927 hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn)); in hv_compose_msi_msg()
1932 if (data->chip_data && !multi_msi) { in hv_compose_msi_msg()
1933 int_desc = data->chip_data; in hv_compose_msi_msg()
1934 data->chip_data = NULL; in hv_compose_msi_msg()
1947 if (msi_desc->irq != data->irq) { in hv_compose_msi_msg()
1948 data->chip_data = int_desc; in hv_compose_msi_msg()
1949 int_desc->address = msi_desc->msg.address_lo | in hv_compose_msi_msg()
1950 (u64)msi_desc->msg.address_hi << 32; in hv_compose_msi_msg()
1951 int_desc->data = msi_desc->msg.data + in hv_compose_msi_msg()
1952 (data->irq - msi_desc->irq); in hv_compose_msi_msg()
1953 msg->address_hi = msi_desc->msg.address_hi; in hv_compose_msi_msg()
1954 msg->address_lo = msi_desc->msg.address_lo; in hv_compose_msi_msg()
1955 msg->data = int_desc->data; in hv_compose_msi_msg()
1962 * to be aligned with the count, and also not zero. Multi-msi in hv_compose_msi_msg()
1966 vector_count = msi_desc->nvec_used; in hv_compose_msi_msg()
1984 switch (hbus->protocol_version) { in hv_compose_msi_msg()
1987 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
1996 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
2004 hpdev->desc.win_slot.slot, in hv_compose_msi_msg()
2014 dev_err(&hbus->hdev->device, in hv_compose_msi_msg()
2019 ret = vmbus_sendpacket_getid(hpdev->hbus->hdev->channel, &ctxt.int_pkts, in hv_compose_msi_msg()
2024 dev_err(&hbus->hdev->device, in hv_compose_msi_msg()
2034 tasklet_disable_in_atomic(&channel->callback_event); in hv_compose_msi_msg()
2043 /* 0xFFFF means an invalid PCI VENDOR ID. */ in hv_compose_msi_msg()
2045 dev_err_once(&hbus->hdev->device, in hv_compose_msi_msg()
2057 spin_lock_irqsave(&channel->sched_lock, flags); in hv_compose_msi_msg()
2058 if (unlikely(channel->onchannel_callback == NULL)) { in hv_compose_msi_msg()
2059 spin_unlock_irqrestore(&channel->sched_lock, flags); in hv_compose_msi_msg()
2063 spin_unlock_irqrestore(&channel->sched_lock, flags); in hv_compose_msi_msg()
2068 tasklet_enable(&channel->callback_event); in hv_compose_msi_msg()
2071 dev_err(&hbus->hdev->device, in hv_compose_msi_msg()
2083 data->chip_data = int_desc; in hv_compose_msi_msg()
2086 msg->address_hi = comp.int_desc.address >> 32; in hv_compose_msi_msg()
2087 msg->address_lo = comp.int_desc.address & 0xffffffff; in hv_compose_msi_msg()
2088 msg->data = comp.int_desc.data; in hv_compose_msi_msg()
2094 tasklet_enable(&channel->callback_event); in hv_compose_msi_msg()
2099 * been 're-used', i.e., already removed and (re-)mapped.) in hv_compose_msi_msg()
2109 msg->address_hi = 0; in hv_compose_msi_msg()
2110 msg->address_lo = 0; in hv_compose_msi_msg()
2111 msg->data = 0; in hv_compose_msi_msg()
2114 static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *domain, in hv_pcie_init_dev_msi_info() argument
2117 struct irq_chip *chip = info->chip; in hv_pcie_init_dev_msi_info()
2119 if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info)) in hv_pcie_init_dev_msi_info()
2122 info->ops->msi_prepare = hv_msi_prepare; in hv_pcie_init_dev_msi_info()
2124 chip->irq_set_affinity = irq_chip_set_affinity_parent; in hv_pcie_init_dev_msi_info()
2127 chip->flags |= IRQCHIP_MOVE_DEFERRED; in hv_pcie_init_dev_msi_info()
2145 .prefix = "HV-",
2151 .name = "Hyper-V PCIe MSI",
2184 struct msi_domain_info *info = d->host_data; in hv_pcie_domain_free()
2198 * hv_pcie_init_irq_domain() - Initialize IRQ domain
2199 * @hbus: The root PCI bus
2201 * This function creates an IRQ domain which will be used for
2203 * devices only support MSI and MSI-X, not line-based interrupts
2204 * or simulations of line-based interrupts through PCIe's
2205 * fabric-layer messages. Because interrupts are remapped, we
2206 * can support multi-message MSI here.
2213 .fwnode = hbus->fwnode, in hv_pcie_init_irq_domain()
2219 hbus->irq_domain = msi_create_parent_irq_domain(&info, &hv_pcie_msi_parent_ops); in hv_pcie_init_irq_domain()
2220 if (!hbus->irq_domain) { in hv_pcie_init_irq_domain()
2221 dev_err(&hbus->hdev->device, in hv_pcie_init_irq_domain()
2222 "Failed to build an MSI IRQ domain\n"); in hv_pcie_init_irq_domain()
2223 return -ENODEV; in hv_pcie_init_irq_domain()
2226 dev_set_msi_domain(&hbus->bridge->dev, hbus->irq_domain); in hv_pcie_init_irq_domain()
2232 * get_bar_size() - Get the address space consumed by a BAR
2233 * @bar_val: Value that a BAR returned after -1 was written
2252 * survey_child_resources() - Total all MMIO requirements
2253 * @hbus: Root PCI bus, as understood by this driver
2265 event = xchg(&hbus->survey_event, NULL); in survey_child_resources()
2270 if (hbus->low_mmio_space || hbus->high_mmio_space) { in survey_child_resources()
2275 spin_lock_irqsave(&hbus->device_list_lock, flags); in survey_child_resources()
2278 * Due to an interesting quirk of the PCI spec, all memory regions in survey_child_resources()
2282 list_for_each_entry(hpdev, &hbus->children, list_entry) { in survey_child_resources()
2284 if (hpdev->probed_bar[i] & PCI_BASE_ADDRESS_SPACE_IO) in survey_child_resources()
2285 dev_err(&hbus->hdev->device, in survey_child_resources()
2288 if (hpdev->probed_bar[i] != 0) { in survey_child_resources()
2294 bar_val = hpdev->probed_bar[i]; in survey_child_resources()
2297 ((u64)hpdev->probed_bar[++i] << 32); in survey_child_resources()
2304 hbus->high_mmio_space += bar_size; in survey_child_resources()
2306 hbus->low_mmio_space += bar_size; in survey_child_resources()
2311 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in survey_child_resources()
2316 * prepopulate_bars() - Fill in BARs with defaults
2317 * @hbus: Root PCI bus, as understood by this driver
2319 * The core PCI driver code seems much, much happier if the BARs
2324 * the memory-mapped I/O space will be aligned on the largest
2341 if (hbus->low_mmio_space) { in prepopulate_bars()
2342 low_size = 1ULL << (63 - __builtin_clzll(hbus->low_mmio_space)); in prepopulate_bars()
2343 low_base = hbus->low_mmio_res->start; in prepopulate_bars()
2346 if (hbus->high_mmio_space) { in prepopulate_bars()
2348 (63 - __builtin_clzll(hbus->high_mmio_space)); in prepopulate_bars()
2349 high_base = hbus->high_mmio_res->start; in prepopulate_bars()
2352 spin_lock_irqsave(&hbus->device_list_lock, flags); in prepopulate_bars()
2360 * If the memory enable bit is already set, Hyper-V silently ignores in prepopulate_bars()
2361 * the below BAR updates, and the related PCI device driver can not in prepopulate_bars()
2365 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
2373 list_for_each_entry(hpdev, &hbus->children, list_entry) { in prepopulate_bars()
2375 bar_val = hpdev->probed_bar[i]; in prepopulate_bars()
2381 ((u64)hpdev->probed_bar[i + 1] in prepopulate_bars()
2414 * the core PCI driver doesn't require the bit in prepopulate_bars()
2415 * to be pre-set. Actually here we intentionally in prepopulate_bars()
2416 * keep the bit off so that the PCI BAR probing in prepopulate_bars()
2417 * in the core PCI driver doesn't cause Hyper-V in prepopulate_bars()
2431 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in prepopulate_bars()
2435 * Assign entries in sysfs pci slot directory.
2440 * same ordered workqueue. Therefore hbus->children list will not change
2449 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_assign_slots()
2450 if (hpdev->pci_slot) in hv_pci_assign_slots()
2453 slot_nr = PCI_SLOT(wslot_to_devfn(hpdev->desc.win_slot.slot)); in hv_pci_assign_slots()
2454 snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser); in hv_pci_assign_slots()
2455 hpdev->pci_slot = pci_create_slot(hbus->bridge->bus, slot_nr, in hv_pci_assign_slots()
2457 if (IS_ERR(hpdev->pci_slot)) { in hv_pci_assign_slots()
2459 hpdev->pci_slot = NULL; in hv_pci_assign_slots()
2465 * Remove entries in sysfs pci slot directory.
2471 list_for_each_entry(hpdev, &hbus->children, list_entry) { in hv_pci_remove_slots()
2472 if (!hpdev->pci_slot) in hv_pci_remove_slots()
2474 pci_destroy_slot(hpdev->pci_slot); in hv_pci_remove_slots()
2475 hpdev->pci_slot = NULL; in hv_pci_remove_slots()
2485 struct pci_bus *bus = hbus->bridge->bus; in hv_pci_assign_numa_node()
2488 list_for_each_entry(dev, &bus->devices, bus_list) { in hv_pci_assign_numa_node()
2489 hv_dev = get_pcichild_wslot(hbus, devfn_to_wslot(dev->devfn)); in hv_pci_assign_numa_node()
2493 if (hv_dev->desc.flags & HV_PCI_DEVICE_FLAG_NUMA_AFFINITY && in hv_pci_assign_numa_node()
2494 hv_dev->desc.virtual_numa_node < num_possible_nodes()) in hv_pci_assign_numa_node()
2501 set_dev_node(&dev->dev, in hv_pci_assign_numa_node()
2503 hv_dev->desc.virtual_numa_node)); in hv_pci_assign_numa_node()
2510 * create_root_hv_pci_bus() - Expose a new root PCI bus
2511 * @hbus: Root PCI bus, as understood by this driver
2513 * Return: 0 on success, -errno on failure
2518 struct pci_host_bridge *bridge = hbus->bridge; in create_root_hv_pci_bus()
2520 bridge->dev.parent = &hbus->hdev->device; in create_root_hv_pci_bus()
2521 bridge->sysdata = &hbus->sysdata; in create_root_hv_pci_bus()
2522 bridge->ops = &hv_pcifront_ops; in create_root_hv_pci_bus()
2530 pci_bus_assign_resources(bridge->bus); in create_root_hv_pci_bus()
2532 pci_bus_add_devices(bridge->bus); in create_root_hv_pci_bus()
2534 hbus->state = hv_pcibus_installed; in create_root_hv_pci_bus()
2544 * q_resource_requirements() - Query Resource Requirements
2561 status = (resp_packet_size < sizeof(*q_res_req)) ? -1 : resp->status; in q_resource_requirements()
2563 dev_err(&completion->hpdev->hbus->hdev->device, in q_resource_requirements()
2568 completion->hpdev->probed_bar[i] = in q_resource_requirements()
2569 q_res_req->probed_bar[i]; in q_resource_requirements()
2573 complete(&completion->host_event); in q_resource_requirements()
2577 * new_pcichild_device() - Create a new child device
2578 * @hbus: The internal struct tracking this root PCI bus.
2604 hpdev->hbus = hbus; in new_pcichild_device()
2612 res_req->message_type.type = PCI_QUERY_RESOURCE_REQUIREMENTS; in new_pcichild_device()
2613 res_req->wslot.slot = desc->win_slot.slot; in new_pcichild_device()
2615 ret = vmbus_sendpacket(hbus->hdev->channel, res_req, in new_pcichild_device()
2623 if (wait_for_response(hbus->hdev, &comp_pkt.host_event)) in new_pcichild_device()
2626 hpdev->desc = *desc; in new_pcichild_device()
2627 refcount_set(&hpdev->refs, 1); in new_pcichild_device()
2629 spin_lock_irqsave(&hbus->device_list_lock, flags); in new_pcichild_device()
2631 list_add_tail(&hpdev->list_entry, &hbus->children); in new_pcichild_device()
2632 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in new_pcichild_device()
2641 * get_pcichild_wslot() - Find device from slot
2642 * @hbus: Root PCI bus, as understood by this driver
2645 * This function looks up a PCI device and returns the internal
2651 * Return: Internal representation of a PCI device
2659 spin_lock_irqsave(&hbus->device_list_lock, flags); in get_pcichild_wslot()
2660 list_for_each_entry(iter, &hbus->children, list_entry) { in get_pcichild_wslot()
2661 if (iter->desc.win_slot.slot == wslot) { in get_pcichild_wslot()
2667 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in get_pcichild_wslot()
2673 * pci_devices_present_work() - Handle new list of child devices
2678 * debug the interaction between Hyper-V and Linux. This
2680 * of functions that should be observed under this PCI Express
2693 * because both are pushed to the ordered workqueue hbus->wq.
2708 hbus = dr_wrk->bus; in pci_devices_present_work()
2714 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2715 while (!list_empty(&hbus->dr_list)) { in pci_devices_present_work()
2716 dr = list_first_entry(&hbus->dr_list, struct hv_dr_state, in pci_devices_present_work()
2718 list_del(&dr->list_entry); in pci_devices_present_work()
2721 if (!list_empty(&hbus->dr_list)) { in pci_devices_present_work()
2726 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2731 mutex_lock(&hbus->state_lock); in pci_devices_present_work()
2734 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2735 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2736 hpdev->reported_missing = true; in pci_devices_present_work()
2738 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2741 for (child_no = 0; child_no < dr->device_count; child_no++) { in pci_devices_present_work()
2743 new_desc = &dr->func[child_no]; in pci_devices_present_work()
2745 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2746 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2747 if ((hpdev->desc.win_slot.slot == new_desc->win_slot.slot) && in pci_devices_present_work()
2748 (hpdev->desc.v_id == new_desc->v_id) && in pci_devices_present_work()
2749 (hpdev->desc.d_id == new_desc->d_id) && in pci_devices_present_work()
2750 (hpdev->desc.ser == new_desc->ser)) { in pci_devices_present_work()
2751 hpdev->reported_missing = false; in pci_devices_present_work()
2755 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2760 dev_err(&hbus->hdev->device, in pci_devices_present_work()
2766 spin_lock_irqsave(&hbus->device_list_lock, flags); in pci_devices_present_work()
2769 list_for_each_entry(hpdev, &hbus->children, list_entry) { in pci_devices_present_work()
2770 if (hpdev->reported_missing) { in pci_devices_present_work()
2773 list_move_tail(&hpdev->list_entry, &removed); in pci_devices_present_work()
2778 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in pci_devices_present_work()
2784 list_del(&hpdev->list_entry); in pci_devices_present_work()
2786 if (hpdev->pci_slot) in pci_devices_present_work()
2787 pci_destroy_slot(hpdev->pci_slot); in pci_devices_present_work()
2792 switch (hbus->state) { in pci_devices_present_work()
2799 pci_scan_child_bus(hbus->bridge->bus); in pci_devices_present_work()
2814 mutex_unlock(&hbus->state_lock); in pci_devices_present_work()
2820 * hv_pci_start_relations_work() - Queue work to start device discovery
2821 * @hbus: Root PCI bus, as understood by this driver
2824 * Return: 0 on success, -errno on failure
2833 if (hbus->state == hv_pcibus_removing) { in hv_pci_start_relations_work()
2834 dev_info(&hbus->hdev->device, in hv_pci_start_relations_work()
2835 "PCI VMBus BUS_RELATIONS: ignored\n"); in hv_pci_start_relations_work()
2836 return -ENOENT; in hv_pci_start_relations_work()
2841 return -ENOMEM; in hv_pci_start_relations_work()
2843 INIT_WORK(&dr_wrk->wrk, pci_devices_present_work); in hv_pci_start_relations_work()
2844 dr_wrk->bus = hbus; in hv_pci_start_relations_work()
2846 spin_lock_irqsave(&hbus->device_list_lock, flags); in hv_pci_start_relations_work()
2852 pending_dr = !list_empty(&hbus->dr_list); in hv_pci_start_relations_work()
2853 list_add_tail(&dr->list_entry, &hbus->dr_list); in hv_pci_start_relations_work()
2854 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in hv_pci_start_relations_work()
2859 queue_work(hbus->wq, &dr_wrk->wrk); in hv_pci_start_relations_work()
2865 * hv_pci_devices_present() - Handle list of new children
2866 * @hbus: Root PCI bus, as understood by this driver
2879 dr = kzalloc(struct_size(dr, func, relations->device_count), in hv_pci_devices_present()
2884 dr->device_count = relations->device_count; in hv_pci_devices_present()
2885 for (i = 0; i < dr->device_count; i++) { in hv_pci_devices_present()
2886 dr->func[i].v_id = relations->func[i].v_id; in hv_pci_devices_present()
2887 dr->func[i].d_id = relations->func[i].d_id; in hv_pci_devices_present()
2888 dr->func[i].rev = relations->func[i].rev; in hv_pci_devices_present()
2889 dr->func[i].prog_intf = relations->func[i].prog_intf; in hv_pci_devices_present()
2890 dr->func[i].subclass = relations->func[i].subclass; in hv_pci_devices_present()
2891 dr->func[i].base_class = relations->func[i].base_class; in hv_pci_devices_present()
2892 dr->func[i].subsystem_id = relations->func[i].subsystem_id; in hv_pci_devices_present()
2893 dr->func[i].win_slot = relations->func[i].win_slot; in hv_pci_devices_present()
2894 dr->func[i].ser = relations->func[i].ser; in hv_pci_devices_present()
2902 * hv_pci_devices_present2() - Handle list of new children
2903 * @hbus: Root PCI bus, as understood by this driver
2914 dr = kzalloc(struct_size(dr, func, relations->device_count), in hv_pci_devices_present2()
2919 dr->device_count = relations->device_count; in hv_pci_devices_present2()
2920 for (i = 0; i < dr->device_count; i++) { in hv_pci_devices_present2()
2921 dr->func[i].v_id = relations->func[i].v_id; in hv_pci_devices_present2()
2922 dr->func[i].d_id = relations->func[i].d_id; in hv_pci_devices_present2()
2923 dr->func[i].rev = relations->func[i].rev; in hv_pci_devices_present2()
2924 dr->func[i].prog_intf = relations->func[i].prog_intf; in hv_pci_devices_present2()
2925 dr->func[i].subclass = relations->func[i].subclass; in hv_pci_devices_present2()
2926 dr->func[i].base_class = relations->func[i].base_class; in hv_pci_devices_present2()
2927 dr->func[i].subsystem_id = relations->func[i].subsystem_id; in hv_pci_devices_present2()
2928 dr->func[i].win_slot = relations->func[i].win_slot; in hv_pci_devices_present2()
2929 dr->func[i].ser = relations->func[i].ser; in hv_pci_devices_present2()
2930 dr->func[i].flags = relations->func[i].flags; in hv_pci_devices_present2()
2931 dr->func[i].virtual_numa_node = in hv_pci_devices_present2()
2932 relations->func[i].virtual_numa_node; in hv_pci_devices_present2()
2940 * hv_eject_device_work() - Asynchronously handles ejection
2962 hbus = hpdev->hbus; in hv_eject_device_work()
2964 mutex_lock(&hbus->state_lock); in hv_eject_device_work()
2967 * Ejection can come before or after the PCI bus has been set up, so in hv_eject_device_work()
2969 * must be done without constructs like pci_domain_nr(hbus->bridge->bus) in hv_eject_device_work()
2970 * because hbus->bridge->bus may not exist yet. in hv_eject_device_work()
2972 wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); in hv_eject_device_work()
2973 pdev = pci_get_domain_bus_and_slot(hbus->bridge->domain_nr, 0, wslot); in hv_eject_device_work()
2981 spin_lock_irqsave(&hbus->device_list_lock, flags); in hv_eject_device_work()
2982 list_del(&hpdev->list_entry); in hv_eject_device_work()
2983 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in hv_eject_device_work()
2985 if (hpdev->pci_slot) in hv_eject_device_work()
2986 pci_destroy_slot(hpdev->pci_slot); in hv_eject_device_work()
2990 ejct_pkt->message_type.type = PCI_EJECTION_COMPLETE; in hv_eject_device_work()
2991 ejct_pkt->wslot.slot = hpdev->desc.win_slot.slot; in hv_eject_device_work()
2992 vmbus_sendpacket(hbus->hdev->channel, ejct_pkt, in hv_eject_device_work()
3003 mutex_unlock(&hbus->state_lock); in hv_eject_device_work()
3007 * hv_pci_eject_device() - Handles device ejection
3011 * just schedules work so that we don't re-enter the packet
3016 struct hv_pcibus_device *hbus = hpdev->hbus; in hv_pci_eject_device()
3017 struct hv_device *hdev = hbus->hdev; in hv_pci_eject_device()
3019 if (hbus->state == hv_pcibus_removing) { in hv_pci_eject_device()
3020 dev_info(&hdev->device, "PCI VMBus EJECT: ignored\n"); in hv_pci_eject_device()
3025 INIT_WORK(&hpdev->wrk, hv_eject_device_work); in hv_pci_eject_device()
3026 queue_work(hbus->wq, &hpdev->wrk); in hv_pci_eject_device()
3030 * hv_pci_onchannelcallback() - Handles incoming packets
3034 * this channel (which is private to this root PCI bus).
3041 struct vmbus_channel *chan = hbus->hdev->channel; in hv_pci_onchannelcallback()
3065 if (ret == -ENOBUFS) { in hv_pci_onchannelcallback()
3087 switch (desc->type) { in hv_pci_onchannelcallback()
3095 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3103 * Call ->completion_func() within the critical section to make in hv_pci_onchannelcallback()
3109 comp_packet->completion_func(comp_packet->compl_ctxt, in hv_pci_onchannelcallback()
3118 switch (new_message->message_type.type) { in hv_pci_onchannelcallback()
3125 bus_rel->device_count)) { in hv_pci_onchannelcallback()
3126 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3140 bus_rel2->device_count)) { in hv_pci_onchannelcallback()
3141 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3153 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3158 dev_message->wslot.slot); in hv_pci_onchannelcallback()
3169 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3174 inval->wslot.slot); in hv_pci_onchannelcallback()
3176 if (hpdev->block_invalidate) { in hv_pci_onchannelcallback()
3177 hpdev->block_invalidate( in hv_pci_onchannelcallback()
3178 hpdev->invalidate_context, in hv_pci_onchannelcallback()
3179 inval->block_mask); in hv_pci_onchannelcallback()
3186 dev_warn(&hbus->hdev->device, in hv_pci_onchannelcallback()
3188 new_message->message_type.type); in hv_pci_onchannelcallback()
3194 dev_err(&hbus->hdev->device, in hv_pci_onchannelcallback()
3196 desc->type, req_id, bytes_recvd); in hv_pci_onchannelcallback()
3205 * hv_pci_protocol_negotiation() - Set up protocol
3206 * @hdev: VMBus's tracking struct for this root PCI bus.
3208 * the order of probing - highest go first.
3216 * surface area of PCI emulation so that these actions can take
3242 return -ENOMEM; in hv_pci_protocol_negotiation()
3245 pkt->completion_func = hv_pci_generic_compl; in hv_pci_protocol_negotiation()
3246 pkt->compl_ctxt = &comp_pkt; in hv_pci_protocol_negotiation()
3248 version_req->message_type.type = PCI_QUERY_PROTOCOL_VERSION; in hv_pci_protocol_negotiation()
3251 version_req->protocol_version = version[i]; in hv_pci_protocol_negotiation()
3252 ret = vmbus_sendpacket(hdev->channel, version_req, in hv_pci_protocol_negotiation()
3260 dev_err(&hdev->device, in hv_pci_protocol_negotiation()
3261 "PCI Pass-through VSP failed to request version: %d", in hv_pci_protocol_negotiation()
3267 hbus->protocol_version = version[i]; in hv_pci_protocol_negotiation()
3268 dev_info(&hdev->device, in hv_pci_protocol_negotiation()
3269 "PCI VMBus probing: Using version %#x\n", in hv_pci_protocol_negotiation()
3270 hbus->protocol_version); in hv_pci_protocol_negotiation()
3275 dev_err(&hdev->device, in hv_pci_protocol_negotiation()
3276 "PCI Pass-through VSP failed version request: %#x", in hv_pci_protocol_negotiation()
3278 ret = -EPROTO; in hv_pci_protocol_negotiation()
3285 dev_err(&hdev->device, in hv_pci_protocol_negotiation()
3286 "PCI pass-through VSP failed to find supported version"); in hv_pci_protocol_negotiation()
3287 ret = -EPROTO; in hv_pci_protocol_negotiation()
3295 * hv_pci_free_bridge_windows() - Release memory regions for the
3297 * @hbus: Root PCI bus, as understood by this driver
3306 if (hbus->low_mmio_space && hbus->low_mmio_res) { in hv_pci_free_bridge_windows()
3307 hbus->low_mmio_res->flags |= IORESOURCE_BUSY; in hv_pci_free_bridge_windows()
3308 vmbus_free_mmio(hbus->low_mmio_res->start, in hv_pci_free_bridge_windows()
3309 resource_size(hbus->low_mmio_res)); in hv_pci_free_bridge_windows()
3312 if (hbus->high_mmio_space && hbus->high_mmio_res) { in hv_pci_free_bridge_windows()
3313 hbus->high_mmio_res->flags |= IORESOURCE_BUSY; in hv_pci_free_bridge_windows()
3314 vmbus_free_mmio(hbus->high_mmio_res->start, in hv_pci_free_bridge_windows()
3315 resource_size(hbus->high_mmio_res)); in hv_pci_free_bridge_windows()
3320 * hv_pci_allocate_bridge_windows() - Allocate memory regions
3322 * @hbus: Root PCI bus, as understood by this driver
3326 * in the kernel such that it comprehends either PCI devices
3339 * endpoint PCI function driver calls request_mem_region() or
3342 * Return: 0 on success, -errno on failure
3349 if (hbus->low_mmio_space) { in hv_pci_allocate_bridge_windows()
3350 align = 1ULL << (63 - __builtin_clzll(hbus->low_mmio_space)); in hv_pci_allocate_bridge_windows()
3351 ret = vmbus_allocate_mmio(&hbus->low_mmio_res, hbus->hdev, 0, in hv_pci_allocate_bridge_windows()
3353 hbus->low_mmio_space, in hv_pci_allocate_bridge_windows()
3356 dev_err(&hbus->hdev->device, in hv_pci_allocate_bridge_windows()
3358 hbus->low_mmio_space); in hv_pci_allocate_bridge_windows()
3363 hbus->low_mmio_res->flags |= IORESOURCE_WINDOW; in hv_pci_allocate_bridge_windows()
3364 hbus->low_mmio_res->flags &= ~IORESOURCE_BUSY; in hv_pci_allocate_bridge_windows()
3365 pci_add_resource(&hbus->bridge->windows, hbus->low_mmio_res); in hv_pci_allocate_bridge_windows()
3368 if (hbus->high_mmio_space) { in hv_pci_allocate_bridge_windows()
3369 align = 1ULL << (63 - __builtin_clzll(hbus->high_mmio_space)); in hv_pci_allocate_bridge_windows()
3370 ret = vmbus_allocate_mmio(&hbus->high_mmio_res, hbus->hdev, in hv_pci_allocate_bridge_windows()
3371 0x100000000, -1, in hv_pci_allocate_bridge_windows()
3372 hbus->high_mmio_space, align, in hv_pci_allocate_bridge_windows()
3375 dev_err(&hbus->hdev->device, in hv_pci_allocate_bridge_windows()
3377 hbus->high_mmio_space); in hv_pci_allocate_bridge_windows()
3382 hbus->high_mmio_res->flags |= IORESOURCE_WINDOW; in hv_pci_allocate_bridge_windows()
3383 hbus->high_mmio_res->flags &= ~IORESOURCE_BUSY; in hv_pci_allocate_bridge_windows()
3384 pci_add_resource(&hbus->bridge->windows, hbus->high_mmio_res); in hv_pci_allocate_bridge_windows()
3390 if (hbus->low_mmio_res) { in hv_pci_allocate_bridge_windows()
3391 vmbus_free_mmio(hbus->low_mmio_res->start, in hv_pci_allocate_bridge_windows()
3392 resource_size(hbus->low_mmio_res)); in hv_pci_allocate_bridge_windows()
3399 * hv_allocate_config_window() - Find MMIO space for PCI Config
3400 * @hbus: Root PCI bus, as understood by this driver
3402 * This function claims memory-mapped I/O space for accessing
3405 * Return: 0 on success, -errno on failure
3415 ret = vmbus_allocate_mmio(&hbus->mem_config, hbus->hdev, 0, -1, in hv_allocate_config_window()
3428 hbus->mem_config->flags |= IORESOURCE_BUSY; in hv_allocate_config_window()
3435 vmbus_free_mmio(hbus->mem_config->start, PCI_CONFIG_MMIO_LENGTH); in hv_free_config_window()
3441 * hv_pci_enter_d0() - Bring the "bus" into the D0 power state
3442 * @hdev: VMBus's tracking struct for this root PCI bus
3444 * Return: 0 on success, -errno on failure
3458 * powered-on state. This includes telling the host which region in hv_pci_enter_d0()
3459 * of memory-mapped I/O space has been chosen for configuration space in hv_pci_enter_d0()
3464 return -ENOMEM; in hv_pci_enter_d0()
3467 pkt->completion_func = hv_pci_generic_compl; in hv_pci_enter_d0()
3468 pkt->compl_ctxt = &comp_pkt; in hv_pci_enter_d0()
3470 d0_entry->message_type.type = PCI_BUS_D0ENTRY; in hv_pci_enter_d0()
3471 d0_entry->mmio_base = hbus->mem_config->start; in hv_pci_enter_d0()
3473 ret = vmbus_sendpacket(hdev->channel, d0_entry, sizeof(*d0_entry), in hv_pci_enter_d0()
3483 * In certain case (Kdump) the pci device of interest was in hv_pci_enter_d0()
3492 dev_err(&hdev->device, "Retrying D0 Entry\n"); in hv_pci_enter_d0()
3502 hbus->wslot_res_allocated = 255; in hv_pci_enter_d0()
3510 dev_err(&hdev->device, in hv_pci_enter_d0()
3515 dev_err(&hdev->device, in hv_pci_enter_d0()
3516 "PCI Pass-through VSP failed D0 Entry with status %x\n", in hv_pci_enter_d0()
3518 ret = -EPROTO; in hv_pci_enter_d0()
3530 * hv_pci_query_relations() - Ask host to send list of child
3532 * @hdev: VMBus's tracking struct for this root PCI bus
3534 * Return: 0 on success, -errno on failure
3545 if (cmpxchg(&hbus->survey_event, NULL, &comp)) in hv_pci_query_relations()
3546 return -ENOTEMPTY; in hv_pci_query_relations()
3551 ret = vmbus_sendpacket(hdev->channel, &message, sizeof(message), in hv_pci_query_relations()
3558 * vmbus_sendpacket() or wait_for_response() returns -ENODEV but we in hv_pci_query_relations()
3560 * channel callback already scheduled a work to hbus->wq, which can be in hv_pci_query_relations()
3561 * running pci_devices_present_work() -> survey_child_resources() -> in hv_pci_query_relations()
3562 * complete(&hbus->survey_event), even after hv_pci_query_relations() in hv_pci_query_relations()
3565 * raw_spin_lock_irqsave(). Flush hbus->wq before we exit from in hv_pci_query_relations()
3567 * -ENODEV, there can't be any more work item scheduled to hbus->wq in hv_pci_query_relations()
3568 * after the flush_workqueue(): see vmbus_onoffer_rescind() -> in hv_pci_query_relations()
3569 * vmbus_reset_channel_cb(), vmbus_rescind_cleanup() -> in hv_pci_query_relations()
3570 * channel->rescind = true. in hv_pci_query_relations()
3572 flush_workqueue(hbus->wq); in hv_pci_query_relations()
3578 * hv_send_resources_allocated() - Report local resource choices
3579 * @hdev: VMBus's tracking struct for this root PCI bus
3588 * is deeply expecting to scan an emulated PCI configuration
3592 * Return: 0 on success, -errno on failure
3606 size_res = (hbus->protocol_version < PCI_PROTOCOL_VERSION_1_2) in hv_send_resources_allocated()
3611 return -ENOMEM; in hv_send_resources_allocated()
3622 pkt->completion_func = hv_pci_generic_compl; in hv_send_resources_allocated()
3623 pkt->compl_ctxt = &comp_pkt; in hv_send_resources_allocated()
3625 if (hbus->protocol_version < PCI_PROTOCOL_VERSION_1_2) { in hv_send_resources_allocated()
3628 res_assigned->message_type.type = in hv_send_resources_allocated()
3630 res_assigned->wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_allocated()
3634 res_assigned2->message_type.type = in hv_send_resources_allocated()
3636 res_assigned2->wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_allocated()
3640 ret = vmbus_sendpacket(hdev->channel, pkt + 1, in hv_send_resources_allocated()
3650 ret = -EPROTO; in hv_send_resources_allocated()
3651 dev_err(&hdev->device, in hv_send_resources_allocated()
3657 hbus->wslot_res_allocated = wslot; in hv_send_resources_allocated()
3665 * hv_send_resources_released() - Report local resources
3667 * @hdev: VMBus's tracking struct for this root PCI bus
3669 * Return: 0 on success, -errno on failure
3679 for (wslot = hbus->wslot_res_allocated; wslot >= 0; wslot--) { in hv_send_resources_released()
3686 pkt.wslot.slot = hpdev->desc.win_slot.slot; in hv_send_resources_released()
3690 ret = vmbus_sendpacket(hdev->channel, &pkt, sizeof(pkt), 0, in hv_send_resources_released()
3695 hbus->wslot_res_allocated = wslot - 1; in hv_send_resources_released()
3698 hbus->wslot_res_allocated = -1; in hv_send_resources_released()
3707 * PCI domain number 0 is used by emulated devices on Gen1 VMs, so define 0
3708 * as invalid for passthrough PCI devices of this driver.
3713 * hv_get_dom_num() - Get a valid PCI domain number
3714 * Check if the PCI domain number is in use, and return another number if
3717 * @dom: Requested domain number
3719 * return: domain number on success, HVPCI_DOM_INVALID on failure
3737 * hv_put_dom_num() - Mark the PCI domain number as free
3738 * @dom: Domain number to be freed
3746 * hv_pci_probe() - New VMBus channel probe, for a root PCI bus
3747 * @hdev: VMBus's tracking struct for this root PCI bus
3750 * Return: 0 on success, -errno on failure
3761 bridge = devm_pci_alloc_host_bridge(&hdev->device, 0); in hv_pci_probe()
3763 return -ENOMEM; in hv_pci_probe()
3767 return -ENOMEM; in hv_pci_probe()
3769 hbus->bridge = bridge; in hv_pci_probe()
3770 mutex_init(&hbus->state_lock); in hv_pci_probe()
3771 hbus->state = hv_pcibus_init; in hv_pci_probe()
3772 hbus->wslot_res_allocated = -1; in hv_pci_probe()
3775 * The PCI bus "domain" is what is called "segment" in ACPI and other in hv_pci_probe()
3780 * Note that, since this code only runs in a Hyper-V VM, Hyper-V in hv_pci_probe()
3782 * domain used by Gen1 VMs for something that looks like a physical in hv_pci_probe()
3783 * PCI bus (which is actually emulated by the hypervisor) is domain 0. in hv_pci_probe()
3787 dom_req = hdev->dev_instance.b[5] << 8 | hdev->dev_instance.b[4]; in hv_pci_probe()
3791 dev_err(&hdev->device, in hv_pci_probe()
3793 ret = -EINVAL; in hv_pci_probe()
3798 dev_info(&hdev->device, in hv_pci_probe()
3799 "PCI dom# 0x%x has collision, using 0x%x", in hv_pci_probe()
3802 hbus->bridge->domain_nr = dom; in hv_pci_probe()
3804 hbus->sysdata.domain = dom; in hv_pci_probe()
3805 hbus->use_calls = !!(ms_hyperv.hints & HV_X64_USE_MMIO_HYPERCALLS); in hv_pci_probe()
3808 * Set the PCI bus parent to be the corresponding VMbus in hv_pci_probe()
3814 hbus->sysdata.parent = hdev->device.parent; in hv_pci_probe()
3815 hbus->use_calls = false; in hv_pci_probe()
3818 hbus->hdev = hdev; in hv_pci_probe()
3819 INIT_LIST_HEAD(&hbus->children); in hv_pci_probe()
3820 INIT_LIST_HEAD(&hbus->dr_list); in hv_pci_probe()
3821 spin_lock_init(&hbus->config_lock); in hv_pci_probe()
3822 spin_lock_init(&hbus->device_list_lock); in hv_pci_probe()
3823 hbus->wq = alloc_ordered_workqueue("hv_pci_%x", 0, in hv_pci_probe()
3824 hbus->bridge->domain_nr); in hv_pci_probe()
3825 if (!hbus->wq) { in hv_pci_probe()
3826 ret = -ENOMEM; in hv_pci_probe()
3830 hdev->channel->next_request_id_callback = vmbus_next_request_id; in hv_pci_probe()
3831 hdev->channel->request_addr_callback = vmbus_request_addr; in hv_pci_probe()
3832 hdev->channel->rqstor_size = HV_PCI_RQSTOR_SIZE; in hv_pci_probe()
3834 ret = vmbus_open(hdev->channel, pci_ring_size, pci_ring_size, NULL, 0, in hv_pci_probe()
3850 hbus->cfg_addr = ioremap(hbus->mem_config->start, in hv_pci_probe()
3852 if (!hbus->cfg_addr) { in hv_pci_probe()
3853 dev_err(&hdev->device, in hv_pci_probe()
3855 ret = -ENOMEM; in hv_pci_probe()
3859 name = kasprintf(GFP_KERNEL, "%pUL", &hdev->dev_instance); in hv_pci_probe()
3861 ret = -ENOMEM; in hv_pci_probe()
3865 hbus->fwnode = irq_domain_alloc_named_fwnode(name); in hv_pci_probe()
3867 if (!hbus->fwnode) { in hv_pci_probe()
3868 ret = -ENOMEM; in hv_pci_probe()
3880 mutex_lock(&hbus->state_lock); in hv_pci_probe()
3896 hbus->state = hv_pcibus_probed; in hv_pci_probe()
3902 mutex_unlock(&hbus->state_lock); in hv_pci_probe()
3910 mutex_unlock(&hbus->state_lock); in hv_pci_probe()
3912 irq_domain_remove(hbus->irq_domain); in hv_pci_probe()
3914 irq_domain_free_fwnode(hbus->fwnode); in hv_pci_probe()
3916 iounmap(hbus->cfg_addr); in hv_pci_probe()
3920 vmbus_close(hdev->channel); in hv_pci_probe()
3922 destroy_workqueue(hbus->wq); in hv_pci_probe()
3924 hv_put_dom_num(hbus->bridge->domain_nr); in hv_pci_probe()
3933 struct vmbus_channel *chan = hdev->channel; in hv_pci_bus_exit()
3947 * access the per-channel ringbuffer any longer. in hv_pci_bus_exit()
3949 if (chan->rescind) in hv_pci_bus_exit()
3957 spin_lock_irqsave(&hbus->device_list_lock, flags); in hv_pci_bus_exit()
3958 list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) in hv_pci_bus_exit()
3959 list_move_tail(&hpdev->list_entry, &removed); in hv_pci_bus_exit()
3960 spin_unlock_irqrestore(&hbus->device_list_lock, flags); in hv_pci_bus_exit()
3964 list_del(&hpdev->list_entry); in hv_pci_bus_exit()
3965 if (hpdev->pci_slot) in hv_pci_bus_exit()
3966 pci_destroy_slot(hpdev->pci_slot); in hv_pci_bus_exit()
3975 dev_err(&hdev->device, in hv_pci_bus_exit()
3985 msg->type = PCI_BUS_D0EXIT; in hv_pci_bus_exit()
4004 return -ETIMEDOUT; in hv_pci_bus_exit()
4011 * hv_pci_remove() - Remove routine for this VMBus channel
4012 * @hdev: VMBus's tracking struct for this root PCI bus
4019 if (hbus->state == hv_pcibus_installed) { in hv_pci_remove()
4020 tasklet_disable(&hdev->channel->callback_event); in hv_pci_remove()
4021 hbus->state = hv_pcibus_removing; in hv_pci_remove()
4022 tasklet_enable(&hdev->channel->callback_event); in hv_pci_remove()
4023 destroy_workqueue(hbus->wq); in hv_pci_remove()
4024 hbus->wq = NULL; in hv_pci_remove()
4027 * on hbus-wq. We can't race with hv_pci_devices_present() in hv_pci_remove()
4031 /* Remove the bus from PCI's point of view. */ in hv_pci_remove()
4033 pci_stop_root_bus(hbus->bridge->bus); in hv_pci_remove()
4035 pci_remove_root_bus(hbus->bridge->bus); in hv_pci_remove()
4041 vmbus_close(hdev->channel); in hv_pci_remove()
4043 iounmap(hbus->cfg_addr); in hv_pci_remove()
4046 irq_domain_remove(hbus->irq_domain); in hv_pci_remove()
4047 irq_domain_free_fwnode(hbus->fwnode); in hv_pci_remove()
4049 hv_put_dom_num(hbus->bridge->domain_nr); in hv_pci_remove()
4066 * items onto hbus->wq in hv_pci_devices_present() and in hv_pci_suspend()
4069 * the work item handler pci_devices_present_work() -> in hv_pci_suspend()
4073 * callback tasklet, sets hbus->state to hv_pcibus_removing, and in hv_pci_suspend()
4074 * re-enables the tasklet. This way, when hv_pci_suspend() proceeds, in hv_pci_suspend()
4076 * hbus->wq and safely closes the vmbus channel. in hv_pci_suspend()
4078 tasklet_disable(&hdev->channel->callback_event); in hv_pci_suspend()
4081 old_state = hbus->state; in hv_pci_suspend()
4082 if (hbus->state == hv_pcibus_installed) in hv_pci_suspend()
4083 hbus->state = hv_pcibus_removing; in hv_pci_suspend()
4085 tasklet_enable(&hdev->channel->callback_event); in hv_pci_suspend()
4088 return -EINVAL; in hv_pci_suspend()
4090 flush_workqueue(hbus->wq); in hv_pci_suspend()
4096 vmbus_close(hdev->channel); in hv_pci_suspend()
4106 if (!pdev->msi_enabled && !pdev->msix_enabled) in hv_pci_restore_msi_msg()
4109 guard(msi_descs_lock)(&pdev->dev); in hv_pci_restore_msi_msg()
4110 msi_for_each_desc(entry, &pdev->dev, MSI_DESC_ASSOCIATED) { in hv_pci_restore_msi_msg()
4111 irq_data = irq_get_irq_data(entry->irq); in hv_pci_restore_msi_msg()
4113 return -EINVAL; in hv_pci_restore_msi_msg()
4114 hv_compose_msi_msg(irq_data, &entry->msg); in hv_pci_restore_msi_msg()
4120 * Upon resume, pci_restore_msi_state() -> ... -> __pci_write_msi_msg()
4121 * directly writes the MSI/MSI-X registers via MMIO, but since Hyper-V
4123 * must be used to ask Hyper-V to re-create the IOMMU Interrupt Remapping
4128 pci_walk_bus(hbus->bridge->bus, hv_pci_restore_msi_msg, NULL); in hv_pci_restore_msi_state()
4137 hbus->state = hv_pcibus_init; in hv_pci_resume()
4139 hdev->channel->next_request_id_callback = vmbus_next_request_id; in hv_pci_resume()
4140 hdev->channel->request_addr_callback = vmbus_request_addr; in hv_pci_resume()
4141 hdev->channel->rqstor_size = HV_PCI_RQSTOR_SIZE; in hv_pci_resume()
4143 ret = vmbus_open(hdev->channel, pci_ring_size, pci_ring_size, NULL, 0, in hv_pci_resume()
4149 version[0] = hbus->protocol_version; in hv_pci_resume()
4158 mutex_lock(&hbus->state_lock); in hv_pci_resume()
4172 hbus->state = hv_pcibus_installed; in hv_pci_resume()
4173 mutex_unlock(&hbus->state_lock); in hv_pci_resume()
4177 mutex_unlock(&hbus->state_lock); in hv_pci_resume()
4179 vmbus_close(hdev->channel); in hv_pci_resume()
4184 /* PCI Pass-through Class ID */
4185 /* 44C4F61D-4444-4400-9D52-802E27EDE19F */
4215 return -ENODEV; in init_hv_pci_drv()
4218 return -ENODEV; in init_hv_pci_drv()
4224 /* Set the invalid domain number's bit, so it will not be used */ in init_hv_pci_drv()
4227 /* Initialize PCI block r/w interface */ in init_hv_pci_drv()
4238 MODULE_DESCRIPTION("Hyper-V PCI");