]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Brandon Philips <bphilips@suse.de> |
2 | Subject: Avoid oops on G33 in 1MB stolen Mem case | |
3 | References: bnc#391261 | |
4 | Patch-Mainline: soon (see bug for ref) | |
5 | ||
6 | This is similar to f443675affe3f16dd428e46f0f7fd3f4d703eeab which was | |
7 | reverted because it broke with older XOrg driver. This patch only fixes | |
8 | the 1MB stolen case since it causes an oops due to a calculation | |
9 | problem. | |
10 | ||
11 | This will not work with older X drivers without the accompanying patch | |
12 | but I think avoiding an oops and making it possible to work with an | |
13 | up-to-date xorg driver is reasonable. | |
14 | ||
15 | Explanation of the oops: | |
16 | ||
17 | > static void intel_i830_init_gtt_entries(void) | |
18 | ... | |
19 | > } else if (IS_G33) { | |
20 | > /* G33's GTT size defined in gmch_ctrl */ | |
21 | > switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) { | |
22 | > case G33_PGETBL_SIZE_1M: | |
23 | > size = 1024; | |
24 | > break; | |
25 | ... | |
26 | > size += 4; | |
27 | ||
28 | size = 1028 | |
29 | ||
30 | Then since we have the BIOS setting 1MB for the device in the GMCH | |
31 | control we get to here: | |
32 | ||
33 | > } else { | |
34 | > switch (gmch_ctrl & I855_GMCH_GMS_MASK) { | |
35 | > case I855_GMCH_GMS_STOLEN_1M: | |
36 | > gtt_entries = MB(1) - KB(size); | |
37 | > break; | |
38 | ||
39 | MB(1) = 1 * 1024 * 1024 | |
40 | KB(1028) = 1028 * 1024 | |
41 | ||
42 | MB(1) - KB(1028) = -4096 | |
43 | ||
44 | > gtt_entries /= KB(4); | |
45 | > intel_private.gtt_entries = gtt_entries; | |
46 | ||
47 | We end up with -1 in gtt_entries. | |
48 | ||
49 | This leads to intel_i915_configure reading/writing to areas outside of | |
50 | mapped memory and the oops. | |
51 | ||
52 | Signed-off-by: Brandon Philips <bphilips@suse.de> | |
53 | Acked-by: Thomas Renninger <trenn@suse.de> | |
54 | ||
55 | --- | |
56 | drivers/char/agp/intel-agp.c | 7 +++++++ | |
57 | 1 file changed, 7 insertions(+) | |
58 | ||
59 | --- a/drivers/char/agp/intel-agp.c | |
60 | +++ b/drivers/char/agp/intel-agp.c | |
61 | @@ -564,6 +564,13 @@ static void intel_i830_init_gtt_entries( | |
62 | } else { | |
63 | switch (gmch_ctrl & I855_GMCH_GMS_MASK) { | |
64 | case I855_GMCH_GMS_STOLEN_1M: | |
65 | + if (IS_G33) { | |
66 | + size = 0; | |
67 | + printk(KERN_WARNING PFX | |
68 | + "Warning: G33 chipset with 1MB" | |
69 | + " allocated. Older X.org Intel drivers" | |
70 | + " will not work.\n"); | |
71 | + } | |
72 | gtt_entries = MB(1) - KB(size); | |
73 | break; | |
74 | case I855_GMCH_GMS_STOLEN_4M: |