[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1388707565-16535-14-git-send-email-yinghai@kernel.org>
Date: Thu, 2 Jan 2014 16:05:45 -0800
From: Yinghai Lu <yinghai@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...e.hu>,
"H. Peter Anvin" <hpa@...or.com>, Tony Luck <tony.luck@...el.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
"Rafael J. Wysocki" <rjw@...k.pl>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org, Yinghai Lu <yinghai@...nel.org>,
Joerg Roedel <joro@...tes.org>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
Subject: [PATCH v5 13/33] x86, irq: Add alloc_reserved_irq_and_cfg_at()
For ioapic hot-add support, it would be easy if we have continuous
irq numbers for new added ioapic controller.
We can reserve irq range at first, then allocate those
pre-reserved one when it is needed.
Add alloc_reserved_irq_and_cfg_at() to really allocate irq_desc and cfg,
because pre-reserved only mark bits in allocate_irqs bit maps.
Also fallback to alloc_irq_and_cfg_at(), and it is needed as
we do not actually reserved irq for io apic irq yet.
This patch is x86 arch code.
-v2: update changelog by adding reasons, requested by Konrad.
-v3: according to tglx, separate to another patch, and use
alloc_reserved_... instead of realloc_...
also add handling for one possible path in
alloc_reserved_irq_and_cfg_at().
Signed-off-by: Yinghai Lu <yinghai@...nel.org>
Cc: Joerg Roedel <joro@...tes.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc: Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
---
arch/x86/kernel/apic/io_apic.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index b943012..4b836ea 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -301,6 +301,29 @@ static void free_irq_at(unsigned int at, struct irq_cfg *cfg)
irq_free_desc(at);
}
+static struct irq_cfg *alloc_reserved_irq_and_cfg_at(unsigned int at, int node)
+{
+ struct irq_cfg *cfg;
+ int res;
+
+ res = irq_alloc_reserved_desc_at(at, node);
+
+ if (res >= 0) {
+ cfg = irq_desc_get_chip_data(irq_to_desc(at));
+ if (cfg)
+ return cfg;
+
+ cfg = alloc_irq_cfg(at, node);
+ if (cfg)
+ irq_set_chip_data(at, cfg);
+ else
+ irq_free_desc(at);
+
+ return cfg;
+ }
+
+ return alloc_irq_and_cfg_at(at, node);
+}
struct io_apic {
unsigned int index;
@@ -3357,7 +3380,7 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
static int
io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr)
{
- struct irq_cfg *cfg = alloc_irq_and_cfg_at(irq, node);
+ struct irq_cfg *cfg = alloc_reserved_irq_and_cfg_at(irq, node);
int ret;
if (!cfg)
--
1.8.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists