public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Yinghai Lu <yinghai@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	hpa@zytor.com, garyhade@us.ibm.com, tglx@linutronix.de,
	linux-tip-commits@vger.kernel.org, linux-kernel@vger.kernel.org,
	mingo@redhat.com, iranna.ankad@in.ibm.com,
	suresh.b.siddha@intel.com, trenn@suse.de
Subject: Re: [PATCH -v12 2/2] x86: fix out of order of gsi - full
Date: Mon, 01 Mar 2010 10:59:37 -0800	[thread overview]
Message-ID: <m1ljeb50me.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <4B8A3270.2000007@kernel.org> (Yinghai Lu's message of "Sun\, 28 Feb 2010 01\:08\:00 -0800")

Yinghai Lu <yinghai@kernel.org> writes:

> Iranna D Ankad reported that IBM x3950 systems have boot problems
> after this commit:
>
>  |
>  | commit b9c61b70075c87a8612624736faf4a2de5b1ed30
>  |
>  |    x86/pci: update pirq_enable_irq() to setup io apic routing
>  |
>
>     As explained in the previous patch ("x86: Fix out of order gsi - partial)
>     try to remap those gsis
>
>     This patch adds boot_ioapic_idx and gsi_to_irq/irq_to_gsi


A couple of nits, that we will eventually want to fix.

> Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
> +++ linux-2.6/arch/x86/kernel/apic/io_apic.c
> @@ -97,6 +97,41 @@ int mp_irq_entries;
>  /* GSI interrupts */
>  static int nr_irqs_gsi = NR_IRQS_LEGACY;
>  
> +/* By default isa irqs are identity mapped to gsis */
> +unsigned int isa_irq_to_gsi[NR_IRQS_LEGACY] = {
> +	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
> +};
> +
> +static int boot_ioapic_idx;
> +static int gsi_delta;
> +int gsi_to_irq(unsigned int gsi)
> +{
> +	unsigned int irq = gsi;
> +	unsigned int i;
> +
> +	irq += gsi_delta;
> +	for (i = 0; i < NR_IRQS_LEGACY; i++) {
> +		if (isa_irq_to_gsi[i] == gsi) {
> +			irq = i;
> +			break;
> +		}
> +	}
> +
> +	return irq;
> +}
> +
> +unsigned int irq_to_gsi(int irq)
> +{
> +	unsigned int gsi;
> +
> +	if (irq < NR_IRQS_LEGACY)
> +		gsi = isa_irq_to_gsi[irq];
> +	else
> +		gsi = irq - gsi_delta;
> +
> +	return gsi;
> +}

This should really live in arch/x86/kernel/acpi/boot.c or similar as
it has everything to do with acpi and gsis and nothing to do with the
ioapics.

Not this merge window, but ultimately we want a fixed value of 16 for
gsi_delta, and we want to always use it.  This has a greater chance of
breaking things but it will ensure in the long run that we flush out
every place that actually needs translation from irqs to gsis.

> Index: linux-2.6/drivers/pnp/pnpacpi/rsparser.c
> ===================================================================
> --- linux-2.6.orig/drivers/pnp/pnpacpi/rsparser.c
> +++ linux-2.6/drivers/pnp/pnpacpi/rsparser.c
> @@ -123,6 +123,14 @@ static void pnpacpi_parse_allocated_irqr
>  	}
>  
>  	flags = irq_flags(triggering, polarity, shareable);
> +#ifdef CONFIG_X86_IO_APIC
> +	/*
> +	 * looks like IBM x3950 is using irq instead of gsi etc...
> +	 * convert it back at first
> +	 */
> +	if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC)
> +		gsi = irq_to_gsi(gsi);
> +#endif

I would like to understand this better.  I suspect the actual problem
is that we are getting passed bus_irq instead of gsi from acpi.  If we
are getting passed the bus_irq than doing this just for x3950 is wrong.

I really dislike having special cases for a specific motherboard.  Both
because they are hard to maintain (as quickly no one has that board) and
because may times they are a symptom of a bug elsewhere in the code
that we are trying to patch over instead of actually fix properly.

>  	irq = acpi_register_gsi(&dev->dev, gsi, triggering, polarity);
>  	if (irq >= 0)
>  		pcibios_penalize_isa_irq(irq, 1);

Eric

  reply	other threads:[~2010-03-01 18:59 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201002221108.42847.trenn@suse.de>
     [not found] ` <4B826CA6.7060007@kernel.org>
     [not found]   ` <201002221258.38506.trenn@suse.de>
2010-02-23  9:07     ` Other problem/regression with b9c61b70075c87a8612624736faf4a2de5b1ed30 Yinghai Lu
2010-02-23 18:40       ` Yinghai Lu
2010-02-23 20:17         ` Eric W. Biederman
2010-02-26 19:30         ` [PATCH -v8 1/2] x86: fix out of order of gsi - have right boot_ioapic_idx Yinghai Lu
2010-02-27 12:57           ` [tip:x86/apic] x86: Fix out of order gsi - have the " tip-bot for Yinghai Lu
2010-02-26 19:31         ` [PATCH -v8 2/2] x86: fix out of order of gsi -- add remap_ioapic_gsi_to_irq Yinghai Lu
2010-02-27 12:57           ` [tip:x86/apic] x86: Fix out of order gsi -- add remap_ioapic_gsi_to_irq() tip-bot for Yinghai Lu
2010-02-27 13:01             ` Ingo Molnar
2010-02-27 18:52               ` Yinghai Lu
2010-02-27 22:57                 ` H. Peter Anvin
2010-02-27 19:04               ` Eric W. Biederman
2010-02-27 19:40                 ` Yinghai Lu
2010-02-27 21:30                   ` Eric W. Biederman
2010-02-27 22:00                     ` Yinghai Lu
2010-02-27 22:18                       ` Eric W. Biederman
2010-02-27 22:58                         ` Yinghai Lu
2010-02-28  1:12                         ` [PATCH -v9] x86: fix out of order of gsi Yinghai Lu
2010-02-28  3:26                           ` [PATCH -v10] " Yinghai Lu
2010-02-28  3:47                         ` [PATCH -v11] x86: fix out of order of gsi -- partial Yinghai Lu
2010-02-28  8:09                           ` Ingo Molnar
2010-02-28  9:05                             ` Yinghai Lu
2010-03-01 14:40                               ` Thomas Renninger
2010-03-01 18:31                                 ` Yinghai Lu
2010-02-28  9:06                             ` [PATCH -v12 1/2] " Yinghai Lu
2010-02-28 19:51                               ` [tip:x86/apic] x86: Fix out of order of gsi tip-bot for Eric W. Biederman
2010-02-28  9:08                             ` [PATCH -v12 2/2] x86: fix out of order of gsi - full Yinghai Lu
2010-03-01 18:59                               ` Eric W. Biederman [this message]
2010-03-01 19:37                       ` [tip:x86/apic] x86: Fix out of order gsi -- add remap_ioapic_gsi_to_irq() Eric W. Biederman
2010-03-01 20:26                         ` Yinghai Lu
2010-03-01 16:46                     ` [LKML] " Konrad Rzeszutek Wilk
2010-03-01 18:37                       ` Yinghai Lu
2010-03-01 18:44                       ` Eric W. Biederman
2010-03-01 18:33                         ` [LKML] " Konrad Rzeszutek Wilk
2010-02-23 19:02       ` Other problem/regression with b9c61b70075c87a8612624736faf4a2de5b1ed30 Gary Hade

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=m1ljeb50me.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=garyhade@us.ibm.com \
    --cc=hpa@zytor.com \
    --cc=iranna.ankad@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=trenn@suse.de \
    --cc=yinghai@kernel.org \
    /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