]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
x86/msi: Use generic MSI domain ops
authorThomas Gleixner <tglx@linutronix.de>
Wed, 26 Aug 2020 11:16:47 +0000 (13:16 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 16 Sep 2020 14:52:35 +0000 (16:52 +0200)
pci_msi_get_hwirq() and pci_msi_set_desc are not longer special. Enable the
generic MSI domain ops in the core and PCI MSI code unconditionally and get
rid of the x86 specific implementations in the X86 MSI code and in the
hyperv PCI driver.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200826112332.564274859@linutronix.de
arch/x86/include/asm/msi.h
arch/x86/kernel/apic/msi.c
drivers/pci/controller/pci-hyperv.c
drivers/pci/msi.c
include/linux/msi.h
kernel/irq/msi.c

index 25ddd0916bb2f4d3fd17bcea2bdbc68d7b3e0f2c..cd30013d15d32563fc491902871a9d98868082d2 100644 (file)
@@ -9,6 +9,4 @@ typedef struct irq_alloc_info msi_alloc_info_t;
 int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec,
                    msi_alloc_info_t *arg);
 
-void pci_msi_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc);
-
 #endif /* _ASM_X86_MSI_H */
index 6b490d9a2537325831f512f67e66e98e5a4943f6..378c692a41703f9cf527b769b70c8d8ac188e17d 100644 (file)
@@ -203,12 +203,6 @@ void native_teardown_msi_irq(unsigned int irq)
        irq_domain_free_irqs(irq, 1);
 }
 
-static irq_hw_number_t pci_msi_get_hwirq(struct msi_domain_info *info,
-                                        msi_alloc_info_t *arg)
-{
-       return arg->hwirq;
-}
-
 int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec,
                    msi_alloc_info_t *arg)
 {
@@ -227,17 +221,8 @@ int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec,
 }
 EXPORT_SYMBOL_GPL(pci_msi_prepare);
 
-void pci_msi_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc)
-{
-       arg->desc = desc;
-       arg->hwirq = pci_msi_domain_calc_hwirq(desc);
-}
-EXPORT_SYMBOL_GPL(pci_msi_set_desc);
-
 static struct msi_domain_ops pci_msi_domain_ops = {
-       .get_hwirq      = pci_msi_get_hwirq,
        .msi_prepare    = pci_msi_prepare,
-       .set_desc       = pci_msi_set_desc,
 };
 
 static struct msi_domain_info pci_msi_domain_info = {
@@ -322,12 +307,6 @@ static struct irq_chip dmar_msi_controller = {
        .flags                  = IRQCHIP_SKIP_SET_WAKE,
 };
 
-static irq_hw_number_t dmar_msi_get_hwirq(struct msi_domain_info *info,
-                                         msi_alloc_info_t *arg)
-{
-       return arg->hwirq;
-}
-
 static int dmar_msi_init(struct irq_domain *domain,
                         struct msi_domain_info *info, unsigned int virq,
                         irq_hw_number_t hwirq, msi_alloc_info_t *arg)
@@ -339,7 +318,6 @@ static int dmar_msi_init(struct irq_domain *domain,
 }
 
 static struct msi_domain_ops dmar_msi_domain_ops = {
-       .get_hwirq      = dmar_msi_get_hwirq,
        .msi_init       = dmar_msi_init,
 };
 
@@ -381,6 +359,7 @@ int dmar_alloc_hwirq(int id, int node, void *arg)
        init_irq_alloc_info(&info, NULL);
        info.type = X86_IRQ_ALLOC_TYPE_DMAR;
        info.devid = id;
+       info.hwirq = id;
        info.data = arg;
 
        return irq_domain_alloc_irqs(domain, 1, node, &info);
@@ -419,12 +398,6 @@ static struct irq_chip hpet_msi_controller __ro_after_init = {
        .flags = IRQCHIP_SKIP_SET_WAKE,
 };
 
-static irq_hw_number_t hpet_msi_get_hwirq(struct msi_domain_info *info,
-                                         msi_alloc_info_t *arg)
-{
-       return arg->hwirq;
-}
-
 static int hpet_msi_init(struct irq_domain *domain,
                         struct msi_domain_info *info, unsigned int virq,
                         irq_hw_number_t hwirq, msi_alloc_info_t *arg)
@@ -443,7 +416,6 @@ static void hpet_msi_free(struct irq_domain *domain,
 }
 
 static struct msi_domain_ops hpet_msi_domain_ops = {
-       .get_hwirq      = hpet_msi_get_hwirq,
        .msi_init       = hpet_msi_init,
        .msi_free       = hpet_msi_free,
 };
index f6cc49ba6e8086b1676bb8c188cf70bdbc4a0f71..25b4c9023bfaa21ab27b94aa724d3e620023b3db 100644 (file)
@@ -1531,16 +1531,8 @@ static struct irq_chip hv_msi_irq_chip = {
        .irq_unmask             = hv_irq_unmask,
 };
 
-static irq_hw_number_t hv_msi_domain_ops_get_hwirq(struct msi_domain_info *info,
-                                                  msi_alloc_info_t *arg)
-{
-       return arg->hwirq;
-}
-
 static struct msi_domain_ops hv_msi_ops = {
-       .get_hwirq      = hv_msi_domain_ops_get_hwirq,
        .msi_prepare    = pci_msi_prepare,
-       .set_desc       = pci_msi_set_desc,
        .msi_free       = hv_msi_free,
 };
 
index 9af58a2ab277bee4c8300a49bc0fa6200307164d..744a1a4d2b32749da637864f12951334f0b6da17 100644 (file)
@@ -1350,7 +1350,7 @@ void pci_msi_domain_write_msg(struct irq_data *irq_data, struct msi_msg *msg)
  *
  * The ID number is only used within the irqdomain.
  */
-irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc)
+static irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc)
 {
        struct pci_dev *dev = msi_desc_to_pci_dev(desc);
 
@@ -1401,16 +1401,12 @@ static int pci_msi_domain_handle_error(struct irq_domain *domain,
        return error;
 }
 
-#ifdef GENERIC_MSI_DOMAIN_OPS
 static void pci_msi_domain_set_desc(msi_alloc_info_t *arg,
                                    struct msi_desc *desc)
 {
        arg->desc = desc;
        arg->hwirq = pci_msi_domain_calc_hwirq(desc);
 }
-#else
-#define pci_msi_domain_set_desc                NULL
-#endif
 
 static struct msi_domain_ops pci_msi_domain_ops_default = {
        .set_desc       = pci_msi_domain_set_desc,
index d360cc7c4f94f3d60fc54be32cf7edfcc1b28149..5aa126b7820b1fc2a8e3395831b48024cd49fcae 100644 (file)
@@ -369,7 +369,6 @@ void pci_msi_domain_write_msg(struct irq_data *irq_data, struct msi_msg *msg);
 struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
                                             struct msi_domain_info *info,
                                             struct irq_domain *parent);
-irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc);
 int pci_msi_domain_check_cap(struct irq_domain *domain,
                             struct msi_domain_info *info, struct device *dev);
 u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev);
index eb95f6106a1ee67ceef63f4fe54fd998054d5678..640668e3f870733b0bd70e40aadf39c0db11c01c 100644 (file)
@@ -187,7 +187,6 @@ static const struct irq_domain_ops msi_domain_ops = {
        .deactivate     = msi_domain_deactivate,
 };
 
-#ifdef GENERIC_MSI_DOMAIN_OPS
 static irq_hw_number_t msi_domain_ops_get_hwirq(struct msi_domain_info *info,
                                                msi_alloc_info_t *arg)
 {
@@ -206,11 +205,6 @@ static void msi_domain_ops_set_desc(msi_alloc_info_t *arg,
 {
        arg->desc = desc;
 }
-#else
-#define msi_domain_ops_get_hwirq       NULL
-#define msi_domain_ops_prepare         NULL
-#define msi_domain_ops_set_desc                NULL
-#endif /* !GENERIC_MSI_DOMAIN_OPS */
 
 static int msi_domain_ops_init(struct irq_domain *domain,
                               struct msi_domain_info *info,