The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: jacob pan <jacob.jun.pan@linux.intel.com>
To: ebiederm@xmission.com (Eric W. Biederman)
Cc: Alan Cox <alan@linux.intel.com>,
	Arjan van de Ven <arjan@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	Feng Tang <feng.tang@intel.com>, Len Brown <len.brown@intel.com>
Subject: Re: [PATCH] x86/sfi: fix ioapic gsi range
Date: Tue, 8 Jun 2010 15:17:35 -0700	[thread overview]
Message-ID: <20100608151735.1693105f@jacob-laptop> (raw)
In-Reply-To: <m1sk4x9q45.fsf@fess.ebiederm.org>

On Tue, 08 Jun 2010 14:22:18 -0700
ebiederm@xmission.com (Eric W. Biederman) wrote:

> jacob pan <jacob.jun.pan@linux.intel.com> writes:
> 
> > On Tue, 08 Jun 2010 12:41:45 -0700
> > ebiederm@xmission.com (Eric W. Biederman) wrote:
> >
> >
> >> Even if sfi is never implemented on a platform where that kind of
> >> hardware exists, the current sfi code is setup to coexist
> >> simultaneously in the kernel with all of the infrastructure of
> >> other platforms where those kinds of devices exist.  Which means
> >> there can be drivers compiled into your kernel that make
> >> assumptions about special properties of the irqs 0-15.
> >> 
> > SFI code can be compiled in with ACPI at the same time but at
> > runtime there is only one used, ACPI take precedence. So there
> > wouldn't be any additional conflict caused by SFI added APIC tables.
> >
> >> As for the question about using legacy_pic to detect the absence of
> >> an irq controller that Peter raised.  We can't do that because it
> >> should be possible for an acpi system with all of the legacy
> >> hardware to exist without needing to implement an i8259, or ever
> >> run in the historical interrupt delivery mode of pcs.
> > In your case, I don't understand how would it change the
> > calculation of irq mapping. Even if you don't use i8259 on a x86 PC
> > platform, you still have NR_LEGACY_IRQS=legacy_pic->nr_legacy_irqs.
> >
> > On the other side, use NR_LEGACY_IRQS breaks the existing code for
> > Moorestown in terms of irq-gsi lookup and nr_irqs_gsi.
> 
> Is this code merged where I should have fixed it in my patchset?
> 
yes, merged.
> We went through this with acpi having an identity mapping of irq to
> gsi mapping and the result is that we (a) developed  weird platform
> specific hooks for things that should have been handled by generic
> code, and on other systems we lost access to 16 irqs.
> 
> It took probably 10 years to sort the acpi irq handling out.  What
> I have learned along the way is:
> - Sharing irq in software is madness, so a one to one mapping with
>   hardware irq is required.
> - An identity mapping with gsis is nice but we can't count on the
> hardware designers or the spec designers always doing sane and
> reasonable things so not guaranteeing a particular mapping is
> important.
> 
> If I have actually broken any sfi drivers because you assumed a
> particular we are back where we were with ISA, and still haven't
> completely escaped.  The abstraction layer should provide all of
> the mapping so drivers only see linux irq numbers.
> 
> Eric
> 

[jacob pan] 

In arch/x86/kernel/mrst.c we parse SFI MTMR table then
add timer irqs to mp_irqs. what is broken by this patch is
pin_2_irq() lookup for the legacy irq range since we want
NR_IRQS_LEGACY to be 0 on Moorestown. We do have the assumption that
mp_irqs from SFI is 1:1 mapped to IRQs.

Doing this can fix the problem, but you mentioned you have to use
NR_IRQS_LEGACY, which i still don't understand.

--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1032,7 +1032,7 @@ static int pin_2_irq(int idx, int apic, int pin)
 	} else {
 		u32 gsi = mp_gsi_routing[apic].gsi_base + pin;
 
-		if (gsi >= NR_IRQS_LEGACY)
+		if (gsi >= legacy_pic->nr_legacy_irqs)
 			irq = gsi;


The second problem is nr_irqs_gsi gets an extra 16 for Moorestown.
Similarly, we need this in probe_nr_irqs_gsi:

-	nr = gsi_top + NR_IRQS_LEGACY;
+	nr = gsi_top + legacy_pic->nr_legacy_irqs;

  reply	other threads:[~2010-06-08 22:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-07 23:07 [PATCH] x86/sfi: fix ioapic gsi range Jacob Pan
2010-06-08  0:01 ` jacob pan
2010-06-08  0:24 ` Eric W. Biederman
2010-06-08  0:30   ` H. Peter Anvin
2010-06-08  1:10     ` Eric W. Biederman
2010-06-08  8:10     ` Alan Cox
2010-06-08 18:11       ` H. Peter Anvin
2010-06-08 20:04         ` Eric W. Biederman
2010-06-08 18:44     ` [PATCH] x86/irq: Rename gsi_end gsi_top, and fix off by one errors Eric W. Biederman
2010-06-09 22:06       ` [tip:x86/urgent] x86, irq: " tip-bot for Eric W. Biederman
2010-06-08  5:50   ` [PATCH] x86/sfi: fix ioapic gsi range jacob pan
2010-06-08 19:41     ` Eric W. Biederman
2010-06-08 19:12       ` Alan Cox
2010-06-08 20:56         ` Yuhong Bao
2010-06-08 22:16           ` Eric W. Biederman
2010-06-08 22:29             ` Alan Cox
2010-06-08 20:36       ` H. Peter Anvin
2010-06-08 20:59         ` Eric W. Biederman
2010-06-08 21:08           ` H. Peter Anvin
2010-06-08 21:51             ` Eric W. Biederman
2010-06-08 20:41       ` jacob pan
2010-06-08 21:22         ` Eric W. Biederman
2010-06-08 22:17           ` jacob pan [this message]
2010-06-09 23:44             ` Eric W. Biederman
2010-06-10  8:40               ` jacob pan
2010-06-10 14:39                 ` Eric W. Biederman

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=20100608151735.1693105f@jacob-laptop \
    --to=jacob.jun.pan@linux.intel.com \
    --cc=alan@linux.intel.com \
    --cc=arjan@linux.intel.com \
    --cc=ebiederm@xmission.com \
    --cc=feng.tang@intel.com \
    --cc=hpa@zytor.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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