[RFC Part4 v1 05/17] PCI/MSI: Move msi_set_affinity() to PCI core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move msi_set_affinity() to PCI core, so it could be reused later.

Signed-off-by: Jiang Liu <jiang.liu@xxxxxxxxxxxxxxx>
---
 arch/x86/kernel/apic/msi.c |   20 ++------------------
 drivers/pci/msi.c          |   16 ++++++++++++++++
 include/linux/msi.h        |    2 ++
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c
index 727e4254f124..0b2261fe6adf 100644
--- a/arch/x86/kernel/apic/msi.c
+++ b/arch/x86/kernel/apic/msi.c
@@ -53,22 +53,6 @@ static void msi_compose_msg(struct irq_data *data, struct msi_msg *msg)
 		MSI_DATA_VECTOR(cfg->vector);
 }
 
-static int msi_set_affinity(struct irq_data *data, const struct cpumask *mask,
-			    bool force)
-{
-	struct irq_data *parent = data->parent_data;
-	struct msi_msg msg;
-	int ret;
-
-	ret = parent->chip->irq_set_affinity(parent, mask, force);
-	if (ret >= 0 && ret != IRQ_SET_MASK_OK_DONE) {
-		irq_chip_compose_msi_msg(data, &msg);
-		__write_msi_msg(data->msi_desc, &msg);
-	}
-
-	return ret;
-}
-
 /*
  * IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices,
  * which implement the MSI or MSI-X Capability Structure.
@@ -78,7 +62,7 @@ static struct irq_chip msi_chip = {
 	.irq_unmask		= unmask_msi_irq,
 	.irq_mask		= mask_msi_irq,
 	.irq_ack		= irq_chip_ack_parent,
-	.irq_set_affinity	= msi_set_affinity,
+	.irq_set_affinity	= msi_domain_set_affinity,
 	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_compose_msi_msg	= msi_compose_msg,
 	.flags			= IRQCHIP_SKIP_SET_WAKE,
@@ -142,7 +126,7 @@ static struct irq_chip msi_ir_chip = {
 	.irq_unmask		= unmask_msi_irq,
 	.irq_mask		= mask_msi_irq,
 	.irq_ack		= irq_chip_ack_parent,
-	.irq_set_affinity	= msi_set_affinity,
+	.irq_set_affinity	= msi_domain_set_affinity,
 	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.flags			= IRQCHIP_SKIP_SET_WAKE,
 };
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 8de7c8774fd2..49a8bd37189d 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1101,6 +1101,22 @@ int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
 EXPORT_SYMBOL(pci_enable_msix_range);
 
 #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
+int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
+			    bool force)
+{
+	struct irq_data *parent = data->parent_data;
+	struct msi_msg msg;
+	int ret;
+
+	ret = parent->chip->irq_set_affinity(parent, mask, force);
+	if (ret >= 0 && ret != IRQ_SET_MASK_OK_DONE) {
+		irq_chip_compose_msi_msg(data, &msg);
+		__write_msi_msg(data->msi_desc, &msg);
+	}
+
+	return ret;
+}
+
 /*
  * Generate a unique ID number for each possible MSI source, the ID number
  * is only used within the irqdomain.
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 662c628fc2fa..daea96489a39 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -79,6 +79,8 @@ struct msi_chip {
 struct irq_domain;
 struct irq_chip;
 
+int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
+			    bool force);
 struct irq_domain *msi_create_irq_domain(struct device_node *of_node,
 					 struct irq_chip *chip,
 					 struct irq_domain *parent);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux