public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems
@ 2007-10-12  7:04 Zhao Yakui
  2007-10-15 16:30 ` Chuck Ebbert
  0 siblings, 1 reply; 9+ messages in thread
From: Zhao Yakui @ 2007-10-12  7:04 UTC (permalink / raw)
  To: Linux-acpi; +Cc: lenb

Hi, All
    The BIOS of some systems using NVIDIA chipset gives the uncorrect
timer override connection, which will cause that I/O APIC and timer
can't be connected and kernel panic.
    There are two ways to fix this bug. One is to use the following patch and 
the other is to add a new boot option of acpi_force_timer_override. 

1. Use the following patch.
The basic flowchart of patch is that:(unnecessary to add new boot option)
    a. When NVIDIA chipset is detected and hpet timer exist, 
acpi_use_timer_override will be set.
    (Skip this when boot option of acpi_use_timer_override is given).
    b. Check whether uncorrect timer connection(IRQ0, Pin0) exists when 
acpi_use_timer_override is set and HPET timer exists. 
      If error exists, timer will be forced to route to the Pin2.

2. Add a new boot option of acpi_force_timer_override
    The basic flowchart of this method is that:
    a. When NVIDIA chipset is detected and HPET timer exists, 
acpi_force_timer_override will be set.
       (skip this when boot option of acpi_force_timer_override is given)
    b. Check whether uncorrect timer connection(IRQ0,Pin0) exists when 
acpi_force_timer_override is set.
       If the error exists, modify the timer override connection.

Welcome the comments.
Thanks.

Subject: ACPI :Modify timer override connection in Some NVIDIA systems
>From : Zhao Yakui <yakui.zhao@intel.com>

BIOS defines the uncorrect timeroverride connection in some NVIDIA
systems
on which HPET timer exists. When the uncorrect connection is deteced, 
the timer will be forced to route to the Pin 2 of I/O APIC instead of
Pin 0.

http://bugzilla.kernel.org/show_bug.cgi?id=8956

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
---
 arch/i386/kernel/acpi/boot.c       |   17 +++++++++++++++++
 arch/i386/kernel/acpi/earlyquirk.c |    7 ++++++-
 arch/x86_64/kernel/early-quirks.c  |    2 ++
 3 files changed, 25 insertions(+), 1 deletion(-)

Index: linux-2.6.23-rc9/arch/i386/kernel/acpi/boot.c
===================================================================
--- linux-2.6.23-rc9.orig/arch/i386/kernel/acpi/boot.c
+++ linux-2.6.23-rc9/arch/i386/kernel/acpi/boot.c
@@ -351,6 +351,11 @@ static void __init acpi_sci_ioapic_setup
 	return;
 }
 
+static int __init acpi_hpet_check(struct acpi_table_header *header)
+{
+	return 0;
+}
+
 static int __init
 acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
 		       const unsigned long end)
@@ -371,6 +376,18 @@ acpi_parse_int_src_ovr(struct acpi_subta
 		return 0;
 	}
 
+	if (acpi_use_timer_override &&
+	   intsrc->source_irq == 0 && intsrc->global_irq == 0 &&
+	   !acpi_table_parse(ACPI_SIG_HPET, acpi_hpet_check)) {
+		mp_override_legacy_irq(intsrc->source_irq,
+			intsrc->inti_flags & ACPI_MADT_POLARITY_MASK,
+			(intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2,
+			2);
+		printk(PREFIX "BIOS IRQ0 pin0 override ignored."
+				"Force to use IRQ0 pin2 \n");
+		return 0;
+	}
+
 	if (acpi_skip_timer_override &&
 	    intsrc->source_irq == 0 && intsrc->global_irq == 2) {
 		printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
Index: linux-2.6.23-rc9/arch/i386/kernel/acpi/earlyquirk.c
===================================================================
--- linux-2.6.23-rc9.orig/arch/i386/kernel/acpi/earlyquirk.c
+++ linux-2.6.23-rc9/arch/i386/kernel/acpi/earlyquirk.c
@@ -26,7 +26,8 @@ static int __init check_bridge(int vendo
 	/* According to Nvidia all timer overrides are bogus unless HPET
 	   is enabled. */
 	if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) {
-		if (!warned && acpi_table_parse(ACPI_SIG_HPET,
+		if (!warned) {
+		if (acpi_table_parse(ACPI_SIG_HPET,
 						nvidia_hpet_check)) {
 			warned = 1;
 			acpi_skip_timer_override = 1;
@@ -36,6 +37,10 @@ static int __init check_bridge(int vendo
                 printk(KERN_INFO "If you got timer trouble "
 			 	 "try acpi_use_timer_override\n");
 
+			} else {
+			warned = 1;
+			acpi_use_timer_override = 1;
+			}
 		}
 	}
 #endif
Index: linux-2.6.23-rc9/arch/x86_64/kernel/early-quirks.c
===================================================================
--- linux-2.6.23-rc9.orig/arch/x86_64/kernel/early-quirks.c
+++ linux-2.6.23-rc9/arch/x86_64/kernel/early-quirks.c
@@ -57,6 +57,8 @@ static void __init nvidia_bugs(void)
 		       "timer override.\n");
 		printk(KERN_INFO "If you got timer trouble "
 			"try acpi_use_timer_override\n");
+	} else {
+		acpi_use_timer_override = 1;
 	}
 #endif
 	/* RED-PEN skip them on mptables too? */

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems
  2007-10-12  7:04 [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems Zhao Yakui
@ 2007-10-15 16:30 ` Chuck Ebbert
  2007-10-15 16:32   ` Andi Kleen
  0 siblings, 1 reply; 9+ messages in thread
From: Chuck Ebbert @ 2007-10-15 16:30 UTC (permalink / raw)
  To: Zhao Yakui; +Cc: Linux-acpi, lenb, Andi Kleen, Thomas Gleixner

On 10/12/2007 03:04 AM, Zhao Yakui wrote:
> Hi, All
>     The BIOS of some systems using NVIDIA chipset gives the uncorrect
> timer override connection, which will cause that I/O APIC and timer
> can't be connected and kernel panic.
>     There are two ways to fix this bug. One is to use the following patch and 
> the other is to add a new boot option of acpi_force_timer_override. 
> 
> 1. Use the following patch.
> The basic flowchart of patch is that:(unnecessary to add new boot option)
>     a. When NVIDIA chipset is detected and hpet timer exist, 
> acpi_use_timer_override will be set.
>     (Skip this when boot option of acpi_use_timer_override is given).
>     b. Check whether uncorrect timer connection(IRQ0, Pin0) exists when 
> acpi_use_timer_override is set and HPET timer exists. 
>       If error exists, timer will be forced to route to the Pin2.
> 
> 2. Add a new boot option of acpi_force_timer_override
>     The basic flowchart of this method is that:
>     a. When NVIDIA chipset is detected and HPET timer exists, 
> acpi_force_timer_override will be set.
>        (skip this when boot option of acpi_force_timer_override is given)
>     b. Check whether uncorrect timer connection(IRQ0,Pin0) exists when 
> acpi_force_timer_override is set.
>        If the error exists, modify the timer override connection.
> 
> Welcome the comments.
> Thanks.
> 
> Subject: ACPI :Modify timer override connection in Some NVIDIA systems
>>From : Zhao Yakui <yakui.zhao@intel.com>
> 
> BIOS defines the uncorrect timeroverride connection in some NVIDIA
> systems
> on which HPET timer exists. When the uncorrect connection is deteced, 
> the timer will be forced to route to the Pin 2 of I/O APIC instead of
> Pin 0.
> 
> http://bugzilla.kernel.org/show_bug.cgi?id=8956
> 
> Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
> ---
>  arch/i386/kernel/acpi/boot.c       |   17 +++++++++++++++++
>  arch/i386/kernel/acpi/earlyquirk.c |    7 ++++++-
>  arch/x86_64/kernel/early-quirks.c  |    2 ++
>  3 files changed, 25 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6.23-rc9/arch/i386/kernel/acpi/boot.c
> ===================================================================
> --- linux-2.6.23-rc9.orig/arch/i386/kernel/acpi/boot.c
> +++ linux-2.6.23-rc9/arch/i386/kernel/acpi/boot.c
> @@ -351,6 +351,11 @@ static void __init acpi_sci_ioapic_setup
>  	return;
>  }
>  
> +static int __init acpi_hpet_check(struct acpi_table_header *header)
> +{
> +	return 0;
> +}
> +
>  static int __init
>  acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
>  		       const unsigned long end)
> @@ -371,6 +376,18 @@ acpi_parse_int_src_ovr(struct acpi_subta
>  		return 0;
>  	}
>  
> +	if (acpi_use_timer_override &&
> +	   intsrc->source_irq == 0 && intsrc->global_irq == 0 &&
> +	   !acpi_table_parse(ACPI_SIG_HPET, acpi_hpet_check)) {
> +		mp_override_legacy_irq(intsrc->source_irq,
> +			intsrc->inti_flags & ACPI_MADT_POLARITY_MASK,
> +			(intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2,
> +			2);
> +		printk(PREFIX "BIOS IRQ0 pin0 override ignored."
> +				"Force to use IRQ0 pin2 \n");
> +		return 0;
> +	}
> +
>  	if (acpi_skip_timer_override &&
>  	    intsrc->source_irq == 0 && intsrc->global_irq == 2) {
>  		printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
> Index: linux-2.6.23-rc9/arch/i386/kernel/acpi/earlyquirk.c
> ===================================================================
> --- linux-2.6.23-rc9.orig/arch/i386/kernel/acpi/earlyquirk.c
> +++ linux-2.6.23-rc9/arch/i386/kernel/acpi/earlyquirk.c
> @@ -26,7 +26,8 @@ static int __init check_bridge(int vendo
>  	/* According to Nvidia all timer overrides are bogus unless HPET
>  	   is enabled. */
>  	if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) {
> -		if (!warned && acpi_table_parse(ACPI_SIG_HPET,
> +		if (!warned) {
> +		if (acpi_table_parse(ACPI_SIG_HPET,
>  						nvidia_hpet_check)) {
>  			warned = 1;
>  			acpi_skip_timer_override = 1;
> @@ -36,6 +37,10 @@ static int __init check_bridge(int vendo
>                  printk(KERN_INFO "If you got timer trouble "
>  			 	 "try acpi_use_timer_override\n");
>  
> +			} else {
> +			warned = 1;
> +			acpi_use_timer_override = 1;
> +			}
>  		}
>  	}
>  #endif
> Index: linux-2.6.23-rc9/arch/x86_64/kernel/early-quirks.c
> ===================================================================
> --- linux-2.6.23-rc9.orig/arch/x86_64/kernel/early-quirks.c
> +++ linux-2.6.23-rc9/arch/x86_64/kernel/early-quirks.c
> @@ -57,6 +57,8 @@ static void __init nvidia_bugs(void)
>  		       "timer override.\n");
>  		printk(KERN_INFO "If you got timer trouble "
>  			"try acpi_use_timer_override\n");
> +	} else {
> +		acpi_use_timer_override = 1;
>  	}
>  #endif
>  	/* RED-PEN skip them on mptables too? */

cc: added

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems
  2007-10-15 16:30 ` Chuck Ebbert
@ 2007-10-15 16:32   ` Andi Kleen
  2007-10-16 21:07     ` Chuck Ebbert
  0 siblings, 1 reply; 9+ messages in thread
From: Andi Kleen @ 2007-10-15 16:32 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: Zhao Yakui, Linux-acpi, lenb, Thomas Gleixner

On Monday 15 October 2007 18:30:13 Chuck Ebbert wrote:
> On 10/12/2007 03:04 AM, Zhao Yakui wrote:
> > Hi, All
> >     The BIOS of some systems using NVIDIA chipset gives the uncorrect
> > timer override connection, which will cause that I/O APIC and timer
> > can't be connected and kernel panic.
> >     There are two ways to fix this bug. One is to use the following patch and 
> > the other is to add a new boot option of acpi_force_timer_override. 

This is already fixed in the firstfloor tree. 

-Andi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems
  2007-10-15 16:32   ` Andi Kleen
@ 2007-10-16 21:07     ` Chuck Ebbert
  2007-10-16 21:51       ` Andi Kleen
  0 siblings, 1 reply; 9+ messages in thread
From: Chuck Ebbert @ 2007-10-16 21:07 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Zhao Yakui, Linux-acpi, lenb, Thomas Gleixner

On 10/15/2007 12:32 PM, Andi Kleen wrote:
> On Monday 15 October 2007 18:30:13 Chuck Ebbert wrote:
>> On 10/12/2007 03:04 AM, Zhao Yakui wrote:
>>> Hi, All
>>>     The BIOS of some systems using NVIDIA chipset gives the uncorrect
>>> timer override connection, which will cause that I/O APIC and timer
>>> can't be connected and kernel panic.
>>>     There are two ways to fix this bug. One is to use the following patch and 
>>> the other is to add a new boot option of acpi_force_timer_override. 
> 
> This is already fixed in the firstfloor tree. 
> 

Do I need something more than early-quirks-unification and nvidia-timer-quirk?
Because those two don't fix anything; I have to manually force
acpi_use_timer_override to get things to work right. The RFC patch seems to
be doing the right thing automatically.

Hardware: nVidia MCP51/C51 (with HPET)
Host Bridge PCI ID: 10de:02f0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems
  2007-10-16 21:07     ` Chuck Ebbert
@ 2007-10-16 21:51       ` Andi Kleen
  2007-10-16 21:57         ` Chuck Ebbert
  2007-10-17  9:00         ` Zhao Yakui
  0 siblings, 2 replies; 9+ messages in thread
From: Andi Kleen @ 2007-10-16 21:51 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: Zhao Yakui, Linux-acpi, lenb, Thomas Gleixner

On Tuesday 16 October 2007 23:07:29 Chuck Ebbert wrote:

> Do I need something more than early-quirks-unification and nvidia-timer-quirk?
> Because those two don't fix anything; I have to manually force
> acpi_use_timer_override to get things to work right. The RFC patch seems to
> be doing the right thing automatically.
> 
> Hardware: nVidia MCP51/C51 (with HPET)
> Host Bridge PCI ID: 10de:02f0

Do you see the "Nvidia board detected. Ignoring ACPI timer override." message?

-Andi


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems
  2007-10-16 21:51       ` Andi Kleen
@ 2007-10-16 21:57         ` Chuck Ebbert
  2007-10-16 22:17           ` Andi Kleen
  2007-10-17  9:00         ` Zhao Yakui
  1 sibling, 1 reply; 9+ messages in thread
From: Chuck Ebbert @ 2007-10-16 21:57 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Zhao Yakui, Linux-acpi, lenb, Thomas Gleixner

On 10/16/2007 05:51 PM, Andi Kleen wrote:
> On Tuesday 16 October 2007 23:07:29 Chuck Ebbert wrote:
> 
>> Do I need something more than early-quirks-unification and nvidia-timer-quirk?
>> Because those two don't fix anything; I have to manually force
>> acpi_use_timer_override to get things to work right. The RFC patch seems to
>> be doing the right thing automatically.
>>
>> Hardware: nVidia MCP51/C51 (with HPET)
>> Host Bridge PCI ID: 10de:02f0
> 
> Do you see the "Nvidia board detected. Ignoring ACPI timer override." message?
> 

If I don't use the "force" option, yes. And the timer ends up as an XT-PIC-XT
interrupt then. But the override is apparently not broken on this system.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems
  2007-10-16 21:57         ` Chuck Ebbert
@ 2007-10-16 22:17           ` Andi Kleen
  0 siblings, 0 replies; 9+ messages in thread
From: Andi Kleen @ 2007-10-16 22:17 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: Zhao Yakui, Linux-acpi, lenb, Thomas Gleixner

On Tuesday 16 October 2007 23:57:25 Chuck Ebbert wrote:
> On 10/16/2007 05:51 PM, Andi Kleen wrote:
> > On Tuesday 16 October 2007 23:07:29 Chuck Ebbert wrote:
> > 
> >> Do I need something more than early-quirks-unification and nvidia-timer-quirk?
> >> Because those two don't fix anything; I have to manually force
> >> acpi_use_timer_override to get things to work right. The RFC patch seems to
> >> be doing the right thing automatically.
> >>
> >> Hardware: nVidia MCP51/C51 (with HPET)
> >> Host Bridge PCI ID: 10de:02f0
> > 
> > Do you see the "Nvidia board detected. Ignoring ACPI timer override." message?
> > 
> 
> If I don't use the "force" option, yes. And the timer ends up as an XT-PIC-XT
> interrupt then. But the override is apparently not broken on this system.

I don't know then. Probably didn't work before either.

The early-quirks change was only supposed to fix NF5 without HPET enabled anyways; 
if NF3 or 4 don't work it's some other problem.

-And

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems
  2007-10-16 21:51       ` Andi Kleen
  2007-10-16 21:57         ` Chuck Ebbert
@ 2007-10-17  9:00         ` Zhao Yakui
  2007-10-17  9:58           ` Andi Kleen
  1 sibling, 1 reply; 9+ messages in thread
From: Zhao Yakui @ 2007-10-17  9:00 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Chuck Ebbert, Linux-acpi, lenb, Thomas Gleixner

On Tue, 2007-10-16 at 23:51 +0200, Andi Kleen wrote:
> On Tuesday 16 October 2007 23:07:29 Chuck Ebbert wrote:
> 
> > Do I need something more than early-quirks-unification and nvidia-timer-quirk?
> > Because those two don't fix anything; I have to manually force
> > acpi_use_timer_override to get things to work right. The RFC patch seems to
> > be doing the right thing automatically.
> > 
> > Hardware: nVidia MCP51/C51 (with HPET)
> > Host Bridge PCI ID: 10de:02f0
> 
> Do you see the "Nvidia board detected. Ignoring ACPI timer override." message?
When booted with acpi=off, the system will print the message ---Nvidia
board detected .Ignoring ACPI timer override. 
But when booted with acpi on, the system won't print the above message. 

The chipset of NVIDIA is used and HPET exists. So the timer_override is
required. But unfortunately the timer override info provided by BIOS is
uncorrect. 
> -Andi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems
  2007-10-17  9:00         ` Zhao Yakui
@ 2007-10-17  9:58           ` Andi Kleen
  0 siblings, 0 replies; 9+ messages in thread
From: Andi Kleen @ 2007-10-17  9:58 UTC (permalink / raw)
  To: Zhao Yakui; +Cc: Chuck Ebbert, Linux-acpi, lenb, Thomas Gleixner

On Wednesday 17 October 2007 11:00:39 Zhao Yakui wrote:
> On Tue, 2007-10-16 at 23:51 +0200, Andi Kleen wrote:
> > On Tuesday 16 October 2007 23:07:29 Chuck Ebbert wrote:
> > 
> > > Do I need something more than early-quirks-unification and nvidia-timer-quirk?
> > > Because those two don't fix anything; I have to manually force
> > > acpi_use_timer_override to get things to work right. The RFC patch seems to
> > > be doing the right thing automatically.
> > > 
> > > Hardware: nVidia MCP51/C51 (with HPET)
> > > Host Bridge PCI ID: 10de:02f0
> > 
> > Do you see the "Nvidia board detected. Ignoring ACPI timer override." message?
> When booted with acpi=off, the system will print the message ---Nvidia
> board detected .Ignoring ACPI timer override. 
> But when booted with acpi on, the system won't print the above message. 

That was a NF5 system right? If yes the nvidia-timer-quirk patch should
work on it.

It didn't work on Chuck's system because that wasn't a NF5.
The main change nvidia-timer-quirk adds is to run the override ignore logic 
only on NF4 and NF3.

His system seems to be in a new situation: a NF4 system which needs
a timer override (that wasn't the case before!) and since most NF4 overrides
are wrong and Linux is ignoring them it won't work.

I don't really see how to handle this short of a DMI quirk for the board.
Your patch essentially hard codes the timer override for all of Nvidia which is surely
not the correct thing to do -- we have lots of evidence that those varies 
widely. Or at least if you really want to hard code you should only do it with a 
explicit DMI entry for a specific board.

> The chipset of NVIDIA is used and HPET exists. So the timer_override is
> required. But unfortunately the timer override info provided by BIOS is
> uncorrect. 

Most NF5 systems need timer override -- if some of them supply the wrong
one I don't see how to detect this short of a DMI quirk.

-Andi

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-10-17  9:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-12  7:04 [RFC] [PATCH] ACPI :Modify timer override connection in Some NVIDIA systems Zhao Yakui
2007-10-15 16:30 ` Chuck Ebbert
2007-10-15 16:32   ` Andi Kleen
2007-10-16 21:07     ` Chuck Ebbert
2007-10-16 21:51       ` Andi Kleen
2007-10-16 21:57         ` Chuck Ebbert
2007-10-16 22:17           ` Andi Kleen
2007-10-17  9:00         ` Zhao Yakui
2007-10-17  9:58           ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox