linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Thomas Gleixner <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, grant.likely@linaro.org,
	hpa@zytor.com, mingo@kernel.org, peterz@infradead.org,
	tony.luck@intel.com, tglx@linutronix.de
Subject: [tip:irq/core] x86: Implement arch_setup/teardown_hwirq()
Date: Fri, 16 May 2014 06:31:59 -0700	[thread overview]
Message-ID: <tip-b1ee544174fd0eb28a7770403b9577fd70f1cd3d@git.kernel.org> (raw)
In-Reply-To: <20140507154334.482904047@linutronix.de>

Commit-ID:  b1ee544174fd0eb28a7770403b9577fd70f1cd3d
Gitweb:     http://git.kernel.org/tip/b1ee544174fd0eb28a7770403b9577fd70f1cd3d
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Wed, 7 May 2014 15:44:06 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 16 May 2014 14:05:18 +0200

x86: Implement arch_setup/teardown_hwirq()

This is just a cleanup to get rid of the create/destroy_irq variants
which were designed in hell.

The long term solution for x86 is to switch over to irq domains and
cleanup the whole vector allocation mess.

The generic irq_alloc_hwirqs() interface deliberately prevents
multi-MSI vector allocation to further enforce the irq domain
conversion (aside of the desire to support ioapic hotplug).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org
Link: http://lkml.kernel.org/r/20140507154334.482904047@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/Kconfig               |  1 +
 arch/x86/kernel/apic/io_apic.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 25d2c6f..4724770 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -831,6 +831,7 @@ config X86_LOCAL_APIC
 config X86_IO_APIC
 	def_bool y
 	depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC || PCI_MSI
+	select GENERIC_IRQ_LEGACY_ALLOC_HWIRQ
 
 config X86_REROUTE_FOR_BROKEN_BOOT_IRQS
 	bool "Reroute for broken boot IRQs"
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 992060e..b7175c0 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3010,6 +3010,39 @@ void destroy_irqs(unsigned int irq, unsigned int count)
 		destroy_irq(irq + i);
 }
 
+int arch_setup_hwirq(unsigned int irq, int node)
+{
+	struct irq_cfg *cfg;
+	unsigned long flags;
+	int ret;
+
+	cfg = alloc_irq_cfg(irq, node);
+	if (!cfg)
+		return -ENOMEM;
+
+	raw_spin_lock_irqsave(&vector_lock, flags);
+	ret = __assign_irq_vector(irq, cfg, apic->target_cpus());
+	raw_spin_unlock_irqrestore(&vector_lock, flags);
+
+	if (!ret)
+		irq_set_chip_data(irq, cfg);
+	else
+		free_irq_cfg(irq, cfg);
+	return ret;
+}
+
+void arch_teardown_hwirq(unsigned int irq)
+{
+	struct irq_cfg *cfg = irq_get_chip_data(irq);
+	unsigned long flags;
+
+	free_remapped_irq(irq);
+	raw_spin_lock_irqsave(&vector_lock, flags);
+	__clear_irq_vector(irq, cfg);
+	raw_spin_unlock_irqrestore(&vector_lock, flags);
+	free_irq_cfg(irq, cfg);
+}
+
 /*
  * MSI message composition
  */

  reply	other threads:[~2014-05-16 13:33 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 15:44 [patch 00/32] genirq: Another round of tree wide cleanups Thomas Gleixner
2014-05-07 15:44 ` [patch 01/32] arm: iop13xx: Use sparse irqs for MSI Thomas Gleixner
2014-05-16 13:31   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 02/32] mips: Kill pointless destroy_irq() Thomas Gleixner
2014-05-16 13:31   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 03/32] genirq: Provide generic hwirq allocation facility Thomas Gleixner
2014-05-07 20:37   ` Chris Metcalf
2014-05-07 23:15     ` Thomas Gleixner
2014-05-08 10:22       ` Thomas Gleixner
2014-05-13 16:59         ` Thomas Gleixner
2014-05-13 17:48           ` Luck, Tony
2014-05-14 17:57       ` Chris Metcalf
2014-05-14 23:57         ` Thomas Gleixner
2014-05-08 12:07   ` Grant Likely
2014-05-08 13:12     ` Thomas Gleixner
2014-05-14 17:44   ` Chris Metcalf
2014-05-14 23:47     ` Thomas Gleixner
2014-05-16 13:31   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 04/32] x86: Implement arch_setup/teardown_hwirq() Thomas Gleixner
2014-05-16 13:31   ` tip-bot for Thomas Gleixner [this message]
2014-05-07 15:44 ` [patch 06/32] x86: hpet: Use irq_alloc/free_hwirq() Thomas Gleixner
2014-05-16 13:32   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 05/32] x86: irq_remapping: " Thomas Gleixner
2014-05-14  9:32   ` Joerg Roedel
2014-05-16 13:32   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 08/32] x86: htirq: Use irq_alloc/free_irq() Thomas Gleixner
2014-05-07 16:03   ` Bjorn Helgaas
2014-05-07 16:30     ` Thomas Gleixner
2014-05-16 13:32   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 07/32] x86: uv: Use irq_alloc/free_hwirq() Thomas Gleixner
2014-05-16 13:32   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 09/32] x86: ioapic: " Thomas Gleixner
2014-05-16 13:33   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 11/32] iommu: dmar: Fix return value check of create_irq() Thomas Gleixner
2014-05-16 13:33   ` [tip:irq/core] iommu: smar: Fix return value check of create_irq( ) tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 10/32] x86: Get rid of get_nr_irqs_gsi() Thomas Gleixner
2014-05-16 13:33   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 13/32] ia64: Remove unused check_irq_used() Thomas Gleixner
2014-05-16 13:33   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 12/32] iommu: dmar: Provide arch specific irq allocation Thomas Gleixner
2014-05-16 13:33   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 14/32] x86: Remove create/dstroy_irq() Thomas Gleixner
2014-05-16 13:34   ` [tip:irq/core] x86: Remove create/destroy_irq() tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 16/32] tile: usb: Use irq_alloc/free_hwirq Thomas Gleixner
2014-05-16 13:34   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 15/32] tile: Implement irq_alloc/free_hwirq() for migration Thomas Gleixner
2014-05-14 17:48   ` Chris Metcalf
     [not found]   ` <5373AC00.7090507@tilera.com>
2014-05-14 23:50     ` Thomas Gleixner
2014-05-16 13:34   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 17/32] tile: net: Use irq_alloc/free_hwirq Thomas Gleixner
2014-05-16 13:34   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 18/32] tile: serial: " Thomas Gleixner
2014-05-16 13:34   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 19/32] tile: hvc: " Thomas Gleixner
2014-05-16 13:35   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 20/32] tile: pci: Use irq_alloc/free_hwirq() Thomas Gleixner
2014-05-16 13:35   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 21/32] tile: Use SPARSE_IRQ Thomas Gleixner
2014-05-16 13:35   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 22/32] genirq: Make create/destroy_irq() ia64 private Thomas Gleixner
2014-05-16 13:35   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 23/32] x86, irq: Remove pointless irq_reserve_irqs() call Thomas Gleixner
2014-05-16 13:36   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 24/32] sh: intc: Remove pointless irq_reserve_irqs() invocation Thomas Gleixner
2014-05-11  0:53   ` Simon Horman
2014-05-16 13:36   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 25/32] s390: pci: Check return value of alloc_irq_desc() proper Thomas Gleixner
2014-05-16 13:36   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 26/32] s390: Remove pointless arch_show_interrupts() Thomas Gleixner
2014-05-16 13:36   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 27/32] s390: Avoid call to irq_reserve_irqs() Thomas Gleixner
2014-05-16 13:36   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 28/32] genirq: Replace reserve_irqs in core code Thomas Gleixner
2014-05-16 13:37   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 29/32] genirq: Remove irq_reserve_irq[s] Thomas Gleixner
2014-05-08 12:14   ` Grant Likely
2014-05-08 12:54     ` Thomas Gleixner
2014-05-16 13:37   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 30/32] genirq: Replace dynamic_irq_init/cleanup Thomas Gleixner
2014-05-16 13:37   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 31/32] ia64: Use irq_init_desc Thomas Gleixner
2014-05-07 20:06   ` Luck, Tony
2014-05-16 13:37   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-07 15:44 ` [patch 32/32] genirq: Remove dynamic_irq mess Thomas Gleixner
2014-05-16 13:37   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-05-08 12:17 ` [patch 00/32] genirq: Another round of tree wide cleanups Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-b1ee544174fd0eb28a7770403b9577fd70f1cd3d@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=grant.likely@linaro.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).