Gentoo Archives: gentoo-commits

From: "Tom Wijsman (tomwij)" <tomwij@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2300 - in genpatches-2.6/trunk: 3.7 3.8
Date: Thu, 28 Feb 2013 23:25:11
Message-Id: 20130228232502.888572171D@flycatcher.gentoo.org
1 Author: tomwij
2 Date: 2013-02-28 23:23:58 +0000 (Thu, 28 Feb 2013)
3 New Revision: 2300
4
5 Added:
6 genpatches-2.6/trunk/3.8/1000_linux-3.8.1.patch
7 Modified:
8 genpatches-2.6/trunk/3.7/4200_fbcondecor-0.9.6.patch
9 genpatches-2.6/trunk/3.8/0000_README
10 genpatches-2.6/trunk/3.8/4200_fbcondecor-0.9.6.patch
11 Log:
12 Linux patch 3.8.1. Updated fbcondecor-0.9.6 to properly work with the 3.7 and 3.8 kernel branches according to bug #459060.
13
14 Modified: genpatches-2.6/trunk/3.7/4200_fbcondecor-0.9.6.patch
15 ===================================================================
16 --- genpatches-2.6/trunk/3.7/4200_fbcondecor-0.9.6.patch 2013-02-28 20:58:06 UTC (rev 2299)
17 +++ genpatches-2.6/trunk/3.7/4200_fbcondecor-0.9.6.patch 2013-02-28 23:23:58 UTC (rev 2300)
18 @@ -228,8 +228,7 @@
19 index 95952c8..b55db6d 100644
20 --- a/drivers/Makefile
21 +++ b/drivers/Makefile
22 -@@ -11,6 +11,10 @@ obj-y += gpio/
23 - obj-$(CONFIG_PCI) += pci/
24 +@@ -16,4 +16,8 @@ obj-$(CONFIG_PCI) += pci/
25 obj-$(CONFIG_PARISC) += parisc/
26 obj-$(CONFIG_RAPIDIO) += rapidio/
27 +# tty/ comes before char/ so that the VT console is the boot-time
28 @@ -238,8 +237,7 @@
29 +obj-y += char/
30 obj-y += video/
31 obj-y += idle/
32 - obj-$(CONFIG_ACPI) += acpi/
33 -@@ -29,11 +33,6 @@ obj-$(CONFIG_XEN) += xen/
34 +@@ -37,11 +41,6 @@ obj-$(CONFIG_XEN) += xen/
35 # regulators early, since some subsystems rely on them to initialize
36 obj-$(CONFIG_REGULATOR) += regulator/
37
38 @@ -255,7 +253,7 @@
39 index a290be5..3a4ca32 100644
40 --- a/drivers/video/Kconfig
41 +++ b/drivers/video/Kconfig
42 -@@ -1241,7 +1241,6 @@ config FB_MATROX
43 +@@ -1229,7 +1229,6 @@ config FB_MATROX
44 select FB_CFB_FILLRECT
45 select FB_CFB_COPYAREA
46 select FB_CFB_IMAGEBLIT
47 @@ -870,7 +868,7 @@
48 u16 c, int is_fg)
49 {
50 int depth = fb_get_color_depth(&info->var, &info->fix);
51 -@@ -458,7 +459,7 @@ static int __init fb_console_setup(char *this_opt)
52 +@@ -465,7 +466,7 @@ static int __init fb_console_setup(char *this_opt)
53 } else
54 return 1;
55 }
56 @@ -879,7 +877,7 @@
57 if (!strncmp(options, "map:", 4)) {
58 options += 4;
59 if (*options) {
60 -@@ -483,8 +484,8 @@ static int __init fb_console_setup(char *this_opt)
61 +@@ -490,8 +491,8 @@ static int __init fb_console_setup(char *this_opt)
62 first_fb_vc = 0;
63 if (*options++ == '-')
64 last_fb_vc = simple_strtoul(options, &options, 10) - 1;
65 @@ -890,7 +888,7 @@
66
67 if (!strncmp(options, "rotate:", 7)) {
68 options += 7;
69 -@@ -545,6 +546,9 @@ static int fbcon_takeover(int show_logo)
70 +@@ -552,6 +553,9 @@ static int fbcon_takeover(int show_logo)
71 info_idx = -1;
72 } else {
73 fbcon_has_console_bind = 1;
74 @@ -900,7 +898,7 @@
75 }
76
77 return err;
78 -@@ -935,7 +939,7 @@ static const char *fbcon_startup(void)
79 +@@ -942,7 +946,7 @@ static const char *fbcon_startup(void)
80 info = registered_fb[info_idx];
81 if (!info)
82 return NULL;
83 @@ -909,7 +907,7 @@
84 owner = info->fbops->owner;
85 if (!try_module_get(owner))
86 return NULL;
87 -@@ -999,6 +1003,12 @@ static const char *fbcon_startup(void)
88 +@@ -1006,6 +1010,12 @@ static const char *fbcon_startup(void)
89 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
90 cols /= vc->vc_font.width;
91 rows /= vc->vc_font.height;
92 @@ -922,7 +920,7 @@
93 vc_resize(vc, cols, rows);
94
95 DPRINTK("mode: %s\n", info->fix.id);
96 -@@ -1028,7 +1038,7 @@ static void fbcon_init(struct vc_data *vc, int init)
97 +@@ -1035,7 +1045,7 @@ static void fbcon_init(struct vc_data *vc, int init)
98 cap = info->flags;
99
100 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
101 @@ -931,7 +929,7 @@
102 logo = 0;
103
104 if (var_to_display(p, &info->var, info))
105 -@@ -1238,6 +1248,11 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
106 +@@ -1245,6 +1255,11 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
107 if (sy < vc->vc_top && vc->vc_top == logo_lines)
108 vc->vc_top = 0;
109
110 @@ -943,7 +941,7 @@
111 /* Split blits that cross physical y_wrap boundary */
112
113 y_break = p->vrows - p->yscroll;
114 -@@ -1257,10 +1272,15 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
115 +@@ -1264,10 +1279,15 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
116 struct display *p = &fb_display[vc->vc_num];
117 struct fbcon_ops *ops = info->fbcon_par;
118
119 @@ -963,7 +961,7 @@
120 }
121
122 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
123 -@@ -1276,8 +1296,13 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
124 +@@ -1283,8 +1303,13 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
125 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
126 struct fbcon_ops *ops = info->fbcon_par;
127
128 @@ -979,7 +977,7 @@
129 }
130
131 static void fbcon_cursor(struct vc_data *vc, int mode)
132 -@@ -1387,7 +1412,7 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count)
133 +@@ -1394,7 +1419,7 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count)
134 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
135 struct fbcon_ops *ops = info->fbcon_par;
136 struct display *p = &fb_display[vc->vc_num];
137 @@ -988,7 +986,7 @@
138 p->yscroll += count;
139 if (p->yscroll >= p->vrows) /* Deal with wrap */
140 p->yscroll -= p->vrows;
141 -@@ -1406,7 +1431,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count)
142 +@@ -1413,7 +1438,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count)
143 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
144 struct fbcon_ops *ops = info->fbcon_par;
145 struct display *p = &fb_display[vc->vc_num];
146 @@ -997,7 +995,7 @@
147 p->yscroll -= count;
148 if (p->yscroll < 0) /* Deal with wrap */
149 p->yscroll += p->vrows;
150 -@@ -1473,7 +1498,7 @@ static __inline__ void ypan_down(struct vc_data *vc, int count)
151 +@@ -1480,7 +1505,7 @@ static __inline__ void ypan_down(struct vc_data *vc, int count)
152 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
153 struct display *p = &fb_display[vc->vc_num];
154 struct fbcon_ops *ops = info->fbcon_par;
155 @@ -1006,7 +1004,7 @@
156 p->yscroll -= count;
157 if (p->yscroll < 0) {
158 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows,
159 -@@ -1797,7 +1822,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
160 +@@ -1804,7 +1829,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
161 count = vc->vc_rows;
162 if (softback_top)
163 fbcon_softback_note(vc, t, count);
164 @@ -1015,7 +1013,7 @@
165 goto redraw_up;
166 switch (p->scrollmode) {
167 case SCROLL_MOVE:
168 -@@ -1890,6 +1915,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
169 +@@ -1897,6 +1922,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
170 count = vc->vc_rows;
171 if (logo_shown >= 0)
172 goto redraw_down;
173 @@ -1024,7 +1022,7 @@
174 switch (p->scrollmode) {
175 case SCROLL_MOVE:
176 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
177 -@@ -1982,7 +2009,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
178 +@@ -1989,7 +2016,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
179 {
180 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
181 struct display *p = &fb_display[vc->vc_num];
182 @@ -1033,7 +1031,7 @@
183 if (fbcon_is_inactive(vc, info))
184 return;
185
186 -@@ -2000,7 +2027,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
187 +@@ -2007,7 +2034,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
188 p->vrows - p->yscroll);
189 }
190
191 @@ -1042,7 +1040,7 @@
192 int dy, int dx, int height, int width, u_int y_break)
193 {
194 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
195 -@@ -2038,6 +2065,13 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
196 +@@ -2045,6 +2072,13 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
197 }
198 return;
199 }
200 @@ -1056,7 +1054,7 @@
201 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
202 height, width);
203 }
204 -@@ -2089,7 +2123,7 @@ static void updatescrollmode(struct display *p,
205 +@@ -2096,7 +2130,7 @@ static void updatescrollmode(struct display *p,
206 }
207 }
208
209 @@ -1065,7 +1063,7 @@
210 unsigned int height, unsigned int user)
211 {
212 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
213 -@@ -2108,8 +2142,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
214 +@@ -2115,8 +2149,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
215 var.yres = virt_h * virt_fh;
216 x_diff = info->var.xres - var.xres;
217 y_diff = info->var.yres - var.yres;
218 @@ -1076,7 +1074,7 @@
219 const struct fb_videomode *mode;
220
221 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
222 -@@ -2145,6 +2179,21 @@ static int fbcon_switch(struct vc_data *vc)
223 +@@ -2152,6 +2186,21 @@ static int fbcon_switch(struct vc_data *vc)
224
225 info = registered_fb[con2fb_map[vc->vc_num]];
226 ops = info->fbcon_par;
227 @@ -1098,7 +1096,7 @@
228
229 if (softback_top) {
230 if (softback_lines)
231 -@@ -2163,9 +2212,6 @@ static int fbcon_switch(struct vc_data *vc)
232 +@@ -2170,9 +2219,6 @@ static int fbcon_switch(struct vc_data *vc)
233 logo_shown = FBCON_LOGO_CANSHOW;
234 }
235
236 @@ -1108,7 +1106,7 @@
237 /*
238 * FIXME: If we have multiple fbdev's loaded, we need to
239 * update all info->currcon. Perhaps, we can place this
240 -@@ -2209,6 +2255,18 @@ static int fbcon_switch(struct vc_data *vc)
241 +@@ -2216,6 +2262,18 @@ static int fbcon_switch(struct vc_data *vc)
242 fbcon_del_cursor_timer(old_info);
243 }
244
245 @@ -1127,7 +1125,7 @@
246 if (fbcon_is_inactive(vc, info) ||
247 ops->blank_state != FB_BLANK_UNBLANK)
248 fbcon_del_cursor_timer(info);
249 -@@ -2257,11 +2315,10 @@ static int fbcon_switch(struct vc_data *vc)
250 +@@ -2264,11 +2322,10 @@ static int fbcon_switch(struct vc_data *vc)
251 ops->update_start(info);
252 }
253
254 @@ -1140,7 +1138,7 @@
255 logo_shown = fg_console;
256 /* This is protected above by initmem_freed */
257 fb_show_logo(info, ops->rotate);
258 -@@ -2317,15 +2374,20 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
259 +@@ -2324,15 +2381,20 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
260 }
261 }
262
263 @@ -1165,7 +1163,7 @@
264 }
265
266 if (!blank)
267 -@@ -2447,7 +2509,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
268 +@@ -2454,7 +2516,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
269 vc->vc_complement_mask >>= 1;
270 vc->vc_s_complement_mask >>= 1;
271 }
272 @@ -1174,7 +1172,7 @@
273 /* ++Edmund: reorder the attribute bits */
274 if (vc->vc_can_do_color) {
275 unsigned short *cp =
276 -@@ -2470,7 +2532,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
277 +@@ -2477,7 +2539,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
278 vc->vc_complement_mask <<= 1;
279 vc->vc_s_complement_mask <<= 1;
280 }
281 @@ -1183,7 +1181,7 @@
282 /* ++Edmund: reorder the attribute bits */
283 {
284 unsigned short *cp =
285 -@@ -2500,13 +2562,22 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
286 +@@ -2507,13 +2569,22 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
287 }
288
289 if (resize) {
290 @@ -1206,7 +1204,7 @@
291 if (CON_IS_VISIBLE(vc) && softback_buf)
292 fbcon_update_softback(vc);
293 } else if (CON_IS_VISIBLE(vc)
294 -@@ -2590,7 +2661,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
295 +@@ -2597,7 +2661,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
296 /* Check if the same font is on some other console already */
297 for (i = first_fb_vc; i <= last_fb_vc; i++) {
298 struct vc_data *tmp = vc_cons[i].d;
299 @@ -1215,7 +1213,7 @@
300 if (fb_display[i].userfont &&
301 fb_display[i].fontdata &&
302 FNTSUM(fb_display[i].fontdata) == csum &&
303 -@@ -2635,7 +2706,11 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
304 +@@ -2642,7 +2713,11 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
305 int i, j, k, depth;
306 u8 val;
307
308 @@ -1228,7 +1226,7 @@
309 return -EINVAL;
310
311 if (!CON_IS_VISIBLE(vc))
312 -@@ -2661,14 +2736,56 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
313 +@@ -2668,14 +2743,56 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
314 } else
315 fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
316
317 @@ -1287,7 +1285,7 @@
318 if (vc->vc_num != fg_console || !softback_lines)
319 return (u16 *) (vc->vc_origin + offset);
320 line = offset / vc->vc_size_row;
321 -@@ -2887,7 +3004,14 @@ static void fbcon_modechanged(struct fb_info *info)
322 +@@ -2894,7 +3011,14 @@ static void fbcon_modechanged(struct fb_info *info)
323 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
324 cols /= vc->vc_font.width;
325 rows /= vc->vc_font.height;
326 @@ -1303,7 +1301,7 @@
327 updatescrollmode(p, info, vc);
328 scrollback_max = 0;
329 scrollback_current = 0;
330 -@@ -2932,7 +3056,9 @@ static void fbcon_set_all_vcs(struct fb_info *info)
331 +@@ -2939,7 +3063,9 @@ static void fbcon_set_all_vcs(struct fb_info *info)
332 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
333 cols /= vc->vc_font.width;
334 rows /= vc->vc_font.height;
335 @@ -1314,7 +1312,7 @@
336 }
337
338 if (fg != -1)
339 -@@ -3542,6 +3668,7 @@ static void fbcon_exit(void)
340 +@@ -3549,6 +3675,7 @@ static void fbcon_exit(void)
341 }
342 }
343
344 @@ -1322,7 +1320,7 @@
345 fbcon_has_exited = 1;
346 }
347
348 -@@ -3595,7 +3722,7 @@ static void __exit fb_console_exit(void)
349 +@@ -3602,7 +3729,7 @@ static void __exit fb_console_exit(void)
350 fbcon_exit();
351 console_unlock();
352 unregister_con_driver(&fb_con);
353 @@ -2014,7 +2012,7 @@
354 index c6ce416..7ce6640 100644
355 --- a/drivers/video/fbmem.c
356 +++ b/drivers/video/fbmem.c
357 -@@ -1222,15 +1222,6 @@ struct fb_fix_screeninfo32 {
358 +@@ -1231,15 +1231,6 @@ struct fb_fix_screeninfo32 {
359 u16 reserved[3];
360 };
361
362 @@ -2107,7 +2105,7 @@
363 index d31cb68..ad161bb 100644
364 --- a/include/uapi/linux/fb.h
365 +++ b/include/uapi/linux/fb.h
366 -@@ -11,6 +11,25 @@
367 +@@ -8,6 +8,25 @@
368
369 #define FB_MAX 32 /* sufficient for now */
370
371 @@ -2133,7 +2131,7 @@
372 /* ioctls
373 0x46 is 'F' */
374 #define FBIOGET_VSCREENINFO 0x4600
375 -@@ -39,6 +58,24 @@
376 +@@ -34,6 +53,24 @@
377 #define FBIOPUT_MODEINFO 0x4617
378 #define FBIOGET_DISPINFO 0x4618
379 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
380 @@ -2158,7 +2156,7 @@
381
382 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
383 #define FB_TYPE_PLANES 1 /* Non interleaved planes */
384 -@@ -291,6 +328,28 @@ struct fb_cmap {
385 +@@ -286,6 +323,28 @@ struct fb_cmap {
386 __u16 *transp; /* transparency, can be NULL */
387 };
388
389 @@ -2187,11 +2185,7 @@
390 struct fb_con2fbmap {
391 __u32 console;
392 __u32 framebuffer;
393 -diff --git a/include/linux/fb.h b/include/linux/fb.h
394 -index d31cb68..ad161bb 100644
395 ---- a/include/linux/fb.h
396 -+++ b/include/linux/fb.h
397 -@@ -372,6 +431,34 @@ struct fb_image {
398 +@@ -367,6 +426,34 @@ struct fb_image {
399 struct fb_cmap cmap; /* color map info */
400 };
401
402 @@ -2226,8 +2220,12 @@
403 /*
404 * hardware cursor control
405 */
406 -@@ -881,6 +968,9 @@ struct fb_info {
407 - #define FBINFO_STATE_SUSPENDED 1
408 +
409 +diff --git a/include/linux/fb.h b/include/linux/fb.h
410 +index d31cb68..ad161bb 100644
411 +--- a/include/linux/fb.h
412 ++++ b/include/linux/fb.h
413 +@@ -488,5 +488,8 @@ #define FBINFO_STATE_SUSPENDED 1
414 u32 state; /* Hardware state i.e suspend */
415 void *fbcon_par; /* fbcon use-only private area */
416 +
417 @@ -2236,11 +2234,12 @@
418 /* From here on everything is device dependent */
419 void *par;
420 /* we need the PCI or similar aperture base/size not
421 +
422 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
423 index 4ab1187..6561627 100644
424 --- a/kernel/sysctl.c
425 +++ b/kernel/sysctl.c
426 -@@ -142,6 +142,10 @@ static int min_percpu_pagelist_fract = 8;
427 +@@ -145,6 +145,10 @@ static int min_percpu_pagelist_fract = 8;
428 static int ngroups_max = NGROUPS_MAX;
429 static const int cap_last_cap = CAP_LAST_CAP;
430
431 @@ -2251,7 +2250,7 @@
432 #ifdef CONFIG_INOTIFY_USER
433 #include <linux/inotify.h>
434 #endif
435 -@@ -238,6 +242,15 @@ static struct ctl_table sysctl_base_table[] = {
436 +@@ -248,6 +252,15 @@ static struct ctl_table sysctl_base_table[] = {
437 .mode = 0555,
438 .child = dev_table,
439 },
440 @@ -2267,7 +2266,7 @@
441 { }
442 };
443
444 -@@ -1038,7 +1051,7 @@ static struct ctl_table vm_table[] = {
445 +@@ -1050,7 +1063,7 @@ static struct ctl_table vm_table[] = {
446 .proc_handler = proc_dointvec,
447 },
448 {
449 @@ -2276,7 +2275,7 @@
450 .data = &page_cluster,
451 .maxlen = sizeof(int),
452 .mode = 0644,
453 -@@ -1484,7 +1497,7 @@ static struct ctl_table fs_table[] = {
454 +@@ -1494,7 +1507,7 @@ static struct ctl_table fs_table[] = {
455 .mode = 0555,
456 .child = inotify_table,
457 },
458 @@ -2285,7 +2284,7 @@
459 #ifdef CONFIG_EPOLL
460 {
461 .procname = "epoll",
462 -@@ -1802,12 +1815,12 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
463 +@@ -1832,12 +1845,12 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
464 unsigned long page = 0;
465 size_t left;
466 char *kbuf;
467 @@ -2300,7 +2299,7 @@
468 i = (int *) tbl_data;
469 vleft = table->maxlen / sizeof(*i);
470 left = *lenp;
471 -@@ -1896,7 +1909,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write,
472 +@@ -1926,7 +1939,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write,
473 * @ppos: file position
474 *
475 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
476 @@ -2309,7 +2308,7 @@
477 *
478 * Returns 0 on success.
479 */
480 -@@ -2223,7 +2236,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
481 +@@ -2285,7 +2298,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
482 * @ppos: file position
483 *
484 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
485 @@ -2318,7 +2317,7 @@
486 * The values read are assumed to be in seconds, and are converted into
487 * jiffies.
488 *
489 -@@ -2245,8 +2258,8 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
490 +@@ -2307,8 +2320,8 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
491 * @ppos: pointer to the file position
492 *
493 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
494 @@ -2329,7 +2328,7 @@
495 * are converted into jiffies.
496 *
497 * Returns 0 on success.
498 -@@ -2268,8 +2281,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
499 +@@ -2330,8 +2343,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
500 * @ppos: the current position in the file
501 *
502 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
503
504 Modified: genpatches-2.6/trunk/3.8/0000_README
505 ===================================================================
506 --- genpatches-2.6/trunk/3.8/0000_README 2013-02-28 20:58:06 UTC (rev 2299)
507 +++ genpatches-2.6/trunk/3.8/0000_README 2013-02-28 23:23:58 UTC (rev 2300)
508 @@ -39,6 +39,10 @@
509
510 Individual Patch Descriptions:
511 --------------------------------------------------------------------------
512 +Patch: 1000_linux-3.8.1.patch
513 +From: http://www.kernel.org
514 +Desc: Linux 3.8.1
515 +
516 Patch: 1700_enable-thinkpad-micled.patch
517 From: https://bugs.gentoo.org/show_bug.cgi?id=449248
518 Desc: Enable mic mute led in thinkpads
519
520 Added: genpatches-2.6/trunk/3.8/1000_linux-3.8.1.patch
521 ===================================================================
522 --- genpatches-2.6/trunk/3.8/1000_linux-3.8.1.patch (rev 0)
523 +++ genpatches-2.6/trunk/3.8/1000_linux-3.8.1.patch 2013-02-28 23:23:58 UTC (rev 2300)
524 @@ -0,0 +1,6680 @@
525 +diff --git a/Makefile b/Makefile
526 +index d69266c..746c856 100644
527 +--- a/Makefile
528 ++++ b/Makefile
529 +@@ -1,6 +1,6 @@
530 + VERSION = 3
531 + PATCHLEVEL = 8
532 +-SUBLEVEL = 0
533 ++SUBLEVEL = 1
534 + EXTRAVERSION =
535 + NAME = Unicycling Gorilla
536 +
537 +diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
538 +index 80e29c6..4801717 100644
539 +--- a/arch/arm/boot/dts/at91sam9n12.dtsi
540 ++++ b/arch/arm/boot/dts/at91sam9n12.dtsi
541 +@@ -324,8 +324,6 @@
542 + compatible = "atmel,at91sam9260-usart";
543 + reg = <0xf801c000 0x4000>;
544 + interrupts = <5 4 5>;
545 +- atmel,use-dma-rx;
546 +- atmel,use-dma-tx;
547 + pinctrl-names = "default";
548 + pinctrl-0 = <&pinctrl_usart0>;
549 + status = "disabled";
550 +@@ -335,8 +333,6 @@
551 + compatible = "atmel,at91sam9260-usart";
552 + reg = <0xf8020000 0x4000>;
553 + interrupts = <6 4 5>;
554 +- atmel,use-dma-rx;
555 +- atmel,use-dma-tx;
556 + pinctrl-names = "default";
557 + pinctrl-0 = <&pinctrl_usart1>;
558 + status = "disabled";
559 +@@ -346,8 +342,6 @@
560 + compatible = "atmel,at91sam9260-usart";
561 + reg = <0xf8024000 0x4000>;
562 + interrupts = <7 4 5>;
563 +- atmel,use-dma-rx;
564 +- atmel,use-dma-tx;
565 + pinctrl-names = "default";
566 + pinctrl-0 = <&pinctrl_usart2>;
567 + status = "disabled";
568 +@@ -357,8 +351,6 @@
569 + compatible = "atmel,at91sam9260-usart";
570 + reg = <0xf8028000 0x4000>;
571 + interrupts = <8 4 5>;
572 +- atmel,use-dma-rx;
573 +- atmel,use-dma-tx;
574 + pinctrl-names = "default";
575 + pinctrl-0 = <&pinctrl_usart3>;
576 + status = "disabled";
577 +diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
578 +index 8ecca69..c461e11 100644
579 +--- a/arch/arm/boot/dts/at91sam9x5.dtsi
580 ++++ b/arch/arm/boot/dts/at91sam9x5.dtsi
581 +@@ -402,8 +402,6 @@
582 + compatible = "atmel,at91sam9260-usart";
583 + reg = <0xf801c000 0x200>;
584 + interrupts = <5 4 5>;
585 +- atmel,use-dma-rx;
586 +- atmel,use-dma-tx;
587 + pinctrl-names = "default";
588 + pinctrl-0 = <&pinctrl_usart0>;
589 + status = "disabled";
590 +@@ -413,8 +411,6 @@
591 + compatible = "atmel,at91sam9260-usart";
592 + reg = <0xf8020000 0x200>;
593 + interrupts = <6 4 5>;
594 +- atmel,use-dma-rx;
595 +- atmel,use-dma-tx;
596 + pinctrl-names = "default";
597 + pinctrl-0 = <&pinctrl_usart1>;
598 + status = "disabled";
599 +@@ -424,8 +420,6 @@
600 + compatible = "atmel,at91sam9260-usart";
601 + reg = <0xf8024000 0x200>;
602 + interrupts = <7 4 5>;
603 +- atmel,use-dma-rx;
604 +- atmel,use-dma-tx;
605 + pinctrl-names = "default";
606 + pinctrl-0 = <&pinctrl_usart2>;
607 + status = "disabled";
608 +diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
609 +index fc6692e..bd6f56b 100644
610 +--- a/arch/arm/kernel/sched_clock.c
611 ++++ b/arch/arm/kernel/sched_clock.c
612 +@@ -93,11 +93,11 @@ static void notrace update_sched_clock(void)
613 + * detectable in cyc_to_fixed_sched_clock().
614 + */
615 + raw_local_irq_save(flags);
616 +- cd.epoch_cyc = cyc;
617 ++ cd.epoch_cyc_copy = cyc;
618 + smp_wmb();
619 + cd.epoch_ns = ns;
620 + smp_wmb();
621 +- cd.epoch_cyc_copy = cyc;
622 ++ cd.epoch_cyc = cyc;
623 + raw_local_irq_restore(flags);
624 + }
625 +
626 +diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
627 +index 2c570cd..69858c7 100644
628 +--- a/arch/arm/mach-imx/clk-imx25.c
629 ++++ b/arch/arm/mach-imx/clk-imx25.c
630 +@@ -224,6 +224,9 @@ static int __init __mx25_clocks_init(unsigned long osc_rate)
631 +
632 + clk_prepare_enable(clk[emi_ahb]);
633 +
634 ++ /* Clock source for gpt must be derived from AHB */
635 ++ clk_set_parent(clk[per5_sel], clk[ahb]);
636 ++
637 + clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
638 + clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
639 +
640 +diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
641 +index 11e2a41..26762bf 100644
642 +--- a/arch/arm/mach-integrator/integrator_ap.c
643 ++++ b/arch/arm/mach-integrator/integrator_ap.c
644 +@@ -613,7 +613,6 @@ static struct map_desc ap_io_desc_atag[] __initdata = {
645 + static void __init ap_map_io_atag(void)
646 + {
647 + iotable_init(ap_io_desc_atag, ARRAY_SIZE(ap_io_desc_atag));
648 +- ap_syscon_base = __io_address(INTEGRATOR_SC_BASE);
649 + ap_map_io();
650 + }
651 +
652 +@@ -685,6 +684,7 @@ static void __init ap_init(void)
653 +
654 + platform_device_register(&cfi_flash_device);
655 +
656 ++ ap_syscon_base = __io_address(INTEGRATOR_SC_BASE);
657 + sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
658 + for (i = 0; i < 4; i++) {
659 + struct lm_device *lmdev;
660 +diff --git a/arch/arm/mach-pxa/include/mach/smemc.h b/arch/arm/mach-pxa/include/mach/smemc.h
661 +index b7de471..b802f28 100644
662 +--- a/arch/arm/mach-pxa/include/mach/smemc.h
663 ++++ b/arch/arm/mach-pxa/include/mach/smemc.h
664 +@@ -37,6 +37,7 @@
665 + #define CSADRCFG1 (SMEMC_VIRT + 0x84) /* Address Configuration Register for CS1 */
666 + #define CSADRCFG2 (SMEMC_VIRT + 0x88) /* Address Configuration Register for CS2 */
667 + #define CSADRCFG3 (SMEMC_VIRT + 0x8C) /* Address Configuration Register for CS3 */
668 ++#define CSMSADRCFG (SMEMC_VIRT + 0xA0) /* Chip Select Configuration Register */
669 +
670 + /*
671 + * More handy macros for PCMCIA
672 +diff --git a/arch/arm/mach-pxa/smemc.c b/arch/arm/mach-pxa/smemc.c
673 +index 7992305..f38aa89 100644
674 +--- a/arch/arm/mach-pxa/smemc.c
675 ++++ b/arch/arm/mach-pxa/smemc.c
676 +@@ -40,6 +40,8 @@ static void pxa3xx_smemc_resume(void)
677 + __raw_writel(csadrcfg[1], CSADRCFG1);
678 + __raw_writel(csadrcfg[2], CSADRCFG2);
679 + __raw_writel(csadrcfg[3], CSADRCFG3);
680 ++ /* CSMSADRCFG wakes up in its default state (0), so we need to set it */
681 ++ __raw_writel(0x2, CSMSADRCFG);
682 + }
683 +
684 + static struct syscore_ops smemc_syscore_ops = {
685 +@@ -49,8 +51,19 @@ static struct syscore_ops smemc_syscore_ops = {
686 +
687 + static int __init smemc_init(void)
688 + {
689 +- if (cpu_is_pxa3xx())
690 ++ if (cpu_is_pxa3xx()) {
691 ++ /*
692 ++ * The only documentation we have on the
693 ++ * Chip Select Configuration Register (CSMSADRCFG) is that
694 ++ * it must be programmed to 0x2.
695 ++ * Moreover, in the bit definitions, the second bit
696 ++ * (CSMSADRCFG[1]) is called "SETALWAYS".
697 ++ * Other bits are reserved in this register.
698 ++ */
699 ++ __raw_writel(0x2, CSMSADRCFG);
700 ++
701 + register_syscore_ops(&smemc_syscore_ops);
702 ++ }
703 +
704 + return 0;
705 + }
706 +diff --git a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
707 +index 4135de8..13ed33c 100644
708 +--- a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
709 ++++ b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
710 +@@ -40,17 +40,17 @@
711 + addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
712 + addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
713 + bic \rd, \rd, #0xff000
714 +- ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
715 ++ ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)]
716 + and \rd, \rd, #0x00ff0000
717 + teq \rd, #0x00440000 @ is it 2440?
718 + 1004:
719 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
720 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
721 + moveq \rd, \rd, lsr #SHIFT_2440TXF
722 + tst \rd, #S3C2410_UFSTAT_TXFULL
723 + .endm
724 +
725 + .macro fifo_full_s3c2410 rd, rx
726 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
727 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
728 + tst \rd, #S3C2410_UFSTAT_TXFULL
729 + .endm
730 +
731 +@@ -68,18 +68,18 @@
732 + addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
733 + addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
734 + bic \rd, \rd, #0xff000
735 +- ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
736 ++ ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)]
737 + and \rd, \rd, #0x00ff0000
738 + teq \rd, #0x00440000 @ is it 2440?
739 +
740 + 10000:
741 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
742 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
743 + andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
744 + andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
745 + .endm
746 +
747 + .macro fifo_level_s3c2410 rd, rx
748 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
749 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
750 + and \rd, \rd, #S3C2410_UFSTAT_TXMASK
751 + .endm
752 +
753 +diff --git a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
754 +index 7615a14..6a21bee 100644
755 +--- a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
756 ++++ b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
757 +@@ -31,10 +31,10 @@
758 +
759 + @@ try the interrupt offset register, since it is there
760 +
761 +- ldr \irqstat, [ \base, #INTPND ]
762 ++ ldr \irqstat, [\base, #INTPND ]
763 + teq \irqstat, #0
764 + beq 1002f
765 +- ldr \irqnr, [ \base, #INTOFFSET ]
766 ++ ldr \irqnr, [\base, #INTOFFSET ]
767 + mov \tmp, #1
768 + tst \irqstat, \tmp, lsl \irqnr
769 + bne 1001f
770 +diff --git a/arch/arm/mach-s3c24xx/pm-h1940.S b/arch/arm/mach-s3c24xx/pm-h1940.S
771 +index c93bf2d..6183a68 100644
772 +--- a/arch/arm/mach-s3c24xx/pm-h1940.S
773 ++++ b/arch/arm/mach-s3c24xx/pm-h1940.S
774 +@@ -30,4 +30,4 @@
775 +
776 + h1940_pm_return:
777 + mov r0, #S3C2410_PA_GPIO
778 +- ldr pc, [ r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO ]
779 ++ ldr pc, [r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO]
780 +diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2410.S b/arch/arm/mach-s3c24xx/sleep-s3c2410.S
781 +index dd5b638..65200ae 100644
782 +--- a/arch/arm/mach-s3c24xx/sleep-s3c2410.S
783 ++++ b/arch/arm/mach-s3c24xx/sleep-s3c2410.S
784 +@@ -45,9 +45,9 @@ ENTRY(s3c2410_cpu_suspend)
785 + ldr r4, =S3C2410_REFRESH
786 + ldr r5, =S3C24XX_MISCCR
787 + ldr r6, =S3C2410_CLKCON
788 +- ldr r7, [ r4 ] @ get REFRESH (and ensure in TLB)
789 +- ldr r8, [ r5 ] @ get MISCCR (and ensure in TLB)
790 +- ldr r9, [ r6 ] @ get CLKCON (and ensure in TLB)
791 ++ ldr r7, [r4] @ get REFRESH (and ensure in TLB)
792 ++ ldr r8, [r5] @ get MISCCR (and ensure in TLB)
793 ++ ldr r9, [r6] @ get CLKCON (and ensure in TLB)
794 +
795 + orr r7, r7, #S3C2410_REFRESH_SELF @ SDRAM sleep command
796 + orr r8, r8, #S3C2410_MISCCR_SDSLEEP @ SDRAM power-down signals
797 +@@ -61,8 +61,8 @@ ENTRY(s3c2410_cpu_suspend)
798 + @@ align next bit of code to cache line
799 + .align 5
800 + s3c2410_do_sleep:
801 +- streq r7, [ r4 ] @ SDRAM sleep command
802 +- streq r8, [ r5 ] @ SDRAM power-down config
803 +- streq r9, [ r6 ] @ CPU sleep
804 ++ streq r7, [r4] @ SDRAM sleep command
805 ++ streq r8, [r5] @ SDRAM power-down config
806 ++ streq r9, [r6] @ CPU sleep
807 + 1: beq 1b
808 + mov pc, r14
809 +diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2412.S b/arch/arm/mach-s3c24xx/sleep-s3c2412.S
810 +index c82418e..5adaceb 100644
811 +--- a/arch/arm/mach-s3c24xx/sleep-s3c2412.S
812 ++++ b/arch/arm/mach-s3c24xx/sleep-s3c2412.S
813 +@@ -57,12 +57,12 @@ s3c2412_sleep_enter1:
814 + * retry, as simply returning causes the system to lock.
815 + */
816 +
817 +- ldrne r9, [ r1 ]
818 +- strne r9, [ r1 ]
819 +- ldrne r9, [ r2 ]
820 +- strne r9, [ r2 ]
821 +- ldrne r9, [ r3 ]
822 +- strne r9, [ r3 ]
823 ++ ldrne r9, [r1]
824 ++ strne r9, [r1]
825 ++ ldrne r9, [r2]
826 ++ strne r9, [r2]
827 ++ ldrne r9, [r3]
828 ++ strne r9, [r3]
829 + bne s3c2412_sleep_enter1
830 +
831 + mov pc, r14
832 +diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
833 +index 5d59294..a78827b 100644
834 +--- a/arch/arm/mach-versatile/core.c
835 ++++ b/arch/arm/mach-versatile/core.c
836 +@@ -36,6 +36,7 @@
837 + #include <linux/gfp.h>
838 + #include <linux/clkdev.h>
839 + #include <linux/mtd/physmap.h>
840 ++#include <linux/bitops.h>
841 +
842 + #include <asm/irq.h>
843 + #include <asm/hardware/arm_timer.h>
844 +@@ -65,16 +66,28 @@
845 + #define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE)
846 + #define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE)
847 +
848 ++/* These PIC IRQs are valid in each configuration */
849 ++#define PIC_VALID_ALL BIT(SIC_INT_KMI0) | BIT(SIC_INT_KMI1) | \
850 ++ BIT(SIC_INT_SCI3) | BIT(SIC_INT_UART3) | \
851 ++ BIT(SIC_INT_CLCD) | BIT(SIC_INT_TOUCH) | \
852 ++ BIT(SIC_INT_KEYPAD) | BIT(SIC_INT_DoC) | \
853 ++ BIT(SIC_INT_USB) | BIT(SIC_INT_PCI0) | \
854 ++ BIT(SIC_INT_PCI1) | BIT(SIC_INT_PCI2) | \
855 ++ BIT(SIC_INT_PCI3)
856 + #if 1
857 + #define IRQ_MMCI0A IRQ_VICSOURCE22
858 + #define IRQ_AACI IRQ_VICSOURCE24
859 + #define IRQ_ETH IRQ_VICSOURCE25
860 + #define PIC_MASK 0xFFD00000
861 ++#define PIC_VALID PIC_VALID_ALL
862 + #else
863 + #define IRQ_MMCI0A IRQ_SIC_MMCI0A
864 + #define IRQ_AACI IRQ_SIC_AACI
865 + #define IRQ_ETH IRQ_SIC_ETH
866 + #define PIC_MASK 0
867 ++#define PIC_VALID PIC_VALID_ALL | BIT(SIC_INT_MMCI0A) | \
868 ++ BIT(SIC_INT_MMCI1A) | BIT(SIC_INT_AACI) | \
869 ++ BIT(SIC_INT_ETH)
870 + #endif
871 +
872 + /* Lookup table for finding a DT node that represents the vic instance */
873 +@@ -102,7 +115,7 @@ void __init versatile_init_irq(void)
874 + VERSATILE_SIC_BASE);
875 +
876 + fpga_irq_init(VA_SIC_BASE, "SIC", IRQ_SIC_START,
877 +- IRQ_VICSOURCE31, ~PIC_MASK, np);
878 ++ IRQ_VICSOURCE31, PIC_VALID, np);
879 +
880 + /*
881 + * Interrupts on secondary controller from 0 to 8 are routed to
882 +diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
883 +index 2f84f40..e92e5e0 100644
884 +--- a/arch/arm/mach-versatile/pci.c
885 ++++ b/arch/arm/mach-versatile/pci.c
886 +@@ -23,6 +23,7 @@
887 + #include <linux/io.h>
888 +
889 + #include <mach/hardware.h>
890 ++#include <mach/irqs.h>
891 + #include <asm/irq.h>
892 + #include <asm/mach/pci.h>
893 +
894 +@@ -327,12 +328,12 @@ static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
895 + int irq;
896 +
897 + /* slot, pin, irq
898 +- * 24 1 27
899 +- * 25 1 28
900 +- * 26 1 29
901 +- * 27 1 30
902 ++ * 24 1 IRQ_SIC_PCI0
903 ++ * 25 1 IRQ_SIC_PCI1
904 ++ * 26 1 IRQ_SIC_PCI2
905 ++ * 27 1 IRQ_SIC_PCI3
906 + */
907 +- irq = 27 + ((slot - 24 + pin - 1) & 3);
908 ++ irq = IRQ_SIC_PCI0 + ((slot - 24 + pin - 1) & 3);
909 +
910 + return irq;
911 + }
912 +diff --git a/arch/arm/plat-samsung/include/plat/debug-macro.S b/arch/arm/plat-samsung/include/plat/debug-macro.S
913 +index 207e275..f3a9cff 100644
914 +--- a/arch/arm/plat-samsung/include/plat/debug-macro.S
915 ++++ b/arch/arm/plat-samsung/include/plat/debug-macro.S
916 +@@ -14,12 +14,12 @@
917 + /* The S5PV210/S5PC110 implementations are as belows. */
918 +
919 + .macro fifo_level_s5pv210 rd, rx
920 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
921 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
922 + and \rd, \rd, #S5PV210_UFSTAT_TXMASK
923 + .endm
924 +
925 + .macro fifo_full_s5pv210 rd, rx
926 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
927 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
928 + tst \rd, #S5PV210_UFSTAT_TXFULL
929 + .endm
930 +
931 +@@ -27,7 +27,7 @@
932 + * most widely re-used */
933 +
934 + .macro fifo_level_s3c2440 rd, rx
935 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
936 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
937 + and \rd, \rd, #S3C2440_UFSTAT_TXMASK
938 + .endm
939 +
940 +@@ -36,7 +36,7 @@
941 + #endif
942 +
943 + .macro fifo_full_s3c2440 rd, rx
944 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
945 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
946 + tst \rd, #S3C2440_UFSTAT_TXFULL
947 + .endm
948 +
949 +@@ -45,11 +45,11 @@
950 + #endif
951 +
952 + .macro senduart,rd,rx
953 +- strb \rd, [\rx, # S3C2410_UTXH ]
954 ++ strb \rd, [\rx, # S3C2410_UTXH]
955 + .endm
956 +
957 + .macro busyuart, rd, rx
958 +- ldr \rd, [ \rx, # S3C2410_UFCON ]
959 ++ ldr \rd, [\rx, # S3C2410_UFCON]
960 + tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
961 + beq 1001f @
962 + @ FIFO enabled...
963 +@@ -60,7 +60,7 @@
964 +
965 + 1001:
966 + @ busy waiting for non fifo
967 +- ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
968 ++ ldr \rd, [\rx, # S3C2410_UTRSTAT]
969 + tst \rd, #S3C2410_UTRSTAT_TXFE
970 + beq 1001b
971 +
972 +@@ -68,7 +68,7 @@
973 + .endm
974 +
975 + .macro waituart,rd,rx
976 +- ldr \rd, [ \rx, # S3C2410_UFCON ]
977 ++ ldr \rd, [\rx, # S3C2410_UFCON]
978 + tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
979 + beq 1001f @
980 + @ FIFO enabled...
981 +@@ -79,7 +79,7 @@
982 + b 1002f
983 + 1001:
984 + @ idle waiting for non fifo
985 +- ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
986 ++ ldr \rd, [\rx, # S3C2410_UTRSTAT]
987 + tst \rd, #S3C2410_UTRSTAT_TXFE
988 + beq 1001b
989 +
990 +diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
991 +index a4db3d2..41db148 100644
992 +--- a/arch/arm64/kernel/signal32.c
993 ++++ b/arch/arm64/kernel/signal32.c
994 +@@ -76,7 +76,7 @@ struct compat_sigcontext {
995 +
996 + struct compat_ucontext {
997 + compat_ulong_t uc_flags;
998 +- struct compat_ucontext *uc_link;
999 ++ compat_uptr_t uc_link;
1000 + compat_stack_t uc_stack;
1001 + struct compat_sigcontext uc_mcontext;
1002 + compat_sigset_t uc_sigmask;
1003 +@@ -703,7 +703,7 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
1004 + err |= copy_siginfo_to_user32(&frame->info, info);
1005 +
1006 + __put_user_error(0, &frame->sig.uc.uc_flags, err);
1007 +- __put_user_error(NULL, &frame->sig.uc.uc_link, err);
1008 ++ __put_user_error(0, &frame->sig.uc.uc_link, err);
1009 +
1010 + memset(&stack, 0, sizeof(stack));
1011 + stack.ss_sp = (compat_uptr_t)current->sas_ss_sp;
1012 +diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
1013 +index ee99f23..7df49fa 100644
1014 +--- a/arch/parisc/include/asm/pgtable.h
1015 ++++ b/arch/parisc/include/asm/pgtable.h
1016 +@@ -12,11 +12,10 @@
1017 +
1018 + #include <linux/bitops.h>
1019 + #include <linux/spinlock.h>
1020 ++#include <linux/mm_types.h>
1021 + #include <asm/processor.h>
1022 + #include <asm/cache.h>
1023 +
1024 +-struct vm_area_struct;
1025 +-
1026 + /*
1027 + * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
1028 + * memory. For the return value to be meaningful, ADDR must be >=
1029 +@@ -40,7 +39,14 @@ struct vm_area_struct;
1030 + do{ \
1031 + *(pteptr) = (pteval); \
1032 + } while(0)
1033 +-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
1034 ++
1035 ++extern void purge_tlb_entries(struct mm_struct *, unsigned long);
1036 ++
1037 ++#define set_pte_at(mm, addr, ptep, pteval) \
1038 ++ do { \
1039 ++ set_pte(ptep, pteval); \
1040 ++ purge_tlb_entries(mm, addr); \
1041 ++ } while (0)
1042 +
1043 + #endif /* !__ASSEMBLY__ */
1044 +
1045 +@@ -466,6 +472,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
1046 + old = pte_val(*ptep);
1047 + new = pte_val(pte_wrprotect(__pte (old)));
1048 + } while (cmpxchg((unsigned long *) ptep, old, new) != old);
1049 ++ purge_tlb_entries(mm, addr);
1050 + #else
1051 + pte_t old_pte = *ptep;
1052 + set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
1053 +diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
1054 +index 48e16dc..b89a85a 100644
1055 +--- a/arch/parisc/kernel/cache.c
1056 ++++ b/arch/parisc/kernel/cache.c
1057 +@@ -419,6 +419,24 @@ void kunmap_parisc(void *addr)
1058 + EXPORT_SYMBOL(kunmap_parisc);
1059 + #endif
1060 +
1061 ++void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
1062 ++{
1063 ++ unsigned long flags;
1064 ++
1065 ++ /* Note: purge_tlb_entries can be called at startup with
1066 ++ no context. */
1067 ++
1068 ++ /* Disable preemption while we play with %sr1. */
1069 ++ preempt_disable();
1070 ++ mtsp(mm->context, 1);
1071 ++ purge_tlb_start(flags);
1072 ++ pdtlb(addr);
1073 ++ pitlb(addr);
1074 ++ purge_tlb_end(flags);
1075 ++ preempt_enable();
1076 ++}
1077 ++EXPORT_SYMBOL(purge_tlb_entries);
1078 ++
1079 + void __flush_tlb_range(unsigned long sid, unsigned long start,
1080 + unsigned long end)
1081 + {
1082 +diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
1083 +index 17903f1..dabe429 100644
1084 +--- a/arch/powerpc/Kconfig
1085 ++++ b/arch/powerpc/Kconfig
1086 +@@ -275,6 +275,10 @@ config PPC_ADV_DEBUG_DAC_RANGE
1087 + depends on PPC_ADV_DEBUG_REGS && 44x
1088 + default y
1089 +
1090 ++config PPC_EMULATE_SSTEP
1091 ++ bool
1092 ++ default y if KPROBES || UPROBES || XMON || HAVE_HW_BREAKPOINT
1093 ++
1094 + source "init/Kconfig"
1095 +
1096 + source "kernel/Kconfig.freezer"
1097 +diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
1098 +index a8fb03e..a80e32b 100644
1099 +--- a/arch/powerpc/include/asm/eeh.h
1100 ++++ b/arch/powerpc/include/asm/eeh.h
1101 +@@ -201,6 +201,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev);
1102 + void __init eeh_addr_cache_build(void);
1103 + void eeh_add_device_tree_early(struct device_node *);
1104 + void eeh_add_device_tree_late(struct pci_bus *);
1105 ++void eeh_add_sysfs_files(struct pci_bus *);
1106 + void eeh_remove_bus_device(struct pci_dev *, int);
1107 +
1108 + /**
1109 +@@ -240,6 +241,8 @@ static inline void eeh_add_device_tree_early(struct device_node *dn) { }
1110 +
1111 + static inline void eeh_add_device_tree_late(struct pci_bus *bus) { }
1112 +
1113 ++static inline void eeh_add_sysfs_files(struct pci_bus *bus) { }
1114 ++
1115 + static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { }
1116 +
1117 + static inline void eeh_lock(void) { }
1118 +diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
1119 +index 7206701..466a290 100644
1120 +--- a/arch/powerpc/kernel/machine_kexec_64.c
1121 ++++ b/arch/powerpc/kernel/machine_kexec_64.c
1122 +@@ -162,6 +162,8 @@ static int kexec_all_irq_disabled = 0;
1123 + static void kexec_smp_down(void *arg)
1124 + {
1125 + local_irq_disable();
1126 ++ hard_irq_disable();
1127 ++
1128 + mb(); /* make sure our irqs are disabled before we say they are */
1129 + get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
1130 + while(kexec_all_irq_disabled == 0)
1131 +@@ -244,6 +246,8 @@ static void kexec_prepare_cpus(void)
1132 + wake_offline_cpus();
1133 + smp_call_function(kexec_smp_down, NULL, /* wait */0);
1134 + local_irq_disable();
1135 ++ hard_irq_disable();
1136 ++
1137 + mb(); /* make sure IRQs are disabled before we say they are */
1138 + get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
1139 +
1140 +@@ -281,6 +285,7 @@ static void kexec_prepare_cpus(void)
1141 + if (ppc_md.kexec_cpu_down)
1142 + ppc_md.kexec_cpu_down(0, 0);
1143 + local_irq_disable();
1144 ++ hard_irq_disable();
1145 + }
1146 +
1147 + #endif /* SMP */
1148 +diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
1149 +index 07c1269..e51c89f 100644
1150 +--- a/arch/powerpc/kernel/of_platform.c
1151 ++++ b/arch/powerpc/kernel/of_platform.c
1152 +@@ -95,6 +95,9 @@ static int of_pci_phb_probe(struct platform_device *dev)
1153 + /* Add probed PCI devices to the device model */
1154 + pci_bus_add_devices(phb->bus);
1155 +
1156 ++ /* sysfs files should only be added after devices are added */
1157 ++ eeh_add_sysfs_files(phb->bus);
1158 ++
1159 + return 0;
1160 + }
1161 +
1162 +diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
1163 +index 7c37379..fa12ae4 100644
1164 +--- a/arch/powerpc/kernel/pci-common.c
1165 ++++ b/arch/powerpc/kernel/pci-common.c
1166 +@@ -1477,11 +1477,14 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus)
1167 + pcibios_allocate_bus_resources(bus);
1168 + pcibios_claim_one_bus(bus);
1169 +
1170 ++ /* Fixup EEH */
1171 ++ eeh_add_device_tree_late(bus);
1172 ++
1173 + /* Add new devices to global lists. Register in proc, sysfs. */
1174 + pci_bus_add_devices(bus);
1175 +
1176 +- /* Fixup EEH */
1177 +- eeh_add_device_tree_late(bus);
1178 ++ /* sysfs files should only be added after devices are added */
1179 ++ eeh_add_sysfs_files(bus);
1180 + }
1181 + EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
1182 +
1183 +diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
1184 +index 746e0c8..35baad9 100644
1185 +--- a/arch/powerpc/lib/Makefile
1186 ++++ b/arch/powerpc/lib/Makefile
1187 +@@ -19,9 +19,7 @@ obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
1188 + checksum_wrappers_64.o hweight_64.o \
1189 + copyuser_power7.o string_64.o copypage_power7.o \
1190 + memcpy_power7.o
1191 +-obj-$(CONFIG_XMON) += sstep.o ldstfp.o
1192 +-obj-$(CONFIG_KPROBES) += sstep.o ldstfp.o
1193 +-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += sstep.o ldstfp.o
1194 ++obj-$(CONFIG_PPC_EMULATE_SSTEP) += sstep.o ldstfp.o
1195 +
1196 + ifeq ($(CONFIG_PPC64),y)
1197 + obj-$(CONFIG_SMP) += locks.o
1198 +diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
1199 +index 9a04322..6b73d6c 100644
1200 +--- a/arch/powerpc/platforms/pseries/eeh.c
1201 ++++ b/arch/powerpc/platforms/pseries/eeh.c
1202 +@@ -788,7 +788,6 @@ static void eeh_add_device_late(struct pci_dev *dev)
1203 + dev->dev.archdata.edev = edev;
1204 +
1205 + eeh_addr_cache_insert_dev(dev);
1206 +- eeh_sysfs_add_device(dev);
1207 + }
1208 +
1209 + /**
1210 +@@ -815,6 +814,29 @@ void eeh_add_device_tree_late(struct pci_bus *bus)
1211 + EXPORT_SYMBOL_GPL(eeh_add_device_tree_late);
1212 +
1213 + /**
1214 ++ * eeh_add_sysfs_files - Add EEH sysfs files for the indicated PCI bus
1215 ++ * @bus: PCI bus
1216 ++ *
1217 ++ * This routine must be used to add EEH sysfs files for PCI
1218 ++ * devices which are attached to the indicated PCI bus. The PCI bus
1219 ++ * is added after system boot through hotplug or dlpar.
1220 ++ */
1221 ++void eeh_add_sysfs_files(struct pci_bus *bus)
1222 ++{
1223 ++ struct pci_dev *dev;
1224 ++
1225 ++ list_for_each_entry(dev, &bus->devices, bus_list) {
1226 ++ eeh_sysfs_add_device(dev);
1227 ++ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
1228 ++ struct pci_bus *subbus = dev->subordinate;
1229 ++ if (subbus)
1230 ++ eeh_add_sysfs_files(subbus);
1231 ++ }
1232 ++ }
1233 ++}
1234 ++EXPORT_SYMBOL_GPL(eeh_add_sysfs_files);
1235 ++
1236 ++/**
1237 + * eeh_remove_device - Undo EEH setup for the indicated pci device
1238 + * @dev: pci device to be removed
1239 + * @purge_pe: remove the PE or not
1240 +diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
1241 +index f090e81..8bafa4f 100644
1242 +--- a/arch/s390/kvm/kvm-s390.c
1243 ++++ b/arch/s390/kvm/kvm-s390.c
1244 +@@ -766,6 +766,14 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
1245 + } else
1246 + prefix = 0;
1247 +
1248 ++ /*
1249 ++ * The guest FPRS and ACRS are in the host FPRS/ACRS due to the lazy
1250 ++ * copying in vcpu load/put. Lets update our copies before we save
1251 ++ * it into the save area
1252 ++ */
1253 ++ save_fp_regs(&vcpu->arch.guest_fpregs);
1254 ++ save_access_regs(vcpu->run->s.regs.acrs);
1255 ++
1256 + if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs),
1257 + vcpu->arch.guest_fpregs.fprs, 128, prefix))
1258 + return -EFAULT;
1259 +diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h
1260 +index 9661e9b..7eb57d2 100644
1261 +--- a/arch/sparc/include/asm/hugetlb.h
1262 ++++ b/arch/sparc/include/asm/hugetlb.h
1263 +@@ -12,7 +12,6 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
1264 +
1265 + static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
1266 + {
1267 +- hugetlb_setup(mm);
1268 + }
1269 +
1270 + static inline int is_hugepage_only_range(struct mm_struct *mm,
1271 +diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h
1272 +index 4b39f74..e155388 100644
1273 +--- a/arch/sparc/include/asm/page_64.h
1274 ++++ b/arch/sparc/include/asm/page_64.h
1275 +@@ -27,8 +27,8 @@
1276 + #ifndef __ASSEMBLY__
1277 +
1278 + #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
1279 +-struct mm_struct;
1280 +-extern void hugetlb_setup(struct mm_struct *mm);
1281 ++struct pt_regs;
1282 ++extern void hugetlb_setup(struct pt_regs *regs);
1283 + #endif
1284 +
1285 + #define WANT_PAGE_VIRTUAL
1286 +diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
1287 +index b4c258d..e696432 100644
1288 +--- a/arch/sparc/include/asm/tsb.h
1289 ++++ b/arch/sparc/include/asm/tsb.h
1290 +@@ -157,17 +157,26 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
1291 + andn REG2, 0x7, REG2; \
1292 + add REG1, REG2, REG1;
1293 +
1294 +- /* This macro exists only to make the PMD translator below easier
1295 +- * to read. It hides the ELF section switch for the sun4v code
1296 +- * patching.
1297 ++ /* These macros exists only to make the PMD translator below
1298 ++ * easier to read. It hides the ELF section switch for the
1299 ++ * sun4v code patching.
1300 + */
1301 +-#define OR_PTE_BIT(REG, NAME) \
1302 ++#define OR_PTE_BIT_1INSN(REG, NAME) \
1303 + 661: or REG, _PAGE_##NAME##_4U, REG; \
1304 + .section .sun4v_1insn_patch, "ax"; \
1305 + .word 661b; \
1306 + or REG, _PAGE_##NAME##_4V, REG; \
1307 + .previous;
1308 +
1309 ++#define OR_PTE_BIT_2INSN(REG, TMP, NAME) \
1310 ++661: sethi %hi(_PAGE_##NAME##_4U), TMP; \
1311 ++ or REG, TMP, REG; \
1312 ++ .section .sun4v_2insn_patch, "ax"; \
1313 ++ .word 661b; \
1314 ++ mov -1, TMP; \
1315 ++ or REG, _PAGE_##NAME##_4V, REG; \
1316 ++ .previous;
1317 ++
1318 + /* Load into REG the PTE value for VALID, CACHE, and SZHUGE. */
1319 + #define BUILD_PTE_VALID_SZHUGE_CACHE(REG) \
1320 + 661: sethi %uhi(_PAGE_VALID|_PAGE_SZHUGE_4U), REG; \
1321 +@@ -214,12 +223,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
1322 + andn REG1, PMD_HUGE_PROTBITS, REG2; \
1323 + sllx REG2, PMD_PADDR_SHIFT, REG2; \
1324 + /* REG2 now holds PFN << PAGE_SHIFT */ \
1325 +- andcc REG1, PMD_HUGE_EXEC, %g0; \
1326 +- bne,a,pt %xcc, 1f; \
1327 +- OR_PTE_BIT(REG2, EXEC); \
1328 +-1: andcc REG1, PMD_HUGE_WRITE, %g0; \
1329 ++ andcc REG1, PMD_HUGE_WRITE, %g0; \
1330 + bne,a,pt %xcc, 1f; \
1331 +- OR_PTE_BIT(REG2, W); \
1332 ++ OR_PTE_BIT_1INSN(REG2, W); \
1333 ++1: andcc REG1, PMD_HUGE_EXEC, %g0; \
1334 ++ be,pt %xcc, 1f; \
1335 ++ nop; \
1336 ++ OR_PTE_BIT_2INSN(REG2, REG1, EXEC); \
1337 + /* REG1 can now be clobbered, build final PTE */ \
1338 + 1: BUILD_PTE_VALID_SZHUGE_CACHE(REG1); \
1339 + ba,pt %xcc, PTE_LABEL; \
1340 +diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S
1341 +index d4bdc7a..a313e4a 100644
1342 +--- a/arch/sparc/kernel/tsb.S
1343 ++++ b/arch/sparc/kernel/tsb.S
1344 +@@ -136,12 +136,43 @@ tsb_miss_page_table_walk_sun4v_fastpath:
1345 + nop
1346 +
1347 + /* It is a huge page, use huge page TSB entry address we
1348 +- * calculated above.
1349 ++ * calculated above. If the huge page TSB has not been
1350 ++ * allocated, setup a trap stack and call hugetlb_setup()
1351 ++ * to do so, then return from the trap to replay the TLB
1352 ++ * miss.
1353 ++ *
1354 ++ * This is necessary to handle the case of transparent huge
1355 ++ * pages where we don't really have a non-atomic context
1356 ++ * in which to allocate the hugepage TSB hash table. When
1357 ++ * the 'mm' faults in the hugepage for the first time, we
1358 ++ * thus handle it here. This also makes sure that we can
1359 ++ * allocate the TSB hash table on the correct NUMA node.
1360 + */
1361 + TRAP_LOAD_TRAP_BLOCK(%g7, %g2)
1362 +- ldx [%g7 + TRAP_PER_CPU_TSB_HUGE_TEMP], %g2
1363 +- cmp %g2, -1
1364 +- movne %xcc, %g2, %g1
1365 ++ ldx [%g7 + TRAP_PER_CPU_TSB_HUGE_TEMP], %g1
1366 ++ cmp %g1, -1
1367 ++ bne,pt %xcc, 60f
1368 ++ nop
1369 ++
1370 ++661: rdpr %pstate, %g5
1371 ++ wrpr %g5, PSTATE_AG | PSTATE_MG, %pstate
1372 ++ .section .sun4v_2insn_patch, "ax"
1373 ++ .word 661b
1374 ++ SET_GL(1)
1375 ++ nop
1376 ++ .previous
1377 ++
1378 ++ rdpr %tl, %g3
1379 ++ cmp %g3, 1
1380 ++ bne,pn %xcc, winfix_trampoline
1381 ++ nop
1382 ++ ba,pt %xcc, etrap
1383 ++ rd %pc, %g7
1384 ++ call hugetlb_setup
1385 ++ add %sp, PTREGS_OFF, %o0
1386 ++ ba,pt %xcc, rtrap
1387 ++ nop
1388 ++
1389 + 60:
1390 + #endif
1391 +
1392 +diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
1393 +index 097aee7..5062ff3 100644
1394 +--- a/arch/sparc/mm/fault_64.c
1395 ++++ b/arch/sparc/mm/fault_64.c
1396 +@@ -472,8 +472,13 @@ good_area:
1397 + #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
1398 + mm_rss = mm->context.huge_pte_count;
1399 + if (unlikely(mm_rss >
1400 +- mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit))
1401 +- tsb_grow(mm, MM_TSB_HUGE, mm_rss);
1402 ++ mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit)) {
1403 ++ if (mm->context.tsb_block[MM_TSB_HUGE].tsb)
1404 ++ tsb_grow(mm, MM_TSB_HUGE, mm_rss);
1405 ++ else
1406 ++ hugetlb_setup(regs);
1407 ++
1408 ++ }
1409 + #endif
1410 + return;
1411 +
1412 +diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
1413 +index c3b7242..82bbf04 100644
1414 +--- a/arch/sparc/mm/init_64.c
1415 ++++ b/arch/sparc/mm/init_64.c
1416 +@@ -314,16 +314,31 @@ static void __update_mmu_tsb_insert(struct mm_struct *mm, unsigned long tsb_inde
1417 + struct tsb *tsb = mm->context.tsb_block[tsb_index].tsb;
1418 + unsigned long tag;
1419 +
1420 ++ if (unlikely(!tsb))
1421 ++ return;
1422 ++
1423 + tsb += ((address >> tsb_hash_shift) &
1424 + (mm->context.tsb_block[tsb_index].tsb_nentries - 1UL));
1425 + tag = (address >> 22UL);
1426 + tsb_insert(tsb, tag, tte);
1427 + }
1428 +
1429 ++#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
1430 ++static inline bool is_hugetlb_pte(pte_t pte)
1431 ++{
1432 ++ if ((tlb_type == hypervisor &&
1433 ++ (pte_val(pte) & _PAGE_SZALL_4V) == _PAGE_SZHUGE_4V) ||
1434 ++ (tlb_type != hypervisor &&
1435 ++ (pte_val(pte) & _PAGE_SZALL_4U) == _PAGE_SZHUGE_4U))
1436 ++ return true;
1437 ++ return false;
1438 ++}
1439 ++#endif
1440 ++
1441 + void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
1442 + {
1443 +- unsigned long tsb_index, tsb_hash_shift, flags;
1444 + struct mm_struct *mm;
1445 ++ unsigned long flags;
1446 + pte_t pte = *ptep;
1447 +
1448 + if (tlb_type != hypervisor) {
1449 +@@ -335,25 +350,16 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *
1450 +
1451 + mm = vma->vm_mm;
1452 +
1453 +- tsb_index = MM_TSB_BASE;
1454 +- tsb_hash_shift = PAGE_SHIFT;
1455 +-
1456 + spin_lock_irqsave(&mm->context.lock, flags);
1457 +
1458 + #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
1459 +- if (mm->context.tsb_block[MM_TSB_HUGE].tsb != NULL) {
1460 +- if ((tlb_type == hypervisor &&
1461 +- (pte_val(pte) & _PAGE_SZALL_4V) == _PAGE_SZHUGE_4V) ||
1462 +- (tlb_type != hypervisor &&
1463 +- (pte_val(pte) & _PAGE_SZALL_4U) == _PAGE_SZHUGE_4U)) {
1464 +- tsb_index = MM_TSB_HUGE;
1465 +- tsb_hash_shift = HPAGE_SHIFT;
1466 +- }
1467 +- }
1468 ++ if (mm->context.huge_pte_count && is_hugetlb_pte(pte))
1469 ++ __update_mmu_tsb_insert(mm, MM_TSB_HUGE, HPAGE_SHIFT,
1470 ++ address, pte_val(pte));
1471 ++ else
1472 + #endif
1473 +-
1474 +- __update_mmu_tsb_insert(mm, tsb_index, tsb_hash_shift,
1475 +- address, pte_val(pte));
1476 ++ __update_mmu_tsb_insert(mm, MM_TSB_BASE, PAGE_SHIFT,
1477 ++ address, pte_val(pte));
1478 +
1479 + spin_unlock_irqrestore(&mm->context.lock, flags);
1480 + }
1481 +@@ -2712,14 +2718,28 @@ static void context_reload(void *__data)
1482 + load_secondary_context(mm);
1483 + }
1484 +
1485 +-void hugetlb_setup(struct mm_struct *mm)
1486 ++void hugetlb_setup(struct pt_regs *regs)
1487 + {
1488 +- struct tsb_config *tp = &mm->context.tsb_block[MM_TSB_HUGE];
1489 ++ struct mm_struct *mm = current->mm;
1490 ++ struct tsb_config *tp;
1491 +
1492 +- if (likely(tp->tsb != NULL))
1493 +- return;
1494 ++ if (in_atomic() || !mm) {
1495 ++ const struct exception_table_entry *entry;
1496 ++
1497 ++ entry = search_exception_tables(regs->tpc);
1498 ++ if (entry) {
1499 ++ regs->tpc = entry->fixup;
1500 ++ regs->tnpc = regs->tpc + 4;
1501 ++ return;
1502 ++ }
1503 ++ pr_alert("Unexpected HugeTLB setup in atomic context.\n");
1504 ++ die_if_kernel("HugeTSB in atomic", regs);
1505 ++ }
1506 ++
1507 ++ tp = &mm->context.tsb_block[MM_TSB_HUGE];
1508 ++ if (likely(tp->tsb == NULL))
1509 ++ tsb_grow(mm, MM_TSB_HUGE, 0);
1510 +
1511 +- tsb_grow(mm, MM_TSB_HUGE, 0);
1512 + tsb_context_switch(mm);
1513 + smp_tsb_sync(mm);
1514 +
1515 +diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
1516 +index 3e8fec3..ba6ae7f 100644
1517 +--- a/arch/sparc/mm/tlb.c
1518 ++++ b/arch/sparc/mm/tlb.c
1519 +@@ -135,8 +135,15 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
1520 + mm->context.huge_pte_count++;
1521 + else
1522 + mm->context.huge_pte_count--;
1523 +- if (mm->context.huge_pte_count == 1)
1524 +- hugetlb_setup(mm);
1525 ++
1526 ++ /* Do not try to allocate the TSB hash table if we
1527 ++ * don't have one already. We have various locks held
1528 ++ * and thus we'll end up doing a GFP_KERNEL allocation
1529 ++ * in an atomic context.
1530 ++ *
1531 ++ * Instead, we let the first TLB miss on a hugepage
1532 ++ * take care of this.
1533 ++ */
1534 + }
1535 +
1536 + if (!pmd_none(orig)) {
1537 +diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
1538 +index 7f64743..428982b 100644
1539 +--- a/arch/sparc/mm/tsb.c
1540 ++++ b/arch/sparc/mm/tsb.c
1541 +@@ -314,7 +314,7 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
1542 + retry_tsb_alloc:
1543 + gfp_flags = GFP_KERNEL;
1544 + if (new_size > (PAGE_SIZE * 2))
1545 +- gfp_flags = __GFP_NOWARN | __GFP_NORETRY;
1546 ++ gfp_flags |= __GFP_NOWARN | __GFP_NORETRY;
1547 +
1548 + new_tsb = kmem_cache_alloc_node(tsb_caches[new_cache_index],
1549 + gfp_flags, numa_node_id());
1550 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
1551 +index 225543b..0694d09 100644
1552 +--- a/arch/x86/Kconfig
1553 ++++ b/arch/x86/Kconfig
1554 +@@ -1253,10 +1253,6 @@ config NODES_SHIFT
1555 + Specify the maximum number of NUMA Nodes available on the target
1556 + system. Increases memory reserved to accommodate various tables.
1557 +
1558 +-config HAVE_ARCH_ALLOC_REMAP
1559 +- def_bool y
1560 +- depends on X86_32 && NUMA
1561 +-
1562 + config ARCH_HAVE_MEMORY_PRESENT
1563 + def_bool y
1564 + depends on X86_32 && DISCONTIGMEM
1565 +diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h
1566 +index eb05fb3..8a9b3e2 100644
1567 +--- a/arch/x86/include/asm/mmzone_32.h
1568 ++++ b/arch/x86/include/asm/mmzone_32.h
1569 +@@ -14,12 +14,6 @@ extern struct pglist_data *node_data[];
1570 +
1571 + #include <asm/numaq.h>
1572 +
1573 +-extern void resume_map_numa_kva(pgd_t *pgd);
1574 +-
1575 +-#else /* !CONFIG_NUMA */
1576 +-
1577 +-static inline void resume_map_numa_kva(pgd_t *pgd) {}
1578 +-
1579 + #endif /* CONFIG_NUMA */
1580 +
1581 + #ifdef CONFIG_DISCONTIGMEM
1582 +diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
1583 +index 0a630dd..646d192 100644
1584 +--- a/arch/x86/kernel/cpu/mshyperv.c
1585 ++++ b/arch/x86/kernel/cpu/mshyperv.c
1586 +@@ -68,7 +68,8 @@ static void __init ms_hyperv_init_platform(void)
1587 + printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n",
1588 + ms_hyperv.features, ms_hyperv.hints);
1589 +
1590 +- clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
1591 ++ if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
1592 ++ clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
1593 + }
1594 +
1595 + const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
1596 +diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
1597 +index 2d125be..8504f36 100644
1598 +--- a/arch/x86/mm/numa.c
1599 ++++ b/arch/x86/mm/numa.c
1600 +@@ -193,7 +193,6 @@ int __init numa_add_memblk(int nid, u64 start, u64 end)
1601 + static void __init setup_node_data(int nid, u64 start, u64 end)
1602 + {
1603 + const size_t nd_size = roundup(sizeof(pg_data_t), PAGE_SIZE);
1604 +- bool remapped = false;
1605 + u64 nd_pa;
1606 + void *nd;
1607 + int tnid;
1608 +@@ -205,37 +204,28 @@ static void __init setup_node_data(int nid, u64 start, u64 end)
1609 + if (end && (end - start) < NODE_MIN_SIZE)
1610 + return;
1611 +
1612 +- /* initialize remap allocator before aligning to ZONE_ALIGN */
1613 +- init_alloc_remap(nid, start, end);
1614 +-
1615 + start = roundup(start, ZONE_ALIGN);
1616 +
1617 + printk(KERN_INFO "Initmem setup node %d [mem %#010Lx-%#010Lx]\n",
1618 + nid, start, end - 1);
1619 +
1620 + /*
1621 +- * Allocate node data. Try remap allocator first, node-local
1622 +- * memory and then any node. Never allocate in DMA zone.
1623 ++ * Allocate node data. Try node-local memory and then any node.
1624 ++ * Never allocate in DMA zone.
1625 + */
1626 +- nd = alloc_remap(nid, nd_size);
1627 +- if (nd) {
1628 +- nd_pa = __pa(nd);
1629 +- remapped = true;
1630 +- } else {
1631 +- nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
1632 +- if (!nd_pa) {
1633 +- pr_err("Cannot find %zu bytes in node %d\n",
1634 +- nd_size, nid);
1635 +- return;
1636 +- }
1637 +- nd = __va(nd_pa);
1638 ++ nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
1639 ++ if (!nd_pa) {
1640 ++ pr_err("Cannot find %zu bytes in node %d\n",
1641 ++ nd_size, nid);
1642 ++ return;
1643 + }
1644 ++ nd = __va(nd_pa);
1645 +
1646 + /* report and initialize */
1647 +- printk(KERN_INFO " NODE_DATA [mem %#010Lx-%#010Lx]%s\n",
1648 +- nd_pa, nd_pa + nd_size - 1, remapped ? " (remapped)" : "");
1649 ++ printk(KERN_INFO " NODE_DATA [mem %#010Lx-%#010Lx]\n",
1650 ++ nd_pa, nd_pa + nd_size - 1);
1651 + tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT);
1652 +- if (!remapped && tnid != nid)
1653 ++ if (tnid != nid)
1654 + printk(KERN_INFO " NODE_DATA(%d) on node %d\n", nid, tnid);
1655 +
1656 + node_data[nid] = nd;
1657 +diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
1658 +index 534255a..73a6d73 100644
1659 +--- a/arch/x86/mm/numa_32.c
1660 ++++ b/arch/x86/mm/numa_32.c
1661 +@@ -73,167 +73,6 @@ unsigned long node_memmap_size_bytes(int nid, unsigned long start_pfn,
1662 +
1663 + extern unsigned long highend_pfn, highstart_pfn;
1664 +
1665 +-#define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE)
1666 +-
1667 +-static void *node_remap_start_vaddr[MAX_NUMNODES];
1668 +-void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
1669 +-
1670 +-/*
1671 +- * Remap memory allocator
1672 +- */
1673 +-static unsigned long node_remap_start_pfn[MAX_NUMNODES];
1674 +-static void *node_remap_end_vaddr[MAX_NUMNODES];
1675 +-static void *node_remap_alloc_vaddr[MAX_NUMNODES];
1676 +-
1677 +-/**
1678 +- * alloc_remap - Allocate remapped memory
1679 +- * @nid: NUMA node to allocate memory from
1680 +- * @size: The size of allocation
1681 +- *
1682 +- * Allocate @size bytes from the remap area of NUMA node @nid. The
1683 +- * size of the remap area is predetermined by init_alloc_remap() and
1684 +- * only the callers considered there should call this function. For
1685 +- * more info, please read the comment on top of init_alloc_remap().
1686 +- *
1687 +- * The caller must be ready to handle allocation failure from this
1688 +- * function and fall back to regular memory allocator in such cases.
1689 +- *
1690 +- * CONTEXT:
1691 +- * Single CPU early boot context.
1692 +- *
1693 +- * RETURNS:
1694 +- * Pointer to the allocated memory on success, %NULL on failure.
1695 +- */
1696 +-void *alloc_remap(int nid, unsigned long size)
1697 +-{
1698 +- void *allocation = node_remap_alloc_vaddr[nid];
1699 +-
1700 +- size = ALIGN(size, L1_CACHE_BYTES);
1701 +-
1702 +- if (!allocation || (allocation + size) > node_remap_end_vaddr[nid])
1703 +- return NULL;
1704 +-
1705 +- node_remap_alloc_vaddr[nid] += size;
1706 +- memset(allocation, 0, size);
1707 +-
1708 +- return allocation;
1709 +-}
1710 +-
1711 +-#ifdef CONFIG_HIBERNATION
1712 +-/**
1713 +- * resume_map_numa_kva - add KVA mapping to the temporary page tables created
1714 +- * during resume from hibernation
1715 +- * @pgd_base - temporary resume page directory
1716 +- */
1717 +-void resume_map_numa_kva(pgd_t *pgd_base)
1718 +-{
1719 +- int node;
1720 +-
1721 +- for_each_online_node(node) {
1722 +- unsigned long start_va, start_pfn, nr_pages, pfn;
1723 +-
1724 +- start_va = (unsigned long)node_remap_start_vaddr[node];
1725 +- start_pfn = node_remap_start_pfn[node];
1726 +- nr_pages = (node_remap_end_vaddr[node] -
1727 +- node_remap_start_vaddr[node]) >> PAGE_SHIFT;
1728 +-
1729 +- printk(KERN_DEBUG "%s: node %d\n", __func__, node);
1730 +-
1731 +- for (pfn = 0; pfn < nr_pages; pfn += PTRS_PER_PTE) {
1732 +- unsigned long vaddr = start_va + (pfn << PAGE_SHIFT);
1733 +- pgd_t *pgd = pgd_base + pgd_index(vaddr);
1734 +- pud_t *pud = pud_offset(pgd, vaddr);
1735 +- pmd_t *pmd = pmd_offset(pud, vaddr);
1736 +-
1737 +- set_pmd(pmd, pfn_pmd(start_pfn + pfn,
1738 +- PAGE_KERNEL_LARGE_EXEC));
1739 +-
1740 +- printk(KERN_DEBUG "%s: %08lx -> pfn %08lx\n",
1741 +- __func__, vaddr, start_pfn + pfn);
1742 +- }
1743 +- }
1744 +-}
1745 +-#endif
1746 +-
1747 +-/**
1748 +- * init_alloc_remap - Initialize remap allocator for a NUMA node
1749 +- * @nid: NUMA node to initizlie remap allocator for
1750 +- *
1751 +- * NUMA nodes may end up without any lowmem. As allocating pgdat and
1752 +- * memmap on a different node with lowmem is inefficient, a special
1753 +- * remap allocator is implemented which can be used by alloc_remap().
1754 +- *
1755 +- * For each node, the amount of memory which will be necessary for
1756 +- * pgdat and memmap is calculated and two memory areas of the size are
1757 +- * allocated - one in the node and the other in lowmem; then, the area
1758 +- * in the node is remapped to the lowmem area.
1759 +- *
1760 +- * As pgdat and memmap must be allocated in lowmem anyway, this
1761 +- * doesn't waste lowmem address space; however, the actual lowmem
1762 +- * which gets remapped over is wasted. The amount shouldn't be
1763 +- * problematic on machines this feature will be used.
1764 +- *
1765 +- * Initialization failure isn't fatal. alloc_remap() is used
1766 +- * opportunistically and the callers will fall back to other memory
1767 +- * allocation mechanisms on failure.
1768 +- */
1769 +-void __init init_alloc_remap(int nid, u64 start, u64 end)
1770 +-{
1771 +- unsigned long start_pfn = start >> PAGE_SHIFT;
1772 +- unsigned long end_pfn = end >> PAGE_SHIFT;
1773 +- unsigned long size, pfn;
1774 +- u64 node_pa, remap_pa;
1775 +- void *remap_va;
1776 +-
1777 +- /*
1778 +- * The acpi/srat node info can show hot-add memroy zones where
1779 +- * memory could be added but not currently present.
1780 +- */
1781 +- printk(KERN_DEBUG "node %d pfn: [%lx - %lx]\n",
1782 +- nid, start_pfn, end_pfn);
1783 +-
1784 +- /* calculate the necessary space aligned to large page size */
1785 +- size = node_memmap_size_bytes(nid, start_pfn, end_pfn);
1786 +- size += ALIGN(sizeof(pg_data_t), PAGE_SIZE);
1787 +- size = ALIGN(size, LARGE_PAGE_BYTES);
1788 +-
1789 +- /* allocate node memory and the lowmem remap area */
1790 +- node_pa = memblock_find_in_range(start, end, size, LARGE_PAGE_BYTES);
1791 +- if (!node_pa) {
1792 +- pr_warning("remap_alloc: failed to allocate %lu bytes for node %d\n",
1793 +- size, nid);
1794 +- return;
1795 +- }
1796 +- memblock_reserve(node_pa, size);
1797 +-
1798 +- remap_pa = memblock_find_in_range(min_low_pfn << PAGE_SHIFT,
1799 +- max_low_pfn << PAGE_SHIFT,
1800 +- size, LARGE_PAGE_BYTES);
1801 +- if (!remap_pa) {
1802 +- pr_warning("remap_alloc: failed to allocate %lu bytes remap area for node %d\n",
1803 +- size, nid);
1804 +- memblock_free(node_pa, size);
1805 +- return;
1806 +- }
1807 +- memblock_reserve(remap_pa, size);
1808 +- remap_va = phys_to_virt(remap_pa);
1809 +-
1810 +- /* perform actual remap */
1811 +- for (pfn = 0; pfn < size >> PAGE_SHIFT; pfn += PTRS_PER_PTE)
1812 +- set_pmd_pfn((unsigned long)remap_va + (pfn << PAGE_SHIFT),
1813 +- (node_pa >> PAGE_SHIFT) + pfn,
1814 +- PAGE_KERNEL_LARGE);
1815 +-
1816 +- /* initialize remap allocator parameters */
1817 +- node_remap_start_pfn[nid] = node_pa >> PAGE_SHIFT;
1818 +- node_remap_start_vaddr[nid] = remap_va;
1819 +- node_remap_end_vaddr[nid] = remap_va + size;
1820 +- node_remap_alloc_vaddr[nid] = remap_va;
1821 +-
1822 +- printk(KERN_DEBUG "remap_alloc: node %d [%08llx-%08llx) -> [%p-%p)\n",
1823 +- nid, node_pa, node_pa + size, remap_va, remap_va + size);
1824 +-}
1825 +-
1826 + void __init initmem_init(void)
1827 + {
1828 + x86_numa_init();
1829 +diff --git a/arch/x86/mm/numa_internal.h b/arch/x86/mm/numa_internal.h
1830 +index 7178c3a..ad86ec9 100644
1831 +--- a/arch/x86/mm/numa_internal.h
1832 ++++ b/arch/x86/mm/numa_internal.h
1833 +@@ -21,12 +21,6 @@ void __init numa_reset_distance(void);
1834 +
1835 + void __init x86_numa_init(void);
1836 +
1837 +-#ifdef CONFIG_X86_64
1838 +-static inline void init_alloc_remap(int nid, u64 start, u64 end) { }
1839 +-#else
1840 +-void __init init_alloc_remap(int nid, u64 start, u64 end);
1841 +-#endif
1842 +-
1843 + #ifdef CONFIG_NUMA_EMU
1844 + void __init numa_emulation(struct numa_meminfo *numa_meminfo,
1845 + int numa_dist_cnt);
1846 +diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
1847 +index 74202c1..7d28c88 100644
1848 +--- a/arch/x86/power/hibernate_32.c
1849 ++++ b/arch/x86/power/hibernate_32.c
1850 +@@ -129,8 +129,6 @@ static int resume_physical_mapping_init(pgd_t *pgd_base)
1851 + }
1852 + }
1853 +
1854 +- resume_map_numa_kva(pgd_base);
1855 +-
1856 + return 0;
1857 + }
1858 +
1859 +diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
1860 +index 83e866d..f7a080e 100644
1861 +--- a/arch/x86/xen/spinlock.c
1862 ++++ b/arch/x86/xen/spinlock.c
1863 +@@ -328,7 +328,6 @@ static noinline void xen_spin_unlock_slow(struct xen_spinlock *xl)
1864 + if (per_cpu(lock_spinners, cpu) == xl) {
1865 + ADD_STATS(released_slow_kicked, 1);
1866 + xen_send_IPI_one(cpu, XEN_SPIN_UNLOCK_VECTOR);
1867 +- break;
1868 + }
1869 + }
1870 + }
1871 +diff --git a/drivers/base/bus.c b/drivers/base/bus.c
1872 +index 24eb078..6856303 100644
1873 +--- a/drivers/base/bus.c
1874 ++++ b/drivers/base/bus.c
1875 +@@ -290,7 +290,7 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start,
1876 + struct device *dev;
1877 + int error = 0;
1878 +
1879 +- if (!bus)
1880 ++ if (!bus || !bus->p)
1881 + return -EINVAL;
1882 +
1883 + klist_iter_init_node(&bus->p->klist_devices, &i,
1884 +@@ -324,7 +324,7 @@ struct device *bus_find_device(struct bus_type *bus,
1885 + struct klist_iter i;
1886 + struct device *dev;
1887 +
1888 +- if (!bus)
1889 ++ if (!bus || !bus->p)
1890 + return NULL;
1891 +
1892 + klist_iter_init_node(&bus->p->klist_devices, &i,
1893 +diff --git a/drivers/base/dd.c b/drivers/base/dd.c
1894 +index e3bbed8..61d3e1b 100644
1895 +--- a/drivers/base/dd.c
1896 ++++ b/drivers/base/dd.c
1897 +@@ -172,6 +172,8 @@ static int deferred_probe_initcall(void)
1898 +
1899 + driver_deferred_probe_enable = true;
1900 + driver_deferred_probe_trigger();
1901 ++ /* Sort as many dependencies as possible before exiting initcalls */
1902 ++ flush_workqueue(deferred_wq);
1903 + return 0;
1904 + }
1905 + late_initcall(deferred_probe_initcall);
1906 +diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
1907 +index bc6f5fa..819dfda 100644
1908 +--- a/drivers/dca/dca-core.c
1909 ++++ b/drivers/dca/dca-core.c
1910 +@@ -420,6 +420,11 @@ void unregister_dca_provider(struct dca_provider *dca, struct device *dev)
1911 +
1912 + raw_spin_lock_irqsave(&dca_lock, flags);
1913 +
1914 ++ if (list_empty(&dca_domains)) {
1915 ++ raw_spin_unlock_irqrestore(&dca_lock, flags);
1916 ++ return;
1917 ++ }
1918 ++
1919 + list_del(&dca->node);
1920 +
1921 + pci_rc = dca_pci_rc_from_dev(dev);
1922 +diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c
1923 +index 3315e4b..b70709b 100644
1924 +--- a/drivers/dma/sh/shdma.c
1925 ++++ b/drivers/dma/sh/shdma.c
1926 +@@ -326,7 +326,7 @@ static int sh_dmae_set_slave(struct shdma_chan *schan,
1927 + shdma_chan);
1928 + const struct sh_dmae_slave_config *cfg = dmae_find_slave(sh_chan, slave_id);
1929 + if (!cfg)
1930 +- return -ENODEV;
1931 ++ return -ENXIO;
1932 +
1933 + if (!try)
1934 + sh_chan->config = cfg;
1935 +diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
1936 +index bdc8302..deca78f 100644
1937 +--- a/drivers/gpio/gpio-em.c
1938 ++++ b/drivers/gpio/gpio-em.c
1939 +@@ -299,8 +299,9 @@ static int em_gio_probe(struct platform_device *pdev)
1940 + irq_chip->irq_set_type = em_gio_irq_set_type;
1941 + irq_chip->flags = IRQCHIP_SKIP_SET_WAKE;
1942 +
1943 +- p->irq_domain = irq_domain_add_linear(pdev->dev.of_node,
1944 ++ p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
1945 + pdata->number_of_pins,
1946 ++ pdata->irq_base,
1947 + &em_gio_irq_domain_ops, p);
1948 + if (!p->irq_domain) {
1949 + ret = -ENXIO;
1950 +diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
1951 +index f2d667b..bcb2c0a 100644
1952 +--- a/drivers/gpu/drm/drm_crtc.c
1953 ++++ b/drivers/gpu/drm/drm_crtc.c
1954 +@@ -2089,7 +2089,7 @@ uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth)
1955 +
1956 + switch (bpp) {
1957 + case 8:
1958 +- fmt = DRM_FORMAT_RGB332;
1959 ++ fmt = DRM_FORMAT_C8;
1960 + break;
1961 + case 16:
1962 + if (depth == 15)
1963 +@@ -3702,6 +3702,7 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1964 + int *bpp)
1965 + {
1966 + switch (format) {
1967 ++ case DRM_FORMAT_C8:
1968 + case DRM_FORMAT_RGB332:
1969 + case DRM_FORMAT_BGR233:
1970 + *depth = 8;
1971 +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
1972 +index 5a3770f..aaded22 100644
1973 +--- a/drivers/gpu/drm/drm_edid.c
1974 ++++ b/drivers/gpu/drm/drm_edid.c
1975 +@@ -87,9 +87,6 @@ static struct edid_quirk {
1976 + int product_id;
1977 + u32 quirks;
1978 + } edid_quirk_list[] = {
1979 +- /* ASUS VW222S */
1980 +- { "ACI", 0x22a2, EDID_QUIRK_FORCE_REDUCED_BLANKING },
1981 +-
1982 + /* Acer AL1706 */
1983 + { "ACR", 44358, EDID_QUIRK_PREFER_LARGE_60 },
1984 + /* Acer F51 */
1985 +@@ -357,10 +354,14 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
1986 + break;
1987 + }
1988 + }
1989 +- if (i == 4)
1990 ++
1991 ++ if (i == 4 && print_bad_edid) {
1992 + dev_warn(connector->dev->dev,
1993 + "%s: Ignoring invalid EDID block %d.\n",
1994 + drm_get_connector_name(connector), j);
1995 ++
1996 ++ connector->bad_edid_counter++;
1997 ++ }
1998 + }
1999 +
2000 + if (valid_extensions != block[0x7e]) {
2001 +@@ -2020,7 +2021,8 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
2002 + num_modes += add_cvt_modes(connector, edid);
2003 + num_modes += add_standard_modes(connector, edid);
2004 + num_modes += add_established_modes(connector, edid);
2005 +- num_modes += add_inferred_modes(connector, edid);
2006 ++ if (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF)
2007 ++ num_modes += add_inferred_modes(connector, edid);
2008 + num_modes += add_cea_modes(connector, edid);
2009 +
2010 + if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
2011 +diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
2012 +index 3cec306..34a156f 100644
2013 +--- a/drivers/gpu/drm/drm_usb.c
2014 ++++ b/drivers/gpu/drm/drm_usb.c
2015 +@@ -18,7 +18,7 @@ int drm_get_usb_dev(struct usb_interface *interface,
2016 +
2017 + usbdev = interface_to_usbdev(interface);
2018 + dev->usbdev = usbdev;
2019 +- dev->dev = &usbdev->dev;
2020 ++ dev->dev = &interface->dev;
2021 +
2022 + mutex_lock(&drm_global_mutex);
2023 +
2024 +diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
2025 +index 9d4a2c2..8a7c48b 100644
2026 +--- a/drivers/gpu/drm/i915/i915_debugfs.c
2027 ++++ b/drivers/gpu/drm/i915/i915_debugfs.c
2028 +@@ -691,7 +691,7 @@ static int i915_error_state(struct seq_file *m, void *unused)
2029 +
2030 + seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec,
2031 + error->time.tv_usec);
2032 +- seq_printf(m, "Kernel: " UTS_RELEASE);
2033 ++ seq_printf(m, "Kernel: " UTS_RELEASE "\n");
2034 + seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device);
2035 + seq_printf(m, "EIR: 0x%08x\n", error->eir);
2036 + seq_printf(m, "IER: 0x%08x\n", error->ier);
2037 +@@ -888,7 +888,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
2038 + u32 gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
2039 + u32 rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
2040 + u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
2041 +- u32 rpstat;
2042 ++ u32 rpstat, cagf;
2043 + u32 rpupei, rpcurup, rpprevup;
2044 + u32 rpdownei, rpcurdown, rpprevdown;
2045 + int max_freq;
2046 +@@ -907,6 +907,11 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
2047 + rpdownei = I915_READ(GEN6_RP_CUR_DOWN_EI);
2048 + rpcurdown = I915_READ(GEN6_RP_CUR_DOWN);
2049 + rpprevdown = I915_READ(GEN6_RP_PREV_DOWN);
2050 ++ if (IS_HASWELL(dev))
2051 ++ cagf = (rpstat & HSW_CAGF_MASK) >> HSW_CAGF_SHIFT;
2052 ++ else
2053 ++ cagf = (rpstat & GEN6_CAGF_MASK) >> GEN6_CAGF_SHIFT;
2054 ++ cagf *= GT_FREQUENCY_MULTIPLIER;
2055 +
2056 + gen6_gt_force_wake_put(dev_priv);
2057 + mutex_unlock(&dev->struct_mutex);
2058 +@@ -919,8 +924,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
2059 + gt_perf_status & 0xff);
2060 + seq_printf(m, "Render p-state limit: %d\n",
2061 + rp_state_limits & 0xff);
2062 +- seq_printf(m, "CAGF: %dMHz\n", ((rpstat & GEN6_CAGF_MASK) >>
2063 +- GEN6_CAGF_SHIFT) * GT_FREQUENCY_MULTIPLIER);
2064 ++ seq_printf(m, "CAGF: %dMHz\n", cagf);
2065 + seq_printf(m, "RP CUR UP EI: %dus\n", rpupei &
2066 + GEN6_CURICONT_MASK);
2067 + seq_printf(m, "RP CUR UP: %dus\n", rpcurup &
2068 +diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
2069 +index 12ab3bd..7339a4b 100644
2070 +--- a/drivers/gpu/drm/i915/i915_drv.h
2071 ++++ b/drivers/gpu/drm/i915/i915_drv.h
2072 +@@ -919,7 +919,7 @@ typedef struct drm_i915_private {
2073 + bool hw_contexts_disabled;
2074 + uint32_t hw_context_size;
2075 +
2076 +- bool fdi_rx_polarity_reversed;
2077 ++ u32 fdi_rx_config;
2078 +
2079 + struct i915_suspend_saved_registers regfile;
2080 +
2081 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
2082 +index 8febea6..de45b60 100644
2083 +--- a/drivers/gpu/drm/i915/i915_gem.c
2084 ++++ b/drivers/gpu/drm/i915/i915_gem.c
2085 +@@ -1918,9 +1918,6 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj)
2086 + BUG_ON(obj->base.write_domain & ~I915_GEM_GPU_DOMAINS);
2087 + BUG_ON(!obj->active);
2088 +
2089 +- if (obj->pin_count) /* are we a framebuffer? */
2090 +- intel_mark_fb_idle(obj);
2091 +-
2092 + list_move_tail(&obj->mm_list, &dev_priv->mm.inactive_list);
2093 +
2094 + list_del_init(&obj->ring_list);
2095 +@@ -3848,7 +3845,7 @@ void i915_gem_l3_remap(struct drm_device *dev)
2096 + u32 misccpctl;
2097 + int i;
2098 +
2099 +- if (!IS_IVYBRIDGE(dev))
2100 ++ if (!HAS_L3_GPU_CACHE(dev))
2101 + return;
2102 +
2103 + if (!dev_priv->l3_parity.remap_info)
2104 +diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
2105 +index 59afb7e..2bfd05a 100644
2106 +--- a/drivers/gpu/drm/i915/i915_reg.h
2107 ++++ b/drivers/gpu/drm/i915/i915_reg.h
2108 +@@ -3927,7 +3927,7 @@
2109 + #define FDI_10BPC (1<<16)
2110 + #define FDI_6BPC (2<<16)
2111 + #define FDI_12BPC (3<<16)
2112 +-#define FDI_LINK_REVERSE_OVERWRITE (1<<15)
2113 ++#define FDI_RX_LINK_REVERSAL_OVERRIDE (1<<15)
2114 + #define FDI_DMI_LINK_REVERSE_MASK (1<<14)
2115 + #define FDI_RX_PLL_ENABLE (1<<13)
2116 + #define FDI_FS_ERR_CORRECT_ENABLE (1<<11)
2117 +@@ -4211,7 +4211,9 @@
2118 + #define GEN6_RP_INTERRUPT_LIMITS 0xA014
2119 + #define GEN6_RPSTAT1 0xA01C
2120 + #define GEN6_CAGF_SHIFT 8
2121 ++#define HSW_CAGF_SHIFT 7
2122 + #define GEN6_CAGF_MASK (0x7f << GEN6_CAGF_SHIFT)
2123 ++#define HSW_CAGF_MASK (0x7f << HSW_CAGF_SHIFT)
2124 + #define GEN6_RP_CONTROL 0xA024
2125 + #define GEN6_RP_MEDIA_TURBO (1<<11)
2126 + #define GEN6_RP_MEDIA_MODE_MASK (3<<9)
2127 +@@ -4280,8 +4282,8 @@
2128 + #define GEN6_PCODE_READ_MIN_FREQ_TABLE 0x9
2129 + #define GEN6_PCODE_WRITE_RC6VIDS 0x4
2130 + #define GEN6_PCODE_READ_RC6VIDS 0x5
2131 +-#define GEN6_ENCODE_RC6_VID(mv) (((mv) / 5) - 245) < 0 ?: 0
2132 +-#define GEN6_DECODE_RC6_VID(vids) (((vids) * 5) > 0 ? ((vids) * 5) + 245 : 0)
2133 ++#define GEN6_ENCODE_RC6_VID(mv) (((mv) - 245) / 5)
2134 ++#define GEN6_DECODE_RC6_VID(vids) (((vids) * 5) + 245)
2135 + #define GEN6_PCODE_DATA 0x138128
2136 + #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8
2137 +
2138 +@@ -4524,6 +4526,7 @@
2139 + #define DDI_BUF_EMP_800MV_0DB_HSW (7<<24) /* Sel7 */
2140 + #define DDI_BUF_EMP_800MV_3_5DB_HSW (8<<24) /* Sel8 */
2141 + #define DDI_BUF_EMP_MASK (0xf<<24)
2142 ++#define DDI_BUF_PORT_REVERSAL (1<<16)
2143 + #define DDI_BUF_IS_IDLE (1<<7)
2144 + #define DDI_A_4_LANES (1<<4)
2145 + #define DDI_PORT_WIDTH_X1 (0<<1)
2146 +diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
2147 +index 9293878..06b1786 100644
2148 +--- a/drivers/gpu/drm/i915/intel_crt.c
2149 ++++ b/drivers/gpu/drm/i915/intel_crt.c
2150 +@@ -800,10 +800,14 @@ void intel_crt_init(struct drm_device *dev)
2151 + dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS;
2152 +
2153 + /*
2154 +- * TODO: find a proper way to discover whether we need to set the
2155 +- * polarity reversal bit or not, instead of relying on the BIOS.
2156 ++ * TODO: find a proper way to discover whether we need to set the the
2157 ++ * polarity and link reversal bits or not, instead of relying on the
2158 ++ * BIOS.
2159 + */
2160 +- if (HAS_PCH_LPT(dev))
2161 +- dev_priv->fdi_rx_polarity_reversed =
2162 +- !!(I915_READ(_FDI_RXA_CTL) & FDI_RX_POLARITY_REVERSED_LPT);
2163 ++ if (HAS_PCH_LPT(dev)) {
2164 ++ u32 fdi_config = FDI_RX_POLARITY_REVERSED_LPT |
2165 ++ FDI_RX_LINK_REVERSAL_OVERRIDE;
2166 ++
2167 ++ dev_priv->fdi_rx_config = I915_READ(_FDI_RXA_CTL) & fdi_config;
2168 ++ }
2169 + }
2170 +diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
2171 +index 4bad0f7..59b778d 100644
2172 +--- a/drivers/gpu/drm/i915/intel_ddi.c
2173 ++++ b/drivers/gpu/drm/i915/intel_ddi.c
2174 +@@ -178,10 +178,8 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
2175 + FDI_RX_TP1_TO_TP2_48 | FDI_RX_FDI_DELAY_90);
2176 +
2177 + /* Enable the PCH Receiver FDI PLL */
2178 +- rx_ctl_val = FDI_RX_PLL_ENABLE | FDI_RX_ENHANCE_FRAME_ENABLE |
2179 +- ((intel_crtc->fdi_lanes - 1) << 19);
2180 +- if (dev_priv->fdi_rx_polarity_reversed)
2181 +- rx_ctl_val |= FDI_RX_POLARITY_REVERSED_LPT;
2182 ++ rx_ctl_val = dev_priv->fdi_rx_config | FDI_RX_ENHANCE_FRAME_ENABLE |
2183 ++ FDI_RX_PLL_ENABLE | ((intel_crtc->fdi_lanes - 1) << 19);
2184 + I915_WRITE(_FDI_RXA_CTL, rx_ctl_val);
2185 + POSTING_READ(_FDI_RXA_CTL);
2186 + udelay(220);
2187 +@@ -203,7 +201,10 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
2188 + DP_TP_CTL_LINK_TRAIN_PAT1 |
2189 + DP_TP_CTL_ENABLE);
2190 +
2191 +- /* Configure and enable DDI_BUF_CTL for DDI E with next voltage */
2192 ++ /* Configure and enable DDI_BUF_CTL for DDI E with next voltage.
2193 ++ * DDI E does not support port reversal, the functionality is
2194 ++ * achieved on the PCH side in FDI_RX_CTL, so no need to set the
2195 ++ * port reversal bit */
2196 + I915_WRITE(DDI_BUF_CTL(PORT_E),
2197 + DDI_BUF_CTL_ENABLE |
2198 + ((intel_crtc->fdi_lanes - 1) << 1) |
2199 +@@ -677,8 +678,11 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder,
2200 +
2201 + if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
2202 + struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
2203 ++ struct intel_digital_port *intel_dig_port =
2204 ++ enc_to_dig_port(encoder);
2205 +
2206 +- intel_dp->DP = DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW;
2207 ++ intel_dp->DP = intel_dig_port->port_reversal |
2208 ++ DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW;
2209 + switch (intel_dp->lane_count) {
2210 + case 1:
2211 + intel_dp->DP |= DDI_PORT_WIDTH_X1;
2212 +@@ -1291,11 +1295,15 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
2213 + int type = intel_encoder->type;
2214 +
2215 + if (type == INTEL_OUTPUT_HDMI) {
2216 ++ struct intel_digital_port *intel_dig_port =
2217 ++ enc_to_dig_port(encoder);
2218 ++
2219 + /* In HDMI/DVI mode, the port width, and swing/emphasis values
2220 + * are ignored so nothing special needs to be done besides
2221 + * enabling the port.
2222 + */
2223 +- I915_WRITE(DDI_BUF_CTL(port), DDI_BUF_CTL_ENABLE);
2224 ++ I915_WRITE(DDI_BUF_CTL(port),
2225 ++ intel_dig_port->port_reversal | DDI_BUF_CTL_ENABLE);
2226 + } else if (type == INTEL_OUTPUT_EDP) {
2227 + struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
2228 +
2229 +@@ -1457,6 +1465,7 @@ static const struct drm_encoder_helper_funcs intel_ddi_helper_funcs = {
2230 +
2231 + void intel_ddi_init(struct drm_device *dev, enum port port)
2232 + {
2233 ++ struct drm_i915_private *dev_priv = dev->dev_private;
2234 + struct intel_digital_port *intel_dig_port;
2235 + struct intel_encoder *intel_encoder;
2236 + struct drm_encoder *encoder;
2237 +@@ -1497,6 +1506,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
2238 + intel_encoder->get_hw_state = intel_ddi_get_hw_state;
2239 +
2240 + intel_dig_port->port = port;
2241 ++ intel_dig_port->port_reversal = I915_READ(DDI_BUF_CTL(port)) &
2242 ++ DDI_BUF_PORT_REVERSAL;
2243 + if (hdmi_connector)
2244 + intel_dig_port->hdmi.sdvox_reg = DDI_BUF_CTL(port);
2245 + else
2246 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
2247 +index da1ad9c..80aa1fc 100644
2248 +--- a/drivers/gpu/drm/i915/intel_display.c
2249 ++++ b/drivers/gpu/drm/i915/intel_display.c
2250 +@@ -154,8 +154,8 @@ static const intel_limit_t intel_limits_i9xx_sdvo = {
2251 + .vco = { .min = 1400000, .max = 2800000 },
2252 + .n = { .min = 1, .max = 6 },
2253 + .m = { .min = 70, .max = 120 },
2254 +- .m1 = { .min = 10, .max = 22 },
2255 +- .m2 = { .min = 5, .max = 9 },
2256 ++ .m1 = { .min = 8, .max = 18 },
2257 ++ .m2 = { .min = 3, .max = 7 },
2258 + .p = { .min = 5, .max = 80 },
2259 + .p1 = { .min = 1, .max = 8 },
2260 + .p2 = { .dot_limit = 200000,
2261 +@@ -2017,18 +2017,29 @@ void intel_unpin_fb_obj(struct drm_i915_gem_object *obj)
2262 +
2263 + /* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel
2264 + * is assumed to be a power-of-two. */
2265 +-unsigned long intel_gen4_compute_offset_xtiled(int *x, int *y,
2266 +- unsigned int bpp,
2267 +- unsigned int pitch)
2268 ++unsigned long intel_gen4_compute_page_offset(int *x, int *y,
2269 ++ unsigned int tiling_mode,
2270 ++ unsigned int cpp,
2271 ++ unsigned int pitch)
2272 + {
2273 +- int tile_rows, tiles;
2274 ++ if (tiling_mode != I915_TILING_NONE) {
2275 ++ unsigned int tile_rows, tiles;
2276 ++
2277 ++ tile_rows = *y / 8;
2278 ++ *y %= 8;
2279 +
2280 +- tile_rows = *y / 8;
2281 +- *y %= 8;
2282 +- tiles = *x / (512/bpp);
2283 +- *x %= 512/bpp;
2284 ++ tiles = *x / (512/cpp);
2285 ++ *x %= 512/cpp;
2286 ++
2287 ++ return tile_rows * pitch * 8 + tiles * 4096;
2288 ++ } else {
2289 ++ unsigned int offset;
2290 +
2291 +- return tile_rows * pitch * 8 + tiles * 4096;
2292 ++ offset = *y * pitch + *x * cpp;
2293 ++ *y = 0;
2294 ++ *x = (offset & 4095) / cpp;
2295 ++ return offset & -4096;
2296 ++ }
2297 + }
2298 +
2299 + static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,
2300 +@@ -2105,9 +2116,9 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,
2301 +
2302 + if (INTEL_INFO(dev)->gen >= 4) {
2303 + intel_crtc->dspaddr_offset =
2304 +- intel_gen4_compute_offset_xtiled(&x, &y,
2305 +- fb->bits_per_pixel / 8,
2306 +- fb->pitches[0]);
2307 ++ intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode,
2308 ++ fb->bits_per_pixel / 8,
2309 ++ fb->pitches[0]);
2310 + linear_offset -= intel_crtc->dspaddr_offset;
2311 + } else {
2312 + intel_crtc->dspaddr_offset = linear_offset;
2313 +@@ -2198,9 +2209,9 @@ static int ironlake_update_plane(struct drm_crtc *crtc,
2314 +
2315 + linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
2316 + intel_crtc->dspaddr_offset =
2317 +- intel_gen4_compute_offset_xtiled(&x, &y,
2318 +- fb->bits_per_pixel / 8,
2319 +- fb->pitches[0]);
2320 ++ intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode,
2321 ++ fb->bits_per_pixel / 8,
2322 ++ fb->pitches[0]);
2323 + linear_offset -= intel_crtc->dspaddr_offset;
2324 +
2325 + DRM_DEBUG_KMS("Writing base %08X %08lX %d %d %d\n",
2326 +@@ -3686,6 +3697,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
2327 + struct intel_encoder *encoder;
2328 + int pipe = intel_crtc->pipe;
2329 + int plane = intel_crtc->plane;
2330 ++ u32 pctl;
2331 +
2332 +
2333 + if (!intel_crtc->active)
2334 +@@ -3705,6 +3717,13 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
2335 +
2336 + intel_disable_plane(dev_priv, plane, pipe);
2337 + intel_disable_pipe(dev_priv, pipe);
2338 ++
2339 ++ /* Disable pannel fitter if it is on this pipe. */
2340 ++ pctl = I915_READ(PFIT_CONTROL);
2341 ++ if ((pctl & PFIT_ENABLE) &&
2342 ++ ((pctl & PFIT_PIPE_MASK) >> PFIT_PIPE_SHIFT) == pipe)
2343 ++ I915_WRITE(PFIT_CONTROL, 0);
2344 ++
2345 + intel_disable_pll(dev_priv, pipe);
2346 +
2347 + intel_crtc->active = false;
2348 +@@ -6993,11 +7012,6 @@ void intel_mark_busy(struct drm_device *dev)
2349 +
2350 + void intel_mark_idle(struct drm_device *dev)
2351 + {
2352 +-}
2353 +-
2354 +-void intel_mark_fb_busy(struct drm_i915_gem_object *obj)
2355 +-{
2356 +- struct drm_device *dev = obj->base.dev;
2357 + struct drm_crtc *crtc;
2358 +
2359 + if (!i915_powersave)
2360 +@@ -7007,12 +7021,11 @@ void intel_mark_fb_busy(struct drm_i915_gem_object *obj)
2361 + if (!crtc->fb)
2362 + continue;
2363 +
2364 +- if (to_intel_framebuffer(crtc->fb)->obj == obj)
2365 +- intel_increase_pllclock(crtc);
2366 ++ intel_decrease_pllclock(crtc);
2367 + }
2368 + }
2369 +
2370 +-void intel_mark_fb_idle(struct drm_i915_gem_object *obj)
2371 ++void intel_mark_fb_busy(struct drm_i915_gem_object *obj)
2372 + {
2373 + struct drm_device *dev = obj->base.dev;
2374 + struct drm_crtc *crtc;
2375 +@@ -7025,7 +7038,7 @@ void intel_mark_fb_idle(struct drm_i915_gem_object *obj)
2376 + continue;
2377 +
2378 + if (to_intel_framebuffer(crtc->fb)->obj == obj)
2379 +- intel_decrease_pllclock(crtc);
2380 ++ intel_increase_pllclock(crtc);
2381 + }
2382 + }
2383 +
2384 +@@ -8888,6 +8901,9 @@ static struct intel_quirk intel_quirks[] = {
2385 +
2386 + /* Acer Aspire 5734Z must invert backlight brightness */
2387 + { 0x2a42, 0x1025, 0x0459, quirk_invert_brightness },
2388 ++
2389 ++ /* Acer Aspire 4736Z */
2390 ++ { 0x2a42, 0x1025, 0x0260, quirk_invert_brightness },
2391 + };
2392 +
2393 + static void intel_init_quirks(struct drm_device *dev)
2394 +diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
2395 +index 8a1bd4a..1c1840f 100644
2396 +--- a/drivers/gpu/drm/i915/intel_drv.h
2397 ++++ b/drivers/gpu/drm/i915/intel_drv.h
2398 +@@ -377,6 +377,7 @@ struct intel_dp {
2399 + struct intel_digital_port {
2400 + struct intel_encoder base;
2401 + enum port port;
2402 ++ u32 port_reversal;
2403 + struct intel_dp dp;
2404 + struct intel_hdmi hdmi;
2405 + };
2406 +@@ -439,9 +440,8 @@ extern bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg,
2407 + extern void intel_dvo_init(struct drm_device *dev);
2408 + extern void intel_tv_init(struct drm_device *dev);
2409 + extern void intel_mark_busy(struct drm_device *dev);
2410 +-extern void intel_mark_idle(struct drm_device *dev);
2411 + extern void intel_mark_fb_busy(struct drm_i915_gem_object *obj);
2412 +-extern void intel_mark_fb_idle(struct drm_i915_gem_object *obj);
2413 ++extern void intel_mark_idle(struct drm_device *dev);
2414 + extern bool intel_lvds_init(struct drm_device *dev);
2415 + extern void intel_dp_init(struct drm_device *dev, int output_reg,
2416 + enum port port);
2417 +@@ -627,9 +627,10 @@ extern void intel_update_sprite_watermarks(struct drm_device *dev, int pipe,
2418 + extern void intel_update_linetime_watermarks(struct drm_device *dev, int pipe,
2419 + struct drm_display_mode *mode);
2420 +
2421 +-extern unsigned long intel_gen4_compute_offset_xtiled(int *x, int *y,
2422 +- unsigned int bpp,
2423 +- unsigned int pitch);
2424 ++extern unsigned long intel_gen4_compute_page_offset(int *x, int *y,
2425 ++ unsigned int tiling_mode,
2426 ++ unsigned int bpp,
2427 ++ unsigned int pitch);
2428 +
2429 + extern int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
2430 + struct drm_file *file_priv);
2431 +diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
2432 +index bee8cb6..a3730e0 100644
2433 +--- a/drivers/gpu/drm/i915/intel_panel.c
2434 ++++ b/drivers/gpu/drm/i915/intel_panel.c
2435 +@@ -321,6 +321,9 @@ void intel_panel_enable_backlight(struct drm_device *dev,
2436 + if (dev_priv->backlight_level == 0)
2437 + dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
2438 +
2439 ++ dev_priv->backlight_enabled = true;
2440 ++ intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
2441 ++
2442 + if (INTEL_INFO(dev)->gen >= 4) {
2443 + uint32_t reg, tmp;
2444 +
2445 +@@ -356,12 +359,12 @@ void intel_panel_enable_backlight(struct drm_device *dev,
2446 + }
2447 +
2448 + set_level:
2449 +- /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1.
2450 +- * BLC_PWM_CPU_CTL may be cleared to zero automatically when these
2451 +- * registers are set.
2452 ++ /* Check the current backlight level and try to set again if it's zero.
2453 ++ * On some machines, BLC_PWM_CPU_CTL is cleared to zero automatically
2454 ++ * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written.
2455 + */
2456 +- dev_priv->backlight_enabled = true;
2457 +- intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
2458 ++ if (!intel_panel_get_backlight(dev))
2459 ++ intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
2460 + }
2461 +
2462 + static void intel_panel_init_backlight(struct drm_device *dev)
2463 +diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
2464 +index d7b060e..9a8d667 100644
2465 +--- a/drivers/gpu/drm/i915/intel_sprite.c
2466 ++++ b/drivers/gpu/drm/i915/intel_sprite.c
2467 +@@ -122,8 +122,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
2468 +
2469 + linear_offset = y * fb->pitches[0] + x * pixel_size;
2470 + sprsurf_offset =
2471 +- intel_gen4_compute_offset_xtiled(&x, &y,
2472 +- pixel_size, fb->pitches[0]);
2473 ++ intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode,
2474 ++ pixel_size, fb->pitches[0]);
2475 + linear_offset -= sprsurf_offset;
2476 +
2477 + /* HSW consolidates SPRTILEOFF and SPRLINOFF into a single SPROFFSET
2478 +@@ -287,8 +287,8 @@ ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
2479 +
2480 + linear_offset = y * fb->pitches[0] + x * pixel_size;
2481 + dvssurf_offset =
2482 +- intel_gen4_compute_offset_xtiled(&x, &y,
2483 +- pixel_size, fb->pitches[0]);
2484 ++ intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode,
2485 ++ pixel_size, fb->pitches[0]);
2486 + linear_offset -= dvssurf_offset;
2487 +
2488 + if (obj->tiling_mode != I915_TILING_NONE)
2489 +diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h
2490 +index b79025d..123270e9 100644
2491 +--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h
2492 ++++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h
2493 +@@ -16,6 +16,8 @@ enum dcb_output_type {
2494 +
2495 + struct dcb_output {
2496 + int index; /* may not be raw dcb index if merging has happened */
2497 ++ u16 hasht;
2498 ++ u16 hashm;
2499 + enum dcb_output_type type;
2500 + uint8_t i2c_index;
2501 + uint8_t heads;
2502 +@@ -25,6 +27,7 @@ struct dcb_output {
2503 + uint8_t or;
2504 + uint8_t link;
2505 + bool duallink_possible;
2506 ++ uint8_t extdev;
2507 + union {
2508 + struct sor_conf {
2509 + int link;
2510 +diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
2511 +index 0fd87df..2d9b9d7 100644
2512 +--- a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
2513 ++++ b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
2514 +@@ -107,6 +107,18 @@ dcb_outp(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len)
2515 + return 0x0000;
2516 + }
2517 +
2518 ++static inline u16
2519 ++dcb_outp_hasht(struct dcb_output *outp)
2520 ++{
2521 ++ return (outp->extdev << 8) | (outp->location << 4) | outp->type;
2522 ++}
2523 ++
2524 ++static inline u16
2525 ++dcb_outp_hashm(struct dcb_output *outp)
2526 ++{
2527 ++ return (outp->heads << 8) | (outp->link << 6) | outp->or;
2528 ++}
2529 ++
2530 + u16
2531 + dcb_outp_parse(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len,
2532 + struct dcb_output *outp)
2533 +@@ -135,34 +147,28 @@ dcb_outp_parse(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len,
2534 + case DCB_OUTPUT_DP:
2535 + outp->link = (conf & 0x00000030) >> 4;
2536 + outp->sorconf.link = outp->link; /*XXX*/
2537 ++ outp->extdev = 0x00;
2538 ++ if (outp->location != 0)
2539 ++ outp->extdev = (conf & 0x0000ff00) >> 8;
2540 + break;
2541 + default:
2542 + break;
2543 + }
2544 + }
2545 ++
2546 ++ outp->hasht = dcb_outp_hasht(outp);
2547 ++ outp->hashm = dcb_outp_hashm(outp);
2548 + }
2549 + return dcb;
2550 + }
2551 +