mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Linus Torvalds <torvalds@osdl.org>
Cc: Tobias Diedrich <ranma+kernel@tdiedrich.de>,
	Yinghai Lu <yinghai.lu@amd.com>, Andrew Morton <akpm@osdl.org>,
	Adrian Bunk <bunk@stusta.de>, Andi Kleen <ak@suse.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: PATCH 2/4] x86_64 io_apic: Implement irq_from_pin
Date: Mon, 08 Jan 2007 08:53:52 -0700	[thread overview]
Message-ID: <m1hcv1ikfj.fsf_-_@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <m1lkkdikmn.fsf_-_@ebiederm.dsl.xmission.com> (Eric W. Biederman's message of "Mon, 08 Jan 2007 08:49:36 -0700")


Another helper needed for guessing the routing of the timer
irq.

irq_from_pin looks at the irq_2_pin mapping and figures
out which irq is connected to a given apic and pin combination.

We need to know this to avoid guessing an apic pin that is already
in use by another irq.

Despite the nested loops this is O(N) walk through the irq_2_pin
data structure.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 arch/x86_64/kernel/io_apic.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 7365f5f..5ad210f 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -262,6 +262,20 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
 }
 #endif
 
+static int irq_from_pin(int apic, int pin)
+{
+	int irq;
+	for (irq = 0; irq < NR_IRQS; irq++) {
+		struct irq_pin_list *entry = irq_2_pin + irq;
+		while (entry->next && ((entry->apic != apic) || (entry->pin != pin)))
+			entry = irq_2_pin + entry->next;
+
+		if ((entry->pin == pin) && (entry->apic == apic))
+			return irq;
+	}
+	return -1;
+}
+
 /*
  * The common case is 1:1 IRQ<->pin mappings. Sometimes there are
  * shared ISA-space IRQs, so we have to support them. We are super
-- 
1.4.4.1.g278f


  reply	other threads:[~2007-01-08 15:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5986589C150B2F49A46483AC44C7BCA490733F@ssvlexmb2.amd.com>
2007-01-03  6:23 ` 2.6.20-rc3: known unfixed regressions - x86_64 boot failure: "IO-APIC + timer doesn't work" Yinghai Lu
2007-01-08  0:55   ` Tobias Diedrich
2007-01-08  1:09     ` Linus Torvalds
2007-01-08 15:49       ` [PATCH 1/4] x86_64 io_apic: Implement remove_pin_to_irq Eric W. Biederman
2007-01-08 15:53         ` Eric W. Biederman [this message]
2007-01-08 15:56           ` [PATCH 3/4] x86_64 io_apic: Implment update_irq0_entry Eric W. Biederman
2007-01-08 16:11             ` [PATCH 4/4] x86_64 ioapic: Improve the heuristics for when check_timer fails Eric W. Biederman
2007-01-08 20:21               ` Adrian Bunk
2007-01-08 21:45                 ` Eric W. Biederman
2007-01-08 22:33                   ` Adrian Bunk
2007-01-08 22:57                     ` Linus Torvalds
2007-01-08 23:14                     ` [discuss] " Andi Kleen
2007-01-08 23:21                       ` Adrian Bunk
2007-01-08 23:18                     ` Eric W. Biederman
2007-01-09 22:00               ` Tobias Diedrich

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=m1hcv1ikfj.fsf_-_@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=bunk@stusta.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ranma+kernel@tdiedrich.de \
    --cc=torvalds@osdl.org \
    --cc=yinghai.lu@amd.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

all inboxes | Powered by JetHome®