x86/pci/xen: populate MSI sysfs entries
commit335b422346
upstream. Commitbf5e758f02
("genirq/msi: Simplify sysfs handling") reworked the creation of sysfs entries for MSI IRQs. The creation used to be in msi_domain_alloc_irqs_descs_locked after calling ops->domain_alloc_irqs. Then it moved into __msi_domain_alloc_irqs which is an implementation of domain_alloc_irqs. However, Xen comes with the only other implementation of domain_alloc_irqs and hence doesn't run the sysfs population code anymore. Commit6c796996ee
("x86/pci/xen: Fixup fallout from the PCI/MSI overhaul") set the flag MSI_FLAG_DEV_SYSFS for the xen msi_domain_info but that doesn't actually have an effect because Xen uses it's own domain_alloc_irqs implementation. Fix this by making use of the fallback functions for sysfs population. Fixes:bf5e758f02
("genirq/msi: Simplify sysfs handling") Signed-off-by: Maximilian Heyne <mheyne@amazon.de> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/20230503131656.15928-1-mheyne@amazon.de Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
84b211b028
commit
53384076f7
|
@ -198,7 +198,7 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
kfree(v);
|
kfree(v);
|
||||||
return 0;
|
return msi_device_populate_sysfs(&dev->dev);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (ret == -ENOSYS)
|
if (ret == -ENOSYS)
|
||||||
|
@ -254,7 +254,7 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
||||||
dev_dbg(&dev->dev,
|
dev_dbg(&dev->dev,
|
||||||
"xen: msi --> pirq=%d --> irq=%d\n", pirq, irq);
|
"xen: msi --> pirq=%d --> irq=%d\n", pirq, irq);
|
||||||
}
|
}
|
||||||
return 0;
|
return msi_device_populate_sysfs(&dev->dev);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
dev_err(&dev->dev, "Failed to create MSI%s! ret=%d!\n",
|
dev_err(&dev->dev, "Failed to create MSI%s! ret=%d!\n",
|
||||||
|
@ -346,7 +346,7 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = msi_device_populate_sysfs(&dev->dev);
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -393,6 +393,8 @@ static void xen_teardown_msi_irqs(struct pci_dev *dev)
|
||||||
for (i = 0; i < msidesc->nvec_used; i++)
|
for (i = 0; i < msidesc->nvec_used; i++)
|
||||||
xen_destroy_irq(msidesc->irq + i);
|
xen_destroy_irq(msidesc->irq + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msi_device_destroy_sysfs(&dev->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xen_pv_teardown_msi_irqs(struct pci_dev *dev)
|
static void xen_pv_teardown_msi_irqs(struct pci_dev *dev)
|
||||||
|
|
|
@ -278,6 +278,13 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
|
||||||
void arch_teardown_msi_irq(unsigned int irq);
|
void arch_teardown_msi_irq(unsigned int irq);
|
||||||
int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
|
int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
|
||||||
void arch_teardown_msi_irqs(struct pci_dev *dev);
|
void arch_teardown_msi_irqs(struct pci_dev *dev);
|
||||||
|
#endif /* CONFIG_PCI_MSI_ARCH_FALLBACKS */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Xen uses non-default msi_domain_ops and hence needs a way to populate sysfs
|
||||||
|
* entries of MSI IRQs.
|
||||||
|
*/
|
||||||
|
#if defined(CONFIG_PCI_XEN) || defined(CONFIG_PCI_MSI_ARCH_FALLBACKS)
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
int msi_device_populate_sysfs(struct device *dev);
|
int msi_device_populate_sysfs(struct device *dev);
|
||||||
void msi_device_destroy_sysfs(struct device *dev);
|
void msi_device_destroy_sysfs(struct device *dev);
|
||||||
|
@ -285,7 +292,7 @@ void msi_device_destroy_sysfs(struct device *dev);
|
||||||
static inline int msi_device_populate_sysfs(struct device *dev) { return 0; }
|
static inline int msi_device_populate_sysfs(struct device *dev) { return 0; }
|
||||||
static inline void msi_device_destroy_sysfs(struct device *dev) { }
|
static inline void msi_device_destroy_sysfs(struct device *dev) { }
|
||||||
#endif /* !CONFIG_SYSFS */
|
#endif /* !CONFIG_SYSFS */
|
||||||
#endif /* CONFIG_PCI_MSI_ARCH_FALLBACKS */
|
#endif /* CONFIG_PCI_XEN || CONFIG_PCI_MSI_ARCH_FALLBACKS */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The restore hook is still available even for fully irq domain based
|
* The restore hook is still available even for fully irq domain based
|
||||||
|
|
|
@ -420,7 +420,7 @@ static int msi_sysfs_populate_desc(struct device *dev, struct msi_desc *desc)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PCI_MSI_ARCH_FALLBACKS
|
#if defined(CONFIG_PCI_MSI_ARCH_FALLBACKS) || defined(CONFIG_PCI_XEN)
|
||||||
/**
|
/**
|
||||||
* msi_device_populate_sysfs - Populate msi_irqs sysfs entries for a device
|
* msi_device_populate_sysfs - Populate msi_irqs sysfs entries for a device
|
||||||
* @dev: The device (PCI, platform etc) which will get sysfs entries
|
* @dev: The device (PCI, platform etc) which will get sysfs entries
|
||||||
|
@ -452,7 +452,7 @@ void msi_device_destroy_sysfs(struct device *dev)
|
||||||
msi_for_each_desc(desc, dev, MSI_DESC_ALL)
|
msi_for_each_desc(desc, dev, MSI_DESC_ALL)
|
||||||
msi_sysfs_remove_desc(dev, desc);
|
msi_sysfs_remove_desc(dev, desc);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_PCI_MSI_ARCH_FALLBACK */
|
#endif /* CONFIG_PCI_MSI_ARCH_FALLBACK || CONFIG_PCI_XEN */
|
||||||
#else /* CONFIG_SYSFS */
|
#else /* CONFIG_SYSFS */
|
||||||
static inline int msi_sysfs_create_group(struct device *dev) { return 0; }
|
static inline int msi_sysfs_create_group(struct device *dev) { return 0; }
|
||||||
static inline int msi_sysfs_populate_desc(struct device *dev, struct msi_desc *desc) { return 0; }
|
static inline int msi_sysfs_populate_desc(struct device *dev, struct msi_desc *desc) { return 0; }
|
||||||
|
|
Loading…
Reference in New Issue