* 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0
@ 2004-01-25 5:26 Huw Rogers
2004-01-25 15:28 ` Zwane Mwaikambo
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Huw Rogers @ 2004-01-25 5:26 UTC (permalink / raw)
To: linux-kernel, linux-laptop
Uniwill N258SA0 (http://www.uniwill.com/Product/N258SA0/N258SA0.html) aka
Hypersonic Aviator NX6, Fujitsu-Siemens AMILO D 1840 Widescreen, etc.).
SiS 648FX chipset, SiS 900 Ethercard, AMI BIOS, ATI AV350/M10 128Mb.
My machine: Hyperthreaded P4 2.8GHz, .5Gb PC3200 RAM.
Installed Fedora. Upgraded to 2.6.2-rc1 per
http://thomer.com/linux/migrate-to-2.6.html.
Applied kernel patches:
- SiS AGP (http://lkml.org/lkml/2004/1/20/233)
(needed to run ATI's 3.7 fglrx drivers on the SiS/M10 combo)
- ACPI 20031203 (http://acpi.sourceforge.net/)
All good, but ACPI sleep doesn't work and neither does userland IRQ
balancing with Arjan's irqbalance (http://people.redhat.com/arjanv/irqbalance/),
a standard part of the Fedora install.
irqbalance just locks up the machine totally, hard power-off needed, no
traces in the logs. Probably some issue (race?) with it writing to
/proc/irq/X/smp_affinity. And how is irqbalance supposed to play with
kirqd anyway? Grepping this list and others doesn't give any kind of an
answer. But disabling it gives all interrupts to cpu0 (looking at
/proc/interrupts). kirqd apparently only balances between CPU packages,
not between HT siblings (info gleaned from this list).
Anyway, sleep/suspend/standby functionality (important to most laptop
users, need to close the lid and go): This checkin to
kernel/power/main.c seems to disable suspend with SMP (!?):
--- 1.3/kernel/power/main.c Sat Jan 24 20:44:47 2004
+++ 1.4/kernel/power/main.c Sat Jan 24 20:44:47 2004
@@ -172,6 +172,12 @@
if (down_trylock(&pm_sem))
return -EBUSY;
+ /* Suspend is hard to get right on SMP. */
+ if (num_online_cpus() != 1) {
+ error = -EPERM;
+ goto Unlock;
+ }
+
if ((error = suspend_prepare(state)))
goto Unlock;
... which, given the prevalence of hyperthreaded CPUs on laptops, is
fighting a trend. I backed out the above with a #if 0 then tried echo -n
1>/proc/acpi/sleep again. This time I got:
Stopping tasks: ===================================================================
stopping tasks failed (1 tasks remaining)
Restarting tasks...<6> Strange, kirqd not stopped
done
kirqd just wouldn't stop.
Tried booting with acpi=off and apm=smp to force APM, then ran
apm --suspend, but it put the machine into a LCD blanked state it
couldn't get out of without another hard power cycle.
Questions: Why does irqbalance lock up the machine and how is it
supposed to collaborate with kirqd? How is ACPI suspend supposed to work
on any recent laptop if SMP is barred? Why doesn't kirqd stop when asked
to by ACPI suspend once that restriction is bypassed?
A lot of effort is going into swsusp/pmdisk - but a lot of laptop users
prefer S1 to S4, as it's faster and more reliable. It'd be nice to see a
simpler "spin down the hard drive, reduce CPU clock speed to a minimum,
and power down display/ether/wireless/usb/PCMCIA" working ahead of
hibernation.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0
2004-01-25 5:26 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0 Huw Rogers
@ 2004-01-25 15:28 ` Zwane Mwaikambo
2004-01-26 23:33 ` bill davidsen
2004-01-27 8:39 ` Pavel Machek
2 siblings, 0 replies; 10+ messages in thread
From: Zwane Mwaikambo @ 2004-01-25 15:28 UTC (permalink / raw)
To: Huw Rogers; +Cc: Linux Kernel, linux-laptop
On Sun, 25 Jan 2004, Huw Rogers wrote:
> irqbalance just locks up the machine totally, hard power-off needed, no
> traces in the logs. Probably some issue (race?) with it writing to
> /proc/irq/X/smp_affinity. And how is irqbalance supposed to play with
> kirqd anyway? Grepping this list and others doesn't give any kind of an
> answer. But disabling it gives all interrupts to cpu0 (looking at
> /proc/interrupts). kirqd apparently only balances between CPU packages,
> not between HT siblings (info gleaned from this list).
Does this happen with the 'noirqbalance' kernel parameter?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0
2004-01-25 5:26 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0 Huw Rogers
2004-01-25 15:28 ` Zwane Mwaikambo
@ 2004-01-26 23:33 ` bill davidsen
2004-01-27 8:39 ` Pavel Machek
2 siblings, 0 replies; 10+ messages in thread
From: bill davidsen @ 2004-01-26 23:33 UTC (permalink / raw)
To: linux-kernel
In article <20040124233749.5637.COUNT0@localnet.com>,
Huw Rogers <count0@localnet.com> wrote:
| Uniwill N258SA0 (http://www.uniwill.com/Product/N258SA0/N258SA0.html) aka
| Hypersonic Aviator NX6, Fujitsu-Siemens AMILO D 1840 Widescreen, etc.).
| SiS 648FX chipset, SiS 900 Ethercard, AMI BIOS, ATI AV350/M10 128Mb.
| My machine: Hyperthreaded P4 2.8GHz, .5Gb PC3200 RAM.
|
| Installed Fedora. Upgraded to 2.6.2-rc1 per
| http://thomer.com/linux/migrate-to-2.6.html.
|
| Applied kernel patches:
| - SiS AGP (http://lkml.org/lkml/2004/1/20/233)
| (needed to run ATI's 3.7 fglrx drivers on the SiS/M10 combo)
| - ACPI 20031203 (http://acpi.sourceforge.net/)
|
| All good, but ACPI sleep doesn't work and neither does userland IRQ
| balancing with Arjan's irqbalance (http://people.redhat.com/arjanv/irqbalance/),
| a standard part of the Fedora install.
Let me ask a question which probably has an obvious answer... why do you
care to balance the irq on the siblings of a single CPU? Is there some
hidden value I totally miss?
Noting that WBEL-3.0 balances all of the interrupts *except* NICs, I am
sure I don't understand the benefits of balancing between siblings, but
I'm sure someone will enlighten me.
--
bill davidsen <davidsen@tmr.com>
CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0
2004-01-25 5:26 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0 Huw Rogers
2004-01-25 15:28 ` Zwane Mwaikambo
2004-01-26 23:33 ` bill davidsen
@ 2004-01-27 8:39 ` Pavel Machek
2004-01-27 15:38 ` Bart Samwel
2 siblings, 1 reply; 10+ messages in thread
From: Pavel Machek @ 2004-01-27 8:39 UTC (permalink / raw)
To: Huw Rogers; +Cc: linux-kernel, linux-laptop
Hi!
> irqbalance just locks up the machine totally, hard power-off needed, no
> traces in the logs. Probably some issue (race?) with it writing to
> /proc/irq/X/smp_affinity. And how is irqbalance supposed to play with
> kirqd anyway? Grepping this list and others doesn't give any kind of an
> answer. But disabling it gives all interrupts to cpu0 (looking at
> /proc/interrupts). kirqd apparently only balances between CPU packages,
> not between HT siblings (info gleaned from this list).
>
> Anyway, sleep/suspend/standby functionality (important to most laptop
> users, need to close the lid and go): This checkin to
> kernel/power/main.c seems to disable suspend with SMP (!?):
>
> --- 1.3/kernel/power/main.c Sat Jan 24 20:44:47 2004
> +++ 1.4/kernel/power/main.c Sat Jan 24 20:44:47 2004
> @@ -172,6 +172,12 @@
> if (down_trylock(&pm_sem))
> return -EBUSY;
>
> + /* Suspend is hard to get right on SMP. */
> + if (num_online_cpus() != 1) {
> + error = -EPERM;
> + goto Unlock;
> + }
> +
> if ((error = suspend_prepare(state)))
> goto Unlock;
>
> ... which, given the prevalence of hyperthreaded CPUs on laptops, is
> fighting a trend. I backed out the above with a #if 0 then tried echo -n
> 1>/proc/acpi/sleep again. This time I got:
Well, no sleep developers have SMP or HT machines, AFAICT.
If you back that out... well you are on your own.
> A lot of effort is going into swsusp/pmdisk - but a lot of laptop users
> prefer S1 to S4, as it's faster and more reliable. It'd be nice to see a
> simpler "spin down the hard drive, reduce CPU clock speed to a minimum,
> and power down display/ether/wireless/usb/PCMCIA" working ahead of
> hibernation.
As far as I can see, noone is interested in S1. If you want to help
with it... [There's no need to stop tasks/stop devices on non-broken
hardware. Unfortunately there's a lot of broken hw out there, so I'm
not sure we can do it by default.]
Pavel
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0
2004-01-27 8:39 ` Pavel Machek
@ 2004-01-27 15:38 ` Bart Samwel
2004-01-27 19:30 ` Nigel Cunningham
2004-01-27 20:58 ` 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0 Pavel Machek
0 siblings, 2 replies; 10+ messages in thread
From: Bart Samwel @ 2004-01-27 15:38 UTC (permalink / raw)
To: Pavel Machek; +Cc: Huw Rogers, linux-kernel, linux-laptop
Pavel Machek wrote:
>>Anyway, sleep/suspend/standby functionality (important to most laptop
>>users, need to close the lid and go): This checkin to
>>kernel/power/main.c seems to disable suspend with SMP (!?):
>>
>>--- 1.3/kernel/power/main.c Sat Jan 24 20:44:47 2004
>>+++ 1.4/kernel/power/main.c Sat Jan 24 20:44:47 2004
>>@@ -172,6 +172,12 @@
>> if (down_trylock(&pm_sem))
>> return -EBUSY;
>>
>>+ /* Suspend is hard to get right on SMP. */
>>+ if (num_online_cpus() != 1) {
>>+ error = -EPERM;
>>+ goto Unlock;
>>+ }
>>+
>> if ((error = suspend_prepare(state)))
>> goto Unlock;
>>
>>... which, given the prevalence of hyperthreaded CPUs on laptops, is
>>fighting a trend. I backed out the above with a #if 0 then tried echo -n
>>1>/proc/acpi/sleep again. This time I got:
>
>
> Well, no sleep developers have SMP or HT machines, AFAICT.
>
> If you back that out... well you are on your own.
Just a random thought: if I understand it correctly, CPU hotplugging is
intended to be able to take CPUs online and offline one by one, am I
right? Well, when that infrastructure's ready, this can probably be made
to work for SMP by taking all the other CPUs offline first. They're all
going to go offline because of the suspend anyway, so it shouldn't make
much difference. :)
-- Bart
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0
2004-01-27 15:38 ` Bart Samwel
@ 2004-01-27 19:30 ` Nigel Cunningham
[not found] ` <37778.199.172.169.20.1075236597.squirrel@webmail.localnet.com>
2004-01-27 20:58 ` 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0 Pavel Machek
1 sibling, 1 reply; 10+ messages in thread
From: Nigel Cunningham @ 2004-01-27 19:30 UTC (permalink / raw)
To: Bart Samwel
Cc: Pavel Machek, Huw Rogers, Linux Kernel Mailing List, linux-laptop
Hi.
I have SMP working under 2.4, and am not far away from having it for
2.6. There is just one file that needs changing, but I need to learn
some x86 assembly first. If someone already knows x86 assembly and wants
to get it going first, I'll happily apply the patch.
Regards,
Nigel
> > Well, no sleep developers have SMP or HT machines, AFAICT.
--
My work on Software Suspend is graciously brought to you by
LinuxFund.org.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0
2004-01-27 15:38 ` Bart Samwel
2004-01-27 19:30 ` Nigel Cunningham
@ 2004-01-27 20:58 ` Pavel Machek
1 sibling, 0 replies; 10+ messages in thread
From: Pavel Machek @ 2004-01-27 20:58 UTC (permalink / raw)
To: Bart Samwel; +Cc: Huw Rogers, linux-kernel, linux-laptop
Hi!
> >>Anyway, sleep/suspend/standby functionality (important to most laptop
> >>users, need to close the lid and go): This checkin to
> >>kernel/power/main.c seems to disable suspend with SMP (!?):
> >>
> >>--- 1.3/kernel/power/main.c Sat Jan 24 20:44:47 2004
> >>+++ 1.4/kernel/power/main.c Sat Jan 24 20:44:47 2004
> >>@@ -172,6 +172,12 @@
> >> if (down_trylock(&pm_sem))
> >> return -EBUSY;
> >>
> >>+ /* Suspend is hard to get right on SMP. */
> >>+ if (num_online_cpus() != 1) {
> >>+ error = -EPERM;
> >>+ goto Unlock;
> >>+ }
> >>+
> >> if ((error = suspend_prepare(state)))
> >> goto Unlock;
> >>
> >>... which, given the prevalence of hyperthreaded CPUs on laptops, is
> >>fighting a trend. I backed out the above with a #if 0 then tried echo -n
> >>1>/proc/acpi/sleep again. This time I got:
> >
> >
> > Well, no sleep developers have SMP or HT machines, AFAICT.
> >
> > If you back that out... well you are on your own.
>
> Just a random thought: if I understand it correctly, CPU hotplugging is
> intended to be able to take CPUs online and offline one by one, am I
> right? Well, when that infrastructure's ready, this can probably be made
> to work for SMP by taking all the other CPUs offline first. They're all
> going to go offline because of the suspend anyway, so it shouldn't make
> much difference. :)
That was original plan, but CPU hotplug is unlikely to get into 2.6,
AFAICT. (And Nigel has another solution).
Pavel
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
^ permalink raw reply [flat|nested] 10+ messages in thread
* APM good, ACPI bad (2.6.2-rc1 / p4 HT / Uniwill N258SA0)
[not found] ` <37778.199.172.169.20.1075236597.squirrel@webmail.localnet.com>
@ 2004-02-01 21:05 ` Huw Rogers
2004-02-01 22:46 ` Pavel Machek
2004-02-17 2:26 ` 2.6.3-rc3-mm1 - COMPILE FAILURE Huw Rogers
0 siblings, 2 replies; 10+ messages in thread
From: Huw Rogers @ 2004-02-01 21:05 UTC (permalink / raw)
To: linux-kernel; +Cc: ncunningham, pavel, linux-laptop, acpi-devel
Got Uniwill N258SA0 laptop suspend/resume working (2.6.2-rc1-mm3) with
APM. Patch enclosed. CPU is desktop P4 with hyperthreading.
Recompiled 2.6.2-rc1-mm3 without ACPI, with APM. Booting with
noirqbalance acpi=ht apm=smp.
apm --suspend works perfectly, including from within fglrx accelerated X
(albeit with occasional minor screen corruption requiring a X refresh on
suspend, easily scripted).
I needed this patch on top of -mm3 (incorporates Oliver's SiS AGP patch
from http://lkml.org/lkml/2004/1/20/233). This fixes the SiS 648FX AGP
driver. I #if 0'd a prohibition on suspend with SMP. I also added
suspend/resume handlers for the SiS 648FX (suspend does nothing, resume
reconfigures).
My earlier report of bad ACPI experience:
> S1 - suspends, does not fully resume (USB devices get re-initted,
> then hangs). needs power cycle to get back
> S3 - suspends if acpi_os_name="Microsoft Windows NT", but resume
> disables the display so thoroughly I have to unplug AC and remove
> battery before power cycling to get it back!
> S4 (pmdisk) - suspends and immediately resumes with spurious wake up
> S4b - ('') - ditto
There's some kind of deep problem with S3 resume and ACPI - "Back to C!"
never even gets output, i.e. wakeup.S has some kind of problem, but it's
difficult to debug.
pmdisk (echo -n "disk" >/sys/power/state) has the same behavior under
APM as reported above under ACPI, i.e. immediate resume. Not sure if
it's supposed to work other than under ACPI anyway...
Patch:
-------- cut here --------
diff -Nru a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
--- a/drivers/char/agp/agp.h 2004-01-09 01:59:26.000000000 -0500
+++ b/drivers/char/agp/agp.h 2004-01-25 19:42:18.000000000 -0500
@@ -402,6 +402,17 @@
void get_agp_version(struct agp_bridge_data *bridge);
unsigned long agp_generic_mask_memory(unsigned long addr, int type);
+/* generic routines for agp>=3 */
+int agp3_generic_fetch_size(void);
+void agp3_generic_tlbflush(struct agp_memory *mem);
+int agp3_generic_configure(void);
+void agp3_generic_cleanup(void);
+
+/* aperture sizes have been standardised since v3 */
+#define AGP_GENERIC_SIZES_ENTRIES 11
+extern struct aper_size_info_16 agp3_generic_sizes[];
+
+
extern int agp_off;
extern int agp_try_unsupported_boot;
@@ -410,7 +421,10 @@
#define AGPCMD 0x8
#define AGPNISTAT 0xc
#define AGPCTRL 0x10
+#define AGPAPSIZE 0x14
#define AGPNEPG 0x16
+#define AGPGARTLO 0x18
+#define AGPGARTHI 0x1c
#define AGPNICMD 0x20
#define AGP_MAJOR_VERSION_SHIFT (20)
@@ -435,4 +449,8 @@
#define AGPSTAT3_8X (1<<1)
#define AGPSTAT3_4X (1)
+#define AGPCTRL_APERENB (1<<8)
+#define AGPCTRL_GTLBEN (1<<7)
+
+
#endif /* _AGP_BACKEND_PRIV_H */
diff -Nru a/drivers/char/agp/generic-agp3.c b/drivers/char/agp/generic-agp3.c
--- a/drivers/char/agp/generic-agp3.c 1969-12-31 19:00:00.000000000 -0500
+++ b/drivers/char/agp/generic-agp3.c 2004-01-25 19:42:18.000000000 -0500
@@ -0,0 +1,115 @@
+/*
+ * AGPGART driver.
+ * Copyright (C) 2002-2003 Dave Jones.
+ * Copyright (C) 1999 Jeff Hartmann.
+ * Copyright (C) 1999 Precision Insight, Inc.
+ * Copyright (C) 1999 Xi Graphics, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+
+#include <linux/pci.h>
+#include <linux/agp_backend.h>
+#include "agp.h"
+
+/*
+ * These functions are implemented according to the agpV3 spec,
+ * which covers implementation details that had previously been
+ * left up to manufacturers.
+ */
+
+int agp3_generic_fetch_size(void)
+{
+ u16 temp_size;
+ int i;
+ struct aper_size_info_16 *values;
+
+ pci_read_config_word(agp_bridge->dev, agp_bridge->capndx+AGPAPSIZE, &temp_size);
+ values = A_SIZE_16(agp_bridge->driver->aperture_sizes);
+
+ for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
+ if (temp_size == values[i].size_value) {
+ agp_bridge->previous_size =
+ agp_bridge->current_size = (void *) (values + i);
+
+ agp_bridge->aperture_size_idx = i;
+ return values[i].size;
+ }
+ }
+ return 0;
+}
+EXPORT_SYMBOL(agp3_generic_fetch_size);
+
+void agp3_generic_tlbflush(struct agp_memory *mem)
+{
+ u32 ctrl;
+ pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, &ctrl);
+ pci_write_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, ctrl & ~AGPCTRL_GTLBEN);
+ pci_write_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, ctrl);
+}
+EXPORT_SYMBOL(agp3_generic_tlbflush);
+
+int agp3_generic_configure(void)
+{
+ u32 temp;
+
+ struct aper_size_info_16 *current_size;
+ current_size = A_SIZE_16(agp_bridge->current_size);
+
+ pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
+ agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
+
+ // set aperture size
+ pci_write_config_word(agp_bridge->dev, agp_bridge->capndx+AGPAPSIZE, current_size->size_value);
+ // set gart pointer
+ pci_write_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPGARTLO, agp_bridge->gatt_bus_addr);
+
+ // enable aperture and GTLB
+ pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, &temp);
+ pci_write_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, temp | AGPCTRL_APERENB | AGPCTRL_GTLBEN);
+
+ return 0;
+}
+EXPORT_SYMBOL(agp3_generic_configure);
+
+void agp3_generic_cleanup(void)
+{
+ u32 ctrl;
+ pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, &ctrl);
+ pci_write_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, ctrl & ~AGPCTRL_APERENB);
+}
+EXPORT_SYMBOL(agp3_generic_cleanup);
+
+struct aper_size_info_16 agp3_generic_sizes[AGP_GENERIC_SIZES_ENTRIES]=
+{
+ {4096, 1048576, 10,0x000},
+ {2048, 524288, 9, 0x800},
+ {1024, 262144, 8, 0xc00},
+ { 512, 131072, 7, 0xe00},
+ { 256, 65536, 6, 0xf00},
+ { 128, 32768, 5, 0xf20},
+ { 64, 16384, 4, 0xf30},
+ { 32, 8192, 3, 0xf38},
+ { 16, 4096, 2, 0xf3c},
+ { 8, 2048, 1, 0xf3e},
+ { 4, 1024, 0, 0xf3f}
+};
+EXPORT_SYMBOL(agp3_generic_sizes);
diff -Nru a/drivers/char/agp/Makefile b/drivers/char/agp/Makefile
--- a/drivers/char/agp/Makefile 2004-01-09 01:59:19.000000000 -0500
+++ b/drivers/char/agp/Makefile 2004-01-25 19:42:18.000000000 -0500
@@ -1,4 +1,4 @@
-agpgart-y := backend.o frontend.o generic.o isoch.o
+agpgart-y := backend.o frontend.o generic.o generic-agp3.o isoch.o
obj-$(CONFIG_AGP) += agpgart.o
obj-$(CONFIG_AGP_ALI) += ali-agp.o
diff -Nru a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
--- a/drivers/char/agp/sis-agp.c 2004-01-09 01:59:06.000000000 -0500
+++ b/drivers/char/agp/sis-agp.c 2004-02-01 13:06:09.000000000 -0500
@@ -21,7 +21,7 @@
((temp_size & ~(0x03)) ==
(values[i].size_value & ~(0x03)))) {
agp_bridge->previous_size =
- agp_bridge->current_size = (void *) (values + i);
+ agp_bridge->current_size = (void *) (values + i);
agp_bridge->aperture_size_idx = i;
return values[i].size;
@@ -61,7 +61,67 @@
(previous_size->size_value & ~(0x03)));
}
-static struct aper_size_info_8 sis_generic_sizes[7] =
+static void sis648_enable(u32 mode)
+{
+ // find the master, this needs to be better
+ struct pci_dev *master = NULL;
+ u8 mcapndx=0;
+
+ while ((master = pci_find_class(PCI_CLASS_DISPLAY_VGA<<8, master)) != NULL) {
+ mcapndx = pci_find_capability(master, PCI_CAP_ID_AGP);
+ printk (KERN_INFO PFX "Found AGP device. %x:%x \n", master->vendor, master->device);
+ break;
+ }
+ if(!mcapndx)
+ return;
+
+ u32 tStatus;
+ u32 mStatus;
+ pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPSTAT, &tStatus);
+ pci_read_config_dword(master, mcapndx+AGPSTAT, &mStatus);
+
+ printk(KERN_INFO PFX "target status %x\n", tStatus);
+ printk(KERN_INFO PFX "master status %x\n", mStatus);
+
+ int tcc=(tStatus>>10)&3;
+ int mcc=(mStatus>>10)&3;
+ int calcycl=(tcc<mcc) ? tcc : mcc;
+ int sba=(tStatus & AGPSTAT_SBA) && (mStatus & AGPSTAT_SBA);
+ int agp_enable=1;
+ int gart64b=0;
+ int over4g=0;
+ int fw=(tStatus & AGPSTAT_FW) && (mStatus & AGPSTAT_FW);
+ int rate=(tStatus & 2) && (tStatus & 2) ? 2 : 1;
+
+ // init target (bridge)
+ u32 tcmd=(calcycl<<10)|(sba<<9)|(agp_enable<<8)|(gart64b<<7)|(over4g<<5)|(fw<<4)|rate;
+ printk(KERN_INFO PFX "tcmd=%x\n",tcmd);
+ pci_write_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCMD, tcmd);
+
+ u8 mcaptest = pci_find_capability(master, PCI_CAP_ID_AGP);
+ if(mcaptest!=mcapndx)
+ {
+ printk(KERN_INFO PFX "master capndx screwed ... waiting 10ms\n");
+ // weird: on 648fx chipsets any rate change in the target command register
+ // triggers a 5ms screwup during which the master cannot be configured
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout (1+(HZ*10)/1000);
+ }
+ else
+ {
+ printk(KERN_INFO PFX "bridge is up and master seems okay");
+ }
+
+ // init master (card)
+ int prq=(mStatus>>24)&0xff;
+ int parqsz=(tStatus>>AGPSTAT_ARQSZ_SHIFT) & 3;
+ u32 mcmd=(prq<<24)|(parqsz<<13)|(sba<<9)|(agp_enable<<8)|(over4g<<5)|(fw<<4)|rate;
+ printk(KERN_INFO PFX "mcmd=%x\n",mcmd);
+
+ pci_write_config_dword(master, mcapndx+AGPCMD, mcmd);
+}
+
+static struct aper_size_info_8 sis_generic_sizes[] =
{
{256, 65536, 6, 99},
{128, 32768, 5, 83},
@@ -95,6 +155,29 @@
.agp_destroy_page = agp_generic_destroy_page,
};
+struct agp_bridge_driver sis648_driver = {
+ .owner = THIS_MODULE,
+ .aperture_sizes = agp3_generic_sizes,
+ .size_type = U16_APER_SIZE,
+ .num_aperture_sizes = AGP_GENERIC_SIZES_ENTRIES,
+ .configure = agp3_generic_configure,
+ .fetch_size = agp3_generic_fetch_size,
+ .cleanup = agp3_generic_cleanup,
+ .tlb_flush = agp3_generic_tlbflush,
+ .mask_memory = agp_generic_mask_memory,
+ .masks = NULL,
+ .agp_enable = sis648_enable,
+ .cache_flush = global_cache_flush,
+ .create_gatt_table = agp_generic_create_gatt_table,
+ .free_gatt_table = agp_generic_free_gatt_table,
+ .insert_memory = agp_generic_insert_memory,
+ .remove_memory = agp_generic_remove_memory,
+ .alloc_by_type = agp_generic_alloc_by_type,
+ .free_by_type = agp_generic_free_by_type,
+ .agp_alloc_page = agp_generic_alloc_page,
+ .agp_destroy_page = agp_generic_destroy_page
+};
+
static struct agp_device_ids sis_agp_device_ids[] __devinitdata =
{
{
@@ -192,13 +275,13 @@
for (j = 0; devs[j].chipset_name; j++) {
if (pdev->device == devs[j].device_id) {
printk(KERN_INFO PFX "Detected SiS %s chipset\n",
- devs[j].chipset_name);
+ devs[j].chipset_name);
goto found;
}
}
printk(KERN_ERR PFX "Unsupported SiS chipset (device id: %04x)\n",
- pdev->device);
+ pdev->device);
return -ENODEV;
found:
@@ -206,14 +289,17 @@
if (!bridge)
return -ENOMEM;
- bridge->driver = &sis_driver;
+ if(pdev->device==PCI_DEVICE_ID_SI_648)
+ bridge->driver = &sis648_driver;
+ else
+ bridge->driver = &sis_driver;
bridge->dev = pdev;
bridge->capndx = cap_ptr;
/* Fill in the mode register */
pci_read_config_dword(pdev,
- bridge->capndx+PCI_AGP_STATUS,
- &bridge->mode);
+ bridge->capndx+PCI_AGP_STATUS,
+ &bridge->mode);
pci_set_drvdata(pdev, bridge);
return agp_add_bridge(bridge);
@@ -227,14 +313,31 @@
agp_put_bridge(bridge);
}
+static int agp_sis_suspend(struct pci_dev *dev, u32 state)
+{
+ return 0;
+}
+
+static int agp_sis_resume(struct pci_dev *pdev)
+{
+ struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
+
+ printk(KERN_INFO PFX "agp_sis_resume()\n");
+
+ if (bridge->driver == &sis648_driver)
+ agp3_generic_configure();
+
+ return 0;
+}
+
static struct pci_device_id agp_sis_pci_table[] = {
{
- .class = (PCI_CLASS_BRIDGE_HOST << 8),
- .class_mask = ~0,
- .vendor = PCI_VENDOR_ID_SI,
- .device = PCI_ANY_ID,
- .subvendor = PCI_ANY_ID,
- .subdevice = PCI_ANY_ID,
+ .class = (PCI_CLASS_BRIDGE_HOST << 8),
+ .class_mask = ~0,
+ .vendor = PCI_VENDOR_ID_SI,
+ .device = PCI_ANY_ID,
+ .subvendor = PCI_ANY_ID,
+ .subdevice = PCI_ANY_ID,
},
{ }
};
@@ -246,6 +349,8 @@
.id_table = agp_sis_pci_table,
.probe = agp_sis_probe,
.remove = agp_sis_remove,
+ .suspend = agp_sis_suspend,
+ .resume = agp_sis_resume
};
static int __init agp_sis_init(void)
diff -Nru a/kernel/power/main.c b/kernel/power/main.c
--- a/kernel/power/main.c 2004-01-09 01:59:19.000000000 -0500
+++ b/kernel/power/main.c 2004-01-25 19:59:35.000000000 -0500
@@ -144,11 +144,13 @@
if (down_trylock(&pm_sem))
return -EBUSY;
+#if 0
/* Suspend is hard to get right on SMP. */
if (num_online_cpus() != 1) {
error = -EPERM;
goto Unlock;
}
+#endif
if (state == PM_SUSPEND_DISK) {
error = pm_suspend_disk();
-------- cut here --------
--
Huw Rogers <count0@localnet.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: APM good, ACPI bad (2.6.2-rc1 / p4 HT / Uniwill N258SA0)
2004-02-01 21:05 ` APM good, ACPI bad (2.6.2-rc1 / p4 HT / Uniwill N258SA0) Huw Rogers
@ 2004-02-01 22:46 ` Pavel Machek
2004-02-17 2:26 ` 2.6.3-rc3-mm1 - COMPILE FAILURE Huw Rogers
1 sibling, 0 replies; 10+ messages in thread
From: Pavel Machek @ 2004-02-01 22:46 UTC (permalink / raw)
To: Huw Rogers; +Cc: linux-kernel, ncunningham, linux-laptop, acpi-devel
Hi!
> Got Uniwill N258SA0 laptop suspend/resume working (2.6.2-rc1-mm3) with
> APM. Patch enclosed. CPU is desktop P4 with hyperthreading.
The patch is rather big. Can you get someone to test it with ACPI, and
if it helps (or at least does not break things), submit to Andrew?
[Do *not* enable suspend on SMP for mainline, unless you are willing
to audit that code...]
Pavel
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
^ permalink raw reply [flat|nested] 10+ messages in thread
* 2.6.3-rc3-mm1 - COMPILE FAILURE
2004-02-01 21:05 ` APM good, ACPI bad (2.6.2-rc1 / p4 HT / Uniwill N258SA0) Huw Rogers
2004-02-01 22:46 ` Pavel Machek
@ 2004-02-17 2:26 ` Huw Rogers
1 sibling, 0 replies; 10+ messages in thread
From: Huw Rogers @ 2004-02-17 2:26 UTC (permalink / raw)
To: linux-kernel
ext3_quota_on() defined at lines 144352-144377 of 2.6.3-rc3-mm1 does
not compile (it does not have matching braces!!!); need CONFIG_QUOTA
to see the failure.
--
Huw Rogers <count0@localnet.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-02-17 2:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-25 5:26 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0 Huw Rogers
2004-01-25 15:28 ` Zwane Mwaikambo
2004-01-26 23:33 ` bill davidsen
2004-01-27 8:39 ` Pavel Machek
2004-01-27 15:38 ` Bart Samwel
2004-01-27 19:30 ` Nigel Cunningham
[not found] ` <37778.199.172.169.20.1075236597.squirrel@webmail.localnet.com>
2004-02-01 21:05 ` APM good, ACPI bad (2.6.2-rc1 / p4 HT / Uniwill N258SA0) Huw Rogers
2004-02-01 22:46 ` Pavel Machek
2004-02-17 2:26 ` 2.6.3-rc3-mm1 - COMPILE FAILURE Huw Rogers
2004-01-27 20:58 ` 2.6.2-rc1 / ACPI sleep / irqbalance / kirqd / pentium 4 HT problems on Uniwill N258SA0 Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox