Commit 5a475ce4692f668b2615ae4ea1365c7c2d93f1dd
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: sh: LCDC dcache flush for deferred io sh: Fix compiler error and include the definition of IS_ERR_VALUE sh: re-add LCDC fbdev support to the Migo-R defconfig sh: fix se7724 ceu names sh: ms7724se: Enable sh_eth in defconfig. arch/sh/boards/mach-se/7206/io.c: Remove unnecessary semicolons sh: ms7724se: Add sh_eth support nommu: provide follow_pfn(). sh: Kill off unused DEBUG_BOOTMEM symbol. perf_counter tools: add cpu_relax()/rmb() definitions for sh. sh64: Hook up page fault events for software perf counters. sh: Hook up page fault events for software perf counters. sh: make set_perf_counter_pending() static inline. clocksource: sh_tmu: Make undefined TCOR behaviour less undefined.
Showing 14 changed files Side-by-side Diff
- arch/sh/Kconfig.debug
- arch/sh/boards/mach-se/7206/io.c
- arch/sh/boards/mach-se/7724/setup.c
- arch/sh/configs/migor_defconfig
- arch/sh/configs/se7724_defconfig
- arch/sh/include/asm/perf_counter.h
- arch/sh/include/asm/syscall_32.h
- arch/sh/include/mach-se/mach/se7724.h
- arch/sh/mm/fault_32.c
- arch/sh/mm/tlbflush_64.c
- drivers/clocksource/sh_tmu.c
- drivers/video/sh_mobile_lcdcfb.c
- mm/nommu.c
- tools/perf/perf.h
arch/sh/Kconfig.debug
... | ... | @@ -61,10 +61,6 @@ |
61 | 61 | select both the EARLY_SCIF_CONSOLE and SH_STANDARD_BIOS, using |
62 | 62 | the kernel command line option to toggle back and forth. |
63 | 63 | |
64 | -config DEBUG_BOOTMEM | |
65 | - depends on DEBUG_KERNEL | |
66 | - bool "Debug BOOTMEM initialization" | |
67 | - | |
68 | 64 | config DEBUG_STACKOVERFLOW |
69 | 65 | bool "Check for stack overflows" |
70 | 66 | depends on DEBUG_KERNEL && SUPERH32 |
arch/sh/boards/mach-se/7206/io.c
arch/sh/boards/mach-se/7724/setup.c
... | ... | @@ -23,6 +23,8 @@ |
23 | 23 | #include <media/sh_mobile_ceu.h> |
24 | 24 | #include <asm/io.h> |
25 | 25 | #include <asm/heartbeat.h> |
26 | +#include <asm/sh_eth.h> | |
27 | +#include <asm/clock.h> | |
26 | 28 | #include <asm/sh_keysc.h> |
27 | 29 | #include <cpu/sh7724.h> |
28 | 30 | #include <mach-se/mach/se7724.h> |
... | ... | @@ -272,6 +274,34 @@ |
272 | 274 | }, |
273 | 275 | }; |
274 | 276 | |
277 | +/* SH Eth */ | |
278 | +static struct resource sh_eth_resources[] = { | |
279 | + [0] = { | |
280 | + .start = SH_ETH_ADDR, | |
281 | + .end = SH_ETH_ADDR + 0x1FC, | |
282 | + .flags = IORESOURCE_MEM, | |
283 | + }, | |
284 | + [1] = { | |
285 | + .start = 91, | |
286 | + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
287 | + }, | |
288 | +}; | |
289 | + | |
290 | +struct sh_eth_plat_data sh_eth_plat = { | |
291 | + .phy = 0x1f, /* SMSC LAN8187 */ | |
292 | + .edmac_endian = EDMAC_LITTLE_ENDIAN, | |
293 | +}; | |
294 | + | |
295 | +static struct platform_device sh_eth_device = { | |
296 | + .name = "sh-eth", | |
297 | + .id = 0, | |
298 | + .dev = { | |
299 | + .platform_data = &sh_eth_plat, | |
300 | + }, | |
301 | + .num_resources = ARRAY_SIZE(sh_eth_resources), | |
302 | + .resource = sh_eth_resources, | |
303 | +}; | |
304 | + | |
275 | 305 | static struct platform_device *ms7724se_devices[] __initdata = { |
276 | 306 | &heartbeat_device, |
277 | 307 | &smc91x_eth_device, |
278 | 308 | |
... | ... | @@ -280,8 +310,57 @@ |
280 | 310 | &ceu0_device, |
281 | 311 | &ceu1_device, |
282 | 312 | &keysc_device, |
313 | + &sh_eth_device, | |
283 | 314 | }; |
284 | 315 | |
316 | +#define EEPROM_OP 0xBA206000 | |
317 | +#define EEPROM_ADR 0xBA206004 | |
318 | +#define EEPROM_DATA 0xBA20600C | |
319 | +#define EEPROM_STAT 0xBA206010 | |
320 | +#define EEPROM_STRT 0xBA206014 | |
321 | +static int __init sh_eth_is_eeprom_ready(void) | |
322 | +{ | |
323 | + int t = 10000; | |
324 | + | |
325 | + while (t--) { | |
326 | + if (!ctrl_inw(EEPROM_STAT)) | |
327 | + return 1; | |
328 | + cpu_relax(); | |
329 | + } | |
330 | + | |
331 | + printk(KERN_ERR "ms7724se can not access to eeprom\n"); | |
332 | + return 0; | |
333 | +} | |
334 | + | |
335 | +static void __init sh_eth_init(void) | |
336 | +{ | |
337 | + int i; | |
338 | + u16 mac[3]; | |
339 | + | |
340 | + /* check EEPROM status */ | |
341 | + if (!sh_eth_is_eeprom_ready()) | |
342 | + return; | |
343 | + | |
344 | + /* read MAC addr from EEPROM */ | |
345 | + for (i = 0 ; i < 3 ; i++) { | |
346 | + ctrl_outw(0x0, EEPROM_OP); /* read */ | |
347 | + ctrl_outw(i*2, EEPROM_ADR); | |
348 | + ctrl_outw(0x1, EEPROM_STRT); | |
349 | + if (!sh_eth_is_eeprom_ready()) | |
350 | + return; | |
351 | + | |
352 | + mac[i] = ctrl_inw(EEPROM_DATA); | |
353 | + mac[i] = ((mac[i] & 0xFF) << 8) | (mac[i] >> 8); /* swap */ | |
354 | + } | |
355 | + | |
356 | + /* reset sh-eth */ | |
357 | + ctrl_outl(0x1, SH_ETH_ADDR + 0x0); | |
358 | + | |
359 | + /* set MAC addr */ | |
360 | + ctrl_outl(((mac[0] << 16) | (mac[1])), SH_ETH_MAHR); | |
361 | + ctrl_outl((mac[2]), SH_ETH_MALR); | |
362 | +} | |
363 | + | |
285 | 364 | #define SW4140 0xBA201000 |
286 | 365 | #define FPGA_OUT 0xBA200400 |
287 | 366 | #define PORT_HIZA 0xA4050158 |
... | ... | @@ -302,7 +381,8 @@ |
302 | 381 | ctrl_outw(ctrl_inw(FPGA_OUT) & |
303 | 382 | ~((1 << 1) | /* LAN */ |
304 | 383 | (1 << 6) | /* VIDEO DAC */ |
305 | - (1 << 12)), /* USB0 */ | |
384 | + (1 << 12) | /* USB0 */ | |
385 | + (1 << 14)), /* RMII */ | |
306 | 386 | FPGA_OUT); |
307 | 387 | |
308 | 388 | /* enable IRQ 0,1,2 */ |
... | ... | @@ -374,7 +454,7 @@ |
374 | 454 | gpio_request(GPIO_FN_VIO0_CLK, NULL); |
375 | 455 | gpio_request(GPIO_FN_VIO0_FLD, NULL); |
376 | 456 | gpio_request(GPIO_FN_VIO0_HD, NULL); |
377 | - platform_resource_setup_memory(&ceu0_device, "ceu", 4 << 20); | |
457 | + platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20); | |
378 | 458 | |
379 | 459 | /* enable CEU1 */ |
380 | 460 | gpio_request(GPIO_FN_VIO1_D7, NULL); |
... | ... | @@ -389,7 +469,7 @@ |
389 | 469 | gpio_request(GPIO_FN_VIO1_HD, NULL); |
390 | 470 | gpio_request(GPIO_FN_VIO1_VD, NULL); |
391 | 471 | gpio_request(GPIO_FN_VIO1_CLK, NULL); |
392 | - platform_resource_setup_memory(&ceu1_device, "ceu", 4 << 20); | |
472 | + platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20); | |
393 | 473 | |
394 | 474 | /* KEYSC */ |
395 | 475 | gpio_request(GPIO_FN_KEYOUT5_IN5, NULL); |
... | ... | @@ -404,6 +484,28 @@ |
404 | 484 | gpio_request(GPIO_FN_KEYOUT1, NULL); |
405 | 485 | gpio_request(GPIO_FN_KEYOUT0, NULL); |
406 | 486 | |
487 | + /* | |
488 | + * enable SH-Eth | |
489 | + * | |
490 | + * please remove J33 pin from your board !! | |
491 | + * | |
492 | + * ms7724 board should not use GPIO_FN_LNKSTA pin | |
493 | + * So, This time PTX5 is set to input pin | |
494 | + */ | |
495 | + gpio_request(GPIO_FN_RMII_RXD0, NULL); | |
496 | + gpio_request(GPIO_FN_RMII_RXD1, NULL); | |
497 | + gpio_request(GPIO_FN_RMII_TXD0, NULL); | |
498 | + gpio_request(GPIO_FN_RMII_TXD1, NULL); | |
499 | + gpio_request(GPIO_FN_RMII_REF_CLK, NULL); | |
500 | + gpio_request(GPIO_FN_RMII_TX_EN, NULL); | |
501 | + gpio_request(GPIO_FN_RMII_RX_ER, NULL); | |
502 | + gpio_request(GPIO_FN_RMII_CRS_DV, NULL); | |
503 | + gpio_request(GPIO_FN_MDIO, NULL); | |
504 | + gpio_request(GPIO_FN_MDC, NULL); | |
505 | + gpio_request(GPIO_PTX5, NULL); | |
506 | + gpio_direction_input(GPIO_PTX5); | |
507 | + sh_eth_init(); | |
508 | + | |
407 | 509 | if (sw & SW41_B) { |
408 | 510 | /* SVGA */ |
409 | 511 | lcdc_info.ch[0].lcd_cfg.xres = 800; |
... | ... | @@ -437,7 +539,7 @@ |
437 | 539 | } |
438 | 540 | |
439 | 541 | return platform_add_devices(ms7724se_devices, |
440 | - ARRAY_SIZE(ms7724se_devices)); | |
542 | + ARRAY_SIZE(ms7724se_devices)); | |
441 | 543 | } |
442 | 544 | device_initcall(devices_setup); |
443 | 545 |
arch/sh/configs/migor_defconfig
... | ... | @@ -309,7 +309,7 @@ |
309 | 309 | CONFIG_BOOT_LINK_OFFSET=0x00800000 |
310 | 310 | CONFIG_ENTRY_OFFSET=0x00001000 |
311 | 311 | CONFIG_CMDLINE_BOOL=y |
312 | -CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ip=on root=/dev/nfs ip=dhcp" | |
312 | +CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 earlyprintk=serial ip=on root=/dev/nfs ip=dhcp" | |
313 | 313 | |
314 | 314 | # |
315 | 315 | # Bus options |
... | ... | @@ -858,7 +858,35 @@ |
858 | 858 | # |
859 | 859 | # CONFIG_VGASTATE is not set |
860 | 860 | # CONFIG_VIDEO_OUTPUT_CONTROL is not set |
861 | -# CONFIG_FB is not set | |
861 | +CONFIG_FB=y | |
862 | +# CONFIG_FIRMWARE_EDID is not set | |
863 | +# CONFIG_FB_DDC is not set | |
864 | +# CONFIG_FB_BOOT_VESA_SUPPORT is not set | |
865 | +# CONFIG_FB_CFB_FILLRECT is not set | |
866 | +# CONFIG_FB_CFB_COPYAREA is not set | |
867 | +# CONFIG_FB_CFB_IMAGEBLIT is not set | |
868 | +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set | |
869 | +CONFIG_FB_SYS_FILLRECT=y | |
870 | +CONFIG_FB_SYS_COPYAREA=y | |
871 | +CONFIG_FB_SYS_IMAGEBLIT=y | |
872 | +# CONFIG_FB_FOREIGN_ENDIAN is not set | |
873 | +CONFIG_FB_SYS_FOPS=y | |
874 | +CONFIG_FB_DEFERRED_IO=y | |
875 | +# CONFIG_FB_SVGALIB is not set | |
876 | +# CONFIG_FB_MACMODES is not set | |
877 | +# CONFIG_FB_BACKLIGHT is not set | |
878 | +# CONFIG_FB_MODE_HELPERS is not set | |
879 | +# CONFIG_FB_TILEBLITTING is not set | |
880 | + | |
881 | +# | |
882 | +# Frame buffer hardware drivers | |
883 | +# | |
884 | +# CONFIG_FB_S1D13XXX is not set | |
885 | +CONFIG_FB_SH_MOBILE_LCDC=y | |
886 | +# CONFIG_FB_VIRTUAL is not set | |
887 | +# CONFIG_FB_METRONOME is not set | |
888 | +# CONFIG_FB_MB862XX is not set | |
889 | +# CONFIG_FB_BROADSHEET is not set | |
862 | 890 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set |
863 | 891 | |
864 | 892 | # |
... | ... | @@ -870,6 +898,27 @@ |
870 | 898 | # Console display driver support |
871 | 899 | # |
872 | 900 | CONFIG_DUMMY_CONSOLE=y |
901 | +CONFIG_FRAMEBUFFER_CONSOLE=y | |
902 | +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | |
903 | +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set | |
904 | +CONFIG_FONTS=y | |
905 | +# CONFIG_FONT_8x8 is not set | |
906 | +# CONFIG_FONT_8x16 is not set | |
907 | +# CONFIG_FONT_6x11 is not set | |
908 | +# CONFIG_FONT_7x14 is not set | |
909 | +# CONFIG_FONT_PEARL_8x8 is not set | |
910 | +# CONFIG_FONT_ACORN_8x8 is not set | |
911 | +CONFIG_FONT_MINI_4x6=y | |
912 | +# CONFIG_FONT_SUN8x16 is not set | |
913 | +# CONFIG_FONT_SUN12x22 is not set | |
914 | +# CONFIG_FONT_10x18 is not set | |
915 | +CONFIG_LOGO=y | |
916 | +# CONFIG_LOGO_LINUX_MONO is not set | |
917 | +# CONFIG_LOGO_LINUX_VGA16 is not set | |
918 | +# CONFIG_LOGO_LINUX_CLUT224 is not set | |
919 | +# CONFIG_LOGO_SUPERH_MONO is not set | |
920 | +CONFIG_LOGO_SUPERH_VGA16=y | |
921 | +# CONFIG_LOGO_SUPERH_CLUT224 is not set | |
873 | 922 | # CONFIG_SOUND is not set |
874 | 923 | CONFIG_HID_SUPPORT=y |
875 | 924 | CONFIG_HID=y |
arch/sh/configs/se7724_defconfig
1 | 1 | # |
2 | 2 | # Automatically generated make config: don't edit |
3 | 3 | # Linux kernel version: 2.6.30 |
4 | -# Thu Jun 18 16:09:05 2009 | |
4 | +# Mon Jun 29 16:28:43 2009 | |
5 | 5 | # |
6 | 6 | CONFIG_SUPERH=y |
7 | 7 | CONFIG_SUPERH32=y |
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | CONFIG_GENERIC_HARDIRQS=y |
15 | 15 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y |
16 | 16 | CONFIG_GENERIC_IRQ_PROBE=y |
17 | +CONFIG_IRQ_PER_CPU=y | |
17 | 18 | CONFIG_GENERIC_GPIO=y |
18 | 19 | CONFIG_GENERIC_TIME=y |
19 | 20 | CONFIG_GENERIC_CLOCKEVENTS=y |
20 | 21 | |
... | ... | @@ -28,7 +29,9 @@ |
28 | 29 | # CONFIG_ARCH_HAS_ILOG2_U64 is not set |
29 | 30 | CONFIG_ARCH_NO_VIRT_TO_BUS=y |
30 | 31 | CONFIG_ARCH_HAS_DEFAULT_IDLE=y |
32 | +CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y | |
31 | 33 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
34 | +CONFIG_CONSTRUCTORS=y | |
32 | 35 | |
33 | 36 | # |
34 | 37 | # General setup |
35 | 38 | |
... | ... | @@ -88,10 +91,12 @@ |
88 | 91 | CONFIG_EVENTFD=y |
89 | 92 | CONFIG_SHMEM=y |
90 | 93 | CONFIG_AIO=y |
94 | +CONFIG_HAVE_PERF_COUNTERS=y | |
91 | 95 | |
92 | 96 | # |
93 | 97 | # Performance Counters |
94 | 98 | # |
99 | +# CONFIG_PERF_COUNTERS is not set | |
95 | 100 | CONFIG_VM_EVENT_COUNTERS=y |
96 | 101 | # CONFIG_STRIP_ASM_SYMS is not set |
97 | 102 | CONFIG_COMPAT_BRK=y |
... | ... | @@ -107,6 +112,10 @@ |
107 | 112 | CONFIG_HAVE_ARCH_TRACEHOOK=y |
108 | 113 | CONFIG_HAVE_CLK=y |
109 | 114 | CONFIG_HAVE_DMA_API_DEBUG=y |
115 | + | |
116 | +# | |
117 | +# GCOV-based kernel profiling | |
118 | +# | |
110 | 119 | # CONFIG_SLOW_WORK is not set |
111 | 120 | CONFIG_HAVE_GENERIC_DMA_COHERENT=y |
112 | 121 | CONFIG_SLABINFO=y |
... | ... | @@ -119,7 +128,7 @@ |
119 | 128 | # CONFIG_MODVERSIONS is not set |
120 | 129 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
121 | 130 | CONFIG_BLOCK=y |
122 | -# CONFIG_LBD is not set | |
131 | +CONFIG_LBDAF=y | |
123 | 132 | # CONFIG_BLK_DEV_BSG is not set |
124 | 133 | # CONFIG_BLK_DEV_INTEGRITY is not set |
125 | 134 | |
... | ... | @@ -584,7 +593,6 @@ |
584 | 593 | # CONFIG_SCSI_SRP_ATTRS is not set |
585 | 594 | CONFIG_SCSI_LOWLEVEL=y |
586 | 595 | # CONFIG_ISCSI_TCP is not set |
587 | -# CONFIG_SCSI_BNX2_ISCSI is not set | |
588 | 596 | # CONFIG_LIBFC is not set |
589 | 597 | # CONFIG_LIBFCOE is not set |
590 | 598 | # CONFIG_SCSI_DEBUG is not set |
... | ... | @@ -624,7 +632,7 @@ |
624 | 632 | CONFIG_MII=y |
625 | 633 | # CONFIG_AX88796 is not set |
626 | 634 | # CONFIG_STNIC is not set |
627 | -# CONFIG_SH_ETH is not set | |
635 | +CONFIG_SH_ETH=y | |
628 | 636 | CONFIG_SMC91X=y |
629 | 637 | # CONFIG_ENC28J60 is not set |
630 | 638 | # CONFIG_ETHOC is not set |
... | ... | @@ -801,6 +809,11 @@ |
801 | 809 | # |
802 | 810 | # CONFIG_SPI_SPIDEV is not set |
803 | 811 | # CONFIG_SPI_TLE62X0 is not set |
812 | + | |
813 | +# | |
814 | +# PPS support | |
815 | +# | |
816 | +# CONFIG_PPS is not set | |
804 | 817 | CONFIG_ARCH_REQUIRE_GPIOLIB=y |
805 | 818 | CONFIG_GPIOLIB=y |
806 | 819 | # CONFIG_GPIO_SYSFS is not set |
... | ... | @@ -851,6 +864,8 @@ |
851 | 864 | # CONFIG_MFD_WM8400 is not set |
852 | 865 | # CONFIG_MFD_WM8350_I2C is not set |
853 | 866 | # CONFIG_MFD_PCF50633 is not set |
867 | +# CONFIG_AB3100_CORE is not set | |
868 | +# CONFIG_EZX_PCAP is not set | |
854 | 869 | # CONFIG_REGULATOR is not set |
855 | 870 | CONFIG_MEDIA_SUPPORT=y |
856 | 871 | |
... | ... | @@ -1196,6 +1211,7 @@ |
1196 | 1211 | # CONFIG_RTC_DRV_S35390A is not set |
1197 | 1212 | # CONFIG_RTC_DRV_FM3130 is not set |
1198 | 1213 | # CONFIG_RTC_DRV_RX8581 is not set |
1214 | +# CONFIG_RTC_DRV_RX8025 is not set | |
1199 | 1215 | |
1200 | 1216 | # |
1201 | 1217 | # SPI RTC drivers |
... | ... | @@ -1260,6 +1276,7 @@ |
1260 | 1276 | # CONFIG_JFS_FS is not set |
1261 | 1277 | CONFIG_FS_POSIX_ACL=y |
1262 | 1278 | # CONFIG_XFS_FS is not set |
1279 | +# CONFIG_GFS2_FS is not set | |
1263 | 1280 | # CONFIG_OCFS2_FS is not set |
1264 | 1281 | # CONFIG_BTRFS_FS is not set |
1265 | 1282 | CONFIG_FILE_LOCKING=y |
arch/sh/include/asm/perf_counter.h
arch/sh/include/asm/syscall_32.h
arch/sh/include/mach-se/mach/se7724.h
... | ... | @@ -20,6 +20,11 @@ |
20 | 20 | */ |
21 | 21 | #include <asm/addrspace.h> |
22 | 22 | |
23 | +/* SH Eth */ | |
24 | +#define SH_ETH_ADDR (0xA4600000) | |
25 | +#define SH_ETH_MAHR (SH_ETH_ADDR + 0x1C0) | |
26 | +#define SH_ETH_MALR (SH_ETH_ADDR + 0x1C8) | |
27 | + | |
23 | 28 | #define PA_LED (0xba203000) /* 8bit LED */ |
24 | 29 | #define IRQ_MODE (0xba200010) |
25 | 30 | #define IRQ0_SR (0xba200014) |
arch/sh/mm/fault_32.c
... | ... | @@ -15,12 +15,28 @@ |
15 | 15 | #include <linux/mm.h> |
16 | 16 | #include <linux/hardirq.h> |
17 | 17 | #include <linux/kprobes.h> |
18 | -#include <linux/marker.h> | |
18 | +#include <linux/perf_counter.h> | |
19 | 19 | #include <asm/io_trapped.h> |
20 | 20 | #include <asm/system.h> |
21 | 21 | #include <asm/mmu_context.h> |
22 | 22 | #include <asm/tlbflush.h> |
23 | 23 | |
24 | +static inline int notify_page_fault(struct pt_regs *regs, int trap) | |
25 | +{ | |
26 | + int ret = 0; | |
27 | + | |
28 | +#ifdef CONFIG_KPROBES | |
29 | + if (!user_mode(regs)) { | |
30 | + preempt_disable(); | |
31 | + if (kprobe_running() && kprobe_fault_handler(regs, trap)) | |
32 | + ret = 1; | |
33 | + preempt_enable(); | |
34 | + } | |
35 | +#endif | |
36 | + | |
37 | + return ret; | |
38 | +} | |
39 | + | |
24 | 40 | /* |
25 | 41 | * This routine handles page faults. It determines the address, |
26 | 42 | * and the problem, and then passes it off to one of the appropriate |
27 | 43 | |
28 | 44 | |
29 | 45 | |
... | ... | @@ -87,13 +103,16 @@ |
87 | 103 | return; |
88 | 104 | } |
89 | 105 | |
106 | + mm = tsk->mm; | |
107 | + | |
108 | + if (unlikely(notify_page_fault(regs, lookup_exception_vector()))) | |
109 | + return; | |
110 | + | |
90 | 111 | /* Only enable interrupts if they were on before the fault */ |
91 | - if ((regs->sr & SR_IMASK) != SR_IMASK) { | |
92 | - trace_hardirqs_on(); | |
112 | + if ((regs->sr & SR_IMASK) != SR_IMASK) | |
93 | 113 | local_irq_enable(); |
94 | - } | |
95 | 114 | |
96 | - mm = tsk->mm; | |
115 | + perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); | |
97 | 116 | |
98 | 117 | /* |
99 | 118 | * If we're in an interrupt or have no user |
100 | 119 | |
101 | 120 | |
... | ... | @@ -141,10 +160,15 @@ |
141 | 160 | goto do_sigbus; |
142 | 161 | BUG(); |
143 | 162 | } |
144 | - if (fault & VM_FAULT_MAJOR) | |
163 | + if (fault & VM_FAULT_MAJOR) { | |
145 | 164 | tsk->maj_flt++; |
146 | - else | |
165 | + perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, | |
166 | + regs, address); | |
167 | + } else { | |
147 | 168 | tsk->min_flt++; |
169 | + perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, | |
170 | + regs, address); | |
171 | + } | |
148 | 172 | |
149 | 173 | up_read(&mm->mmap_sem); |
150 | 174 | return; |
... | ... | @@ -245,22 +269,6 @@ |
245 | 269 | goto no_context; |
246 | 270 | } |
247 | 271 | |
248 | -static inline int notify_page_fault(struct pt_regs *regs, int trap) | |
249 | -{ | |
250 | - int ret = 0; | |
251 | - | |
252 | -#ifdef CONFIG_KPROBES | |
253 | - if (!user_mode(regs)) { | |
254 | - preempt_disable(); | |
255 | - if (kprobe_running() && kprobe_fault_handler(regs, trap)) | |
256 | - ret = 1; | |
257 | - preempt_enable(); | |
258 | - } | |
259 | -#endif | |
260 | - | |
261 | - return ret; | |
262 | -} | |
263 | - | |
264 | 272 | /* |
265 | 273 | * Called with interrupts disabled. |
266 | 274 | */ |
... | ... | @@ -273,12 +281,7 @@ |
273 | 281 | pmd_t *pmd; |
274 | 282 | pte_t *pte; |
275 | 283 | pte_t entry; |
276 | - int ret = 0; | |
277 | - | |
278 | - if (notify_page_fault(regs, lookup_exception_vector())) | |
279 | - goto out; | |
280 | - | |
281 | - ret = 1; | |
284 | + int ret = 1; | |
282 | 285 | |
283 | 286 | /* |
284 | 287 | * We don't take page faults for P1, P2, and parts of P4, these |
arch/sh/mm/tlbflush_64.c
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | * |
4 | 4 | * Copyright (C) 2000, 2001 Paolo Alberelli |
5 | 5 | * Copyright (C) 2003 Richard Curnow (/proc/tlb, bug fixes) |
6 | - * Copyright (C) 2003 Paul Mundt | |
6 | + * Copyright (C) 2003 - 2009 Paul Mundt | |
7 | 7 | * |
8 | 8 | * This file is subject to the terms and conditions of the GNU General Public |
9 | 9 | * License. See the file "COPYING" in the main directory of this archive |
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 | #include <linux/mman.h> |
21 | 21 | #include <linux/mm.h> |
22 | 22 | #include <linux/smp.h> |
23 | +#include <linux/perf_counter.h> | |
23 | 24 | #include <linux/interrupt.h> |
24 | 25 | #include <asm/system.h> |
25 | 26 | #include <asm/io.h> |
... | ... | @@ -115,6 +116,8 @@ |
115 | 116 | /* Not an IO address, so reenable interrupts */ |
116 | 117 | local_irq_enable(); |
117 | 118 | |
119 | + perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); | |
120 | + | |
118 | 121 | /* |
119 | 122 | * If we're in an interrupt or have no user |
120 | 123 | * context, we must not take the fault.. |
121 | 124 | |
122 | 125 | |
... | ... | @@ -195,10 +198,16 @@ |
195 | 198 | goto do_sigbus; |
196 | 199 | BUG(); |
197 | 200 | } |
198 | - if (fault & VM_FAULT_MAJOR) | |
201 | + | |
202 | + if (fault & VM_FAULT_MAJOR) { | |
199 | 203 | tsk->maj_flt++; |
200 | - else | |
204 | + perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, | |
205 | + regs, address); | |
206 | + } else { | |
201 | 207 | tsk->min_flt++; |
208 | + perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, | |
209 | + regs, address); | |
210 | + } | |
202 | 211 | |
203 | 212 | /* If we get here, the page fault has been handled. Do the TLB refill |
204 | 213 | now from the newly-setup PTE, to avoid having to fault again right |
drivers/clocksource/sh_tmu.c
drivers/video/sh_mobile_lcdcfb.c
... | ... | @@ -17,6 +17,7 @@ |
17 | 17 | #include <linux/platform_device.h> |
18 | 18 | #include <linux/dma-mapping.h> |
19 | 19 | #include <linux/interrupt.h> |
20 | +#include <linux/vmalloc.h> | |
20 | 21 | #include <video/sh_mobile_lcdc.h> |
21 | 22 | #include <asm/atomic.h> |
22 | 23 | |
... | ... | @@ -33,6 +34,7 @@ |
33 | 34 | struct fb_info info; |
34 | 35 | dma_addr_t dma_handle; |
35 | 36 | struct fb_deferred_io defio; |
37 | + struct scatterlist *sglist; | |
36 | 38 | unsigned long frame_end; |
37 | 39 | wait_queue_head_t frame_end_wait; |
38 | 40 | }; |
39 | 41 | |
40 | 42 | |
41 | 43 | |
... | ... | @@ -206,16 +208,38 @@ |
206 | 208 | static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv) {} |
207 | 209 | #endif |
208 | 210 | |
211 | +static int sh_mobile_lcdc_sginit(struct fb_info *info, | |
212 | + struct list_head *pagelist) | |
213 | +{ | |
214 | + struct sh_mobile_lcdc_chan *ch = info->par; | |
215 | + unsigned int nr_pages_max = info->fix.smem_len >> PAGE_SHIFT; | |
216 | + struct page *page; | |
217 | + int nr_pages = 0; | |
218 | + | |
219 | + sg_init_table(ch->sglist, nr_pages_max); | |
220 | + | |
221 | + list_for_each_entry(page, pagelist, lru) | |
222 | + sg_set_page(&ch->sglist[nr_pages++], page, PAGE_SIZE, 0); | |
223 | + | |
224 | + return nr_pages; | |
225 | +} | |
226 | + | |
209 | 227 | static void sh_mobile_lcdc_deferred_io(struct fb_info *info, |
210 | 228 | struct list_head *pagelist) |
211 | 229 | { |
212 | 230 | struct sh_mobile_lcdc_chan *ch = info->par; |
231 | + unsigned int nr_pages; | |
213 | 232 | |
214 | 233 | /* enable clocks before accessing hardware */ |
215 | 234 | sh_mobile_lcdc_clk_on(ch->lcdc); |
216 | 235 | |
236 | + nr_pages = sh_mobile_lcdc_sginit(info, pagelist); | |
237 | + dma_map_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE); | |
238 | + | |
217 | 239 | /* trigger panel update */ |
218 | 240 | lcdc_write_chan(ch, LDSM2R, 1); |
241 | + | |
242 | + dma_unmap_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE); | |
219 | 243 | } |
220 | 244 | |
221 | 245 | static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info) |
222 | 246 | |
223 | 247 | |
224 | 248 | |
225 | 249 | |
... | ... | @@ -846,21 +870,31 @@ |
846 | 870 | } |
847 | 871 | |
848 | 872 | for (i = 0; i < j; i++) { |
849 | - error = register_framebuffer(&priv->ch[i].info); | |
873 | + struct sh_mobile_lcdc_chan *ch = priv->ch + i; | |
874 | + | |
875 | + info = &ch->info; | |
876 | + | |
877 | + if (info->fbdefio) { | |
878 | + priv->ch->sglist = vmalloc(sizeof(struct scatterlist) * | |
879 | + info->fix.smem_len >> PAGE_SHIFT); | |
880 | + if (!priv->ch->sglist) { | |
881 | + dev_err(&pdev->dev, "cannot allocate sglist\n"); | |
882 | + goto err1; | |
883 | + } | |
884 | + } | |
885 | + | |
886 | + error = register_framebuffer(info); | |
850 | 887 | if (error < 0) |
851 | 888 | goto err1; |
852 | - } | |
853 | 889 | |
854 | - for (i = 0; i < j; i++) { | |
855 | - info = &priv->ch[i].info; | |
856 | 890 | dev_info(info->dev, |
857 | 891 | "registered %s/%s as %dx%d %dbpp.\n", |
858 | 892 | pdev->name, |
859 | - (priv->ch[i].cfg.chan == LCDC_CHAN_MAINLCD) ? | |
893 | + (ch->cfg.chan == LCDC_CHAN_MAINLCD) ? | |
860 | 894 | "mainlcd" : "sublcd", |
861 | - (int) priv->ch[i].cfg.lcd_cfg.xres, | |
862 | - (int) priv->ch[i].cfg.lcd_cfg.yres, | |
863 | - priv->ch[i].cfg.bpp); | |
895 | + (int) ch->cfg.lcd_cfg.xres, | |
896 | + (int) ch->cfg.lcd_cfg.yres, | |
897 | + ch->cfg.bpp); | |
864 | 898 | |
865 | 899 | /* deferred io mode: disable clock to save power */ |
866 | 900 | if (info->fbdefio) |
... | ... | @@ -891,6 +925,9 @@ |
891 | 925 | |
892 | 926 | if (!info->device) |
893 | 927 | continue; |
928 | + | |
929 | + if (priv->ch[i].sglist) | |
930 | + vfree(priv->ch[i].sglist); | |
894 | 931 | |
895 | 932 | dma_free_coherent(&pdev->dev, info->fix.smem_len, |
896 | 933 | info->screen_base, priv->ch[i].dma_handle); |
mm/nommu.c
... | ... | @@ -238,6 +238,27 @@ |
238 | 238 | } |
239 | 239 | EXPORT_SYMBOL(get_user_pages); |
240 | 240 | |
241 | +/** | |
242 | + * follow_pfn - look up PFN at a user virtual address | |
243 | + * @vma: memory mapping | |
244 | + * @address: user virtual address | |
245 | + * @pfn: location to store found PFN | |
246 | + * | |
247 | + * Only IO mappings and raw PFN mappings are allowed. | |
248 | + * | |
249 | + * Returns zero and the pfn at @pfn on success, -ve otherwise. | |
250 | + */ | |
251 | +int follow_pfn(struct vm_area_struct *vma, unsigned long address, | |
252 | + unsigned long *pfn) | |
253 | +{ | |
254 | + if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) | |
255 | + return -EINVAL; | |
256 | + | |
257 | + *pfn = address >> PAGE_SHIFT; | |
258 | + return 0; | |
259 | +} | |
260 | +EXPORT_SYMBOL(follow_pfn); | |
261 | + | |
241 | 262 | DEFINE_RWLOCK(vmlist_lock); |
242 | 263 | struct vm_struct *vmlist; |
243 | 264 |
tools/perf/perf.h
... | ... | @@ -19,6 +19,16 @@ |
19 | 19 | #define cpu_relax() asm volatile("" ::: "memory"); |
20 | 20 | #endif |
21 | 21 | |
22 | +#ifdef __sh__ | |
23 | +#include "../../arch/sh/include/asm/unistd.h" | |
24 | +#if defined(__SH4A__) || defined(__SH5__) | |
25 | +# define rmb() asm volatile("synco" ::: "memory") | |
26 | +#else | |
27 | +# define rmb() asm volatile("" ::: "memory") | |
28 | +#endif | |
29 | +#define cpu_relax() asm volatile("" ::: "memory") | |
30 | +#endif | |
31 | + | |
22 | 32 | #include <time.h> |
23 | 33 | #include <unistd.h> |
24 | 34 | #include <sys/types.h> |