xen/pci: support multi-segment systems
Now that the hypercall interface changes are in -unstable, make the kernel side code not ignore the segment (aka domain) number anymore (which results in pretty odd behavior on such systems). Rather, if only the old interfaces are available, don't call them for devices on non-zero segments at all. Signed-off-by: Jan Beulich <jbeulich@suse.com> [v1: Edited git description] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
This commit is contained in:

committed by
Konrad Rzeszutek Wilk

parent
6810df88dc
commit
55e901fc1f
@@ -185,6 +185,8 @@ static void xen_teardown_msi_irq(unsigned int irq)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_XEN_DOM0
|
||||
static bool __read_mostly pci_seg_supported = true;
|
||||
|
||||
static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -202,10 +204,11 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
||||
|
||||
memset(&map_irq, 0, sizeof(map_irq));
|
||||
map_irq.domid = domid;
|
||||
map_irq.type = MAP_PIRQ_TYPE_MSI;
|
||||
map_irq.type = MAP_PIRQ_TYPE_MSI_SEG;
|
||||
map_irq.index = -1;
|
||||
map_irq.pirq = -1;
|
||||
map_irq.bus = dev->bus->number;
|
||||
map_irq.bus = dev->bus->number |
|
||||
(pci_domain_nr(dev->bus) << 16);
|
||||
map_irq.devfn = dev->devfn;
|
||||
|
||||
if (type == PCI_CAP_ID_MSIX) {
|
||||
@@ -222,7 +225,20 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
||||
map_irq.entry_nr = msidesc->msi_attrib.entry_nr;
|
||||
}
|
||||
|
||||
ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
|
||||
ret = -EINVAL;
|
||||
if (pci_seg_supported)
|
||||
ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq,
|
||||
&map_irq);
|
||||
if (ret == -EINVAL && !pci_domain_nr(dev->bus)) {
|
||||
map_irq.type = MAP_PIRQ_TYPE_MSI;
|
||||
map_irq.index = -1;
|
||||
map_irq.pirq = -1;
|
||||
map_irq.bus = dev->bus->number;
|
||||
ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq,
|
||||
&map_irq);
|
||||
if (ret != -EINVAL)
|
||||
pci_seg_supported = false;
|
||||
}
|
||||
if (ret) {
|
||||
dev_warn(&dev->dev, "xen map irq failed %d for %d domain\n",
|
||||
ret, domid);
|
||||
|
Reference in New Issue
Block a user