diff options
| -rw-r--r-- | arch/x86/kvm/x86.c | 1 | ||||
| -rw-r--r-- | include/linux/kvm.h | 4 | ||||
| -rw-r--r-- | include/linux/kvm_host.h | 1 | ||||
| -rw-r--r-- | virt/kvm/assigned-dev.c | 4 | ||||
| -rw-r--r-- | virt/kvm/iommu.c | 9 |
5 files changed, 14 insertions, 5 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index d47ceda7a928..0bf3df527afc 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -1569,6 +1569,7 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
| 1569 | case KVM_CAP_HYPERV: | 1569 | case KVM_CAP_HYPERV: |
| 1570 | case KVM_CAP_HYPERV_VAPIC: | 1570 | case KVM_CAP_HYPERV_VAPIC: |
| 1571 | case KVM_CAP_HYPERV_SPIN: | 1571 | case KVM_CAP_HYPERV_SPIN: |
| 1572 | case KVM_CAP_PCI_SEGMENT: | ||
| 1572 | r = 1; | 1573 | r = 1; |
| 1573 | break; | 1574 | break; |
| 1574 | case KVM_CAP_COALESCED_MMIO: | 1575 | case KVM_CAP_COALESCED_MMIO: |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 4c4937e7f65f..dfa54be881f4 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
| @@ -500,6 +500,7 @@ struct kvm_ioeventfd { | |||
| 500 | #define KVM_CAP_HYPERV 44 | 500 | #define KVM_CAP_HYPERV 44 |
| 501 | #define KVM_CAP_HYPERV_VAPIC 45 | 501 | #define KVM_CAP_HYPERV_VAPIC 45 |
| 502 | #define KVM_CAP_HYPERV_SPIN 46 | 502 | #define KVM_CAP_HYPERV_SPIN 46 |
| 503 | #define KVM_CAP_PCI_SEGMENT 47 | ||
| 503 | 504 | ||
| 504 | #ifdef KVM_CAP_IRQ_ROUTING | 505 | #ifdef KVM_CAP_IRQ_ROUTING |
| 505 | 506 | ||
| @@ -694,8 +695,9 @@ struct kvm_assigned_pci_dev { | |||
| 694 | __u32 busnr; | 695 | __u32 busnr; |
| 695 | __u32 devfn; | 696 | __u32 devfn; |
| 696 | __u32 flags; | 697 | __u32 flags; |
| 698 | __u32 segnr; | ||
| 697 | union { | 699 | union { |
| 698 | __u32 reserved[12]; | 700 | __u32 reserved[11]; |
| 699 | }; | 701 | }; |
| 700 | }; | 702 | }; |
| 701 | 703 | ||
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index dfde04b0d453..665c37063f30 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -400,6 +400,7 @@ struct kvm_assigned_dev_kernel { | |||
| 400 | struct work_struct interrupt_work; | 400 | struct work_struct interrupt_work; |
| 401 | struct list_head list; | 401 | struct list_head list; |
| 402 | int assigned_dev_id; | 402 | int assigned_dev_id; |
| 403 | int host_segnr; | ||
| 403 | int host_busnr; | 404 | int host_busnr; |
| 404 | int host_devfn; | 405 | int host_devfn; |
| 405 | unsigned int entries_nr; | 406 | unsigned int entries_nr; |
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index f51e684dd238..057e2cca6af5 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c | |||
| @@ -526,7 +526,8 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
| 526 | r = -ENOMEM; | 526 | r = -ENOMEM; |
| 527 | goto out; | 527 | goto out; |
| 528 | } | 528 | } |
| 529 | dev = pci_get_bus_and_slot(assigned_dev->busnr, | 529 | dev = pci_get_domain_bus_and_slot(assigned_dev->segnr, |
| 530 | assigned_dev->busnr, | ||
| 530 | assigned_dev->devfn); | 531 | assigned_dev->devfn); |
| 531 | if (!dev) { | 532 | if (!dev) { |
| 532 | printk(KERN_INFO "%s: host device not found\n", __func__); | 533 | printk(KERN_INFO "%s: host device not found\n", __func__); |
| @@ -548,6 +549,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
| 548 | pci_reset_function(dev); | 549 | pci_reset_function(dev); |
| 549 | 550 | ||
| 550 | match->assigned_dev_id = assigned_dev->assigned_dev_id; | 551 | match->assigned_dev_id = assigned_dev->assigned_dev_id; |
| 552 | match->host_segnr = assigned_dev->segnr; | ||
| 551 | match->host_busnr = assigned_dev->busnr; | 553 | match->host_busnr = assigned_dev->busnr; |
| 552 | match->host_devfn = assigned_dev->devfn; | 554 | match->host_devfn = assigned_dev->devfn; |
| 553 | match->flags = assigned_dev->flags; | 555 | match->flags = assigned_dev->flags; |
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 65a51432c8e5..80fd3ad3b2de 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c | |||
| @@ -106,7 +106,8 @@ int kvm_assign_device(struct kvm *kvm, | |||
| 106 | 106 | ||
| 107 | r = iommu_attach_device(domain, &pdev->dev); | 107 | r = iommu_attach_device(domain, &pdev->dev); |
| 108 | if (r) { | 108 | if (r) { |
| 109 | printk(KERN_ERR "assign device %x:%x.%x failed", | 109 | printk(KERN_ERR "assign device %x:%x:%x.%x failed", |
| 110 | pci_domain_nr(pdev->bus), | ||
| 110 | pdev->bus->number, | 111 | pdev->bus->number, |
| 111 | PCI_SLOT(pdev->devfn), | 112 | PCI_SLOT(pdev->devfn), |
| 112 | PCI_FUNC(pdev->devfn)); | 113 | PCI_FUNC(pdev->devfn)); |
| @@ -127,7 +128,8 @@ int kvm_assign_device(struct kvm *kvm, | |||
| 127 | goto out_unmap; | 128 | goto out_unmap; |
| 128 | } | 129 | } |
| 129 | 130 | ||
| 130 | printk(KERN_DEBUG "assign device: host bdf = %x:%x:%x\n", | 131 | printk(KERN_DEBUG "assign device %x:%x:%x.%x\n", |
| 132 | assigned_dev->host_segnr, | ||
| 131 | assigned_dev->host_busnr, | 133 | assigned_dev->host_busnr, |
| 132 | PCI_SLOT(assigned_dev->host_devfn), | 134 | PCI_SLOT(assigned_dev->host_devfn), |
| 133 | PCI_FUNC(assigned_dev->host_devfn)); | 135 | PCI_FUNC(assigned_dev->host_devfn)); |
| @@ -154,7 +156,8 @@ int kvm_deassign_device(struct kvm *kvm, | |||
| 154 | 156 | ||
| 155 | iommu_detach_device(domain, &pdev->dev); | 157 | iommu_detach_device(domain, &pdev->dev); |
| 156 | 158 | ||
| 157 | printk(KERN_DEBUG "deassign device: host bdf = %x:%x:%x\n", | 159 | printk(KERN_DEBUG "deassign device %x:%x:%x.%x\n", |
| 160 | assigned_dev->host_segnr, | ||
| 158 | assigned_dev->host_busnr, | 161 | assigned_dev->host_busnr, |
| 159 | PCI_SLOT(assigned_dev->host_devfn), | 162 | PCI_SLOT(assigned_dev->host_devfn), |
| 160 | PCI_FUNC(assigned_dev->host_devfn)); | 163 | PCI_FUNC(assigned_dev->host_devfn)); |
