diff options
author | Zhai, Edwin <edwin.zhai@intel.com> | 2010-01-29 01:38:44 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:36:06 -0500 |
commit | ab9f4ecbb6d39a18e300a0d10a4968c37404aa76 (patch) | |
tree | 1f7fba2feaeca2f6d643437167c7b9036c909c98 /virt | |
parent | 6d3e435e708fa32f99b780caf6c5508a606a513b (diff) |
KVM: enable PCI multiple-segments for pass-through device
Enable optional parameter (default 0) - PCI segment (or domain) besides
BDF, when assigning PCI device to guest.
Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/assigned-dev.c | 4 | ||||
-rw-r--r-- | virt/kvm/iommu.c | 9 |
2 files changed, 9 insertions, 4 deletions
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)); |