diff options
451 files changed, 3845 insertions, 3317 deletions
diff --git a/Documentation/ABI/testing/sysfs-block b/Documentation/ABI/testing/sysfs-block index 2b5d56127fce..c1eb41cb9876 100644 --- a/Documentation/ABI/testing/sysfs-block +++ b/Documentation/ABI/testing/sysfs-block | |||
@@ -206,16 +206,3 @@ Description: | |||
206 | when a discarded area is read the discard_zeroes_data | 206 | when a discarded area is read the discard_zeroes_data |
207 | parameter will be set to one. Otherwise it will be 0 and | 207 | parameter will be set to one. Otherwise it will be 0 and |
208 | the result of reading a discarded area is undefined. | 208 | the result of reading a discarded area is undefined. |
209 | What: /sys/block/<disk>/alias | ||
210 | Date: Aug 2011 | ||
211 | Contact: Nao Nishijima <nao.nishijima.xt@hitachi.com> | ||
212 | Description: | ||
213 | A raw device name of a disk does not always point a same disk | ||
214 | each boot-up time. Therefore, users have to use persistent | ||
215 | device names, which udev creates when the kernel finds a disk, | ||
216 | instead of raw device name. However, kernel doesn't show those | ||
217 | persistent names on its messages (e.g. dmesg). | ||
218 | This file can store an alias of the disk and it would be | ||
219 | appeared in kernel messages if it is set. A disk can have an | ||
220 | alias which length is up to 255bytes. Users can use alphabets, | ||
221 | numbers, "-" and "_" in alias name. This file is writeonce. | ||
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl index 54883de5d5f9..ac3d0018140c 100644 --- a/Documentation/DocBook/uio-howto.tmpl +++ b/Documentation/DocBook/uio-howto.tmpl | |||
@@ -521,6 +521,11 @@ Here's a description of the fields of <varname>struct uio_mem</varname>: | |||
521 | 521 | ||
522 | <itemizedlist> | 522 | <itemizedlist> |
523 | <listitem><para> | 523 | <listitem><para> |
524 | <varname>const char *name</varname>: Optional. Set this to help identify | ||
525 | the memory region, it will show up in the corresponding sysfs node. | ||
526 | </para></listitem> | ||
527 | |||
528 | <listitem><para> | ||
524 | <varname>int memtype</varname>: Required if the mapping is used. Set this to | 529 | <varname>int memtype</varname>: Required if the mapping is used. Set this to |
525 | <varname>UIO_MEM_PHYS</varname> if you you have physical memory on your | 530 | <varname>UIO_MEM_PHYS</varname> if you you have physical memory on your |
526 | card to be mapped. Use <varname>UIO_MEM_LOGICAL</varname> for logical | 531 | card to be mapped. Use <varname>UIO_MEM_LOGICAL</varname> for logical |
@@ -553,7 +558,7 @@ instead to remember such an address. | |||
553 | </itemizedlist> | 558 | </itemizedlist> |
554 | 559 | ||
555 | <para> | 560 | <para> |
556 | Please do not touch the <varname>kobj</varname> element of | 561 | Please do not touch the <varname>map</varname> element of |
557 | <varname>struct uio_mem</varname>! It is used by the UIO framework | 562 | <varname>struct uio_mem</varname>! It is used by the UIO framework |
558 | to set up sysfs files for this mapping. Simply leave it alone. | 563 | to set up sysfs files for this mapping. Simply leave it alone. |
559 | </para> | 564 | </para> |
diff --git a/Documentation/blockdev/cciss.txt b/Documentation/blockdev/cciss.txt index 71464e09ec18..b79d0a13e7cd 100644 --- a/Documentation/blockdev/cciss.txt +++ b/Documentation/blockdev/cciss.txt | |||
@@ -98,14 +98,12 @@ You must enable "SCSI tape drive support for Smart Array 5xxx" and | |||
98 | "SCSI support" in your kernel configuration to be able to use SCSI | 98 | "SCSI support" in your kernel configuration to be able to use SCSI |
99 | tape drives with your Smart Array 5xxx controller. | 99 | tape drives with your Smart Array 5xxx controller. |
100 | 100 | ||
101 | Additionally, note that the driver will not engage the SCSI core at init | 101 | Additionally, note that the driver will engage the SCSI core at init |
102 | time. The driver must be directed to dynamically engage the SCSI core via | 102 | time if any tape drives or medium changers are detected. The driver may |
103 | the /proc filesystem entry which the "block" side of the driver creates as | 103 | also be directed to dynamically engage the SCSI core via the /proc filesystem |
104 | /proc/driver/cciss/cciss* at runtime. This is because at driver init time, | 104 | entry which the "block" side of the driver creates as |
105 | the SCSI core may not yet be initialized (because the driver is a block | 105 | /proc/driver/cciss/cciss* at runtime. This is best done via a script. |
106 | driver) and attempting to register it with the SCSI core in such a case | 106 | |
107 | would cause a hang. This is best done via an initialization script | ||
108 | (typically in /etc/init.d, but could vary depending on distribution). | ||
109 | For example: | 107 | For example: |
110 | 108 | ||
111 | for x in /proc/driver/cciss/cciss[0-9]* | 109 | for x in /proc/driver/cciss/cciss[0-9]* |
diff --git a/Documentation/i2c/ten-bit-addresses b/Documentation/i2c/ten-bit-addresses index e9890709c508..cdfe13901b99 100644 --- a/Documentation/i2c/ten-bit-addresses +++ b/Documentation/i2c/ten-bit-addresses | |||
@@ -1,22 +1,24 @@ | |||
1 | The I2C protocol knows about two kinds of device addresses: normal 7 bit | 1 | The I2C protocol knows about two kinds of device addresses: normal 7 bit |
2 | addresses, and an extended set of 10 bit addresses. The sets of addresses | 2 | addresses, and an extended set of 10 bit addresses. The sets of addresses |
3 | do not intersect: the 7 bit address 0x10 is not the same as the 10 bit | 3 | do not intersect: the 7 bit address 0x10 is not the same as the 10 bit |
4 | address 0x10 (though a single device could respond to both of them). You | 4 | address 0x10 (though a single device could respond to both of them). |
5 | select a 10 bit address by adding an extra byte after the address | ||
6 | byte: | ||
7 | S Addr7 Rd/Wr .... | ||
8 | becomes | ||
9 | S 11110 Addr10 Rd/Wr | ||
10 | S is the start bit, Rd/Wr the read/write bit, and if you count the number | ||
11 | of bits, you will see the there are 8 after the S bit for 7 bit addresses, | ||
12 | and 16 after the S bit for 10 bit addresses. | ||
13 | 5 | ||
14 | WARNING! The current 10 bit address support is EXPERIMENTAL. There are | 6 | I2C messages to and from 10-bit address devices have a different format. |
15 | several places in the code that will cause SEVERE PROBLEMS with 10 bit | 7 | See the I2C specification for the details. |
16 | addresses, even though there is some basic handling and hooks. Also, | ||
17 | almost no supported adapter handles the 10 bit addresses correctly. | ||
18 | 8 | ||
19 | As soon as a real 10 bit address device is spotted 'in the wild', we | 9 | The current 10 bit address support is minimal. It should work, however |
20 | can and will add proper support. Right now, 10 bit address devices | 10 | you can expect some problems along the way: |
21 | are defined by the I2C protocol, but we have never seen a single device | 11 | * Not all bus drivers support 10-bit addresses. Some don't because the |
22 | which supports them. | 12 | hardware doesn't support them (SMBus doesn't require 10-bit address |
13 | support for example), some don't because nobody bothered adding the | ||
14 | code (or it's there but not working properly.) Software implementation | ||
15 | (i2c-algo-bit) is known to work. | ||
16 | * Some optional features do not support 10-bit addresses. This is the | ||
17 | case of automatic detection and instantiation of devices by their, | ||
18 | drivers, for example. | ||
19 | * Many user-space packages (for example i2c-tools) lack support for | ||
20 | 10-bit addresses. | ||
21 | |||
22 | Note that 10-bit address devices are still pretty rare, so the limitations | ||
23 | listed above could stay for a long time, maybe even forever if nobody | ||
24 | needs them to be fixed. | ||
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index cb7f3148035d..f049a1ca186f 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -20,7 +20,7 @@ ip_no_pmtu_disc - BOOLEAN | |||
20 | default FALSE | 20 | default FALSE |
21 | 21 | ||
22 | min_pmtu - INTEGER | 22 | min_pmtu - INTEGER |
23 | default 562 - minimum discovered Path MTU | 23 | default 552 - minimum discovered Path MTU |
24 | 24 | ||
25 | route/max_size - INTEGER | 25 | route/max_size - INTEGER |
26 | Maximum number of routes allowed in the kernel. Increase | 26 | Maximum number of routes allowed in the kernel. Increase |
diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt index 079cb3df62cf..41c8378c0b2f 100644 --- a/Documentation/serial/serial-rs485.txt +++ b/Documentation/serial/serial-rs485.txt | |||
@@ -97,15 +97,23 @@ | |||
97 | 97 | ||
98 | struct serial_rs485 rs485conf; | 98 | struct serial_rs485 rs485conf; |
99 | 99 | ||
100 | /* Set RS485 mode: */ | 100 | /* Enable RS485 mode: */ |
101 | rs485conf.flags |= SER_RS485_ENABLED; | 101 | rs485conf.flags |= SER_RS485_ENABLED; |
102 | 102 | ||
103 | /* Set logical level for RTS pin equal to 1 when sending: */ | ||
104 | rs485conf.flags |= SER_RS485_RTS_ON_SEND; | ||
105 | /* or, set logical level for RTS pin equal to 0 when sending: */ | ||
106 | rs485conf.flags &= ~(SER_RS485_RTS_ON_SEND); | ||
107 | |||
108 | /* Set logical level for RTS pin equal to 1 after sending: */ | ||
109 | rs485conf.flags |= SER_RS485_RTS_AFTER_SEND; | ||
110 | /* or, set logical level for RTS pin equal to 0 after sending: */ | ||
111 | rs485conf.flags &= ~(SER_RS485_RTS_AFTER_SEND); | ||
112 | |||
103 | /* Set rts delay before send, if needed: */ | 113 | /* Set rts delay before send, if needed: */ |
104 | rs485conf.flags |= SER_RS485_RTS_BEFORE_SEND; | ||
105 | rs485conf.delay_rts_before_send = ...; | 114 | rs485conf.delay_rts_before_send = ...; |
106 | 115 | ||
107 | /* Set rts delay after send, if needed: */ | 116 | /* Set rts delay after send, if needed: */ |
108 | rs485conf.flags |= SER_RS485_RTS_AFTER_SEND; | ||
109 | rs485conf.delay_rts_after_send = ...; | 117 | rs485conf.delay_rts_after_send = ...; |
110 | 118 | ||
111 | /* Set this flag if you want to receive data even whilst sending data */ | 119 | /* Set this flag if you want to receive data even whilst sending data */ |
diff --git a/Documentation/sound/alsa/HD-Audio.txt b/Documentation/sound/alsa/HD-Audio.txt index 03e2771ddeef..91fee3b45fb8 100644 --- a/Documentation/sound/alsa/HD-Audio.txt +++ b/Documentation/sound/alsa/HD-Audio.txt | |||
@@ -579,7 +579,7 @@ Development Tree | |||
579 | ~~~~~~~~~~~~~~~~ | 579 | ~~~~~~~~~~~~~~~~ |
580 | The latest development codes for HD-audio are found on sound git tree: | 580 | The latest development codes for HD-audio are found on sound git tree: |
581 | 581 | ||
582 | - git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git | 582 | - git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git |
583 | 583 | ||
584 | The master branch or for-next branches can be used as the main | 584 | The master branch or for-next branches can be used as the main |
585 | development branches in general while the HD-audio specific patches | 585 | development branches in general while the HD-audio specific patches |
@@ -594,7 +594,7 @@ is, installed via the usual spells: configure, make and make | |||
594 | install(-modules). See INSTALL in the package. The snapshot tarballs | 594 | install(-modules). See INSTALL in the package. The snapshot tarballs |
595 | are found at: | 595 | are found at: |
596 | 596 | ||
597 | - ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/ | 597 | - ftp://ftp.suse.com/pub/people/tiwai/snapshot/ |
598 | 598 | ||
599 | 599 | ||
600 | Sending a Bug Report | 600 | Sending a Bug Report |
@@ -696,7 +696,7 @@ via hda-verb won't change the mixer value. | |||
696 | 696 | ||
697 | The hda-verb program is found in the ftp directory: | 697 | The hda-verb program is found in the ftp directory: |
698 | 698 | ||
699 | - ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/misc/ | 699 | - ftp://ftp.suse.com/pub/people/tiwai/misc/ |
700 | 700 | ||
701 | Also a git repository is available: | 701 | Also a git repository is available: |
702 | 702 | ||
@@ -764,7 +764,7 @@ operation, the jack plugging simulation, etc. | |||
764 | 764 | ||
765 | The package is found in: | 765 | The package is found in: |
766 | 766 | ||
767 | - ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/misc/ | 767 | - ftp://ftp.suse.com/pub/people/tiwai/misc/ |
768 | 768 | ||
769 | A git repository is available: | 769 | A git repository is available: |
770 | 770 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 1e1d1ffc542c..3523ab000f1f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1789,6 +1789,14 @@ F: include/net/cfg80211.h | |||
1789 | F: net/wireless/* | 1789 | F: net/wireless/* |
1790 | X: net/wireless/wext* | 1790 | X: net/wireless/wext* |
1791 | 1791 | ||
1792 | CHAR and MISC DRIVERS | ||
1793 | M: Arnd Bergmann <arnd@arndb.de> | ||
1794 | M: Greg Kroah-Hartman <greg@kroah.com> | ||
1795 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git | ||
1796 | S: Maintained | ||
1797 | F: drivers/char/* | ||
1798 | F: drivers/misc/* | ||
1799 | |||
1792 | CHECKPATCH | 1800 | CHECKPATCH |
1793 | M: Andy Whitcroft <apw@canonical.com> | 1801 | M: Andy Whitcroft <apw@canonical.com> |
1794 | S: Supported | 1802 | S: Supported |
@@ -1927,9 +1935,11 @@ S: Maintained | |||
1927 | F: drivers/connector/ | 1935 | F: drivers/connector/ |
1928 | 1936 | ||
1929 | CONTROL GROUPS (CGROUPS) | 1937 | CONTROL GROUPS (CGROUPS) |
1930 | M: Paul Menage <paul@paulmenage.org> | 1938 | M: Tejun Heo <tj@kernel.org> |
1931 | M: Li Zefan <lizf@cn.fujitsu.com> | 1939 | M: Li Zefan <lizf@cn.fujitsu.com> |
1932 | L: containers@lists.linux-foundation.org | 1940 | L: containers@lists.linux-foundation.org |
1941 | L: cgroups@vger.kernel.org | ||
1942 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git | ||
1933 | S: Maintained | 1943 | S: Maintained |
1934 | F: include/linux/cgroup* | 1944 | F: include/linux/cgroup* |
1935 | F: kernel/cgroup* | 1945 | F: kernel/cgroup* |
@@ -2584,7 +2594,7 @@ S: Maintained | |||
2584 | F: drivers/net/ethernet/i825xx/eexpress.* | 2594 | F: drivers/net/ethernet/i825xx/eexpress.* |
2585 | 2595 | ||
2586 | ETHERNET BRIDGE | 2596 | ETHERNET BRIDGE |
2587 | M: Stephen Hemminger <shemminger@linux-foundation.org> | 2597 | M: Stephen Hemminger <shemminger@vyatta.com> |
2588 | L: bridge@lists.linux-foundation.org | 2598 | L: bridge@lists.linux-foundation.org |
2589 | L: netdev@vger.kernel.org | 2599 | L: netdev@vger.kernel.org |
2590 | W: http://www.linuxfoundation.org/en/Net:Bridge | 2600 | W: http://www.linuxfoundation.org/en/Net:Bridge |
@@ -3718,7 +3728,7 @@ F: fs/jbd2/ | |||
3718 | F: include/linux/jbd2.h | 3728 | F: include/linux/jbd2.h |
3719 | 3729 | ||
3720 | JSM Neo PCI based serial card | 3730 | JSM Neo PCI based serial card |
3721 | M: Breno Leitao <leitao@linux.vnet.ibm.com> | 3731 | M: Lucas Tavares <lucaskt@linux.vnet.ibm.com> |
3722 | L: linux-serial@vger.kernel.org | 3732 | L: linux-serial@vger.kernel.org |
3723 | S: Maintained | 3733 | S: Maintained |
3724 | F: drivers/tty/serial/jsm/ | 3734 | F: drivers/tty/serial/jsm/ |
@@ -4304,6 +4314,7 @@ MEMORY RESOURCE CONTROLLER | |||
4304 | M: Balbir Singh <bsingharora@gmail.com> | 4314 | M: Balbir Singh <bsingharora@gmail.com> |
4305 | M: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> | 4315 | M: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> |
4306 | M: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 4316 | M: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> |
4317 | L: cgroups@vger.kernel.org | ||
4307 | L: linux-mm@kvack.org | 4318 | L: linux-mm@kvack.org |
4308 | S: Maintained | 4319 | S: Maintained |
4309 | F: mm/memcontrol.c | 4320 | F: mm/memcontrol.c |
@@ -4337,7 +4348,7 @@ MIPS | |||
4337 | M: Ralf Baechle <ralf@linux-mips.org> | 4348 | M: Ralf Baechle <ralf@linux-mips.org> |
4338 | L: linux-mips@linux-mips.org | 4349 | L: linux-mips@linux-mips.org |
4339 | W: http://www.linux-mips.org/ | 4350 | W: http://www.linux-mips.org/ |
4340 | T: git git://git.linux-mips.org/pub/scm/linux.git | 4351 | T: git git://git.linux-mips.org/pub/scm/ralf/linux.git |
4341 | Q: http://patchwork.linux-mips.org/project/linux-mips/list/ | 4352 | Q: http://patchwork.linux-mips.org/project/linux-mips/list/ |
4342 | S: Supported | 4353 | S: Supported |
4343 | F: Documentation/mips/ | 4354 | F: Documentation/mips/ |
@@ -4470,7 +4481,7 @@ S: Supported | |||
4470 | F: drivers/infiniband/hw/nes/ | 4481 | F: drivers/infiniband/hw/nes/ |
4471 | 4482 | ||
4472 | NETEM NETWORK EMULATOR | 4483 | NETEM NETWORK EMULATOR |
4473 | M: Stephen Hemminger <shemminger@linux-foundation.org> | 4484 | M: Stephen Hemminger <shemminger@vyatta.com> |
4474 | L: netem@lists.linux-foundation.org | 4485 | L: netem@lists.linux-foundation.org |
4475 | S: Maintained | 4486 | S: Maintained |
4476 | F: net/sched/sch_netem.c | 4487 | F: net/sched/sch_netem.c |
@@ -5985,7 +5996,7 @@ S: Maintained | |||
5985 | F: drivers/usb/misc/sisusbvga/ | 5996 | F: drivers/usb/misc/sisusbvga/ |
5986 | 5997 | ||
5987 | SKGE, SKY2 10/100/1000 GIGABIT ETHERNET DRIVERS | 5998 | SKGE, SKY2 10/100/1000 GIGABIT ETHERNET DRIVERS |
5988 | M: Stephen Hemminger <shemminger@linux-foundation.org> | 5999 | M: Stephen Hemminger <shemminger@vyatta.com> |
5989 | L: netdev@vger.kernel.org | 6000 | L: netdev@vger.kernel.org |
5990 | S: Maintained | 6001 | S: Maintained |
5991 | F: drivers/net/ethernet/marvell/sk* | 6002 | F: drivers/net/ethernet/marvell/sk* |
@@ -7433,7 +7444,8 @@ F: drivers/xen/*swiotlb* | |||
7433 | 7444 | ||
7434 | XFS FILESYSTEM | 7445 | XFS FILESYSTEM |
7435 | P: Silicon Graphics Inc | 7446 | P: Silicon Graphics Inc |
7436 | M: Alex Elder <aelder@sgi.com> | 7447 | M: Ben Myers <bpm@sgi.com> |
7448 | M: Alex Elder <elder@kernel.org> | ||
7437 | M: xfs-masters@oss.sgi.com | 7449 | M: xfs-masters@oss.sgi.com |
7438 | L: xfs@oss.sgi.com | 7450 | L: xfs@oss.sgi.com |
7439 | W: http://oss.sgi.com/projects/xfs | 7451 | W: http://oss.sgi.com/projects/xfs |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 2 | 2 | PATCHLEVEL = 2 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc3 |
5 | NAME = Saber-toothed Squirrel | 5 | NAME = Saber-toothed Squirrel |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile index 176062ac7f07..5df26a9976a2 100644 --- a/arch/arm/boot/Makefile +++ b/arch/arm/boot/Makefile | |||
@@ -65,6 +65,8 @@ $(obj)/%.dtb: $(src)/dts/%.dts | |||
65 | 65 | ||
66 | $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y)) | 66 | $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y)) |
67 | 67 | ||
68 | clean-files := *.dtb | ||
69 | |||
68 | quiet_cmd_uimage = UIMAGE $@ | 70 | quiet_cmd_uimage = UIMAGE $@ |
69 | cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ | 71 | cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ |
70 | -C none -a $(LOADADDR) -e $(STARTADDR) \ | 72 | -C none -a $(LOADADDR) -e $(STARTADDR) \ |
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h index 1db1143a9483..7df239bcdf27 100644 --- a/arch/arm/include/asm/hardware/cache-l2x0.h +++ b/arch/arm/include/asm/hardware/cache-l2x0.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef __ASM_ARM_HARDWARE_L2X0_H | 20 | #ifndef __ASM_ARM_HARDWARE_L2X0_H |
21 | #define __ASM_ARM_HARDWARE_L2X0_H | 21 | #define __ASM_ARM_HARDWARE_L2X0_H |
22 | 22 | ||
23 | #include <linux/errno.h> | ||
24 | |||
23 | #define L2X0_CACHE_ID 0x000 | 25 | #define L2X0_CACHE_ID 0x000 |
24 | #define L2X0_CACHE_TYPE 0x004 | 26 | #define L2X0_CACHE_TYPE 0x004 |
25 | #define L2X0_CTRL 0x100 | 27 | #define L2X0_CTRL 0x100 |
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 7d19425dd496..2b0efc3104ac 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h | |||
@@ -13,6 +13,7 @@ | |||
13 | struct tag; | 13 | struct tag; |
14 | struct meminfo; | 14 | struct meminfo; |
15 | struct sys_timer; | 15 | struct sys_timer; |
16 | struct pt_regs; | ||
16 | 17 | ||
17 | struct machine_desc { | 18 | struct machine_desc { |
18 | unsigned int nr; /* architecture number */ | 19 | unsigned int nr; /* architecture number */ |
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index c60a2944f95b..4a1123783806 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h | |||
@@ -402,6 +402,8 @@ | |||
402 | #define __NR_syncfs (__NR_SYSCALL_BASE+373) | 402 | #define __NR_syncfs (__NR_SYSCALL_BASE+373) |
403 | #define __NR_sendmmsg (__NR_SYSCALL_BASE+374) | 403 | #define __NR_sendmmsg (__NR_SYSCALL_BASE+374) |
404 | #define __NR_setns (__NR_SYSCALL_BASE+375) | 404 | #define __NR_setns (__NR_SYSCALL_BASE+375) |
405 | #define __NR_process_vm_readv (__NR_SYSCALL_BASE+376) | ||
406 | #define __NR_process_vm_writev (__NR_SYSCALL_BASE+377) | ||
405 | 407 | ||
406 | /* | 408 | /* |
407 | * The following SWIs are ARM private. | 409 | * The following SWIs are ARM private. |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 9943e9e74a1b..463ff4a0ec8a 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
@@ -385,6 +385,8 @@ | |||
385 | CALL(sys_syncfs) | 385 | CALL(sys_syncfs) |
386 | CALL(sys_sendmmsg) | 386 | CALL(sys_sendmmsg) |
387 | /* 375 */ CALL(sys_setns) | 387 | /* 375 */ CALL(sys_setns) |
388 | CALL(sys_process_vm_readv) | ||
389 | CALL(sys_process_vm_writev) | ||
388 | #ifndef syscalls_counted | 390 | #ifndef syscalls_counted |
389 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls | 391 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls |
390 | #define syscalls_counted | 392 | #define syscalls_counted |
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 566c54c2a1fe..08c82fd844a8 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -360,7 +360,7 @@ __secondary_data: | |||
360 | * r13 = *virtual* address to jump to upon completion | 360 | * r13 = *virtual* address to jump to upon completion |
361 | */ | 361 | */ |
362 | __enable_mmu: | 362 | __enable_mmu: |
363 | #ifdef CONFIG_ALIGNMENT_TRAP | 363 | #if defined(CONFIG_ALIGNMENT_TRAP) && __LINUX_ARM_ARCH__ < 6 |
364 | orr r0, r0, #CR_A | 364 | orr r0, r0, #CR_A |
365 | #else | 365 | #else |
366 | bic r0, r0, #CR_A | 366 | bic r0, r0, #CR_A |
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index c1b4463dcc83..e59bbd496c39 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c | |||
@@ -32,24 +32,6 @@ static atomic_t waiting_for_crash_ipi; | |||
32 | 32 | ||
33 | int machine_kexec_prepare(struct kimage *image) | 33 | int machine_kexec_prepare(struct kimage *image) |
34 | { | 34 | { |
35 | unsigned long page_list; | ||
36 | void *reboot_code_buffer; | ||
37 | page_list = image->head & PAGE_MASK; | ||
38 | |||
39 | reboot_code_buffer = page_address(image->control_code_page); | ||
40 | |||
41 | /* Prepare parameters for reboot_code_buffer*/ | ||
42 | kexec_start_address = image->start; | ||
43 | kexec_indirection_page = page_list; | ||
44 | kexec_mach_type = machine_arch_type; | ||
45 | kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET; | ||
46 | |||
47 | /* copy our kernel relocation code to the control code page */ | ||
48 | memcpy(reboot_code_buffer, | ||
49 | relocate_new_kernel, relocate_new_kernel_size); | ||
50 | |||
51 | flush_icache_range((unsigned long) reboot_code_buffer, | ||
52 | (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE); | ||
53 | return 0; | 35 | return 0; |
54 | } | 36 | } |
55 | 37 | ||
@@ -100,14 +82,31 @@ void (*kexec_reinit)(void); | |||
100 | 82 | ||
101 | void machine_kexec(struct kimage *image) | 83 | void machine_kexec(struct kimage *image) |
102 | { | 84 | { |
85 | unsigned long page_list; | ||
103 | unsigned long reboot_code_buffer_phys; | 86 | unsigned long reboot_code_buffer_phys; |
104 | void *reboot_code_buffer; | 87 | void *reboot_code_buffer; |
105 | 88 | ||
89 | |||
90 | page_list = image->head & PAGE_MASK; | ||
91 | |||
106 | /* we need both effective and real address here */ | 92 | /* we need both effective and real address here */ |
107 | reboot_code_buffer_phys = | 93 | reboot_code_buffer_phys = |
108 | page_to_pfn(image->control_code_page) << PAGE_SHIFT; | 94 | page_to_pfn(image->control_code_page) << PAGE_SHIFT; |
109 | reboot_code_buffer = page_address(image->control_code_page); | 95 | reboot_code_buffer = page_address(image->control_code_page); |
110 | 96 | ||
97 | /* Prepare parameters for reboot_code_buffer*/ | ||
98 | kexec_start_address = image->start; | ||
99 | kexec_indirection_page = page_list; | ||
100 | kexec_mach_type = machine_arch_type; | ||
101 | kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET; | ||
102 | |||
103 | /* copy our kernel relocation code to the control code page */ | ||
104 | memcpy(reboot_code_buffer, | ||
105 | relocate_new_kernel, relocate_new_kernel_size); | ||
106 | |||
107 | |||
108 | flush_icache_range((unsigned long) reboot_code_buffer, | ||
109 | (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE); | ||
111 | printk(KERN_INFO "Bye!\n"); | 110 | printk(KERN_INFO "Bye!\n"); |
112 | 111 | ||
113 | if (kexec_reinit) | 112 | if (kexec_reinit) |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 7e7977ab994f..3448a3f9cc8c 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -461,8 +461,10 @@ static void __init setup_processor(void) | |||
461 | cpu_name, read_cpuid_id(), read_cpuid_id() & 15, | 461 | cpu_name, read_cpuid_id(), read_cpuid_id() & 15, |
462 | proc_arch[cpu_architecture()], cr_alignment); | 462 | proc_arch[cpu_architecture()], cr_alignment); |
463 | 463 | ||
464 | sprintf(init_utsname()->machine, "%s%c", list->arch_name, ENDIANNESS); | 464 | snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c", |
465 | sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS); | 465 | list->arch_name, ENDIANNESS); |
466 | snprintf(elf_platform, ELF_PLATFORM_SIZE, "%s%c", | ||
467 | list->elf_name, ENDIANNESS); | ||
466 | elf_hwcap = list->elf_hwcap; | 468 | elf_hwcap = list->elf_hwcap; |
467 | #ifndef CONFIG_ARM_THUMB | 469 | #ifndef CONFIG_ARM_THUMB |
468 | elf_hwcap &= ~HWCAP_THUMB; | 470 | elf_hwcap &= ~HWCAP_THUMB; |
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c index 43eadbcc29ed..430da120a297 100644 --- a/arch/arm/mach-bcmring/core.c +++ b/arch/arm/mach-bcmring/core.c | |||
@@ -235,7 +235,7 @@ void __init bcmring_init_timer(void) | |||
235 | */ | 235 | */ |
236 | bcmring_clocksource_init(); | 236 | bcmring_clocksource_init(); |
237 | 237 | ||
238 | sp804_clockevents_register(TIMER0_VA_BASE, IRQ_TIMER0, "timer0"); | 238 | sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMER0, "timer0"); |
239 | } | 239 | } |
240 | 240 | ||
241 | struct sys_timer bcmring_timer = { | 241 | struct sys_timer bcmring_timer = { |
diff --git a/arch/arm/mach-bcmring/dma.c b/arch/arm/mach-bcmring/dma.c index b52b8de91bde..f4d4d6d174d0 100644 --- a/arch/arm/mach-bcmring/dma.c +++ b/arch/arm/mach-bcmring/dma.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/mm.h> | 36 | #include <linux/mm.h> |
37 | #include <linux/pfn.h> | 37 | #include <linux/pfn.h> |
38 | #include <linux/atomic.h> | 38 | #include <linux/atomic.h> |
39 | #include <linux/sched.h> | ||
39 | #include <mach/dma.h> | 40 | #include <mach/dma.h> |
40 | 41 | ||
41 | /* I don't quite understand why dc4 fails when this is set to 1 and DMA is enabled */ | 42 | /* I don't quite understand why dc4 fails when this is set to 1 and DMA is enabled */ |
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c index 0a5b22942fd3..34bbcbfb1706 100644 --- a/arch/arm/mach-shmobile/pm-sh7372.c +++ b/arch/arm/mach-shmobile/pm-sh7372.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
22 | #include <linux/bitrev.h> | 22 | #include <linux/bitrev.h> |
23 | #include <linux/console.h> | ||
23 | #include <asm/system.h> | 24 | #include <asm/system.h> |
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
@@ -106,9 +107,8 @@ static int pd_power_down(struct generic_pm_domain *genpd) | |||
106 | return 0; | 107 | return 0; |
107 | } | 108 | } |
108 | 109 | ||
109 | static int pd_power_up(struct generic_pm_domain *genpd) | 110 | static int __pd_power_up(struct sh7372_pm_domain *sh7372_pd, bool do_resume) |
110 | { | 111 | { |
111 | struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd); | ||
112 | unsigned int mask = 1 << sh7372_pd->bit_shift; | 112 | unsigned int mask = 1 << sh7372_pd->bit_shift; |
113 | unsigned int retry_count; | 113 | unsigned int retry_count; |
114 | int ret = 0; | 114 | int ret = 0; |
@@ -123,13 +123,13 @@ static int pd_power_up(struct generic_pm_domain *genpd) | |||
123 | 123 | ||
124 | for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) { | 124 | for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) { |
125 | if (!(__raw_readl(SWUCR) & mask)) | 125 | if (!(__raw_readl(SWUCR) & mask)) |
126 | goto out; | 126 | break; |
127 | if (retry_count > PSTR_RETRIES) | 127 | if (retry_count > PSTR_RETRIES) |
128 | udelay(PSTR_DELAY_US); | 128 | udelay(PSTR_DELAY_US); |
129 | else | 129 | else |
130 | cpu_relax(); | 130 | cpu_relax(); |
131 | } | 131 | } |
132 | if (__raw_readl(SWUCR) & mask) | 132 | if (!retry_count) |
133 | ret = -EIO; | 133 | ret = -EIO; |
134 | 134 | ||
135 | if (!sh7372_pd->no_debug) | 135 | if (!sh7372_pd->no_debug) |
@@ -137,12 +137,17 @@ static int pd_power_up(struct generic_pm_domain *genpd) | |||
137 | mask, __raw_readl(PSTR)); | 137 | mask, __raw_readl(PSTR)); |
138 | 138 | ||
139 | out: | 139 | out: |
140 | if (ret == 0 && sh7372_pd->resume) | 140 | if (ret == 0 && sh7372_pd->resume && do_resume) |
141 | sh7372_pd->resume(); | 141 | sh7372_pd->resume(); |
142 | 142 | ||
143 | return ret; | 143 | return ret; |
144 | } | 144 | } |
145 | 145 | ||
146 | static int pd_power_up(struct generic_pm_domain *genpd) | ||
147 | { | ||
148 | return __pd_power_up(to_sh7372_pd(genpd), true); | ||
149 | } | ||
150 | |||
146 | static void sh7372_a4r_suspend(void) | 151 | static void sh7372_a4r_suspend(void) |
147 | { | 152 | { |
148 | sh7372_intcs_suspend(); | 153 | sh7372_intcs_suspend(); |
@@ -174,7 +179,7 @@ void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd) | |||
174 | genpd->active_wakeup = pd_active_wakeup; | 179 | genpd->active_wakeup = pd_active_wakeup; |
175 | genpd->power_off = pd_power_down; | 180 | genpd->power_off = pd_power_down; |
176 | genpd->power_on = pd_power_up; | 181 | genpd->power_on = pd_power_up; |
177 | genpd->power_on(&sh7372_pd->genpd); | 182 | __pd_power_up(sh7372_pd, false); |
178 | } | 183 | } |
179 | 184 | ||
180 | void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd, | 185 | void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd, |
@@ -227,11 +232,23 @@ struct sh7372_pm_domain sh7372_a3sp = { | |||
227 | .no_debug = true, | 232 | .no_debug = true, |
228 | }; | 233 | }; |
229 | 234 | ||
235 | static void sh7372_a3sp_init(void) | ||
236 | { | ||
237 | /* serial consoles make use of SCIF hardware located in A3SP, | ||
238 | * keep such power domain on if "no_console_suspend" is set. | ||
239 | */ | ||
240 | sh7372_a3sp.stay_on = !console_suspend_enabled; | ||
241 | } | ||
242 | |||
230 | struct sh7372_pm_domain sh7372_a3sg = { | 243 | struct sh7372_pm_domain sh7372_a3sg = { |
231 | .bit_shift = 13, | 244 | .bit_shift = 13, |
232 | }; | 245 | }; |
233 | 246 | ||
234 | #endif /* CONFIG_PM */ | 247 | #else /* !CONFIG_PM */ |
248 | |||
249 | static inline void sh7372_a3sp_init(void) {} | ||
250 | |||
251 | #endif /* !CONFIG_PM */ | ||
235 | 252 | ||
236 | #if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE) | 253 | #if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE) |
237 | static int sh7372_do_idle_core_standby(unsigned long unused) | 254 | static int sh7372_do_idle_core_standby(unsigned long unused) |
@@ -465,6 +482,8 @@ void __init sh7372_pm_init(void) | |||
465 | /* do not convert A3SM, A3SP, A3SG, A4R power down into A4S */ | 482 | /* do not convert A3SM, A3SP, A3SG, A4R power down into A4S */ |
466 | __raw_writel(0, PDNSEL); | 483 | __raw_writel(0, PDNSEL); |
467 | 484 | ||
485 | sh7372_a3sp_init(); | ||
486 | |||
468 | sh7372_suspend_init(); | 487 | sh7372_suspend_init(); |
469 | sh7372_cpuidle_init(); | 488 | sh7372_cpuidle_init(); |
470 | } | 489 | } |
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c index 7a1fa6adb7c3..5b0c38abacc1 100644 --- a/arch/arm/mach-w90x900/dev.c +++ b/arch/arm/mach-w90x900/dev.c | |||
@@ -422,7 +422,7 @@ struct platform_device nuc900_device_kpi = { | |||
422 | 422 | ||
423 | /* LCD controller*/ | 423 | /* LCD controller*/ |
424 | 424 | ||
425 | static struct nuc900fb_display __initdata nuc900_lcd_info[] = { | 425 | static struct nuc900fb_display nuc900_lcd_info[] = { |
426 | /* Giantplus Technology GPM1040A0 320x240 Color TFT LCD */ | 426 | /* Giantplus Technology GPM1040A0 320x240 Color TFT LCD */ |
427 | [0] = { | 427 | [0] = { |
428 | .type = LCM_DCCS_VA_SRC_RGB565, | 428 | .type = LCM_DCCS_VA_SRC_RGB565, |
@@ -445,7 +445,7 @@ static struct nuc900fb_display __initdata nuc900_lcd_info[] = { | |||
445 | }, | 445 | }, |
446 | }; | 446 | }; |
447 | 447 | ||
448 | static struct nuc900fb_mach_info nuc900_fb_info __initdata = { | 448 | static struct nuc900fb_mach_info nuc900_fb_info = { |
449 | #if defined(CONFIG_GPM1040A0_320X240) | 449 | #if defined(CONFIG_GPM1040A0_320X240) |
450 | .displays = &nuc900_lcd_info[0], | 450 | .displays = &nuc900_lcd_info[0], |
451 | #else | 451 | #else |
diff --git a/arch/arm/mach-w90x900/include/mach/mfp.h b/arch/arm/mach-w90x900/include/mach/mfp.h index 94c0e71617c6..23ef1f573abd 100644 --- a/arch/arm/mach-w90x900/include/mach/mfp.h +++ b/arch/arm/mach-w90x900/include/mach/mfp.h | |||
@@ -19,6 +19,7 @@ | |||
19 | extern void mfp_set_groupf(struct device *dev); | 19 | extern void mfp_set_groupf(struct device *dev); |
20 | extern void mfp_set_groupc(struct device *dev); | 20 | extern void mfp_set_groupc(struct device *dev); |
21 | extern void mfp_set_groupi(struct device *dev); | 21 | extern void mfp_set_groupi(struct device *dev); |
22 | extern void mfp_set_groupg(struct device *dev); | 22 | extern void mfp_set_groupg(struct device *dev, const char *subname); |
23 | extern void mfp_set_groupd(struct device *dev, const char *subname); | ||
23 | 24 | ||
24 | #endif /* __ASM_ARCH_MFP_H */ | 25 | #endif /* __ASM_ARCH_MFP_H */ |
diff --git a/arch/arm/mach-w90x900/include/mach/nuc900_spi.h b/arch/arm/mach-w90x900/include/mach/nuc900_spi.h index bd94819e314f..2c4e0c128501 100644 --- a/arch/arm/mach-w90x900/include/mach/nuc900_spi.h +++ b/arch/arm/mach-w90x900/include/mach/nuc900_spi.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #ifndef __ASM_ARCH_SPI_H | 14 | #ifndef __ASM_ARCH_SPI_H |
15 | #define __ASM_ARCH_SPI_H | 15 | #define __ASM_ARCH_SPI_H |
16 | 16 | ||
17 | extern void mfp_set_groupg(struct device *dev); | 17 | extern void mfp_set_groupg(struct device *dev, const char *subname); |
18 | 18 | ||
19 | struct nuc900_spi_info { | 19 | struct nuc900_spi_info { |
20 | unsigned int num_cs; | 20 | unsigned int num_cs; |
diff --git a/arch/arm/mach-w90x900/mfp.c b/arch/arm/mach-w90x900/mfp.c index fb7fb627b1a5..9dd74612bb87 100644 --- a/arch/arm/mach-w90x900/mfp.c +++ b/arch/arm/mach-w90x900/mfp.c | |||
@@ -26,10 +26,8 @@ | |||
26 | #define REG_MFSEL (W90X900_VA_GCR + 0xC) | 26 | #define REG_MFSEL (W90X900_VA_GCR + 0xC) |
27 | 27 | ||
28 | #define GPSELF (0x01 << 1) | 28 | #define GPSELF (0x01 << 1) |
29 | |||
30 | #define GPSELC (0x03 << 2) | 29 | #define GPSELC (0x03 << 2) |
31 | #define ENKPI (0x02 << 2) | 30 | #define GPSELD (0x0f << 4) |
32 | #define ENNAND (0x01 << 2) | ||
33 | 31 | ||
34 | #define GPSELEI0 (0x01 << 26) | 32 | #define GPSELEI0 (0x01 << 26) |
35 | #define GPSELEI1 (0x01 << 27) | 33 | #define GPSELEI1 (0x01 << 27) |
@@ -37,11 +35,16 @@ | |||
37 | #define GPIOG0TO1 (0x03 << 14) | 35 | #define GPIOG0TO1 (0x03 << 14) |
38 | #define GPIOG2TO3 (0x03 << 16) | 36 | #define GPIOG2TO3 (0x03 << 16) |
39 | #define GPIOG22TO23 (0x03 << 22) | 37 | #define GPIOG22TO23 (0x03 << 22) |
38 | #define GPIOG18TO20 (0x07 << 18) | ||
40 | 39 | ||
41 | #define ENSPI (0x0a << 14) | 40 | #define ENSPI (0x0a << 14) |
42 | #define ENI2C0 (0x01 << 14) | 41 | #define ENI2C0 (0x01 << 14) |
43 | #define ENI2C1 (0x01 << 16) | 42 | #define ENI2C1 (0x01 << 16) |
44 | #define ENAC97 (0x02 << 22) | 43 | #define ENAC97 (0x02 << 22) |
44 | #define ENSD1 (0x02 << 18) | ||
45 | #define ENSD0 (0x0a << 4) | ||
46 | #define ENKPI (0x02 << 2) | ||
47 | #define ENNAND (0x01 << 2) | ||
45 | 48 | ||
46 | static DEFINE_MUTEX(mfp_mutex); | 49 | static DEFINE_MUTEX(mfp_mutex); |
47 | 50 | ||
@@ -127,16 +130,19 @@ void mfp_set_groupi(struct device *dev) | |||
127 | } | 130 | } |
128 | EXPORT_SYMBOL(mfp_set_groupi); | 131 | EXPORT_SYMBOL(mfp_set_groupi); |
129 | 132 | ||
130 | void mfp_set_groupg(struct device *dev) | 133 | void mfp_set_groupg(struct device *dev, const char *subname) |
131 | { | 134 | { |
132 | unsigned long mfpen; | 135 | unsigned long mfpen; |
133 | const char *dev_id; | 136 | const char *dev_id; |
134 | 137 | ||
135 | BUG_ON(!dev); | 138 | BUG_ON((!dev) && (!subname)); |
136 | 139 | ||
137 | mutex_lock(&mfp_mutex); | 140 | mutex_lock(&mfp_mutex); |
138 | 141 | ||
139 | dev_id = dev_name(dev); | 142 | if (subname != NULL) |
143 | dev_id = subname; | ||
144 | else | ||
145 | dev_id = dev_name(dev); | ||
140 | 146 | ||
141 | mfpen = __raw_readl(REG_MFSEL); | 147 | mfpen = __raw_readl(REG_MFSEL); |
142 | 148 | ||
@@ -152,6 +158,9 @@ void mfp_set_groupg(struct device *dev) | |||
152 | } else if (strcmp(dev_id, "nuc900-audio") == 0) { | 158 | } else if (strcmp(dev_id, "nuc900-audio") == 0) { |
153 | mfpen &= ~(GPIOG22TO23); | 159 | mfpen &= ~(GPIOG22TO23); |
154 | mfpen |= ENAC97;/*enable AC97*/ | 160 | mfpen |= ENAC97;/*enable AC97*/ |
161 | } else if (strcmp(dev_id, "nuc900-mmc-port1") == 0) { | ||
162 | mfpen &= ~(GPIOG18TO20); | ||
163 | mfpen |= (ENSD1 | 0x01);/*enable sd1*/ | ||
155 | } else { | 164 | } else { |
156 | mfpen &= ~(GPIOG0TO1 | GPIOG2TO3);/*GPIOG[3:0]*/ | 165 | mfpen &= ~(GPIOG0TO1 | GPIOG2TO3);/*GPIOG[3:0]*/ |
157 | } | 166 | } |
@@ -162,3 +171,30 @@ void mfp_set_groupg(struct device *dev) | |||
162 | } | 171 | } |
163 | EXPORT_SYMBOL(mfp_set_groupg); | 172 | EXPORT_SYMBOL(mfp_set_groupg); |
164 | 173 | ||
174 | void mfp_set_groupd(struct device *dev, const char *subname) | ||
175 | { | ||
176 | unsigned long mfpen; | ||
177 | const char *dev_id; | ||
178 | |||
179 | BUG_ON((!dev) && (!subname)); | ||
180 | |||
181 | mutex_lock(&mfp_mutex); | ||
182 | |||
183 | if (subname != NULL) | ||
184 | dev_id = subname; | ||
185 | else | ||
186 | dev_id = dev_name(dev); | ||
187 | |||
188 | mfpen = __raw_readl(REG_MFSEL); | ||
189 | |||
190 | if (strcmp(dev_id, "nuc900-mmc-port0") == 0) { | ||
191 | mfpen &= ~GPSELD;/*enable sd0*/ | ||
192 | mfpen |= ENSD0; | ||
193 | } else | ||
194 | mfpen &= (~GPSELD); | ||
195 | |||
196 | __raw_writel(mfpen, REG_MFSEL); | ||
197 | |||
198 | mutex_unlock(&mfp_mutex); | ||
199 | } | ||
200 | EXPORT_SYMBOL(mfp_set_groupd); | ||
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig index 32d90867a984..5f2cdb3e428c 100644 --- a/arch/cris/arch-v10/drivers/Kconfig +++ b/arch/cris/arch-v10/drivers/Kconfig | |||
@@ -3,7 +3,7 @@ if ETRAX_ARCH_V10 | |||
3 | config ETRAX_ETHERNET | 3 | config ETRAX_ETHERNET |
4 | bool "Ethernet support" | 4 | bool "Ethernet support" |
5 | depends on ETRAX_ARCH_V10 | 5 | depends on ETRAX_ARCH_V10 |
6 | select NET_ETHERNET | 6 | select ETHERNET |
7 | select NET_CORE | 7 | select NET_CORE |
8 | select MII | 8 | select MII |
9 | help | 9 | help |
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig index e47e9c3401b0..de43aadcdbc4 100644 --- a/arch/cris/arch-v32/drivers/Kconfig +++ b/arch/cris/arch-v32/drivers/Kconfig | |||
@@ -3,7 +3,7 @@ if ETRAX_ARCH_V32 | |||
3 | config ETRAX_ETHERNET | 3 | config ETRAX_ETHERNET |
4 | bool "Ethernet support" | 4 | bool "Ethernet support" |
5 | depends on ETRAX_ARCH_V32 | 5 | depends on ETRAX_ARCH_V32 |
6 | select NET_ETHERNET | 6 | select ETHERNET |
7 | select NET_CORE | 7 | select NET_CORE |
8 | select MII | 8 | select MII |
9 | help | 9 | help |
diff --git a/arch/microblaze/include/asm/namei.h b/arch/microblaze/include/asm/namei.h deleted file mode 100644 index 61d60b8a07d5..000000000000 --- a/arch/microblaze/include/asm/namei.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_NAMEI_H | ||
10 | #define _ASM_MICROBLAZE_NAMEI_H | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | /* This dummy routine maybe changed to something useful | ||
15 | * for /usr/gnemul/ emulation stuff. | ||
16 | * Look at asm-sparc/namei.h for details. | ||
17 | */ | ||
18 | #define __emul_prefix() NULL | ||
19 | |||
20 | #endif /* __KERNEL__ */ | ||
21 | |||
22 | #endif /* _ASM_MICROBLAZE_NAMEI_H */ | ||
diff --git a/arch/mips/cavium-octeon/flash_setup.c b/arch/mips/cavium-octeon/flash_setup.c index 975c20327bb1..0a430e06f5e5 100644 --- a/arch/mips/cavium-octeon/flash_setup.c +++ b/arch/mips/cavium-octeon/flash_setup.c | |||
@@ -17,8 +17,6 @@ | |||
17 | 17 | ||
18 | static struct map_info flash_map; | 18 | static struct map_info flash_map; |
19 | static struct mtd_info *mymtd; | 19 | static struct mtd_info *mymtd; |
20 | static int nr_parts; | ||
21 | static struct mtd_partition *parts; | ||
22 | static const char *part_probe_types[] = { | 20 | static const char *part_probe_types[] = { |
23 | "cmdlinepart", | 21 | "cmdlinepart", |
24 | #ifdef CONFIG_MTD_REDBOOT_PARTS | 22 | #ifdef CONFIG_MTD_REDBOOT_PARTS |
@@ -61,11 +59,8 @@ static int __init flash_init(void) | |||
61 | mymtd = do_map_probe("cfi_probe", &flash_map); | 59 | mymtd = do_map_probe("cfi_probe", &flash_map); |
62 | if (mymtd) { | 60 | if (mymtd) { |
63 | mymtd->owner = THIS_MODULE; | 61 | mymtd->owner = THIS_MODULE; |
64 | 62 | mtd_device_parse_register(mymtd, part_probe_types, | |
65 | nr_parts = parse_mtd_partitions(mymtd, | 63 | 0, NULL, 0); |
66 | part_probe_types, | ||
67 | &parts, 0); | ||
68 | mtd_device_register(mymtd, parts, nr_parts); | ||
69 | } else { | 64 | } else { |
70 | pr_err("Failed to register MTD device for flash\n"); | 65 | pr_err("Failed to register MTD device for flash\n"); |
71 | } | 66 | } |
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c index 8b606423bbd7..efcfff4d4627 100644 --- a/arch/mips/cavium-octeon/smp.c +++ b/arch/mips/cavium-octeon/smp.c | |||
@@ -207,8 +207,9 @@ void octeon_prepare_cpus(unsigned int max_cpus) | |||
207 | * the other bits alone. | 207 | * the other bits alone. |
208 | */ | 208 | */ |
209 | cvmx_write_csr(CVMX_CIU_MBOX_CLRX(cvmx_get_core_num()), 0xffff); | 209 | cvmx_write_csr(CVMX_CIU_MBOX_CLRX(cvmx_get_core_num()), 0xffff); |
210 | if (request_irq(OCTEON_IRQ_MBOX0, mailbox_interrupt, IRQF_DISABLED, | 210 | if (request_irq(OCTEON_IRQ_MBOX0, mailbox_interrupt, |
211 | "SMP-IPI", mailbox_interrupt)) { | 211 | IRQF_PERCPU | IRQF_NO_THREAD, "SMP-IPI", |
212 | mailbox_interrupt)) { | ||
212 | panic("Cannot request_irq(OCTEON_IRQ_MBOX0)\n"); | 213 | panic("Cannot request_irq(OCTEON_IRQ_MBOX0)\n"); |
213 | } | 214 | } |
214 | } | 215 | } |
diff --git a/arch/mips/emma/common/prom.c b/arch/mips/emma/common/prom.c index 708f08761406..cae42259d6da 100644 --- a/arch/mips/emma/common/prom.c +++ b/arch/mips/emma/common/prom.c | |||
@@ -50,7 +50,7 @@ void __init prom_init(void) | |||
50 | 50 | ||
51 | /* arg[0] is "g", the rest is boot parameters */ | 51 | /* arg[0] is "g", the rest is boot parameters */ |
52 | for (i = 1; i < argc; i++) { | 52 | for (i = 1; i < argc; i++) { |
53 | if (strlen(arcs_cmdline) + strlen(arg[i] + 1) | 53 | if (strlen(arcs_cmdline) + strlen(arg[i]) + 1 |
54 | >= sizeof(arcs_cmdline)) | 54 | >= sizeof(arcs_cmdline)) |
55 | break; | 55 | break; |
56 | strcat(arcs_cmdline, arg[i]); | 56 | strcat(arcs_cmdline, arg[i]); |
diff --git a/arch/mips/include/asm/mach-bcm47xx/gpio.h b/arch/mips/include/asm/mach-bcm47xx/gpio.h index 76961cabeedf..2ef17e8df403 100644 --- a/arch/mips/include/asm/mach-bcm47xx/gpio.h +++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h | |||
@@ -36,6 +36,8 @@ static inline int gpio_get_value(unsigned gpio) | |||
36 | return -EINVAL; | 36 | return -EINVAL; |
37 | } | 37 | } |
38 | 38 | ||
39 | #define gpio_get_value_cansleep gpio_get_value | ||
40 | |||
39 | static inline void gpio_set_value(unsigned gpio, int value) | 41 | static inline void gpio_set_value(unsigned gpio, int value) |
40 | { | 42 | { |
41 | switch (bcm47xx_bus_type) { | 43 | switch (bcm47xx_bus_type) { |
@@ -54,6 +56,19 @@ static inline void gpio_set_value(unsigned gpio, int value) | |||
54 | } | 56 | } |
55 | } | 57 | } |
56 | 58 | ||
59 | #define gpio_set_value_cansleep gpio_set_value | ||
60 | |||
61 | static inline int gpio_cansleep(unsigned gpio) | ||
62 | { | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static inline int gpio_is_valid(unsigned gpio) | ||
67 | { | ||
68 | return gpio < (BCM47XX_EXTIF_GPIO_LINES + BCM47XX_CHIPCO_GPIO_LINES); | ||
69 | } | ||
70 | |||
71 | |||
57 | static inline int gpio_direction_input(unsigned gpio) | 72 | static inline int gpio_direction_input(unsigned gpio) |
58 | { | 73 | { |
59 | switch (bcm47xx_bus_type) { | 74 | switch (bcm47xx_bus_type) { |
@@ -137,7 +152,4 @@ static inline int gpio_polarity(unsigned gpio, int value) | |||
137 | } | 152 | } |
138 | 153 | ||
139 | 154 | ||
140 | /* cansleep wrappers */ | ||
141 | #include <asm-generic/gpio.h> | ||
142 | |||
143 | #endif /* __BCM47XX_GPIO_H */ | 155 | #endif /* __BCM47XX_GPIO_H */ |
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h index ecea7871dec2..d8dad5340ea3 100644 --- a/arch/mips/include/asm/unistd.h +++ b/arch/mips/include/asm/unistd.h | |||
@@ -365,16 +365,18 @@ | |||
365 | #define __NR_syncfs (__NR_Linux + 342) | 365 | #define __NR_syncfs (__NR_Linux + 342) |
366 | #define __NR_sendmmsg (__NR_Linux + 343) | 366 | #define __NR_sendmmsg (__NR_Linux + 343) |
367 | #define __NR_setns (__NR_Linux + 344) | 367 | #define __NR_setns (__NR_Linux + 344) |
368 | #define __NR_process_vm_readv (__NR_Linux + 345) | ||
369 | #define __NR_process_vm_writev (__NR_Linux + 346) | ||
368 | 370 | ||
369 | /* | 371 | /* |
370 | * Offset of the last Linux o32 flavoured syscall | 372 | * Offset of the last Linux o32 flavoured syscall |
371 | */ | 373 | */ |
372 | #define __NR_Linux_syscalls 344 | 374 | #define __NR_Linux_syscalls 346 |
373 | 375 | ||
374 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 376 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
375 | 377 | ||
376 | #define __NR_O32_Linux 4000 | 378 | #define __NR_O32_Linux 4000 |
377 | #define __NR_O32_Linux_syscalls 344 | 379 | #define __NR_O32_Linux_syscalls 346 |
378 | 380 | ||
379 | #if _MIPS_SIM == _MIPS_SIM_ABI64 | 381 | #if _MIPS_SIM == _MIPS_SIM_ABI64 |
380 | 382 | ||
@@ -686,16 +688,18 @@ | |||
686 | #define __NR_syncfs (__NR_Linux + 301) | 688 | #define __NR_syncfs (__NR_Linux + 301) |
687 | #define __NR_sendmmsg (__NR_Linux + 302) | 689 | #define __NR_sendmmsg (__NR_Linux + 302) |
688 | #define __NR_setns (__NR_Linux + 303) | 690 | #define __NR_setns (__NR_Linux + 303) |
691 | #define __NR_process_vm_readv (__NR_Linux + 304) | ||
692 | #define __NR_process_vm_writev (__NR_Linux + 305) | ||
689 | 693 | ||
690 | /* | 694 | /* |
691 | * Offset of the last Linux 64-bit flavoured syscall | 695 | * Offset of the last Linux 64-bit flavoured syscall |
692 | */ | 696 | */ |
693 | #define __NR_Linux_syscalls 303 | 697 | #define __NR_Linux_syscalls 305 |
694 | 698 | ||
695 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ | 699 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ |
696 | 700 | ||
697 | #define __NR_64_Linux 5000 | 701 | #define __NR_64_Linux 5000 |
698 | #define __NR_64_Linux_syscalls 303 | 702 | #define __NR_64_Linux_syscalls 305 |
699 | 703 | ||
700 | #if _MIPS_SIM == _MIPS_SIM_NABI32 | 704 | #if _MIPS_SIM == _MIPS_SIM_NABI32 |
701 | 705 | ||
@@ -1012,16 +1016,18 @@ | |||
1012 | #define __NR_syncfs (__NR_Linux + 306) | 1016 | #define __NR_syncfs (__NR_Linux + 306) |
1013 | #define __NR_sendmmsg (__NR_Linux + 307) | 1017 | #define __NR_sendmmsg (__NR_Linux + 307) |
1014 | #define __NR_setns (__NR_Linux + 308) | 1018 | #define __NR_setns (__NR_Linux + 308) |
1019 | #define __NR_process_vm_readv (__NR_Linux + 309) | ||
1020 | #define __NR_process_vm_writev (__NR_Linux + 310) | ||
1015 | 1021 | ||
1016 | /* | 1022 | /* |
1017 | * Offset of the last N32 flavoured syscall | 1023 | * Offset of the last N32 flavoured syscall |
1018 | */ | 1024 | */ |
1019 | #define __NR_Linux_syscalls 308 | 1025 | #define __NR_Linux_syscalls 310 |
1020 | 1026 | ||
1021 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ | 1027 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ |
1022 | 1028 | ||
1023 | #define __NR_N32_Linux 6000 | 1029 | #define __NR_N32_Linux 6000 |
1024 | #define __NR_N32_Linux_syscalls 308 | 1030 | #define __NR_N32_Linux_syscalls 310 |
1025 | 1031 | ||
1026 | #ifdef __KERNEL__ | 1032 | #ifdef __KERNEL__ |
1027 | 1033 | ||
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c index 98c5a9737c14..e2d8e199be32 100644 --- a/arch/mips/kernel/cevt-r4k.c +++ b/arch/mips/kernel/cevt-r4k.c | |||
@@ -103,19 +103,10 @@ static int c0_compare_int_pending(void) | |||
103 | 103 | ||
104 | /* | 104 | /* |
105 | * Compare interrupt can be routed and latched outside the core, | 105 | * Compare interrupt can be routed and latched outside the core, |
106 | * so a single execution hazard barrier may not be enough to give | 106 | * so wait up to worst case number of cycle counter ticks for timer interrupt |
107 | * it time to clear as seen in the Cause register. 4 time the | 107 | * changes to propagate to the cause register. |
108 | * pipeline depth seems reasonably conservative, and empirically | ||
109 | * works better in configurations with high CPU/bus clock ratios. | ||
110 | */ | 108 | */ |
111 | 109 | #define COMPARE_INT_SEEN_TICKS 50 | |
112 | #define compare_change_hazard() \ | ||
113 | do { \ | ||
114 | irq_disable_hazard(); \ | ||
115 | irq_disable_hazard(); \ | ||
116 | irq_disable_hazard(); \ | ||
117 | irq_disable_hazard(); \ | ||
118 | } while (0) | ||
119 | 110 | ||
120 | int c0_compare_int_usable(void) | 111 | int c0_compare_int_usable(void) |
121 | { | 112 | { |
@@ -126,8 +117,12 @@ int c0_compare_int_usable(void) | |||
126 | * IP7 already pending? Try to clear it by acking the timer. | 117 | * IP7 already pending? Try to clear it by acking the timer. |
127 | */ | 118 | */ |
128 | if (c0_compare_int_pending()) { | 119 | if (c0_compare_int_pending()) { |
129 | write_c0_compare(read_c0_count()); | 120 | cnt = read_c0_count(); |
130 | compare_change_hazard(); | 121 | write_c0_compare(cnt); |
122 | back_to_back_c0_hazard(); | ||
123 | while (read_c0_count() < (cnt + COMPARE_INT_SEEN_TICKS)) | ||
124 | if (!c0_compare_int_pending()) | ||
125 | break; | ||
131 | if (c0_compare_int_pending()) | 126 | if (c0_compare_int_pending()) |
132 | return 0; | 127 | return 0; |
133 | } | 128 | } |
@@ -136,7 +131,7 @@ int c0_compare_int_usable(void) | |||
136 | cnt = read_c0_count(); | 131 | cnt = read_c0_count(); |
137 | cnt += delta; | 132 | cnt += delta; |
138 | write_c0_compare(cnt); | 133 | write_c0_compare(cnt); |
139 | compare_change_hazard(); | 134 | back_to_back_c0_hazard(); |
140 | if ((int)(read_c0_count() - cnt) < 0) | 135 | if ((int)(read_c0_count() - cnt) < 0) |
141 | break; | 136 | break; |
142 | /* increase delta if the timer was already expired */ | 137 | /* increase delta if the timer was already expired */ |
@@ -145,12 +140,17 @@ int c0_compare_int_usable(void) | |||
145 | while ((int)(read_c0_count() - cnt) <= 0) | 140 | while ((int)(read_c0_count() - cnt) <= 0) |
146 | ; /* Wait for expiry */ | 141 | ; /* Wait for expiry */ |
147 | 142 | ||
148 | compare_change_hazard(); | 143 | while (read_c0_count() < (cnt + COMPARE_INT_SEEN_TICKS)) |
144 | if (c0_compare_int_pending()) | ||
145 | break; | ||
149 | if (!c0_compare_int_pending()) | 146 | if (!c0_compare_int_pending()) |
150 | return 0; | 147 | return 0; |
151 | 148 | cnt = read_c0_count(); | |
152 | write_c0_compare(read_c0_count()); | 149 | write_c0_compare(cnt); |
153 | compare_change_hazard(); | 150 | back_to_back_c0_hazard(); |
151 | while (read_c0_count() < (cnt + COMPARE_INT_SEEN_TICKS)) | ||
152 | if (!c0_compare_int_pending()) | ||
153 | break; | ||
154 | if (c0_compare_int_pending()) | 154 | if (c0_compare_int_pending()) |
155 | return 0; | 155 | return 0; |
156 | 156 | ||
diff --git a/arch/mips/kernel/cpufreq/loongson2_clock.c b/arch/mips/kernel/cpufreq/loongson2_clock.c index cefc6e259baf..5426779d9fdb 100644 --- a/arch/mips/kernel/cpufreq/loongson2_clock.c +++ b/arch/mips/kernel/cpufreq/loongson2_clock.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * for more details. | 7 | * for more details. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/module.h> | ||
10 | #include <linux/cpufreq.h> | 11 | #include <linux/cpufreq.h> |
11 | #include <linux/platform_device.h> | 12 | #include <linux/platform_device.h> |
12 | 13 | ||
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index 47920657968d..a632bc144efa 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -591,6 +591,8 @@ einval: li v0, -ENOSYS | |||
591 | sys sys_syncfs 1 | 591 | sys sys_syncfs 1 |
592 | sys sys_sendmmsg 4 | 592 | sys sys_sendmmsg 4 |
593 | sys sys_setns 2 | 593 | sys sys_setns 2 |
594 | sys sys_process_vm_readv 6 /* 4345 */ | ||
595 | sys sys_process_vm_writev 6 | ||
594 | .endm | 596 | .endm |
595 | 597 | ||
596 | /* We pre-compute the number of _instruction_ bytes needed to | 598 | /* We pre-compute the number of _instruction_ bytes needed to |
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index fb7334bea731..3b5a5e9ae49c 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
@@ -430,4 +430,6 @@ sys_call_table: | |||
430 | PTR sys_syncfs | 430 | PTR sys_syncfs |
431 | PTR sys_sendmmsg | 431 | PTR sys_sendmmsg |
432 | PTR sys_setns | 432 | PTR sys_setns |
433 | PTR sys_process_vm_readv | ||
434 | PTR sys_process_vm_writev /* 5305 */ | ||
433 | .size sys_call_table,.-sys_call_table | 435 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 6de1f598346e..6be6f7020923 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -430,4 +430,6 @@ EXPORT(sysn32_call_table) | |||
430 | PTR sys_syncfs | 430 | PTR sys_syncfs |
431 | PTR compat_sys_sendmmsg | 431 | PTR compat_sys_sendmmsg |
432 | PTR sys_setns | 432 | PTR sys_setns |
433 | PTR compat_sys_process_vm_readv | ||
434 | PTR compat_sys_process_vm_writev /* 6310 */ | ||
433 | .size sysn32_call_table,.-sysn32_call_table | 435 | .size sysn32_call_table,.-sysn32_call_table |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index 1d813169e453..54228553691d 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -548,4 +548,6 @@ sys_call_table: | |||
548 | PTR sys_syncfs | 548 | PTR sys_syncfs |
549 | PTR compat_sys_sendmmsg | 549 | PTR compat_sys_sendmmsg |
550 | PTR sys_setns | 550 | PTR sys_setns |
551 | PTR compat_sys_process_vm_readv /* 4345 */ | ||
552 | PTR compat_sys_process_vm_writev | ||
551 | .size sys_call_table,.-sys_call_table | 553 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 261ccbc07740..5c8a49d55054 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -1596,7 +1596,8 @@ void __cpuinit per_cpu_trap_init(void) | |||
1596 | } | 1596 | } |
1597 | #endif /* CONFIG_MIPS_MT_SMTC */ | 1597 | #endif /* CONFIG_MIPS_MT_SMTC */ |
1598 | 1598 | ||
1599 | cpu_data[cpu].asid_cache = ASID_FIRST_VERSION; | 1599 | if (!cpu_data[cpu].asid_cache) |
1600 | cpu_data[cpu].asid_cache = ASID_FIRST_VERSION; | ||
1600 | 1601 | ||
1601 | atomic_inc(&init_mm.mm_count); | 1602 | atomic_inc(&init_mm.mm_count); |
1602 | current->active_mm = &init_mm; | 1603 | current->active_mm = &init_mm; |
diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c index 7e9c0ffc11a5..77ed70fc2fe5 100644 --- a/arch/mips/lantiq/clk.c +++ b/arch/mips/lantiq/clk.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> | 7 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> |
8 | */ | 8 | */ |
9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
10 | #include <linux/module.h> | 10 | #include <linux/export.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
diff --git a/arch/mips/lantiq/devices.c b/arch/mips/lantiq/devices.c index 44a36771c819..de1cb2bcd79a 100644 --- a/arch/mips/lantiq/devices.c +++ b/arch/mips/lantiq/devices.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/module.h> | 10 | #include <linux/export.h> |
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c index 56ba007bf1e5..e34fcfd0d5ca 100644 --- a/arch/mips/lantiq/prom.c +++ b/arch/mips/lantiq/prom.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> | 6 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/export.h> |
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <asm/bootinfo.h> | 11 | #include <asm/bootinfo.h> |
12 | #include <asm/time.h> | 12 | #include <asm/time.h> |
diff --git a/arch/mips/lantiq/setup.c b/arch/mips/lantiq/setup.c index 9b8af77ed0f9..1ff6c9d6cb93 100644 --- a/arch/mips/lantiq/setup.c +++ b/arch/mips/lantiq/setup.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/module.h> | 10 | #include <linux/export.h> |
11 | #include <linux/io.h> | 11 | #include <linux/io.h> |
12 | #include <linux/ioport.h> | 12 | #include <linux/ioport.h> |
13 | #include <asm/bootinfo.h> | 13 | #include <asm/bootinfo.h> |
diff --git a/arch/mips/lantiq/xway/clk-ase.c b/arch/mips/lantiq/xway/clk-ase.c index 22d823acd536..652258309c9c 100644 --- a/arch/mips/lantiq/xway/clk-ase.c +++ b/arch/mips/lantiq/xway/clk-ase.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
10 | #include <linux/module.h> | 10 | #include <linux/export.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/clk.h> | 12 | #include <linux/clk.h> |
13 | 13 | ||
diff --git a/arch/mips/lantiq/xway/clk-xway.c b/arch/mips/lantiq/xway/clk-xway.c index ddd39593c581..696b1a3e0642 100644 --- a/arch/mips/lantiq/xway/clk-xway.c +++ b/arch/mips/lantiq/xway/clk-xway.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
10 | #include <linux/module.h> | 10 | #include <linux/export.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/clk.h> | 12 | #include <linux/clk.h> |
13 | 13 | ||
diff --git a/arch/mips/lantiq/xway/devices.c b/arch/mips/lantiq/xway/devices.c index d0e32ab2ea07..d614aa7ff07f 100644 --- a/arch/mips/lantiq/xway/devices.c +++ b/arch/mips/lantiq/xway/devices.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/module.h> | 10 | #include <linux/export.h> |
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/mtd/physmap.h> | 13 | #include <linux/mtd/physmap.h> |
diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c index 4278a459d6c4..cbb6ae5747b9 100644 --- a/arch/mips/lantiq/xway/dma.c +++ b/arch/mips/lantiq/xway/dma.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
22 | #include <linux/export.h> | ||
22 | 23 | ||
23 | #include <lantiq_soc.h> | 24 | #include <lantiq_soc.h> |
24 | #include <xway_dma.h> | 25 | #include <xway_dma.h> |
diff --git a/arch/mips/lantiq/xway/gpio.c b/arch/mips/lantiq/xway/gpio.c index a321451a5455..d2fa98f3c78d 100644 --- a/arch/mips/lantiq/xway/gpio.c +++ b/arch/mips/lantiq/xway/gpio.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/module.h> | 10 | #include <linux/export.h> |
11 | #include <linux/platform_device.h> | 11 | #include <linux/platform_device.h> |
12 | #include <linux/gpio.h> | 12 | #include <linux/gpio.h> |
13 | #include <linux/ioport.h> | 13 | #include <linux/ioport.h> |
diff --git a/arch/mips/lantiq/xway/gpio_ebu.c b/arch/mips/lantiq/xway/gpio_ebu.c index a479355abdb9..b91c7f17f10f 100644 --- a/arch/mips/lantiq/xway/gpio_ebu.c +++ b/arch/mips/lantiq/xway/gpio_ebu.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/module.h> | 10 | #include <linux/export.h> |
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/platform_device.h> | 12 | #include <linux/platform_device.h> |
13 | #include <linux/mutex.h> | 13 | #include <linux/mutex.h> |
diff --git a/arch/mips/lantiq/xway/gpio_stp.c b/arch/mips/lantiq/xway/gpio_stp.c index 67d59d690340..ff9991cddeaa 100644 --- a/arch/mips/lantiq/xway/gpio_stp.c +++ b/arch/mips/lantiq/xway/gpio_stp.c | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/module.h> | 12 | #include <linux/export.h> |
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/mutex.h> | 15 | #include <linux/mutex.h> |
diff --git a/arch/mips/lantiq/xway/prom-ase.c b/arch/mips/lantiq/xway/prom-ase.c index abe49f4db57f..ae4959ae865c 100644 --- a/arch/mips/lantiq/xway/prom-ase.c +++ b/arch/mips/lantiq/xway/prom-ase.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> | 6 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/export.h> |
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <asm/bootinfo.h> | 11 | #include <asm/bootinfo.h> |
12 | #include <asm/time.h> | 12 | #include <asm/time.h> |
diff --git a/arch/mips/lantiq/xway/prom-xway.c b/arch/mips/lantiq/xway/prom-xway.c index 1686692ac24d..2228133ca356 100644 --- a/arch/mips/lantiq/xway/prom-xway.c +++ b/arch/mips/lantiq/xway/prom-xway.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> | 6 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/export.h> |
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <asm/bootinfo.h> | 11 | #include <asm/bootinfo.h> |
12 | #include <asm/time.h> | 12 | #include <asm/time.h> |
diff --git a/arch/mips/lantiq/xway/reset.c b/arch/mips/lantiq/xway/reset.c index a1be36d0e490..3d41f0bb5bf7 100644 --- a/arch/mips/lantiq/xway/reset.c +++ b/arch/mips/lantiq/xway/reset.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <linux/io.h> | 10 | #include <linux/io.h> |
11 | #include <linux/ioport.h> | 11 | #include <linux/ioport.h> |
12 | #include <linux/pm.h> | 12 | #include <linux/pm.h> |
13 | #include <linux/module.h> | 13 | #include <linux/export.h> |
14 | #include <asm/reboot.h> | 14 | #include <asm/reboot.h> |
15 | 15 | ||
16 | #include <lantiq_soc.h> | 16 | #include <lantiq_soc.h> |
diff --git a/arch/mips/nxp/pnx8550/common/pci.c b/arch/mips/nxp/pnx8550/common/pci.c deleted file mode 100644 index 98e86ddb86cc..000000000000 --- a/arch/mips/nxp/pnx8550/common/pci.c +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * | ||
5 | * Author: source@mvista.com | ||
6 | * | ||
7 | * This program is free software; you can distribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License (Version 2) as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
14 | * for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
19 | */ | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/pci.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/init.h> | ||
24 | |||
25 | #include <pci.h> | ||
26 | #include <glb.h> | ||
27 | #include <nand.h> | ||
28 | |||
29 | static struct resource pci_io_resource = { | ||
30 | .start = PNX8550_PCIIO + 0x1000, /* reserve regacy I/O space */ | ||
31 | .end = PNX8550_PCIIO + PNX8550_PCIIO_SIZE, | ||
32 | .name = "pci IO space", | ||
33 | .flags = IORESOURCE_IO | ||
34 | }; | ||
35 | |||
36 | static struct resource pci_mem_resource = { | ||
37 | .start = PNX8550_PCIMEM, | ||
38 | .end = PNX8550_PCIMEM + PNX8550_PCIMEM_SIZE - 1, | ||
39 | .name = "pci memory space", | ||
40 | .flags = IORESOURCE_MEM | ||
41 | }; | ||
42 | |||
43 | extern struct pci_ops pnx8550_pci_ops; | ||
44 | |||
45 | static struct pci_controller pnx8550_controller = { | ||
46 | .pci_ops = &pnx8550_pci_ops, | ||
47 | .io_map_base = PNX8550_PORT_BASE, | ||
48 | .io_resource = &pci_io_resource, | ||
49 | .mem_resource = &pci_mem_resource, | ||
50 | }; | ||
51 | |||
52 | /* Return the total size of DRAM-memory, (RANK0 + RANK1) */ | ||
53 | static inline unsigned long get_system_mem_size(void) | ||
54 | { | ||
55 | /* Read IP2031_RANK0_ADDR_LO */ | ||
56 | unsigned long dram_r0_lo = inl(PCI_BASE | 0x65010); | ||
57 | /* Read IP2031_RANK1_ADDR_HI */ | ||
58 | unsigned long dram_r1_hi = inl(PCI_BASE | 0x65018); | ||
59 | |||
60 | return dram_r1_hi - dram_r0_lo + 1; | ||
61 | } | ||
62 | |||
63 | static int __init pnx8550_pci_setup(void) | ||
64 | { | ||
65 | int pci_mem_code; | ||
66 | int mem_size = get_system_mem_size() >> 20; | ||
67 | |||
68 | /* Clear the Global 2 Register, PCI Inta Output Enable Registers | ||
69 | Bit 1:Enable DAC Powerdown | ||
70 | -> 0:DACs are enabled and are working normally | ||
71 | 1:DACs are powerdown | ||
72 | Bit 0:Enable of PCI inta output | ||
73 | -> 0 = Disable PCI inta output | ||
74 | 1 = Enable PCI inta output | ||
75 | */ | ||
76 | PNX8550_GLB2_ENAB_INTA_O = 0; | ||
77 | |||
78 | /* Calc the PCI mem size code */ | ||
79 | if (mem_size >= 128) | ||
80 | pci_mem_code = SIZE_128M; | ||
81 | else if (mem_size >= 64) | ||
82 | pci_mem_code = SIZE_64M; | ||
83 | else if (mem_size >= 32) | ||
84 | pci_mem_code = SIZE_32M; | ||
85 | else | ||
86 | pci_mem_code = SIZE_16M; | ||
87 | |||
88 | /* Set PCI_XIO registers */ | ||
89 | outl(pci_mem_resource.start, PCI_BASE | PCI_BASE1_LO); | ||
90 | outl(pci_mem_resource.end + 1, PCI_BASE | PCI_BASE1_HI); | ||
91 | outl(pci_io_resource.start, PCI_BASE | PCI_BASE2_LO); | ||
92 | outl(pci_io_resource.end, PCI_BASE | PCI_BASE2_HI); | ||
93 | |||
94 | /* Send memory transaction via PCI_BASE2 */ | ||
95 | outl(0x00000001, PCI_BASE | PCI_IO); | ||
96 | |||
97 | /* Unlock the setup register */ | ||
98 | outl(0xca, PCI_BASE | PCI_UNLOCKREG); | ||
99 | |||
100 | /* | ||
101 | * BAR0 of PNX8550 (pci base 10) must be zero in order for ide | ||
102 | * to work, and in order for bus_to_baddr to work without any | ||
103 | * hacks. | ||
104 | */ | ||
105 | outl(0x00000000, PCI_BASE | PCI_BASE10); | ||
106 | |||
107 | /* | ||
108 | *These two bars are set by default or the boot code. | ||
109 | * However, it's safer to set them here so we're not boot | ||
110 | * code dependent. | ||
111 | */ | ||
112 | outl(0x1be00000, PCI_BASE | PCI_BASE14); /* PNX MMIO */ | ||
113 | outl(PNX8550_NAND_BASE_ADDR, PCI_BASE | PCI_BASE18); /* XIO */ | ||
114 | |||
115 | outl(PCI_EN_TA | | ||
116 | PCI_EN_PCI2MMI | | ||
117 | PCI_EN_XIO | | ||
118 | PCI_SETUP_BASE18_SIZE(SIZE_32M) | | ||
119 | PCI_SETUP_BASE18_EN | | ||
120 | PCI_SETUP_BASE14_EN | | ||
121 | PCI_SETUP_BASE10_PREF | | ||
122 | PCI_SETUP_BASE10_SIZE(pci_mem_code) | | ||
123 | PCI_SETUP_CFGMANAGE_EN | | ||
124 | PCI_SETUP_PCIARB_EN, | ||
125 | PCI_BASE | | ||
126 | PCI_SETUP); /* PCI_SETUP */ | ||
127 | outl(0x00000000, PCI_BASE | PCI_CTRL); /* PCI_CONTROL */ | ||
128 | |||
129 | register_pci_controller(&pnx8550_controller); | ||
130 | |||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | arch_initcall(pnx8550_pci_setup); | ||
diff --git a/arch/mips/nxp/pnx8550/common/setup.c b/arch/mips/nxp/pnx8550/common/setup.c deleted file mode 100644 index 71adac323323..000000000000 --- a/arch/mips/nxp/pnx8550/common/setup.c +++ /dev/null | |||
@@ -1,143 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * 2.6 port, Embedded Alley Solutions, Inc | ||
4 | * | ||
5 | * Based on Per Hallsmark, per.hallsmark@mvista.com | ||
6 | * | ||
7 | * This program is free software; you can distribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License (Version 2) as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
14 | * for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
19 | */ | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/irq.h> | ||
24 | #include <linux/mm.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/serial_pnx8xxx.h> | ||
28 | #include <linux/pm.h> | ||
29 | |||
30 | #include <asm/cpu.h> | ||
31 | #include <asm/bootinfo.h> | ||
32 | #include <asm/irq.h> | ||
33 | #include <asm/mipsregs.h> | ||
34 | #include <asm/reboot.h> | ||
35 | #include <asm/pgtable.h> | ||
36 | #include <asm/time.h> | ||
37 | |||
38 | #include <glb.h> | ||
39 | #include <int.h> | ||
40 | #include <pci.h> | ||
41 | #include <uart.h> | ||
42 | #include <nand.h> | ||
43 | |||
44 | extern void __init board_setup(void); | ||
45 | extern void pnx8550_machine_restart(char *); | ||
46 | extern void pnx8550_machine_halt(void); | ||
47 | extern void pnx8550_machine_power_off(void); | ||
48 | extern struct resource ioport_resource; | ||
49 | extern struct resource iomem_resource; | ||
50 | extern char *prom_getcmdline(void); | ||
51 | |||
52 | struct resource standard_io_resources[] = { | ||
53 | { | ||
54 | .start = 0x00, | ||
55 | .end = 0x1f, | ||
56 | .name = "dma1", | ||
57 | .flags = IORESOURCE_BUSY | ||
58 | }, { | ||
59 | .start = 0x40, | ||
60 | .end = 0x5f, | ||
61 | .name = "timer", | ||
62 | .flags = IORESOURCE_BUSY | ||
63 | }, { | ||
64 | .start = 0x80, | ||
65 | .end = 0x8f, | ||
66 | .name = "dma page reg", | ||
67 | .flags = IORESOURCE_BUSY | ||
68 | }, { | ||
69 | .start = 0xc0, | ||
70 | .end = 0xdf, | ||
71 | .name = "dma2", | ||
72 | .flags = IORESOURCE_BUSY | ||
73 | }, | ||
74 | }; | ||
75 | |||
76 | #define STANDARD_IO_RESOURCES ARRAY_SIZE(standard_io_resources) | ||
77 | |||
78 | extern struct resource pci_io_resource; | ||
79 | extern struct resource pci_mem_resource; | ||
80 | |||
81 | /* Return the total size of DRAM-memory, (RANK0 + RANK1) */ | ||
82 | unsigned long get_system_mem_size(void) | ||
83 | { | ||
84 | /* Read IP2031_RANK0_ADDR_LO */ | ||
85 | unsigned long dram_r0_lo = inl(PCI_BASE | 0x65010); | ||
86 | /* Read IP2031_RANK1_ADDR_HI */ | ||
87 | unsigned long dram_r1_hi = inl(PCI_BASE | 0x65018); | ||
88 | |||
89 | return dram_r1_hi - dram_r0_lo + 1; | ||
90 | } | ||
91 | |||
92 | int pnx8550_console_port = -1; | ||
93 | |||
94 | void __init plat_mem_setup(void) | ||
95 | { | ||
96 | int i; | ||
97 | char* argptr; | ||
98 | |||
99 | board_setup(); /* board specific setup */ | ||
100 | |||
101 | _machine_restart = pnx8550_machine_restart; | ||
102 | _machine_halt = pnx8550_machine_halt; | ||
103 | pm_power_off = pnx8550_machine_power_off; | ||
104 | |||
105 | /* Clear the Global 2 Register, PCI Inta Output Enable Registers | ||
106 | Bit 1:Enable DAC Powerdown | ||
107 | -> 0:DACs are enabled and are working normally | ||
108 | 1:DACs are powerdown | ||
109 | Bit 0:Enable of PCI inta output | ||
110 | -> 0 = Disable PCI inta output | ||
111 | 1 = Enable PCI inta output | ||
112 | */ | ||
113 | PNX8550_GLB2_ENAB_INTA_O = 0; | ||
114 | |||
115 | /* IO/MEM resources. */ | ||
116 | set_io_port_base(PNX8550_PORT_BASE); | ||
117 | ioport_resource.start = 0; | ||
118 | ioport_resource.end = ~0; | ||
119 | iomem_resource.start = 0; | ||
120 | iomem_resource.end = ~0; | ||
121 | |||
122 | /* Request I/O space for devices on this board */ | ||
123 | for (i = 0; i < STANDARD_IO_RESOURCES; i++) | ||
124 | request_resource(&ioport_resource, standard_io_resources + i); | ||
125 | |||
126 | /* Place the Mode Control bit for GPIO pin 16 in primary function */ | ||
127 | /* Pin 16 is used by UART1, UA1_TX */ | ||
128 | outl((PNX8550_GPIO_MODE_PRIMOP << PNX8550_GPIO_MC_16_BIT) | | ||
129 | (PNX8550_GPIO_MODE_PRIMOP << PNX8550_GPIO_MC_17_BIT), | ||
130 | PNX8550_GPIO_MC1); | ||
131 | |||
132 | argptr = prom_getcmdline(); | ||
133 | if ((argptr = strstr(argptr, "console=ttyS")) != NULL) { | ||
134 | argptr += strlen("console=ttyS"); | ||
135 | pnx8550_console_port = *argptr == '0' ? 0 : 1; | ||
136 | |||
137 | /* We must initialize the UART (console) before early printk */ | ||
138 | /* Set LCR to 8-bit and BAUD to 38400 (no 5) */ | ||
139 | ip3106_lcr(UART_BASE, pnx8550_console_port) = | ||
140 | PNX8XXX_UART_LCR_8BIT; | ||
141 | ip3106_baud(UART_BASE, pnx8550_console_port) = 5; | ||
142 | } | ||
143 | } | ||
diff --git a/arch/mips/pci/pci-alchemy.c b/arch/mips/pci/pci-alchemy.c index 4ee57104e47b..b5ce041cdafb 100644 --- a/arch/mips/pci/pci-alchemy.c +++ b/arch/mips/pci/pci-alchemy.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * Support for all devices (greater than 16) added by David Gathright. | 7 | * Support for all devices (greater than 16) added by David Gathright. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/export.h> | ||
10 | #include <linux/types.h> | 11 | #include <linux/types.h> |
11 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
12 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c index 8656388b34bd..be1e1afe12c3 100644 --- a/arch/mips/pci/pci-lantiq.c +++ b/arch/mips/pci/pci-lantiq.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
15 | #include <linux/vmalloc.h> | 15 | #include <linux/vmalloc.h> |
16 | #include <linux/export.h> | ||
16 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
17 | 18 | ||
18 | #include <asm/pci.h> | 19 | #include <asm/pci.h> |
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c index cf4c868715ac..dcc926e06fce 100644 --- a/arch/mips/pmc-sierra/yosemite/prom.c +++ b/arch/mips/pmc-sierra/yosemite/prom.c | |||
@@ -102,7 +102,7 @@ void __init prom_init(void) | |||
102 | 102 | ||
103 | /* Get the boot parameters */ | 103 | /* Get the boot parameters */ |
104 | for (i = 1; i < argc; i++) { | 104 | for (i = 1; i < argc; i++) { |
105 | if (strlen(arcs_cmdline) + strlen(arg[i] + 1) >= | 105 | if (strlen(arcs_cmdline) + strlen(arg[i]) + 1 >= |
106 | sizeof(arcs_cmdline)) | 106 | sizeof(arcs_cmdline)) |
107 | break; | 107 | break; |
108 | 108 | ||
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index b177caa56d95..951e18f5335b 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -345,7 +345,7 @@ config ARCH_ENABLE_MEMORY_HOTREMOVE | |||
345 | 345 | ||
346 | config KEXEC | 346 | config KEXEC |
347 | bool "kexec system call (EXPERIMENTAL)" | 347 | bool "kexec system call (EXPERIMENTAL)" |
348 | depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP && !47x)) && EXPERIMENTAL | 348 | depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP && !PPC_47x)) && EXPERIMENTAL |
349 | help | 349 | help |
350 | kexec is a system call that implements the ability to shutdown your | 350 | kexec is a system call that implements the ability to shutdown your |
351 | current kernel, and to start another kernel. It is like a reboot | 351 | current kernel, and to start another kernel. It is like a reboot |
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 57af16edc192..70ba0c0a1223 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile | |||
@@ -255,12 +255,6 @@ checkbin: | |||
255 | echo 'disable kernel modules' ; \ | 255 | echo 'disable kernel modules' ; \ |
256 | false ; \ | 256 | false ; \ |
257 | fi | 257 | fi |
258 | @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \ | ||
259 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \ | ||
260 | echo 'correctly with old versions of binutils.' ; \ | ||
261 | echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \ | ||
262 | false ; \ | ||
263 | fi | ||
264 | 258 | ||
265 | CLEAN_FILES += $(TOUT) | 259 | CLEAN_FILES += $(TOUT) |
266 | 260 | ||
diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h index e2a4c26ad377..02e41b53488d 100644 --- a/arch/powerpc/include/asm/atomic.h +++ b/arch/powerpc/include/asm/atomic.h | |||
@@ -49,13 +49,13 @@ static __inline__ int atomic_add_return(int a, atomic_t *v) | |||
49 | int t; | 49 | int t; |
50 | 50 | ||
51 | __asm__ __volatile__( | 51 | __asm__ __volatile__( |
52 | PPC_RELEASE_BARRIER | 52 | PPC_ATOMIC_ENTRY_BARRIER |
53 | "1: lwarx %0,0,%2 # atomic_add_return\n\ | 53 | "1: lwarx %0,0,%2 # atomic_add_return\n\ |
54 | add %0,%1,%0\n" | 54 | add %0,%1,%0\n" |
55 | PPC405_ERR77(0,%2) | 55 | PPC405_ERR77(0,%2) |
56 | " stwcx. %0,0,%2 \n\ | 56 | " stwcx. %0,0,%2 \n\ |
57 | bne- 1b" | 57 | bne- 1b" |
58 | PPC_ACQUIRE_BARRIER | 58 | PPC_ATOMIC_EXIT_BARRIER |
59 | : "=&r" (t) | 59 | : "=&r" (t) |
60 | : "r" (a), "r" (&v->counter) | 60 | : "r" (a), "r" (&v->counter) |
61 | : "cc", "memory"); | 61 | : "cc", "memory"); |
@@ -85,13 +85,13 @@ static __inline__ int atomic_sub_return(int a, atomic_t *v) | |||
85 | int t; | 85 | int t; |
86 | 86 | ||
87 | __asm__ __volatile__( | 87 | __asm__ __volatile__( |
88 | PPC_RELEASE_BARRIER | 88 | PPC_ATOMIC_ENTRY_BARRIER |
89 | "1: lwarx %0,0,%2 # atomic_sub_return\n\ | 89 | "1: lwarx %0,0,%2 # atomic_sub_return\n\ |
90 | subf %0,%1,%0\n" | 90 | subf %0,%1,%0\n" |
91 | PPC405_ERR77(0,%2) | 91 | PPC405_ERR77(0,%2) |
92 | " stwcx. %0,0,%2 \n\ | 92 | " stwcx. %0,0,%2 \n\ |
93 | bne- 1b" | 93 | bne- 1b" |
94 | PPC_ACQUIRE_BARRIER | 94 | PPC_ATOMIC_EXIT_BARRIER |
95 | : "=&r" (t) | 95 | : "=&r" (t) |
96 | : "r" (a), "r" (&v->counter) | 96 | : "r" (a), "r" (&v->counter) |
97 | : "cc", "memory"); | 97 | : "cc", "memory"); |
@@ -119,13 +119,13 @@ static __inline__ int atomic_inc_return(atomic_t *v) | |||
119 | int t; | 119 | int t; |
120 | 120 | ||
121 | __asm__ __volatile__( | 121 | __asm__ __volatile__( |
122 | PPC_RELEASE_BARRIER | 122 | PPC_ATOMIC_ENTRY_BARRIER |
123 | "1: lwarx %0,0,%1 # atomic_inc_return\n\ | 123 | "1: lwarx %0,0,%1 # atomic_inc_return\n\ |
124 | addic %0,%0,1\n" | 124 | addic %0,%0,1\n" |
125 | PPC405_ERR77(0,%1) | 125 | PPC405_ERR77(0,%1) |
126 | " stwcx. %0,0,%1 \n\ | 126 | " stwcx. %0,0,%1 \n\ |
127 | bne- 1b" | 127 | bne- 1b" |
128 | PPC_ACQUIRE_BARRIER | 128 | PPC_ATOMIC_EXIT_BARRIER |
129 | : "=&r" (t) | 129 | : "=&r" (t) |
130 | : "r" (&v->counter) | 130 | : "r" (&v->counter) |
131 | : "cc", "xer", "memory"); | 131 | : "cc", "xer", "memory"); |
@@ -163,13 +163,13 @@ static __inline__ int atomic_dec_return(atomic_t *v) | |||
163 | int t; | 163 | int t; |
164 | 164 | ||
165 | __asm__ __volatile__( | 165 | __asm__ __volatile__( |
166 | PPC_RELEASE_BARRIER | 166 | PPC_ATOMIC_ENTRY_BARRIER |
167 | "1: lwarx %0,0,%1 # atomic_dec_return\n\ | 167 | "1: lwarx %0,0,%1 # atomic_dec_return\n\ |
168 | addic %0,%0,-1\n" | 168 | addic %0,%0,-1\n" |
169 | PPC405_ERR77(0,%1) | 169 | PPC405_ERR77(0,%1) |
170 | " stwcx. %0,0,%1\n\ | 170 | " stwcx. %0,0,%1\n\ |
171 | bne- 1b" | 171 | bne- 1b" |
172 | PPC_ACQUIRE_BARRIER | 172 | PPC_ATOMIC_EXIT_BARRIER |
173 | : "=&r" (t) | 173 | : "=&r" (t) |
174 | : "r" (&v->counter) | 174 | : "r" (&v->counter) |
175 | : "cc", "xer", "memory"); | 175 | : "cc", "xer", "memory"); |
@@ -194,7 +194,7 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u) | |||
194 | int t; | 194 | int t; |
195 | 195 | ||
196 | __asm__ __volatile__ ( | 196 | __asm__ __volatile__ ( |
197 | PPC_RELEASE_BARRIER | 197 | PPC_ATOMIC_ENTRY_BARRIER |
198 | "1: lwarx %0,0,%1 # __atomic_add_unless\n\ | 198 | "1: lwarx %0,0,%1 # __atomic_add_unless\n\ |
199 | cmpw 0,%0,%3 \n\ | 199 | cmpw 0,%0,%3 \n\ |
200 | beq- 2f \n\ | 200 | beq- 2f \n\ |
@@ -202,7 +202,7 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u) | |||
202 | PPC405_ERR77(0,%2) | 202 | PPC405_ERR77(0,%2) |
203 | " stwcx. %0,0,%1 \n\ | 203 | " stwcx. %0,0,%1 \n\ |
204 | bne- 1b \n" | 204 | bne- 1b \n" |
205 | PPC_ACQUIRE_BARRIER | 205 | PPC_ATOMIC_EXIT_BARRIER |
206 | " subf %0,%2,%0 \n\ | 206 | " subf %0,%2,%0 \n\ |
207 | 2:" | 207 | 2:" |
208 | : "=&r" (t) | 208 | : "=&r" (t) |
@@ -226,7 +226,7 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v) | |||
226 | int t; | 226 | int t; |
227 | 227 | ||
228 | __asm__ __volatile__( | 228 | __asm__ __volatile__( |
229 | PPC_RELEASE_BARRIER | 229 | PPC_ATOMIC_ENTRY_BARRIER |
230 | "1: lwarx %0,0,%1 # atomic_dec_if_positive\n\ | 230 | "1: lwarx %0,0,%1 # atomic_dec_if_positive\n\ |
231 | cmpwi %0,1\n\ | 231 | cmpwi %0,1\n\ |
232 | addi %0,%0,-1\n\ | 232 | addi %0,%0,-1\n\ |
@@ -234,7 +234,7 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v) | |||
234 | PPC405_ERR77(0,%1) | 234 | PPC405_ERR77(0,%1) |
235 | " stwcx. %0,0,%1\n\ | 235 | " stwcx. %0,0,%1\n\ |
236 | bne- 1b" | 236 | bne- 1b" |
237 | PPC_ACQUIRE_BARRIER | 237 | PPC_ATOMIC_EXIT_BARRIER |
238 | "\n\ | 238 | "\n\ |
239 | 2:" : "=&b" (t) | 239 | 2:" : "=&b" (t) |
240 | : "r" (&v->counter) | 240 | : "r" (&v->counter) |
@@ -285,12 +285,12 @@ static __inline__ long atomic64_add_return(long a, atomic64_t *v) | |||
285 | long t; | 285 | long t; |
286 | 286 | ||
287 | __asm__ __volatile__( | 287 | __asm__ __volatile__( |
288 | PPC_RELEASE_BARRIER | 288 | PPC_ATOMIC_ENTRY_BARRIER |
289 | "1: ldarx %0,0,%2 # atomic64_add_return\n\ | 289 | "1: ldarx %0,0,%2 # atomic64_add_return\n\ |
290 | add %0,%1,%0\n\ | 290 | add %0,%1,%0\n\ |
291 | stdcx. %0,0,%2 \n\ | 291 | stdcx. %0,0,%2 \n\ |
292 | bne- 1b" | 292 | bne- 1b" |
293 | PPC_ACQUIRE_BARRIER | 293 | PPC_ATOMIC_EXIT_BARRIER |
294 | : "=&r" (t) | 294 | : "=&r" (t) |
295 | : "r" (a), "r" (&v->counter) | 295 | : "r" (a), "r" (&v->counter) |
296 | : "cc", "memory"); | 296 | : "cc", "memory"); |
@@ -319,12 +319,12 @@ static __inline__ long atomic64_sub_return(long a, atomic64_t *v) | |||
319 | long t; | 319 | long t; |
320 | 320 | ||
321 | __asm__ __volatile__( | 321 | __asm__ __volatile__( |
322 | PPC_RELEASE_BARRIER | 322 | PPC_ATOMIC_ENTRY_BARRIER |
323 | "1: ldarx %0,0,%2 # atomic64_sub_return\n\ | 323 | "1: ldarx %0,0,%2 # atomic64_sub_return\n\ |
324 | subf %0,%1,%0\n\ | 324 | subf %0,%1,%0\n\ |
325 | stdcx. %0,0,%2 \n\ | 325 | stdcx. %0,0,%2 \n\ |
326 | bne- 1b" | 326 | bne- 1b" |
327 | PPC_ACQUIRE_BARRIER | 327 | PPC_ATOMIC_EXIT_BARRIER |
328 | : "=&r" (t) | 328 | : "=&r" (t) |
329 | : "r" (a), "r" (&v->counter) | 329 | : "r" (a), "r" (&v->counter) |
330 | : "cc", "memory"); | 330 | : "cc", "memory"); |
@@ -351,12 +351,12 @@ static __inline__ long atomic64_inc_return(atomic64_t *v) | |||
351 | long t; | 351 | long t; |
352 | 352 | ||
353 | __asm__ __volatile__( | 353 | __asm__ __volatile__( |
354 | PPC_RELEASE_BARRIER | 354 | PPC_ATOMIC_ENTRY_BARRIER |
355 | "1: ldarx %0,0,%1 # atomic64_inc_return\n\ | 355 | "1: ldarx %0,0,%1 # atomic64_inc_return\n\ |
356 | addic %0,%0,1\n\ | 356 | addic %0,%0,1\n\ |
357 | stdcx. %0,0,%1 \n\ | 357 | stdcx. %0,0,%1 \n\ |
358 | bne- 1b" | 358 | bne- 1b" |
359 | PPC_ACQUIRE_BARRIER | 359 | PPC_ATOMIC_EXIT_BARRIER |
360 | : "=&r" (t) | 360 | : "=&r" (t) |
361 | : "r" (&v->counter) | 361 | : "r" (&v->counter) |
362 | : "cc", "xer", "memory"); | 362 | : "cc", "xer", "memory"); |
@@ -393,12 +393,12 @@ static __inline__ long atomic64_dec_return(atomic64_t *v) | |||
393 | long t; | 393 | long t; |
394 | 394 | ||
395 | __asm__ __volatile__( | 395 | __asm__ __volatile__( |
396 | PPC_RELEASE_BARRIER | 396 | PPC_ATOMIC_ENTRY_BARRIER |
397 | "1: ldarx %0,0,%1 # atomic64_dec_return\n\ | 397 | "1: ldarx %0,0,%1 # atomic64_dec_return\n\ |
398 | addic %0,%0,-1\n\ | 398 | addic %0,%0,-1\n\ |
399 | stdcx. %0,0,%1\n\ | 399 | stdcx. %0,0,%1\n\ |
400 | bne- 1b" | 400 | bne- 1b" |
401 | PPC_ACQUIRE_BARRIER | 401 | PPC_ATOMIC_EXIT_BARRIER |
402 | : "=&r" (t) | 402 | : "=&r" (t) |
403 | : "r" (&v->counter) | 403 | : "r" (&v->counter) |
404 | : "cc", "xer", "memory"); | 404 | : "cc", "xer", "memory"); |
@@ -418,13 +418,13 @@ static __inline__ long atomic64_dec_if_positive(atomic64_t *v) | |||
418 | long t; | 418 | long t; |
419 | 419 | ||
420 | __asm__ __volatile__( | 420 | __asm__ __volatile__( |
421 | PPC_RELEASE_BARRIER | 421 | PPC_ATOMIC_ENTRY_BARRIER |
422 | "1: ldarx %0,0,%1 # atomic64_dec_if_positive\n\ | 422 | "1: ldarx %0,0,%1 # atomic64_dec_if_positive\n\ |
423 | addic. %0,%0,-1\n\ | 423 | addic. %0,%0,-1\n\ |
424 | blt- 2f\n\ | 424 | blt- 2f\n\ |
425 | stdcx. %0,0,%1\n\ | 425 | stdcx. %0,0,%1\n\ |
426 | bne- 1b" | 426 | bne- 1b" |
427 | PPC_ACQUIRE_BARRIER | 427 | PPC_ATOMIC_EXIT_BARRIER |
428 | "\n\ | 428 | "\n\ |
429 | 2:" : "=&r" (t) | 429 | 2:" : "=&r" (t) |
430 | : "r" (&v->counter) | 430 | : "r" (&v->counter) |
@@ -450,14 +450,14 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) | |||
450 | long t; | 450 | long t; |
451 | 451 | ||
452 | __asm__ __volatile__ ( | 452 | __asm__ __volatile__ ( |
453 | PPC_RELEASE_BARRIER | 453 | PPC_ATOMIC_ENTRY_BARRIER |
454 | "1: ldarx %0,0,%1 # __atomic_add_unless\n\ | 454 | "1: ldarx %0,0,%1 # __atomic_add_unless\n\ |
455 | cmpd 0,%0,%3 \n\ | 455 | cmpd 0,%0,%3 \n\ |
456 | beq- 2f \n\ | 456 | beq- 2f \n\ |
457 | add %0,%2,%0 \n" | 457 | add %0,%2,%0 \n" |
458 | " stdcx. %0,0,%1 \n\ | 458 | " stdcx. %0,0,%1 \n\ |
459 | bne- 1b \n" | 459 | bne- 1b \n" |
460 | PPC_ACQUIRE_BARRIER | 460 | PPC_ATOMIC_EXIT_BARRIER |
461 | " subf %0,%2,%0 \n\ | 461 | " subf %0,%2,%0 \n\ |
462 | 2:" | 462 | 2:" |
463 | : "=&r" (t) | 463 | : "=&r" (t) |
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h index e137afcc10fa..efdc92618b38 100644 --- a/arch/powerpc/include/asm/bitops.h +++ b/arch/powerpc/include/asm/bitops.h | |||
@@ -124,14 +124,14 @@ static __inline__ unsigned long fn( \ | |||
124 | return (old & mask); \ | 124 | return (old & mask); \ |
125 | } | 125 | } |
126 | 126 | ||
127 | DEFINE_TESTOP(test_and_set_bits, or, PPC_RELEASE_BARRIER, | 127 | DEFINE_TESTOP(test_and_set_bits, or, PPC_ATOMIC_ENTRY_BARRIER, |
128 | PPC_ACQUIRE_BARRIER, 0) | 128 | PPC_ATOMIC_EXIT_BARRIER, 0) |
129 | DEFINE_TESTOP(test_and_set_bits_lock, or, "", | 129 | DEFINE_TESTOP(test_and_set_bits_lock, or, "", |
130 | PPC_ACQUIRE_BARRIER, 1) | 130 | PPC_ACQUIRE_BARRIER, 1) |
131 | DEFINE_TESTOP(test_and_clear_bits, andc, PPC_RELEASE_BARRIER, | 131 | DEFINE_TESTOP(test_and_clear_bits, andc, PPC_ATOMIC_ENTRY_BARRIER, |
132 | PPC_ACQUIRE_BARRIER, 0) | 132 | PPC_ATOMIC_EXIT_BARRIER, 0) |
133 | DEFINE_TESTOP(test_and_change_bits, xor, PPC_RELEASE_BARRIER, | 133 | DEFINE_TESTOP(test_and_change_bits, xor, PPC_ATOMIC_ENTRY_BARRIER, |
134 | PPC_ACQUIRE_BARRIER, 0) | 134 | PPC_ATOMIC_EXIT_BARRIER, 0) |
135 | 135 | ||
136 | static __inline__ int test_and_set_bit(unsigned long nr, | 136 | static __inline__ int test_and_set_bit(unsigned long nr, |
137 | volatile unsigned long *addr) | 137 | volatile unsigned long *addr) |
diff --git a/arch/powerpc/include/asm/futex.h b/arch/powerpc/include/asm/futex.h index c94e4a3fe2ef..2a9cf845473b 100644 --- a/arch/powerpc/include/asm/futex.h +++ b/arch/powerpc/include/asm/futex.h | |||
@@ -11,12 +11,13 @@ | |||
11 | 11 | ||
12 | #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ | 12 | #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ |
13 | __asm__ __volatile ( \ | 13 | __asm__ __volatile ( \ |
14 | PPC_RELEASE_BARRIER \ | 14 | PPC_ATOMIC_ENTRY_BARRIER \ |
15 | "1: lwarx %0,0,%2\n" \ | 15 | "1: lwarx %0,0,%2\n" \ |
16 | insn \ | 16 | insn \ |
17 | PPC405_ERR77(0, %2) \ | 17 | PPC405_ERR77(0, %2) \ |
18 | "2: stwcx. %1,0,%2\n" \ | 18 | "2: stwcx. %1,0,%2\n" \ |
19 | "bne- 1b\n" \ | 19 | "bne- 1b\n" \ |
20 | PPC_ATOMIC_EXIT_BARRIER \ | ||
20 | "li %1,0\n" \ | 21 | "li %1,0\n" \ |
21 | "3: .section .fixup,\"ax\"\n" \ | 22 | "3: .section .fixup,\"ax\"\n" \ |
22 | "4: li %1,%3\n" \ | 23 | "4: li %1,%3\n" \ |
@@ -92,14 +93,14 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
92 | return -EFAULT; | 93 | return -EFAULT; |
93 | 94 | ||
94 | __asm__ __volatile__ ( | 95 | __asm__ __volatile__ ( |
95 | PPC_RELEASE_BARRIER | 96 | PPC_ATOMIC_ENTRY_BARRIER |
96 | "1: lwarx %1,0,%3 # futex_atomic_cmpxchg_inatomic\n\ | 97 | "1: lwarx %1,0,%3 # futex_atomic_cmpxchg_inatomic\n\ |
97 | cmpw 0,%1,%4\n\ | 98 | cmpw 0,%1,%4\n\ |
98 | bne- 3f\n" | 99 | bne- 3f\n" |
99 | PPC405_ERR77(0,%3) | 100 | PPC405_ERR77(0,%3) |
100 | "2: stwcx. %5,0,%3\n\ | 101 | "2: stwcx. %5,0,%3\n\ |
101 | bne- 1b\n" | 102 | bne- 1b\n" |
102 | PPC_ACQUIRE_BARRIER | 103 | PPC_ATOMIC_EXIT_BARRIER |
103 | "3: .section .fixup,\"ax\"\n\ | 104 | "3: .section .fixup,\"ax\"\n\ |
104 | 4: li %0,%6\n\ | 105 | 4: li %0,%6\n\ |
105 | b 3b\n\ | 106 | b 3b\n\ |
diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h index 08fe69edcd10..0ad432bc81d6 100644 --- a/arch/powerpc/include/asm/kvm.h +++ b/arch/powerpc/include/asm/kvm.h | |||
@@ -149,12 +149,6 @@ struct kvm_regs { | |||
149 | #define KVM_SREGS_E_UPDATE_DBSR (1 << 3) | 149 | #define KVM_SREGS_E_UPDATE_DBSR (1 << 3) |
150 | 150 | ||
151 | /* | 151 | /* |
152 | * Book3S special bits to indicate contents in the struct by maintaining | ||
153 | * backwards compatibility with older structs. If adding a new field, | ||
154 | * please make sure to add a flag for that new field */ | ||
155 | #define KVM_SREGS_S_HIOR (1 << 0) | ||
156 | |||
157 | /* | ||
158 | * In KVM_SET_SREGS, reserved/pad fields must be left untouched from a | 152 | * In KVM_SET_SREGS, reserved/pad fields must be left untouched from a |
159 | * previous KVM_GET_REGS. | 153 | * previous KVM_GET_REGS. |
160 | * | 154 | * |
@@ -179,8 +173,6 @@ struct kvm_sregs { | |||
179 | __u64 ibat[8]; | 173 | __u64 ibat[8]; |
180 | __u64 dbat[8]; | 174 | __u64 dbat[8]; |
181 | } ppc32; | 175 | } ppc32; |
182 | __u64 flags; /* KVM_SREGS_S_ */ | ||
183 | __u64 hior; | ||
184 | } s; | 176 | } s; |
185 | struct { | 177 | struct { |
186 | union { | 178 | union { |
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index a384ffdf33de..d4df013ad779 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h | |||
@@ -90,8 +90,6 @@ struct kvmppc_vcpu_book3s { | |||
90 | #endif | 90 | #endif |
91 | int context_id[SID_CONTEXTS]; | 91 | int context_id[SID_CONTEXTS]; |
92 | 92 | ||
93 | bool hior_sregs; /* HIOR is set by SREGS, not PVR */ | ||
94 | |||
95 | struct hlist_head hpte_hash_pte[HPTEG_HASH_NUM_PTE]; | 93 | struct hlist_head hpte_hash_pte[HPTEG_HASH_NUM_PTE]; |
96 | struct hlist_head hpte_hash_pte_long[HPTEG_HASH_NUM_PTE_LONG]; | 94 | struct hlist_head hpte_hash_pte_long[HPTEG_HASH_NUM_PTE_LONG]; |
97 | struct hlist_head hpte_hash_vpte[HPTEG_HASH_NUM_VPTE]; | 95 | struct hlist_head hpte_hash_vpte[HPTEG_HASH_NUM_VPTE]; |
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h index 28cdbd9f399c..03c48e819c8e 100644 --- a/arch/powerpc/include/asm/reg_booke.h +++ b/arch/powerpc/include/asm/reg_booke.h | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | #define MSR_ MSR_ME | MSR_CE | 32 | #define MSR_ MSR_ME | MSR_CE |
33 | #define MSR_KERNEL MSR_ | MSR_64BIT | 33 | #define MSR_KERNEL MSR_ | MSR_64BIT |
34 | #define MSR_USER32 MSR_ | MSR_PR | MSR_EE | MSR_DE | 34 | #define MSR_USER32 MSR_ | MSR_PR | MSR_EE |
35 | #define MSR_USER64 MSR_USER32 | MSR_64BIT | 35 | #define MSR_USER64 MSR_USER32 | MSR_64BIT |
36 | #elif defined (CONFIG_40x) | 36 | #elif defined (CONFIG_40x) |
37 | #define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE) | 37 | #define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE) |
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h index 6fbce725c710..a0f358d4a00c 100644 --- a/arch/powerpc/include/asm/sections.h +++ b/arch/powerpc/include/asm/sections.h | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | #ifdef __powerpc64__ | 9 | #ifdef __powerpc64__ |
10 | 10 | ||
11 | extern char _end[]; | 11 | extern char __end_interrupts[]; |
12 | 12 | ||
13 | static inline int in_kernel_text(unsigned long addr) | 13 | static inline int in_kernel_text(unsigned long addr) |
14 | { | 14 | { |
diff --git a/arch/powerpc/include/asm/synch.h b/arch/powerpc/include/asm/synch.h index d7cab44643c5..e682a7143edb 100644 --- a/arch/powerpc/include/asm/synch.h +++ b/arch/powerpc/include/asm/synch.h | |||
@@ -13,6 +13,7 @@ | |||
13 | extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup; | 13 | extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup; |
14 | extern void do_lwsync_fixups(unsigned long value, void *fixup_start, | 14 | extern void do_lwsync_fixups(unsigned long value, void *fixup_start, |
15 | void *fixup_end); | 15 | void *fixup_end); |
16 | extern void do_final_fixups(void); | ||
16 | 17 | ||
17 | static inline void eieio(void) | 18 | static inline void eieio(void) |
18 | { | 19 | { |
@@ -41,11 +42,15 @@ static inline void isync(void) | |||
41 | START_LWSYNC_SECTION(97); \ | 42 | START_LWSYNC_SECTION(97); \ |
42 | isync; \ | 43 | isync; \ |
43 | MAKE_LWSYNC_SECTION_ENTRY(97, __lwsync_fixup); | 44 | MAKE_LWSYNC_SECTION_ENTRY(97, __lwsync_fixup); |
44 | #define PPC_ACQUIRE_BARRIER "\n" stringify_in_c(__PPC_ACQUIRE_BARRIER) | 45 | #define PPC_ACQUIRE_BARRIER "\n" stringify_in_c(__PPC_ACQUIRE_BARRIER) |
45 | #define PPC_RELEASE_BARRIER stringify_in_c(LWSYNC) "\n" | 46 | #define PPC_RELEASE_BARRIER stringify_in_c(LWSYNC) "\n" |
47 | #define PPC_ATOMIC_ENTRY_BARRIER "\n" stringify_in_c(LWSYNC) "\n" | ||
48 | #define PPC_ATOMIC_EXIT_BARRIER "\n" stringify_in_c(sync) "\n" | ||
46 | #else | 49 | #else |
47 | #define PPC_ACQUIRE_BARRIER | 50 | #define PPC_ACQUIRE_BARRIER |
48 | #define PPC_RELEASE_BARRIER | 51 | #define PPC_RELEASE_BARRIER |
52 | #define PPC_ATOMIC_ENTRY_BARRIER | ||
53 | #define PPC_ATOMIC_EXIT_BARRIER | ||
49 | #endif | 54 | #endif |
50 | 55 | ||
51 | #endif /* __KERNEL__ */ | 56 | #endif /* __KERNEL__ */ |
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 56212bc0ab08..4f80cf1ce77b 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -215,7 +215,22 @@ reenable_mmu: /* re-enable mmu so we can */ | |||
215 | stw r9,8(r1) | 215 | stw r9,8(r1) |
216 | stw r11,12(r1) | 216 | stw r11,12(r1) |
217 | stw r3,ORIG_GPR3(r1) | 217 | stw r3,ORIG_GPR3(r1) |
218 | /* | ||
219 | * The trace_hardirqs_off will use CALLER_ADDR0 and CALLER_ADDR1. | ||
220 | * If from user mode there is only one stack frame on the stack, and | ||
221 | * accessing CALLER_ADDR1 will cause oops. So we need create a dummy | ||
222 | * stack frame to make trace_hardirqs_off happy. | ||
223 | */ | ||
224 | andi. r12,r12,MSR_PR | ||
225 | beq 11f | ||
226 | stwu r1,-16(r1) | ||
227 | bl trace_hardirqs_off | ||
228 | addi r1,r1,16 | ||
229 | b 12f | ||
230 | |||
231 | 11: | ||
218 | bl trace_hardirqs_off | 232 | bl trace_hardirqs_off |
233 | 12: | ||
219 | lwz r0,GPR0(r1) | 234 | lwz r0,GPR0(r1) |
220 | lwz r3,ORIG_GPR3(r1) | 235 | lwz r3,ORIG_GPR3(r1) |
221 | lwz r4,GPR4(r1) | 236 | lwz r4,GPR4(r1) |
diff --git a/arch/powerpc/kernel/jump_label.c b/arch/powerpc/kernel/jump_label.c index 368d158d665d..a1ed8a8c7cb4 100644 --- a/arch/powerpc/kernel/jump_label.c +++ b/arch/powerpc/kernel/jump_label.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/jump_label.h> | 11 | #include <linux/jump_label.h> |
12 | #include <asm/code-patching.h> | 12 | #include <asm/code-patching.h> |
13 | 13 | ||
14 | #ifdef HAVE_JUMP_LABEL | ||
14 | void arch_jump_label_transform(struct jump_entry *entry, | 15 | void arch_jump_label_transform(struct jump_entry *entry, |
15 | enum jump_label_type type) | 16 | enum jump_label_type type) |
16 | { | 17 | { |
@@ -21,3 +22,4 @@ void arch_jump_label_transform(struct jump_entry *entry, | |||
21 | else | 22 | else |
22 | patch_instruction(addr, PPC_INST_NOP); | 23 | patch_instruction(addr, PPC_INST_NOP); |
23 | } | 24 | } |
25 | #endif | ||
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c index 35f27646c4ff..2985338d0e10 100644 --- a/arch/powerpc/kernel/kvm.c +++ b/arch/powerpc/kernel/kvm.c | |||
@@ -132,7 +132,6 @@ static void kvm_patch_ins_b(u32 *inst, int addr) | |||
132 | /* On relocatable kernels interrupts handlers and our code | 132 | /* On relocatable kernels interrupts handlers and our code |
133 | can be in different regions, so we don't patch them */ | 133 | can be in different regions, so we don't patch them */ |
134 | 134 | ||
135 | extern u32 __end_interrupts; | ||
136 | if ((ulong)inst < (ulong)&__end_interrupts) | 135 | if ((ulong)inst < (ulong)&__end_interrupts) |
137 | return; | 136 | return; |
138 | #endif | 137 | #endif |
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S index f7d760ab5ca1..7cd07b42ca1a 100644 --- a/arch/powerpc/kernel/misc_32.S +++ b/arch/powerpc/kernel/misc_32.S | |||
@@ -738,7 +738,7 @@ relocate_new_kernel: | |||
738 | mr r5, r31 | 738 | mr r5, r31 |
739 | 739 | ||
740 | li r0, 0 | 740 | li r0, 0 |
741 | #elif defined(CONFIG_44x) && !defined(CONFIG_47x) | 741 | #elif defined(CONFIG_44x) && !defined(CONFIG_PPC_47x) |
742 | 742 | ||
743 | /* | 743 | /* |
744 | * Code for setting up 1:1 mapping for PPC440x for KEXEC | 744 | * Code for setting up 1:1 mapping for PPC440x for KEXEC |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 9054ca9ab4f9..6457574c0b2f 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -486,28 +486,6 @@ struct task_struct *__switch_to(struct task_struct *prev, | |||
486 | new_thread = &new->thread; | 486 | new_thread = &new->thread; |
487 | old_thread = ¤t->thread; | 487 | old_thread = ¤t->thread; |
488 | 488 | ||
489 | #if defined(CONFIG_PPC_BOOK3E_64) | ||
490 | /* XXX Current Book3E code doesn't deal with kernel side DBCR0, | ||
491 | * we always hold the user values, so we set it now. | ||
492 | * | ||
493 | * However, we ensure the kernel MSR:DE is appropriately cleared too | ||
494 | * to avoid spurrious single step exceptions in the kernel. | ||
495 | * | ||
496 | * This will have to change to merge with the ppc32 code at some point, | ||
497 | * but I don't like much what ppc32 is doing today so there's some | ||
498 | * thinking needed there | ||
499 | */ | ||
500 | if ((new_thread->dbcr0 | old_thread->dbcr0) & DBCR0_IDM) { | ||
501 | u32 dbcr0; | ||
502 | |||
503 | mtmsr(mfmsr() & ~MSR_DE); | ||
504 | isync(); | ||
505 | dbcr0 = mfspr(SPRN_DBCR0); | ||
506 | dbcr0 = (dbcr0 & DBCR0_EDM) | new_thread->dbcr0; | ||
507 | mtspr(SPRN_DBCR0, dbcr0); | ||
508 | } | ||
509 | #endif /* CONFIG_PPC64_BOOK3E */ | ||
510 | |||
511 | #ifdef CONFIG_PPC64 | 489 | #ifdef CONFIG_PPC64 |
512 | /* | 490 | /* |
513 | * Collect processor utilization data per process | 491 | * Collect processor utilization data per process |
@@ -657,7 +635,7 @@ void show_regs(struct pt_regs * regs) | |||
657 | if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR)) | 635 | if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR)) |
658 | printk("CFAR: "REG"\n", regs->orig_gpr3); | 636 | printk("CFAR: "REG"\n", regs->orig_gpr3); |
659 | if (trap == 0x300 || trap == 0x600) | 637 | if (trap == 0x300 || trap == 0x600) |
660 | #ifdef CONFIG_PPC_ADV_DEBUG_REGS | 638 | #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) |
661 | printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr); | 639 | printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr); |
662 | #else | 640 | #else |
663 | printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr); | 641 | printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr); |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index b4fa66127495..cc584865b3df 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -1579,10 +1579,8 @@ static void __init prom_instantiate_rtas(void) | |||
1579 | return; | 1579 | return; |
1580 | 1580 | ||
1581 | base = alloc_down(size, PAGE_SIZE, 0); | 1581 | base = alloc_down(size, PAGE_SIZE, 0); |
1582 | if (base == 0) { | 1582 | if (base == 0) |
1583 | prom_printf("RTAS allocation failed !\n"); | 1583 | prom_panic("Could not allocate memory for RTAS\n"); |
1584 | return; | ||
1585 | } | ||
1586 | 1584 | ||
1587 | rtas_inst = call_prom("open", 1, 1, ADDR("/rtas")); | 1585 | rtas_inst = call_prom("open", 1, 1, ADDR("/rtas")); |
1588 | if (!IHANDLE_VALID(rtas_inst)) { | 1586 | if (!IHANDLE_VALID(rtas_inst)) { |
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index c1ce86357ecb..ac7610815113 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -107,6 +107,8 @@ notrace unsigned long __init early_init(unsigned long dt_ptr) | |||
107 | PTRRELOC(&__start___lwsync_fixup), | 107 | PTRRELOC(&__start___lwsync_fixup), |
108 | PTRRELOC(&__stop___lwsync_fixup)); | 108 | PTRRELOC(&__stop___lwsync_fixup)); |
109 | 109 | ||
110 | do_final_fixups(); | ||
111 | |||
110 | return KERNELBASE + offset; | 112 | return KERNELBASE + offset; |
111 | } | 113 | } |
112 | 114 | ||
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 1a9dea80a69b..fb9bb46e7e88 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -359,6 +359,7 @@ void __init setup_system(void) | |||
359 | &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup); | 359 | &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup); |
360 | do_lwsync_fixups(cur_cpu_spec->cpu_features, | 360 | do_lwsync_fixups(cur_cpu_spec->cpu_features, |
361 | &__start___lwsync_fixup, &__stop___lwsync_fixup); | 361 | &__start___lwsync_fixup, &__stop___lwsync_fixup); |
362 | do_final_fixups(); | ||
362 | 363 | ||
363 | /* | 364 | /* |
364 | * Unflatten the device-tree passed by prom_init or kexec | 365 | * Unflatten the device-tree passed by prom_init or kexec |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 78b76dc54dfb..836a5a19eb2c 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -97,7 +97,7 @@ static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set) | |||
97 | compat_sigset_t cset; | 97 | compat_sigset_t cset; |
98 | 98 | ||
99 | switch (_NSIG_WORDS) { | 99 | switch (_NSIG_WORDS) { |
100 | case 4: cset.sig[5] = set->sig[3] & 0xffffffffull; | 100 | case 4: cset.sig[6] = set->sig[3] & 0xffffffffull; |
101 | cset.sig[7] = set->sig[3] >> 32; | 101 | cset.sig[7] = set->sig[3] >> 32; |
102 | case 3: cset.sig[4] = set->sig[2] & 0xffffffffull; | 102 | case 3: cset.sig[4] = set->sig[2] & 0xffffffffull; |
103 | cset.sig[5] = set->sig[2] >> 32; | 103 | cset.sig[5] = set->sig[2] >> 32; |
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 4e5908264d1a..5459d148a0f6 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -1298,14 +1298,12 @@ void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) | |||
1298 | 1298 | ||
1299 | if (user_mode(regs)) { | 1299 | if (user_mode(regs)) { |
1300 | current->thread.dbcr0 &= ~DBCR0_IC; | 1300 | current->thread.dbcr0 &= ~DBCR0_IC; |
1301 | #ifdef CONFIG_PPC_ADV_DEBUG_REGS | ||
1302 | if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, | 1301 | if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, |
1303 | current->thread.dbcr1)) | 1302 | current->thread.dbcr1)) |
1304 | regs->msr |= MSR_DE; | 1303 | regs->msr |= MSR_DE; |
1305 | else | 1304 | else |
1306 | /* Make sure the IDM bit is off */ | 1305 | /* Make sure the IDM bit is off */ |
1307 | current->thread.dbcr0 &= ~DBCR0_IDM; | 1306 | current->thread.dbcr0 &= ~DBCR0_IDM; |
1308 | #endif | ||
1309 | } | 1307 | } |
1310 | 1308 | ||
1311 | _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); | 1309 | _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); |
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 0cdbc07cec14..0cb137a9b038 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <asm/processor.h> | 44 | #include <asm/processor.h> |
45 | #include <asm/cputhreads.h> | 45 | #include <asm/cputhreads.h> |
46 | #include <asm/page.h> | 46 | #include <asm/page.h> |
47 | #include <asm/hvcall.h> | ||
47 | #include <linux/gfp.h> | 48 | #include <linux/gfp.h> |
48 | #include <linux/sched.h> | 49 | #include <linux/sched.h> |
49 | #include <linux/vmalloc.h> | 50 | #include <linux/vmalloc.h> |
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index bc4d50dec78b..3c791e1eb675 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c | |||
@@ -151,16 +151,14 @@ void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr) | |||
151 | #ifdef CONFIG_PPC_BOOK3S_64 | 151 | #ifdef CONFIG_PPC_BOOK3S_64 |
152 | if ((pvr >= 0x330000) && (pvr < 0x70330000)) { | 152 | if ((pvr >= 0x330000) && (pvr < 0x70330000)) { |
153 | kvmppc_mmu_book3s_64_init(vcpu); | 153 | kvmppc_mmu_book3s_64_init(vcpu); |
154 | if (!to_book3s(vcpu)->hior_sregs) | 154 | to_book3s(vcpu)->hior = 0xfff00000; |
155 | to_book3s(vcpu)->hior = 0xfff00000; | ||
156 | to_book3s(vcpu)->msr_mask = 0xffffffffffffffffULL; | 155 | to_book3s(vcpu)->msr_mask = 0xffffffffffffffffULL; |
157 | vcpu->arch.cpu_type = KVM_CPU_3S_64; | 156 | vcpu->arch.cpu_type = KVM_CPU_3S_64; |
158 | } else | 157 | } else |
159 | #endif | 158 | #endif |
160 | { | 159 | { |
161 | kvmppc_mmu_book3s_32_init(vcpu); | 160 | kvmppc_mmu_book3s_32_init(vcpu); |
162 | if (!to_book3s(vcpu)->hior_sregs) | 161 | to_book3s(vcpu)->hior = 0; |
163 | to_book3s(vcpu)->hior = 0; | ||
164 | to_book3s(vcpu)->msr_mask = 0xffffffffULL; | 162 | to_book3s(vcpu)->msr_mask = 0xffffffffULL; |
165 | vcpu->arch.cpu_type = KVM_CPU_3S_32; | 163 | vcpu->arch.cpu_type = KVM_CPU_3S_32; |
166 | } | 164 | } |
@@ -797,9 +795,6 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, | |||
797 | } | 795 | } |
798 | } | 796 | } |
799 | 797 | ||
800 | if (sregs->u.s.flags & KVM_SREGS_S_HIOR) | ||
801 | sregs->u.s.hior = to_book3s(vcpu)->hior; | ||
802 | |||
803 | return 0; | 798 | return 0; |
804 | } | 799 | } |
805 | 800 | ||
@@ -836,11 +831,6 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, | |||
836 | /* Flush the MMU after messing with the segments */ | 831 | /* Flush the MMU after messing with the segments */ |
837 | kvmppc_mmu_pte_flush(vcpu, 0, 0); | 832 | kvmppc_mmu_pte_flush(vcpu, 0, 0); |
838 | 833 | ||
839 | if (sregs->u.s.flags & KVM_SREGS_S_HIOR) { | ||
840 | to_book3s(vcpu)->hior_sregs = true; | ||
841 | to_book3s(vcpu)->hior = sregs->u.s.hior; | ||
842 | } | ||
843 | |||
844 | return 0; | 834 | return 0; |
845 | } | 835 | } |
846 | 836 | ||
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index efbf9ad87203..607fbdf24b84 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -208,7 +208,6 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
208 | case KVM_CAP_PPC_BOOKE_SREGS: | 208 | case KVM_CAP_PPC_BOOKE_SREGS: |
209 | #else | 209 | #else |
210 | case KVM_CAP_PPC_SEGSTATE: | 210 | case KVM_CAP_PPC_SEGSTATE: |
211 | case KVM_CAP_PPC_HIOR: | ||
212 | case KVM_CAP_PPC_PAPR: | 211 | case KVM_CAP_PPC_PAPR: |
213 | #endif | 212 | #endif |
214 | case KVM_CAP_PPC_UNSET_IRQ: | 213 | case KVM_CAP_PPC_UNSET_IRQ: |
diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c index 0d08d0171392..7a8a7487cee8 100644 --- a/arch/powerpc/lib/feature-fixups.c +++ b/arch/powerpc/lib/feature-fixups.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <asm/cputable.h> | 19 | #include <asm/cputable.h> |
20 | #include <asm/code-patching.h> | 20 | #include <asm/code-patching.h> |
21 | #include <asm/page.h> | ||
22 | #include <asm/sections.h> | ||
21 | 23 | ||
22 | 24 | ||
23 | struct fixup_entry { | 25 | struct fixup_entry { |
@@ -128,6 +130,27 @@ void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end) | |||
128 | } | 130 | } |
129 | } | 131 | } |
130 | 132 | ||
133 | void do_final_fixups(void) | ||
134 | { | ||
135 | #if defined(CONFIG_PPC64) && defined(CONFIG_RELOCATABLE) | ||
136 | int *src, *dest; | ||
137 | unsigned long length; | ||
138 | |||
139 | if (PHYSICAL_START == 0) | ||
140 | return; | ||
141 | |||
142 | src = (int *)(KERNELBASE + PHYSICAL_START); | ||
143 | dest = (int *)KERNELBASE; | ||
144 | length = (__end_interrupts - _stext) / sizeof(int); | ||
145 | |||
146 | while (length--) { | ||
147 | patch_instruction(dest, *src); | ||
148 | src++; | ||
149 | dest++; | ||
150 | } | ||
151 | #endif | ||
152 | } | ||
153 | |||
131 | #ifdef CONFIG_FTR_FIXUP_SELFTEST | 154 | #ifdef CONFIG_FTR_FIXUP_SELFTEST |
132 | 155 | ||
133 | #define check(x) \ | 156 | #define check(x) \ |
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index e4588721ef34..3fe6d927ad70 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig | |||
@@ -347,7 +347,7 @@ config SIMPLE_GPIO | |||
347 | 347 | ||
348 | config MCU_MPC8349EMITX | 348 | config MCU_MPC8349EMITX |
349 | bool "MPC8349E-mITX MCU driver" | 349 | bool "MPC8349E-mITX MCU driver" |
350 | depends on I2C && PPC_83xx | 350 | depends on I2C=y && PPC_83xx |
351 | select GENERIC_GPIO | 351 | select GENERIC_GPIO |
352 | select ARCH_REQUIRE_GPIOLIB | 352 | select ARCH_REQUIRE_GPIOLIB |
353 | help | 353 | help |
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c index 404bc52b7806..1d6f4f478fe2 100644 --- a/arch/powerpc/platforms/ps3/interrupt.c +++ b/arch/powerpc/platforms/ps3/interrupt.c | |||
@@ -88,6 +88,7 @@ struct ps3_private { | |||
88 | struct ps3_bmp bmp __attribute__ ((aligned (PS3_BMP_MINALIGN))); | 88 | struct ps3_bmp bmp __attribute__ ((aligned (PS3_BMP_MINALIGN))); |
89 | u64 ppe_id; | 89 | u64 ppe_id; |
90 | u64 thread_id; | 90 | u64 thread_id; |
91 | unsigned long ipi_mask; | ||
91 | }; | 92 | }; |
92 | 93 | ||
93 | static DEFINE_PER_CPU(struct ps3_private, ps3_private); | 94 | static DEFINE_PER_CPU(struct ps3_private, ps3_private); |
@@ -144,7 +145,11 @@ static void ps3_chip_unmask(struct irq_data *d) | |||
144 | static void ps3_chip_eoi(struct irq_data *d) | 145 | static void ps3_chip_eoi(struct irq_data *d) |
145 | { | 146 | { |
146 | const struct ps3_private *pd = irq_data_get_irq_chip_data(d); | 147 | const struct ps3_private *pd = irq_data_get_irq_chip_data(d); |
147 | lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, d->irq); | 148 | |
149 | /* non-IPIs are EOIed here. */ | ||
150 | |||
151 | if (!test_bit(63 - d->irq, &pd->ipi_mask)) | ||
152 | lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, d->irq); | ||
148 | } | 153 | } |
149 | 154 | ||
150 | /** | 155 | /** |
@@ -691,6 +696,16 @@ void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq) | |||
691 | cpu, virq, pd->bmp.ipi_debug_brk_mask); | 696 | cpu, virq, pd->bmp.ipi_debug_brk_mask); |
692 | } | 697 | } |
693 | 698 | ||
699 | void __init ps3_register_ipi_irq(unsigned int cpu, unsigned int virq) | ||
700 | { | ||
701 | struct ps3_private *pd = &per_cpu(ps3_private, cpu); | ||
702 | |||
703 | set_bit(63 - virq, &pd->ipi_mask); | ||
704 | |||
705 | DBG("%s:%d: cpu %u, virq %u, ipi_mask %lxh\n", __func__, __LINE__, | ||
706 | cpu, virq, pd->ipi_mask); | ||
707 | } | ||
708 | |||
694 | static unsigned int ps3_get_irq(void) | 709 | static unsigned int ps3_get_irq(void) |
695 | { | 710 | { |
696 | struct ps3_private *pd = &__get_cpu_var(ps3_private); | 711 | struct ps3_private *pd = &__get_cpu_var(ps3_private); |
@@ -720,6 +735,12 @@ static unsigned int ps3_get_irq(void) | |||
720 | BUG(); | 735 | BUG(); |
721 | } | 736 | } |
722 | #endif | 737 | #endif |
738 | |||
739 | /* IPIs are EOIed here. */ | ||
740 | |||
741 | if (test_bit(63 - plug, &pd->ipi_mask)) | ||
742 | lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, plug); | ||
743 | |||
723 | return plug; | 744 | return plug; |
724 | } | 745 | } |
725 | 746 | ||
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h index 9a196a88eda7..1a633ed0fe98 100644 --- a/arch/powerpc/platforms/ps3/platform.h +++ b/arch/powerpc/platforms/ps3/platform.h | |||
@@ -43,6 +43,7 @@ void ps3_mm_shutdown(void); | |||
43 | void ps3_init_IRQ(void); | 43 | void ps3_init_IRQ(void); |
44 | void ps3_shutdown_IRQ(int cpu); | 44 | void ps3_shutdown_IRQ(int cpu); |
45 | void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq); | 45 | void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq); |
46 | void __init ps3_register_ipi_irq(unsigned int cpu, unsigned int virq); | ||
46 | 47 | ||
47 | /* smp */ | 48 | /* smp */ |
48 | 49 | ||
diff --git a/arch/powerpc/platforms/ps3/smp.c b/arch/powerpc/platforms/ps3/smp.c index 4c44794faac0..efc1cd8c034a 100644 --- a/arch/powerpc/platforms/ps3/smp.c +++ b/arch/powerpc/platforms/ps3/smp.c | |||
@@ -59,46 +59,49 @@ static void ps3_smp_message_pass(int cpu, int msg) | |||
59 | 59 | ||
60 | static int ps3_smp_probe(void) | 60 | static int ps3_smp_probe(void) |
61 | { | 61 | { |
62 | return 2; | 62 | int cpu; |
63 | } | ||
64 | 63 | ||
65 | static void __init ps3_smp_setup_cpu(int cpu) | 64 | for (cpu = 0; cpu < 2; cpu++) { |
66 | { | 65 | int result; |
67 | int result; | 66 | unsigned int *virqs = per_cpu(ps3_ipi_virqs, cpu); |
68 | unsigned int *virqs = per_cpu(ps3_ipi_virqs, cpu); | 67 | int i; |
69 | int i; | ||
70 | 68 | ||
71 | DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu); | 69 | DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu); |
72 | 70 | ||
73 | /* | 71 | /* |
74 | * Check assumptions on ps3_ipi_virqs[] indexing. If this | 72 | * Check assumptions on ps3_ipi_virqs[] indexing. If this |
75 | * check fails, then a different mapping of PPC_MSG_ | 73 | * check fails, then a different mapping of PPC_MSG_ |
76 | * to index needs to be setup. | 74 | * to index needs to be setup. |
77 | */ | 75 | */ |
78 | 76 | ||
79 | BUILD_BUG_ON(PPC_MSG_CALL_FUNCTION != 0); | 77 | BUILD_BUG_ON(PPC_MSG_CALL_FUNCTION != 0); |
80 | BUILD_BUG_ON(PPC_MSG_RESCHEDULE != 1); | 78 | BUILD_BUG_ON(PPC_MSG_RESCHEDULE != 1); |
81 | BUILD_BUG_ON(PPC_MSG_CALL_FUNC_SINGLE != 2); | 79 | BUILD_BUG_ON(PPC_MSG_CALL_FUNC_SINGLE != 2); |
82 | BUILD_BUG_ON(PPC_MSG_DEBUGGER_BREAK != 3); | 80 | BUILD_BUG_ON(PPC_MSG_DEBUGGER_BREAK != 3); |
83 | 81 | ||
84 | for (i = 0; i < MSG_COUNT; i++) { | 82 | for (i = 0; i < MSG_COUNT; i++) { |
85 | result = ps3_event_receive_port_setup(cpu, &virqs[i]); | 83 | result = ps3_event_receive_port_setup(cpu, &virqs[i]); |
86 | 84 | ||
87 | if (result) | 85 | if (result) |
88 | continue; | 86 | continue; |
89 | 87 | ||
90 | DBG("%s:%d: (%d, %d) => virq %u\n", | 88 | DBG("%s:%d: (%d, %d) => virq %u\n", |
91 | __func__, __LINE__, cpu, i, virqs[i]); | 89 | __func__, __LINE__, cpu, i, virqs[i]); |
92 | 90 | ||
93 | result = smp_request_message_ipi(virqs[i], i); | 91 | result = smp_request_message_ipi(virqs[i], i); |
94 | 92 | ||
95 | if (result) | 93 | if (result) |
96 | virqs[i] = NO_IRQ; | 94 | virqs[i] = NO_IRQ; |
97 | } | 95 | else |
96 | ps3_register_ipi_irq(cpu, virqs[i]); | ||
97 | } | ||
98 | 98 | ||
99 | ps3_register_ipi_debug_brk(cpu, virqs[PPC_MSG_DEBUGGER_BREAK]); | 99 | ps3_register_ipi_debug_brk(cpu, virqs[PPC_MSG_DEBUGGER_BREAK]); |
100 | 100 | ||
101 | DBG(" <- %s:%d: (%d)\n", __func__, __LINE__, cpu); | 101 | DBG(" <- %s:%d: (%d)\n", __func__, __LINE__, cpu); |
102 | } | ||
103 | |||
104 | return 2; | ||
102 | } | 105 | } |
103 | 106 | ||
104 | void ps3_smp_cleanup_cpu(int cpu) | 107 | void ps3_smp_cleanup_cpu(int cpu) |
@@ -121,7 +124,6 @@ static struct smp_ops_t ps3_smp_ops = { | |||
121 | .probe = ps3_smp_probe, | 124 | .probe = ps3_smp_probe, |
122 | .message_pass = ps3_smp_message_pass, | 125 | .message_pass = ps3_smp_message_pass, |
123 | .kick_cpu = smp_generic_kick_cpu, | 126 | .kick_cpu = smp_generic_kick_cpu, |
124 | .setup_cpu = ps3_smp_setup_cpu, | ||
125 | }; | 127 | }; |
126 | 128 | ||
127 | void smp_init_ps3(void) | 129 | void smp_init_ps3(void) |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index a9fbd43395f7..373679b3744a 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -572,6 +572,7 @@ config KEXEC | |||
572 | config CRASH_DUMP | 572 | config CRASH_DUMP |
573 | bool "kernel crash dumps" | 573 | bool "kernel crash dumps" |
574 | depends on 64BIT | 574 | depends on 64BIT |
575 | select KEXEC | ||
575 | help | 576 | help |
576 | Generate crash dump after being started by kexec. | 577 | Generate crash dump after being started by kexec. |
577 | Crash dump kernels are loaded in the main kernel with kexec-tools | 578 | Crash dump kernels are loaded in the main kernel with kexec-tools |
diff --git a/arch/s390/crypto/crypt_s390.h b/arch/s390/crypto/crypt_s390.h index 49676771bd66..ffd1ac255f19 100644 --- a/arch/s390/crypto/crypt_s390.h +++ b/arch/s390/crypto/crypt_s390.h | |||
@@ -368,9 +368,12 @@ static inline int crypt_s390_func_available(int func, | |||
368 | 368 | ||
369 | if (facility_mask & CRYPT_S390_MSA && !test_facility(17)) | 369 | if (facility_mask & CRYPT_S390_MSA && !test_facility(17)) |
370 | return 0; | 370 | return 0; |
371 | if (facility_mask & CRYPT_S390_MSA3 && !test_facility(76)) | 371 | |
372 | if (facility_mask & CRYPT_S390_MSA3 && | ||
373 | (!test_facility(2) || !test_facility(76))) | ||
372 | return 0; | 374 | return 0; |
373 | if (facility_mask & CRYPT_S390_MSA4 && !test_facility(77)) | 375 | if (facility_mask & CRYPT_S390_MSA4 && |
376 | (!test_facility(2) || !test_facility(77))) | ||
374 | return 0; | 377 | return 0; |
375 | 378 | ||
376 | switch (func & CRYPT_S390_OP_MASK) { | 379 | switch (func & CRYPT_S390_OP_MASK) { |
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h index 24e18473d926..b0c235cb6ad5 100644 --- a/arch/s390/include/asm/kvm_host.h +++ b/arch/s390/include/asm/kvm_host.h | |||
@@ -47,7 +47,7 @@ struct sca_block { | |||
47 | #define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1)) | 47 | #define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1)) |
48 | #define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE) | 48 | #define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE) |
49 | 49 | ||
50 | #define CPUSTAT_HOST 0x80000000 | 50 | #define CPUSTAT_STOPPED 0x80000000 |
51 | #define CPUSTAT_WAIT 0x10000000 | 51 | #define CPUSTAT_WAIT 0x10000000 |
52 | #define CPUSTAT_ECALL_PEND 0x08000000 | 52 | #define CPUSTAT_ECALL_PEND 0x08000000 |
53 | #define CPUSTAT_STOP_INT 0x04000000 | 53 | #define CPUSTAT_STOP_INT 0x04000000 |
@@ -139,6 +139,7 @@ struct kvm_vcpu_stat { | |||
139 | u32 instruction_stfl; | 139 | u32 instruction_stfl; |
140 | u32 instruction_tprot; | 140 | u32 instruction_tprot; |
141 | u32 instruction_sigp_sense; | 141 | u32 instruction_sigp_sense; |
142 | u32 instruction_sigp_sense_running; | ||
142 | u32 instruction_sigp_external_call; | 143 | u32 instruction_sigp_external_call; |
143 | u32 instruction_sigp_emergency; | 144 | u32 instruction_sigp_emergency; |
144 | u32 instruction_sigp_stop; | 145 | u32 instruction_sigp_stop; |
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 34ede0ea85a9..524d23b8610c 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
@@ -593,6 +593,8 @@ static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste) | |||
593 | unsigned long address, bits; | 593 | unsigned long address, bits; |
594 | unsigned char skey; | 594 | unsigned char skey; |
595 | 595 | ||
596 | if (!pte_present(*ptep)) | ||
597 | return pgste; | ||
596 | address = pte_val(*ptep) & PAGE_MASK; | 598 | address = pte_val(*ptep) & PAGE_MASK; |
597 | skey = page_get_storage_key(address); | 599 | skey = page_get_storage_key(address); |
598 | bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); | 600 | bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); |
@@ -625,6 +627,8 @@ static inline pgste_t pgste_update_young(pte_t *ptep, pgste_t pgste) | |||
625 | #ifdef CONFIG_PGSTE | 627 | #ifdef CONFIG_PGSTE |
626 | int young; | 628 | int young; |
627 | 629 | ||
630 | if (!pte_present(*ptep)) | ||
631 | return pgste; | ||
628 | young = page_reset_referenced(pte_val(*ptep) & PAGE_MASK); | 632 | young = page_reset_referenced(pte_val(*ptep) & PAGE_MASK); |
629 | /* Transfer page referenced bit to pte software bit (host view) */ | 633 | /* Transfer page referenced bit to pte software bit (host view) */ |
630 | if (young || (pgste_val(pgste) & RCP_HR_BIT)) | 634 | if (young || (pgste_val(pgste) & RCP_HR_BIT)) |
@@ -638,13 +642,15 @@ static inline pgste_t pgste_update_young(pte_t *ptep, pgste_t pgste) | |||
638 | 642 | ||
639 | } | 643 | } |
640 | 644 | ||
641 | static inline void pgste_set_pte(pte_t *ptep, pgste_t pgste) | 645 | static inline void pgste_set_pte(pte_t *ptep, pgste_t pgste, pte_t entry) |
642 | { | 646 | { |
643 | #ifdef CONFIG_PGSTE | 647 | #ifdef CONFIG_PGSTE |
644 | unsigned long address; | 648 | unsigned long address; |
645 | unsigned long okey, nkey; | 649 | unsigned long okey, nkey; |
646 | 650 | ||
647 | address = pte_val(*ptep) & PAGE_MASK; | 651 | if (!pte_present(entry)) |
652 | return; | ||
653 | address = pte_val(entry) & PAGE_MASK; | ||
648 | okey = nkey = page_get_storage_key(address); | 654 | okey = nkey = page_get_storage_key(address); |
649 | nkey &= ~(_PAGE_ACC_BITS | _PAGE_FP_BIT); | 655 | nkey &= ~(_PAGE_ACC_BITS | _PAGE_FP_BIT); |
650 | /* Set page access key and fetch protection bit from pgste */ | 656 | /* Set page access key and fetch protection bit from pgste */ |
@@ -712,7 +718,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
712 | 718 | ||
713 | if (mm_has_pgste(mm)) { | 719 | if (mm_has_pgste(mm)) { |
714 | pgste = pgste_get_lock(ptep); | 720 | pgste = pgste_get_lock(ptep); |
715 | pgste_set_pte(ptep, pgste); | 721 | pgste_set_pte(ptep, pgste, entry); |
716 | *ptep = entry; | 722 | *ptep = entry; |
717 | pgste_set_unlock(ptep, pgste); | 723 | pgste_set_unlock(ptep, pgste); |
718 | } else | 724 | } else |
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h index 5a099714df04..097183c70407 100644 --- a/arch/s390/include/asm/setup.h +++ b/arch/s390/include/asm/setup.h | |||
@@ -82,6 +82,7 @@ extern unsigned int user_mode; | |||
82 | #define MACHINE_FLAG_LPAR (1UL << 12) | 82 | #define MACHINE_FLAG_LPAR (1UL << 12) |
83 | #define MACHINE_FLAG_SPP (1UL << 13) | 83 | #define MACHINE_FLAG_SPP (1UL << 13) |
84 | #define MACHINE_FLAG_TOPOLOGY (1UL << 14) | 84 | #define MACHINE_FLAG_TOPOLOGY (1UL << 14) |
85 | #define MACHINE_FLAG_STCKF (1UL << 15) | ||
85 | 86 | ||
86 | #define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) | 87 | #define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) |
87 | #define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) | 88 | #define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) |
@@ -100,6 +101,7 @@ extern unsigned int user_mode; | |||
100 | #define MACHINE_HAS_PFMF (0) | 101 | #define MACHINE_HAS_PFMF (0) |
101 | #define MACHINE_HAS_SPP (0) | 102 | #define MACHINE_HAS_SPP (0) |
102 | #define MACHINE_HAS_TOPOLOGY (0) | 103 | #define MACHINE_HAS_TOPOLOGY (0) |
104 | #define MACHINE_HAS_STCKF (0) | ||
103 | #else /* __s390x__ */ | 105 | #else /* __s390x__ */ |
104 | #define MACHINE_HAS_IEEE (1) | 106 | #define MACHINE_HAS_IEEE (1) |
105 | #define MACHINE_HAS_CSP (1) | 107 | #define MACHINE_HAS_CSP (1) |
@@ -111,6 +113,7 @@ extern unsigned int user_mode; | |||
111 | #define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF) | 113 | #define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF) |
112 | #define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP) | 114 | #define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP) |
113 | #define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) | 115 | #define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) |
116 | #define MACHINE_HAS_STCKF (S390_lowcore.machine_flags & MACHINE_FLAG_STCKF) | ||
114 | #endif /* __s390x__ */ | 117 | #endif /* __s390x__ */ |
115 | 118 | ||
116 | #define ZFCPDUMP_HSA_SIZE (32UL<<20) | 119 | #define ZFCPDUMP_HSA_SIZE (32UL<<20) |
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h index d610bef9c5e9..c447a27a7fdb 100644 --- a/arch/s390/include/asm/timex.h +++ b/arch/s390/include/asm/timex.h | |||
@@ -90,7 +90,7 @@ static inline unsigned long long get_clock_fast(void) | |||
90 | { | 90 | { |
91 | unsigned long long clk; | 91 | unsigned long long clk; |
92 | 92 | ||
93 | if (test_facility(25)) | 93 | if (MACHINE_HAS_STCKF) |
94 | asm volatile(".insn s,0xb27c0000,%0" : "=Q" (clk) : : "cc"); | 94 | asm volatile(".insn s,0xb27c0000,%0" : "=Q" (clk) : : "cc"); |
95 | else | 95 | else |
96 | clk = get_clock(); | 96 | clk = get_clock(); |
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h index 404bdb9671b4..58de4c91c333 100644 --- a/arch/s390/include/asm/unistd.h +++ b/arch/s390/include/asm/unistd.h | |||
@@ -277,7 +277,9 @@ | |||
277 | #define __NR_clock_adjtime 337 | 277 | #define __NR_clock_adjtime 337 |
278 | #define __NR_syncfs 338 | 278 | #define __NR_syncfs 338 |
279 | #define __NR_setns 339 | 279 | #define __NR_setns 339 |
280 | #define NR_syscalls 340 | 280 | #define __NR_process_vm_readv 340 |
281 | #define __NR_process_vm_writev 341 | ||
282 | #define NR_syscalls 342 | ||
281 | 283 | ||
282 | /* | 284 | /* |
283 | * There are some system calls that are not present on 64 bit, some | 285 | * There are some system calls that are not present on 64 bit, some |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 5006a1d9f5d0..18c51df9fe06 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1627,3 +1627,23 @@ ENTRY(sys_setns_wrapper) | |||
1627 | lgfr %r2,%r2 # int | 1627 | lgfr %r2,%r2 # int |
1628 | lgfr %r3,%r3 # int | 1628 | lgfr %r3,%r3 # int |
1629 | jg sys_setns | 1629 | jg sys_setns |
1630 | |||
1631 | ENTRY(compat_sys_process_vm_readv_wrapper) | ||
1632 | lgfr %r2,%r2 # compat_pid_t | ||
1633 | llgtr %r3,%r3 # struct compat_iovec __user * | ||
1634 | llgfr %r4,%r4 # unsigned long | ||
1635 | llgtr %r5,%r5 # struct compat_iovec __user * | ||
1636 | llgfr %r6,%r6 # unsigned long | ||
1637 | llgf %r0,164(%r15) # unsigned long | ||
1638 | stg %r0,160(%r15) | ||
1639 | jg sys_process_vm_readv | ||
1640 | |||
1641 | ENTRY(compat_sys_process_vm_writev_wrapper) | ||
1642 | lgfr %r2,%r2 # compat_pid_t | ||
1643 | llgtr %r3,%r3 # struct compat_iovec __user * | ||
1644 | llgfr %r4,%r4 # unsigned long | ||
1645 | llgtr %r5,%r5 # struct compat_iovec __user * | ||
1646 | llgfr %r6,%r6 # unsigned long | ||
1647 | llgf %r0,164(%r15) # unsigned long | ||
1648 | stg %r0,160(%r15) | ||
1649 | jg sys_process_vm_writev | ||
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index 37394b3413e2..c9ffe0025197 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c | |||
@@ -390,6 +390,8 @@ static __init void detect_machine_facilities(void) | |||
390 | S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; | 390 | S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; |
391 | if (test_facility(40)) | 391 | if (test_facility(40)) |
392 | S390_lowcore.machine_flags |= MACHINE_FLAG_SPP; | 392 | S390_lowcore.machine_flags |= MACHINE_FLAG_SPP; |
393 | if (test_facility(25)) | ||
394 | S390_lowcore.machine_flags |= MACHINE_FLAG_STCKF; | ||
393 | #endif | 395 | #endif |
394 | } | 396 | } |
395 | 397 | ||
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 8ac6bfa2786c..e58a462949b1 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -211,6 +211,8 @@ static void __init setup_zfcpdump(unsigned int console_devno) | |||
211 | 211 | ||
212 | if (ipl_info.type != IPL_TYPE_FCP_DUMP) | 212 | if (ipl_info.type != IPL_TYPE_FCP_DUMP) |
213 | return; | 213 | return; |
214 | if (OLDMEM_BASE) | ||
215 | return; | ||
214 | if (console_devno != -1) | 216 | if (console_devno != -1) |
215 | sprintf(str, " cio_ignore=all,!0.0.%04x,!0.0.%04x", | 217 | sprintf(str, " cio_ignore=all,!0.0.%04x,!0.0.%04x", |
216 | ipl_info.data.fcp.dev_id.devno, console_devno); | 218 | ipl_info.data.fcp.dev_id.devno, console_devno); |
@@ -482,7 +484,7 @@ static void __init setup_memory_end(void) | |||
482 | 484 | ||
483 | 485 | ||
484 | #ifdef CONFIG_ZFCPDUMP | 486 | #ifdef CONFIG_ZFCPDUMP |
485 | if (ipl_info.type == IPL_TYPE_FCP_DUMP) { | 487 | if (ipl_info.type == IPL_TYPE_FCP_DUMP && !OLDMEM_BASE) { |
486 | memory_end = ZFCPDUMP_HSA_SIZE; | 488 | memory_end = ZFCPDUMP_HSA_SIZE; |
487 | memory_end_set = 1; | 489 | memory_end_set = 1; |
488 | } | 490 | } |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 73eb08c874fb..bcab2f04ba58 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -348,3 +348,5 @@ SYSCALL(sys_open_by_handle_at,sys_open_by_handle_at,compat_sys_open_by_handle_at | |||
348 | SYSCALL(sys_clock_adjtime,sys_clock_adjtime,compat_sys_clock_adjtime_wrapper) | 348 | SYSCALL(sys_clock_adjtime,sys_clock_adjtime,compat_sys_clock_adjtime_wrapper) |
349 | SYSCALL(sys_syncfs,sys_syncfs,sys_syncfs_wrapper) | 349 | SYSCALL(sys_syncfs,sys_syncfs,sys_syncfs_wrapper) |
350 | SYSCALL(sys_setns,sys_setns,sys_setns_wrapper) | 350 | SYSCALL(sys_setns,sys_setns,sys_setns_wrapper) |
351 | SYSCALL(sys_process_vm_readv,sys_process_vm_readv,compat_sys_process_vm_readv_wrapper) /* 340 */ | ||
352 | SYSCALL(sys_process_vm_writev,sys_process_vm_writev,compat_sys_process_vm_writev_wrapper) | ||
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index 77b8942b9a15..fdb5b8cb260f 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c | |||
@@ -68,8 +68,10 @@ static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu) | |||
68 | return mask; | 68 | return mask; |
69 | } | 69 | } |
70 | 70 | ||
71 | static void add_cpus_to_mask(struct topology_cpu *tl_cpu, | 71 | static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu, |
72 | struct mask_info *book, struct mask_info *core) | 72 | struct mask_info *book, |
73 | struct mask_info *core, | ||
74 | int z10) | ||
73 | { | 75 | { |
74 | unsigned int cpu; | 76 | unsigned int cpu; |
75 | 77 | ||
@@ -88,10 +90,16 @@ static void add_cpus_to_mask(struct topology_cpu *tl_cpu, | |||
88 | cpu_book_id[lcpu] = book->id; | 90 | cpu_book_id[lcpu] = book->id; |
89 | #endif | 91 | #endif |
90 | cpumask_set_cpu(lcpu, &core->mask); | 92 | cpumask_set_cpu(lcpu, &core->mask); |
91 | cpu_core_id[lcpu] = core->id; | 93 | if (z10) { |
94 | cpu_core_id[lcpu] = rcpu; | ||
95 | core = core->next; | ||
96 | } else { | ||
97 | cpu_core_id[lcpu] = core->id; | ||
98 | } | ||
92 | smp_cpu_polarization[lcpu] = tl_cpu->pp; | 99 | smp_cpu_polarization[lcpu] = tl_cpu->pp; |
93 | } | 100 | } |
94 | } | 101 | } |
102 | return core; | ||
95 | } | 103 | } |
96 | 104 | ||
97 | static void clear_masks(void) | 105 | static void clear_masks(void) |
@@ -123,18 +131,41 @@ static void tl_to_cores(struct sysinfo_15_1_x *info) | |||
123 | { | 131 | { |
124 | #ifdef CONFIG_SCHED_BOOK | 132 | #ifdef CONFIG_SCHED_BOOK |
125 | struct mask_info *book = &book_info; | 133 | struct mask_info *book = &book_info; |
134 | struct cpuid cpu_id; | ||
126 | #else | 135 | #else |
127 | struct mask_info *book = NULL; | 136 | struct mask_info *book = NULL; |
128 | #endif | 137 | #endif |
129 | struct mask_info *core = &core_info; | 138 | struct mask_info *core = &core_info; |
130 | union topology_entry *tle, *end; | 139 | union topology_entry *tle, *end; |
140 | int z10 = 0; | ||
131 | 141 | ||
132 | 142 | #ifdef CONFIG_SCHED_BOOK | |
143 | get_cpu_id(&cpu_id); | ||
144 | z10 = cpu_id.machine == 0x2097 || cpu_id.machine == 0x2098; | ||
145 | #endif | ||
133 | spin_lock_irq(&topology_lock); | 146 | spin_lock_irq(&topology_lock); |
134 | clear_masks(); | 147 | clear_masks(); |
135 | tle = info->tle; | 148 | tle = info->tle; |
136 | end = (union topology_entry *)((unsigned long)info + info->length); | 149 | end = (union topology_entry *)((unsigned long)info + info->length); |
137 | while (tle < end) { | 150 | while (tle < end) { |
151 | #ifdef CONFIG_SCHED_BOOK | ||
152 | if (z10) { | ||
153 | switch (tle->nl) { | ||
154 | case 1: | ||
155 | book = book->next; | ||
156 | book->id = tle->container.id; | ||
157 | break; | ||
158 | case 0: | ||
159 | core = add_cpus_to_mask(&tle->cpu, book, core, z10); | ||
160 | break; | ||
161 | default: | ||
162 | clear_masks(); | ||
163 | goto out; | ||
164 | } | ||
165 | tle = next_tle(tle); | ||
166 | continue; | ||
167 | } | ||
168 | #endif | ||
138 | switch (tle->nl) { | 169 | switch (tle->nl) { |
139 | #ifdef CONFIG_SCHED_BOOK | 170 | #ifdef CONFIG_SCHED_BOOK |
140 | case 2: | 171 | case 2: |
@@ -147,7 +178,7 @@ static void tl_to_cores(struct sysinfo_15_1_x *info) | |||
147 | core->id = tle->container.id; | 178 | core->id = tle->container.id; |
148 | break; | 179 | break; |
149 | case 0: | 180 | case 0: |
150 | add_cpus_to_mask(&tle->cpu, book, core); | 181 | add_cpus_to_mask(&tle->cpu, book, core, z10); |
151 | break; | 182 | break; |
152 | default: | 183 | default: |
153 | clear_masks(); | 184 | clear_masks(); |
@@ -328,8 +359,8 @@ void __init s390_init_cpu_topology(void) | |||
328 | for (i = 0; i < TOPOLOGY_NR_MAG; i++) | 359 | for (i = 0; i < TOPOLOGY_NR_MAG; i++) |
329 | printk(" %d", info->mag[i]); | 360 | printk(" %d", info->mag[i]); |
330 | printk(" / %d\n", info->mnest); | 361 | printk(" / %d\n", info->mnest); |
331 | alloc_masks(info, &core_info, 2); | 362 | alloc_masks(info, &core_info, 1); |
332 | #ifdef CONFIG_SCHED_BOOK | 363 | #ifdef CONFIG_SCHED_BOOK |
333 | alloc_masks(info, &book_info, 3); | 364 | alloc_masks(info, &book_info, 2); |
334 | #endif | 365 | #endif |
335 | } | 366 | } |
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 56fe6bc81fee..e4c79ebb40e6 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S | |||
@@ -43,6 +43,8 @@ SECTIONS | |||
43 | 43 | ||
44 | NOTES :text :note | 44 | NOTES :text :note |
45 | 45 | ||
46 | .dummy : { *(.dummy) } :data | ||
47 | |||
46 | RODATA | 48 | RODATA |
47 | 49 | ||
48 | #ifdef CONFIG_SHARED_KERNEL | 50 | #ifdef CONFIG_SHARED_KERNEL |
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c index 87cedd61be04..8943e82cd4d9 100644 --- a/arch/s390/kvm/diag.c +++ b/arch/s390/kvm/diag.c | |||
@@ -70,7 +70,7 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu) | |||
70 | return -EOPNOTSUPP; | 70 | return -EOPNOTSUPP; |
71 | } | 71 | } |
72 | 72 | ||
73 | atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); | 73 | atomic_set_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags); |
74 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_SUBSYSTEM; | 74 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_SUBSYSTEM; |
75 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_IPL; | 75 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_IPL; |
76 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_CPU_INIT; | 76 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_CPU_INIT; |
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c index c7c51898984e..02434543eabb 100644 --- a/arch/s390/kvm/intercept.c +++ b/arch/s390/kvm/intercept.c | |||
@@ -132,7 +132,6 @@ static int handle_stop(struct kvm_vcpu *vcpu) | |||
132 | int rc = 0; | 132 | int rc = 0; |
133 | 133 | ||
134 | vcpu->stat.exit_stop_request++; | 134 | vcpu->stat.exit_stop_request++; |
135 | atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); | ||
136 | spin_lock_bh(&vcpu->arch.local_int.lock); | 135 | spin_lock_bh(&vcpu->arch.local_int.lock); |
137 | if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) { | 136 | if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) { |
138 | vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP; | 137 | vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP; |
@@ -149,6 +148,8 @@ static int handle_stop(struct kvm_vcpu *vcpu) | |||
149 | } | 148 | } |
150 | 149 | ||
151 | if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) { | 150 | if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) { |
151 | atomic_set_mask(CPUSTAT_STOPPED, | ||
152 | &vcpu->arch.sie_block->cpuflags); | ||
152 | vcpu->arch.local_int.action_bits &= ~ACTION_STOP_ON_STOP; | 153 | vcpu->arch.local_int.action_bits &= ~ACTION_STOP_ON_STOP; |
153 | VCPU_EVENT(vcpu, 3, "%s", "cpu stopped"); | 154 | VCPU_EVENT(vcpu, 3, "%s", "cpu stopped"); |
154 | rc = -EOPNOTSUPP; | 155 | rc = -EOPNOTSUPP; |
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index 87c16705b381..278ee009ce65 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c | |||
@@ -252,6 +252,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, | |||
252 | offsetof(struct _lowcore, restart_psw), sizeof(psw_t)); | 252 | offsetof(struct _lowcore, restart_psw), sizeof(psw_t)); |
253 | if (rc == -EFAULT) | 253 | if (rc == -EFAULT) |
254 | exception = 1; | 254 | exception = 1; |
255 | atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags); | ||
255 | break; | 256 | break; |
256 | 257 | ||
257 | case KVM_S390_PROGRAM_INT: | 258 | case KVM_S390_PROGRAM_INT: |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 0bd3bea1e4cd..d1c445732451 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -65,6 +65,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { | |||
65 | { "instruction_stfl", VCPU_STAT(instruction_stfl) }, | 65 | { "instruction_stfl", VCPU_STAT(instruction_stfl) }, |
66 | { "instruction_tprot", VCPU_STAT(instruction_tprot) }, | 66 | { "instruction_tprot", VCPU_STAT(instruction_tprot) }, |
67 | { "instruction_sigp_sense", VCPU_STAT(instruction_sigp_sense) }, | 67 | { "instruction_sigp_sense", VCPU_STAT(instruction_sigp_sense) }, |
68 | { "instruction_sigp_sense_running", VCPU_STAT(instruction_sigp_sense_running) }, | ||
68 | { "instruction_sigp_external_call", VCPU_STAT(instruction_sigp_external_call) }, | 69 | { "instruction_sigp_external_call", VCPU_STAT(instruction_sigp_external_call) }, |
69 | { "instruction_sigp_emergency", VCPU_STAT(instruction_sigp_emergency) }, | 70 | { "instruction_sigp_emergency", VCPU_STAT(instruction_sigp_emergency) }, |
70 | { "instruction_sigp_stop", VCPU_STAT(instruction_sigp_stop) }, | 71 | { "instruction_sigp_stop", VCPU_STAT(instruction_sigp_stop) }, |
@@ -127,6 +128,7 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
127 | switch (ext) { | 128 | switch (ext) { |
128 | case KVM_CAP_S390_PSW: | 129 | case KVM_CAP_S390_PSW: |
129 | case KVM_CAP_S390_GMAP: | 130 | case KVM_CAP_S390_GMAP: |
131 | case KVM_CAP_SYNC_MMU: | ||
130 | r = 1; | 132 | r = 1; |
131 | break; | 133 | break; |
132 | default: | 134 | default: |
@@ -270,10 +272,12 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
270 | restore_fp_regs(&vcpu->arch.guest_fpregs); | 272 | restore_fp_regs(&vcpu->arch.guest_fpregs); |
271 | restore_access_regs(vcpu->arch.guest_acrs); | 273 | restore_access_regs(vcpu->arch.guest_acrs); |
272 | gmap_enable(vcpu->arch.gmap); | 274 | gmap_enable(vcpu->arch.gmap); |
275 | atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); | ||
273 | } | 276 | } |
274 | 277 | ||
275 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) | 278 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) |
276 | { | 279 | { |
280 | atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); | ||
277 | gmap_disable(vcpu->arch.gmap); | 281 | gmap_disable(vcpu->arch.gmap); |
278 | save_fp_regs(&vcpu->arch.guest_fpregs); | 282 | save_fp_regs(&vcpu->arch.guest_fpregs); |
279 | save_access_regs(vcpu->arch.guest_acrs); | 283 | save_access_regs(vcpu->arch.guest_acrs); |
@@ -301,7 +305,9 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu) | |||
301 | 305 | ||
302 | int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) | 306 | int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) |
303 | { | 307 | { |
304 | atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | CPUSTAT_SM); | 308 | atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | |
309 | CPUSTAT_SM | | ||
310 | CPUSTAT_STOPPED); | ||
305 | vcpu->arch.sie_block->ecb = 6; | 311 | vcpu->arch.sie_block->ecb = 6; |
306 | vcpu->arch.sie_block->eca = 0xC1002001U; | 312 | vcpu->arch.sie_block->eca = 0xC1002001U; |
307 | vcpu->arch.sie_block->fac = (int) (long) facilities; | 313 | vcpu->arch.sie_block->fac = (int) (long) facilities; |
@@ -428,7 +434,7 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw) | |||
428 | { | 434 | { |
429 | int rc = 0; | 435 | int rc = 0; |
430 | 436 | ||
431 | if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING) | 437 | if (!(atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_STOPPED)) |
432 | rc = -EBUSY; | 438 | rc = -EBUSY; |
433 | else { | 439 | else { |
434 | vcpu->run->psw_mask = psw.mask; | 440 | vcpu->run->psw_mask = psw.mask; |
@@ -501,7 +507,7 @@ rerun_vcpu: | |||
501 | if (vcpu->sigset_active) | 507 | if (vcpu->sigset_active) |
502 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); | 508 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); |
503 | 509 | ||
504 | atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); | 510 | atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags); |
505 | 511 | ||
506 | BUG_ON(vcpu->kvm->arch.float_int.local_int[vcpu->vcpu_id] == NULL); | 512 | BUG_ON(vcpu->kvm->arch.float_int.local_int[vcpu->vcpu_id] == NULL); |
507 | 513 | ||
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index 391626361084..d02638959922 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c | |||
@@ -336,6 +336,7 @@ static int handle_tprot(struct kvm_vcpu *vcpu) | |||
336 | u64 address1 = disp1 + base1 ? vcpu->arch.guest_gprs[base1] : 0; | 336 | u64 address1 = disp1 + base1 ? vcpu->arch.guest_gprs[base1] : 0; |
337 | u64 address2 = disp2 + base2 ? vcpu->arch.guest_gprs[base2] : 0; | 337 | u64 address2 = disp2 + base2 ? vcpu->arch.guest_gprs[base2] : 0; |
338 | struct vm_area_struct *vma; | 338 | struct vm_area_struct *vma; |
339 | unsigned long user_address; | ||
339 | 340 | ||
340 | vcpu->stat.instruction_tprot++; | 341 | vcpu->stat.instruction_tprot++; |
341 | 342 | ||
@@ -349,9 +350,14 @@ static int handle_tprot(struct kvm_vcpu *vcpu) | |||
349 | return -EOPNOTSUPP; | 350 | return -EOPNOTSUPP; |
350 | 351 | ||
351 | 352 | ||
353 | /* we must resolve the address without holding the mmap semaphore. | ||
354 | * This is ok since the userspace hypervisor is not supposed to change | ||
355 | * the mapping while the guest queries the memory. Otherwise the guest | ||
356 | * might crash or get wrong info anyway. */ | ||
357 | user_address = (unsigned long) __guestaddr_to_user(vcpu, address1); | ||
358 | |||
352 | down_read(¤t->mm->mmap_sem); | 359 | down_read(¤t->mm->mmap_sem); |
353 | vma = find_vma(current->mm, | 360 | vma = find_vma(current->mm, user_address); |
354 | (unsigned long) __guestaddr_to_user(vcpu, address1)); | ||
355 | if (!vma) { | 361 | if (!vma) { |
356 | up_read(¤t->mm->mmap_sem); | 362 | up_read(¤t->mm->mmap_sem); |
357 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 363 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c index f815118835f3..0a7941d74bc6 100644 --- a/arch/s390/kvm/sigp.c +++ b/arch/s390/kvm/sigp.c | |||
@@ -31,9 +31,11 @@ | |||
31 | #define SIGP_SET_PREFIX 0x0d | 31 | #define SIGP_SET_PREFIX 0x0d |
32 | #define SIGP_STORE_STATUS_ADDR 0x0e | 32 | #define SIGP_STORE_STATUS_ADDR 0x0e |
33 | #define SIGP_SET_ARCH 0x12 | 33 | #define SIGP_SET_ARCH 0x12 |
34 | #define SIGP_SENSE_RUNNING 0x15 | ||
34 | 35 | ||
35 | /* cpu status bits */ | 36 | /* cpu status bits */ |
36 | #define SIGP_STAT_EQUIPMENT_CHECK 0x80000000UL | 37 | #define SIGP_STAT_EQUIPMENT_CHECK 0x80000000UL |
38 | #define SIGP_STAT_NOT_RUNNING 0x00000400UL | ||
37 | #define SIGP_STAT_INCORRECT_STATE 0x00000200UL | 39 | #define SIGP_STAT_INCORRECT_STATE 0x00000200UL |
38 | #define SIGP_STAT_INVALID_PARAMETER 0x00000100UL | 40 | #define SIGP_STAT_INVALID_PARAMETER 0x00000100UL |
39 | #define SIGP_STAT_EXT_CALL_PENDING 0x00000080UL | 41 | #define SIGP_STAT_EXT_CALL_PENDING 0x00000080UL |
@@ -57,8 +59,8 @@ static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr, | |||
57 | spin_lock(&fi->lock); | 59 | spin_lock(&fi->lock); |
58 | if (fi->local_int[cpu_addr] == NULL) | 60 | if (fi->local_int[cpu_addr] == NULL) |
59 | rc = 3; /* not operational */ | 61 | rc = 3; /* not operational */ |
60 | else if (atomic_read(fi->local_int[cpu_addr]->cpuflags) | 62 | else if (!(atomic_read(fi->local_int[cpu_addr]->cpuflags) |
61 | & CPUSTAT_RUNNING) { | 63 | & CPUSTAT_STOPPED)) { |
62 | *reg &= 0xffffffff00000000UL; | 64 | *reg &= 0xffffffff00000000UL; |
63 | rc = 1; /* status stored */ | 65 | rc = 1; /* status stored */ |
64 | } else { | 66 | } else { |
@@ -251,7 +253,7 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address, | |||
251 | 253 | ||
252 | spin_lock_bh(&li->lock); | 254 | spin_lock_bh(&li->lock); |
253 | /* cpu must be in stopped state */ | 255 | /* cpu must be in stopped state */ |
254 | if (atomic_read(li->cpuflags) & CPUSTAT_RUNNING) { | 256 | if (!(atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) { |
255 | rc = 1; /* incorrect state */ | 257 | rc = 1; /* incorrect state */ |
256 | *reg &= SIGP_STAT_INCORRECT_STATE; | 258 | *reg &= SIGP_STAT_INCORRECT_STATE; |
257 | kfree(inti); | 259 | kfree(inti); |
@@ -275,6 +277,38 @@ out_fi: | |||
275 | return rc; | 277 | return rc; |
276 | } | 278 | } |
277 | 279 | ||
280 | static int __sigp_sense_running(struct kvm_vcpu *vcpu, u16 cpu_addr, | ||
281 | unsigned long *reg) | ||
282 | { | ||
283 | int rc; | ||
284 | struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; | ||
285 | |||
286 | if (cpu_addr >= KVM_MAX_VCPUS) | ||
287 | return 3; /* not operational */ | ||
288 | |||
289 | spin_lock(&fi->lock); | ||
290 | if (fi->local_int[cpu_addr] == NULL) | ||
291 | rc = 3; /* not operational */ | ||
292 | else { | ||
293 | if (atomic_read(fi->local_int[cpu_addr]->cpuflags) | ||
294 | & CPUSTAT_RUNNING) { | ||
295 | /* running */ | ||
296 | rc = 1; | ||
297 | } else { | ||
298 | /* not running */ | ||
299 | *reg &= 0xffffffff00000000UL; | ||
300 | *reg |= SIGP_STAT_NOT_RUNNING; | ||
301 | rc = 0; | ||
302 | } | ||
303 | } | ||
304 | spin_unlock(&fi->lock); | ||
305 | |||
306 | VCPU_EVENT(vcpu, 4, "sensed running status of cpu %x rc %x", cpu_addr, | ||
307 | rc); | ||
308 | |||
309 | return rc; | ||
310 | } | ||
311 | |||
278 | int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu) | 312 | int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu) |
279 | { | 313 | { |
280 | int r1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; | 314 | int r1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; |
@@ -331,6 +365,11 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu) | |||
331 | rc = __sigp_set_prefix(vcpu, cpu_addr, parameter, | 365 | rc = __sigp_set_prefix(vcpu, cpu_addr, parameter, |
332 | &vcpu->arch.guest_gprs[r1]); | 366 | &vcpu->arch.guest_gprs[r1]); |
333 | break; | 367 | break; |
368 | case SIGP_SENSE_RUNNING: | ||
369 | vcpu->stat.instruction_sigp_sense_running++; | ||
370 | rc = __sigp_sense_running(vcpu, cpu_addr, | ||
371 | &vcpu->arch.guest_gprs[r1]); | ||
372 | break; | ||
334 | case SIGP_RESTART: | 373 | case SIGP_RESTART: |
335 | vcpu->stat.instruction_sigp_restart++; | 374 | vcpu->stat.instruction_sigp_restart++; |
336 | /* user space must know about restart */ | 375 | /* user space must know about restart */ |
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 1766def5bc3f..a9a301866b3c 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -587,8 +587,13 @@ static void pfault_interrupt(unsigned int ext_int_code, | |||
587 | } else { | 587 | } else { |
588 | /* Completion interrupt was faster than initial | 588 | /* Completion interrupt was faster than initial |
589 | * interrupt. Set pfault_wait to -1 so the initial | 589 | * interrupt. Set pfault_wait to -1 so the initial |
590 | * interrupt doesn't put the task to sleep. */ | 590 | * interrupt doesn't put the task to sleep. |
591 | tsk->thread.pfault_wait = -1; | 591 | * If the task is not running, ignore the completion |
592 | * interrupt since it must be a leftover of a PFAULT | ||
593 | * CANCEL operation which didn't remove all pending | ||
594 | * completion interrupts. */ | ||
595 | if (tsk->state == TASK_RUNNING) | ||
596 | tsk->thread.pfault_wait = -1; | ||
592 | } | 597 | } |
593 | put_task_struct(tsk); | 598 | put_task_struct(tsk); |
594 | } else { | 599 | } else { |
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index 5b31a8e89823..a790cc657476 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h | |||
@@ -431,10 +431,6 @@ extern unsigned long *sparc_valid_addr_bitmap; | |||
431 | #define kern_addr_valid(addr) \ | 431 | #define kern_addr_valid(addr) \ |
432 | (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap)) | 432 | (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap)) |
433 | 433 | ||
434 | extern int io_remap_pfn_range(struct vm_area_struct *vma, | ||
435 | unsigned long from, unsigned long pfn, | ||
436 | unsigned long size, pgprot_t prot); | ||
437 | |||
438 | /* | 434 | /* |
439 | * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in | 435 | * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in |
440 | * its high 4 bits. These macros/functions put it there or get it from there. | 436 | * its high 4 bits. These macros/functions put it there or get it from there. |
@@ -443,6 +439,22 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma, | |||
443 | #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) | 439 | #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) |
444 | #define GET_PFN(pfn) (pfn & 0x0fffffffUL) | 440 | #define GET_PFN(pfn) (pfn & 0x0fffffffUL) |
445 | 441 | ||
442 | extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, | ||
443 | unsigned long, pgprot_t); | ||
444 | |||
445 | static inline int io_remap_pfn_range(struct vm_area_struct *vma, | ||
446 | unsigned long from, unsigned long pfn, | ||
447 | unsigned long size, pgprot_t prot) | ||
448 | { | ||
449 | unsigned long long offset, space, phys_base; | ||
450 | |||
451 | offset = ((unsigned long long) GET_PFN(pfn)) << PAGE_SHIFT; | ||
452 | space = GET_IOSPACE(pfn); | ||
453 | phys_base = offset | (space << 32ULL); | ||
454 | |||
455 | return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); | ||
456 | } | ||
457 | |||
446 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | 458 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS |
447 | #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ | 459 | #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ |
448 | ({ \ | 460 | ({ \ |
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index adf89329af59..38ebb2c60137 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h | |||
@@ -757,10 +757,6 @@ static inline bool kern_addr_valid(unsigned long addr) | |||
757 | 757 | ||
758 | extern int page_in_phys_avail(unsigned long paddr); | 758 | extern int page_in_phys_avail(unsigned long paddr); |
759 | 759 | ||
760 | extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, | ||
761 | unsigned long pfn, | ||
762 | unsigned long size, pgprot_t prot); | ||
763 | |||
764 | /* | 760 | /* |
765 | * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in | 761 | * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in |
766 | * its high 4 bits. These macros/functions put it there or get it from there. | 762 | * its high 4 bits. These macros/functions put it there or get it from there. |
@@ -769,6 +765,22 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, | |||
769 | #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) | 765 | #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) |
770 | #define GET_PFN(pfn) (pfn & 0x0fffffffffffffffUL) | 766 | #define GET_PFN(pfn) (pfn & 0x0fffffffffffffffUL) |
771 | 767 | ||
768 | extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, | ||
769 | unsigned long, pgprot_t); | ||
770 | |||
771 | static inline int io_remap_pfn_range(struct vm_area_struct *vma, | ||
772 | unsigned long from, unsigned long pfn, | ||
773 | unsigned long size, pgprot_t prot) | ||
774 | { | ||
775 | unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; | ||
776 | int space = GET_IOSPACE(pfn); | ||
777 | unsigned long phys_base; | ||
778 | |||
779 | phys_base = offset | (((unsigned long) space) << 32UL); | ||
780 | |||
781 | return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); | ||
782 | } | ||
783 | |||
772 | #include <asm-generic/pgtable.h> | 784 | #include <asm-generic/pgtable.h> |
773 | 785 | ||
774 | /* We provide our own get_unmapped_area to cope with VA holes and | 786 | /* We provide our own get_unmapped_area to cope with VA holes and |
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h index e27f8ea8656e..0c218e4c0881 100644 --- a/arch/sparc/kernel/entry.h +++ b/arch/sparc/kernel/entry.h | |||
@@ -42,6 +42,9 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | |||
42 | extern void fpload(unsigned long *fpregs, unsigned long *fsr); | 42 | extern void fpload(unsigned long *fpregs, unsigned long *fsr); |
43 | 43 | ||
44 | #else /* CONFIG_SPARC32 */ | 44 | #else /* CONFIG_SPARC32 */ |
45 | |||
46 | #include <asm/trap_block.h> | ||
47 | |||
45 | struct popc_3insn_patch_entry { | 48 | struct popc_3insn_patch_entry { |
46 | unsigned int addr; | 49 | unsigned int addr; |
47 | unsigned int insns[3]; | 50 | unsigned int insns[3]; |
@@ -57,6 +60,10 @@ extern struct popc_6insn_patch_entry __popc_6insn_patch, | |||
57 | __popc_6insn_patch_end; | 60 | __popc_6insn_patch_end; |
58 | 61 | ||
59 | extern void __init per_cpu_patch(void); | 62 | extern void __init per_cpu_patch(void); |
63 | extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *, | ||
64 | struct sun4v_1insn_patch_entry *); | ||
65 | extern void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, | ||
66 | struct sun4v_2insn_patch_entry *); | ||
60 | extern void __init sun4v_patch(void); | 67 | extern void __init sun4v_patch(void); |
61 | extern void __init boot_cpu_id_too_large(int cpu); | 68 | extern void __init boot_cpu_id_too_large(int cpu); |
62 | extern unsigned int dcache_parity_tl1_occurred; | 69 | extern unsigned int dcache_parity_tl1_occurred; |
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index da0c6c70ccb2..e5519870c3d9 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
18 | #include <asm/spitfire.h> | 18 | #include <asm/spitfire.h> |
19 | 19 | ||
20 | #include "entry.h" | ||
21 | |||
20 | #ifdef CONFIG_SPARC64 | 22 | #ifdef CONFIG_SPARC64 |
21 | 23 | ||
22 | #include <linux/jump_label.h> | 24 | #include <linux/jump_label.h> |
@@ -203,6 +205,29 @@ int apply_relocate_add(Elf_Shdr *sechdrs, | |||
203 | } | 205 | } |
204 | 206 | ||
205 | #ifdef CONFIG_SPARC64 | 207 | #ifdef CONFIG_SPARC64 |
208 | static void do_patch_sections(const Elf_Ehdr *hdr, | ||
209 | const Elf_Shdr *sechdrs) | ||
210 | { | ||
211 | const Elf_Shdr *s, *sun4v_1insn = NULL, *sun4v_2insn = NULL; | ||
212 | char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; | ||
213 | |||
214 | for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { | ||
215 | if (!strcmp(".sun4v_1insn_patch", secstrings + s->sh_name)) | ||
216 | sun4v_1insn = s; | ||
217 | if (!strcmp(".sun4v_2insn_patch", secstrings + s->sh_name)) | ||
218 | sun4v_2insn = s; | ||
219 | } | ||
220 | |||
221 | if (sun4v_1insn && tlb_type == hypervisor) { | ||
222 | void *p = (void *) sun4v_1insn->sh_addr; | ||
223 | sun4v_patch_1insn_range(p, p + sun4v_1insn->sh_size); | ||
224 | } | ||
225 | if (sun4v_2insn && tlb_type == hypervisor) { | ||
226 | void *p = (void *) sun4v_2insn->sh_addr; | ||
227 | sun4v_patch_2insn_range(p, p + sun4v_2insn->sh_size); | ||
228 | } | ||
229 | } | ||
230 | |||
206 | int module_finalize(const Elf_Ehdr *hdr, | 231 | int module_finalize(const Elf_Ehdr *hdr, |
207 | const Elf_Shdr *sechdrs, | 232 | const Elf_Shdr *sechdrs, |
208 | struct module *me) | 233 | struct module *me) |
@@ -210,6 +235,8 @@ int module_finalize(const Elf_Ehdr *hdr, | |||
210 | /* make jump label nops */ | 235 | /* make jump label nops */ |
211 | jump_label_apply_nops(me); | 236 | jump_label_apply_nops(me); |
212 | 237 | ||
238 | do_patch_sections(hdr, sechdrs); | ||
239 | |||
213 | /* Cheetah's I-cache is fully coherent. */ | 240 | /* Cheetah's I-cache is fully coherent. */ |
214 | if (tlb_type == spitfire) { | 241 | if (tlb_type == spitfire) { |
215 | unsigned long va; | 242 | unsigned long va; |
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index c965595aa7e9..a854a1c240ff 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
@@ -234,40 +234,50 @@ void __init per_cpu_patch(void) | |||
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | void __init sun4v_patch(void) | 237 | void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *start, |
238 | struct sun4v_1insn_patch_entry *end) | ||
238 | { | 239 | { |
239 | extern void sun4v_hvapi_init(void); | 240 | while (start < end) { |
240 | struct sun4v_1insn_patch_entry *p1; | 241 | unsigned long addr = start->addr; |
241 | struct sun4v_2insn_patch_entry *p2; | ||
242 | |||
243 | if (tlb_type != hypervisor) | ||
244 | return; | ||
245 | 242 | ||
246 | p1 = &__sun4v_1insn_patch; | 243 | *(unsigned int *) (addr + 0) = start->insn; |
247 | while (p1 < &__sun4v_1insn_patch_end) { | ||
248 | unsigned long addr = p1->addr; | ||
249 | |||
250 | *(unsigned int *) (addr + 0) = p1->insn; | ||
251 | wmb(); | 244 | wmb(); |
252 | __asm__ __volatile__("flush %0" : : "r" (addr + 0)); | 245 | __asm__ __volatile__("flush %0" : : "r" (addr + 0)); |
253 | 246 | ||
254 | p1++; | 247 | start++; |
255 | } | 248 | } |
249 | } | ||
256 | 250 | ||
257 | p2 = &__sun4v_2insn_patch; | 251 | void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *start, |
258 | while (p2 < &__sun4v_2insn_patch_end) { | 252 | struct sun4v_2insn_patch_entry *end) |
259 | unsigned long addr = p2->addr; | 253 | { |
254 | while (start < end) { | ||
255 | unsigned long addr = start->addr; | ||
260 | 256 | ||
261 | *(unsigned int *) (addr + 0) = p2->insns[0]; | 257 | *(unsigned int *) (addr + 0) = start->insns[0]; |
262 | wmb(); | 258 | wmb(); |
263 | __asm__ __volatile__("flush %0" : : "r" (addr + 0)); | 259 | __asm__ __volatile__("flush %0" : : "r" (addr + 0)); |
264 | 260 | ||
265 | *(unsigned int *) (addr + 4) = p2->insns[1]; | 261 | *(unsigned int *) (addr + 4) = start->insns[1]; |
266 | wmb(); | 262 | wmb(); |
267 | __asm__ __volatile__("flush %0" : : "r" (addr + 4)); | 263 | __asm__ __volatile__("flush %0" : : "r" (addr + 4)); |
268 | 264 | ||
269 | p2++; | 265 | start++; |
270 | } | 266 | } |
267 | } | ||
268 | |||
269 | void __init sun4v_patch(void) | ||
270 | { | ||
271 | extern void sun4v_hvapi_init(void); | ||
272 | |||
273 | if (tlb_type != hypervisor) | ||
274 | return; | ||
275 | |||
276 | sun4v_patch_1insn_range(&__sun4v_1insn_patch, | ||
277 | &__sun4v_1insn_patch_end); | ||
278 | |||
279 | sun4v_patch_2insn_range(&__sun4v_2insn_patch, | ||
280 | &__sun4v_2insn_patch_end); | ||
271 | 281 | ||
272 | sun4v_hvapi_init(); | 282 | sun4v_hvapi_init(); |
273 | } | 283 | } |
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index 2caa556db86d..023b8860dc97 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c | |||
@@ -822,21 +822,23 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs | |||
822 | * want to handle. Thus you cannot kill init even with a SIGKILL even by | 822 | * want to handle. Thus you cannot kill init even with a SIGKILL even by |
823 | * mistake. | 823 | * mistake. |
824 | */ | 824 | */ |
825 | void do_signal32(sigset_t *oldset, struct pt_regs * regs, | 825 | void do_signal32(sigset_t *oldset, struct pt_regs * regs) |
826 | int restart_syscall, unsigned long orig_i0) | ||
827 | { | 826 | { |
828 | struct k_sigaction ka; | 827 | struct k_sigaction ka; |
828 | unsigned long orig_i0; | ||
829 | int restart_syscall; | ||
829 | siginfo_t info; | 830 | siginfo_t info; |
830 | int signr; | 831 | int signr; |
831 | 832 | ||
832 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 833 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
833 | 834 | ||
834 | /* If the debugger messes with the program counter, it clears | 835 | restart_syscall = 0; |
835 | * the "in syscall" bit, directing us to not perform a syscall | 836 | orig_i0 = 0; |
836 | * restart. | 837 | if (pt_regs_is_syscall(regs) && |
837 | */ | 838 | (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { |
838 | if (restart_syscall && !pt_regs_is_syscall(regs)) | 839 | restart_syscall = 1; |
839 | restart_syscall = 0; | 840 | orig_i0 = regs->u_regs[UREG_G6]; |
841 | } | ||
840 | 842 | ||
841 | if (signr > 0) { | 843 | if (signr > 0) { |
842 | if (restart_syscall) | 844 | if (restart_syscall) |
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c index 8ce247ac04cc..d54c6e53aba0 100644 --- a/arch/sparc/kernel/signal_32.c +++ b/arch/sparc/kernel/signal_32.c | |||
@@ -519,10 +519,26 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
519 | siginfo_t info; | 519 | siginfo_t info; |
520 | int signr; | 520 | int signr; |
521 | 521 | ||
522 | /* It's a lot of work and synchronization to add a new ptrace | ||
523 | * register for GDB to save and restore in order to get | ||
524 | * orig_i0 correct for syscall restarts when debugging. | ||
525 | * | ||
526 | * Although it should be the case that most of the global | ||
527 | * registers are volatile across a system call, glibc already | ||
528 | * depends upon that fact that we preserve them. So we can't | ||
529 | * just use any global register to save away the orig_i0 value. | ||
530 | * | ||
531 | * In particular %g2, %g3, %g4, and %g5 are all assumed to be | ||
532 | * preserved across a system call trap by various pieces of | ||
533 | * code in glibc. | ||
534 | * | ||
535 | * %g7 is used as the "thread register". %g6 is not used in | ||
536 | * any fixed manner. %g6 is used as a scratch register and | ||
537 | * a compiler temporary, but it's value is never used across | ||
538 | * a system call. Therefore %g6 is usable for orig_i0 storage. | ||
539 | */ | ||
522 | if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C)) | 540 | if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C)) |
523 | restart_syscall = 1; | 541 | regs->u_regs[UREG_G6] = orig_i0; |
524 | else | ||
525 | restart_syscall = 0; | ||
526 | 542 | ||
527 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 543 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
528 | oldset = ¤t->saved_sigmask; | 544 | oldset = ¤t->saved_sigmask; |
@@ -535,8 +551,12 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
535 | * the software "in syscall" bit, directing us to not perform | 551 | * the software "in syscall" bit, directing us to not perform |
536 | * a syscall restart. | 552 | * a syscall restart. |
537 | */ | 553 | */ |
538 | if (restart_syscall && !pt_regs_is_syscall(regs)) | 554 | restart_syscall = 0; |
539 | restart_syscall = 0; | 555 | if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C)) { |
556 | restart_syscall = 1; | ||
557 | orig_i0 = regs->u_regs[UREG_G6]; | ||
558 | } | ||
559 | |||
540 | 560 | ||
541 | if (signr > 0) { | 561 | if (signr > 0) { |
542 | if (restart_syscall) | 562 | if (restart_syscall) |
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c index a2b81598d905..f0836cd0e2f2 100644 --- a/arch/sparc/kernel/signal_64.c +++ b/arch/sparc/kernel/signal_64.c | |||
@@ -529,11 +529,27 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
529 | siginfo_t info; | 529 | siginfo_t info; |
530 | int signr; | 530 | int signr; |
531 | 531 | ||
532 | /* It's a lot of work and synchronization to add a new ptrace | ||
533 | * register for GDB to save and restore in order to get | ||
534 | * orig_i0 correct for syscall restarts when debugging. | ||
535 | * | ||
536 | * Although it should be the case that most of the global | ||
537 | * registers are volatile across a system call, glibc already | ||
538 | * depends upon that fact that we preserve them. So we can't | ||
539 | * just use any global register to save away the orig_i0 value. | ||
540 | * | ||
541 | * In particular %g2, %g3, %g4, and %g5 are all assumed to be | ||
542 | * preserved across a system call trap by various pieces of | ||
543 | * code in glibc. | ||
544 | * | ||
545 | * %g7 is used as the "thread register". %g6 is not used in | ||
546 | * any fixed manner. %g6 is used as a scratch register and | ||
547 | * a compiler temporary, but it's value is never used across | ||
548 | * a system call. Therefore %g6 is usable for orig_i0 storage. | ||
549 | */ | ||
532 | if (pt_regs_is_syscall(regs) && | 550 | if (pt_regs_is_syscall(regs) && |
533 | (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { | 551 | (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) |
534 | restart_syscall = 1; | 552 | regs->u_regs[UREG_G6] = orig_i0; |
535 | } else | ||
536 | restart_syscall = 0; | ||
537 | 553 | ||
538 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | 554 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) |
539 | oldset = ¤t->saved_sigmask; | 555 | oldset = ¤t->saved_sigmask; |
@@ -542,22 +558,20 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
542 | 558 | ||
543 | #ifdef CONFIG_COMPAT | 559 | #ifdef CONFIG_COMPAT |
544 | if (test_thread_flag(TIF_32BIT)) { | 560 | if (test_thread_flag(TIF_32BIT)) { |
545 | extern void do_signal32(sigset_t *, struct pt_regs *, | 561 | extern void do_signal32(sigset_t *, struct pt_regs *); |
546 | int restart_syscall, | 562 | do_signal32(oldset, regs); |
547 | unsigned long orig_i0); | ||
548 | do_signal32(oldset, regs, restart_syscall, orig_i0); | ||
549 | return; | 563 | return; |
550 | } | 564 | } |
551 | #endif | 565 | #endif |
552 | 566 | ||
553 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 567 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
554 | 568 | ||
555 | /* If the debugger messes with the program counter, it clears | 569 | restart_syscall = 0; |
556 | * the software "in syscall" bit, directing us to not perform | 570 | if (pt_regs_is_syscall(regs) && |
557 | * a syscall restart. | 571 | (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { |
558 | */ | 572 | restart_syscall = 1; |
559 | if (restart_syscall && !pt_regs_is_syscall(regs)) | 573 | orig_i0 = regs->u_regs[UREG_G6]; |
560 | restart_syscall = 0; | 574 | } |
561 | 575 | ||
562 | if (signr > 0) { | 576 | if (signr > 0) { |
563 | if (restart_syscall) | 577 | if (restart_syscall) |
diff --git a/arch/sparc/kernel/sigutil_64.c b/arch/sparc/kernel/sigutil_64.c index e7dc508c38eb..b19570d41a39 100644 --- a/arch/sparc/kernel/sigutil_64.c +++ b/arch/sparc/kernel/sigutil_64.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <linux/types.h> | 2 | #include <linux/types.h> |
3 | #include <linux/thread_info.h> | 3 | #include <linux/thread_info.h> |
4 | #include <linux/uaccess.h> | 4 | #include <linux/uaccess.h> |
5 | #include <linux/errno.h> | ||
5 | 6 | ||
6 | #include <asm/sigcontext.h> | 7 | #include <asm/sigcontext.h> |
7 | #include <asm/fpumacro.h> | 8 | #include <asm/fpumacro.h> |
diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile index e3cda21b5ee9..301421c11291 100644 --- a/arch/sparc/mm/Makefile +++ b/arch/sparc/mm/Makefile | |||
@@ -8,7 +8,6 @@ obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o gup.o | |||
8 | obj-y += fault_$(BITS).o | 8 | obj-y += fault_$(BITS).o |
9 | obj-y += init_$(BITS).o | 9 | obj-y += init_$(BITS).o |
10 | obj-$(CONFIG_SPARC32) += loadmmu.o | 10 | obj-$(CONFIG_SPARC32) += loadmmu.o |
11 | obj-y += generic_$(BITS).o | ||
12 | obj-$(CONFIG_SPARC32) += extable.o btfixup.o srmmu.o iommu.o io-unit.o | 11 | obj-$(CONFIG_SPARC32) += extable.o btfixup.o srmmu.o iommu.o io-unit.o |
13 | obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o | 12 | obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o |
14 | obj-$(CONFIG_SPARC_LEON)+= leon_mm.o | 13 | obj-$(CONFIG_SPARC_LEON)+= leon_mm.o |
diff --git a/arch/sparc/mm/generic_32.c b/arch/sparc/mm/generic_32.c deleted file mode 100644 index 6ca39a60a196..000000000000 --- a/arch/sparc/mm/generic_32.c +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | /* | ||
2 | * generic.c: Generic Sparc mm routines that are not dependent upon | ||
3 | * MMU type but are Sparc specific. | ||
4 | * | ||
5 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/mm.h> | ||
10 | #include <linux/swap.h> | ||
11 | #include <linux/pagemap.h> | ||
12 | #include <linux/export.h> | ||
13 | |||
14 | #include <asm/pgalloc.h> | ||
15 | #include <asm/pgtable.h> | ||
16 | #include <asm/page.h> | ||
17 | #include <asm/cacheflush.h> | ||
18 | #include <asm/tlbflush.h> | ||
19 | |||
20 | /* Remap IO memory, the same way as remap_pfn_range(), but use | ||
21 | * the obio memory space. | ||
22 | * | ||
23 | * They use a pgprot that sets PAGE_IO and does not check the | ||
24 | * mem_map table as this is independent of normal memory. | ||
25 | */ | ||
26 | static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, unsigned long address, unsigned long size, | ||
27 | unsigned long offset, pgprot_t prot, int space) | ||
28 | { | ||
29 | unsigned long end; | ||
30 | |||
31 | address &= ~PMD_MASK; | ||
32 | end = address + size; | ||
33 | if (end > PMD_SIZE) | ||
34 | end = PMD_SIZE; | ||
35 | do { | ||
36 | set_pte_at(mm, address, pte, mk_pte_io(offset, prot, space)); | ||
37 | address += PAGE_SIZE; | ||
38 | offset += PAGE_SIZE; | ||
39 | pte++; | ||
40 | } while (address < end); | ||
41 | } | ||
42 | |||
43 | static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size, | ||
44 | unsigned long offset, pgprot_t prot, int space) | ||
45 | { | ||
46 | unsigned long end; | ||
47 | |||
48 | address &= ~PGDIR_MASK; | ||
49 | end = address + size; | ||
50 | if (end > PGDIR_SIZE) | ||
51 | end = PGDIR_SIZE; | ||
52 | offset -= address; | ||
53 | do { | ||
54 | pte_t *pte = pte_alloc_map(mm, NULL, pmd, address); | ||
55 | if (!pte) | ||
56 | return -ENOMEM; | ||
57 | io_remap_pte_range(mm, pte, address, end - address, address + offset, prot, space); | ||
58 | address = (address + PMD_SIZE) & PMD_MASK; | ||
59 | pmd++; | ||
60 | } while (address < end); | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, | ||
65 | unsigned long pfn, unsigned long size, pgprot_t prot) | ||
66 | { | ||
67 | int error = 0; | ||
68 | pgd_t * dir; | ||
69 | unsigned long beg = from; | ||
70 | unsigned long end = from + size; | ||
71 | struct mm_struct *mm = vma->vm_mm; | ||
72 | int space = GET_IOSPACE(pfn); | ||
73 | unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; | ||
74 | |||
75 | /* See comment in mm/memory.c remap_pfn_range */ | ||
76 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; | ||
77 | vma->vm_pgoff = (offset >> PAGE_SHIFT) | | ||
78 | ((unsigned long)space << 28UL); | ||
79 | |||
80 | offset -= from; | ||
81 | dir = pgd_offset(mm, from); | ||
82 | flush_cache_range(vma, beg, end); | ||
83 | |||
84 | while (from < end) { | ||
85 | pmd_t *pmd = pmd_alloc(mm, dir, from); | ||
86 | error = -ENOMEM; | ||
87 | if (!pmd) | ||
88 | break; | ||
89 | error = io_remap_pmd_range(mm, pmd, from, end - from, offset + from, prot, space); | ||
90 | if (error) | ||
91 | break; | ||
92 | from = (from + PGDIR_SIZE) & PGDIR_MASK; | ||
93 | dir++; | ||
94 | } | ||
95 | |||
96 | flush_tlb_range(vma, beg, end); | ||
97 | return error; | ||
98 | } | ||
99 | EXPORT_SYMBOL(io_remap_pfn_range); | ||
diff --git a/arch/sparc/mm/generic_64.c b/arch/sparc/mm/generic_64.c deleted file mode 100644 index 9b357ddae39d..000000000000 --- a/arch/sparc/mm/generic_64.c +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | /* | ||
2 | * generic.c: Generic Sparc mm routines that are not dependent upon | ||
3 | * MMU type but are Sparc specific. | ||
4 | * | ||
5 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/mm.h> | ||
10 | #include <linux/swap.h> | ||
11 | #include <linux/export.h> | ||
12 | #include <linux/pagemap.h> | ||
13 | |||
14 | #include <asm/pgalloc.h> | ||
15 | #include <asm/pgtable.h> | ||
16 | #include <asm/page.h> | ||
17 | #include <asm/tlbflush.h> | ||
18 | |||
19 | /* Remap IO memory, the same way as remap_pfn_range(), but use | ||
20 | * the obio memory space. | ||
21 | * | ||
22 | * They use a pgprot that sets PAGE_IO and does not check the | ||
23 | * mem_map table as this is independent of normal memory. | ||
24 | */ | ||
25 | static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, | ||
26 | unsigned long address, | ||
27 | unsigned long size, | ||
28 | unsigned long offset, pgprot_t prot, | ||
29 | int space) | ||
30 | { | ||
31 | unsigned long end; | ||
32 | |||
33 | /* clear hack bit that was used as a write_combine side-effect flag */ | ||
34 | offset &= ~0x1UL; | ||
35 | address &= ~PMD_MASK; | ||
36 | end = address + size; | ||
37 | if (end > PMD_SIZE) | ||
38 | end = PMD_SIZE; | ||
39 | do { | ||
40 | pte_t entry; | ||
41 | unsigned long curend = address + PAGE_SIZE; | ||
42 | |||
43 | entry = mk_pte_io(offset, prot, space, PAGE_SIZE); | ||
44 | if (!(address & 0xffff)) { | ||
45 | if (PAGE_SIZE < (4 * 1024 * 1024) && | ||
46 | !(address & 0x3fffff) && | ||
47 | !(offset & 0x3ffffe) && | ||
48 | end >= address + 0x400000) { | ||
49 | entry = mk_pte_io(offset, prot, space, | ||
50 | 4 * 1024 * 1024); | ||
51 | curend = address + 0x400000; | ||
52 | offset += 0x400000; | ||
53 | } else if (PAGE_SIZE < (512 * 1024) && | ||
54 | !(address & 0x7ffff) && | ||
55 | !(offset & 0x7fffe) && | ||
56 | end >= address + 0x80000) { | ||
57 | entry = mk_pte_io(offset, prot, space, | ||
58 | 512 * 1024 * 1024); | ||
59 | curend = address + 0x80000; | ||
60 | offset += 0x80000; | ||
61 | } else if (PAGE_SIZE < (64 * 1024) && | ||
62 | !(offset & 0xfffe) && | ||
63 | end >= address + 0x10000) { | ||
64 | entry = mk_pte_io(offset, prot, space, | ||
65 | 64 * 1024); | ||
66 | curend = address + 0x10000; | ||
67 | offset += 0x10000; | ||
68 | } else | ||
69 | offset += PAGE_SIZE; | ||
70 | } else | ||
71 | offset += PAGE_SIZE; | ||
72 | |||
73 | if (pte_write(entry)) | ||
74 | entry = pte_mkdirty(entry); | ||
75 | do { | ||
76 | BUG_ON(!pte_none(*pte)); | ||
77 | set_pte_at(mm, address, pte, entry); | ||
78 | address += PAGE_SIZE; | ||
79 | pte_val(entry) += PAGE_SIZE; | ||
80 | pte++; | ||
81 | } while (address < curend); | ||
82 | } while (address < end); | ||
83 | } | ||
84 | |||
85 | static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size, | ||
86 | unsigned long offset, pgprot_t prot, int space) | ||
87 | { | ||
88 | unsigned long end; | ||
89 | |||
90 | address &= ~PGDIR_MASK; | ||
91 | end = address + size; | ||
92 | if (end > PGDIR_SIZE) | ||
93 | end = PGDIR_SIZE; | ||
94 | offset -= address; | ||
95 | do { | ||
96 | pte_t *pte = pte_alloc_map(mm, NULL, pmd, address); | ||
97 | if (!pte) | ||
98 | return -ENOMEM; | ||
99 | io_remap_pte_range(mm, pte, address, end - address, address + offset, prot, space); | ||
100 | pte_unmap(pte); | ||
101 | address = (address + PMD_SIZE) & PMD_MASK; | ||
102 | pmd++; | ||
103 | } while (address < end); | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | static inline int io_remap_pud_range(struct mm_struct *mm, pud_t * pud, unsigned long address, unsigned long size, | ||
108 | unsigned long offset, pgprot_t prot, int space) | ||
109 | { | ||
110 | unsigned long end; | ||
111 | |||
112 | address &= ~PUD_MASK; | ||
113 | end = address + size; | ||
114 | if (end > PUD_SIZE) | ||
115 | end = PUD_SIZE; | ||
116 | offset -= address; | ||
117 | do { | ||
118 | pmd_t *pmd = pmd_alloc(mm, pud, address); | ||
119 | if (!pud) | ||
120 | return -ENOMEM; | ||
121 | io_remap_pmd_range(mm, pmd, address, end - address, address + offset, prot, space); | ||
122 | address = (address + PUD_SIZE) & PUD_MASK; | ||
123 | pud++; | ||
124 | } while (address < end); | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, | ||
129 | unsigned long pfn, unsigned long size, pgprot_t prot) | ||
130 | { | ||
131 | int error = 0; | ||
132 | pgd_t * dir; | ||
133 | unsigned long beg = from; | ||
134 | unsigned long end = from + size; | ||
135 | struct mm_struct *mm = vma->vm_mm; | ||
136 | int space = GET_IOSPACE(pfn); | ||
137 | unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; | ||
138 | unsigned long phys_base; | ||
139 | |||
140 | phys_base = offset | (((unsigned long) space) << 32UL); | ||
141 | |||
142 | /* See comment in mm/memory.c remap_pfn_range */ | ||
143 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; | ||
144 | vma->vm_pgoff = phys_base >> PAGE_SHIFT; | ||
145 | |||
146 | offset -= from; | ||
147 | dir = pgd_offset(mm, from); | ||
148 | flush_cache_range(vma, beg, end); | ||
149 | |||
150 | while (from < end) { | ||
151 | pud_t *pud = pud_alloc(mm, dir, from); | ||
152 | error = -ENOMEM; | ||
153 | if (!pud) | ||
154 | break; | ||
155 | error = io_remap_pud_range(mm, pud, from, end - from, offset + from, prot, space); | ||
156 | if (error) | ||
157 | break; | ||
158 | from = (from + PGDIR_SIZE) & PGDIR_MASK; | ||
159 | dir++; | ||
160 | } | ||
161 | |||
162 | flush_tlb_range(vma, beg, end); | ||
163 | return error; | ||
164 | } | ||
165 | EXPORT_SYMBOL(io_remap_pfn_range); | ||
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig index e57dcce9bfda..942ed6174f1d 100644 --- a/arch/unicore32/Kconfig +++ b/arch/unicore32/Kconfig | |||
@@ -237,13 +237,13 @@ menu "PKUnity NetBook-0916 Features" | |||
237 | 237 | ||
238 | config I2C_BATTERY_BQ27200 | 238 | config I2C_BATTERY_BQ27200 |
239 | tristate "I2C Battery BQ27200 Support" | 239 | tristate "I2C Battery BQ27200 Support" |
240 | select PUV3_I2C | 240 | select I2C_PUV3 |
241 | select POWER_SUPPLY | 241 | select POWER_SUPPLY |
242 | select BATTERY_BQ27x00 | 242 | select BATTERY_BQ27x00 |
243 | 243 | ||
244 | config I2C_EEPROM_AT24 | 244 | config I2C_EEPROM_AT24 |
245 | tristate "I2C EEPROMs AT24 support" | 245 | tristate "I2C EEPROMs AT24 support" |
246 | select PUV3_I2C | 246 | select I2C_PUV3 |
247 | select MISC_DEVICES | 247 | select MISC_DEVICES |
248 | select EEPROM_AT24 | 248 | select EEPROM_AT24 |
249 | 249 | ||
diff --git a/arch/unicore32/Kconfig.debug b/arch/unicore32/Kconfig.debug index ae2ec334c3c6..1a3626239843 100644 --- a/arch/unicore32/Kconfig.debug +++ b/arch/unicore32/Kconfig.debug | |||
@@ -44,18 +44,4 @@ config DEBUG_OCD | |||
44 | Say Y here if you want the debug print routines to direct their | 44 | Say Y here if you want the debug print routines to direct their |
45 | output to the UniCore On-Chip-Debugger channel using CP #1. | 45 | output to the UniCore On-Chip-Debugger channel using CP #1. |
46 | 46 | ||
47 | config DEBUG_OCD_BREAKPOINT | ||
48 | bool "Breakpoint support via On-Chip-Debugger" | ||
49 | depends on DEBUG_OCD | ||
50 | |||
51 | config DEBUG_UART | ||
52 | int "Kernel low-level debugging messages via serial port" | ||
53 | depends on DEBUG_LL | ||
54 | range 0 1 | ||
55 | default "0" | ||
56 | help | ||
57 | Choice for UART for kernel low-level using PKUnity UARTS, | ||
58 | should be between zero and one. The port must have been | ||
59 | initialised by the boot-loader before use. | ||
60 | |||
61 | endmenu | 47 | endmenu |
diff --git a/arch/unicore32/boot/compressed/Makefile b/arch/unicore32/boot/compressed/Makefile index b0954a2d23cf..950a9afa38f8 100644 --- a/arch/unicore32/boot/compressed/Makefile +++ b/arch/unicore32/boot/compressed/Makefile | |||
@@ -10,8 +10,8 @@ | |||
10 | # Copyright (C) 2001~2010 GUAN Xue-tao | 10 | # Copyright (C) 2001~2010 GUAN Xue-tao |
11 | # | 11 | # |
12 | 12 | ||
13 | EXTRA_CFLAGS := -fpic -fno-builtin | 13 | ccflags-y := -fpic -fno-builtin |
14 | EXTRA_AFLAGS := -Wa,-march=all | 14 | asflags-y := -Wa,-march=all |
15 | 15 | ||
16 | OBJS := misc.o | 16 | OBJS := misc.o |
17 | 17 | ||
diff --git a/arch/unicore32/include/asm/bitops.h b/arch/unicore32/include/asm/bitops.h index 1628a6328994..401f597bc38c 100644 --- a/arch/unicore32/include/asm/bitops.h +++ b/arch/unicore32/include/asm/bitops.h | |||
@@ -13,12 +13,6 @@ | |||
13 | #ifndef __UNICORE_BITOPS_H__ | 13 | #ifndef __UNICORE_BITOPS_H__ |
14 | #define __UNICORE_BITOPS_H__ | 14 | #define __UNICORE_BITOPS_H__ |
15 | 15 | ||
16 | #define find_next_bit __uc32_find_next_bit | ||
17 | #define find_next_zero_bit __uc32_find_next_zero_bit | ||
18 | |||
19 | #define find_first_bit __uc32_find_first_bit | ||
20 | #define find_first_zero_bit __uc32_find_first_zero_bit | ||
21 | |||
22 | #define _ASM_GENERIC_BITOPS_FLS_H_ | 16 | #define _ASM_GENERIC_BITOPS_FLS_H_ |
23 | #define _ASM_GENERIC_BITOPS___FLS_H_ | 17 | #define _ASM_GENERIC_BITOPS___FLS_H_ |
24 | #define _ASM_GENERIC_BITOPS_FFS_H_ | 18 | #define _ASM_GENERIC_BITOPS_FFS_H_ |
@@ -44,4 +38,10 @@ static inline int fls(int x) | |||
44 | 38 | ||
45 | #include <asm-generic/bitops.h> | 39 | #include <asm-generic/bitops.h> |
46 | 40 | ||
41 | /* following definitions: to avoid using codes in lib/find_*.c */ | ||
42 | #define find_next_bit find_next_bit | ||
43 | #define find_next_zero_bit find_next_zero_bit | ||
44 | #define find_first_bit find_first_bit | ||
45 | #define find_first_zero_bit find_first_zero_bit | ||
46 | |||
47 | #endif /* __UNICORE_BITOPS_H__ */ | 47 | #endif /* __UNICORE_BITOPS_H__ */ |
diff --git a/arch/unicore32/include/asm/processor.h b/arch/unicore32/include/asm/processor.h index e11cb0786578..f0d780a51f9b 100644 --- a/arch/unicore32/include/asm/processor.h +++ b/arch/unicore32/include/asm/processor.h | |||
@@ -53,7 +53,6 @@ struct thread_struct { | |||
53 | #define start_thread(regs, pc, sp) \ | 53 | #define start_thread(regs, pc, sp) \ |
54 | ({ \ | 54 | ({ \ |
55 | unsigned long *stack = (unsigned long *)sp; \ | 55 | unsigned long *stack = (unsigned long *)sp; \ |
56 | set_fs(USER_DS); \ | ||
57 | memset(regs->uregs, 0, sizeof(regs->uregs)); \ | 56 | memset(regs->uregs, 0, sizeof(regs->uregs)); \ |
58 | regs->UCreg_asr = USER_MODE; \ | 57 | regs->UCreg_asr = USER_MODE; \ |
59 | regs->UCreg_pc = pc & ~1; /* pc */ \ | 58 | regs->UCreg_pc = pc & ~1; /* pc */ \ |
diff --git a/arch/unicore32/kernel/ksyms.c b/arch/unicore32/kernel/ksyms.c index a8970809428a..d98bd812cae1 100644 --- a/arch/unicore32/kernel/ksyms.c +++ b/arch/unicore32/kernel/ksyms.c | |||
@@ -24,8 +24,8 @@ | |||
24 | 24 | ||
25 | #include "ksyms.h" | 25 | #include "ksyms.h" |
26 | 26 | ||
27 | EXPORT_SYMBOL(__uc32_find_next_zero_bit); | 27 | EXPORT_SYMBOL(find_next_zero_bit); |
28 | EXPORT_SYMBOL(__uc32_find_next_bit); | 28 | EXPORT_SYMBOL(find_next_bit); |
29 | 29 | ||
30 | EXPORT_SYMBOL(__backtrace); | 30 | EXPORT_SYMBOL(__backtrace); |
31 | 31 | ||
diff --git a/arch/unicore32/lib/findbit.S b/arch/unicore32/lib/findbit.S index c360ce905d8b..c77746247d36 100644 --- a/arch/unicore32/lib/findbit.S +++ b/arch/unicore32/lib/findbit.S | |||
@@ -17,7 +17,7 @@ | |||
17 | * Purpose : Find a 'zero' bit | 17 | * Purpose : Find a 'zero' bit |
18 | * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); | 18 | * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); |
19 | */ | 19 | */ |
20 | __uc32_find_first_zero_bit: | 20 | ENTRY(find_first_zero_bit) |
21 | cxor.a r1, #0 | 21 | cxor.a r1, #0 |
22 | beq 3f | 22 | beq 3f |
23 | mov r2, #0 | 23 | mov r2, #0 |
@@ -29,13 +29,14 @@ __uc32_find_first_zero_bit: | |||
29 | bub 1b | 29 | bub 1b |
30 | 3: mov r0, r1 @ no free bits | 30 | 3: mov r0, r1 @ no free bits |
31 | mov pc, lr | 31 | mov pc, lr |
32 | ENDPROC(find_first_zero_bit) | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * Purpose : Find next 'zero' bit | 35 | * Purpose : Find next 'zero' bit |
35 | * Prototype: int find_next_zero_bit | 36 | * Prototype: int find_next_zero_bit |
36 | * (void *addr, unsigned int maxbit, int offset) | 37 | * (void *addr, unsigned int maxbit, int offset) |
37 | */ | 38 | */ |
38 | ENTRY(__uc32_find_next_zero_bit) | 39 | ENTRY(find_next_zero_bit) |
39 | cxor.a r1, #0 | 40 | cxor.a r1, #0 |
40 | beq 3b | 41 | beq 3b |
41 | and.a ip, r2, #7 | 42 | and.a ip, r2, #7 |
@@ -47,14 +48,14 @@ ENTRY(__uc32_find_next_zero_bit) | |||
47 | or r2, r2, #7 @ if zero, then no bits here | 48 | or r2, r2, #7 @ if zero, then no bits here |
48 | add r2, r2, #1 @ align bit pointer | 49 | add r2, r2, #1 @ align bit pointer |
49 | b 2b @ loop for next bit | 50 | b 2b @ loop for next bit |
50 | ENDPROC(__uc32_find_next_zero_bit) | 51 | ENDPROC(find_next_zero_bit) |
51 | 52 | ||
52 | /* | 53 | /* |
53 | * Purpose : Find a 'one' bit | 54 | * Purpose : Find a 'one' bit |
54 | * Prototype: int find_first_bit | 55 | * Prototype: int find_first_bit |
55 | * (const unsigned long *addr, unsigned int maxbit); | 56 | * (const unsigned long *addr, unsigned int maxbit); |
56 | */ | 57 | */ |
57 | __uc32_find_first_bit: | 58 | ENTRY(find_first_bit) |
58 | cxor.a r1, #0 | 59 | cxor.a r1, #0 |
59 | beq 3f | 60 | beq 3f |
60 | mov r2, #0 | 61 | mov r2, #0 |
@@ -66,13 +67,14 @@ __uc32_find_first_bit: | |||
66 | bub 1b | 67 | bub 1b |
67 | 3: mov r0, r1 @ no free bits | 68 | 3: mov r0, r1 @ no free bits |
68 | mov pc, lr | 69 | mov pc, lr |
70 | ENDPROC(find_first_bit) | ||
69 | 71 | ||
70 | /* | 72 | /* |
71 | * Purpose : Find next 'one' bit | 73 | * Purpose : Find next 'one' bit |
72 | * Prototype: int find_next_zero_bit | 74 | * Prototype: int find_next_zero_bit |
73 | * (void *addr, unsigned int maxbit, int offset) | 75 | * (void *addr, unsigned int maxbit, int offset) |
74 | */ | 76 | */ |
75 | ENTRY(__uc32_find_next_bit) | 77 | ENTRY(find_next_bit) |
76 | cxor.a r1, #0 | 78 | cxor.a r1, #0 |
77 | beq 3b | 79 | beq 3b |
78 | and.a ip, r2, #7 | 80 | and.a ip, r2, #7 |
@@ -83,7 +85,7 @@ ENTRY(__uc32_find_next_bit) | |||
83 | or r2, r2, #7 @ if zero, then no bits here | 85 | or r2, r2, #7 @ if zero, then no bits here |
84 | add r2, r2, #1 @ align bit pointer | 86 | add r2, r2, #1 @ align bit pointer |
85 | b 2b @ loop for next bit | 87 | b 2b @ loop for next bit |
86 | ENDPROC(__uc32_find_next_bit) | 88 | ENDPROC(find_next_bit) |
87 | 89 | ||
88 | /* | 90 | /* |
89 | * One or more bits in the LSB of r3 are assumed to be set. | 91 | * One or more bits in the LSB of r3 are assumed to be set. |
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 9b7273cb2193..1a6c09af048f 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -49,6 +49,7 @@ extern unsigned int apic_verbosity; | |||
49 | extern int local_apic_timer_c2_ok; | 49 | extern int local_apic_timer_c2_ok; |
50 | 50 | ||
51 | extern int disable_apic; | 51 | extern int disable_apic; |
52 | extern unsigned int lapic_timer_frequency; | ||
52 | 53 | ||
53 | #ifdef CONFIG_SMP | 54 | #ifdef CONFIG_SMP |
54 | extern void __inquire_remote_apic(int apicid); | 55 | extern void __inquire_remote_apic(int apicid); |
diff --git a/arch/x86/include/asm/mach_traps.h b/arch/x86/include/asm/mach_traps.h index 72a8b52e7dfd..a01e7ec7d237 100644 --- a/arch/x86/include/asm/mach_traps.h +++ b/arch/x86/include/asm/mach_traps.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #define NMI_REASON_CLEAR_IOCHK 0x08 | 17 | #define NMI_REASON_CLEAR_IOCHK 0x08 |
18 | #define NMI_REASON_CLEAR_MASK 0x0f | 18 | #define NMI_REASON_CLEAR_MASK 0x0f |
19 | 19 | ||
20 | static inline unsigned char get_nmi_reason(void) | 20 | static inline unsigned char default_get_nmi_reason(void) |
21 | { | 21 | { |
22 | return inb(NMI_REASON_PORT); | 22 | return inb(NMI_REASON_PORT); |
23 | } | 23 | } |
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h index c9321f34e55b..0e8ae57d3656 100644 --- a/arch/x86/include/asm/mce.h +++ b/arch/x86/include/asm/mce.h | |||
@@ -201,7 +201,10 @@ int mce_notify_irq(void); | |||
201 | void mce_notify_process(void); | 201 | void mce_notify_process(void); |
202 | 202 | ||
203 | DECLARE_PER_CPU(struct mce, injectm); | 203 | DECLARE_PER_CPU(struct mce, injectm); |
204 | extern struct file_operations mce_chrdev_ops; | 204 | |
205 | extern void register_mce_write_callback(ssize_t (*)(struct file *filp, | ||
206 | const char __user *ubuf, | ||
207 | size_t usize, loff_t *off)); | ||
205 | 208 | ||
206 | /* | 209 | /* |
207 | * Exception handler | 210 | * Exception handler |
diff --git a/arch/x86/include/asm/mrst.h b/arch/x86/include/asm/mrst.h index 719f00b28ff5..e6283129c821 100644 --- a/arch/x86/include/asm/mrst.h +++ b/arch/x86/include/asm/mrst.h | |||
@@ -44,6 +44,13 @@ enum mrst_timer_options { | |||
44 | 44 | ||
45 | extern enum mrst_timer_options mrst_timer_options; | 45 | extern enum mrst_timer_options mrst_timer_options; |
46 | 46 | ||
47 | /* | ||
48 | * Penwell uses spread spectrum clock, so the freq number is not exactly | ||
49 | * the same as reported by MSR based on SDM. | ||
50 | */ | ||
51 | #define PENWELL_FSB_FREQ_83SKU 83200 | ||
52 | #define PENWELL_FSB_FREQ_100SKU 99840 | ||
53 | |||
47 | #define SFI_MTMR_MAX_NUM 8 | 54 | #define SFI_MTMR_MAX_NUM 8 |
48 | #define SFI_MRTC_MAX 8 | 55 | #define SFI_MRTC_MAX 8 |
49 | 56 | ||
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index d3d859035af9..1971e652d24b 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -152,6 +152,7 @@ struct x86_cpuinit_ops { | |||
152 | /** | 152 | /** |
153 | * struct x86_platform_ops - platform specific runtime functions | 153 | * struct x86_platform_ops - platform specific runtime functions |
154 | * @calibrate_tsc: calibrate TSC | 154 | * @calibrate_tsc: calibrate TSC |
155 | * @wallclock_init: init the wallclock device | ||
155 | * @get_wallclock: get time from HW clock like RTC etc. | 156 | * @get_wallclock: get time from HW clock like RTC etc. |
156 | * @set_wallclock: set time back to HW clock | 157 | * @set_wallclock: set time back to HW clock |
157 | * @is_untracked_pat_range exclude from PAT logic | 158 | * @is_untracked_pat_range exclude from PAT logic |
@@ -160,11 +161,13 @@ struct x86_cpuinit_ops { | |||
160 | */ | 161 | */ |
161 | struct x86_platform_ops { | 162 | struct x86_platform_ops { |
162 | unsigned long (*calibrate_tsc)(void); | 163 | unsigned long (*calibrate_tsc)(void); |
164 | void (*wallclock_init)(void); | ||
163 | unsigned long (*get_wallclock)(void); | 165 | unsigned long (*get_wallclock)(void); |
164 | int (*set_wallclock)(unsigned long nowtime); | 166 | int (*set_wallclock)(unsigned long nowtime); |
165 | void (*iommu_shutdown)(void); | 167 | void (*iommu_shutdown)(void); |
166 | bool (*is_untracked_pat_range)(u64 start, u64 end); | 168 | bool (*is_untracked_pat_range)(u64 start, u64 end); |
167 | void (*nmi_init)(void); | 169 | void (*nmi_init)(void); |
170 | unsigned char (*get_nmi_reason)(void); | ||
168 | int (*i8042_detect)(void); | 171 | int (*i8042_detect)(void); |
169 | }; | 172 | }; |
170 | 173 | ||
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index c63822816249..1f84794f0759 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c | |||
@@ -738,5 +738,5 @@ void __kprobes text_poke_smp_batch(struct text_poke_param *params, int n) | |||
738 | 738 | ||
739 | atomic_set(&stop_machine_first, 1); | 739 | atomic_set(&stop_machine_first, 1); |
740 | wrote_text = 0; | 740 | wrote_text = 0; |
741 | __stop_machine(stop_machine_text_poke, (void *)&tpp, NULL); | 741 | __stop_machine(stop_machine_text_poke, (void *)&tpp, cpu_online_mask); |
742 | } | 742 | } |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index a2fd72e0ab35..f98d84caf94c 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -186,7 +186,7 @@ static struct resource lapic_resource = { | |||
186 | .flags = IORESOURCE_MEM | IORESOURCE_BUSY, | 186 | .flags = IORESOURCE_MEM | IORESOURCE_BUSY, |
187 | }; | 187 | }; |
188 | 188 | ||
189 | static unsigned int calibration_result; | 189 | unsigned int lapic_timer_frequency = 0; |
190 | 190 | ||
191 | static void apic_pm_activate(void); | 191 | static void apic_pm_activate(void); |
192 | 192 | ||
@@ -454,7 +454,7 @@ static void lapic_timer_setup(enum clock_event_mode mode, | |||
454 | switch (mode) { | 454 | switch (mode) { |
455 | case CLOCK_EVT_MODE_PERIODIC: | 455 | case CLOCK_EVT_MODE_PERIODIC: |
456 | case CLOCK_EVT_MODE_ONESHOT: | 456 | case CLOCK_EVT_MODE_ONESHOT: |
457 | __setup_APIC_LVTT(calibration_result, | 457 | __setup_APIC_LVTT(lapic_timer_frequency, |
458 | mode != CLOCK_EVT_MODE_PERIODIC, 1); | 458 | mode != CLOCK_EVT_MODE_PERIODIC, 1); |
459 | break; | 459 | break; |
460 | case CLOCK_EVT_MODE_UNUSED: | 460 | case CLOCK_EVT_MODE_UNUSED: |
@@ -638,6 +638,25 @@ static int __init calibrate_APIC_clock(void) | |||
638 | long delta, deltatsc; | 638 | long delta, deltatsc; |
639 | int pm_referenced = 0; | 639 | int pm_referenced = 0; |
640 | 640 | ||
641 | /** | ||
642 | * check if lapic timer has already been calibrated by platform | ||
643 | * specific routine, such as tsc calibration code. if so, we just fill | ||
644 | * in the clockevent structure and return. | ||
645 | */ | ||
646 | |||
647 | if (lapic_timer_frequency) { | ||
648 | apic_printk(APIC_VERBOSE, "lapic timer already calibrated %d\n", | ||
649 | lapic_timer_frequency); | ||
650 | lapic_clockevent.mult = div_sc(lapic_timer_frequency/APIC_DIVISOR, | ||
651 | TICK_NSEC, lapic_clockevent.shift); | ||
652 | lapic_clockevent.max_delta_ns = | ||
653 | clockevent_delta2ns(0x7FFFFF, &lapic_clockevent); | ||
654 | lapic_clockevent.min_delta_ns = | ||
655 | clockevent_delta2ns(0xF, &lapic_clockevent); | ||
656 | lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY; | ||
657 | return 0; | ||
658 | } | ||
659 | |||
641 | local_irq_disable(); | 660 | local_irq_disable(); |
642 | 661 | ||
643 | /* Replace the global interrupt handler */ | 662 | /* Replace the global interrupt handler */ |
@@ -679,12 +698,12 @@ static int __init calibrate_APIC_clock(void) | |||
679 | lapic_clockevent.min_delta_ns = | 698 | lapic_clockevent.min_delta_ns = |
680 | clockevent_delta2ns(0xF, &lapic_clockevent); | 699 | clockevent_delta2ns(0xF, &lapic_clockevent); |
681 | 700 | ||
682 | calibration_result = (delta * APIC_DIVISOR) / LAPIC_CAL_LOOPS; | 701 | lapic_timer_frequency = (delta * APIC_DIVISOR) / LAPIC_CAL_LOOPS; |
683 | 702 | ||
684 | apic_printk(APIC_VERBOSE, "..... delta %ld\n", delta); | 703 | apic_printk(APIC_VERBOSE, "..... delta %ld\n", delta); |
685 | apic_printk(APIC_VERBOSE, "..... mult: %u\n", lapic_clockevent.mult); | 704 | apic_printk(APIC_VERBOSE, "..... mult: %u\n", lapic_clockevent.mult); |
686 | apic_printk(APIC_VERBOSE, "..... calibration result: %u\n", | 705 | apic_printk(APIC_VERBOSE, "..... calibration result: %u\n", |
687 | calibration_result); | 706 | lapic_timer_frequency); |
688 | 707 | ||
689 | if (cpu_has_tsc) { | 708 | if (cpu_has_tsc) { |
690 | apic_printk(APIC_VERBOSE, "..... CPU clock speed is " | 709 | apic_printk(APIC_VERBOSE, "..... CPU clock speed is " |
@@ -695,13 +714,13 @@ static int __init calibrate_APIC_clock(void) | |||
695 | 714 | ||
696 | apic_printk(APIC_VERBOSE, "..... host bus clock speed is " | 715 | apic_printk(APIC_VERBOSE, "..... host bus clock speed is " |
697 | "%u.%04u MHz.\n", | 716 | "%u.%04u MHz.\n", |
698 | calibration_result / (1000000 / HZ), | 717 | lapic_timer_frequency / (1000000 / HZ), |
699 | calibration_result % (1000000 / HZ)); | 718 | lapic_timer_frequency % (1000000 / HZ)); |
700 | 719 | ||
701 | /* | 720 | /* |
702 | * Do a sanity check on the APIC calibration result | 721 | * Do a sanity check on the APIC calibration result |
703 | */ | 722 | */ |
704 | if (calibration_result < (1000000 / HZ)) { | 723 | if (lapic_timer_frequency < (1000000 / HZ)) { |
705 | local_irq_enable(); | 724 | local_irq_enable(); |
706 | pr_warning("APIC frequency too slow, disabling apic timer\n"); | 725 | pr_warning("APIC frequency too slow, disabling apic timer\n"); |
707 | return -1; | 726 | return -1; |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 3c31fa98af6d..6d939d7847e2 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -193,10 +193,8 @@ int __init arch_early_irq_init(void) | |||
193 | struct irq_cfg *cfg; | 193 | struct irq_cfg *cfg; |
194 | int count, node, i; | 194 | int count, node, i; |
195 | 195 | ||
196 | if (!legacy_pic->nr_legacy_irqs) { | 196 | if (!legacy_pic->nr_legacy_irqs) |
197 | nr_irqs_gsi = 0; | ||
198 | io_apic_irqs = ~0UL; | 197 | io_apic_irqs = ~0UL; |
199 | } | ||
200 | 198 | ||
201 | for (i = 0; i < nr_ioapics; i++) { | 199 | for (i = 0; i < nr_ioapics; i++) { |
202 | ioapics[i].saved_registers = | 200 | ioapics[i].saved_registers = |
@@ -1696,6 +1694,7 @@ __apicdebuginit(void) print_IO_APICs(void) | |||
1696 | int ioapic_idx; | 1694 | int ioapic_idx; |
1697 | struct irq_cfg *cfg; | 1695 | struct irq_cfg *cfg; |
1698 | unsigned int irq; | 1696 | unsigned int irq; |
1697 | struct irq_chip *chip; | ||
1699 | 1698 | ||
1700 | printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); | 1699 | printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); |
1701 | for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) | 1700 | for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) |
@@ -1716,6 +1715,10 @@ __apicdebuginit(void) print_IO_APICs(void) | |||
1716 | for_each_active_irq(irq) { | 1715 | for_each_active_irq(irq) { |
1717 | struct irq_pin_list *entry; | 1716 | struct irq_pin_list *entry; |
1718 | 1717 | ||
1718 | chip = irq_get_chip(irq); | ||
1719 | if (chip != &ioapic_chip) | ||
1720 | continue; | ||
1721 | |||
1719 | cfg = irq_get_chip_data(irq); | 1722 | cfg = irq_get_chip_data(irq); |
1720 | if (!cfg) | 1723 | if (!cfg) |
1721 | continue; | 1724 | continue; |
diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c index 6199232161cf..319882ef848d 100644 --- a/arch/x86/kernel/cpu/mcheck/mce-inject.c +++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c | |||
@@ -208,7 +208,7 @@ static int inject_init(void) | |||
208 | if (!alloc_cpumask_var(&mce_inject_cpumask, GFP_KERNEL)) | 208 | if (!alloc_cpumask_var(&mce_inject_cpumask, GFP_KERNEL)) |
209 | return -ENOMEM; | 209 | return -ENOMEM; |
210 | printk(KERN_INFO "Machine check injector initialized\n"); | 210 | printk(KERN_INFO "Machine check injector initialized\n"); |
211 | mce_chrdev_ops.write = mce_write; | 211 | register_mce_write_callback(mce_write); |
212 | register_nmi_handler(NMI_LOCAL, mce_raise_notify, 0, | 212 | register_nmi_handler(NMI_LOCAL, mce_raise_notify, 0, |
213 | "mce_notify"); | 213 | "mce_notify"); |
214 | return 0; | 214 | return 0; |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 362056aefeb4..2af127d4c3d1 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -1634,16 +1634,35 @@ static long mce_chrdev_ioctl(struct file *f, unsigned int cmd, | |||
1634 | } | 1634 | } |
1635 | } | 1635 | } |
1636 | 1636 | ||
1637 | /* Modified in mce-inject.c, so not static or const */ | 1637 | static ssize_t (*mce_write)(struct file *filp, const char __user *ubuf, |
1638 | struct file_operations mce_chrdev_ops = { | 1638 | size_t usize, loff_t *off); |
1639 | |||
1640 | void register_mce_write_callback(ssize_t (*fn)(struct file *filp, | ||
1641 | const char __user *ubuf, | ||
1642 | size_t usize, loff_t *off)) | ||
1643 | { | ||
1644 | mce_write = fn; | ||
1645 | } | ||
1646 | EXPORT_SYMBOL_GPL(register_mce_write_callback); | ||
1647 | |||
1648 | ssize_t mce_chrdev_write(struct file *filp, const char __user *ubuf, | ||
1649 | size_t usize, loff_t *off) | ||
1650 | { | ||
1651 | if (mce_write) | ||
1652 | return mce_write(filp, ubuf, usize, off); | ||
1653 | else | ||
1654 | return -EINVAL; | ||
1655 | } | ||
1656 | |||
1657 | static const struct file_operations mce_chrdev_ops = { | ||
1639 | .open = mce_chrdev_open, | 1658 | .open = mce_chrdev_open, |
1640 | .release = mce_chrdev_release, | 1659 | .release = mce_chrdev_release, |
1641 | .read = mce_chrdev_read, | 1660 | .read = mce_chrdev_read, |
1661 | .write = mce_chrdev_write, | ||
1642 | .poll = mce_chrdev_poll, | 1662 | .poll = mce_chrdev_poll, |
1643 | .unlocked_ioctl = mce_chrdev_ioctl, | 1663 | .unlocked_ioctl = mce_chrdev_ioctl, |
1644 | .llseek = no_llseek, | 1664 | .llseek = no_llseek, |
1645 | }; | 1665 | }; |
1646 | EXPORT_SYMBOL_GPL(mce_chrdev_ops); | ||
1647 | 1666 | ||
1648 | static struct miscdevice mce_chrdev_device = { | 1667 | static struct miscdevice mce_chrdev_device = { |
1649 | MISC_MCELOG_MINOR, | 1668 | MISC_MCELOG_MINOR, |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index c1a0188e29ae..44842d756b29 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -74,9 +74,10 @@ static cycle_t kvm_clock_read(void) | |||
74 | struct pvclock_vcpu_time_info *src; | 74 | struct pvclock_vcpu_time_info *src; |
75 | cycle_t ret; | 75 | cycle_t ret; |
76 | 76 | ||
77 | src = &get_cpu_var(hv_clock); | 77 | preempt_disable_notrace(); |
78 | src = &__get_cpu_var(hv_clock); | ||
78 | ret = pvclock_clocksource_read(src); | 79 | ret = pvclock_clocksource_read(src); |
79 | put_cpu_var(hv_clock); | 80 | preempt_enable_notrace(); |
80 | return ret; | 81 | return ret; |
81 | } | 82 | } |
82 | 83 | ||
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c index b9c8628974af..e88f37b58ddd 100644 --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/nmi.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <asm/traps.h> | 29 | #include <asm/traps.h> |
30 | #include <asm/mach_traps.h> | 30 | #include <asm/mach_traps.h> |
31 | #include <asm/nmi.h> | 31 | #include <asm/nmi.h> |
32 | #include <asm/x86_init.h> | ||
32 | 33 | ||
33 | #define NMI_MAX_NAMELEN 16 | 34 | #define NMI_MAX_NAMELEN 16 |
34 | struct nmiaction { | 35 | struct nmiaction { |
@@ -348,7 +349,7 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs) | |||
348 | 349 | ||
349 | /* Non-CPU-specific NMI: NMI sources can be processed on any CPU */ | 350 | /* Non-CPU-specific NMI: NMI sources can be processed on any CPU */ |
350 | raw_spin_lock(&nmi_reason_lock); | 351 | raw_spin_lock(&nmi_reason_lock); |
351 | reason = get_nmi_reason(); | 352 | reason = x86_platform.get_nmi_reason(); |
352 | 353 | ||
353 | if (reason & NMI_REASON_MASK) { | 354 | if (reason & NMI_REASON_MASK) { |
354 | if (reason & NMI_REASON_SERR) | 355 | if (reason & NMI_REASON_SERR) |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index afaf38447ef5..cf0ef986cb6d 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -1045,6 +1045,8 @@ void __init setup_arch(char **cmdline_p) | |||
1045 | 1045 | ||
1046 | x86_init.timers.wallclock_init(); | 1046 | x86_init.timers.wallclock_init(); |
1047 | 1047 | ||
1048 | x86_platform.wallclock_init(); | ||
1049 | |||
1048 | mcheck_init(); | 1050 | mcheck_init(); |
1049 | 1051 | ||
1050 | arch_init_ideal_nops(); | 1052 | arch_init_ideal_nops(); |
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index 6f164bd5e14d..c1d6cd549397 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
@@ -21,12 +21,14 @@ | |||
21 | #include <asm/pat.h> | 21 | #include <asm/pat.h> |
22 | #include <asm/tsc.h> | 22 | #include <asm/tsc.h> |
23 | #include <asm/iommu.h> | 23 | #include <asm/iommu.h> |
24 | #include <asm/mach_traps.h> | ||
24 | 25 | ||
25 | void __cpuinit x86_init_noop(void) { } | 26 | void __cpuinit x86_init_noop(void) { } |
26 | void __init x86_init_uint_noop(unsigned int unused) { } | 27 | void __init x86_init_uint_noop(unsigned int unused) { } |
27 | void __init x86_init_pgd_noop(pgd_t *unused) { } | 28 | void __init x86_init_pgd_noop(pgd_t *unused) { } |
28 | int __init iommu_init_noop(void) { return 0; } | 29 | int __init iommu_init_noop(void) { return 0; } |
29 | void iommu_shutdown_noop(void) { } | 30 | void iommu_shutdown_noop(void) { } |
31 | void wallclock_init_noop(void) { } | ||
30 | 32 | ||
31 | /* | 33 | /* |
32 | * The platform setup functions are preset with the default functions | 34 | * The platform setup functions are preset with the default functions |
@@ -97,11 +99,13 @@ static int default_i8042_detect(void) { return 1; }; | |||
97 | 99 | ||
98 | struct x86_platform_ops x86_platform = { | 100 | struct x86_platform_ops x86_platform = { |
99 | .calibrate_tsc = native_calibrate_tsc, | 101 | .calibrate_tsc = native_calibrate_tsc, |
102 | .wallclock_init = wallclock_init_noop, | ||
100 | .get_wallclock = mach_get_cmos_time, | 103 | .get_wallclock = mach_get_cmos_time, |
101 | .set_wallclock = mach_set_rtc_mmss, | 104 | .set_wallclock = mach_set_rtc_mmss, |
102 | .iommu_shutdown = iommu_shutdown_noop, | 105 | .iommu_shutdown = iommu_shutdown_noop, |
103 | .is_untracked_pat_range = is_ISA_range, | 106 | .is_untracked_pat_range = is_ISA_range, |
104 | .nmi_init = default_nmi_init, | 107 | .nmi_init = default_nmi_init, |
108 | .get_nmi_reason = default_get_nmi_reason, | ||
105 | .i8042_detect = default_i8042_detect | 109 | .i8042_detect = default_i8042_detect |
106 | }; | 110 | }; |
107 | 111 | ||
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a0d6bd9ad442..579a0b51696a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <asm/mce.h> | 39 | #include <asm/mce.h> |
40 | #include <asm/i387.h> | 40 | #include <asm/i387.h> |
41 | #include <asm/xcr.h> | 41 | #include <asm/xcr.h> |
42 | #include <asm/perf_event.h> | ||
42 | 43 | ||
43 | #include "trace.h" | 44 | #include "trace.h" |
44 | 45 | ||
@@ -118,7 +119,7 @@ module_param(ple_gap, int, S_IRUGO); | |||
118 | static int ple_window = KVM_VMX_DEFAULT_PLE_WINDOW; | 119 | static int ple_window = KVM_VMX_DEFAULT_PLE_WINDOW; |
119 | module_param(ple_window, int, S_IRUGO); | 120 | module_param(ple_window, int, S_IRUGO); |
120 | 121 | ||
121 | #define NR_AUTOLOAD_MSRS 1 | 122 | #define NR_AUTOLOAD_MSRS 8 |
122 | #define VMCS02_POOL_SIZE 1 | 123 | #define VMCS02_POOL_SIZE 1 |
123 | 124 | ||
124 | struct vmcs { | 125 | struct vmcs { |
@@ -622,6 +623,7 @@ static unsigned long *vmx_msr_bitmap_legacy; | |||
622 | static unsigned long *vmx_msr_bitmap_longmode; | 623 | static unsigned long *vmx_msr_bitmap_longmode; |
623 | 624 | ||
624 | static bool cpu_has_load_ia32_efer; | 625 | static bool cpu_has_load_ia32_efer; |
626 | static bool cpu_has_load_perf_global_ctrl; | ||
625 | 627 | ||
626 | static DECLARE_BITMAP(vmx_vpid_bitmap, VMX_NR_VPIDS); | 628 | static DECLARE_BITMAP(vmx_vpid_bitmap, VMX_NR_VPIDS); |
627 | static DEFINE_SPINLOCK(vmx_vpid_lock); | 629 | static DEFINE_SPINLOCK(vmx_vpid_lock); |
@@ -1191,15 +1193,34 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu) | |||
1191 | vmcs_write32(EXCEPTION_BITMAP, eb); | 1193 | vmcs_write32(EXCEPTION_BITMAP, eb); |
1192 | } | 1194 | } |
1193 | 1195 | ||
1196 | static void clear_atomic_switch_msr_special(unsigned long entry, | ||
1197 | unsigned long exit) | ||
1198 | { | ||
1199 | vmcs_clear_bits(VM_ENTRY_CONTROLS, entry); | ||
1200 | vmcs_clear_bits(VM_EXIT_CONTROLS, exit); | ||
1201 | } | ||
1202 | |||
1194 | static void clear_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr) | 1203 | static void clear_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr) |
1195 | { | 1204 | { |
1196 | unsigned i; | 1205 | unsigned i; |
1197 | struct msr_autoload *m = &vmx->msr_autoload; | 1206 | struct msr_autoload *m = &vmx->msr_autoload; |
1198 | 1207 | ||
1199 | if (msr == MSR_EFER && cpu_has_load_ia32_efer) { | 1208 | switch (msr) { |
1200 | vmcs_clear_bits(VM_ENTRY_CONTROLS, VM_ENTRY_LOAD_IA32_EFER); | 1209 | case MSR_EFER: |
1201 | vmcs_clear_bits(VM_EXIT_CONTROLS, VM_EXIT_LOAD_IA32_EFER); | 1210 | if (cpu_has_load_ia32_efer) { |
1202 | return; | 1211 | clear_atomic_switch_msr_special(VM_ENTRY_LOAD_IA32_EFER, |
1212 | VM_EXIT_LOAD_IA32_EFER); | ||
1213 | return; | ||
1214 | } | ||
1215 | break; | ||
1216 | case MSR_CORE_PERF_GLOBAL_CTRL: | ||
1217 | if (cpu_has_load_perf_global_ctrl) { | ||
1218 | clear_atomic_switch_msr_special( | ||
1219 | VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL, | ||
1220 | VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL); | ||
1221 | return; | ||
1222 | } | ||
1223 | break; | ||
1203 | } | 1224 | } |
1204 | 1225 | ||
1205 | for (i = 0; i < m->nr; ++i) | 1226 | for (i = 0; i < m->nr; ++i) |
@@ -1215,25 +1236,55 @@ static void clear_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr) | |||
1215 | vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, m->nr); | 1236 | vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, m->nr); |
1216 | } | 1237 | } |
1217 | 1238 | ||
1239 | static void add_atomic_switch_msr_special(unsigned long entry, | ||
1240 | unsigned long exit, unsigned long guest_val_vmcs, | ||
1241 | unsigned long host_val_vmcs, u64 guest_val, u64 host_val) | ||
1242 | { | ||
1243 | vmcs_write64(guest_val_vmcs, guest_val); | ||
1244 | vmcs_write64(host_val_vmcs, host_val); | ||
1245 | vmcs_set_bits(VM_ENTRY_CONTROLS, entry); | ||
1246 | vmcs_set_bits(VM_EXIT_CONTROLS, exit); | ||
1247 | } | ||
1248 | |||
1218 | static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr, | 1249 | static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr, |
1219 | u64 guest_val, u64 host_val) | 1250 | u64 guest_val, u64 host_val) |
1220 | { | 1251 | { |
1221 | unsigned i; | 1252 | unsigned i; |
1222 | struct msr_autoload *m = &vmx->msr_autoload; | 1253 | struct msr_autoload *m = &vmx->msr_autoload; |
1223 | 1254 | ||
1224 | if (msr == MSR_EFER && cpu_has_load_ia32_efer) { | 1255 | switch (msr) { |
1225 | vmcs_write64(GUEST_IA32_EFER, guest_val); | 1256 | case MSR_EFER: |
1226 | vmcs_write64(HOST_IA32_EFER, host_val); | 1257 | if (cpu_has_load_ia32_efer) { |
1227 | vmcs_set_bits(VM_ENTRY_CONTROLS, VM_ENTRY_LOAD_IA32_EFER); | 1258 | add_atomic_switch_msr_special(VM_ENTRY_LOAD_IA32_EFER, |
1228 | vmcs_set_bits(VM_EXIT_CONTROLS, VM_EXIT_LOAD_IA32_EFER); | 1259 | VM_EXIT_LOAD_IA32_EFER, |
1229 | return; | 1260 | GUEST_IA32_EFER, |
1261 | HOST_IA32_EFER, | ||
1262 | guest_val, host_val); | ||
1263 | return; | ||
1264 | } | ||
1265 | break; | ||
1266 | case MSR_CORE_PERF_GLOBAL_CTRL: | ||
1267 | if (cpu_has_load_perf_global_ctrl) { | ||
1268 | add_atomic_switch_msr_special( | ||
1269 | VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL, | ||
1270 | VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL, | ||
1271 | GUEST_IA32_PERF_GLOBAL_CTRL, | ||
1272 | HOST_IA32_PERF_GLOBAL_CTRL, | ||
1273 | guest_val, host_val); | ||
1274 | return; | ||
1275 | } | ||
1276 | break; | ||
1230 | } | 1277 | } |
1231 | 1278 | ||
1232 | for (i = 0; i < m->nr; ++i) | 1279 | for (i = 0; i < m->nr; ++i) |
1233 | if (m->guest[i].index == msr) | 1280 | if (m->guest[i].index == msr) |
1234 | break; | 1281 | break; |
1235 | 1282 | ||
1236 | if (i == m->nr) { | 1283 | if (i == NR_AUTOLOAD_MSRS) { |
1284 | printk_once(KERN_WARNING"Not enough mst switch entries. " | ||
1285 | "Can't add msr %x\n", msr); | ||
1286 | return; | ||
1287 | } else if (i == m->nr) { | ||
1237 | ++m->nr; | 1288 | ++m->nr; |
1238 | vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, m->nr); | 1289 | vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, m->nr); |
1239 | vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, m->nr); | 1290 | vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, m->nr); |
@@ -2455,6 +2506,42 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) | |||
2455 | && allow_1_setting(MSR_IA32_VMX_EXIT_CTLS, | 2506 | && allow_1_setting(MSR_IA32_VMX_EXIT_CTLS, |
2456 | VM_EXIT_LOAD_IA32_EFER); | 2507 | VM_EXIT_LOAD_IA32_EFER); |
2457 | 2508 | ||
2509 | cpu_has_load_perf_global_ctrl = | ||
2510 | allow_1_setting(MSR_IA32_VMX_ENTRY_CTLS, | ||
2511 | VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL) | ||
2512 | && allow_1_setting(MSR_IA32_VMX_EXIT_CTLS, | ||
2513 | VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL); | ||
2514 | |||
2515 | /* | ||
2516 | * Some cpus support VM_ENTRY_(LOAD|SAVE)_IA32_PERF_GLOBAL_CTRL | ||
2517 | * but due to arrata below it can't be used. Workaround is to use | ||
2518 | * msr load mechanism to switch IA32_PERF_GLOBAL_CTRL. | ||
2519 | * | ||
2520 | * VM Exit May Incorrectly Clear IA32_PERF_GLOBAL_CTRL [34:32] | ||
2521 | * | ||
2522 | * AAK155 (model 26) | ||
2523 | * AAP115 (model 30) | ||
2524 | * AAT100 (model 37) | ||
2525 | * BC86,AAY89,BD102 (model 44) | ||
2526 | * BA97 (model 46) | ||
2527 | * | ||
2528 | */ | ||
2529 | if (cpu_has_load_perf_global_ctrl && boot_cpu_data.x86 == 0x6) { | ||
2530 | switch (boot_cpu_data.x86_model) { | ||
2531 | case 26: | ||
2532 | case 30: | ||
2533 | case 37: | ||
2534 | case 44: | ||
2535 | case 46: | ||
2536 | cpu_has_load_perf_global_ctrl = false; | ||
2537 | printk_once(KERN_WARNING"kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL " | ||
2538 | "does not work properly. Using workaround\n"); | ||
2539 | break; | ||
2540 | default: | ||
2541 | break; | ||
2542 | } | ||
2543 | } | ||
2544 | |||
2458 | return 0; | 2545 | return 0; |
2459 | } | 2546 | } |
2460 | 2547 | ||
@@ -5968,6 +6055,24 @@ static void vmx_cancel_injection(struct kvm_vcpu *vcpu) | |||
5968 | vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0); | 6055 | vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0); |
5969 | } | 6056 | } |
5970 | 6057 | ||
6058 | static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx) | ||
6059 | { | ||
6060 | int i, nr_msrs; | ||
6061 | struct perf_guest_switch_msr *msrs; | ||
6062 | |||
6063 | msrs = perf_guest_get_msrs(&nr_msrs); | ||
6064 | |||
6065 | if (!msrs) | ||
6066 | return; | ||
6067 | |||
6068 | for (i = 0; i < nr_msrs; i++) | ||
6069 | if (msrs[i].host == msrs[i].guest) | ||
6070 | clear_atomic_switch_msr(vmx, msrs[i].msr); | ||
6071 | else | ||
6072 | add_atomic_switch_msr(vmx, msrs[i].msr, msrs[i].guest, | ||
6073 | msrs[i].host); | ||
6074 | } | ||
6075 | |||
5971 | #ifdef CONFIG_X86_64 | 6076 | #ifdef CONFIG_X86_64 |
5972 | #define R "r" | 6077 | #define R "r" |
5973 | #define Q "q" | 6078 | #define Q "q" |
@@ -6017,6 +6122,8 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) | |||
6017 | if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) | 6122 | if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) |
6018 | vmx_set_interrupt_shadow(vcpu, 0); | 6123 | vmx_set_interrupt_shadow(vcpu, 0); |
6019 | 6124 | ||
6125 | atomic_switch_perf_msrs(vmx); | ||
6126 | |||
6020 | vmx->__launched = vmx->loaded_vmcs->launched; | 6127 | vmx->__launched = vmx->loaded_vmcs->launched; |
6021 | asm( | 6128 | asm( |
6022 | /* Store host registers */ | 6129 | /* Store host registers */ |
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index 541020df0da6..b1489a06a49d 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c | |||
@@ -187,11 +187,34 @@ int __init sfi_parse_mrtc(struct sfi_table_header *table) | |||
187 | static unsigned long __init mrst_calibrate_tsc(void) | 187 | static unsigned long __init mrst_calibrate_tsc(void) |
188 | { | 188 | { |
189 | unsigned long flags, fast_calibrate; | 189 | unsigned long flags, fast_calibrate; |
190 | 190 | if (__mrst_cpu_chip == MRST_CPU_CHIP_PENWELL) { | |
191 | local_irq_save(flags); | 191 | u32 lo, hi, ratio, fsb; |
192 | fast_calibrate = apbt_quick_calibrate(); | 192 | |
193 | local_irq_restore(flags); | 193 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); |
194 | 194 | pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi); | |
195 | ratio = (hi >> 8) & 0x1f; | ||
196 | pr_debug("ratio is %d\n", ratio); | ||
197 | if (!ratio) { | ||
198 | pr_err("read a zero ratio, should be incorrect!\n"); | ||
199 | pr_err("force tsc ratio to 16 ...\n"); | ||
200 | ratio = 16; | ||
201 | } | ||
202 | rdmsr(MSR_FSB_FREQ, lo, hi); | ||
203 | if ((lo & 0x7) == 0x7) | ||
204 | fsb = PENWELL_FSB_FREQ_83SKU; | ||
205 | else | ||
206 | fsb = PENWELL_FSB_FREQ_100SKU; | ||
207 | fast_calibrate = ratio * fsb; | ||
208 | pr_debug("read penwell tsc %lu khz\n", fast_calibrate); | ||
209 | lapic_timer_frequency = fsb * 1000 / HZ; | ||
210 | /* mark tsc clocksource as reliable */ | ||
211 | set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE); | ||
212 | } else { | ||
213 | local_irq_save(flags); | ||
214 | fast_calibrate = apbt_quick_calibrate(); | ||
215 | local_irq_restore(flags); | ||
216 | } | ||
217 | |||
195 | if (fast_calibrate) | 218 | if (fast_calibrate) |
196 | return fast_calibrate; | 219 | return fast_calibrate; |
197 | 220 | ||
@@ -254,6 +277,17 @@ static void mrst_reboot(void) | |||
254 | } | 277 | } |
255 | 278 | ||
256 | /* | 279 | /* |
280 | * Moorestown does not have external NMI source nor port 0x61 to report | ||
281 | * NMI status. The possible NMI sources are from pmu as a result of NMI | ||
282 | * watchdog or lock debug. Reading io port 0x61 results in 0xff which | ||
283 | * misled NMI handler. | ||
284 | */ | ||
285 | static unsigned char mrst_get_nmi_reason(void) | ||
286 | { | ||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | /* | ||
257 | * Moorestown specific x86_init function overrides and early setup | 291 | * Moorestown specific x86_init function overrides and early setup |
258 | * calls. | 292 | * calls. |
259 | */ | 293 | */ |
@@ -274,6 +308,8 @@ void __init x86_mrst_early_setup(void) | |||
274 | x86_platform.calibrate_tsc = mrst_calibrate_tsc; | 308 | x86_platform.calibrate_tsc = mrst_calibrate_tsc; |
275 | x86_platform.i8042_detect = mrst_i8042_detect; | 309 | x86_platform.i8042_detect = mrst_i8042_detect; |
276 | x86_init.timers.wallclock_init = mrst_rtc_init; | 310 | x86_init.timers.wallclock_init = mrst_rtc_init; |
311 | x86_platform.get_nmi_reason = mrst_get_nmi_reason; | ||
312 | |||
277 | x86_init.pci.init = pci_mrst_init; | 313 | x86_init.pci.init = pci_mrst_init; |
278 | x86_init.pci.fixup_irqs = x86_init_noop; | 314 | x86_init.pci.fixup_irqs = x86_init_noop; |
279 | 315 | ||
diff --git a/arch/x86/um/asm/processor.h b/arch/x86/um/asm/processor.h index 118c143a9cb4..2c32df6fe231 100644 --- a/arch/x86/um/asm/processor.h +++ b/arch/x86/um/asm/processor.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | #define KSTK_EIP(tsk) KSTK_REG(tsk, HOST_IP) | 13 | #define KSTK_EIP(tsk) KSTK_REG(tsk, HOST_IP) |
14 | #define KSTK_ESP(tsk) KSTK_REG(tsk, HOST_IP) | 14 | #define KSTK_ESP(tsk) KSTK_REG(tsk, HOST_SP) |
15 | #define KSTK_EBP(tsk) KSTK_REG(tsk, HOST_BP) | 15 | #define KSTK_EBP(tsk) KSTK_REG(tsk, HOST_BP) |
16 | 16 | ||
17 | #define ARCH_IS_STACKGROW(address) \ | 17 | #define ARCH_IS_STACKGROW(address) \ |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index da8afd576a6b..1f928659c338 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1356,7 +1356,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self, | |||
1356 | int cpu = (long)hcpu; | 1356 | int cpu = (long)hcpu; |
1357 | switch (action) { | 1357 | switch (action) { |
1358 | case CPU_UP_PREPARE: | 1358 | case CPU_UP_PREPARE: |
1359 | per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; | 1359 | xen_vcpu_setup(cpu); |
1360 | if (xen_have_vector_callback) | 1360 | if (xen_have_vector_callback) |
1361 | xen_init_lock_cpu(cpu); | 1361 | xen_init_lock_cpu(cpu); |
1362 | break; | 1362 | break; |
@@ -1386,7 +1386,6 @@ static void __init xen_hvm_guest_init(void) | |||
1386 | xen_hvm_smp_init(); | 1386 | xen_hvm_smp_init(); |
1387 | register_cpu_notifier(&xen_hvm_cpu_notifier); | 1387 | register_cpu_notifier(&xen_hvm_cpu_notifier); |
1388 | xen_unplug_emulated_devices(); | 1388 | xen_unplug_emulated_devices(); |
1389 | have_vcpu_info_placement = 0; | ||
1390 | x86_init.irqs.intr_init = xen_init_IRQ; | 1389 | x86_init.irqs.intr_init = xen_init_IRQ; |
1391 | xen_hvm_init_time_ops(); | 1390 | xen_hvm_init_time_ops(); |
1392 | xen_hvm_init_mmu_ops(); | 1391 | xen_hvm_init_mmu_ops(); |
diff --git a/arch/x86/xen/grant-table.c b/arch/x86/xen/grant-table.c index 65160a8a0ba3..3a5f55d51907 100644 --- a/arch/x86/xen/grant-table.c +++ b/arch/x86/xen/grant-table.c | |||
@@ -85,7 +85,7 @@ int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, | |||
85 | 85 | ||
86 | if (shared == NULL) { | 86 | if (shared == NULL) { |
87 | struct vm_struct *area = | 87 | struct vm_struct *area = |
88 | alloc_vm_area(PAGE_SIZE * max_nr_gframes); | 88 | alloc_vm_area(PAGE_SIZE * max_nr_gframes, NULL); |
89 | BUG_ON(area == NULL); | 89 | BUG_ON(area == NULL); |
90 | shared = area->addr; | 90 | shared = area->addr; |
91 | *__shared = shared; | 91 | *__shared = shared; |
diff --git a/block/blk-core.c b/block/blk-core.c index f43c8a5840ae..ea70e6c80cd3 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1379,15 +1379,19 @@ get_rq: | |||
1379 | */ | 1379 | */ |
1380 | if (list_empty(&plug->list)) | 1380 | if (list_empty(&plug->list)) |
1381 | trace_block_plug(q); | 1381 | trace_block_plug(q); |
1382 | else if (!plug->should_sort) { | 1382 | else { |
1383 | struct request *__rq; | 1383 | if (!plug->should_sort) { |
1384 | struct request *__rq; | ||
1384 | 1385 | ||
1385 | __rq = list_entry_rq(plug->list.prev); | 1386 | __rq = list_entry_rq(plug->list.prev); |
1386 | if (__rq->q != q) | 1387 | if (__rq->q != q) |
1387 | plug->should_sort = 1; | 1388 | plug->should_sort = 1; |
1389 | } | ||
1390 | if (request_count >= BLK_MAX_REQUEST_COUNT) { | ||
1391 | blk_flush_plug_list(plug, false); | ||
1392 | trace_block_plug(q); | ||
1393 | } | ||
1388 | } | 1394 | } |
1389 | if (request_count >= BLK_MAX_REQUEST_COUNT) | ||
1390 | blk_flush_plug_list(plug, false); | ||
1391 | list_add_tail(&req->queuelist, &plug->list); | 1395 | list_add_tail(&req->queuelist, &plug->list); |
1392 | drive_stat_acct(req, 1); | 1396 | drive_stat_acct(req, 1); |
1393 | } else { | 1397 | } else { |
diff --git a/block/blk-map.c b/block/blk-map.c index e663ac2d8e68..164cd0059706 100644 --- a/block/blk-map.c +++ b/block/blk-map.c | |||
@@ -204,10 +204,11 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, | |||
204 | if (!iov[i].iov_len) | 204 | if (!iov[i].iov_len) |
205 | return -EINVAL; | 205 | return -EINVAL; |
206 | 206 | ||
207 | if (uaddr & queue_dma_alignment(q)) { | 207 | /* |
208 | * Keep going so we check length of all segments | ||
209 | */ | ||
210 | if (uaddr & queue_dma_alignment(q)) | ||
208 | unaligned = 1; | 211 | unaligned = 1; |
209 | break; | ||
210 | } | ||
211 | } | 212 | } |
212 | 213 | ||
213 | if (unaligned || (q->dma_pad_mask & len) || map_data) | 214 | if (unaligned || (q->dma_pad_mask & len) || map_data) |
diff --git a/block/genhd.c b/block/genhd.c index 9253839714ff..02e9fca80825 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/mutex.h> | 19 | #include <linux/mutex.h> |
20 | #include <linux/idr.h> | 20 | #include <linux/idr.h> |
21 | #include <linux/log2.h> | 21 | #include <linux/log2.h> |
22 | #include <linux/ctype.h> | ||
23 | 22 | ||
24 | #include "blk.h" | 23 | #include "blk.h" |
25 | 24 | ||
@@ -916,74 +915,6 @@ static int __init genhd_device_init(void) | |||
916 | 915 | ||
917 | subsys_initcall(genhd_device_init); | 916 | subsys_initcall(genhd_device_init); |
918 | 917 | ||
919 | static ssize_t alias_show(struct device *dev, | ||
920 | struct device_attribute *attr, char *buf) | ||
921 | { | ||
922 | struct gendisk *disk = dev_to_disk(dev); | ||
923 | ssize_t ret = 0; | ||
924 | |||
925 | if (disk->alias) | ||
926 | ret = snprintf(buf, ALIAS_LEN, "%s\n", disk->alias); | ||
927 | return ret; | ||
928 | } | ||
929 | |||
930 | static ssize_t alias_store(struct device *dev, struct device_attribute *attr, | ||
931 | const char *buf, size_t count) | ||
932 | { | ||
933 | struct gendisk *disk = dev_to_disk(dev); | ||
934 | char *alias; | ||
935 | char *envp[] = { NULL, NULL }; | ||
936 | unsigned char c; | ||
937 | int i; | ||
938 | ssize_t ret = count; | ||
939 | |||
940 | if (!count) | ||
941 | return -EINVAL; | ||
942 | |||
943 | if (count >= ALIAS_LEN) { | ||
944 | printk(KERN_ERR "alias: alias is too long\n"); | ||
945 | return -EINVAL; | ||
946 | } | ||
947 | |||
948 | /* Validation check */ | ||
949 | for (i = 0; i < count; i++) { | ||
950 | c = buf[i]; | ||
951 | if (i == count - 1 && c == '\n') | ||
952 | break; | ||
953 | if (!isalnum(c) && c != '_' && c != '-') { | ||
954 | printk(KERN_ERR "alias: invalid alias\n"); | ||
955 | return -EINVAL; | ||
956 | } | ||
957 | } | ||
958 | |||
959 | if (disk->alias) { | ||
960 | printk(KERN_INFO "alias: %s is already assigned (%s)\n", | ||
961 | disk->disk_name, disk->alias); | ||
962 | return -EINVAL; | ||
963 | } | ||
964 | |||
965 | alias = kasprintf(GFP_KERNEL, "%s", buf); | ||
966 | if (!alias) | ||
967 | return -ENOMEM; | ||
968 | |||
969 | if (alias[count - 1] == '\n') | ||
970 | alias[count - 1] = '\0'; | ||
971 | |||
972 | envp[0] = kasprintf(GFP_KERNEL, "ALIAS=%s", alias); | ||
973 | if (!envp[0]) { | ||
974 | kfree(alias); | ||
975 | return -ENOMEM; | ||
976 | } | ||
977 | |||
978 | disk->alias = alias; | ||
979 | printk(KERN_INFO "alias: assigned %s to %s\n", alias, disk->disk_name); | ||
980 | |||
981 | kobject_uevent_env(&dev->kobj, KOBJ_ADD, envp); | ||
982 | |||
983 | kfree(envp[0]); | ||
984 | return ret; | ||
985 | } | ||
986 | |||
987 | static ssize_t disk_range_show(struct device *dev, | 918 | static ssize_t disk_range_show(struct device *dev, |
988 | struct device_attribute *attr, char *buf) | 919 | struct device_attribute *attr, char *buf) |
989 | { | 920 | { |
@@ -1043,7 +974,6 @@ static ssize_t disk_discard_alignment_show(struct device *dev, | |||
1043 | return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue)); | 974 | return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue)); |
1044 | } | 975 | } |
1045 | 976 | ||
1046 | static DEVICE_ATTR(alias, S_IRUGO|S_IWUSR, alias_show, alias_store); | ||
1047 | static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); | 977 | static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); |
1048 | static DEVICE_ATTR(ext_range, S_IRUGO, disk_ext_range_show, NULL); | 978 | static DEVICE_ATTR(ext_range, S_IRUGO, disk_ext_range_show, NULL); |
1049 | static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL); | 979 | static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL); |
@@ -1066,7 +996,6 @@ static struct device_attribute dev_attr_fail_timeout = | |||
1066 | #endif | 996 | #endif |
1067 | 997 | ||
1068 | static struct attribute *disk_attrs[] = { | 998 | static struct attribute *disk_attrs[] = { |
1069 | &dev_attr_alias.attr, | ||
1070 | &dev_attr_range.attr, | 999 | &dev_attr_range.attr, |
1071 | &dev_attr_ext_range.attr, | 1000 | &dev_attr_ext_range.attr, |
1072 | &dev_attr_removable.attr, | 1001 | &dev_attr_removable.attr, |
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index ec555951176e..43b875810d1b 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
@@ -67,7 +67,7 @@ static int __init ahci_probe(struct platform_device *pdev) | |||
67 | struct device *dev = &pdev->dev; | 67 | struct device *dev = &pdev->dev; |
68 | struct ahci_platform_data *pdata = dev_get_platdata(dev); | 68 | struct ahci_platform_data *pdata = dev_get_platdata(dev); |
69 | const struct platform_device_id *id = platform_get_device_id(pdev); | 69 | const struct platform_device_id *id = platform_get_device_id(pdev); |
70 | struct ata_port_info pi = ahci_port_info[id->driver_data]; | 70 | struct ata_port_info pi = ahci_port_info[id ? id->driver_data : 0]; |
71 | const struct ata_port_info *ppi[] = { &pi, NULL }; | 71 | const struct ata_port_info *ppi[] = { &pi, NULL }; |
72 | struct ahci_host_priv *hpriv; | 72 | struct ahci_host_priv *hpriv; |
73 | struct ata_host *host; | 73 | struct ata_host *host; |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 63d53277d6a9..4cadfa28f940 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -2533,10 +2533,12 @@ static int ata_pci_init_one(struct pci_dev *pdev, | |||
2533 | if (rc) | 2533 | if (rc) |
2534 | goto out; | 2534 | goto out; |
2535 | 2535 | ||
2536 | #ifdef CONFIG_ATA_BMDMA | ||
2536 | if (bmdma) | 2537 | if (bmdma) |
2537 | /* prepare and activate BMDMA host */ | 2538 | /* prepare and activate BMDMA host */ |
2538 | rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host); | 2539 | rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host); |
2539 | else | 2540 | else |
2541 | #endif | ||
2540 | /* prepare and activate SFF host */ | 2542 | /* prepare and activate SFF host */ |
2541 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); | 2543 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); |
2542 | if (rc) | 2544 | if (rc) |
@@ -2544,10 +2546,12 @@ static int ata_pci_init_one(struct pci_dev *pdev, | |||
2544 | host->private_data = host_priv; | 2546 | host->private_data = host_priv; |
2545 | host->flags |= hflags; | 2547 | host->flags |= hflags; |
2546 | 2548 | ||
2549 | #ifdef CONFIG_ATA_BMDMA | ||
2547 | if (bmdma) { | 2550 | if (bmdma) { |
2548 | pci_set_master(pdev); | 2551 | pci_set_master(pdev); |
2549 | rc = ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht); | 2552 | rc = ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht); |
2550 | } else | 2553 | } else |
2554 | #endif | ||
2551 | rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht); | 2555 | rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht); |
2552 | out: | 2556 | out: |
2553 | if (rc == 0) | 2557 | if (rc == 0) |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 82c865452c70..d8b3d89db043 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/kallsyms.h> | 22 | #include <linux/kallsyms.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/async.h> | 24 | #include <linux/async.h> |
25 | #include <linux/pm_runtime.h> | ||
25 | 26 | ||
26 | #include "base.h" | 27 | #include "base.h" |
27 | #include "power/power.h" | 28 | #include "power/power.h" |
@@ -1742,6 +1743,8 @@ void device_shutdown(void) | |||
1742 | */ | 1743 | */ |
1743 | list_del_init(&dev->kobj.entry); | 1744 | list_del_init(&dev->kobj.entry); |
1744 | spin_unlock(&devices_kset->list_lock); | 1745 | spin_unlock(&devices_kset->list_lock); |
1746 | /* Disable all device's runtime power management */ | ||
1747 | pm_runtime_disable(dev); | ||
1745 | 1748 | ||
1746 | if (dev->bus && dev->bus->shutdown) { | 1749 | if (dev->bus && dev->bus->shutdown) { |
1747 | dev_dbg(dev, "shutdown\n"); | 1750 | dev_dbg(dev, "shutdown\n"); |
diff --git a/drivers/base/node.c b/drivers/base/node.c index 793f796c4da3..5693ecee9a40 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
@@ -127,12 +127,13 @@ static ssize_t node_read_meminfo(struct sys_device * dev, | |||
127 | nid, K(node_page_state(nid, NR_WRITEBACK)), | 127 | nid, K(node_page_state(nid, NR_WRITEBACK)), |
128 | nid, K(node_page_state(nid, NR_FILE_PAGES)), | 128 | nid, K(node_page_state(nid, NR_FILE_PAGES)), |
129 | nid, K(node_page_state(nid, NR_FILE_MAPPED)), | 129 | nid, K(node_page_state(nid, NR_FILE_MAPPED)), |
130 | nid, K(node_page_state(nid, NR_ANON_PAGES) | ||
131 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 130 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
131 | nid, K(node_page_state(nid, NR_ANON_PAGES) | ||
132 | + node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) * | 132 | + node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) * |
133 | HPAGE_PMD_NR | 133 | HPAGE_PMD_NR), |
134 | #else | ||
135 | nid, K(node_page_state(nid, NR_ANON_PAGES)), | ||
134 | #endif | 136 | #endif |
135 | ), | ||
136 | nid, K(node_page_state(nid, NR_SHMEM)), | 137 | nid, K(node_page_state(nid, NR_SHMEM)), |
137 | nid, node_page_state(nid, NR_KERNEL_STACK) * | 138 | nid, node_page_state(nid, NR_KERNEL_STACK) * |
138 | THREAD_SIZE / 1024, | 139 | THREAD_SIZE / 1024, |
@@ -143,13 +144,14 @@ static ssize_t node_read_meminfo(struct sys_device * dev, | |||
143 | nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) + | 144 | nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) + |
144 | node_page_state(nid, NR_SLAB_UNRECLAIMABLE)), | 145 | node_page_state(nid, NR_SLAB_UNRECLAIMABLE)), |
145 | nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)), | 146 | nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)), |
146 | nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE)) | ||
147 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 147 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
148 | nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE)) | ||
148 | , nid, | 149 | , nid, |
149 | K(node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) * | 150 | K(node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) * |
150 | HPAGE_PMD_NR) | 151 | HPAGE_PMD_NR)); |
152 | #else | ||
153 | nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))); | ||
151 | #endif | 154 | #endif |
152 | ); | ||
153 | n += hugetlb_report_node_meminfo(nid, buf + n); | 155 | n += hugetlb_report_node_meminfo(nid, buf + n); |
154 | return n; | 156 | return n; |
155 | } | 157 | } |
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 5f0f85d5c576..428e55e012dc 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c | |||
@@ -229,7 +229,8 @@ int pm_clk_suspend(struct device *dev) | |||
229 | 229 | ||
230 | list_for_each_entry_reverse(ce, &psd->clock_list, node) { | 230 | list_for_each_entry_reverse(ce, &psd->clock_list, node) { |
231 | if (ce->status < PCE_STATUS_ERROR) { | 231 | if (ce->status < PCE_STATUS_ERROR) { |
232 | clk_disable(ce->clk); | 232 | if (ce->status == PCE_STATUS_ENABLED) |
233 | clk_disable(ce->clk); | ||
233 | ce->status = PCE_STATUS_ACQUIRED; | 234 | ce->status = PCE_STATUS_ACQUIRED; |
234 | } | 235 | } |
235 | } | 236 | } |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 7fa098464dae..c3d2dfcf438d 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -920,7 +920,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
920 | End: | 920 | End: |
921 | if (!error) { | 921 | if (!error) { |
922 | dev->power.is_suspended = true; | 922 | dev->power.is_suspended = true; |
923 | if (dev->power.wakeup_path && dev->parent) | 923 | if (dev->power.wakeup_path |
924 | && dev->parent && !dev->parent->power.ignore_children) | ||
924 | dev->parent->power.wakeup_path = true; | 925 | dev->parent->power.wakeup_path = true; |
925 | } | 926 | } |
926 | 927 | ||
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 30a94eadc200..86de6c50fc41 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c | |||
@@ -212,11 +212,9 @@ int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, | |||
212 | if (!dev || !req) /*guard against callers passing in null */ | 212 | if (!dev || !req) /*guard against callers passing in null */ |
213 | return -EINVAL; | 213 | return -EINVAL; |
214 | 214 | ||
215 | if (dev_pm_qos_request_active(req)) { | 215 | if (WARN(dev_pm_qos_request_active(req), |
216 | WARN(1, KERN_ERR "dev_pm_qos_add_request() called for already " | 216 | "%s() called for already added request\n", __func__)) |
217 | "added request\n"); | ||
218 | return -EINVAL; | 217 | return -EINVAL; |
219 | } | ||
220 | 218 | ||
221 | req->dev = dev; | 219 | req->dev = dev; |
222 | 220 | ||
@@ -271,11 +269,9 @@ int dev_pm_qos_update_request(struct dev_pm_qos_request *req, | |||
271 | if (!req) /*guard against callers passing in null */ | 269 | if (!req) /*guard against callers passing in null */ |
272 | return -EINVAL; | 270 | return -EINVAL; |
273 | 271 | ||
274 | if (!dev_pm_qos_request_active(req)) { | 272 | if (WARN(!dev_pm_qos_request_active(req), |
275 | WARN(1, KERN_ERR "dev_pm_qos_update_request() called for " | 273 | "%s() called for unknown object\n", __func__)) |
276 | "unknown object\n"); | ||
277 | return -EINVAL; | 274 | return -EINVAL; |
278 | } | ||
279 | 275 | ||
280 | mutex_lock(&dev_pm_qos_mtx); | 276 | mutex_lock(&dev_pm_qos_mtx); |
281 | 277 | ||
@@ -312,11 +308,9 @@ int dev_pm_qos_remove_request(struct dev_pm_qos_request *req) | |||
312 | if (!req) /*guard against callers passing in null */ | 308 | if (!req) /*guard against callers passing in null */ |
313 | return -EINVAL; | 309 | return -EINVAL; |
314 | 310 | ||
315 | if (!dev_pm_qos_request_active(req)) { | 311 | if (WARN(!dev_pm_qos_request_active(req), |
316 | WARN(1, KERN_ERR "dev_pm_qos_remove_request() called for " | 312 | "%s() called for unknown object\n", __func__)) |
317 | "unknown object\n"); | ||
318 | return -EINVAL; | 313 | return -EINVAL; |
319 | } | ||
320 | 314 | ||
321 | mutex_lock(&dev_pm_qos_mtx); | 315 | mutex_lock(&dev_pm_qos_mtx); |
322 | 316 | ||
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 486f94ef24d4..8004ac30a7a8 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/pci-aspm.h> | ||
27 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
29 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
@@ -4319,6 +4320,10 @@ static int __devinit cciss_pci_init(ctlr_info_t *h) | |||
4319 | dev_warn(&h->pdev->dev, "controller appears to be disabled\n"); | 4320 | dev_warn(&h->pdev->dev, "controller appears to be disabled\n"); |
4320 | return -ENODEV; | 4321 | return -ENODEV; |
4321 | } | 4322 | } |
4323 | |||
4324 | pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S | | ||
4325 | PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM); | ||
4326 | |||
4322 | err = pci_enable_device(h->pdev); | 4327 | err = pci_enable_device(h->pdev); |
4323 | if (err) { | 4328 | if (err) { |
4324 | dev_warn(&h->pdev->dev, "Unable to Enable PCI device\n"); | 4329 | dev_warn(&h->pdev->dev, "Unable to Enable PCI device\n"); |
@@ -5158,6 +5163,7 @@ reinit_after_soft_reset: | |||
5158 | h->cciss_max_sectors = 8192; | 5163 | h->cciss_max_sectors = 8192; |
5159 | 5164 | ||
5160 | rebuild_lun_table(h, 1, 0); | 5165 | rebuild_lun_table(h, 1, 0); |
5166 | cciss_engage_scsi(h); | ||
5161 | h->busy_initializing = 0; | 5167 | h->busy_initializing = 0; |
5162 | return 1; | 5168 | return 1; |
5163 | 5169 | ||
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index 951a4e33b92b..e820b68d2f6c 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -1720,5 +1720,6 @@ static int cciss_eh_abort_handler(struct scsi_cmnd *scsicmd) | |||
1720 | /* If no tape support, then these become defined out of existence */ | 1720 | /* If no tape support, then these become defined out of existence */ |
1721 | 1721 | ||
1722 | #define cciss_scsi_setup(cntl_num) | 1722 | #define cciss_scsi_setup(cntl_num) |
1723 | #define cciss_engage_scsi(h) | ||
1723 | 1724 | ||
1724 | #endif /* CONFIG_CISS_SCSI_TAPE */ | 1725 | #endif /* CONFIG_CISS_SCSI_TAPE */ |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 3d806820280e..68b205a9338f 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -161,17 +161,19 @@ static struct loop_func_table *xfer_funcs[MAX_LO_CRYPT] = { | |||
161 | &xor_funcs | 161 | &xor_funcs |
162 | }; | 162 | }; |
163 | 163 | ||
164 | static loff_t get_loop_size(struct loop_device *lo, struct file *file) | 164 | static loff_t get_size(loff_t offset, loff_t sizelimit, struct file *file) |
165 | { | 165 | { |
166 | loff_t size, offset, loopsize; | 166 | loff_t size, loopsize; |
167 | 167 | ||
168 | /* Compute loopsize in bytes */ | 168 | /* Compute loopsize in bytes */ |
169 | size = i_size_read(file->f_mapping->host); | 169 | size = i_size_read(file->f_mapping->host); |
170 | offset = lo->lo_offset; | ||
171 | loopsize = size - offset; | 170 | loopsize = size - offset; |
172 | if (lo->lo_sizelimit > 0 && lo->lo_sizelimit < loopsize) | 171 | /* offset is beyond i_size, wierd but possible */ |
173 | loopsize = lo->lo_sizelimit; | 172 | if (loopsize < 0) |
173 | return 0; | ||
174 | 174 | ||
175 | if (sizelimit > 0 && sizelimit < loopsize) | ||
176 | loopsize = sizelimit; | ||
175 | /* | 177 | /* |
176 | * Unfortunately, if we want to do I/O on the device, | 178 | * Unfortunately, if we want to do I/O on the device, |
177 | * the number of 512-byte sectors has to fit into a sector_t. | 179 | * the number of 512-byte sectors has to fit into a sector_t. |
@@ -179,17 +181,25 @@ static loff_t get_loop_size(struct loop_device *lo, struct file *file) | |||
179 | return loopsize >> 9; | 181 | return loopsize >> 9; |
180 | } | 182 | } |
181 | 183 | ||
184 | static loff_t get_loop_size(struct loop_device *lo, struct file *file) | ||
185 | { | ||
186 | return get_size(lo->lo_offset, lo->lo_sizelimit, file); | ||
187 | } | ||
188 | |||
182 | static int | 189 | static int |
183 | figure_loop_size(struct loop_device *lo) | 190 | figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit) |
184 | { | 191 | { |
185 | loff_t size = get_loop_size(lo, lo->lo_backing_file); | 192 | loff_t size = get_size(offset, sizelimit, lo->lo_backing_file); |
186 | sector_t x = (sector_t)size; | 193 | sector_t x = (sector_t)size; |
187 | 194 | ||
188 | if (unlikely((loff_t)x != size)) | 195 | if (unlikely((loff_t)x != size)) |
189 | return -EFBIG; | 196 | return -EFBIG; |
190 | 197 | if (lo->lo_offset != offset) | |
198 | lo->lo_offset = offset; | ||
199 | if (lo->lo_sizelimit != sizelimit) | ||
200 | lo->lo_sizelimit = sizelimit; | ||
191 | set_capacity(lo->lo_disk, x); | 201 | set_capacity(lo->lo_disk, x); |
192 | return 0; | 202 | return 0; |
193 | } | 203 | } |
194 | 204 | ||
195 | static inline int | 205 | static inline int |
@@ -372,7 +382,8 @@ do_lo_receive(struct loop_device *lo, | |||
372 | 382 | ||
373 | if (retval < 0) | 383 | if (retval < 0) |
374 | return retval; | 384 | return retval; |
375 | 385 | if (retval != bvec->bv_len) | |
386 | return -EIO; | ||
376 | return 0; | 387 | return 0; |
377 | } | 388 | } |
378 | 389 | ||
@@ -1058,9 +1069,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) | |||
1058 | 1069 | ||
1059 | if (lo->lo_offset != info->lo_offset || | 1070 | if (lo->lo_offset != info->lo_offset || |
1060 | lo->lo_sizelimit != info->lo_sizelimit) { | 1071 | lo->lo_sizelimit != info->lo_sizelimit) { |
1061 | lo->lo_offset = info->lo_offset; | 1072 | if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) |
1062 | lo->lo_sizelimit = info->lo_sizelimit; | ||
1063 | if (figure_loop_size(lo)) | ||
1064 | return -EFBIG; | 1073 | return -EFBIG; |
1065 | } | 1074 | } |
1066 | loop_config_discard(lo); | 1075 | loop_config_discard(lo); |
@@ -1246,7 +1255,7 @@ static int loop_set_capacity(struct loop_device *lo, struct block_device *bdev) | |||
1246 | err = -ENXIO; | 1255 | err = -ENXIO; |
1247 | if (unlikely(lo->lo_state != Lo_bound)) | 1256 | if (unlikely(lo->lo_state != Lo_bound)) |
1248 | goto out; | 1257 | goto out; |
1249 | err = figure_loop_size(lo); | 1258 | err = figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit); |
1250 | if (unlikely(err)) | 1259 | if (unlikely(err)) |
1251 | goto out; | 1260 | goto out; |
1252 | sec = get_capacity(lo->lo_disk); | 1261 | sec = get_capacity(lo->lo_disk); |
@@ -1284,13 +1293,19 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode, | |||
1284 | goto out_unlocked; | 1293 | goto out_unlocked; |
1285 | break; | 1294 | break; |
1286 | case LOOP_SET_STATUS: | 1295 | case LOOP_SET_STATUS: |
1287 | err = loop_set_status_old(lo, (struct loop_info __user *) arg); | 1296 | err = -EPERM; |
1297 | if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN)) | ||
1298 | err = loop_set_status_old(lo, | ||
1299 | (struct loop_info __user *)arg); | ||
1288 | break; | 1300 | break; |
1289 | case LOOP_GET_STATUS: | 1301 | case LOOP_GET_STATUS: |
1290 | err = loop_get_status_old(lo, (struct loop_info __user *) arg); | 1302 | err = loop_get_status_old(lo, (struct loop_info __user *) arg); |
1291 | break; | 1303 | break; |
1292 | case LOOP_SET_STATUS64: | 1304 | case LOOP_SET_STATUS64: |
1293 | err = loop_set_status64(lo, (struct loop_info64 __user *) arg); | 1305 | err = -EPERM; |
1306 | if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN)) | ||
1307 | err = loop_set_status64(lo, | ||
1308 | (struct loop_info64 __user *) arg); | ||
1294 | break; | 1309 | break; |
1295 | case LOOP_GET_STATUS64: | 1310 | case LOOP_GET_STATUS64: |
1296 | err = loop_get_status64(lo, (struct loop_info64 __user *) arg); | 1311 | err = loop_get_status64(lo, (struct loop_info64 __user *) arg); |
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 6b9a2000d56a..a79fb4f7ff62 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
@@ -630,6 +630,7 @@ static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t | |||
630 | if (dev->status & 0x10) | 630 | if (dev->status & 0x10) |
631 | return -ETIME; | 631 | return -ETIME; |
632 | 632 | ||
633 | memset(&hdr, 0, sizeof(hdr)); | ||
633 | hdr.magic = PG_MAGIC; | 634 | hdr.magic = PG_MAGIC; |
634 | hdr.dlen = dev->dlen; | 635 | hdr.dlen = dev->dlen; |
635 | copy = 0; | 636 | copy = 0; |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index f9b726091ad0..fe4ebc375b3d 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -100,6 +100,9 @@ static struct usb_device_id btusb_table[] = { | |||
100 | /* Canyon CN-BTU1 with HID interfaces */ | 100 | /* Canyon CN-BTU1 with HID interfaces */ |
101 | { USB_DEVICE(0x0c10, 0x0000) }, | 101 | { USB_DEVICE(0x0c10, 0x0000) }, |
102 | 102 | ||
103 | /* Broadcom BCM20702A0 */ | ||
104 | { USB_DEVICE(0x413c, 0x8197) }, | ||
105 | |||
103 | { } /* Terminating entry */ | 106 | { } /* Terminating entry */ |
104 | }; | 107 | }; |
105 | 108 | ||
diff --git a/drivers/char/random.c b/drivers/char/random.c index 63e19ba56bbe..6035ab8d5ef7 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -941,7 +941,7 @@ void get_random_bytes(void *buf, int nbytes) | |||
941 | if (!arch_get_random_long(&v)) | 941 | if (!arch_get_random_long(&v)) |
942 | break; | 942 | break; |
943 | 943 | ||
944 | memcpy(buf, &v, chunk); | 944 | memcpy(p, &v, chunk); |
945 | p += chunk; | 945 | p += chunk; |
946 | nbytes -= chunk; | 946 | nbytes -= chunk; |
947 | } | 947 | } |
diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig index 643b055ed3cd..8f0491037080 100644 --- a/drivers/devfreq/Kconfig +++ b/drivers/devfreq/Kconfig | |||
@@ -1,36 +1,29 @@ | |||
1 | config ARCH_HAS_DEVFREQ | ||
2 | bool | ||
3 | depends on ARCH_HAS_OPP | ||
4 | help | ||
5 | Denotes that the architecture supports DEVFREQ. If the architecture | ||
6 | supports multiple OPP entries per device and the frequency of the | ||
7 | devices with OPPs may be altered dynamically, the architecture | ||
8 | supports DEVFREQ. | ||
9 | |||
10 | menuconfig PM_DEVFREQ | 1 | menuconfig PM_DEVFREQ |
11 | bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support" | 2 | bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support" |
12 | depends on PM_OPP && ARCH_HAS_DEVFREQ | ||
13 | help | 3 | help |
14 | With OPP support, a device may have a list of frequencies and | 4 | A device may have a list of frequencies and voltages available. |
15 | voltages available. DEVFREQ, a generic DVFS framework can be | 5 | devfreq, a generic DVFS framework can be registered for a device |
16 | registered for a device with OPP support in order to let the | 6 | in order to let the governor provided to devfreq choose an |
17 | governor provided to DEVFREQ choose an operating frequency | 7 | operating frequency based on the device driver's policy. |
18 | based on the OPP's list and the policy given with DEVFREQ. | ||
19 | 8 | ||
20 | Each device may have its own governor and policy. DEVFREQ can | 9 | Each device may have its own governor and policy. Devfreq can |
21 | reevaluate the device state periodically and/or based on the | 10 | reevaluate the device state periodically and/or based on the |
22 | OPP list changes (each frequency/voltage pair in OPP may be | 11 | notification to "nb", a notifier block, of devfreq. |
23 | disabled or enabled). | ||
24 | 12 | ||
25 | Like some CPUs with CPUFREQ, a device may have multiple clocks. | 13 | Like some CPUs with CPUfreq, a device may have multiple clocks. |
26 | However, because the clock frequencies of a single device are | 14 | However, because the clock frequencies of a single device are |
27 | determined by the single device's state, an instance of DEVFREQ | 15 | determined by the single device's state, an instance of devfreq |
28 | is attached to a single device and returns a "representative" | 16 | is attached to a single device and returns a "representative" |
29 | clock frequency from the OPP of the device, which is also attached | 17 | clock frequency of the device, which is also attached |
30 | to a device by 1-to-1. The device registering DEVFREQ takes the | 18 | to a device by 1-to-1. The device registering devfreq takes the |
31 | responsiblity to "interpret" the frequency listed in OPP and | 19 | responsiblity to "interpret" the representative frequency and |
32 | to set its every clock accordingly with the "target" callback | 20 | to set its every clock accordingly with the "target" callback |
33 | given to DEVFREQ. | 21 | given to devfreq. |
22 | |||
23 | When OPP is used with the devfreq device, it is recommended to | ||
24 | register devfreq's nb to the OPP's notifier head. If OPP is | ||
25 | used with the devfreq device, you may use OPP helper | ||
26 | functions defined in devfreq.h. | ||
34 | 27 | ||
35 | if PM_DEVFREQ | 28 | if PM_DEVFREQ |
36 | 29 | ||
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 5d15b812377b..59d24e9cb8c5 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
@@ -15,7 +15,9 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/module.h> | ||
18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/stat.h> | ||
19 | #include <linux/opp.h> | 21 | #include <linux/opp.h> |
20 | #include <linux/devfreq.h> | 22 | #include <linux/devfreq.h> |
21 | #include <linux/workqueue.h> | 23 | #include <linux/workqueue.h> |
@@ -416,10 +418,14 @@ out: | |||
416 | */ | 418 | */ |
417 | int devfreq_remove_device(struct devfreq *devfreq) | 419 | int devfreq_remove_device(struct devfreq *devfreq) |
418 | { | 420 | { |
421 | bool central_polling; | ||
422 | |||
419 | if (!devfreq) | 423 | if (!devfreq) |
420 | return -EINVAL; | 424 | return -EINVAL; |
421 | 425 | ||
422 | if (!devfreq->governor->no_central_polling) { | 426 | central_polling = !devfreq->governor->no_central_polling; |
427 | |||
428 | if (central_polling) { | ||
423 | mutex_lock(&devfreq_list_lock); | 429 | mutex_lock(&devfreq_list_lock); |
424 | while (wait_remove_device == devfreq) { | 430 | while (wait_remove_device == devfreq) { |
425 | mutex_unlock(&devfreq_list_lock); | 431 | mutex_unlock(&devfreq_list_lock); |
@@ -431,7 +437,7 @@ int devfreq_remove_device(struct devfreq *devfreq) | |||
431 | mutex_lock(&devfreq->lock); | 437 | mutex_lock(&devfreq->lock); |
432 | _remove_devfreq(devfreq, false); /* it unlocks devfreq->lock */ | 438 | _remove_devfreq(devfreq, false); /* it unlocks devfreq->lock */ |
433 | 439 | ||
434 | if (!devfreq->governor->no_central_polling) | 440 | if (central_polling) |
435 | mutex_unlock(&devfreq_list_lock); | 441 | mutex_unlock(&devfreq_list_lock); |
436 | 442 | ||
437 | return 0; | 443 | return 0; |
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index bcb1126e3d00..153980be4ee6 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -585,14 +585,12 @@ int dmi_name_in_serial(const char *str) | |||
585 | } | 585 | } |
586 | 586 | ||
587 | /** | 587 | /** |
588 | * dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information. | 588 | * dmi_name_in_vendors - Check if string is in the DMI system or board vendor name |
589 | * @str: Case sensitive Name | 589 | * @str: Case sensitive Name |
590 | */ | 590 | */ |
591 | int dmi_name_in_vendors(const char *str) | 591 | int dmi_name_in_vendors(const char *str) |
592 | { | 592 | { |
593 | static int fields[] = { DMI_BIOS_VENDOR, DMI_BIOS_VERSION, DMI_SYS_VENDOR, | 593 | static int fields[] = { DMI_SYS_VENDOR, DMI_BOARD_VENDOR, DMI_NONE }; |
594 | DMI_PRODUCT_NAME, DMI_PRODUCT_VERSION, DMI_BOARD_VENDOR, | ||
595 | DMI_BOARD_NAME, DMI_BOARD_VERSION, DMI_NONE }; | ||
596 | int i; | 594 | int i; |
597 | for (i = 0; fields[i] != DMI_NONE; i++) { | 595 | for (i = 0; fields[i] != DMI_NONE; i++) { |
598 | int f = fields[i]; | 596 | int f = fields[i]; |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 405c63b9d539..8323fc389840 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -1873,6 +1873,10 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, | |||
1873 | } | 1873 | } |
1874 | 1874 | ||
1875 | if (num_clips && clips_ptr) { | 1875 | if (num_clips && clips_ptr) { |
1876 | if (num_clips < 0 || num_clips > DRM_MODE_FB_DIRTY_MAX_CLIPS) { | ||
1877 | ret = -EINVAL; | ||
1878 | goto out_err1; | ||
1879 | } | ||
1876 | clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL); | 1880 | clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL); |
1877 | if (!clips) { | 1881 | if (!clips) { |
1878 | ret = -ENOMEM; | 1882 | ret = -ENOMEM; |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 68b756253f9f..44a5d0ad8b7c 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -110,10 +110,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc) | |||
110 | /* Prevent vblank irq processing while disabling vblank irqs, | 110 | /* Prevent vblank irq processing while disabling vblank irqs, |
111 | * so no updates of timestamps or count can happen after we've | 111 | * so no updates of timestamps or count can happen after we've |
112 | * disabled. Needed to prevent races in case of delayed irq's. | 112 | * disabled. Needed to prevent races in case of delayed irq's. |
113 | * Disable preemption, so vblank_time_lock is held as short as | ||
114 | * possible, even under a kernel with PREEMPT_RT patches. | ||
115 | */ | 113 | */ |
116 | preempt_disable(); | ||
117 | spin_lock_irqsave(&dev->vblank_time_lock, irqflags); | 114 | spin_lock_irqsave(&dev->vblank_time_lock, irqflags); |
118 | 115 | ||
119 | dev->driver->disable_vblank(dev, crtc); | 116 | dev->driver->disable_vblank(dev, crtc); |
@@ -164,7 +161,6 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc) | |||
164 | clear_vblank_timestamps(dev, crtc); | 161 | clear_vblank_timestamps(dev, crtc); |
165 | 162 | ||
166 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); | 163 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); |
167 | preempt_enable(); | ||
168 | } | 164 | } |
169 | 165 | ||
170 | static void vblank_disable_fn(unsigned long arg) | 166 | static void vblank_disable_fn(unsigned long arg) |
@@ -889,10 +885,6 @@ int drm_vblank_get(struct drm_device *dev, int crtc) | |||
889 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | 885 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
890 | /* Going from 0->1 means we have to enable interrupts again */ | 886 | /* Going from 0->1 means we have to enable interrupts again */ |
891 | if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1) { | 887 | if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1) { |
892 | /* Disable preemption while holding vblank_time_lock. Do | ||
893 | * it explicitely to guard against PREEMPT_RT kernel. | ||
894 | */ | ||
895 | preempt_disable(); | ||
896 | spin_lock_irqsave(&dev->vblank_time_lock, irqflags2); | 888 | spin_lock_irqsave(&dev->vblank_time_lock, irqflags2); |
897 | if (!dev->vblank_enabled[crtc]) { | 889 | if (!dev->vblank_enabled[crtc]) { |
898 | /* Enable vblank irqs under vblank_time_lock protection. | 890 | /* Enable vblank irqs under vblank_time_lock protection. |
@@ -912,7 +904,6 @@ int drm_vblank_get(struct drm_device *dev, int crtc) | |||
912 | } | 904 | } |
913 | } | 905 | } |
914 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags2); | 906 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags2); |
915 | preempt_enable(); | ||
916 | } else { | 907 | } else { |
917 | if (!dev->vblank_enabled[crtc]) { | 908 | if (!dev->vblank_enabled[crtc]) { |
918 | atomic_dec(&dev->vblank_refcount[crtc]); | 909 | atomic_dec(&dev->vblank_refcount[crtc]); |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 4f40f1ce1d8e..d09a6e02dc95 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -636,11 +636,16 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data) | |||
636 | struct drm_device *dev = node->minor->dev; | 636 | struct drm_device *dev = node->minor->dev; |
637 | drm_i915_private_t *dev_priv = dev->dev_private; | 637 | drm_i915_private_t *dev_priv = dev->dev_private; |
638 | struct intel_ring_buffer *ring; | 638 | struct intel_ring_buffer *ring; |
639 | int ret; | ||
639 | 640 | ||
640 | ring = &dev_priv->ring[(uintptr_t)node->info_ent->data]; | 641 | ring = &dev_priv->ring[(uintptr_t)node->info_ent->data]; |
641 | if (ring->size == 0) | 642 | if (ring->size == 0) |
642 | return 0; | 643 | return 0; |
643 | 644 | ||
645 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
646 | if (ret) | ||
647 | return ret; | ||
648 | |||
644 | seq_printf(m, "Ring %s:\n", ring->name); | 649 | seq_printf(m, "Ring %s:\n", ring->name); |
645 | seq_printf(m, " Head : %08x\n", I915_READ_HEAD(ring) & HEAD_ADDR); | 650 | seq_printf(m, " Head : %08x\n", I915_READ_HEAD(ring) & HEAD_ADDR); |
646 | seq_printf(m, " Tail : %08x\n", I915_READ_TAIL(ring) & TAIL_ADDR); | 651 | seq_printf(m, " Tail : %08x\n", I915_READ_TAIL(ring) & TAIL_ADDR); |
@@ -654,6 +659,8 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data) | |||
654 | seq_printf(m, " Control : %08x\n", I915_READ_CTL(ring)); | 659 | seq_printf(m, " Control : %08x\n", I915_READ_CTL(ring)); |
655 | seq_printf(m, " Start : %08x\n", I915_READ_START(ring)); | 660 | seq_printf(m, " Start : %08x\n", I915_READ_START(ring)); |
656 | 661 | ||
662 | mutex_unlock(&dev->struct_mutex); | ||
663 | |||
657 | return 0; | 664 | return 0; |
658 | } | 665 | } |
659 | 666 | ||
@@ -842,7 +849,16 @@ static int i915_rstdby_delays(struct seq_file *m, void *unused) | |||
842 | struct drm_info_node *node = (struct drm_info_node *) m->private; | 849 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
843 | struct drm_device *dev = node->minor->dev; | 850 | struct drm_device *dev = node->minor->dev; |
844 | drm_i915_private_t *dev_priv = dev->dev_private; | 851 | drm_i915_private_t *dev_priv = dev->dev_private; |
845 | u16 crstanddelay = I915_READ16(CRSTANDVID); | 852 | u16 crstanddelay; |
853 | int ret; | ||
854 | |||
855 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
856 | if (ret) | ||
857 | return ret; | ||
858 | |||
859 | crstanddelay = I915_READ16(CRSTANDVID); | ||
860 | |||
861 | mutex_unlock(&dev->struct_mutex); | ||
846 | 862 | ||
847 | seq_printf(m, "w/ctx: %d, w/o ctx: %d\n", (crstanddelay >> 8) & 0x3f, (crstanddelay & 0x3f)); | 863 | seq_printf(m, "w/ctx: %d, w/o ctx: %d\n", (crstanddelay >> 8) & 0x3f, (crstanddelay & 0x3f)); |
848 | 864 | ||
@@ -940,7 +956,11 @@ static int i915_delayfreq_table(struct seq_file *m, void *unused) | |||
940 | struct drm_device *dev = node->minor->dev; | 956 | struct drm_device *dev = node->minor->dev; |
941 | drm_i915_private_t *dev_priv = dev->dev_private; | 957 | drm_i915_private_t *dev_priv = dev->dev_private; |
942 | u32 delayfreq; | 958 | u32 delayfreq; |
943 | int i; | 959 | int ret, i; |
960 | |||
961 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
962 | if (ret) | ||
963 | return ret; | ||
944 | 964 | ||
945 | for (i = 0; i < 16; i++) { | 965 | for (i = 0; i < 16; i++) { |
946 | delayfreq = I915_READ(PXVFREQ_BASE + i * 4); | 966 | delayfreq = I915_READ(PXVFREQ_BASE + i * 4); |
@@ -948,6 +968,8 @@ static int i915_delayfreq_table(struct seq_file *m, void *unused) | |||
948 | (delayfreq & PXVFREQ_PX_MASK) >> PXVFREQ_PX_SHIFT); | 968 | (delayfreq & PXVFREQ_PX_MASK) >> PXVFREQ_PX_SHIFT); |
949 | } | 969 | } |
950 | 970 | ||
971 | mutex_unlock(&dev->struct_mutex); | ||
972 | |||
951 | return 0; | 973 | return 0; |
952 | } | 974 | } |
953 | 975 | ||
@@ -962,13 +984,19 @@ static int i915_inttoext_table(struct seq_file *m, void *unused) | |||
962 | struct drm_device *dev = node->minor->dev; | 984 | struct drm_device *dev = node->minor->dev; |
963 | drm_i915_private_t *dev_priv = dev->dev_private; | 985 | drm_i915_private_t *dev_priv = dev->dev_private; |
964 | u32 inttoext; | 986 | u32 inttoext; |
965 | int i; | 987 | int ret, i; |
988 | |||
989 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
990 | if (ret) | ||
991 | return ret; | ||
966 | 992 | ||
967 | for (i = 1; i <= 32; i++) { | 993 | for (i = 1; i <= 32; i++) { |
968 | inttoext = I915_READ(INTTOEXT_BASE_ILK + i * 4); | 994 | inttoext = I915_READ(INTTOEXT_BASE_ILK + i * 4); |
969 | seq_printf(m, "INTTOEXT%02d: 0x%08x\n", i, inttoext); | 995 | seq_printf(m, "INTTOEXT%02d: 0x%08x\n", i, inttoext); |
970 | } | 996 | } |
971 | 997 | ||
998 | mutex_unlock(&dev->struct_mutex); | ||
999 | |||
972 | return 0; | 1000 | return 0; |
973 | } | 1001 | } |
974 | 1002 | ||
@@ -977,9 +1005,19 @@ static int i915_drpc_info(struct seq_file *m, void *unused) | |||
977 | struct drm_info_node *node = (struct drm_info_node *) m->private; | 1005 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
978 | struct drm_device *dev = node->minor->dev; | 1006 | struct drm_device *dev = node->minor->dev; |
979 | drm_i915_private_t *dev_priv = dev->dev_private; | 1007 | drm_i915_private_t *dev_priv = dev->dev_private; |
980 | u32 rgvmodectl = I915_READ(MEMMODECTL); | 1008 | u32 rgvmodectl, rstdbyctl; |
981 | u32 rstdbyctl = I915_READ(RSTDBYCTL); | 1009 | u16 crstandvid; |
982 | u16 crstandvid = I915_READ16(CRSTANDVID); | 1010 | int ret; |
1011 | |||
1012 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
1013 | if (ret) | ||
1014 | return ret; | ||
1015 | |||
1016 | rgvmodectl = I915_READ(MEMMODECTL); | ||
1017 | rstdbyctl = I915_READ(RSTDBYCTL); | ||
1018 | crstandvid = I915_READ16(CRSTANDVID); | ||
1019 | |||
1020 | mutex_unlock(&dev->struct_mutex); | ||
983 | 1021 | ||
984 | seq_printf(m, "HD boost: %s\n", (rgvmodectl & MEMMODE_BOOST_EN) ? | 1022 | seq_printf(m, "HD boost: %s\n", (rgvmodectl & MEMMODE_BOOST_EN) ? |
985 | "yes" : "no"); | 1023 | "yes" : "no"); |
@@ -1167,9 +1205,16 @@ static int i915_gfxec(struct seq_file *m, void *unused) | |||
1167 | struct drm_info_node *node = (struct drm_info_node *) m->private; | 1205 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
1168 | struct drm_device *dev = node->minor->dev; | 1206 | struct drm_device *dev = node->minor->dev; |
1169 | drm_i915_private_t *dev_priv = dev->dev_private; | 1207 | drm_i915_private_t *dev_priv = dev->dev_private; |
1208 | int ret; | ||
1209 | |||
1210 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
1211 | if (ret) | ||
1212 | return ret; | ||
1170 | 1213 | ||
1171 | seq_printf(m, "GFXEC: %ld\n", (unsigned long)I915_READ(0x112f4)); | 1214 | seq_printf(m, "GFXEC: %ld\n", (unsigned long)I915_READ(0x112f4)); |
1172 | 1215 | ||
1216 | mutex_unlock(&dev->struct_mutex); | ||
1217 | |||
1173 | return 0; | 1218 | return 0; |
1174 | } | 1219 | } |
1175 | 1220 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index e9c2cfe45daa..15bfa9145d2b 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -68,7 +68,7 @@ module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); | |||
68 | MODULE_PARM_DESC(i915_enable_rc6, | 68 | MODULE_PARM_DESC(i915_enable_rc6, |
69 | "Enable power-saving render C-state 6 (default: true)"); | 69 | "Enable power-saving render C-state 6 (default: true)"); |
70 | 70 | ||
71 | unsigned int i915_enable_fbc __read_mostly = -1; | 71 | int i915_enable_fbc __read_mostly = -1; |
72 | module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); | 72 | module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); |
73 | MODULE_PARM_DESC(i915_enable_fbc, | 73 | MODULE_PARM_DESC(i915_enable_fbc, |
74 | "Enable frame buffer compression for power savings " | 74 | "Enable frame buffer compression for power savings " |
@@ -80,7 +80,7 @@ MODULE_PARM_DESC(lvds_downclock, | |||
80 | "Use panel (LVDS/eDP) downclocking for power savings " | 80 | "Use panel (LVDS/eDP) downclocking for power savings " |
81 | "(default: false)"); | 81 | "(default: false)"); |
82 | 82 | ||
83 | unsigned int i915_panel_use_ssc __read_mostly = -1; | 83 | int i915_panel_use_ssc __read_mostly = -1; |
84 | module_param_named(lvds_use_ssc, i915_panel_use_ssc, int, 0600); | 84 | module_param_named(lvds_use_ssc, i915_panel_use_ssc, int, 0600); |
85 | MODULE_PARM_DESC(lvds_use_ssc, | 85 | MODULE_PARM_DESC(lvds_use_ssc, |
86 | "Use Spread Spectrum Clock with panels [LVDS/eDP] " | 86 | "Use Spread Spectrum Clock with panels [LVDS/eDP] " |
@@ -107,7 +107,7 @@ static struct drm_driver driver; | |||
107 | extern int intel_agp_enabled; | 107 | extern int intel_agp_enabled; |
108 | 108 | ||
109 | #define INTEL_VGA_DEVICE(id, info) { \ | 109 | #define INTEL_VGA_DEVICE(id, info) { \ |
110 | .class = PCI_CLASS_DISPLAY_VGA << 8, \ | 110 | .class = PCI_BASE_CLASS_DISPLAY << 16, \ |
111 | .class_mask = 0xff0000, \ | 111 | .class_mask = 0xff0000, \ |
112 | .vendor = 0x8086, \ | 112 | .vendor = 0x8086, \ |
113 | .device = id, \ | 113 | .device = id, \ |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 06a37f4fd74b..4a9c1b979804 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -126,6 +126,9 @@ struct drm_i915_master_private { | |||
126 | struct _drm_i915_sarea *sarea_priv; | 126 | struct _drm_i915_sarea *sarea_priv; |
127 | }; | 127 | }; |
128 | #define I915_FENCE_REG_NONE -1 | 128 | #define I915_FENCE_REG_NONE -1 |
129 | #define I915_MAX_NUM_FENCES 16 | ||
130 | /* 16 fences + sign bit for FENCE_REG_NONE */ | ||
131 | #define I915_MAX_NUM_FENCE_BITS 5 | ||
129 | 132 | ||
130 | struct drm_i915_fence_reg { | 133 | struct drm_i915_fence_reg { |
131 | struct list_head lru_list; | 134 | struct list_head lru_list; |
@@ -168,7 +171,7 @@ struct drm_i915_error_state { | |||
168 | u32 instdone1; | 171 | u32 instdone1; |
169 | u32 seqno; | 172 | u32 seqno; |
170 | u64 bbaddr; | 173 | u64 bbaddr; |
171 | u64 fence[16]; | 174 | u64 fence[I915_MAX_NUM_FENCES]; |
172 | struct timeval time; | 175 | struct timeval time; |
173 | struct drm_i915_error_object { | 176 | struct drm_i915_error_object { |
174 | int page_count; | 177 | int page_count; |
@@ -182,7 +185,7 @@ struct drm_i915_error_state { | |||
182 | u32 gtt_offset; | 185 | u32 gtt_offset; |
183 | u32 read_domains; | 186 | u32 read_domains; |
184 | u32 write_domain; | 187 | u32 write_domain; |
185 | s32 fence_reg:5; | 188 | s32 fence_reg:I915_MAX_NUM_FENCE_BITS; |
186 | s32 pinned:2; | 189 | s32 pinned:2; |
187 | u32 tiling:2; | 190 | u32 tiling:2; |
188 | u32 dirty:1; | 191 | u32 dirty:1; |
@@ -375,7 +378,7 @@ typedef struct drm_i915_private { | |||
375 | struct notifier_block lid_notifier; | 378 | struct notifier_block lid_notifier; |
376 | 379 | ||
377 | int crt_ddc_pin; | 380 | int crt_ddc_pin; |
378 | struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */ | 381 | struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */ |
379 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ | 382 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ |
380 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ | 383 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ |
381 | 384 | ||
@@ -506,7 +509,7 @@ typedef struct drm_i915_private { | |||
506 | u8 saveAR[21]; | 509 | u8 saveAR[21]; |
507 | u8 saveDACMASK; | 510 | u8 saveDACMASK; |
508 | u8 saveCR[37]; | 511 | u8 saveCR[37]; |
509 | uint64_t saveFENCE[16]; | 512 | uint64_t saveFENCE[I915_MAX_NUM_FENCES]; |
510 | u32 saveCURACNTR; | 513 | u32 saveCURACNTR; |
511 | u32 saveCURAPOS; | 514 | u32 saveCURAPOS; |
512 | u32 saveCURABASE; | 515 | u32 saveCURABASE; |
@@ -777,10 +780,8 @@ struct drm_i915_gem_object { | |||
777 | * Fence register bits (if any) for this object. Will be set | 780 | * Fence register bits (if any) for this object. Will be set |
778 | * as needed when mapped into the GTT. | 781 | * as needed when mapped into the GTT. |
779 | * Protected by dev->struct_mutex. | 782 | * Protected by dev->struct_mutex. |
780 | * | ||
781 | * Size: 4 bits for 16 fences + sign (for FENCE_REG_NONE) | ||
782 | */ | 783 | */ |
783 | signed int fence_reg:5; | 784 | signed int fence_reg:I915_MAX_NUM_FENCE_BITS; |
784 | 785 | ||
785 | /** | 786 | /** |
786 | * Advice: are the backing pages purgeable? | 787 | * Advice: are the backing pages purgeable? |
@@ -999,10 +1000,10 @@ extern int i915_panel_ignore_lid __read_mostly; | |||
999 | extern unsigned int i915_powersave __read_mostly; | 1000 | extern unsigned int i915_powersave __read_mostly; |
1000 | extern unsigned int i915_semaphores __read_mostly; | 1001 | extern unsigned int i915_semaphores __read_mostly; |
1001 | extern unsigned int i915_lvds_downclock __read_mostly; | 1002 | extern unsigned int i915_lvds_downclock __read_mostly; |
1002 | extern unsigned int i915_panel_use_ssc __read_mostly; | 1003 | extern int i915_panel_use_ssc __read_mostly; |
1003 | extern int i915_vbt_sdvo_panel_type __read_mostly; | 1004 | extern int i915_vbt_sdvo_panel_type __read_mostly; |
1004 | extern unsigned int i915_enable_rc6 __read_mostly; | 1005 | extern unsigned int i915_enable_rc6 __read_mostly; |
1005 | extern unsigned int i915_enable_fbc __read_mostly; | 1006 | extern int i915_enable_fbc __read_mostly; |
1006 | extern bool i915_enable_hangcheck __read_mostly; | 1007 | extern bool i915_enable_hangcheck __read_mostly; |
1007 | 1008 | ||
1008 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); | 1009 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index d18b07adcffa..8359dc777041 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1745,7 +1745,7 @@ static void i915_gem_reset_fences(struct drm_device *dev) | |||
1745 | struct drm_i915_private *dev_priv = dev->dev_private; | 1745 | struct drm_i915_private *dev_priv = dev->dev_private; |
1746 | int i; | 1746 | int i; |
1747 | 1747 | ||
1748 | for (i = 0; i < 16; i++) { | 1748 | for (i = 0; i < dev_priv->num_fence_regs; i++) { |
1749 | struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; | 1749 | struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; |
1750 | struct drm_i915_gem_object *obj = reg->obj; | 1750 | struct drm_i915_gem_object *obj = reg->obj; |
1751 | 1751 | ||
@@ -3512,9 +3512,11 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
3512 | * so emit a request to do so. | 3512 | * so emit a request to do so. |
3513 | */ | 3513 | */ |
3514 | request = kzalloc(sizeof(*request), GFP_KERNEL); | 3514 | request = kzalloc(sizeof(*request), GFP_KERNEL); |
3515 | if (request) | 3515 | if (request) { |
3516 | ret = i915_add_request(obj->ring, NULL, request); | 3516 | ret = i915_add_request(obj->ring, NULL, request); |
3517 | else | 3517 | if (ret) |
3518 | kfree(request); | ||
3519 | } else | ||
3518 | ret = -ENOMEM; | 3520 | ret = -ENOMEM; |
3519 | } | 3521 | } |
3520 | 3522 | ||
@@ -3613,7 +3615,7 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev, | |||
3613 | obj->base.write_domain = I915_GEM_DOMAIN_CPU; | 3615 | obj->base.write_domain = I915_GEM_DOMAIN_CPU; |
3614 | obj->base.read_domains = I915_GEM_DOMAIN_CPU; | 3616 | obj->base.read_domains = I915_GEM_DOMAIN_CPU; |
3615 | 3617 | ||
3616 | if (IS_GEN6(dev)) { | 3618 | if (IS_GEN6(dev) || IS_GEN7(dev)) { |
3617 | /* On Gen6, we can have the GPU use the LLC (the CPU | 3619 | /* On Gen6, we can have the GPU use the LLC (the CPU |
3618 | * cache) for about a 10% performance improvement | 3620 | * cache) for about a 10% performance improvement |
3619 | * compared to uncached. Graphics requests other than | 3621 | * compared to uncached. Graphics requests other than |
@@ -3877,7 +3879,7 @@ i915_gem_load(struct drm_device *dev) | |||
3877 | INIT_LIST_HEAD(&dev_priv->mm.gtt_list); | 3879 | INIT_LIST_HEAD(&dev_priv->mm.gtt_list); |
3878 | for (i = 0; i < I915_NUM_RINGS; i++) | 3880 | for (i = 0; i < I915_NUM_RINGS; i++) |
3879 | init_ring_lists(&dev_priv->ring[i]); | 3881 | init_ring_lists(&dev_priv->ring[i]); |
3880 | for (i = 0; i < 16; i++) | 3882 | for (i = 0; i < I915_MAX_NUM_FENCES; i++) |
3881 | INIT_LIST_HEAD(&dev_priv->fence_regs[i].lru_list); | 3883 | INIT_LIST_HEAD(&dev_priv->fence_regs[i].lru_list); |
3882 | INIT_DELAYED_WORK(&dev_priv->mm.retire_work, | 3884 | INIT_DELAYED_WORK(&dev_priv->mm.retire_work, |
3883 | i915_gem_retire_work_handler); | 3885 | i915_gem_retire_work_handler); |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 9ee2729fe5c6..b40004b55977 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -824,6 +824,7 @@ static void i915_gem_record_fences(struct drm_device *dev, | |||
824 | 824 | ||
825 | /* Fences */ | 825 | /* Fences */ |
826 | switch (INTEL_INFO(dev)->gen) { | 826 | switch (INTEL_INFO(dev)->gen) { |
827 | case 7: | ||
827 | case 6: | 828 | case 6: |
828 | for (i = 0; i < 16; i++) | 829 | for (i = 0; i < 16; i++) |
829 | error->fence[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8)); | 830 | error->fence[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8)); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 5a09416e611f..b080cc824001 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -1553,12 +1553,21 @@ | |||
1553 | */ | 1553 | */ |
1554 | #define PP_READY (1 << 30) | 1554 | #define PP_READY (1 << 30) |
1555 | #define PP_SEQUENCE_NONE (0 << 28) | 1555 | #define PP_SEQUENCE_NONE (0 << 28) |
1556 | #define PP_SEQUENCE_ON (1 << 28) | 1556 | #define PP_SEQUENCE_POWER_UP (1 << 28) |
1557 | #define PP_SEQUENCE_OFF (2 << 28) | 1557 | #define PP_SEQUENCE_POWER_DOWN (2 << 28) |
1558 | #define PP_SEQUENCE_MASK 0x30000000 | 1558 | #define PP_SEQUENCE_MASK (3 << 28) |
1559 | #define PP_SEQUENCE_SHIFT 28 | ||
1559 | #define PP_CYCLE_DELAY_ACTIVE (1 << 27) | 1560 | #define PP_CYCLE_DELAY_ACTIVE (1 << 27) |
1560 | #define PP_SEQUENCE_STATE_ON_IDLE (1 << 3) | ||
1561 | #define PP_SEQUENCE_STATE_MASK 0x0000000f | 1561 | #define PP_SEQUENCE_STATE_MASK 0x0000000f |
1562 | #define PP_SEQUENCE_STATE_OFF_IDLE (0x0 << 0) | ||
1563 | #define PP_SEQUENCE_STATE_OFF_S0_1 (0x1 << 0) | ||
1564 | #define PP_SEQUENCE_STATE_OFF_S0_2 (0x2 << 0) | ||
1565 | #define PP_SEQUENCE_STATE_OFF_S0_3 (0x3 << 0) | ||
1566 | #define PP_SEQUENCE_STATE_ON_IDLE (0x8 << 0) | ||
1567 | #define PP_SEQUENCE_STATE_ON_S1_0 (0x9 << 0) | ||
1568 | #define PP_SEQUENCE_STATE_ON_S1_2 (0xa << 0) | ||
1569 | #define PP_SEQUENCE_STATE_ON_S1_3 (0xb << 0) | ||
1570 | #define PP_SEQUENCE_STATE_RESET (0xf << 0) | ||
1562 | #define PP_CONTROL 0x61204 | 1571 | #define PP_CONTROL 0x61204 |
1563 | #define POWER_TARGET_ON (1 << 0) | 1572 | #define POWER_TARGET_ON (1 << 0) |
1564 | #define PP_ON_DELAYS 0x61208 | 1573 | #define PP_ON_DELAYS 0x61208 |
@@ -3444,6 +3453,10 @@ | |||
3444 | #define GT_FIFO_FREE_ENTRIES 0x120008 | 3453 | #define GT_FIFO_FREE_ENTRIES 0x120008 |
3445 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 | 3454 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 |
3446 | 3455 | ||
3456 | #define GEN6_UCGCTL2 0x9404 | ||
3457 | # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12) | ||
3458 | # define GEN6_RCCUNIT_CLOCK_GATE_DISABLE (1 << 11) | ||
3459 | |||
3447 | #define GEN6_RPNSWREQ 0xA008 | 3460 | #define GEN6_RPNSWREQ 0xA008 |
3448 | #define GEN6_TURBO_DISABLE (1<<31) | 3461 | #define GEN6_TURBO_DISABLE (1<<31) |
3449 | #define GEN6_FREQUENCY(x) ((x)<<25) | 3462 | #define GEN6_FREQUENCY(x) ((x)<<25) |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index f8f602d76650..7886e4fb60e3 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -370,6 +370,7 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
370 | 370 | ||
371 | /* Fences */ | 371 | /* Fences */ |
372 | switch (INTEL_INFO(dev)->gen) { | 372 | switch (INTEL_INFO(dev)->gen) { |
373 | case 7: | ||
373 | case 6: | 374 | case 6: |
374 | for (i = 0; i < 16; i++) | 375 | for (i = 0; i < 16; i++) |
375 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8)); | 376 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8)); |
@@ -404,6 +405,7 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
404 | 405 | ||
405 | /* Fences */ | 406 | /* Fences */ |
406 | switch (INTEL_INFO(dev)->gen) { | 407 | switch (INTEL_INFO(dev)->gen) { |
408 | case 7: | ||
407 | case 6: | 409 | case 6: |
408 | for (i = 0; i < 16; i++) | 410 | for (i = 0; i < 16; i++) |
409 | I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + (i * 8), dev_priv->saveFENCE[i]); | 411 | I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + (i * 8), dev_priv->saveFENCE[i]); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 981b1f1c04d8..e77a863a3833 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2933,7 +2933,8 @@ static void ironlake_pch_enable(struct drm_crtc *crtc) | |||
2933 | 2933 | ||
2934 | /* For PCH DP, enable TRANS_DP_CTL */ | 2934 | /* For PCH DP, enable TRANS_DP_CTL */ |
2935 | if (HAS_PCH_CPT(dev) && | 2935 | if (HAS_PCH_CPT(dev) && |
2936 | intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) { | 2936 | (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) || |
2937 | intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) { | ||
2937 | u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) >> 5; | 2938 | u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) >> 5; |
2938 | reg = TRANS_DP_CTL(pipe); | 2939 | reg = TRANS_DP_CTL(pipe); |
2939 | temp = I915_READ(reg); | 2940 | temp = I915_READ(reg); |
@@ -4711,7 +4712,7 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, | |||
4711 | lvds_bpc = 6; | 4712 | lvds_bpc = 6; |
4712 | 4713 | ||
4713 | if (lvds_bpc < display_bpc) { | 4714 | if (lvds_bpc < display_bpc) { |
4714 | DRM_DEBUG_DRIVER("clamping display bpc (was %d) to LVDS (%d)\n", display_bpc, lvds_bpc); | 4715 | DRM_DEBUG_KMS("clamping display bpc (was %d) to LVDS (%d)\n", display_bpc, lvds_bpc); |
4715 | display_bpc = lvds_bpc; | 4716 | display_bpc = lvds_bpc; |
4716 | } | 4717 | } |
4717 | continue; | 4718 | continue; |
@@ -4722,7 +4723,7 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, | |||
4722 | unsigned int edp_bpc = dev_priv->edp.bpp / 3; | 4723 | unsigned int edp_bpc = dev_priv->edp.bpp / 3; |
4723 | 4724 | ||
4724 | if (edp_bpc < display_bpc) { | 4725 | if (edp_bpc < display_bpc) { |
4725 | DRM_DEBUG_DRIVER("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc); | 4726 | DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc); |
4726 | display_bpc = edp_bpc; | 4727 | display_bpc = edp_bpc; |
4727 | } | 4728 | } |
4728 | continue; | 4729 | continue; |
@@ -4737,7 +4738,7 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, | |||
4737 | /* Don't use an invalid EDID bpc value */ | 4738 | /* Don't use an invalid EDID bpc value */ |
4738 | if (connector->display_info.bpc && | 4739 | if (connector->display_info.bpc && |
4739 | connector->display_info.bpc < display_bpc) { | 4740 | connector->display_info.bpc < display_bpc) { |
4740 | DRM_DEBUG_DRIVER("clamping display bpc (was %d) to EDID reported max of %d\n", display_bpc, connector->display_info.bpc); | 4741 | DRM_DEBUG_KMS("clamping display bpc (was %d) to EDID reported max of %d\n", display_bpc, connector->display_info.bpc); |
4741 | display_bpc = connector->display_info.bpc; | 4742 | display_bpc = connector->display_info.bpc; |
4742 | } | 4743 | } |
4743 | } | 4744 | } |
@@ -4748,10 +4749,10 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, | |||
4748 | */ | 4749 | */ |
4749 | if (intel_encoder->type == INTEL_OUTPUT_HDMI) { | 4750 | if (intel_encoder->type == INTEL_OUTPUT_HDMI) { |
4750 | if (display_bpc > 8 && display_bpc < 12) { | 4751 | if (display_bpc > 8 && display_bpc < 12) { |
4751 | DRM_DEBUG_DRIVER("forcing bpc to 12 for HDMI\n"); | 4752 | DRM_DEBUG_KMS("forcing bpc to 12 for HDMI\n"); |
4752 | display_bpc = 12; | 4753 | display_bpc = 12; |
4753 | } else { | 4754 | } else { |
4754 | DRM_DEBUG_DRIVER("forcing bpc to 8 for HDMI\n"); | 4755 | DRM_DEBUG_KMS("forcing bpc to 8 for HDMI\n"); |
4755 | display_bpc = 8; | 4756 | display_bpc = 8; |
4756 | } | 4757 | } |
4757 | } | 4758 | } |
@@ -4789,8 +4790,8 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, | |||
4789 | 4790 | ||
4790 | display_bpc = min(display_bpc, bpc); | 4791 | display_bpc = min(display_bpc, bpc); |
4791 | 4792 | ||
4792 | DRM_DEBUG_DRIVER("setting pipe bpc to %d (max display bpc %d)\n", | 4793 | DRM_DEBUG_KMS("setting pipe bpc to %d (max display bpc %d)\n", |
4793 | bpc, display_bpc); | 4794 | bpc, display_bpc); |
4794 | 4795 | ||
4795 | *pipe_bpp = display_bpc * 3; | 4796 | *pipe_bpp = display_bpc * 3; |
4796 | 4797 | ||
@@ -5671,7 +5672,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5671 | pipeconf &= ~PIPECONF_DITHER_TYPE_MASK; | 5672 | pipeconf &= ~PIPECONF_DITHER_TYPE_MASK; |
5672 | if ((is_lvds && dev_priv->lvds_dither) || dither) { | 5673 | if ((is_lvds && dev_priv->lvds_dither) || dither) { |
5673 | pipeconf |= PIPECONF_DITHER_EN; | 5674 | pipeconf |= PIPECONF_DITHER_EN; |
5674 | pipeconf |= PIPECONF_DITHER_TYPE_ST1; | 5675 | pipeconf |= PIPECONF_DITHER_TYPE_SP; |
5675 | } | 5676 | } |
5676 | if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { | 5677 | if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
5677 | intel_dp_set_m_n(crtc, mode, adjusted_mode); | 5678 | intel_dp_set_m_n(crtc, mode, adjusted_mode); |
@@ -8148,6 +8149,20 @@ static void gen6_init_clock_gating(struct drm_device *dev) | |||
8148 | I915_WRITE(WM2_LP_ILK, 0); | 8149 | I915_WRITE(WM2_LP_ILK, 0); |
8149 | I915_WRITE(WM1_LP_ILK, 0); | 8150 | I915_WRITE(WM1_LP_ILK, 0); |
8150 | 8151 | ||
8152 | /* According to the BSpec vol1g, bit 12 (RCPBUNIT) clock | ||
8153 | * gating disable must be set. Failure to set it results in | ||
8154 | * flickering pixels due to Z write ordering failures after | ||
8155 | * some amount of runtime in the Mesa "fire" demo, and Unigine | ||
8156 | * Sanctuary and Tropics, and apparently anything else with | ||
8157 | * alpha test or pixel discard. | ||
8158 | * | ||
8159 | * According to the spec, bit 11 (RCCUNIT) must also be set, | ||
8160 | * but we didn't debug actual testcases to find it out. | ||
8161 | */ | ||
8162 | I915_WRITE(GEN6_UCGCTL2, | ||
8163 | GEN6_RCPBUNIT_CLOCK_GATE_DISABLE | | ||
8164 | GEN6_RCCUNIT_CLOCK_GATE_DISABLE); | ||
8165 | |||
8151 | /* | 8166 | /* |
8152 | * According to the spec the following bits should be | 8167 | * According to the spec the following bits should be |
8153 | * set in order to enable memory self-refresh and fbc: | 8168 | * set in order to enable memory self-refresh and fbc: |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 09b318b0227f..4d0358fad937 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -59,7 +59,6 @@ struct intel_dp { | |||
59 | struct i2c_algo_dp_aux_data algo; | 59 | struct i2c_algo_dp_aux_data algo; |
60 | bool is_pch_edp; | 60 | bool is_pch_edp; |
61 | uint8_t train_set[4]; | 61 | uint8_t train_set[4]; |
62 | uint8_t link_status[DP_LINK_STATUS_SIZE]; | ||
63 | int panel_power_up_delay; | 62 | int panel_power_up_delay; |
64 | int panel_power_down_delay; | 63 | int panel_power_down_delay; |
65 | int panel_power_cycle_delay; | 64 | int panel_power_cycle_delay; |
@@ -68,7 +67,6 @@ struct intel_dp { | |||
68 | struct drm_display_mode *panel_fixed_mode; /* for eDP */ | 67 | struct drm_display_mode *panel_fixed_mode; /* for eDP */ |
69 | struct delayed_work panel_vdd_work; | 68 | struct delayed_work panel_vdd_work; |
70 | bool want_panel_vdd; | 69 | bool want_panel_vdd; |
71 | unsigned long panel_off_jiffies; | ||
72 | }; | 70 | }; |
73 | 71 | ||
74 | /** | 72 | /** |
@@ -157,16 +155,12 @@ intel_edp_link_config(struct intel_encoder *intel_encoder, | |||
157 | static int | 155 | static int |
158 | intel_dp_max_lane_count(struct intel_dp *intel_dp) | 156 | intel_dp_max_lane_count(struct intel_dp *intel_dp) |
159 | { | 157 | { |
160 | int max_lane_count = 4; | 158 | int max_lane_count = intel_dp->dpcd[DP_MAX_LANE_COUNT] & 0x1f; |
161 | 159 | switch (max_lane_count) { | |
162 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) { | 160 | case 1: case 2: case 4: |
163 | max_lane_count = intel_dp->dpcd[DP_MAX_LANE_COUNT] & 0x1f; | 161 | break; |
164 | switch (max_lane_count) { | 162 | default: |
165 | case 1: case 2: case 4: | 163 | max_lane_count = 4; |
166 | break; | ||
167 | default: | ||
168 | max_lane_count = 4; | ||
169 | } | ||
170 | } | 164 | } |
171 | return max_lane_count; | 165 | return max_lane_count; |
172 | } | 166 | } |
@@ -768,12 +762,11 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
768 | continue; | 762 | continue; |
769 | 763 | ||
770 | intel_dp = enc_to_intel_dp(encoder); | 764 | intel_dp = enc_to_intel_dp(encoder); |
771 | if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT) { | 765 | if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || |
766 | intel_dp->base.type == INTEL_OUTPUT_EDP) | ||
767 | { | ||
772 | lane_count = intel_dp->lane_count; | 768 | lane_count = intel_dp->lane_count; |
773 | break; | 769 | break; |
774 | } else if (is_edp(intel_dp)) { | ||
775 | lane_count = dev_priv->edp.lanes; | ||
776 | break; | ||
777 | } | 770 | } |
778 | } | 771 | } |
779 | 772 | ||
@@ -810,6 +803,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
810 | struct drm_display_mode *adjusted_mode) | 803 | struct drm_display_mode *adjusted_mode) |
811 | { | 804 | { |
812 | struct drm_device *dev = encoder->dev; | 805 | struct drm_device *dev = encoder->dev; |
806 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
813 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 807 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
814 | struct drm_crtc *crtc = intel_dp->base.base.crtc; | 808 | struct drm_crtc *crtc = intel_dp->base.base.crtc; |
815 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 809 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
@@ -822,18 +816,31 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
822 | ironlake_edp_pll_off(encoder); | 816 | ironlake_edp_pll_off(encoder); |
823 | } | 817 | } |
824 | 818 | ||
825 | intel_dp->DP = DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; | 819 | /* |
826 | intel_dp->DP |= intel_dp->color_range; | 820 | * There are three kinds of DP registers: |
821 | * | ||
822 | * IBX PCH | ||
823 | * CPU | ||
824 | * CPT PCH | ||
825 | * | ||
826 | * IBX PCH and CPU are the same for almost everything, | ||
827 | * except that the CPU DP PLL is configured in this | ||
828 | * register | ||
829 | * | ||
830 | * CPT PCH is quite different, having many bits moved | ||
831 | * to the TRANS_DP_CTL register instead. That | ||
832 | * configuration happens (oddly) in ironlake_pch_enable | ||
833 | */ | ||
827 | 834 | ||
828 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 835 | /* Preserve the BIOS-computed detected bit. This is |
829 | intel_dp->DP |= DP_SYNC_HS_HIGH; | 836 | * supposed to be read-only. |
830 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | 837 | */ |
831 | intel_dp->DP |= DP_SYNC_VS_HIGH; | 838 | intel_dp->DP = I915_READ(intel_dp->output_reg) & DP_DETECTED; |
839 | intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; | ||
832 | 840 | ||
833 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 841 | /* Handle DP bits in common between all three register formats */ |
834 | intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT; | 842 | |
835 | else | 843 | intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; |
836 | intel_dp->DP |= DP_LINK_TRAIN_OFF; | ||
837 | 844 | ||
838 | switch (intel_dp->lane_count) { | 845 | switch (intel_dp->lane_count) { |
839 | case 1: | 846 | case 1: |
@@ -852,59 +859,106 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
852 | intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; | 859 | intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; |
853 | intel_write_eld(encoder, adjusted_mode); | 860 | intel_write_eld(encoder, adjusted_mode); |
854 | } | 861 | } |
855 | |||
856 | memset(intel_dp->link_configuration, 0, DP_LINK_CONFIGURATION_SIZE); | 862 | memset(intel_dp->link_configuration, 0, DP_LINK_CONFIGURATION_SIZE); |
857 | intel_dp->link_configuration[0] = intel_dp->link_bw; | 863 | intel_dp->link_configuration[0] = intel_dp->link_bw; |
858 | intel_dp->link_configuration[1] = intel_dp->lane_count; | 864 | intel_dp->link_configuration[1] = intel_dp->lane_count; |
859 | intel_dp->link_configuration[8] = DP_SET_ANSI_8B10B; | 865 | intel_dp->link_configuration[8] = DP_SET_ANSI_8B10B; |
860 | |||
861 | /* | 866 | /* |
862 | * Check for DPCD version > 1.1 and enhanced framing support | 867 | * Check for DPCD version > 1.1 and enhanced framing support |
863 | */ | 868 | */ |
864 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 && | 869 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 && |
865 | (intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP)) { | 870 | (intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP)) { |
866 | intel_dp->link_configuration[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; | 871 | intel_dp->link_configuration[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; |
867 | intel_dp->DP |= DP_ENHANCED_FRAMING; | ||
868 | } | 872 | } |
869 | 873 | ||
870 | /* CPT DP's pipe select is decided in TRANS_DP_CTL */ | 874 | /* Split out the IBX/CPU vs CPT settings */ |
871 | if (intel_crtc->pipe == 1 && !HAS_PCH_CPT(dev)) | ||
872 | intel_dp->DP |= DP_PIPEB_SELECT; | ||
873 | 875 | ||
874 | if (is_cpu_edp(intel_dp)) { | 876 | if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) { |
875 | /* don't miss out required setting for eDP */ | 877 | intel_dp->DP |= intel_dp->color_range; |
876 | intel_dp->DP |= DP_PLL_ENABLE; | 878 | |
877 | if (adjusted_mode->clock < 200000) | 879 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
878 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | 880 | intel_dp->DP |= DP_SYNC_HS_HIGH; |
879 | else | 881 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
880 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; | 882 | intel_dp->DP |= DP_SYNC_VS_HIGH; |
883 | intel_dp->DP |= DP_LINK_TRAIN_OFF; | ||
884 | |||
885 | if (intel_dp->link_configuration[1] & DP_LANE_COUNT_ENHANCED_FRAME_EN) | ||
886 | intel_dp->DP |= DP_ENHANCED_FRAMING; | ||
887 | |||
888 | if (intel_crtc->pipe == 1) | ||
889 | intel_dp->DP |= DP_PIPEB_SELECT; | ||
890 | |||
891 | if (is_cpu_edp(intel_dp)) { | ||
892 | /* don't miss out required setting for eDP */ | ||
893 | intel_dp->DP |= DP_PLL_ENABLE; | ||
894 | if (adjusted_mode->clock < 200000) | ||
895 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | ||
896 | else | ||
897 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; | ||
898 | } | ||
899 | } else { | ||
900 | intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT; | ||
881 | } | 901 | } |
882 | } | 902 | } |
883 | 903 | ||
884 | static void ironlake_wait_panel_off(struct intel_dp *intel_dp) | 904 | #define IDLE_ON_MASK (PP_ON | 0 | PP_SEQUENCE_MASK | 0 | PP_SEQUENCE_STATE_MASK) |
905 | #define IDLE_ON_VALUE (PP_ON | 0 | PP_SEQUENCE_NONE | 0 | PP_SEQUENCE_STATE_ON_IDLE) | ||
906 | |||
907 | #define IDLE_OFF_MASK (PP_ON | 0 | PP_SEQUENCE_MASK | 0 | PP_SEQUENCE_STATE_MASK) | ||
908 | #define IDLE_OFF_VALUE (0 | 0 | PP_SEQUENCE_NONE | 0 | PP_SEQUENCE_STATE_OFF_IDLE) | ||
909 | |||
910 | #define IDLE_CYCLE_MASK (PP_ON | 0 | PP_SEQUENCE_MASK | PP_CYCLE_DELAY_ACTIVE | PP_SEQUENCE_STATE_MASK) | ||
911 | #define IDLE_CYCLE_VALUE (0 | 0 | PP_SEQUENCE_NONE | 0 | PP_SEQUENCE_STATE_OFF_IDLE) | ||
912 | |||
913 | static void ironlake_wait_panel_status(struct intel_dp *intel_dp, | ||
914 | u32 mask, | ||
915 | u32 value) | ||
885 | { | 916 | { |
886 | unsigned long off_time; | 917 | struct drm_device *dev = intel_dp->base.base.dev; |
887 | unsigned long delay; | 918 | struct drm_i915_private *dev_priv = dev->dev_private; |
888 | 919 | ||
889 | DRM_DEBUG_KMS("Wait for panel power off time\n"); | 920 | DRM_DEBUG_KMS("mask %08x value %08x status %08x control %08x\n", |
921 | mask, value, | ||
922 | I915_READ(PCH_PP_STATUS), | ||
923 | I915_READ(PCH_PP_CONTROL)); | ||
890 | 924 | ||
891 | if (ironlake_edp_have_panel_power(intel_dp) || | 925 | if (_wait_for((I915_READ(PCH_PP_STATUS) & mask) == value, 5000, 10)) { |
892 | ironlake_edp_have_panel_vdd(intel_dp)) | 926 | DRM_ERROR("Panel status timeout: status %08x control %08x\n", |
893 | { | 927 | I915_READ(PCH_PP_STATUS), |
894 | DRM_DEBUG_KMS("Panel still on, no delay needed\n"); | 928 | I915_READ(PCH_PP_CONTROL)); |
895 | return; | ||
896 | } | 929 | } |
930 | } | ||
897 | 931 | ||
898 | off_time = intel_dp->panel_off_jiffies + msecs_to_jiffies(intel_dp->panel_power_down_delay); | 932 | static void ironlake_wait_panel_on(struct intel_dp *intel_dp) |
899 | if (time_after(jiffies, off_time)) { | 933 | { |
900 | DRM_DEBUG_KMS("Time already passed"); | 934 | DRM_DEBUG_KMS("Wait for panel power on\n"); |
901 | return; | 935 | ironlake_wait_panel_status(intel_dp, IDLE_ON_MASK, IDLE_ON_VALUE); |
902 | } | 936 | } |
903 | delay = jiffies_to_msecs(off_time - jiffies); | 937 | |
904 | if (delay > intel_dp->panel_power_down_delay) | 938 | static void ironlake_wait_panel_off(struct intel_dp *intel_dp) |
905 | delay = intel_dp->panel_power_down_delay; | 939 | { |
906 | DRM_DEBUG_KMS("Waiting an additional %ld ms\n", delay); | 940 | DRM_DEBUG_KMS("Wait for panel power off time\n"); |
907 | msleep(delay); | 941 | ironlake_wait_panel_status(intel_dp, IDLE_OFF_MASK, IDLE_OFF_VALUE); |
942 | } | ||
943 | |||
944 | static void ironlake_wait_panel_power_cycle(struct intel_dp *intel_dp) | ||
945 | { | ||
946 | DRM_DEBUG_KMS("Wait for panel power cycle\n"); | ||
947 | ironlake_wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE); | ||
948 | } | ||
949 | |||
950 | |||
951 | /* Read the current pp_control value, unlocking the register if it | ||
952 | * is locked | ||
953 | */ | ||
954 | |||
955 | static u32 ironlake_get_pp_control(struct drm_i915_private *dev_priv) | ||
956 | { | ||
957 | u32 control = I915_READ(PCH_PP_CONTROL); | ||
958 | |||
959 | control &= ~PANEL_UNLOCK_MASK; | ||
960 | control |= PANEL_UNLOCK_REGS; | ||
961 | return control; | ||
908 | } | 962 | } |
909 | 963 | ||
910 | static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp) | 964 | static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp) |
@@ -921,15 +975,16 @@ static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp) | |||
921 | "eDP VDD already requested on\n"); | 975 | "eDP VDD already requested on\n"); |
922 | 976 | ||
923 | intel_dp->want_panel_vdd = true; | 977 | intel_dp->want_panel_vdd = true; |
978 | |||
924 | if (ironlake_edp_have_panel_vdd(intel_dp)) { | 979 | if (ironlake_edp_have_panel_vdd(intel_dp)) { |
925 | DRM_DEBUG_KMS("eDP VDD already on\n"); | 980 | DRM_DEBUG_KMS("eDP VDD already on\n"); |
926 | return; | 981 | return; |
927 | } | 982 | } |
928 | 983 | ||
929 | ironlake_wait_panel_off(intel_dp); | 984 | if (!ironlake_edp_have_panel_power(intel_dp)) |
930 | pp = I915_READ(PCH_PP_CONTROL); | 985 | ironlake_wait_panel_power_cycle(intel_dp); |
931 | pp &= ~PANEL_UNLOCK_MASK; | 986 | |
932 | pp |= PANEL_UNLOCK_REGS; | 987 | pp = ironlake_get_pp_control(dev_priv); |
933 | pp |= EDP_FORCE_VDD; | 988 | pp |= EDP_FORCE_VDD; |
934 | I915_WRITE(PCH_PP_CONTROL, pp); | 989 | I915_WRITE(PCH_PP_CONTROL, pp); |
935 | POSTING_READ(PCH_PP_CONTROL); | 990 | POSTING_READ(PCH_PP_CONTROL); |
@@ -952,9 +1007,7 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp) | |||
952 | u32 pp; | 1007 | u32 pp; |
953 | 1008 | ||
954 | if (!intel_dp->want_panel_vdd && ironlake_edp_have_panel_vdd(intel_dp)) { | 1009 | if (!intel_dp->want_panel_vdd && ironlake_edp_have_panel_vdd(intel_dp)) { |
955 | pp = I915_READ(PCH_PP_CONTROL); | 1010 | pp = ironlake_get_pp_control(dev_priv); |
956 | pp &= ~PANEL_UNLOCK_MASK; | ||
957 | pp |= PANEL_UNLOCK_REGS; | ||
958 | pp &= ~EDP_FORCE_VDD; | 1011 | pp &= ~EDP_FORCE_VDD; |
959 | I915_WRITE(PCH_PP_CONTROL, pp); | 1012 | I915_WRITE(PCH_PP_CONTROL, pp); |
960 | POSTING_READ(PCH_PP_CONTROL); | 1013 | POSTING_READ(PCH_PP_CONTROL); |
@@ -962,7 +1015,8 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp) | |||
962 | /* Make sure sequencer is idle before allowing subsequent activity */ | 1015 | /* Make sure sequencer is idle before allowing subsequent activity */ |
963 | DRM_DEBUG_KMS("PCH_PP_STATUS: 0x%08x PCH_PP_CONTROL: 0x%08x\n", | 1016 | DRM_DEBUG_KMS("PCH_PP_STATUS: 0x%08x PCH_PP_CONTROL: 0x%08x\n", |
964 | I915_READ(PCH_PP_STATUS), I915_READ(PCH_PP_CONTROL)); | 1017 | I915_READ(PCH_PP_STATUS), I915_READ(PCH_PP_CONTROL)); |
965 | intel_dp->panel_off_jiffies = jiffies; | 1018 | |
1019 | msleep(intel_dp->panel_power_down_delay); | ||
966 | } | 1020 | } |
967 | } | 1021 | } |
968 | 1022 | ||
@@ -972,9 +1026,9 @@ static void ironlake_panel_vdd_work(struct work_struct *__work) | |||
972 | struct intel_dp, panel_vdd_work); | 1026 | struct intel_dp, panel_vdd_work); |
973 | struct drm_device *dev = intel_dp->base.base.dev; | 1027 | struct drm_device *dev = intel_dp->base.base.dev; |
974 | 1028 | ||
975 | mutex_lock(&dev->struct_mutex); | 1029 | mutex_lock(&dev->mode_config.mutex); |
976 | ironlake_panel_vdd_off_sync(intel_dp); | 1030 | ironlake_panel_vdd_off_sync(intel_dp); |
977 | mutex_unlock(&dev->struct_mutex); | 1031 | mutex_unlock(&dev->mode_config.mutex); |
978 | } | 1032 | } |
979 | 1033 | ||
980 | static void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) | 1034 | static void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) |
@@ -984,7 +1038,7 @@ static void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) | |||
984 | 1038 | ||
985 | DRM_DEBUG_KMS("Turn eDP VDD off %d\n", intel_dp->want_panel_vdd); | 1039 | DRM_DEBUG_KMS("Turn eDP VDD off %d\n", intel_dp->want_panel_vdd); |
986 | WARN(!intel_dp->want_panel_vdd, "eDP VDD not forced on"); | 1040 | WARN(!intel_dp->want_panel_vdd, "eDP VDD not forced on"); |
987 | 1041 | ||
988 | intel_dp->want_panel_vdd = false; | 1042 | intel_dp->want_panel_vdd = false; |
989 | 1043 | ||
990 | if (sync) { | 1044 | if (sync) { |
@@ -1000,23 +1054,25 @@ static void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) | |||
1000 | } | 1054 | } |
1001 | } | 1055 | } |
1002 | 1056 | ||
1003 | /* Returns true if the panel was already on when called */ | ||
1004 | static void ironlake_edp_panel_on(struct intel_dp *intel_dp) | 1057 | static void ironlake_edp_panel_on(struct intel_dp *intel_dp) |
1005 | { | 1058 | { |
1006 | struct drm_device *dev = intel_dp->base.base.dev; | 1059 | struct drm_device *dev = intel_dp->base.base.dev; |
1007 | struct drm_i915_private *dev_priv = dev->dev_private; | 1060 | struct drm_i915_private *dev_priv = dev->dev_private; |
1008 | u32 pp, idle_on_mask = PP_ON | PP_SEQUENCE_STATE_ON_IDLE; | 1061 | u32 pp; |
1009 | 1062 | ||
1010 | if (!is_edp(intel_dp)) | 1063 | if (!is_edp(intel_dp)) |
1011 | return; | 1064 | return; |
1012 | if (ironlake_edp_have_panel_power(intel_dp)) | 1065 | |
1066 | DRM_DEBUG_KMS("Turn eDP power on\n"); | ||
1067 | |||
1068 | if (ironlake_edp_have_panel_power(intel_dp)) { | ||
1069 | DRM_DEBUG_KMS("eDP power already on\n"); | ||
1013 | return; | 1070 | return; |
1071 | } | ||
1014 | 1072 | ||
1015 | ironlake_wait_panel_off(intel_dp); | 1073 | ironlake_wait_panel_power_cycle(intel_dp); |
1016 | pp = I915_READ(PCH_PP_CONTROL); | ||
1017 | pp &= ~PANEL_UNLOCK_MASK; | ||
1018 | pp |= PANEL_UNLOCK_REGS; | ||
1019 | 1074 | ||
1075 | pp = ironlake_get_pp_control(dev_priv); | ||
1020 | if (IS_GEN5(dev)) { | 1076 | if (IS_GEN5(dev)) { |
1021 | /* ILK workaround: disable reset around power sequence */ | 1077 | /* ILK workaround: disable reset around power sequence */ |
1022 | pp &= ~PANEL_POWER_RESET; | 1078 | pp &= ~PANEL_POWER_RESET; |
@@ -1025,13 +1081,13 @@ static void ironlake_edp_panel_on(struct intel_dp *intel_dp) | |||
1025 | } | 1081 | } |
1026 | 1082 | ||
1027 | pp |= POWER_TARGET_ON; | 1083 | pp |= POWER_TARGET_ON; |
1084 | if (!IS_GEN5(dev)) | ||
1085 | pp |= PANEL_POWER_RESET; | ||
1086 | |||
1028 | I915_WRITE(PCH_PP_CONTROL, pp); | 1087 | I915_WRITE(PCH_PP_CONTROL, pp); |
1029 | POSTING_READ(PCH_PP_CONTROL); | 1088 | POSTING_READ(PCH_PP_CONTROL); |
1030 | 1089 | ||
1031 | if (wait_for((I915_READ(PCH_PP_STATUS) & idle_on_mask) == idle_on_mask, | 1090 | ironlake_wait_panel_on(intel_dp); |
1032 | 5000)) | ||
1033 | DRM_ERROR("panel on wait timed out: 0x%08x\n", | ||
1034 | I915_READ(PCH_PP_STATUS)); | ||
1035 | 1091 | ||
1036 | if (IS_GEN5(dev)) { | 1092 | if (IS_GEN5(dev)) { |
1037 | pp |= PANEL_POWER_RESET; /* restore panel reset bit */ | 1093 | pp |= PANEL_POWER_RESET; /* restore panel reset bit */ |
@@ -1040,46 +1096,25 @@ static void ironlake_edp_panel_on(struct intel_dp *intel_dp) | |||
1040 | } | 1096 | } |
1041 | } | 1097 | } |
1042 | 1098 | ||
1043 | static void ironlake_edp_panel_off(struct drm_encoder *encoder) | 1099 | static void ironlake_edp_panel_off(struct intel_dp *intel_dp) |
1044 | { | 1100 | { |
1045 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 1101 | struct drm_device *dev = intel_dp->base.base.dev; |
1046 | struct drm_device *dev = encoder->dev; | ||
1047 | struct drm_i915_private *dev_priv = dev->dev_private; | 1102 | struct drm_i915_private *dev_priv = dev->dev_private; |
1048 | u32 pp, idle_off_mask = PP_ON | PP_SEQUENCE_MASK | | 1103 | u32 pp; |
1049 | PP_CYCLE_DELAY_ACTIVE | PP_SEQUENCE_STATE_MASK; | ||
1050 | 1104 | ||
1051 | if (!is_edp(intel_dp)) | 1105 | if (!is_edp(intel_dp)) |
1052 | return; | 1106 | return; |
1053 | pp = I915_READ(PCH_PP_CONTROL); | ||
1054 | pp &= ~PANEL_UNLOCK_MASK; | ||
1055 | pp |= PANEL_UNLOCK_REGS; | ||
1056 | 1107 | ||
1057 | if (IS_GEN5(dev)) { | 1108 | DRM_DEBUG_KMS("Turn eDP power off\n"); |
1058 | /* ILK workaround: disable reset around power sequence */ | ||
1059 | pp &= ~PANEL_POWER_RESET; | ||
1060 | I915_WRITE(PCH_PP_CONTROL, pp); | ||
1061 | POSTING_READ(PCH_PP_CONTROL); | ||
1062 | } | ||
1063 | 1109 | ||
1064 | intel_dp->panel_off_jiffies = jiffies; | 1110 | WARN(intel_dp->want_panel_vdd, "Cannot turn power off while VDD is on\n"); |
1065 | 1111 | ||
1066 | if (IS_GEN5(dev)) { | 1112 | pp = ironlake_get_pp_control(dev_priv); |
1067 | pp &= ~POWER_TARGET_ON; | 1113 | pp &= ~(POWER_TARGET_ON | EDP_FORCE_VDD | PANEL_POWER_RESET | EDP_BLC_ENABLE); |
1068 | I915_WRITE(PCH_PP_CONTROL, pp); | 1114 | I915_WRITE(PCH_PP_CONTROL, pp); |
1069 | POSTING_READ(PCH_PP_CONTROL); | 1115 | POSTING_READ(PCH_PP_CONTROL); |
1070 | pp &= ~POWER_TARGET_ON; | ||
1071 | I915_WRITE(PCH_PP_CONTROL, pp); | ||
1072 | POSTING_READ(PCH_PP_CONTROL); | ||
1073 | msleep(intel_dp->panel_power_cycle_delay); | ||
1074 | |||
1075 | if (wait_for((I915_READ(PCH_PP_STATUS) & idle_off_mask) == 0, 5000)) | ||
1076 | DRM_ERROR("panel off wait timed out: 0x%08x\n", | ||
1077 | I915_READ(PCH_PP_STATUS)); | ||
1078 | 1116 | ||
1079 | pp |= PANEL_POWER_RESET; /* restore panel reset bit */ | 1117 | ironlake_wait_panel_off(intel_dp); |
1080 | I915_WRITE(PCH_PP_CONTROL, pp); | ||
1081 | POSTING_READ(PCH_PP_CONTROL); | ||
1082 | } | ||
1083 | } | 1118 | } |
1084 | 1119 | ||
1085 | static void ironlake_edp_backlight_on(struct intel_dp *intel_dp) | 1120 | static void ironlake_edp_backlight_on(struct intel_dp *intel_dp) |
@@ -1099,9 +1134,7 @@ static void ironlake_edp_backlight_on(struct intel_dp *intel_dp) | |||
1099 | * allowing it to appear. | 1134 | * allowing it to appear. |
1100 | */ | 1135 | */ |
1101 | msleep(intel_dp->backlight_on_delay); | 1136 | msleep(intel_dp->backlight_on_delay); |
1102 | pp = I915_READ(PCH_PP_CONTROL); | 1137 | pp = ironlake_get_pp_control(dev_priv); |
1103 | pp &= ~PANEL_UNLOCK_MASK; | ||
1104 | pp |= PANEL_UNLOCK_REGS; | ||
1105 | pp |= EDP_BLC_ENABLE; | 1138 | pp |= EDP_BLC_ENABLE; |
1106 | I915_WRITE(PCH_PP_CONTROL, pp); | 1139 | I915_WRITE(PCH_PP_CONTROL, pp); |
1107 | POSTING_READ(PCH_PP_CONTROL); | 1140 | POSTING_READ(PCH_PP_CONTROL); |
@@ -1117,9 +1150,7 @@ static void ironlake_edp_backlight_off(struct intel_dp *intel_dp) | |||
1117 | return; | 1150 | return; |
1118 | 1151 | ||
1119 | DRM_DEBUG_KMS("\n"); | 1152 | DRM_DEBUG_KMS("\n"); |
1120 | pp = I915_READ(PCH_PP_CONTROL); | 1153 | pp = ironlake_get_pp_control(dev_priv); |
1121 | pp &= ~PANEL_UNLOCK_MASK; | ||
1122 | pp |= PANEL_UNLOCK_REGS; | ||
1123 | pp &= ~EDP_BLC_ENABLE; | 1154 | pp &= ~EDP_BLC_ENABLE; |
1124 | I915_WRITE(PCH_PP_CONTROL, pp); | 1155 | I915_WRITE(PCH_PP_CONTROL, pp); |
1125 | POSTING_READ(PCH_PP_CONTROL); | 1156 | POSTING_READ(PCH_PP_CONTROL); |
@@ -1187,17 +1218,18 @@ static void intel_dp_prepare(struct drm_encoder *encoder) | |||
1187 | { | 1218 | { |
1188 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 1219 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
1189 | 1220 | ||
1221 | ironlake_edp_backlight_off(intel_dp); | ||
1222 | ironlake_edp_panel_off(intel_dp); | ||
1223 | |||
1190 | /* Wake up the sink first */ | 1224 | /* Wake up the sink first */ |
1191 | ironlake_edp_panel_vdd_on(intel_dp); | 1225 | ironlake_edp_panel_vdd_on(intel_dp); |
1192 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); | 1226 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); |
1227 | intel_dp_link_down(intel_dp); | ||
1193 | ironlake_edp_panel_vdd_off(intel_dp, false); | 1228 | ironlake_edp_panel_vdd_off(intel_dp, false); |
1194 | 1229 | ||
1195 | /* Make sure the panel is off before trying to | 1230 | /* Make sure the panel is off before trying to |
1196 | * change the mode | 1231 | * change the mode |
1197 | */ | 1232 | */ |
1198 | ironlake_edp_backlight_off(intel_dp); | ||
1199 | intel_dp_link_down(intel_dp); | ||
1200 | ironlake_edp_panel_off(encoder); | ||
1201 | } | 1233 | } |
1202 | 1234 | ||
1203 | static void intel_dp_commit(struct drm_encoder *encoder) | 1235 | static void intel_dp_commit(struct drm_encoder *encoder) |
@@ -1211,7 +1243,6 @@ static void intel_dp_commit(struct drm_encoder *encoder) | |||
1211 | intel_dp_start_link_train(intel_dp); | 1243 | intel_dp_start_link_train(intel_dp); |
1212 | ironlake_edp_panel_on(intel_dp); | 1244 | ironlake_edp_panel_on(intel_dp); |
1213 | ironlake_edp_panel_vdd_off(intel_dp, true); | 1245 | ironlake_edp_panel_vdd_off(intel_dp, true); |
1214 | |||
1215 | intel_dp_complete_link_train(intel_dp); | 1246 | intel_dp_complete_link_train(intel_dp); |
1216 | ironlake_edp_backlight_on(intel_dp); | 1247 | ironlake_edp_backlight_on(intel_dp); |
1217 | 1248 | ||
@@ -1230,16 +1261,20 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode) | |||
1230 | uint32_t dp_reg = I915_READ(intel_dp->output_reg); | 1261 | uint32_t dp_reg = I915_READ(intel_dp->output_reg); |
1231 | 1262 | ||
1232 | if (mode != DRM_MODE_DPMS_ON) { | 1263 | if (mode != DRM_MODE_DPMS_ON) { |
1264 | ironlake_edp_backlight_off(intel_dp); | ||
1265 | ironlake_edp_panel_off(intel_dp); | ||
1266 | |||
1233 | ironlake_edp_panel_vdd_on(intel_dp); | 1267 | ironlake_edp_panel_vdd_on(intel_dp); |
1234 | if (is_edp(intel_dp)) | ||
1235 | ironlake_edp_backlight_off(intel_dp); | ||
1236 | intel_dp_sink_dpms(intel_dp, mode); | 1268 | intel_dp_sink_dpms(intel_dp, mode); |
1237 | intel_dp_link_down(intel_dp); | 1269 | intel_dp_link_down(intel_dp); |
1238 | ironlake_edp_panel_off(encoder); | ||
1239 | if (is_edp(intel_dp) && !is_pch_edp(intel_dp)) | ||
1240 | ironlake_edp_pll_off(encoder); | ||
1241 | ironlake_edp_panel_vdd_off(intel_dp, false); | 1270 | ironlake_edp_panel_vdd_off(intel_dp, false); |
1271 | |||
1272 | if (is_cpu_edp(intel_dp)) | ||
1273 | ironlake_edp_pll_off(encoder); | ||
1242 | } else { | 1274 | } else { |
1275 | if (is_cpu_edp(intel_dp)) | ||
1276 | ironlake_edp_pll_on(encoder); | ||
1277 | |||
1243 | ironlake_edp_panel_vdd_on(intel_dp); | 1278 | ironlake_edp_panel_vdd_on(intel_dp); |
1244 | intel_dp_sink_dpms(intel_dp, mode); | 1279 | intel_dp_sink_dpms(intel_dp, mode); |
1245 | if (!(dp_reg & DP_PORT_EN)) { | 1280 | if (!(dp_reg & DP_PORT_EN)) { |
@@ -1247,7 +1282,6 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode) | |||
1247 | ironlake_edp_panel_on(intel_dp); | 1282 | ironlake_edp_panel_on(intel_dp); |
1248 | ironlake_edp_panel_vdd_off(intel_dp, true); | 1283 | ironlake_edp_panel_vdd_off(intel_dp, true); |
1249 | intel_dp_complete_link_train(intel_dp); | 1284 | intel_dp_complete_link_train(intel_dp); |
1250 | ironlake_edp_backlight_on(intel_dp); | ||
1251 | } else | 1285 | } else |
1252 | ironlake_edp_panel_vdd_off(intel_dp, false); | 1286 | ironlake_edp_panel_vdd_off(intel_dp, false); |
1253 | ironlake_edp_backlight_on(intel_dp); | 1287 | ironlake_edp_backlight_on(intel_dp); |
@@ -1285,11 +1319,11 @@ intel_dp_aux_native_read_retry(struct intel_dp *intel_dp, uint16_t address, | |||
1285 | * link status information | 1319 | * link status information |
1286 | */ | 1320 | */ |
1287 | static bool | 1321 | static bool |
1288 | intel_dp_get_link_status(struct intel_dp *intel_dp) | 1322 | intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]) |
1289 | { | 1323 | { |
1290 | return intel_dp_aux_native_read_retry(intel_dp, | 1324 | return intel_dp_aux_native_read_retry(intel_dp, |
1291 | DP_LANE0_1_STATUS, | 1325 | DP_LANE0_1_STATUS, |
1292 | intel_dp->link_status, | 1326 | link_status, |
1293 | DP_LINK_STATUS_SIZE); | 1327 | DP_LINK_STATUS_SIZE); |
1294 | } | 1328 | } |
1295 | 1329 | ||
@@ -1301,27 +1335,25 @@ intel_dp_link_status(uint8_t link_status[DP_LINK_STATUS_SIZE], | |||
1301 | } | 1335 | } |
1302 | 1336 | ||
1303 | static uint8_t | 1337 | static uint8_t |
1304 | intel_get_adjust_request_voltage(uint8_t link_status[DP_LINK_STATUS_SIZE], | 1338 | intel_get_adjust_request_voltage(uint8_t adjust_request[2], |
1305 | int lane) | 1339 | int lane) |
1306 | { | 1340 | { |
1307 | int i = DP_ADJUST_REQUEST_LANE0_1 + (lane >> 1); | ||
1308 | int s = ((lane & 1) ? | 1341 | int s = ((lane & 1) ? |
1309 | DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT : | 1342 | DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT : |
1310 | DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT); | 1343 | DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT); |
1311 | uint8_t l = intel_dp_link_status(link_status, i); | 1344 | uint8_t l = adjust_request[lane>>1]; |
1312 | 1345 | ||
1313 | return ((l >> s) & 3) << DP_TRAIN_VOLTAGE_SWING_SHIFT; | 1346 | return ((l >> s) & 3) << DP_TRAIN_VOLTAGE_SWING_SHIFT; |
1314 | } | 1347 | } |
1315 | 1348 | ||
1316 | static uint8_t | 1349 | static uint8_t |
1317 | intel_get_adjust_request_pre_emphasis(uint8_t link_status[DP_LINK_STATUS_SIZE], | 1350 | intel_get_adjust_request_pre_emphasis(uint8_t adjust_request[2], |
1318 | int lane) | 1351 | int lane) |
1319 | { | 1352 | { |
1320 | int i = DP_ADJUST_REQUEST_LANE0_1 + (lane >> 1); | ||
1321 | int s = ((lane & 1) ? | 1353 | int s = ((lane & 1) ? |
1322 | DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT : | 1354 | DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT : |
1323 | DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT); | 1355 | DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT); |
1324 | uint8_t l = intel_dp_link_status(link_status, i); | 1356 | uint8_t l = adjust_request[lane>>1]; |
1325 | 1357 | ||
1326 | return ((l >> s) & 3) << DP_TRAIN_PRE_EMPHASIS_SHIFT; | 1358 | return ((l >> s) & 3) << DP_TRAIN_PRE_EMPHASIS_SHIFT; |
1327 | } | 1359 | } |
@@ -1344,6 +1376,7 @@ static char *link_train_names[] = { | |||
1344 | * a maximum voltage of 800mV and a maximum pre-emphasis of 6dB | 1376 | * a maximum voltage of 800mV and a maximum pre-emphasis of 6dB |
1345 | */ | 1377 | */ |
1346 | #define I830_DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_800 | 1378 | #define I830_DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_800 |
1379 | #define I830_DP_VOLTAGE_MAX_CPT DP_TRAIN_VOLTAGE_SWING_1200 | ||
1347 | 1380 | ||
1348 | static uint8_t | 1381 | static uint8_t |
1349 | intel_dp_pre_emphasis_max(uint8_t voltage_swing) | 1382 | intel_dp_pre_emphasis_max(uint8_t voltage_swing) |
@@ -1362,15 +1395,18 @@ intel_dp_pre_emphasis_max(uint8_t voltage_swing) | |||
1362 | } | 1395 | } |
1363 | 1396 | ||
1364 | static void | 1397 | static void |
1365 | intel_get_adjust_train(struct intel_dp *intel_dp) | 1398 | intel_get_adjust_train(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]) |
1366 | { | 1399 | { |
1400 | struct drm_device *dev = intel_dp->base.base.dev; | ||
1367 | uint8_t v = 0; | 1401 | uint8_t v = 0; |
1368 | uint8_t p = 0; | 1402 | uint8_t p = 0; |
1369 | int lane; | 1403 | int lane; |
1404 | uint8_t *adjust_request = link_status + (DP_ADJUST_REQUEST_LANE0_1 - DP_LANE0_1_STATUS); | ||
1405 | int voltage_max; | ||
1370 | 1406 | ||
1371 | for (lane = 0; lane < intel_dp->lane_count; lane++) { | 1407 | for (lane = 0; lane < intel_dp->lane_count; lane++) { |
1372 | uint8_t this_v = intel_get_adjust_request_voltage(intel_dp->link_status, lane); | 1408 | uint8_t this_v = intel_get_adjust_request_voltage(adjust_request, lane); |
1373 | uint8_t this_p = intel_get_adjust_request_pre_emphasis(intel_dp->link_status, lane); | 1409 | uint8_t this_p = intel_get_adjust_request_pre_emphasis(adjust_request, lane); |
1374 | 1410 | ||
1375 | if (this_v > v) | 1411 | if (this_v > v) |
1376 | v = this_v; | 1412 | v = this_v; |
@@ -1378,8 +1414,12 @@ intel_get_adjust_train(struct intel_dp *intel_dp) | |||
1378 | p = this_p; | 1414 | p = this_p; |
1379 | } | 1415 | } |
1380 | 1416 | ||
1381 | if (v >= I830_DP_VOLTAGE_MAX) | 1417 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) |
1382 | v = I830_DP_VOLTAGE_MAX | DP_TRAIN_MAX_SWING_REACHED; | 1418 | voltage_max = I830_DP_VOLTAGE_MAX_CPT; |
1419 | else | ||
1420 | voltage_max = I830_DP_VOLTAGE_MAX; | ||
1421 | if (v >= voltage_max) | ||
1422 | v = voltage_max | DP_TRAIN_MAX_SWING_REACHED; | ||
1383 | 1423 | ||
1384 | if (p >= intel_dp_pre_emphasis_max(v)) | 1424 | if (p >= intel_dp_pre_emphasis_max(v)) |
1385 | p = intel_dp_pre_emphasis_max(v) | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED; | 1425 | p = intel_dp_pre_emphasis_max(v) | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED; |
@@ -1389,7 +1429,7 @@ intel_get_adjust_train(struct intel_dp *intel_dp) | |||
1389 | } | 1429 | } |
1390 | 1430 | ||
1391 | static uint32_t | 1431 | static uint32_t |
1392 | intel_dp_signal_levels(uint8_t train_set, int lane_count) | 1432 | intel_dp_signal_levels(uint8_t train_set) |
1393 | { | 1433 | { |
1394 | uint32_t signal_levels = 0; | 1434 | uint32_t signal_levels = 0; |
1395 | 1435 | ||
@@ -1458,9 +1498,8 @@ static uint8_t | |||
1458 | intel_get_lane_status(uint8_t link_status[DP_LINK_STATUS_SIZE], | 1498 | intel_get_lane_status(uint8_t link_status[DP_LINK_STATUS_SIZE], |
1459 | int lane) | 1499 | int lane) |
1460 | { | 1500 | { |
1461 | int i = DP_LANE0_1_STATUS + (lane >> 1); | ||
1462 | int s = (lane & 1) * 4; | 1501 | int s = (lane & 1) * 4; |
1463 | uint8_t l = intel_dp_link_status(link_status, i); | 1502 | uint8_t l = link_status[lane>>1]; |
1464 | 1503 | ||
1465 | return (l >> s) & 0xf; | 1504 | return (l >> s) & 0xf; |
1466 | } | 1505 | } |
@@ -1485,18 +1524,18 @@ intel_clock_recovery_ok(uint8_t link_status[DP_LINK_STATUS_SIZE], int lane_count | |||
1485 | DP_LANE_CHANNEL_EQ_DONE|\ | 1524 | DP_LANE_CHANNEL_EQ_DONE|\ |
1486 | DP_LANE_SYMBOL_LOCKED) | 1525 | DP_LANE_SYMBOL_LOCKED) |
1487 | static bool | 1526 | static bool |
1488 | intel_channel_eq_ok(struct intel_dp *intel_dp) | 1527 | intel_channel_eq_ok(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]) |
1489 | { | 1528 | { |
1490 | uint8_t lane_align; | 1529 | uint8_t lane_align; |
1491 | uint8_t lane_status; | 1530 | uint8_t lane_status; |
1492 | int lane; | 1531 | int lane; |
1493 | 1532 | ||
1494 | lane_align = intel_dp_link_status(intel_dp->link_status, | 1533 | lane_align = intel_dp_link_status(link_status, |
1495 | DP_LANE_ALIGN_STATUS_UPDATED); | 1534 | DP_LANE_ALIGN_STATUS_UPDATED); |
1496 | if ((lane_align & DP_INTERLANE_ALIGN_DONE) == 0) | 1535 | if ((lane_align & DP_INTERLANE_ALIGN_DONE) == 0) |
1497 | return false; | 1536 | return false; |
1498 | for (lane = 0; lane < intel_dp->lane_count; lane++) { | 1537 | for (lane = 0; lane < intel_dp->lane_count; lane++) { |
1499 | lane_status = intel_get_lane_status(intel_dp->link_status, lane); | 1538 | lane_status = intel_get_lane_status(link_status, lane); |
1500 | if ((lane_status & CHANNEL_EQ_BITS) != CHANNEL_EQ_BITS) | 1539 | if ((lane_status & CHANNEL_EQ_BITS) != CHANNEL_EQ_BITS) |
1501 | return false; | 1540 | return false; |
1502 | } | 1541 | } |
@@ -1521,8 +1560,9 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, | |||
1521 | 1560 | ||
1522 | ret = intel_dp_aux_native_write(intel_dp, | 1561 | ret = intel_dp_aux_native_write(intel_dp, |
1523 | DP_TRAINING_LANE0_SET, | 1562 | DP_TRAINING_LANE0_SET, |
1524 | intel_dp->train_set, 4); | 1563 | intel_dp->train_set, |
1525 | if (ret != 4) | 1564 | intel_dp->lane_count); |
1565 | if (ret != intel_dp->lane_count) | ||
1526 | return false; | 1566 | return false; |
1527 | 1567 | ||
1528 | return true; | 1568 | return true; |
@@ -1538,7 +1578,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1538 | int i; | 1578 | int i; |
1539 | uint8_t voltage; | 1579 | uint8_t voltage; |
1540 | bool clock_recovery = false; | 1580 | bool clock_recovery = false; |
1541 | int tries; | 1581 | int voltage_tries, loop_tries; |
1542 | u32 reg; | 1582 | u32 reg; |
1543 | uint32_t DP = intel_dp->DP; | 1583 | uint32_t DP = intel_dp->DP; |
1544 | 1584 | ||
@@ -1565,16 +1605,20 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1565 | DP &= ~DP_LINK_TRAIN_MASK; | 1605 | DP &= ~DP_LINK_TRAIN_MASK; |
1566 | memset(intel_dp->train_set, 0, 4); | 1606 | memset(intel_dp->train_set, 0, 4); |
1567 | voltage = 0xff; | 1607 | voltage = 0xff; |
1568 | tries = 0; | 1608 | voltage_tries = 0; |
1609 | loop_tries = 0; | ||
1569 | clock_recovery = false; | 1610 | clock_recovery = false; |
1570 | for (;;) { | 1611 | for (;;) { |
1571 | /* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */ | 1612 | /* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */ |
1613 | uint8_t link_status[DP_LINK_STATUS_SIZE]; | ||
1572 | uint32_t signal_levels; | 1614 | uint32_t signal_levels; |
1573 | if (IS_GEN6(dev) && is_edp(intel_dp)) { | 1615 | |
1616 | if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | ||
1574 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); | 1617 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); |
1575 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; | 1618 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; |
1576 | } else { | 1619 | } else { |
1577 | signal_levels = intel_dp_signal_levels(intel_dp->train_set[0], intel_dp->lane_count); | 1620 | signal_levels = intel_dp_signal_levels(intel_dp->train_set[0]); |
1621 | DRM_DEBUG_KMS("training pattern 1 signal levels %08x\n", signal_levels); | ||
1578 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; | 1622 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; |
1579 | } | 1623 | } |
1580 | 1624 | ||
@@ -1590,10 +1634,13 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1590 | /* Set training pattern 1 */ | 1634 | /* Set training pattern 1 */ |
1591 | 1635 | ||
1592 | udelay(100); | 1636 | udelay(100); |
1593 | if (!intel_dp_get_link_status(intel_dp)) | 1637 | if (!intel_dp_get_link_status(intel_dp, link_status)) { |
1638 | DRM_ERROR("failed to get link status\n"); | ||
1594 | break; | 1639 | break; |
1640 | } | ||
1595 | 1641 | ||
1596 | if (intel_clock_recovery_ok(intel_dp->link_status, intel_dp->lane_count)) { | 1642 | if (intel_clock_recovery_ok(link_status, intel_dp->lane_count)) { |
1643 | DRM_DEBUG_KMS("clock recovery OK\n"); | ||
1597 | clock_recovery = true; | 1644 | clock_recovery = true; |
1598 | break; | 1645 | break; |
1599 | } | 1646 | } |
@@ -1602,20 +1649,30 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1602 | for (i = 0; i < intel_dp->lane_count; i++) | 1649 | for (i = 0; i < intel_dp->lane_count; i++) |
1603 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) | 1650 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) |
1604 | break; | 1651 | break; |
1605 | if (i == intel_dp->lane_count) | 1652 | if (i == intel_dp->lane_count) { |
1606 | break; | 1653 | ++loop_tries; |
1654 | if (loop_tries == 5) { | ||
1655 | DRM_DEBUG_KMS("too many full retries, give up\n"); | ||
1656 | break; | ||
1657 | } | ||
1658 | memset(intel_dp->train_set, 0, 4); | ||
1659 | voltage_tries = 0; | ||
1660 | continue; | ||
1661 | } | ||
1607 | 1662 | ||
1608 | /* Check to see if we've tried the same voltage 5 times */ | 1663 | /* Check to see if we've tried the same voltage 5 times */ |
1609 | if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) { | 1664 | if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) { |
1610 | ++tries; | 1665 | ++voltage_tries; |
1611 | if (tries == 5) | 1666 | if (voltage_tries == 5) { |
1667 | DRM_DEBUG_KMS("too many voltage retries, give up\n"); | ||
1612 | break; | 1668 | break; |
1669 | } | ||
1613 | } else | 1670 | } else |
1614 | tries = 0; | 1671 | voltage_tries = 0; |
1615 | voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK; | 1672 | voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK; |
1616 | 1673 | ||
1617 | /* Compute new intel_dp->train_set as requested by target */ | 1674 | /* Compute new intel_dp->train_set as requested by target */ |
1618 | intel_get_adjust_train(intel_dp); | 1675 | intel_get_adjust_train(intel_dp, link_status); |
1619 | } | 1676 | } |
1620 | 1677 | ||
1621 | intel_dp->DP = DP; | 1678 | intel_dp->DP = DP; |
@@ -1638,6 +1695,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1638 | for (;;) { | 1695 | for (;;) { |
1639 | /* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */ | 1696 | /* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */ |
1640 | uint32_t signal_levels; | 1697 | uint32_t signal_levels; |
1698 | uint8_t link_status[DP_LINK_STATUS_SIZE]; | ||
1641 | 1699 | ||
1642 | if (cr_tries > 5) { | 1700 | if (cr_tries > 5) { |
1643 | DRM_ERROR("failed to train DP, aborting\n"); | 1701 | DRM_ERROR("failed to train DP, aborting\n"); |
@@ -1645,11 +1703,11 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1645 | break; | 1703 | break; |
1646 | } | 1704 | } |
1647 | 1705 | ||
1648 | if (IS_GEN6(dev) && is_edp(intel_dp)) { | 1706 | if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { |
1649 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); | 1707 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); |
1650 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; | 1708 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; |
1651 | } else { | 1709 | } else { |
1652 | signal_levels = intel_dp_signal_levels(intel_dp->train_set[0], intel_dp->lane_count); | 1710 | signal_levels = intel_dp_signal_levels(intel_dp->train_set[0]); |
1653 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; | 1711 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; |
1654 | } | 1712 | } |
1655 | 1713 | ||
@@ -1665,17 +1723,17 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1665 | break; | 1723 | break; |
1666 | 1724 | ||
1667 | udelay(400); | 1725 | udelay(400); |
1668 | if (!intel_dp_get_link_status(intel_dp)) | 1726 | if (!intel_dp_get_link_status(intel_dp, link_status)) |
1669 | break; | 1727 | break; |
1670 | 1728 | ||
1671 | /* Make sure clock is still ok */ | 1729 | /* Make sure clock is still ok */ |
1672 | if (!intel_clock_recovery_ok(intel_dp->link_status, intel_dp->lane_count)) { | 1730 | if (!intel_clock_recovery_ok(link_status, intel_dp->lane_count)) { |
1673 | intel_dp_start_link_train(intel_dp); | 1731 | intel_dp_start_link_train(intel_dp); |
1674 | cr_tries++; | 1732 | cr_tries++; |
1675 | continue; | 1733 | continue; |
1676 | } | 1734 | } |
1677 | 1735 | ||
1678 | if (intel_channel_eq_ok(intel_dp)) { | 1736 | if (intel_channel_eq_ok(intel_dp, link_status)) { |
1679 | channel_eq = true; | 1737 | channel_eq = true; |
1680 | break; | 1738 | break; |
1681 | } | 1739 | } |
@@ -1690,7 +1748,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1690 | } | 1748 | } |
1691 | 1749 | ||
1692 | /* Compute new intel_dp->train_set as requested by target */ | 1750 | /* Compute new intel_dp->train_set as requested by target */ |
1693 | intel_get_adjust_train(intel_dp); | 1751 | intel_get_adjust_train(intel_dp, link_status); |
1694 | ++tries; | 1752 | ++tries; |
1695 | } | 1753 | } |
1696 | 1754 | ||
@@ -1735,8 +1793,12 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
1735 | 1793 | ||
1736 | msleep(17); | 1794 | msleep(17); |
1737 | 1795 | ||
1738 | if (is_edp(intel_dp)) | 1796 | if (is_edp(intel_dp)) { |
1739 | DP |= DP_LINK_TRAIN_OFF; | 1797 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) |
1798 | DP |= DP_LINK_TRAIN_OFF_CPT; | ||
1799 | else | ||
1800 | DP |= DP_LINK_TRAIN_OFF; | ||
1801 | } | ||
1740 | 1802 | ||
1741 | if (!HAS_PCH_CPT(dev) && | 1803 | if (!HAS_PCH_CPT(dev) && |
1742 | I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) { | 1804 | I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) { |
@@ -1822,6 +1884,7 @@ static void | |||
1822 | intel_dp_check_link_status(struct intel_dp *intel_dp) | 1884 | intel_dp_check_link_status(struct intel_dp *intel_dp) |
1823 | { | 1885 | { |
1824 | u8 sink_irq_vector; | 1886 | u8 sink_irq_vector; |
1887 | u8 link_status[DP_LINK_STATUS_SIZE]; | ||
1825 | 1888 | ||
1826 | if (intel_dp->dpms_mode != DRM_MODE_DPMS_ON) | 1889 | if (intel_dp->dpms_mode != DRM_MODE_DPMS_ON) |
1827 | return; | 1890 | return; |
@@ -1830,7 +1893,7 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) | |||
1830 | return; | 1893 | return; |
1831 | 1894 | ||
1832 | /* Try to read receiver status if the link appears to be up */ | 1895 | /* Try to read receiver status if the link appears to be up */ |
1833 | if (!intel_dp_get_link_status(intel_dp)) { | 1896 | if (!intel_dp_get_link_status(intel_dp, link_status)) { |
1834 | intel_dp_link_down(intel_dp); | 1897 | intel_dp_link_down(intel_dp); |
1835 | return; | 1898 | return; |
1836 | } | 1899 | } |
@@ -1855,7 +1918,7 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) | |||
1855 | DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n"); | 1918 | DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n"); |
1856 | } | 1919 | } |
1857 | 1920 | ||
1858 | if (!intel_channel_eq_ok(intel_dp)) { | 1921 | if (!intel_channel_eq_ok(intel_dp, link_status)) { |
1859 | DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n", | 1922 | DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n", |
1860 | drm_get_encoder_name(&intel_dp->base.base)); | 1923 | drm_get_encoder_name(&intel_dp->base.base)); |
1861 | intel_dp_start_link_train(intel_dp); | 1924 | intel_dp_start_link_train(intel_dp); |
@@ -2179,7 +2242,8 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc) | |||
2179 | continue; | 2242 | continue; |
2180 | 2243 | ||
2181 | intel_dp = enc_to_intel_dp(encoder); | 2244 | intel_dp = enc_to_intel_dp(encoder); |
2182 | if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT) | 2245 | if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || |
2246 | intel_dp->base.type == INTEL_OUTPUT_EDP) | ||
2183 | return intel_dp->output_reg; | 2247 | return intel_dp->output_reg; |
2184 | } | 2248 | } |
2185 | 2249 | ||
@@ -2321,7 +2385,7 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
2321 | 2385 | ||
2322 | cur.t8 = (pp_on & PANEL_LIGHT_ON_DELAY_MASK) >> | 2386 | cur.t8 = (pp_on & PANEL_LIGHT_ON_DELAY_MASK) >> |
2323 | PANEL_LIGHT_ON_DELAY_SHIFT; | 2387 | PANEL_LIGHT_ON_DELAY_SHIFT; |
2324 | 2388 | ||
2325 | cur.t9 = (pp_off & PANEL_LIGHT_OFF_DELAY_MASK) >> | 2389 | cur.t9 = (pp_off & PANEL_LIGHT_OFF_DELAY_MASK) >> |
2326 | PANEL_LIGHT_OFF_DELAY_SHIFT; | 2390 | PANEL_LIGHT_OFF_DELAY_SHIFT; |
2327 | 2391 | ||
@@ -2354,11 +2418,10 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
2354 | DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n", | 2418 | DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n", |
2355 | intel_dp->backlight_on_delay, intel_dp->backlight_off_delay); | 2419 | intel_dp->backlight_on_delay, intel_dp->backlight_off_delay); |
2356 | 2420 | ||
2357 | intel_dp->panel_off_jiffies = jiffies - intel_dp->panel_power_down_delay; | ||
2358 | |||
2359 | ironlake_edp_panel_vdd_on(intel_dp); | 2421 | ironlake_edp_panel_vdd_on(intel_dp); |
2360 | ret = intel_dp_get_dpcd(intel_dp); | 2422 | ret = intel_dp_get_dpcd(intel_dp); |
2361 | ironlake_edp_panel_vdd_off(intel_dp, false); | 2423 | ironlake_edp_panel_vdd_off(intel_dp, false); |
2424 | |||
2362 | if (ret) { | 2425 | if (ret) { |
2363 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) | 2426 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) |
2364 | dev_priv->no_aux_handshake = | 2427 | dev_priv->no_aux_handshake = |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 499d4c0dbeeb..21f60b7d69a3 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -326,7 +326,8 @@ static int intel_panel_update_status(struct backlight_device *bd) | |||
326 | static int intel_panel_get_brightness(struct backlight_device *bd) | 326 | static int intel_panel_get_brightness(struct backlight_device *bd) |
327 | { | 327 | { |
328 | struct drm_device *dev = bl_get_data(bd); | 328 | struct drm_device *dev = bl_get_data(bd); |
329 | return intel_panel_get_backlight(dev); | 329 | struct drm_i915_private *dev_priv = dev->dev_private; |
330 | return dev_priv->backlight_level; | ||
330 | } | 331 | } |
331 | 332 | ||
332 | static const struct backlight_ops intel_panel_bl_ops = { | 333 | static const struct backlight_ops intel_panel_bl_ops = { |
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 7fdfa8ea7570..38e1bda73d33 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
@@ -480,21 +480,23 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
480 | } | 480 | } |
481 | break; | 481 | break; |
482 | case DB_Z_INFO: | 482 | case DB_Z_INFO: |
483 | r = evergreen_cs_packet_next_reloc(p, &reloc); | ||
484 | if (r) { | ||
485 | dev_warn(p->dev, "bad SET_CONTEXT_REG " | ||
486 | "0x%04X\n", reg); | ||
487 | return -EINVAL; | ||
488 | } | ||
489 | track->db_z_info = radeon_get_ib_value(p, idx); | 483 | track->db_z_info = radeon_get_ib_value(p, idx); |
490 | ib[idx] &= ~Z_ARRAY_MODE(0xf); | 484 | if (!p->keep_tiling_flags) { |
491 | track->db_z_info &= ~Z_ARRAY_MODE(0xf); | 485 | r = evergreen_cs_packet_next_reloc(p, &reloc); |
492 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 486 | if (r) { |
493 | ib[idx] |= Z_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 487 | dev_warn(p->dev, "bad SET_CONTEXT_REG " |
494 | track->db_z_info |= Z_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 488 | "0x%04X\n", reg); |
495 | } else { | 489 | return -EINVAL; |
496 | ib[idx] |= Z_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | 490 | } |
497 | track->db_z_info |= Z_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | 491 | ib[idx] &= ~Z_ARRAY_MODE(0xf); |
492 | track->db_z_info &= ~Z_ARRAY_MODE(0xf); | ||
493 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | ||
494 | ib[idx] |= Z_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
495 | track->db_z_info |= Z_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
496 | } else { | ||
497 | ib[idx] |= Z_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
498 | track->db_z_info |= Z_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
499 | } | ||
498 | } | 500 | } |
499 | break; | 501 | break; |
500 | case DB_STENCIL_INFO: | 502 | case DB_STENCIL_INFO: |
@@ -607,40 +609,44 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
607 | case CB_COLOR5_INFO: | 609 | case CB_COLOR5_INFO: |
608 | case CB_COLOR6_INFO: | 610 | case CB_COLOR6_INFO: |
609 | case CB_COLOR7_INFO: | 611 | case CB_COLOR7_INFO: |
610 | r = evergreen_cs_packet_next_reloc(p, &reloc); | ||
611 | if (r) { | ||
612 | dev_warn(p->dev, "bad SET_CONTEXT_REG " | ||
613 | "0x%04X\n", reg); | ||
614 | return -EINVAL; | ||
615 | } | ||
616 | tmp = (reg - CB_COLOR0_INFO) / 0x3c; | 612 | tmp = (reg - CB_COLOR0_INFO) / 0x3c; |
617 | track->cb_color_info[tmp] = radeon_get_ib_value(p, idx); | 613 | track->cb_color_info[tmp] = radeon_get_ib_value(p, idx); |
618 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 614 | if (!p->keep_tiling_flags) { |
619 | ib[idx] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 615 | r = evergreen_cs_packet_next_reloc(p, &reloc); |
620 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 616 | if (r) { |
621 | } else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { | 617 | dev_warn(p->dev, "bad SET_CONTEXT_REG " |
622 | ib[idx] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | 618 | "0x%04X\n", reg); |
623 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | 619 | return -EINVAL; |
620 | } | ||
621 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | ||
622 | ib[idx] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
623 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
624 | } else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { | ||
625 | ib[idx] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
626 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
627 | } | ||
624 | } | 628 | } |
625 | break; | 629 | break; |
626 | case CB_COLOR8_INFO: | 630 | case CB_COLOR8_INFO: |
627 | case CB_COLOR9_INFO: | 631 | case CB_COLOR9_INFO: |
628 | case CB_COLOR10_INFO: | 632 | case CB_COLOR10_INFO: |
629 | case CB_COLOR11_INFO: | 633 | case CB_COLOR11_INFO: |
630 | r = evergreen_cs_packet_next_reloc(p, &reloc); | ||
631 | if (r) { | ||
632 | dev_warn(p->dev, "bad SET_CONTEXT_REG " | ||
633 | "0x%04X\n", reg); | ||
634 | return -EINVAL; | ||
635 | } | ||
636 | tmp = ((reg - CB_COLOR8_INFO) / 0x1c) + 8; | 634 | tmp = ((reg - CB_COLOR8_INFO) / 0x1c) + 8; |
637 | track->cb_color_info[tmp] = radeon_get_ib_value(p, idx); | 635 | track->cb_color_info[tmp] = radeon_get_ib_value(p, idx); |
638 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 636 | if (!p->keep_tiling_flags) { |
639 | ib[idx] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 637 | r = evergreen_cs_packet_next_reloc(p, &reloc); |
640 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 638 | if (r) { |
641 | } else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { | 639 | dev_warn(p->dev, "bad SET_CONTEXT_REG " |
642 | ib[idx] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | 640 | "0x%04X\n", reg); |
643 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | 641 | return -EINVAL; |
642 | } | ||
643 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | ||
644 | ib[idx] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
645 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
646 | } else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { | ||
647 | ib[idx] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
648 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
649 | } | ||
644 | } | 650 | } |
645 | break; | 651 | break; |
646 | case CB_COLOR0_PITCH: | 652 | case CB_COLOR0_PITCH: |
@@ -1311,10 +1317,12 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
1311 | return -EINVAL; | 1317 | return -EINVAL; |
1312 | } | 1318 | } |
1313 | ib[idx+1+(i*8)+2] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1319 | ib[idx+1+(i*8)+2] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
1314 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) | 1320 | if (!p->keep_tiling_flags) { |
1315 | ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 1321 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) |
1316 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) | 1322 | ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_2D_TILED_THIN1); |
1317 | ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | 1323 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) |
1324 | ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
1325 | } | ||
1318 | texture = reloc->robj; | 1326 | texture = reloc->robj; |
1319 | /* tex mip base */ | 1327 | /* tex mip base */ |
1320 | r = evergreen_cs_packet_next_reloc(p, &reloc); | 1328 | r = evergreen_cs_packet_next_reloc(p, &reloc); |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 400b26df652a..c93bc64707e1 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -701,16 +701,21 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
701 | return r; | 701 | return r; |
702 | } | 702 | } |
703 | 703 | ||
704 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) | 704 | if (p->keep_tiling_flags) { |
705 | tile_flags |= R300_TXO_MACRO_TILE; | 705 | ib[idx] = (idx_value & 31) | /* keep the 1st 5 bits */ |
706 | if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) | 706 | ((idx_value & ~31) + (u32)reloc->lobj.gpu_offset); |
707 | tile_flags |= R300_TXO_MICRO_TILE; | 707 | } else { |
708 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO_SQUARE) | 708 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) |
709 | tile_flags |= R300_TXO_MICRO_TILE_SQUARE; | 709 | tile_flags |= R300_TXO_MACRO_TILE; |
710 | 710 | if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) | |
711 | tmp = idx_value + ((u32)reloc->lobj.gpu_offset); | 711 | tile_flags |= R300_TXO_MICRO_TILE; |
712 | tmp |= tile_flags; | 712 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO_SQUARE) |
713 | ib[idx] = tmp; | 713 | tile_flags |= R300_TXO_MICRO_TILE_SQUARE; |
714 | |||
715 | tmp = idx_value + ((u32)reloc->lobj.gpu_offset); | ||
716 | tmp |= tile_flags; | ||
717 | ib[idx] = tmp; | ||
718 | } | ||
714 | track->textures[i].robj = reloc->robj; | 719 | track->textures[i].robj = reloc->robj; |
715 | track->tex_dirty = true; | 720 | track->tex_dirty = true; |
716 | break; | 721 | break; |
@@ -760,24 +765,26 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
760 | /* RB3D_COLORPITCH1 */ | 765 | /* RB3D_COLORPITCH1 */ |
761 | /* RB3D_COLORPITCH2 */ | 766 | /* RB3D_COLORPITCH2 */ |
762 | /* RB3D_COLORPITCH3 */ | 767 | /* RB3D_COLORPITCH3 */ |
763 | r = r100_cs_packet_next_reloc(p, &reloc); | 768 | if (!p->keep_tiling_flags) { |
764 | if (r) { | 769 | r = r100_cs_packet_next_reloc(p, &reloc); |
765 | DRM_ERROR("No reloc for ib[%d]=0x%04X\n", | 770 | if (r) { |
766 | idx, reg); | 771 | DRM_ERROR("No reloc for ib[%d]=0x%04X\n", |
767 | r100_cs_dump_packet(p, pkt); | 772 | idx, reg); |
768 | return r; | 773 | r100_cs_dump_packet(p, pkt); |
769 | } | 774 | return r; |
775 | } | ||
770 | 776 | ||
771 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) | 777 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) |
772 | tile_flags |= R300_COLOR_TILE_ENABLE; | 778 | tile_flags |= R300_COLOR_TILE_ENABLE; |
773 | if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) | 779 | if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) |
774 | tile_flags |= R300_COLOR_MICROTILE_ENABLE; | 780 | tile_flags |= R300_COLOR_MICROTILE_ENABLE; |
775 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO_SQUARE) | 781 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO_SQUARE) |
776 | tile_flags |= R300_COLOR_MICROTILE_SQUARE_ENABLE; | 782 | tile_flags |= R300_COLOR_MICROTILE_SQUARE_ENABLE; |
777 | 783 | ||
778 | tmp = idx_value & ~(0x7 << 16); | 784 | tmp = idx_value & ~(0x7 << 16); |
779 | tmp |= tile_flags; | 785 | tmp |= tile_flags; |
780 | ib[idx] = tmp; | 786 | ib[idx] = tmp; |
787 | } | ||
781 | i = (reg - 0x4E38) >> 2; | 788 | i = (reg - 0x4E38) >> 2; |
782 | track->cb[i].pitch = idx_value & 0x3FFE; | 789 | track->cb[i].pitch = idx_value & 0x3FFE; |
783 | switch (((idx_value >> 21) & 0xF)) { | 790 | switch (((idx_value >> 21) & 0xF)) { |
@@ -843,25 +850,26 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
843 | break; | 850 | break; |
844 | case 0x4F24: | 851 | case 0x4F24: |
845 | /* ZB_DEPTHPITCH */ | 852 | /* ZB_DEPTHPITCH */ |
846 | r = r100_cs_packet_next_reloc(p, &reloc); | 853 | if (!p->keep_tiling_flags) { |
847 | if (r) { | 854 | r = r100_cs_packet_next_reloc(p, &reloc); |
848 | DRM_ERROR("No reloc for ib[%d]=0x%04X\n", | 855 | if (r) { |
849 | idx, reg); | 856 | DRM_ERROR("No reloc for ib[%d]=0x%04X\n", |
850 | r100_cs_dump_packet(p, pkt); | 857 | idx, reg); |
851 | return r; | 858 | r100_cs_dump_packet(p, pkt); |
852 | } | 859 | return r; |
853 | 860 | } | |
854 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) | ||
855 | tile_flags |= R300_DEPTHMACROTILE_ENABLE; | ||
856 | if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) | ||
857 | tile_flags |= R300_DEPTHMICROTILE_TILED; | ||
858 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO_SQUARE) | ||
859 | tile_flags |= R300_DEPTHMICROTILE_TILED_SQUARE; | ||
860 | 861 | ||
861 | tmp = idx_value & ~(0x7 << 16); | 862 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) |
862 | tmp |= tile_flags; | 863 | tile_flags |= R300_DEPTHMACROTILE_ENABLE; |
863 | ib[idx] = tmp; | 864 | if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) |
865 | tile_flags |= R300_DEPTHMICROTILE_TILED; | ||
866 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO_SQUARE) | ||
867 | tile_flags |= R300_DEPTHMICROTILE_TILED_SQUARE; | ||
864 | 868 | ||
869 | tmp = idx_value & ~(0x7 << 16); | ||
870 | tmp |= tile_flags; | ||
871 | ib[idx] = tmp; | ||
872 | } | ||
865 | track->zb.pitch = idx_value & 0x3FFC; | 873 | track->zb.pitch = idx_value & 0x3FFC; |
866 | track->zb_dirty = true; | 874 | track->zb_dirty = true; |
867 | break; | 875 | break; |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 0a2e023c1557..cb1acffd2430 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -941,7 +941,8 @@ static int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
941 | track->db_depth_control = radeon_get_ib_value(p, idx); | 941 | track->db_depth_control = radeon_get_ib_value(p, idx); |
942 | break; | 942 | break; |
943 | case R_028010_DB_DEPTH_INFO: | 943 | case R_028010_DB_DEPTH_INFO: |
944 | if (r600_cs_packet_next_is_pkt3_nop(p)) { | 944 | if (!p->keep_tiling_flags && |
945 | r600_cs_packet_next_is_pkt3_nop(p)) { | ||
945 | r = r600_cs_packet_next_reloc(p, &reloc); | 946 | r = r600_cs_packet_next_reloc(p, &reloc); |
946 | if (r) { | 947 | if (r) { |
947 | dev_warn(p->dev, "bad SET_CONTEXT_REG " | 948 | dev_warn(p->dev, "bad SET_CONTEXT_REG " |
@@ -992,7 +993,8 @@ static int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
992 | case R_0280B4_CB_COLOR5_INFO: | 993 | case R_0280B4_CB_COLOR5_INFO: |
993 | case R_0280B8_CB_COLOR6_INFO: | 994 | case R_0280B8_CB_COLOR6_INFO: |
994 | case R_0280BC_CB_COLOR7_INFO: | 995 | case R_0280BC_CB_COLOR7_INFO: |
995 | if (r600_cs_packet_next_is_pkt3_nop(p)) { | 996 | if (!p->keep_tiling_flags && |
997 | r600_cs_packet_next_is_pkt3_nop(p)) { | ||
996 | r = r600_cs_packet_next_reloc(p, &reloc); | 998 | r = r600_cs_packet_next_reloc(p, &reloc); |
997 | if (r) { | 999 | if (r) { |
998 | dev_err(p->dev, "bad SET_CONTEXT_REG 0x%04X\n", reg); | 1000 | dev_err(p->dev, "bad SET_CONTEXT_REG 0x%04X\n", reg); |
@@ -1291,10 +1293,12 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx, | |||
1291 | mip_offset <<= 8; | 1293 | mip_offset <<= 8; |
1292 | 1294 | ||
1293 | word0 = radeon_get_ib_value(p, idx + 0); | 1295 | word0 = radeon_get_ib_value(p, idx + 0); |
1294 | if (tiling_flags & RADEON_TILING_MACRO) | 1296 | if (!p->keep_tiling_flags) { |
1295 | word0 |= S_038000_TILE_MODE(V_038000_ARRAY_2D_TILED_THIN1); | 1297 | if (tiling_flags & RADEON_TILING_MACRO) |
1296 | else if (tiling_flags & RADEON_TILING_MICRO) | 1298 | word0 |= S_038000_TILE_MODE(V_038000_ARRAY_2D_TILED_THIN1); |
1297 | word0 |= S_038000_TILE_MODE(V_038000_ARRAY_1D_TILED_THIN1); | 1299 | else if (tiling_flags & RADEON_TILING_MICRO) |
1300 | word0 |= S_038000_TILE_MODE(V_038000_ARRAY_1D_TILED_THIN1); | ||
1301 | } | ||
1298 | word1 = radeon_get_ib_value(p, idx + 1); | 1302 | word1 = radeon_get_ib_value(p, idx + 1); |
1299 | w0 = G_038000_TEX_WIDTH(word0) + 1; | 1303 | w0 = G_038000_TEX_WIDTH(word0) + 1; |
1300 | h0 = G_038004_TEX_HEIGHT(word1) + 1; | 1304 | h0 = G_038004_TEX_HEIGHT(word1) + 1; |
@@ -1621,10 +1625,12 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
1621 | return -EINVAL; | 1625 | return -EINVAL; |
1622 | } | 1626 | } |
1623 | base_offset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1627 | base_offset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
1624 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) | 1628 | if (!p->keep_tiling_flags) { |
1625 | ib[idx+1+(i*7)+0] |= S_038000_TILE_MODE(V_038000_ARRAY_2D_TILED_THIN1); | 1629 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) |
1626 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) | 1630 | ib[idx+1+(i*7)+0] |= S_038000_TILE_MODE(V_038000_ARRAY_2D_TILED_THIN1); |
1627 | ib[idx+1+(i*7)+0] |= S_038000_TILE_MODE(V_038000_ARRAY_1D_TILED_THIN1); | 1631 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) |
1632 | ib[idx+1+(i*7)+0] |= S_038000_TILE_MODE(V_038000_ARRAY_1D_TILED_THIN1); | ||
1633 | } | ||
1628 | texture = reloc->robj; | 1634 | texture = reloc->robj; |
1629 | /* tex mip base */ | 1635 | /* tex mip base */ |
1630 | r = r600_cs_packet_next_reloc(p, &reloc); | 1636 | r = r600_cs_packet_next_reloc(p, &reloc); |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index fc5a1d642cb5..8227e76b5c70 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -611,7 +611,8 @@ struct radeon_cs_parser { | |||
611 | struct radeon_ib *ib; | 611 | struct radeon_ib *ib; |
612 | void *track; | 612 | void *track; |
613 | unsigned family; | 613 | unsigned family; |
614 | int parser_error; | 614 | int parser_error; |
615 | bool keep_tiling_flags; | ||
615 | }; | 616 | }; |
616 | 617 | ||
617 | extern int radeon_cs_update_pages(struct radeon_cs_parser *p, int pg_idx); | 618 | extern int radeon_cs_update_pages(struct radeon_cs_parser *p, int pg_idx); |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index d2d179267af3..d24baf30efcb 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -62,6 +62,87 @@ union atom_supported_devices { | |||
62 | struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1; | 62 | struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static void radeon_lookup_i2c_gpio_quirks(struct radeon_device *rdev, | ||
66 | ATOM_GPIO_I2C_ASSIGMENT *gpio, | ||
67 | u8 index) | ||
68 | { | ||
69 | /* r4xx mask is technically not used by the hw, so patch in the legacy mask bits */ | ||
70 | if ((rdev->family == CHIP_R420) || | ||
71 | (rdev->family == CHIP_R423) || | ||
72 | (rdev->family == CHIP_RV410)) { | ||
73 | if ((le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x0018) || | ||
74 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x0019) || | ||
75 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x001a)) { | ||
76 | gpio->ucClkMaskShift = 0x19; | ||
77 | gpio->ucDataMaskShift = 0x18; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | /* some evergreen boards have bad data for this entry */ | ||
82 | if (ASIC_IS_DCE4(rdev)) { | ||
83 | if ((index == 7) && | ||
84 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1936) && | ||
85 | (gpio->sucI2cId.ucAccess == 0)) { | ||
86 | gpio->sucI2cId.ucAccess = 0x97; | ||
87 | gpio->ucDataMaskShift = 8; | ||
88 | gpio->ucDataEnShift = 8; | ||
89 | gpio->ucDataY_Shift = 8; | ||
90 | gpio->ucDataA_Shift = 8; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | /* some DCE3 boards have bad data for this entry */ | ||
95 | if (ASIC_IS_DCE3(rdev)) { | ||
96 | if ((index == 4) && | ||
97 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1fda) && | ||
98 | (gpio->sucI2cId.ucAccess == 0x94)) | ||
99 | gpio->sucI2cId.ucAccess = 0x14; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | static struct radeon_i2c_bus_rec radeon_get_bus_rec_for_i2c_gpio(ATOM_GPIO_I2C_ASSIGMENT *gpio) | ||
104 | { | ||
105 | struct radeon_i2c_bus_rec i2c; | ||
106 | |||
107 | memset(&i2c, 0, sizeof(struct radeon_i2c_bus_rec)); | ||
108 | |||
109 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | ||
110 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | ||
111 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | ||
112 | i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; | ||
113 | i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; | ||
114 | i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; | ||
115 | i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; | ||
116 | i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; | ||
117 | i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); | ||
118 | i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); | ||
119 | i2c.en_clk_mask = (1 << gpio->ucClkEnShift); | ||
120 | i2c.en_data_mask = (1 << gpio->ucDataEnShift); | ||
121 | i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); | ||
122 | i2c.y_data_mask = (1 << gpio->ucDataY_Shift); | ||
123 | i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); | ||
124 | i2c.a_data_mask = (1 << gpio->ucDataA_Shift); | ||
125 | |||
126 | if (gpio->sucI2cId.sbfAccess.bfHW_Capable) | ||
127 | i2c.hw_capable = true; | ||
128 | else | ||
129 | i2c.hw_capable = false; | ||
130 | |||
131 | if (gpio->sucI2cId.ucAccess == 0xa0) | ||
132 | i2c.mm_i2c = true; | ||
133 | else | ||
134 | i2c.mm_i2c = false; | ||
135 | |||
136 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | ||
137 | |||
138 | if (i2c.mask_clk_reg) | ||
139 | i2c.valid = true; | ||
140 | else | ||
141 | i2c.valid = false; | ||
142 | |||
143 | return i2c; | ||
144 | } | ||
145 | |||
65 | static struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rdev, | 146 | static struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rdev, |
66 | uint8_t id) | 147 | uint8_t id) |
67 | { | 148 | { |
@@ -85,59 +166,10 @@ static struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rd | |||
85 | for (i = 0; i < num_indices; i++) { | 166 | for (i = 0; i < num_indices; i++) { |
86 | gpio = &i2c_info->asGPIO_Info[i]; | 167 | gpio = &i2c_info->asGPIO_Info[i]; |
87 | 168 | ||
88 | /* some evergreen boards have bad data for this entry */ | 169 | radeon_lookup_i2c_gpio_quirks(rdev, gpio, i); |
89 | if (ASIC_IS_DCE4(rdev)) { | ||
90 | if ((i == 7) && | ||
91 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1936) && | ||
92 | (gpio->sucI2cId.ucAccess == 0)) { | ||
93 | gpio->sucI2cId.ucAccess = 0x97; | ||
94 | gpio->ucDataMaskShift = 8; | ||
95 | gpio->ucDataEnShift = 8; | ||
96 | gpio->ucDataY_Shift = 8; | ||
97 | gpio->ucDataA_Shift = 8; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | /* some DCE3 boards have bad data for this entry */ | ||
102 | if (ASIC_IS_DCE3(rdev)) { | ||
103 | if ((i == 4) && | ||
104 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1fda) && | ||
105 | (gpio->sucI2cId.ucAccess == 0x94)) | ||
106 | gpio->sucI2cId.ucAccess = 0x14; | ||
107 | } | ||
108 | 170 | ||
109 | if (gpio->sucI2cId.ucAccess == id) { | 171 | if (gpio->sucI2cId.ucAccess == id) { |
110 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | 172 | i2c = radeon_get_bus_rec_for_i2c_gpio(gpio); |
111 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | ||
112 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | ||
113 | i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; | ||
114 | i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; | ||
115 | i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; | ||
116 | i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; | ||
117 | i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; | ||
118 | i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); | ||
119 | i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); | ||
120 | i2c.en_clk_mask = (1 << gpio->ucClkEnShift); | ||
121 | i2c.en_data_mask = (1 << gpio->ucDataEnShift); | ||
122 | i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); | ||
123 | i2c.y_data_mask = (1 << gpio->ucDataY_Shift); | ||
124 | i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); | ||
125 | i2c.a_data_mask = (1 << gpio->ucDataA_Shift); | ||
126 | |||
127 | if (gpio->sucI2cId.sbfAccess.bfHW_Capable) | ||
128 | i2c.hw_capable = true; | ||
129 | else | ||
130 | i2c.hw_capable = false; | ||
131 | |||
132 | if (gpio->sucI2cId.ucAccess == 0xa0) | ||
133 | i2c.mm_i2c = true; | ||
134 | else | ||
135 | i2c.mm_i2c = false; | ||
136 | |||
137 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | ||
138 | |||
139 | if (i2c.mask_clk_reg) | ||
140 | i2c.valid = true; | ||
141 | break; | 173 | break; |
142 | } | 174 | } |
143 | } | 175 | } |
@@ -157,8 +189,6 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) | |||
157 | int i, num_indices; | 189 | int i, num_indices; |
158 | char stmp[32]; | 190 | char stmp[32]; |
159 | 191 | ||
160 | memset(&i2c, 0, sizeof(struct radeon_i2c_bus_rec)); | ||
161 | |||
162 | if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) { | 192 | if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) { |
163 | i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); | 193 | i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); |
164 | 194 | ||
@@ -167,60 +197,12 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) | |||
167 | 197 | ||
168 | for (i = 0; i < num_indices; i++) { | 198 | for (i = 0; i < num_indices; i++) { |
169 | gpio = &i2c_info->asGPIO_Info[i]; | 199 | gpio = &i2c_info->asGPIO_Info[i]; |
170 | i2c.valid = false; | ||
171 | |||
172 | /* some evergreen boards have bad data for this entry */ | ||
173 | if (ASIC_IS_DCE4(rdev)) { | ||
174 | if ((i == 7) && | ||
175 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1936) && | ||
176 | (gpio->sucI2cId.ucAccess == 0)) { | ||
177 | gpio->sucI2cId.ucAccess = 0x97; | ||
178 | gpio->ucDataMaskShift = 8; | ||
179 | gpio->ucDataEnShift = 8; | ||
180 | gpio->ucDataY_Shift = 8; | ||
181 | gpio->ucDataA_Shift = 8; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | /* some DCE3 boards have bad data for this entry */ | ||
186 | if (ASIC_IS_DCE3(rdev)) { | ||
187 | if ((i == 4) && | ||
188 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1fda) && | ||
189 | (gpio->sucI2cId.ucAccess == 0x94)) | ||
190 | gpio->sucI2cId.ucAccess = 0x14; | ||
191 | } | ||
192 | 200 | ||
193 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | 201 | radeon_lookup_i2c_gpio_quirks(rdev, gpio, i); |
194 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | ||
195 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | ||
196 | i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; | ||
197 | i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; | ||
198 | i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; | ||
199 | i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; | ||
200 | i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; | ||
201 | i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); | ||
202 | i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); | ||
203 | i2c.en_clk_mask = (1 << gpio->ucClkEnShift); | ||
204 | i2c.en_data_mask = (1 << gpio->ucDataEnShift); | ||
205 | i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); | ||
206 | i2c.y_data_mask = (1 << gpio->ucDataY_Shift); | ||
207 | i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); | ||
208 | i2c.a_data_mask = (1 << gpio->ucDataA_Shift); | ||
209 | |||
210 | if (gpio->sucI2cId.sbfAccess.bfHW_Capable) | ||
211 | i2c.hw_capable = true; | ||
212 | else | ||
213 | i2c.hw_capable = false; | ||
214 | 202 | ||
215 | if (gpio->sucI2cId.ucAccess == 0xa0) | 203 | i2c = radeon_get_bus_rec_for_i2c_gpio(gpio); |
216 | i2c.mm_i2c = true; | ||
217 | else | ||
218 | i2c.mm_i2c = false; | ||
219 | 204 | ||
220 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | 205 | if (i2c.valid) { |
221 | |||
222 | if (i2c.mask_clk_reg) { | ||
223 | i2c.valid = true; | ||
224 | sprintf(stmp, "0x%x", i2c.i2c_id); | 206 | sprintf(stmp, "0x%x", i2c.i2c_id); |
225 | rdev->i2c_bus[i] = radeon_i2c_create(rdev->ddev, &i2c, stmp); | 207 | rdev->i2c_bus[i] = radeon_i2c_create(rdev->ddev, &i2c, stmp); |
226 | } | 208 | } |
@@ -1996,14 +1978,14 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev) | |||
1996 | return state_index; | 1978 | return state_index; |
1997 | /* last mode is usually default, array is low to high */ | 1979 | /* last mode is usually default, array is low to high */ |
1998 | for (i = 0; i < num_modes; i++) { | 1980 | for (i = 0; i < num_modes; i++) { |
1981 | rdev->pm.power_state[state_index].clock_info = | ||
1982 | kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); | ||
1983 | if (!rdev->pm.power_state[state_index].clock_info) | ||
1984 | return state_index; | ||
1985 | rdev->pm.power_state[state_index].num_clock_modes = 1; | ||
1999 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; | 1986 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; |
2000 | switch (frev) { | 1987 | switch (frev) { |
2001 | case 1: | 1988 | case 1: |
2002 | rdev->pm.power_state[state_index].clock_info = | ||
2003 | kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); | ||
2004 | if (!rdev->pm.power_state[state_index].clock_info) | ||
2005 | return state_index; | ||
2006 | rdev->pm.power_state[state_index].num_clock_modes = 1; | ||
2007 | rdev->pm.power_state[state_index].clock_info[0].mclk = | 1989 | rdev->pm.power_state[state_index].clock_info[0].mclk = |
2008 | le16_to_cpu(power_info->info.asPowerPlayInfo[i].usMemoryClock); | 1990 | le16_to_cpu(power_info->info.asPowerPlayInfo[i].usMemoryClock); |
2009 | rdev->pm.power_state[state_index].clock_info[0].sclk = | 1991 | rdev->pm.power_state[state_index].clock_info[0].sclk = |
@@ -2039,11 +2021,6 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev) | |||
2039 | state_index++; | 2021 | state_index++; |
2040 | break; | 2022 | break; |
2041 | case 2: | 2023 | case 2: |
2042 | rdev->pm.power_state[state_index].clock_info = | ||
2043 | kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); | ||
2044 | if (!rdev->pm.power_state[state_index].clock_info) | ||
2045 | return state_index; | ||
2046 | rdev->pm.power_state[state_index].num_clock_modes = 1; | ||
2047 | rdev->pm.power_state[state_index].clock_info[0].mclk = | 2024 | rdev->pm.power_state[state_index].clock_info[0].mclk = |
2048 | le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMemoryClock); | 2025 | le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMemoryClock); |
2049 | rdev->pm.power_state[state_index].clock_info[0].sclk = | 2026 | rdev->pm.power_state[state_index].clock_info[0].sclk = |
@@ -2080,11 +2057,6 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev) | |||
2080 | state_index++; | 2057 | state_index++; |
2081 | break; | 2058 | break; |
2082 | case 3: | 2059 | case 3: |
2083 | rdev->pm.power_state[state_index].clock_info = | ||
2084 | kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); | ||
2085 | if (!rdev->pm.power_state[state_index].clock_info) | ||
2086 | return state_index; | ||
2087 | rdev->pm.power_state[state_index].num_clock_modes = 1; | ||
2088 | rdev->pm.power_state[state_index].clock_info[0].mclk = | 2060 | rdev->pm.power_state[state_index].clock_info[0].mclk = |
2089 | le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMemoryClock); | 2061 | le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMemoryClock); |
2090 | rdev->pm.power_state[state_index].clock_info[0].sclk = | 2062 | rdev->pm.power_state[state_index].clock_info[0].sclk = |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index ccaa243c1442..29afd71e0840 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -93,7 +93,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
93 | { | 93 | { |
94 | struct drm_radeon_cs *cs = data; | 94 | struct drm_radeon_cs *cs = data; |
95 | uint64_t *chunk_array_ptr; | 95 | uint64_t *chunk_array_ptr; |
96 | unsigned size, i; | 96 | unsigned size, i, flags = 0; |
97 | 97 | ||
98 | if (!cs->num_chunks) { | 98 | if (!cs->num_chunks) { |
99 | return 0; | 99 | return 0; |
@@ -140,6 +140,10 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
140 | if (p->chunks[i].length_dw == 0) | 140 | if (p->chunks[i].length_dw == 0) |
141 | return -EINVAL; | 141 | return -EINVAL; |
142 | } | 142 | } |
143 | if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_FLAGS && | ||
144 | !p->chunks[i].length_dw) { | ||
145 | return -EINVAL; | ||
146 | } | ||
143 | 147 | ||
144 | p->chunks[i].length_dw = user_chunk.length_dw; | 148 | p->chunks[i].length_dw = user_chunk.length_dw; |
145 | p->chunks[i].user_ptr = (void __user *)(unsigned long)user_chunk.chunk_data; | 149 | p->chunks[i].user_ptr = (void __user *)(unsigned long)user_chunk.chunk_data; |
@@ -155,6 +159,9 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
155 | p->chunks[i].user_ptr, size)) { | 159 | p->chunks[i].user_ptr, size)) { |
156 | return -EFAULT; | 160 | return -EFAULT; |
157 | } | 161 | } |
162 | if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_FLAGS) { | ||
163 | flags = p->chunks[i].kdata[0]; | ||
164 | } | ||
158 | } else { | 165 | } else { |
159 | p->chunks[i].kpage[0] = kmalloc(PAGE_SIZE, GFP_KERNEL); | 166 | p->chunks[i].kpage[0] = kmalloc(PAGE_SIZE, GFP_KERNEL); |
160 | p->chunks[i].kpage[1] = kmalloc(PAGE_SIZE, GFP_KERNEL); | 167 | p->chunks[i].kpage[1] = kmalloc(PAGE_SIZE, GFP_KERNEL); |
@@ -174,6 +181,8 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
174 | p->chunks[p->chunk_ib_idx].length_dw); | 181 | p->chunks[p->chunk_ib_idx].length_dw); |
175 | return -EINVAL; | 182 | return -EINVAL; |
176 | } | 183 | } |
184 | |||
185 | p->keep_tiling_flags = (flags & RADEON_CS_KEEP_TILING_FLAGS) != 0; | ||
177 | return 0; | 186 | return 0; |
178 | } | 187 | } |
179 | 188 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index a0b35e909489..71499fc3daf5 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -53,9 +53,10 @@ | |||
53 | * 2.9.0 - r600 tiling (s3tc,rgtc) working, SET_PREDICATION packet 3 on r600 + eg, backend query | 53 | * 2.9.0 - r600 tiling (s3tc,rgtc) working, SET_PREDICATION packet 3 on r600 + eg, backend query |
54 | * 2.10.0 - fusion 2D tiling | 54 | * 2.10.0 - fusion 2D tiling |
55 | * 2.11.0 - backend map, initial compute support for the CS checker | 55 | * 2.11.0 - backend map, initial compute support for the CS checker |
56 | * 2.12.0 - RADEON_CS_KEEP_TILING_FLAGS | ||
56 | */ | 57 | */ |
57 | #define KMS_DRIVER_MAJOR 2 | 58 | #define KMS_DRIVER_MAJOR 2 |
58 | #define KMS_DRIVER_MINOR 11 | 59 | #define KMS_DRIVER_MINOR 12 |
59 | #define KMS_DRIVER_PATCHLEVEL 0 | 60 | #define KMS_DRIVER_PATCHLEVEL 0 |
60 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); | 61 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); |
61 | int radeon_driver_unload_kms(struct drm_device *dev); | 62 | int radeon_driver_unload_kms(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 617b64678fc6..0bb0f5f713e6 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -574,10 +574,16 @@ retry: | |||
574 | return ret; | 574 | return ret; |
575 | 575 | ||
576 | spin_lock(&glob->lru_lock); | 576 | spin_lock(&glob->lru_lock); |
577 | |||
578 | if (unlikely(list_empty(&bo->ddestroy))) { | ||
579 | spin_unlock(&glob->lru_lock); | ||
580 | return 0; | ||
581 | } | ||
582 | |||
577 | ret = ttm_bo_reserve_locked(bo, interruptible, | 583 | ret = ttm_bo_reserve_locked(bo, interruptible, |
578 | no_wait_reserve, false, 0); | 584 | no_wait_reserve, false, 0); |
579 | 585 | ||
580 | if (unlikely(ret != 0) || list_empty(&bo->ddestroy)) { | 586 | if (unlikely(ret != 0)) { |
581 | spin_unlock(&glob->lru_lock); | 587 | spin_unlock(&glob->lru_lock); |
582 | return ret; | 588 | return ret; |
583 | } | 589 | } |
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index c72f1c0b5e63..111d956d8e7d 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -465,31 +465,29 @@ static void vga_arbiter_check_bridge_sharing(struct vga_device *vgadev) | |||
465 | while (new_bus) { | 465 | while (new_bus) { |
466 | new_bridge = new_bus->self; | 466 | new_bridge = new_bus->self; |
467 | 467 | ||
468 | if (new_bridge) { | 468 | /* go through list of devices already registered */ |
469 | /* go through list of devices already registered */ | 469 | list_for_each_entry(same_bridge_vgadev, &vga_list, list) { |
470 | list_for_each_entry(same_bridge_vgadev, &vga_list, list) { | 470 | bus = same_bridge_vgadev->pdev->bus; |
471 | bus = same_bridge_vgadev->pdev->bus; | 471 | bridge = bus->self; |
472 | bridge = bus->self; | 472 | |
473 | 473 | /* see if the share a bridge with this device */ | |
474 | /* see if the share a bridge with this device */ | 474 | if (new_bridge == bridge) { |
475 | if (new_bridge == bridge) { | 475 | /* if their direct parent bridge is the same |
476 | /* if their direct parent bridge is the same | 476 | as any bridge of this device then it can't be used |
477 | as any bridge of this device then it can't be used | 477 | for that device */ |
478 | for that device */ | 478 | same_bridge_vgadev->bridge_has_one_vga = false; |
479 | same_bridge_vgadev->bridge_has_one_vga = false; | 479 | } |
480 | } | ||
481 | 480 | ||
482 | /* now iterate the previous devices bridge hierarchy */ | 481 | /* now iterate the previous devices bridge hierarchy */ |
483 | /* if the new devices parent bridge is in the other devices | 482 | /* if the new devices parent bridge is in the other devices |
484 | hierarchy then we can't use it to control this device */ | 483 | hierarchy then we can't use it to control this device */ |
485 | while (bus) { | 484 | while (bus) { |
486 | bridge = bus->self; | 485 | bridge = bus->self; |
487 | if (bridge) { | 486 | if (bridge) { |
488 | if (bridge == vgadev->pdev->bus->self) | 487 | if (bridge == vgadev->pdev->bus->self) |
489 | vgadev->bridge_has_one_vga = false; | 488 | vgadev->bridge_has_one_vga = false; |
490 | } | ||
491 | bus = bus->parent; | ||
492 | } | 489 | } |
490 | bus = bus->parent; | ||
493 | } | 491 | } |
494 | } | 492 | } |
495 | new_bus = new_bus->parent; | 493 | new_bus = new_bus->parent; |
@@ -993,14 +991,20 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
993 | uc = &priv->cards[i]; | 991 | uc = &priv->cards[i]; |
994 | } | 992 | } |
995 | 993 | ||
996 | if (!uc) | 994 | if (!uc) { |
997 | return -EINVAL; | 995 | ret_val = -EINVAL; |
996 | goto done; | ||
997 | } | ||
998 | 998 | ||
999 | if (io_state & VGA_RSRC_LEGACY_IO && uc->io_cnt == 0) | 999 | if (io_state & VGA_RSRC_LEGACY_IO && uc->io_cnt == 0) { |
1000 | return -EINVAL; | 1000 | ret_val = -EINVAL; |
1001 | goto done; | ||
1002 | } | ||
1001 | 1003 | ||
1002 | if (io_state & VGA_RSRC_LEGACY_MEM && uc->mem_cnt == 0) | 1004 | if (io_state & VGA_RSRC_LEGACY_MEM && uc->mem_cnt == 0) { |
1003 | return -EINVAL; | 1005 | ret_val = -EINVAL; |
1006 | goto done; | ||
1007 | } | ||
1004 | 1008 | ||
1005 | vga_put(pdev, io_state); | 1009 | vga_put(pdev, io_state); |
1006 | 1010 | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 9ec854ae118b..91be41f60809 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -315,7 +315,7 @@ config SENSORS_DS1621 | |||
315 | 315 | ||
316 | config SENSORS_EXYNOS4_TMU | 316 | config SENSORS_EXYNOS4_TMU |
317 | tristate "Temperature sensor on Samsung EXYNOS4" | 317 | tristate "Temperature sensor on Samsung EXYNOS4" |
318 | depends on EXYNOS4_DEV_TMU | 318 | depends on ARCH_EXYNOS4 |
319 | help | 319 | help |
320 | If you say yes here you get support for TMU (Thermal Managment | 320 | If you say yes here you get support for TMU (Thermal Managment |
321 | Unit) on SAMSUNG EXYNOS4 series of SoC. | 321 | Unit) on SAMSUNG EXYNOS4 series of SoC. |
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 85584a547c25..525c7345fa0b 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -488,7 +488,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
488 | 488 | ||
489 | if (flags & I2C_M_TEN) { | 489 | if (flags & I2C_M_TEN) { |
490 | /* a ten bit address */ | 490 | /* a ten bit address */ |
491 | addr = 0xf0 | ((msg->addr >> 7) & 0x03); | 491 | addr = 0xf0 | ((msg->addr >> 7) & 0x06); |
492 | bit_dbg(2, &i2c_adap->dev, "addr0: %d\n", addr); | 492 | bit_dbg(2, &i2c_adap->dev, "addr0: %d\n", addr); |
493 | /* try extended address code...*/ | 493 | /* try extended address code...*/ |
494 | ret = try_address(i2c_adap, addr, retries); | 494 | ret = try_address(i2c_adap, addr, retries); |
@@ -498,7 +498,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
498 | return -ENXIO; | 498 | return -ENXIO; |
499 | } | 499 | } |
500 | /* the remaining 8 bit address */ | 500 | /* the remaining 8 bit address */ |
501 | ret = i2c_outb(i2c_adap, msg->addr & 0x7f); | 501 | ret = i2c_outb(i2c_adap, msg->addr & 0xff); |
502 | if ((ret != 1) && !nak_ok) { | 502 | if ((ret != 1) && !nak_ok) { |
503 | /* the chip did not ack / xmission error occurred */ | 503 | /* the chip did not ack / xmission error occurred */ |
504 | dev_err(&i2c_adap->dev, "died at 2nd address code\n"); | 504 | dev_err(&i2c_adap->dev, "died at 2nd address code\n"); |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 131079a3e292..1e5606185b4f 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -539,8 +539,10 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) | |||
539 | client->dev.type = &i2c_client_type; | 539 | client->dev.type = &i2c_client_type; |
540 | client->dev.of_node = info->of_node; | 540 | client->dev.of_node = info->of_node; |
541 | 541 | ||
542 | /* For 10-bit clients, add an arbitrary offset to avoid collisions */ | ||
542 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), | 543 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), |
543 | client->addr); | 544 | client->addr | ((client->flags & I2C_CLIENT_TEN) |
545 | ? 0xa000 : 0)); | ||
544 | status = device_register(&client->dev); | 546 | status = device_register(&client->dev); |
545 | if (status) | 547 | if (status) |
546 | goto out_err; | 548 | goto out_err; |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index c90ce50b619f..57a45ce84b2d 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -579,7 +579,7 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy) | |||
579 | return 0; | 579 | return 0; |
580 | } | 580 | } |
581 | 581 | ||
582 | int i2cdev_notifier_call(struct notifier_block *nb, unsigned long action, | 582 | static int i2cdev_notifier_call(struct notifier_block *nb, unsigned long action, |
583 | void *data) | 583 | void *data) |
584 | { | 584 | { |
585 | struct device *dev = data; | 585 | struct device *dev = data; |
diff --git a/drivers/ide/cy82c693.c b/drivers/ide/cy82c693.c index 67cbcfa35122..847553fd8b96 100644 --- a/drivers/ide/cy82c693.c +++ b/drivers/ide/cy82c693.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer | 2 | * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer |
3 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator | 3 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator |
4 | * Copyright (C) 2007-2010 Bartlomiej Zolnierkiewicz | 4 | * Copyright (C) 2007-2011 Bartlomiej Zolnierkiewicz |
5 | * | 5 | * |
6 | * CYPRESS CY82C693 chipset IDE controller | 6 | * CYPRESS CY82C693 chipset IDE controller |
7 | * | 7 | * |
@@ -90,7 +90,7 @@ static void cy82c693_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
90 | u8 time_16, time_8; | 90 | u8 time_16, time_8; |
91 | 91 | ||
92 | /* select primary or secondary channel */ | 92 | /* select primary or secondary channel */ |
93 | if (hwif->index > 0) { /* drive is on the secondary channel */ | 93 | if (drive->dn > 1) { /* drive is on the secondary channel */ |
94 | dev = pci_get_slot(dev->bus, dev->devfn+1); | 94 | dev = pci_get_slot(dev->bus, dev->devfn+1); |
95 | if (!dev) { | 95 | if (!dev) { |
96 | printk(KERN_ERR "%s: tune_drive: " | 96 | printk(KERN_ERR "%s: tune_drive: " |
@@ -141,7 +141,7 @@ static void cy82c693_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
141 | pci_write_config_byte(dev, CY82_IDE_SLAVE_IOW, time_16); | 141 | pci_write_config_byte(dev, CY82_IDE_SLAVE_IOW, time_16); |
142 | pci_write_config_byte(dev, CY82_IDE_SLAVE_8BIT, time_8); | 142 | pci_write_config_byte(dev, CY82_IDE_SLAVE_8BIT, time_8); |
143 | } | 143 | } |
144 | if (hwif->index > 0) | 144 | if (drive->dn > 1) |
145 | pci_dev_put(dev); | 145 | pci_dev_put(dev); |
146 | } | 146 | } |
147 | 147 | ||
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index 4a697a238e28..8716066a2f2b 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c | |||
@@ -521,8 +521,8 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
521 | if (ec->dma != NO_DMA && !request_dma(ec->dma, DRV_NAME)) { | 521 | if (ec->dma != NO_DMA && !request_dma(ec->dma, DRV_NAME)) { |
522 | d.init_dma = icside_dma_init; | 522 | d.init_dma = icside_dma_init; |
523 | d.port_ops = &icside_v6_port_ops; | 523 | d.port_ops = &icside_v6_port_ops; |
524 | } else | ||
524 | d.dma_ops = NULL; | 525 | d.dma_ops = NULL; |
525 | } | ||
526 | 526 | ||
527 | ret = ide_host_register(host, &d, hws); | 527 | ret = ide_host_register(host, &d, hws); |
528 | if (ret) | 528 | if (ret) |
diff --git a/drivers/ide/piix.c b/drivers/ide/piix.c index b59d04c72051..1892e81fb00f 100644 --- a/drivers/ide/piix.c +++ b/drivers/ide/piix.c | |||
@@ -331,7 +331,7 @@ static const struct ide_port_ops ich_port_ops = { | |||
331 | .udma_mask = udma, \ | 331 | .udma_mask = udma, \ |
332 | } | 332 | } |
333 | 333 | ||
334 | #define DECLARE_ICH_DEV(udma) \ | 334 | #define DECLARE_ICH_DEV(mwdma, udma) \ |
335 | { \ | 335 | { \ |
336 | .name = DRV_NAME, \ | 336 | .name = DRV_NAME, \ |
337 | .init_chipset = init_chipset_ich, \ | 337 | .init_chipset = init_chipset_ich, \ |
@@ -340,7 +340,7 @@ static const struct ide_port_ops ich_port_ops = { | |||
340 | .port_ops = &ich_port_ops, \ | 340 | .port_ops = &ich_port_ops, \ |
341 | .pio_mask = ATA_PIO4, \ | 341 | .pio_mask = ATA_PIO4, \ |
342 | .swdma_mask = ATA_SWDMA2_ONLY, \ | 342 | .swdma_mask = ATA_SWDMA2_ONLY, \ |
343 | .mwdma_mask = ATA_MWDMA12_ONLY, \ | 343 | .mwdma_mask = mwdma, \ |
344 | .udma_mask = udma, \ | 344 | .udma_mask = udma, \ |
345 | } | 345 | } |
346 | 346 | ||
@@ -362,13 +362,15 @@ static const struct ide_port_info piix_pci_info[] __devinitdata = { | |||
362 | /* 2: PIIX4 */ | 362 | /* 2: PIIX4 */ |
363 | DECLARE_PIIX_DEV(ATA_UDMA2), | 363 | DECLARE_PIIX_DEV(ATA_UDMA2), |
364 | /* 3: ICH0 */ | 364 | /* 3: ICH0 */ |
365 | DECLARE_ICH_DEV(ATA_UDMA2), | 365 | DECLARE_ICH_DEV(ATA_MWDMA12_ONLY, ATA_UDMA2), |
366 | /* 4: ICH */ | 366 | /* 4: ICH */ |
367 | DECLARE_ICH_DEV(ATA_UDMA4), | 367 | DECLARE_ICH_DEV(ATA_MWDMA12_ONLY, ATA_UDMA4), |
368 | /* 5: PIIX4 */ | 368 | /* 5: PIIX4 */ |
369 | DECLARE_PIIX_DEV(ATA_UDMA4), | 369 | DECLARE_PIIX_DEV(ATA_UDMA4), |
370 | /* 6: ICH[2-7]/ICH[2-3]M/C-ICH/ICH5-SATA/ESB2/ICH8M */ | 370 | /* 6: ICH[2-6]/ICH[2-3]M/C-ICH/ICH5-SATA/ESB2/ICH8M */ |
371 | DECLARE_ICH_DEV(ATA_UDMA5), | 371 | DECLARE_ICH_DEV(ATA_MWDMA12_ONLY, ATA_UDMA5), |
372 | /* 7: ICH7/7-R, no MWDMA1 */ | ||
373 | DECLARE_ICH_DEV(ATA_MWDMA2_ONLY, ATA_UDMA5), | ||
372 | }; | 374 | }; |
373 | 375 | ||
374 | /** | 376 | /** |
@@ -438,9 +440,9 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
438 | #endif | 440 | #endif |
439 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB_2), 6 }, | 441 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB_2), 6 }, |
440 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH6_19), 6 }, | 442 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH6_19), 6 }, |
441 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH7_21), 6 }, | 443 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH7_21), 7 }, |
442 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_1), 6 }, | 444 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82801DB_1), 6 }, |
443 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB2_18), 6 }, | 445 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ESB2_18), 7 }, |
444 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH8_6), 6 }, | 446 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICH8_6), 6 }, |
445 | { 0, }, | 447 | { 0, }, |
446 | }; | 448 | }; |
diff --git a/drivers/ide/triflex.c b/drivers/ide/triflex.c index e53a1b78378b..281c91426345 100644 --- a/drivers/ide/triflex.c +++ b/drivers/ide/triflex.c | |||
@@ -113,12 +113,26 @@ static const struct pci_device_id triflex_pci_tbl[] = { | |||
113 | }; | 113 | }; |
114 | MODULE_DEVICE_TABLE(pci, triflex_pci_tbl); | 114 | MODULE_DEVICE_TABLE(pci, triflex_pci_tbl); |
115 | 115 | ||
116 | #ifdef CONFIG_PM | ||
117 | static int triflex_ide_pci_suspend(struct pci_dev *dev, pm_message_t state) | ||
118 | { | ||
119 | /* | ||
120 | * We must not disable or powerdown the device. | ||
121 | * APM bios refuses to suspend if IDE is not accessible. | ||
122 | */ | ||
123 | pci_save_state(dev); | ||
124 | return 0; | ||
125 | } | ||
126 | #else | ||
127 | #define triflex_ide_pci_suspend NULL | ||
128 | #endif | ||
129 | |||
116 | static struct pci_driver triflex_pci_driver = { | 130 | static struct pci_driver triflex_pci_driver = { |
117 | .name = "TRIFLEX_IDE", | 131 | .name = "TRIFLEX_IDE", |
118 | .id_table = triflex_pci_tbl, | 132 | .id_table = triflex_pci_tbl, |
119 | .probe = triflex_init_one, | 133 | .probe = triflex_init_one, |
120 | .remove = ide_pci_remove, | 134 | .remove = ide_pci_remove, |
121 | .suspend = ide_pci_suspend, | 135 | .suspend = triflex_ide_pci_suspend, |
122 | .resume = ide_pci_resume, | 136 | .resume = ide_pci_resume, |
123 | }; | 137 | }; |
124 | 138 | ||
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 09b93b11a274..e2a9867c19d5 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -1210,18 +1210,28 @@ static int elantech_reconnect(struct psmouse *psmouse) | |||
1210 | */ | 1210 | */ |
1211 | static int elantech_set_properties(struct elantech_data *etd) | 1211 | static int elantech_set_properties(struct elantech_data *etd) |
1212 | { | 1212 | { |
1213 | /* This represents the version of IC body. */ | ||
1213 | int ver = (etd->fw_version & 0x0f0000) >> 16; | 1214 | int ver = (etd->fw_version & 0x0f0000) >> 16; |
1214 | 1215 | ||
1216 | /* Early version of Elan touchpads doesn't obey the rule. */ | ||
1215 | if (etd->fw_version < 0x020030 || etd->fw_version == 0x020600) | 1217 | if (etd->fw_version < 0x020030 || etd->fw_version == 0x020600) |
1216 | etd->hw_version = 1; | 1218 | etd->hw_version = 1; |
1217 | else if (etd->fw_version < 0x150600) | 1219 | else { |
1218 | etd->hw_version = 2; | 1220 | switch (ver) { |
1219 | else if (ver == 5) | 1221 | case 2: |
1220 | etd->hw_version = 3; | 1222 | case 4: |
1221 | else if (ver == 6) | 1223 | etd->hw_version = 2; |
1222 | etd->hw_version = 4; | 1224 | break; |
1223 | else | 1225 | case 5: |
1224 | return -1; | 1226 | etd->hw_version = 3; |
1227 | break; | ||
1228 | case 6: | ||
1229 | etd->hw_version = 4; | ||
1230 | break; | ||
1231 | default: | ||
1232 | return -1; | ||
1233 | } | ||
1234 | } | ||
1225 | 1235 | ||
1226 | /* | 1236 | /* |
1227 | * Turn on packet checking by default. | 1237 | * Turn on packet checking by default. |
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c index 4b2a42f9f0bb..d4d08bd9205b 100644 --- a/drivers/input/serio/ams_delta_serio.c +++ b/drivers/input/serio/ams_delta_serio.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
25 | #include <linux/serio.h> | 25 | #include <linux/serio.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/module.h> | ||
27 | 28 | ||
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
29 | #include <plat/board-ams-delta.h> | 30 | #include <plat/board-ams-delta.h> |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index bb9f5d31f0d0..b4cfc6c8be89 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -431,6 +431,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
431 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"), | 431 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"), |
432 | }, | 432 | }, |
433 | }, | 433 | }, |
434 | { | ||
435 | /* Newer HP Pavilion dv4 models */ | ||
436 | .matches = { | ||
437 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
438 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), | ||
439 | }, | ||
440 | }, | ||
434 | { } | 441 | { } |
435 | }; | 442 | }; |
436 | 443 | ||
@@ -560,6 +567,13 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { | |||
560 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"), | 567 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"), |
561 | }, | 568 | }, |
562 | }, | 569 | }, |
570 | { | ||
571 | /* Newer HP Pavilion dv4 models */ | ||
572 | .matches = { | ||
573 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
574 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), | ||
575 | }, | ||
576 | }, | ||
563 | { } | 577 | { } |
564 | }; | 578 | }; |
565 | 579 | ||
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 661b692573e7..6d5628bb0601 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -270,11 +270,8 @@ void led_blink_set(struct led_classdev *led_cdev, | |||
270 | del_timer_sync(&led_cdev->blink_timer); | 270 | del_timer_sync(&led_cdev->blink_timer); |
271 | 271 | ||
272 | if (led_cdev->blink_set && | 272 | if (led_cdev->blink_set && |
273 | !led_cdev->blink_set(led_cdev, delay_on, delay_off)) { | 273 | !led_cdev->blink_set(led_cdev, delay_on, delay_off)) |
274 | led_cdev->blink_delay_on = *delay_on; | ||
275 | led_cdev->blink_delay_off = *delay_off; | ||
276 | return; | 274 | return; |
277 | } | ||
278 | 275 | ||
279 | /* blink with 1 Hz as default if nothing specified */ | 276 | /* blink with 1 Hz as default if nothing specified */ |
280 | if (!*delay_on && !*delay_off) | 277 | if (!*delay_on && !*delay_off) |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index d593878d66d0..5664696f2d3a 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -472,7 +472,7 @@ config BMP085 | |||
472 | module will be called bmp085. | 472 | module will be called bmp085. |
473 | 473 | ||
474 | config PCH_PHUB | 474 | config PCH_PHUB |
475 | tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) PHUB" | 475 | tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) PHUB" |
476 | depends on PCI | 476 | depends on PCI |
477 | help | 477 | help |
478 | This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of | 478 | This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of |
@@ -480,12 +480,13 @@ config PCH_PHUB | |||
480 | processor. The Topcliff has MAC address and Option ROM data in SROM. | 480 | processor. The Topcliff has MAC address and Option ROM data in SROM. |
481 | This driver can access MAC address and Option ROM data in SROM. | 481 | This driver can access MAC address and Option ROM data in SROM. |
482 | 482 | ||
483 | This driver also can be used for OKI SEMICONDUCTOR IOH(Input/ | 483 | This driver also can be used for LAPIS Semiconductor's IOH, |
484 | Output Hub), ML7213 and ML7223. | 484 | ML7213/ML7223/ML7831. |
485 | ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is | 485 | ML7213 which is for IVI(In-Vehicle Infotainment) use. |
486 | for MP(Media Phone) use. | 486 | ML7223 IOH is for MP(Media Phone) use. |
487 | ML7213/ML7223 is companion chip for Intel Atom E6xx series. | 487 | ML7831 IOH is for general purpose use. |
488 | ML7213/ML7223 is completely compatible for Intel EG20T PCH. | 488 | ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series. |
489 | ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH. | ||
489 | 490 | ||
490 | To compile this driver as a module, choose M here: the module will | 491 | To compile this driver as a module, choose M here: the module will |
491 | be called pch_phub. | 492 | be called pch_phub. |
diff --git a/drivers/misc/ad525x_dpot.h b/drivers/misc/ad525x_dpot.h index a662f5987b68..82b2cb77ae19 100644 --- a/drivers/misc/ad525x_dpot.h +++ b/drivers/misc/ad525x_dpot.h | |||
@@ -100,7 +100,7 @@ enum dpot_devid { | |||
100 | AD5293_ID = DPOT_CONF(F_RDACS_RW | F_SPI_16BIT, BRDAC0, 10, 27), | 100 | AD5293_ID = DPOT_CONF(F_RDACS_RW | F_SPI_16BIT, BRDAC0, 10, 27), |
101 | AD7376_ID = DPOT_CONF(F_RDACS_WONLY | F_AD_APPDATA | F_SPI_8BIT, | 101 | AD7376_ID = DPOT_CONF(F_RDACS_WONLY | F_AD_APPDATA | F_SPI_8BIT, |
102 | BRDAC0, 7, 28), | 102 | BRDAC0, 7, 28), |
103 | AD8400_ID = DPOT_CONF(F_RDACS_WONLY | F_AD_APPDATA | F_SPI_8BIT, | 103 | AD8400_ID = DPOT_CONF(F_RDACS_WONLY | F_AD_APPDATA | F_SPI_16BIT, |
104 | BRDAC0, 8, 29), | 104 | BRDAC0, 8, 29), |
105 | AD8402_ID = DPOT_CONF(F_RDACS_WONLY | F_AD_APPDATA | F_SPI_16BIT, | 105 | AD8402_ID = DPOT_CONF(F_RDACS_WONLY | F_AD_APPDATA | F_SPI_16BIT, |
106 | BRDAC0 | BRDAC1, 8, 30), | 106 | BRDAC0 | BRDAC1, 8, 30), |
diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c index 7ce6065dc20e..eb5cd28bc6d8 100644 --- a/drivers/misc/carma/carma-fpga-program.c +++ b/drivers/misc/carma/carma-fpga-program.c | |||
@@ -945,8 +945,7 @@ static int fpga_of_remove(struct platform_device *op) | |||
945 | /* CTL-CPLD Version Register */ | 945 | /* CTL-CPLD Version Register */ |
946 | #define CTL_CPLD_VERSION 0x2000 | 946 | #define CTL_CPLD_VERSION 0x2000 |
947 | 947 | ||
948 | static int fpga_of_probe(struct platform_device *op, | 948 | static int fpga_of_probe(struct platform_device *op) |
949 | const struct of_device_id *match) | ||
950 | { | 949 | { |
951 | struct device_node *of_node = op->dev.of_node; | 950 | struct device_node *of_node = op->dev.of_node; |
952 | struct device *this_device; | 951 | struct device *this_device; |
@@ -1107,7 +1106,7 @@ static struct of_device_id fpga_of_match[] = { | |||
1107 | {}, | 1106 | {}, |
1108 | }; | 1107 | }; |
1109 | 1108 | ||
1110 | static struct of_platform_driver fpga_of_driver = { | 1109 | static struct platform_driver fpga_of_driver = { |
1111 | .probe = fpga_of_probe, | 1110 | .probe = fpga_of_probe, |
1112 | .remove = fpga_of_remove, | 1111 | .remove = fpga_of_remove, |
1113 | .driver = { | 1112 | .driver = { |
@@ -1124,12 +1123,12 @@ static struct of_platform_driver fpga_of_driver = { | |||
1124 | static int __init fpga_init(void) | 1123 | static int __init fpga_init(void) |
1125 | { | 1124 | { |
1126 | led_trigger_register_simple("fpga", &ledtrig_fpga); | 1125 | led_trigger_register_simple("fpga", &ledtrig_fpga); |
1127 | return of_register_platform_driver(&fpga_of_driver); | 1126 | return platform_driver_register(&fpga_of_driver); |
1128 | } | 1127 | } |
1129 | 1128 | ||
1130 | static void __exit fpga_exit(void) | 1129 | static void __exit fpga_exit(void) |
1131 | { | 1130 | { |
1132 | of_unregister_platform_driver(&fpga_of_driver); | 1131 | platform_driver_unregister(&fpga_of_driver); |
1133 | led_trigger_unregister_simple(ledtrig_fpga); | 1132 | led_trigger_unregister_simple(ledtrig_fpga); |
1134 | } | 1133 | } |
1135 | 1134 | ||
diff --git a/drivers/misc/carma/carma-fpga.c b/drivers/misc/carma/carma-fpga.c index 3965821fef17..14e974b2a781 100644 --- a/drivers/misc/carma/carma-fpga.c +++ b/drivers/misc/carma/carma-fpga.c | |||
@@ -1249,8 +1249,7 @@ static bool dma_filter(struct dma_chan *chan, void *data) | |||
1249 | return true; | 1249 | return true; |
1250 | } | 1250 | } |
1251 | 1251 | ||
1252 | static int data_of_probe(struct platform_device *op, | 1252 | static int data_of_probe(struct platform_device *op) |
1253 | const struct of_device_id *match) | ||
1254 | { | 1253 | { |
1255 | struct device_node *of_node = op->dev.of_node; | 1254 | struct device_node *of_node = op->dev.of_node; |
1256 | struct device *this_device; | 1255 | struct device *this_device; |
@@ -1401,7 +1400,7 @@ static struct of_device_id data_of_match[] = { | |||
1401 | {}, | 1400 | {}, |
1402 | }; | 1401 | }; |
1403 | 1402 | ||
1404 | static struct of_platform_driver data_of_driver = { | 1403 | static struct platform_driver data_of_driver = { |
1405 | .probe = data_of_probe, | 1404 | .probe = data_of_probe, |
1406 | .remove = data_of_remove, | 1405 | .remove = data_of_remove, |
1407 | .driver = { | 1406 | .driver = { |
@@ -1417,12 +1416,12 @@ static struct of_platform_driver data_of_driver = { | |||
1417 | 1416 | ||
1418 | static int __init data_init(void) | 1417 | static int __init data_init(void) |
1419 | { | 1418 | { |
1420 | return of_register_platform_driver(&data_of_driver); | 1419 | return platform_driver_register(&data_of_driver); |
1421 | } | 1420 | } |
1422 | 1421 | ||
1423 | static void __exit data_exit(void) | 1422 | static void __exit data_exit(void) |
1424 | { | 1423 | { |
1425 | of_unregister_platform_driver(&data_of_driver); | 1424 | platform_driver_unregister(&data_of_driver); |
1426 | } | 1425 | } |
1427 | 1426 | ||
1428 | MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>"); | 1427 | MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>"); |
diff --git a/drivers/misc/eeprom/Kconfig b/drivers/misc/eeprom/Kconfig index 26cf12ca7f50..701edf658970 100644 --- a/drivers/misc/eeprom/Kconfig +++ b/drivers/misc/eeprom/Kconfig | |||
@@ -85,7 +85,7 @@ config EEPROM_93XX46 | |||
85 | 85 | ||
86 | config EEPROM_DIGSY_MTC_CFG | 86 | config EEPROM_DIGSY_MTC_CFG |
87 | bool "DigsyMTC display configuration EEPROMs device" | 87 | bool "DigsyMTC display configuration EEPROMs device" |
88 | depends on PPC_MPC5200_GPIO && GPIOLIB && SPI_GPIO | 88 | depends on GPIO_MPC5200 && SPI_GPIO |
89 | help | 89 | help |
90 | This option enables access to display configuration EEPROMs | 90 | This option enables access to display configuration EEPROMs |
91 | on digsy_mtc board. You have to additionally select Microwire | 91 | on digsy_mtc board. You have to additionally select Microwire |
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c index dee33addcaeb..10fc4785dba7 100644 --- a/drivers/misc/pch_phub.c +++ b/drivers/misc/pch_phub.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 OKI SEMICONDUCTOR CO., LTD. | 2 | * Copyright (C) 2011 LAPIS Semiconductor Co., Ltd. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -41,10 +41,10 @@ | |||
41 | #define PCH_PHUB_ROM_START_ADDR_EG20T 0x80 /* ROM data area start address offset | 41 | #define PCH_PHUB_ROM_START_ADDR_EG20T 0x80 /* ROM data area start address offset |
42 | (Intel EG20T PCH)*/ | 42 | (Intel EG20T PCH)*/ |
43 | #define PCH_PHUB_ROM_START_ADDR_ML7213 0x400 /* ROM data area start address | 43 | #define PCH_PHUB_ROM_START_ADDR_ML7213 0x400 /* ROM data area start address |
44 | offset(OKI SEMICONDUCTOR ML7213) | 44 | offset(LAPIS Semicon ML7213) |
45 | */ | 45 | */ |
46 | #define PCH_PHUB_ROM_START_ADDR_ML7223 0x400 /* ROM data area start address | 46 | #define PCH_PHUB_ROM_START_ADDR_ML7223 0x400 /* ROM data area start address |
47 | offset(OKI SEMICONDUCTOR ML7223) | 47 | offset(LAPIS Semicon ML7223) |
48 | */ | 48 | */ |
49 | 49 | ||
50 | /* MAX number of INT_REDUCE_CONTROL registers */ | 50 | /* MAX number of INT_REDUCE_CONTROL registers */ |
@@ -73,6 +73,9 @@ | |||
73 | #define PCI_DEVICE_ID_ROHM_ML7223_mPHUB 0x8012 /* for Bus-m */ | 73 | #define PCI_DEVICE_ID_ROHM_ML7223_mPHUB 0x8012 /* for Bus-m */ |
74 | #define PCI_DEVICE_ID_ROHM_ML7223_nPHUB 0x8002 /* for Bus-n */ | 74 | #define PCI_DEVICE_ID_ROHM_ML7223_nPHUB 0x8002 /* for Bus-n */ |
75 | 75 | ||
76 | /* Macros for ML7831 */ | ||
77 | #define PCI_DEVICE_ID_ROHM_ML7831_PHUB 0x8801 | ||
78 | |||
76 | /* SROM ACCESS Macro */ | 79 | /* SROM ACCESS Macro */ |
77 | #define PCH_WORD_ADDR_MASK (~((1 << 2) - 1)) | 80 | #define PCH_WORD_ADDR_MASK (~((1 << 2) - 1)) |
78 | 81 | ||
@@ -115,6 +118,7 @@ | |||
115 | * @pch_mac_start_address: MAC address area start address | 118 | * @pch_mac_start_address: MAC address area start address |
116 | * @pch_opt_rom_start_address: Option ROM start address | 119 | * @pch_opt_rom_start_address: Option ROM start address |
117 | * @ioh_type: Save IOH type | 120 | * @ioh_type: Save IOH type |
121 | * @pdev: pointer to pci device struct | ||
118 | */ | 122 | */ |
119 | struct pch_phub_reg { | 123 | struct pch_phub_reg { |
120 | u32 phub_id_reg; | 124 | u32 phub_id_reg; |
@@ -136,6 +140,7 @@ struct pch_phub_reg { | |||
136 | u32 pch_mac_start_address; | 140 | u32 pch_mac_start_address; |
137 | u32 pch_opt_rom_start_address; | 141 | u32 pch_opt_rom_start_address; |
138 | int ioh_type; | 142 | int ioh_type; |
143 | struct pci_dev *pdev; | ||
139 | }; | 144 | }; |
140 | 145 | ||
141 | /* SROM SPEC for MAC address assignment offset */ | 146 | /* SROM SPEC for MAC address assignment offset */ |
@@ -471,7 +476,7 @@ static int pch_phub_write_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data) | |||
471 | int retval; | 476 | int retval; |
472 | int i; | 477 | int i; |
473 | 478 | ||
474 | if (chip->ioh_type == 1) /* EG20T */ | 479 | if ((chip->ioh_type == 1) || (chip->ioh_type == 5)) /* EG20T or ML7831*/ |
475 | retval = pch_phub_gbe_serial_rom_conf(chip); | 480 | retval = pch_phub_gbe_serial_rom_conf(chip); |
476 | else /* ML7223 */ | 481 | else /* ML7223 */ |
477 | retval = pch_phub_gbe_serial_rom_conf_mp(chip); | 482 | retval = pch_phub_gbe_serial_rom_conf_mp(chip); |
@@ -498,6 +503,7 @@ static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj, | |||
498 | unsigned int orom_size; | 503 | unsigned int orom_size; |
499 | int ret; | 504 | int ret; |
500 | int err; | 505 | int err; |
506 | ssize_t rom_size; | ||
501 | 507 | ||
502 | struct pch_phub_reg *chip = | 508 | struct pch_phub_reg *chip = |
503 | dev_get_drvdata(container_of(kobj, struct device, kobj)); | 509 | dev_get_drvdata(container_of(kobj, struct device, kobj)); |
@@ -509,6 +515,10 @@ static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj, | |||
509 | } | 515 | } |
510 | 516 | ||
511 | /* Get Rom signature */ | 517 | /* Get Rom signature */ |
518 | chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); | ||
519 | if (!chip->pch_phub_extrom_base_address) | ||
520 | goto exrom_map_err; | ||
521 | |||
512 | pch_phub_read_serial_rom(chip, chip->pch_opt_rom_start_address, | 522 | pch_phub_read_serial_rom(chip, chip->pch_opt_rom_start_address, |
513 | (unsigned char *)&rom_signature); | 523 | (unsigned char *)&rom_signature); |
514 | rom_signature &= 0xff; | 524 | rom_signature &= 0xff; |
@@ -539,10 +549,13 @@ static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj, | |||
539 | goto return_err; | 549 | goto return_err; |
540 | } | 550 | } |
541 | return_ok: | 551 | return_ok: |
552 | pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); | ||
542 | mutex_unlock(&pch_phub_mutex); | 553 | mutex_unlock(&pch_phub_mutex); |
543 | return addr_offset; | 554 | return addr_offset; |
544 | 555 | ||
545 | return_err: | 556 | return_err: |
557 | pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); | ||
558 | exrom_map_err: | ||
546 | mutex_unlock(&pch_phub_mutex); | 559 | mutex_unlock(&pch_phub_mutex); |
547 | return_err_nomutex: | 560 | return_err_nomutex: |
548 | return err; | 561 | return err; |
@@ -555,6 +568,7 @@ static ssize_t pch_phub_bin_write(struct file *filp, struct kobject *kobj, | |||
555 | int err; | 568 | int err; |
556 | unsigned int addr_offset; | 569 | unsigned int addr_offset; |
557 | int ret; | 570 | int ret; |
571 | ssize_t rom_size; | ||
558 | struct pch_phub_reg *chip = | 572 | struct pch_phub_reg *chip = |
559 | dev_get_drvdata(container_of(kobj, struct device, kobj)); | 573 | dev_get_drvdata(container_of(kobj, struct device, kobj)); |
560 | 574 | ||
@@ -571,6 +585,12 @@ static ssize_t pch_phub_bin_write(struct file *filp, struct kobject *kobj, | |||
571 | goto return_ok; | 585 | goto return_ok; |
572 | } | 586 | } |
573 | 587 | ||
588 | chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); | ||
589 | if (!chip->pch_phub_extrom_base_address) { | ||
590 | err = -ENOMEM; | ||
591 | goto exrom_map_err; | ||
592 | } | ||
593 | |||
574 | for (addr_offset = 0; addr_offset < count; addr_offset++) { | 594 | for (addr_offset = 0; addr_offset < count; addr_offset++) { |
575 | if (PCH_PHUB_OROM_SIZE < off + addr_offset) | 595 | if (PCH_PHUB_OROM_SIZE < off + addr_offset) |
576 | goto return_ok; | 596 | goto return_ok; |
@@ -585,10 +605,14 @@ static ssize_t pch_phub_bin_write(struct file *filp, struct kobject *kobj, | |||
585 | } | 605 | } |
586 | 606 | ||
587 | return_ok: | 607 | return_ok: |
608 | pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); | ||
588 | mutex_unlock(&pch_phub_mutex); | 609 | mutex_unlock(&pch_phub_mutex); |
589 | return addr_offset; | 610 | return addr_offset; |
590 | 611 | ||
591 | return_err: | 612 | return_err: |
613 | pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); | ||
614 | |||
615 | exrom_map_err: | ||
592 | mutex_unlock(&pch_phub_mutex); | 616 | mutex_unlock(&pch_phub_mutex); |
593 | return err; | 617 | return err; |
594 | } | 618 | } |
@@ -598,8 +622,14 @@ static ssize_t show_pch_mac(struct device *dev, struct device_attribute *attr, | |||
598 | { | 622 | { |
599 | u8 mac[8]; | 623 | u8 mac[8]; |
600 | struct pch_phub_reg *chip = dev_get_drvdata(dev); | 624 | struct pch_phub_reg *chip = dev_get_drvdata(dev); |
625 | ssize_t rom_size; | ||
626 | |||
627 | chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); | ||
628 | if (!chip->pch_phub_extrom_base_address) | ||
629 | return -ENOMEM; | ||
601 | 630 | ||
602 | pch_phub_read_gbe_mac_addr(chip, mac); | 631 | pch_phub_read_gbe_mac_addr(chip, mac); |
632 | pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); | ||
603 | 633 | ||
604 | return sprintf(buf, "%pM\n", mac); | 634 | return sprintf(buf, "%pM\n", mac); |
605 | } | 635 | } |
@@ -608,6 +638,7 @@ static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr, | |||
608 | const char *buf, size_t count) | 638 | const char *buf, size_t count) |
609 | { | 639 | { |
610 | u8 mac[6]; | 640 | u8 mac[6]; |
641 | ssize_t rom_size; | ||
611 | struct pch_phub_reg *chip = dev_get_drvdata(dev); | 642 | struct pch_phub_reg *chip = dev_get_drvdata(dev); |
612 | 643 | ||
613 | if (count != 18) | 644 | if (count != 18) |
@@ -617,7 +648,12 @@ static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr, | |||
617 | (u32 *)&mac[0], (u32 *)&mac[1], (u32 *)&mac[2], (u32 *)&mac[3], | 648 | (u32 *)&mac[0], (u32 *)&mac[1], (u32 *)&mac[2], (u32 *)&mac[3], |
618 | (u32 *)&mac[4], (u32 *)&mac[5]); | 649 | (u32 *)&mac[4], (u32 *)&mac[5]); |
619 | 650 | ||
651 | chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); | ||
652 | if (!chip->pch_phub_extrom_base_address) | ||
653 | return -ENOMEM; | ||
654 | |||
620 | pch_phub_write_gbe_mac_addr(chip, mac); | 655 | pch_phub_write_gbe_mac_addr(chip, mac); |
656 | pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); | ||
621 | 657 | ||
622 | return count; | 658 | return count; |
623 | } | 659 | } |
@@ -640,7 +676,6 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev, | |||
640 | int retval; | 676 | int retval; |
641 | 677 | ||
642 | int ret; | 678 | int ret; |
643 | ssize_t rom_size; | ||
644 | struct pch_phub_reg *chip; | 679 | struct pch_phub_reg *chip; |
645 | 680 | ||
646 | chip = kzalloc(sizeof(struct pch_phub_reg), GFP_KERNEL); | 681 | chip = kzalloc(sizeof(struct pch_phub_reg), GFP_KERNEL); |
@@ -677,19 +712,7 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev, | |||
677 | "in pch_phub_base_address variable is %p\n", __func__, | 712 | "in pch_phub_base_address variable is %p\n", __func__, |
678 | chip->pch_phub_base_address); | 713 | chip->pch_phub_base_address); |
679 | 714 | ||
680 | if (id->driver_data != 3) { | 715 | chip->pdev = pdev; /* Save pci device struct */ |
681 | chip->pch_phub_extrom_base_address =\ | ||
682 | pci_map_rom(pdev, &rom_size); | ||
683 | if (chip->pch_phub_extrom_base_address == 0) { | ||
684 | dev_err(&pdev->dev, "%s: pci_map_rom FAILED", __func__); | ||
685 | ret = -ENOMEM; | ||
686 | goto err_pci_map; | ||
687 | } | ||
688 | dev_dbg(&pdev->dev, "%s : " | ||
689 | "pci_map_rom SUCCESS and value in " | ||
690 | "pch_phub_extrom_base_address variable is %p\n", | ||
691 | __func__, chip->pch_phub_extrom_base_address); | ||
692 | } | ||
693 | 716 | ||
694 | if (id->driver_data == 1) { /* EG20T PCH */ | 717 | if (id->driver_data == 1) { /* EG20T PCH */ |
695 | const char *board_name; | 718 | const char *board_name; |
@@ -763,6 +786,22 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev, | |||
763 | chip->pch_opt_rom_start_address =\ | 786 | chip->pch_opt_rom_start_address =\ |
764 | PCH_PHUB_ROM_START_ADDR_ML7223; | 787 | PCH_PHUB_ROM_START_ADDR_ML7223; |
765 | chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; | 788 | chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; |
789 | } else if (id->driver_data == 5) { /* ML7831 */ | ||
790 | retval = sysfs_create_file(&pdev->dev.kobj, | ||
791 | &dev_attr_pch_mac.attr); | ||
792 | if (retval) | ||
793 | goto err_sysfs_create; | ||
794 | |||
795 | retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); | ||
796 | if (retval) | ||
797 | goto exit_bin_attr; | ||
798 | |||
799 | /* set the prefech value */ | ||
800 | iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14); | ||
801 | /* set the interrupt delay value */ | ||
802 | iowrite32(0x25, chip->pch_phub_base_address + 0x44); | ||
803 | chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T; | ||
804 | chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T; | ||
766 | } | 805 | } |
767 | 806 | ||
768 | chip->ioh_type = id->driver_data; | 807 | chip->ioh_type = id->driver_data; |
@@ -773,8 +812,6 @@ exit_bin_attr: | |||
773 | sysfs_remove_file(&pdev->dev.kobj, &dev_attr_pch_mac.attr); | 812 | sysfs_remove_file(&pdev->dev.kobj, &dev_attr_pch_mac.attr); |
774 | 813 | ||
775 | err_sysfs_create: | 814 | err_sysfs_create: |
776 | pci_unmap_rom(pdev, chip->pch_phub_extrom_base_address); | ||
777 | err_pci_map: | ||
778 | pci_iounmap(pdev, chip->pch_phub_base_address); | 815 | pci_iounmap(pdev, chip->pch_phub_base_address); |
779 | err_pci_iomap: | 816 | err_pci_iomap: |
780 | pci_release_regions(pdev); | 817 | pci_release_regions(pdev); |
@@ -792,7 +829,6 @@ static void __devexit pch_phub_remove(struct pci_dev *pdev) | |||
792 | 829 | ||
793 | sysfs_remove_file(&pdev->dev.kobj, &dev_attr_pch_mac.attr); | 830 | sysfs_remove_file(&pdev->dev.kobj, &dev_attr_pch_mac.attr); |
794 | sysfs_remove_bin_file(&pdev->dev.kobj, &pch_bin_attr); | 831 | sysfs_remove_bin_file(&pdev->dev.kobj, &pch_bin_attr); |
795 | pci_unmap_rom(pdev, chip->pch_phub_extrom_base_address); | ||
796 | pci_iounmap(pdev, chip->pch_phub_base_address); | 832 | pci_iounmap(pdev, chip->pch_phub_base_address); |
797 | pci_release_regions(pdev); | 833 | pci_release_regions(pdev); |
798 | pci_disable_device(pdev); | 834 | pci_disable_device(pdev); |
@@ -847,6 +883,7 @@ static struct pci_device_id pch_phub_pcidev_id[] = { | |||
847 | { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7213_PHUB), 2, }, | 883 | { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7213_PHUB), 2, }, |
848 | { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_mPHUB), 3, }, | 884 | { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_mPHUB), 3, }, |
849 | { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_nPHUB), 4, }, | 885 | { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_nPHUB), 4, }, |
886 | { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7831_PHUB), 5, }, | ||
850 | { } | 887 | { } |
851 | }; | 888 | }; |
852 | MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id); | 889 | MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id); |
@@ -873,5 +910,5 @@ static void __exit pch_phub_pci_exit(void) | |||
873 | module_init(pch_phub_pci_init); | 910 | module_init(pch_phub_pci_init); |
874 | module_exit(pch_phub_pci_exit); | 911 | module_exit(pch_phub_pci_exit); |
875 | 912 | ||
876 | MODULE_DESCRIPTION("Intel EG20T PCH/OKI SEMICONDUCTOR IOH(ML7213/ML7223) PHUB"); | 913 | MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7223) PHUB"); |
877 | MODULE_LICENSE("GPL"); | 914 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/misc/spear13xx_pcie_gadget.c b/drivers/misc/spear13xx_pcie_gadget.c index cfbddbef11de..43d073bc1d9c 100644 --- a/drivers/misc/spear13xx_pcie_gadget.c +++ b/drivers/misc/spear13xx_pcie_gadget.c | |||
@@ -903,6 +903,6 @@ static void __exit spear_pcie_gadget_exit(void) | |||
903 | } | 903 | } |
904 | module_exit(spear_pcie_gadget_exit); | 904 | module_exit(spear_pcie_gadget_exit); |
905 | 905 | ||
906 | MODULE_ALIAS("pcie-gadget-spear"); | 906 | MODULE_ALIAS("platform:pcie-gadget-spear"); |
907 | MODULE_AUTHOR("Pratyush Anand"); | 907 | MODULE_AUTHOR("Pratyush Anand"); |
908 | MODULE_LICENSE("GPL"); | 908 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 583f66cd5bbd..654a5e94e0e7 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -245,6 +245,8 @@ source "drivers/net/ethernet/Kconfig" | |||
245 | 245 | ||
246 | source "drivers/net/fddi/Kconfig" | 246 | source "drivers/net/fddi/Kconfig" |
247 | 247 | ||
248 | source "drivers/net/hippi/Kconfig" | ||
249 | |||
248 | config NET_SB1000 | 250 | config NET_SB1000 |
249 | tristate "General Instruments Surfboard 1000" | 251 | tristate "General Instruments Surfboard 1000" |
250 | depends on PNP | 252 | depends on PNP |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 5a20804fdece..4ef7e2fd9fe6 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -319,6 +319,13 @@ static ssize_t bonding_store_mode(struct device *d, | |||
319 | goto out; | 319 | goto out; |
320 | } | 320 | } |
321 | 321 | ||
322 | if (bond->slave_cnt > 0) { | ||
323 | pr_err("unable to update mode of %s because it has slaves.\n", | ||
324 | bond->dev->name); | ||
325 | ret = -EPERM; | ||
326 | goto out; | ||
327 | } | ||
328 | |||
322 | new_value = bond_parse_parm(buf, bond_mode_tbl); | 329 | new_value = bond_parse_parm(buf, bond_mode_tbl); |
323 | if (new_value < 0) { | 330 | if (new_value < 0) { |
324 | pr_err("%s: Ignoring invalid mode value %.*s.\n", | 331 | pr_err("%s: Ignoring invalid mode value %.*s.\n", |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 6486ab8c8fc8..2f6361e949f0 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -10548,33 +10548,38 @@ do { \ | |||
10548 | 10548 | ||
10549 | int bnx2x_init_firmware(struct bnx2x *bp) | 10549 | int bnx2x_init_firmware(struct bnx2x *bp) |
10550 | { | 10550 | { |
10551 | const char *fw_file_name; | ||
10552 | struct bnx2x_fw_file_hdr *fw_hdr; | 10551 | struct bnx2x_fw_file_hdr *fw_hdr; |
10553 | int rc; | 10552 | int rc; |
10554 | 10553 | ||
10555 | if (CHIP_IS_E1(bp)) | ||
10556 | fw_file_name = FW_FILE_NAME_E1; | ||
10557 | else if (CHIP_IS_E1H(bp)) | ||
10558 | fw_file_name = FW_FILE_NAME_E1H; | ||
10559 | else if (!CHIP_IS_E1x(bp)) | ||
10560 | fw_file_name = FW_FILE_NAME_E2; | ||
10561 | else { | ||
10562 | BNX2X_ERR("Unsupported chip revision\n"); | ||
10563 | return -EINVAL; | ||
10564 | } | ||
10565 | 10554 | ||
10566 | BNX2X_DEV_INFO("Loading %s\n", fw_file_name); | 10555 | if (!bp->firmware) { |
10556 | const char *fw_file_name; | ||
10567 | 10557 | ||
10568 | rc = request_firmware(&bp->firmware, fw_file_name, &bp->pdev->dev); | 10558 | if (CHIP_IS_E1(bp)) |
10569 | if (rc) { | 10559 | fw_file_name = FW_FILE_NAME_E1; |
10570 | BNX2X_ERR("Can't load firmware file %s\n", fw_file_name); | 10560 | else if (CHIP_IS_E1H(bp)) |
10571 | goto request_firmware_exit; | 10561 | fw_file_name = FW_FILE_NAME_E1H; |
10572 | } | 10562 | else if (!CHIP_IS_E1x(bp)) |
10563 | fw_file_name = FW_FILE_NAME_E2; | ||
10564 | else { | ||
10565 | BNX2X_ERR("Unsupported chip revision\n"); | ||
10566 | return -EINVAL; | ||
10567 | } | ||
10568 | BNX2X_DEV_INFO("Loading %s\n", fw_file_name); | ||
10573 | 10569 | ||
10574 | rc = bnx2x_check_firmware(bp); | 10570 | rc = request_firmware(&bp->firmware, fw_file_name, |
10575 | if (rc) { | 10571 | &bp->pdev->dev); |
10576 | BNX2X_ERR("Corrupt firmware file %s\n", fw_file_name); | 10572 | if (rc) { |
10577 | goto request_firmware_exit; | 10573 | BNX2X_ERR("Can't load firmware file %s\n", |
10574 | fw_file_name); | ||
10575 | goto request_firmware_exit; | ||
10576 | } | ||
10577 | |||
10578 | rc = bnx2x_check_firmware(bp); | ||
10579 | if (rc) { | ||
10580 | BNX2X_ERR("Corrupt firmware file %s\n", fw_file_name); | ||
10581 | goto request_firmware_exit; | ||
10582 | } | ||
10578 | } | 10583 | } |
10579 | 10584 | ||
10580 | fw_hdr = (struct bnx2x_fw_file_hdr *)bp->firmware->data; | 10585 | fw_hdr = (struct bnx2x_fw_file_hdr *)bp->firmware->data; |
@@ -10630,6 +10635,7 @@ static void bnx2x_release_firmware(struct bnx2x *bp) | |||
10630 | kfree(bp->init_ops); | 10635 | kfree(bp->init_ops); |
10631 | kfree(bp->init_data); | 10636 | kfree(bp->init_data); |
10632 | release_firmware(bp->firmware); | 10637 | release_firmware(bp->firmware); |
10638 | bp->firmware = NULL; | ||
10633 | } | 10639 | } |
10634 | 10640 | ||
10635 | 10641 | ||
@@ -10925,6 +10931,8 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev) | |||
10925 | if (bp->doorbells) | 10931 | if (bp->doorbells) |
10926 | iounmap(bp->doorbells); | 10932 | iounmap(bp->doorbells); |
10927 | 10933 | ||
10934 | bnx2x_release_firmware(bp); | ||
10935 | |||
10928 | bnx2x_free_mem_bp(bp); | 10936 | bnx2x_free_mem_bp(bp); |
10929 | 10937 | ||
10930 | free_netdev(dev); | 10938 | free_netdev(dev); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c index 0440425c83d6..14517691f8db 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | |||
@@ -5380,7 +5380,7 @@ static int bnx2x_func_hw_init(struct bnx2x *bp, | |||
5380 | rc = drv->init_fw(bp); | 5380 | rc = drv->init_fw(bp); |
5381 | if (rc) { | 5381 | if (rc) { |
5382 | BNX2X_ERR("Error loading firmware\n"); | 5382 | BNX2X_ERR("Error loading firmware\n"); |
5383 | goto fw_init_err; | 5383 | goto init_err; |
5384 | } | 5384 | } |
5385 | 5385 | ||
5386 | /* Handle the beginning of COMMON_XXX pases separatelly... */ | 5386 | /* Handle the beginning of COMMON_XXX pases separatelly... */ |
@@ -5388,25 +5388,25 @@ static int bnx2x_func_hw_init(struct bnx2x *bp, | |||
5388 | case FW_MSG_CODE_DRV_LOAD_COMMON_CHIP: | 5388 | case FW_MSG_CODE_DRV_LOAD_COMMON_CHIP: |
5389 | rc = bnx2x_func_init_cmn_chip(bp, drv); | 5389 | rc = bnx2x_func_init_cmn_chip(bp, drv); |
5390 | if (rc) | 5390 | if (rc) |
5391 | goto init_hw_err; | 5391 | goto init_err; |
5392 | 5392 | ||
5393 | break; | 5393 | break; |
5394 | case FW_MSG_CODE_DRV_LOAD_COMMON: | 5394 | case FW_MSG_CODE_DRV_LOAD_COMMON: |
5395 | rc = bnx2x_func_init_cmn(bp, drv); | 5395 | rc = bnx2x_func_init_cmn(bp, drv); |
5396 | if (rc) | 5396 | if (rc) |
5397 | goto init_hw_err; | 5397 | goto init_err; |
5398 | 5398 | ||
5399 | break; | 5399 | break; |
5400 | case FW_MSG_CODE_DRV_LOAD_PORT: | 5400 | case FW_MSG_CODE_DRV_LOAD_PORT: |
5401 | rc = bnx2x_func_init_port(bp, drv); | 5401 | rc = bnx2x_func_init_port(bp, drv); |
5402 | if (rc) | 5402 | if (rc) |
5403 | goto init_hw_err; | 5403 | goto init_err; |
5404 | 5404 | ||
5405 | break; | 5405 | break; |
5406 | case FW_MSG_CODE_DRV_LOAD_FUNCTION: | 5406 | case FW_MSG_CODE_DRV_LOAD_FUNCTION: |
5407 | rc = bnx2x_func_init_func(bp, drv); | 5407 | rc = bnx2x_func_init_func(bp, drv); |
5408 | if (rc) | 5408 | if (rc) |
5409 | goto init_hw_err; | 5409 | goto init_err; |
5410 | 5410 | ||
5411 | break; | 5411 | break; |
5412 | default: | 5412 | default: |
@@ -5414,10 +5414,7 @@ static int bnx2x_func_hw_init(struct bnx2x *bp, | |||
5414 | rc = -EINVAL; | 5414 | rc = -EINVAL; |
5415 | } | 5415 | } |
5416 | 5416 | ||
5417 | init_hw_err: | 5417 | init_err: |
5418 | drv->release_fw(bp); | ||
5419 | |||
5420 | fw_init_err: | ||
5421 | drv->gunzip_end(bp); | 5418 | drv->gunzip_end(bp); |
5422 | 5419 | ||
5423 | /* In case of success, complete the comand immediatelly: no ramrods | 5420 | /* In case of success, complete the comand immediatelly: no ramrods |
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig index 98849a1fc749..b48378a41e49 100644 --- a/drivers/net/ethernet/cadence/Kconfig +++ b/drivers/net/ethernet/cadence/Kconfig | |||
@@ -7,6 +7,7 @@ config HAVE_NET_MACB | |||
7 | 7 | ||
8 | config NET_ATMEL | 8 | config NET_ATMEL |
9 | bool "Atmel devices" | 9 | bool "Atmel devices" |
10 | default y | ||
10 | depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200) | 11 | depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200) |
11 | ---help--- | 12 | ---help--- |
12 | If you have a network (Ethernet) card belonging to this class, say Y. | 13 | If you have a network (Ethernet) card belonging to this class, say Y. |
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index 6bb2b9506cad..0b3567ab8121 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/io.h> | 36 | #include <linux/io.h> |
37 | #include <linux/dma-mapping.h> | ||
38 | #include <linux/module.h> | ||
37 | 39 | ||
38 | #include <asm/checksum.h> | 40 | #include <asm/checksum.h> |
39 | 41 | ||
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index fdc6c394c683..7803efa46eb2 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #include "sky2.h" | 50 | #include "sky2.h" |
51 | 51 | ||
52 | #define DRV_NAME "sky2" | 52 | #define DRV_NAME "sky2" |
53 | #define DRV_VERSION "1.29" | 53 | #define DRV_VERSION "1.30" |
54 | 54 | ||
55 | /* | 55 | /* |
56 | * The Yukon II chipset takes 64 bit command blocks (called list elements) | 56 | * The Yukon II chipset takes 64 bit command blocks (called list elements) |
@@ -68,7 +68,7 @@ | |||
68 | #define MAX_SKB_TX_LE (2 + (sizeof(dma_addr_t)/sizeof(u32))*(MAX_SKB_FRAGS+1)) | 68 | #define MAX_SKB_TX_LE (2 + (sizeof(dma_addr_t)/sizeof(u32))*(MAX_SKB_FRAGS+1)) |
69 | #define TX_MIN_PENDING (MAX_SKB_TX_LE+1) | 69 | #define TX_MIN_PENDING (MAX_SKB_TX_LE+1) |
70 | #define TX_MAX_PENDING 1024 | 70 | #define TX_MAX_PENDING 1024 |
71 | #define TX_DEF_PENDING 127 | 71 | #define TX_DEF_PENDING 63 |
72 | 72 | ||
73 | #define TX_WATCHDOG (5 * HZ) | 73 | #define TX_WATCHDOG (5 * HZ) |
74 | #define NAPI_WEIGHT 64 | 74 | #define NAPI_WEIGHT 64 |
@@ -869,6 +869,7 @@ static void sky2_wol_init(struct sky2_port *sky2) | |||
869 | 869 | ||
870 | /* block receiver */ | 870 | /* block receiver */ |
871 | sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); | 871 | sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); |
872 | sky2_read32(hw, B0_CTST); | ||
872 | } | 873 | } |
873 | 874 | ||
874 | static void sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port) | 875 | static void sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port) |
@@ -1274,6 +1275,14 @@ static void rx_set_checksum(struct sky2_port *sky2) | |||
1274 | ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); | 1275 | ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); |
1275 | } | 1276 | } |
1276 | 1277 | ||
1278 | /* | ||
1279 | * Fixed initial key as seed to RSS. | ||
1280 | */ | ||
1281 | static const uint32_t rss_init_key[10] = { | ||
1282 | 0x7c3351da, 0x51c5cf4e, 0x44adbdd1, 0xe8d38d18, 0x48897c43, | ||
1283 | 0xb1d60e7e, 0x6a3dd760, 0x01a2e453, 0x16f46f13, 0x1a0e7b30 | ||
1284 | }; | ||
1285 | |||
1277 | /* Enable/disable receive hash calculation (RSS) */ | 1286 | /* Enable/disable receive hash calculation (RSS) */ |
1278 | static void rx_set_rss(struct net_device *dev, u32 features) | 1287 | static void rx_set_rss(struct net_device *dev, u32 features) |
1279 | { | 1288 | { |
@@ -1289,12 +1298,9 @@ static void rx_set_rss(struct net_device *dev, u32 features) | |||
1289 | 1298 | ||
1290 | /* Program RSS initial values */ | 1299 | /* Program RSS initial values */ |
1291 | if (features & NETIF_F_RXHASH) { | 1300 | if (features & NETIF_F_RXHASH) { |
1292 | u32 key[nkeys]; | ||
1293 | |||
1294 | get_random_bytes(key, nkeys * sizeof(u32)); | ||
1295 | for (i = 0; i < nkeys; i++) | 1301 | for (i = 0; i < nkeys; i++) |
1296 | sky2_write32(hw, SK_REG(sky2->port, RSS_KEY + i * 4), | 1302 | sky2_write32(hw, SK_REG(sky2->port, RSS_KEY + i * 4), |
1297 | key[i]); | 1303 | rss_init_key[i]); |
1298 | 1304 | ||
1299 | /* Need to turn on (undocumented) flag to make hashing work */ | 1305 | /* Need to turn on (undocumented) flag to make hashing work */ |
1300 | sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), | 1306 | sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), |
@@ -1717,6 +1723,8 @@ static int sky2_setup_irq(struct sky2_hw *hw, const char *name) | |||
1717 | if (err) | 1723 | if (err) |
1718 | dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq); | 1724 | dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq); |
1719 | else { | 1725 | else { |
1726 | hw->flags |= SKY2_HW_IRQ_SETUP; | ||
1727 | |||
1720 | napi_enable(&hw->napi); | 1728 | napi_enable(&hw->napi); |
1721 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); | 1729 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); |
1722 | sky2_read32(hw, B0_IMSK); | 1730 | sky2_read32(hw, B0_IMSK); |
@@ -1727,7 +1735,7 @@ static int sky2_setup_irq(struct sky2_hw *hw, const char *name) | |||
1727 | 1735 | ||
1728 | 1736 | ||
1729 | /* Bring up network interface. */ | 1737 | /* Bring up network interface. */ |
1730 | static int sky2_up(struct net_device *dev) | 1738 | static int sky2_open(struct net_device *dev) |
1731 | { | 1739 | { |
1732 | struct sky2_port *sky2 = netdev_priv(dev); | 1740 | struct sky2_port *sky2 = netdev_priv(dev); |
1733 | struct sky2_hw *hw = sky2->hw; | 1741 | struct sky2_hw *hw = sky2->hw; |
@@ -1747,6 +1755,11 @@ static int sky2_up(struct net_device *dev) | |||
1747 | 1755 | ||
1748 | sky2_hw_up(sky2); | 1756 | sky2_hw_up(sky2); |
1749 | 1757 | ||
1758 | if (hw->chip_id == CHIP_ID_YUKON_OPT || | ||
1759 | hw->chip_id == CHIP_ID_YUKON_PRM || | ||
1760 | hw->chip_id == CHIP_ID_YUKON_OP_2) | ||
1761 | imask |= Y2_IS_PHY_QLNK; /* enable PHY Quick Link */ | ||
1762 | |||
1750 | /* Enable interrupts from phy/mac for port */ | 1763 | /* Enable interrupts from phy/mac for port */ |
1751 | imask = sky2_read32(hw, B0_IMSK); | 1764 | imask = sky2_read32(hw, B0_IMSK); |
1752 | imask |= portirq_msk[port]; | 1765 | imask |= portirq_msk[port]; |
@@ -2040,6 +2053,8 @@ static void sky2_tx_reset(struct sky2_hw *hw, unsigned port) | |||
2040 | 2053 | ||
2041 | sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), RB_RST_SET); | 2054 | sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), RB_RST_SET); |
2042 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); | 2055 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); |
2056 | |||
2057 | sky2_read32(hw, B0_CTST); | ||
2043 | } | 2058 | } |
2044 | 2059 | ||
2045 | static void sky2_hw_down(struct sky2_port *sky2) | 2060 | static void sky2_hw_down(struct sky2_port *sky2) |
@@ -2090,7 +2105,7 @@ static void sky2_hw_down(struct sky2_port *sky2) | |||
2090 | } | 2105 | } |
2091 | 2106 | ||
2092 | /* Network shutdown */ | 2107 | /* Network shutdown */ |
2093 | static int sky2_down(struct net_device *dev) | 2108 | static int sky2_close(struct net_device *dev) |
2094 | { | 2109 | { |
2095 | struct sky2_port *sky2 = netdev_priv(dev); | 2110 | struct sky2_port *sky2 = netdev_priv(dev); |
2096 | struct sky2_hw *hw = sky2->hw; | 2111 | struct sky2_hw *hw = sky2->hw; |
@@ -2101,15 +2116,22 @@ static int sky2_down(struct net_device *dev) | |||
2101 | 2116 | ||
2102 | netif_info(sky2, ifdown, dev, "disabling interface\n"); | 2117 | netif_info(sky2, ifdown, dev, "disabling interface\n"); |
2103 | 2118 | ||
2104 | /* Disable port IRQ */ | ||
2105 | sky2_write32(hw, B0_IMSK, | ||
2106 | sky2_read32(hw, B0_IMSK) & ~portirq_msk[sky2->port]); | ||
2107 | sky2_read32(hw, B0_IMSK); | ||
2108 | |||
2109 | if (hw->ports == 1) { | 2119 | if (hw->ports == 1) { |
2120 | sky2_write32(hw, B0_IMSK, 0); | ||
2121 | sky2_read32(hw, B0_IMSK); | ||
2122 | |||
2110 | napi_disable(&hw->napi); | 2123 | napi_disable(&hw->napi); |
2111 | free_irq(hw->pdev->irq, hw); | 2124 | free_irq(hw->pdev->irq, hw); |
2125 | hw->flags &= ~SKY2_HW_IRQ_SETUP; | ||
2112 | } else { | 2126 | } else { |
2127 | u32 imask; | ||
2128 | |||
2129 | /* Disable port IRQ */ | ||
2130 | imask = sky2_read32(hw, B0_IMSK); | ||
2131 | imask &= ~portirq_msk[sky2->port]; | ||
2132 | sky2_write32(hw, B0_IMSK, imask); | ||
2133 | sky2_read32(hw, B0_IMSK); | ||
2134 | |||
2113 | synchronize_irq(hw->pdev->irq); | 2135 | synchronize_irq(hw->pdev->irq); |
2114 | napi_synchronize(&hw->napi); | 2136 | napi_synchronize(&hw->napi); |
2115 | } | 2137 | } |
@@ -2587,7 +2609,7 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) | |||
2587 | if (netif_running(dev)) { | 2609 | if (netif_running(dev)) { |
2588 | sky2_tx_complete(sky2, last); | 2610 | sky2_tx_complete(sky2, last); |
2589 | 2611 | ||
2590 | /* Wake unless it's detached, and called e.g. from sky2_down() */ | 2612 | /* Wake unless it's detached, and called e.g. from sky2_close() */ |
2591 | if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) | 2613 | if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) |
2592 | netif_wake_queue(dev); | 2614 | netif_wake_queue(dev); |
2593 | } | 2615 | } |
@@ -3258,7 +3280,6 @@ static void sky2_reset(struct sky2_hw *hw) | |||
3258 | hw->chip_id == CHIP_ID_YUKON_PRM || | 3280 | hw->chip_id == CHIP_ID_YUKON_PRM || |
3259 | hw->chip_id == CHIP_ID_YUKON_OP_2) { | 3281 | hw->chip_id == CHIP_ID_YUKON_OP_2) { |
3260 | u16 reg; | 3282 | u16 reg; |
3261 | u32 msk; | ||
3262 | 3283 | ||
3263 | if (hw->chip_id == CHIP_ID_YUKON_OPT && hw->chip_rev == 0) { | 3284 | if (hw->chip_id == CHIP_ID_YUKON_OPT && hw->chip_rev == 0) { |
3264 | /* disable PCI-E PHY power down (set PHY reg 0x80, bit 7 */ | 3285 | /* disable PCI-E PHY power down (set PHY reg 0x80, bit 7 */ |
@@ -3281,11 +3302,6 @@ static void sky2_reset(struct sky2_hw *hw) | |||
3281 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 3302 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
3282 | sky2_pci_write16(hw, PSM_CONFIG_REG4, reg); | 3303 | sky2_pci_write16(hw, PSM_CONFIG_REG4, reg); |
3283 | 3304 | ||
3284 | /* enable PHY Quick Link */ | ||
3285 | msk = sky2_read32(hw, B0_IMSK); | ||
3286 | msk |= Y2_IS_PHY_QLNK; | ||
3287 | sky2_write32(hw, B0_IMSK, msk); | ||
3288 | |||
3289 | /* check if PSMv2 was running before */ | 3305 | /* check if PSMv2 was running before */ |
3290 | reg = sky2_pci_read16(hw, PSM_CONFIG_REG3); | 3306 | reg = sky2_pci_read16(hw, PSM_CONFIG_REG3); |
3291 | if (reg & PCI_EXP_LNKCTL_ASPMC) | 3307 | if (reg & PCI_EXP_LNKCTL_ASPMC) |
@@ -3383,7 +3399,7 @@ static void sky2_detach(struct net_device *dev) | |||
3383 | netif_tx_lock(dev); | 3399 | netif_tx_lock(dev); |
3384 | netif_device_detach(dev); /* stop txq */ | 3400 | netif_device_detach(dev); /* stop txq */ |
3385 | netif_tx_unlock(dev); | 3401 | netif_tx_unlock(dev); |
3386 | sky2_down(dev); | 3402 | sky2_close(dev); |
3387 | } | 3403 | } |
3388 | } | 3404 | } |
3389 | 3405 | ||
@@ -3393,7 +3409,7 @@ static int sky2_reattach(struct net_device *dev) | |||
3393 | int err = 0; | 3409 | int err = 0; |
3394 | 3410 | ||
3395 | if (netif_running(dev)) { | 3411 | if (netif_running(dev)) { |
3396 | err = sky2_up(dev); | 3412 | err = sky2_open(dev); |
3397 | if (err) { | 3413 | if (err) { |
3398 | netdev_info(dev, "could not restart %d\n", err); | 3414 | netdev_info(dev, "could not restart %d\n", err); |
3399 | dev_close(dev); | 3415 | dev_close(dev); |
@@ -3410,10 +3426,13 @@ static void sky2_all_down(struct sky2_hw *hw) | |||
3410 | { | 3426 | { |
3411 | int i; | 3427 | int i; |
3412 | 3428 | ||
3413 | sky2_read32(hw, B0_IMSK); | 3429 | if (hw->flags & SKY2_HW_IRQ_SETUP) { |
3414 | sky2_write32(hw, B0_IMSK, 0); | 3430 | sky2_read32(hw, B0_IMSK); |
3415 | synchronize_irq(hw->pdev->irq); | 3431 | sky2_write32(hw, B0_IMSK, 0); |
3416 | napi_disable(&hw->napi); | 3432 | |
3433 | synchronize_irq(hw->pdev->irq); | ||
3434 | napi_disable(&hw->napi); | ||
3435 | } | ||
3417 | 3436 | ||
3418 | for (i = 0; i < hw->ports; i++) { | 3437 | for (i = 0; i < hw->ports; i++) { |
3419 | struct net_device *dev = hw->dev[i]; | 3438 | struct net_device *dev = hw->dev[i]; |
@@ -3446,11 +3465,12 @@ static void sky2_all_up(struct sky2_hw *hw) | |||
3446 | netif_wake_queue(dev); | 3465 | netif_wake_queue(dev); |
3447 | } | 3466 | } |
3448 | 3467 | ||
3449 | sky2_write32(hw, B0_IMSK, imask); | 3468 | if (hw->flags & SKY2_HW_IRQ_SETUP) { |
3450 | sky2_read32(hw, B0_IMSK); | 3469 | sky2_write32(hw, B0_IMSK, imask); |
3451 | 3470 | sky2_read32(hw, B0_IMSK); | |
3452 | sky2_read32(hw, B0_Y2_SP_LISR); | 3471 | sky2_read32(hw, B0_Y2_SP_LISR); |
3453 | napi_enable(&hw->napi); | 3472 | napi_enable(&hw->napi); |
3473 | } | ||
3454 | } | 3474 | } |
3455 | 3475 | ||
3456 | static void sky2_restart(struct work_struct *work) | 3476 | static void sky2_restart(struct work_struct *work) |
@@ -4071,6 +4091,16 @@ static int sky2_set_coalesce(struct net_device *dev, | |||
4071 | return 0; | 4091 | return 0; |
4072 | } | 4092 | } |
4073 | 4093 | ||
4094 | /* | ||
4095 | * Hardware is limited to min of 128 and max of 2048 for ring size | ||
4096 | * and rounded up to next power of two | ||
4097 | * to avoid division in modulus calclation | ||
4098 | */ | ||
4099 | static unsigned long roundup_ring_size(unsigned long pending) | ||
4100 | { | ||
4101 | return max(128ul, roundup_pow_of_two(pending+1)); | ||
4102 | } | ||
4103 | |||
4074 | static void sky2_get_ringparam(struct net_device *dev, | 4104 | static void sky2_get_ringparam(struct net_device *dev, |
4075 | struct ethtool_ringparam *ering) | 4105 | struct ethtool_ringparam *ering) |
4076 | { | 4106 | { |
@@ -4098,7 +4128,7 @@ static int sky2_set_ringparam(struct net_device *dev, | |||
4098 | 4128 | ||
4099 | sky2->rx_pending = ering->rx_pending; | 4129 | sky2->rx_pending = ering->rx_pending; |
4100 | sky2->tx_pending = ering->tx_pending; | 4130 | sky2->tx_pending = ering->tx_pending; |
4101 | sky2->tx_ring_size = roundup_pow_of_two(sky2->tx_pending+1); | 4131 | sky2->tx_ring_size = roundup_ring_size(sky2->tx_pending); |
4102 | 4132 | ||
4103 | return sky2_reattach(dev); | 4133 | return sky2_reattach(dev); |
4104 | } | 4134 | } |
@@ -4556,7 +4586,7 @@ static int sky2_device_event(struct notifier_block *unused, | |||
4556 | struct net_device *dev = ptr; | 4586 | struct net_device *dev = ptr; |
4557 | struct sky2_port *sky2 = netdev_priv(dev); | 4587 | struct sky2_port *sky2 = netdev_priv(dev); |
4558 | 4588 | ||
4559 | if (dev->netdev_ops->ndo_open != sky2_up || !sky2_debug) | 4589 | if (dev->netdev_ops->ndo_open != sky2_open || !sky2_debug) |
4560 | return NOTIFY_DONE; | 4590 | return NOTIFY_DONE; |
4561 | 4591 | ||
4562 | switch (event) { | 4592 | switch (event) { |
@@ -4621,8 +4651,8 @@ static __exit void sky2_debug_cleanup(void) | |||
4621 | not allowing netpoll on second port */ | 4651 | not allowing netpoll on second port */ |
4622 | static const struct net_device_ops sky2_netdev_ops[2] = { | 4652 | static const struct net_device_ops sky2_netdev_ops[2] = { |
4623 | { | 4653 | { |
4624 | .ndo_open = sky2_up, | 4654 | .ndo_open = sky2_open, |
4625 | .ndo_stop = sky2_down, | 4655 | .ndo_stop = sky2_close, |
4626 | .ndo_start_xmit = sky2_xmit_frame, | 4656 | .ndo_start_xmit = sky2_xmit_frame, |
4627 | .ndo_do_ioctl = sky2_ioctl, | 4657 | .ndo_do_ioctl = sky2_ioctl, |
4628 | .ndo_validate_addr = eth_validate_addr, | 4658 | .ndo_validate_addr = eth_validate_addr, |
@@ -4638,8 +4668,8 @@ static const struct net_device_ops sky2_netdev_ops[2] = { | |||
4638 | #endif | 4668 | #endif |
4639 | }, | 4669 | }, |
4640 | { | 4670 | { |
4641 | .ndo_open = sky2_up, | 4671 | .ndo_open = sky2_open, |
4642 | .ndo_stop = sky2_down, | 4672 | .ndo_stop = sky2_close, |
4643 | .ndo_start_xmit = sky2_xmit_frame, | 4673 | .ndo_start_xmit = sky2_xmit_frame, |
4644 | .ndo_do_ioctl = sky2_ioctl, | 4674 | .ndo_do_ioctl = sky2_ioctl, |
4645 | .ndo_validate_addr = eth_validate_addr, | 4675 | .ndo_validate_addr = eth_validate_addr, |
@@ -4692,7 +4722,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
4692 | spin_lock_init(&sky2->phy_lock); | 4722 | spin_lock_init(&sky2->phy_lock); |
4693 | 4723 | ||
4694 | sky2->tx_pending = TX_DEF_PENDING; | 4724 | sky2->tx_pending = TX_DEF_PENDING; |
4695 | sky2->tx_ring_size = roundup_pow_of_two(TX_DEF_PENDING+1); | 4725 | sky2->tx_ring_size = roundup_ring_size(TX_DEF_PENDING); |
4696 | sky2->rx_pending = RX_DEF_PENDING; | 4726 | sky2->rx_pending = RX_DEF_PENDING; |
4697 | 4727 | ||
4698 | hw->dev[port] = dev; | 4728 | hw->dev[port] = dev; |
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h index 0af31b8b5f10..ff6f58bf822a 100644 --- a/drivers/net/ethernet/marvell/sky2.h +++ b/drivers/net/ethernet/marvell/sky2.h | |||
@@ -2287,6 +2287,7 @@ struct sky2_hw { | |||
2287 | #define SKY2_HW_RSS_BROKEN 0x00000100 | 2287 | #define SKY2_HW_RSS_BROKEN 0x00000100 |
2288 | #define SKY2_HW_VLAN_BROKEN 0x00000200 | 2288 | #define SKY2_HW_VLAN_BROKEN 0x00000200 |
2289 | #define SKY2_HW_RSS_CHKSUM 0x00000400 /* RSS requires chksum */ | 2289 | #define SKY2_HW_RSS_CHKSUM 0x00000400 /* RSS requires chksum */ |
2290 | #define SKY2_HW_IRQ_SETUP 0x00000800 | ||
2290 | 2291 | ||
2291 | u8 chip_id; | 2292 | u8 chip_id; |
2292 | u8 chip_rev; | 2293 | u8 chip_rev; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index b89c36dbf5b3..c2df6c358603 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
@@ -581,6 +581,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud | |||
581 | * Packet is OK - process it. | 581 | * Packet is OK - process it. |
582 | */ | 582 | */ |
583 | length = be32_to_cpu(cqe->byte_cnt); | 583 | length = be32_to_cpu(cqe->byte_cnt); |
584 | length -= ring->fcs_del; | ||
584 | ring->bytes += length; | 585 | ring->bytes += length; |
585 | ring->packets++; | 586 | ring->packets++; |
586 | 587 | ||
@@ -813,8 +814,11 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn, | |||
813 | context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma); | 814 | context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma); |
814 | 815 | ||
815 | /* Cancel FCS removal if FW allows */ | 816 | /* Cancel FCS removal if FW allows */ |
816 | if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP) | 817 | if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP) { |
817 | context->param3 |= cpu_to_be32(1 << 29); | 818 | context->param3 |= cpu_to_be32(1 << 29); |
819 | ring->fcs_del = ETH_FCS_LEN; | ||
820 | } else | ||
821 | ring->fcs_del = 0; | ||
818 | 822 | ||
819 | err = mlx4_qp_to_ready(mdev->dev, &ring->wqres.mtt, context, qp, state); | 823 | err = mlx4_qp_to_ready(mdev->dev, &ring->wqres.mtt, context, qp, state); |
820 | if (err) { | 824 | if (err) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 8fda331c65df..207b5add3ca8 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -272,6 +272,7 @@ struct mlx4_en_rx_ring { | |||
272 | u32 prod; | 272 | u32 prod; |
273 | u32 cons; | 273 | u32 cons; |
274 | u32 buf_size; | 274 | u32 buf_size; |
275 | u8 fcs_del; | ||
275 | void *buf; | 276 | void *buf; |
276 | void *rx_info; | 277 | void *rx_info; |
277 | unsigned long bytes; | 278 | unsigned long bytes; |
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 1dca57013cb2..1c61d36e6570 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c | |||
@@ -609,7 +609,7 @@ struct nv_ethtool_str { | |||
609 | }; | 609 | }; |
610 | 610 | ||
611 | static const struct nv_ethtool_str nv_estats_str[] = { | 611 | static const struct nv_ethtool_str nv_estats_str[] = { |
612 | { "tx_bytes" }, | 612 | { "tx_bytes" }, /* includes Ethernet FCS CRC */ |
613 | { "tx_zero_rexmt" }, | 613 | { "tx_zero_rexmt" }, |
614 | { "tx_one_rexmt" }, | 614 | { "tx_one_rexmt" }, |
615 | { "tx_many_rexmt" }, | 615 | { "tx_many_rexmt" }, |
@@ -637,7 +637,7 @@ static const struct nv_ethtool_str nv_estats_str[] = { | |||
637 | /* version 2 stats */ | 637 | /* version 2 stats */ |
638 | { "tx_deferral" }, | 638 | { "tx_deferral" }, |
639 | { "tx_packets" }, | 639 | { "tx_packets" }, |
640 | { "rx_bytes" }, | 640 | { "rx_bytes" }, /* includes Ethernet FCS CRC */ |
641 | { "tx_pause" }, | 641 | { "tx_pause" }, |
642 | { "rx_pause" }, | 642 | { "rx_pause" }, |
643 | { "rx_drop_frame" }, | 643 | { "rx_drop_frame" }, |
@@ -649,7 +649,7 @@ static const struct nv_ethtool_str nv_estats_str[] = { | |||
649 | }; | 649 | }; |
650 | 650 | ||
651 | struct nv_ethtool_stats { | 651 | struct nv_ethtool_stats { |
652 | u64 tx_bytes; | 652 | u64 tx_bytes; /* should be ifconfig->tx_bytes + 4*tx_packets */ |
653 | u64 tx_zero_rexmt; | 653 | u64 tx_zero_rexmt; |
654 | u64 tx_one_rexmt; | 654 | u64 tx_one_rexmt; |
655 | u64 tx_many_rexmt; | 655 | u64 tx_many_rexmt; |
@@ -670,14 +670,14 @@ struct nv_ethtool_stats { | |||
670 | u64 rx_unicast; | 670 | u64 rx_unicast; |
671 | u64 rx_multicast; | 671 | u64 rx_multicast; |
672 | u64 rx_broadcast; | 672 | u64 rx_broadcast; |
673 | u64 rx_packets; | 673 | u64 rx_packets; /* should be ifconfig->rx_packets */ |
674 | u64 rx_errors_total; | 674 | u64 rx_errors_total; |
675 | u64 tx_errors_total; | 675 | u64 tx_errors_total; |
676 | 676 | ||
677 | /* version 2 stats */ | 677 | /* version 2 stats */ |
678 | u64 tx_deferral; | 678 | u64 tx_deferral; |
679 | u64 tx_packets; | 679 | u64 tx_packets; /* should be ifconfig->tx_packets */ |
680 | u64 rx_bytes; | 680 | u64 rx_bytes; /* should be ifconfig->rx_bytes + 4*rx_packets */ |
681 | u64 tx_pause; | 681 | u64 tx_pause; |
682 | u64 rx_pause; | 682 | u64 rx_pause; |
683 | u64 rx_drop_frame; | 683 | u64 rx_drop_frame; |
@@ -1706,10 +1706,17 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev) | |||
1706 | if (np->driver_data & (DEV_HAS_STATISTICS_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_STATISTICS_V3)) { | 1706 | if (np->driver_data & (DEV_HAS_STATISTICS_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_STATISTICS_V3)) { |
1707 | nv_get_hw_stats(dev); | 1707 | nv_get_hw_stats(dev); |
1708 | 1708 | ||
1709 | /* | ||
1710 | * Note: because HW stats are not always available and | ||
1711 | * for consistency reasons, the following ifconfig | ||
1712 | * stats are managed by software: rx_bytes, tx_bytes, | ||
1713 | * rx_packets and tx_packets. The related hardware | ||
1714 | * stats reported by ethtool should be equivalent to | ||
1715 | * these ifconfig stats, with 4 additional bytes per | ||
1716 | * packet (Ethernet FCS CRC). | ||
1717 | */ | ||
1718 | |||
1709 | /* copy to net_device stats */ | 1719 | /* copy to net_device stats */ |
1710 | dev->stats.tx_packets = np->estats.tx_packets; | ||
1711 | dev->stats.rx_bytes = np->estats.rx_bytes; | ||
1712 | dev->stats.tx_bytes = np->estats.tx_bytes; | ||
1713 | dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors; | 1720 | dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors; |
1714 | dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors; | 1721 | dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors; |
1715 | dev->stats.rx_crc_errors = np->estats.rx_crc_errors; | 1722 | dev->stats.rx_crc_errors = np->estats.rx_crc_errors; |
@@ -2380,6 +2387,9 @@ static int nv_tx_done(struct net_device *dev, int limit) | |||
2380 | if (flags & NV_TX_ERROR) { | 2387 | if (flags & NV_TX_ERROR) { |
2381 | if ((flags & NV_TX_RETRYERROR) && !(flags & NV_TX_RETRYCOUNT_MASK)) | 2388 | if ((flags & NV_TX_RETRYERROR) && !(flags & NV_TX_RETRYCOUNT_MASK)) |
2382 | nv_legacybackoff_reseed(dev); | 2389 | nv_legacybackoff_reseed(dev); |
2390 | } else { | ||
2391 | dev->stats.tx_packets++; | ||
2392 | dev->stats.tx_bytes += np->get_tx_ctx->skb->len; | ||
2383 | } | 2393 | } |
2384 | dev_kfree_skb_any(np->get_tx_ctx->skb); | 2394 | dev_kfree_skb_any(np->get_tx_ctx->skb); |
2385 | np->get_tx_ctx->skb = NULL; | 2395 | np->get_tx_ctx->skb = NULL; |
@@ -2390,6 +2400,9 @@ static int nv_tx_done(struct net_device *dev, int limit) | |||
2390 | if (flags & NV_TX2_ERROR) { | 2400 | if (flags & NV_TX2_ERROR) { |
2391 | if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) | 2401 | if ((flags & NV_TX2_RETRYERROR) && !(flags & NV_TX2_RETRYCOUNT_MASK)) |
2392 | nv_legacybackoff_reseed(dev); | 2402 | nv_legacybackoff_reseed(dev); |
2403 | } else { | ||
2404 | dev->stats.tx_packets++; | ||
2405 | dev->stats.tx_bytes += np->get_tx_ctx->skb->len; | ||
2393 | } | 2406 | } |
2394 | dev_kfree_skb_any(np->get_tx_ctx->skb); | 2407 | dev_kfree_skb_any(np->get_tx_ctx->skb); |
2395 | np->get_tx_ctx->skb = NULL; | 2408 | np->get_tx_ctx->skb = NULL; |
@@ -2429,6 +2442,9 @@ static int nv_tx_done_optimized(struct net_device *dev, int limit) | |||
2429 | else | 2442 | else |
2430 | nv_legacybackoff_reseed(dev); | 2443 | nv_legacybackoff_reseed(dev); |
2431 | } | 2444 | } |
2445 | } else { | ||
2446 | dev->stats.tx_packets++; | ||
2447 | dev->stats.tx_bytes += np->get_tx_ctx->skb->len; | ||
2432 | } | 2448 | } |
2433 | 2449 | ||
2434 | dev_kfree_skb_any(np->get_tx_ctx->skb); | 2450 | dev_kfree_skb_any(np->get_tx_ctx->skb); |
@@ -2678,6 +2694,7 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2678 | skb->protocol = eth_type_trans(skb, dev); | 2694 | skb->protocol = eth_type_trans(skb, dev); |
2679 | napi_gro_receive(&np->napi, skb); | 2695 | napi_gro_receive(&np->napi, skb); |
2680 | dev->stats.rx_packets++; | 2696 | dev->stats.rx_packets++; |
2697 | dev->stats.rx_bytes += len; | ||
2681 | next_pkt: | 2698 | next_pkt: |
2682 | if (unlikely(np->get_rx.orig++ == np->last_rx.orig)) | 2699 | if (unlikely(np->get_rx.orig++ == np->last_rx.orig)) |
2683 | np->get_rx.orig = np->first_rx.orig; | 2700 | np->get_rx.orig = np->first_rx.orig; |
@@ -2761,6 +2778,7 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit) | |||
2761 | } | 2778 | } |
2762 | napi_gro_receive(&np->napi, skb); | 2779 | napi_gro_receive(&np->napi, skb); |
2763 | dev->stats.rx_packets++; | 2780 | dev->stats.rx_packets++; |
2781 | dev->stats.rx_bytes += len; | ||
2764 | } else { | 2782 | } else { |
2765 | dev_kfree_skb(skb); | 2783 | dev_kfree_skb(skb); |
2766 | } | 2784 | } |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c index 9c075ea2682e..9cb5f912e489 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c | |||
@@ -18,8 +18,8 @@ | |||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/module.h> /* for __MODULE_STRING */ | ||
22 | #include "pch_gbe.h" | 21 | #include "pch_gbe.h" |
22 | #include <linux/module.h> /* for __MODULE_STRING */ | ||
23 | 23 | ||
24 | #define OPTION_UNSET -1 | 24 | #define OPTION_UNSET -1 |
25 | #define OPTION_DISABLED 0 | 25 | #define OPTION_DISABLED 0 |
diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c index 1fc01ca72b46..4bf68cfef390 100644 --- a/drivers/net/ethernet/rdc/r6040.c +++ b/drivers/net/ethernet/rdc/r6040.c | |||
@@ -940,7 +940,7 @@ static void r6040_multicast_list(struct net_device *dev) | |||
940 | iowrite16(lp->mcr0, ioaddr + MCR0); | 940 | iowrite16(lp->mcr0, ioaddr + MCR0); |
941 | 941 | ||
942 | /* Fill the MAC hash tables with their values */ | 942 | /* Fill the MAC hash tables with their values */ |
943 | if (lp->mcr0 && MCR0_HASH_EN) { | 943 | if (lp->mcr0 & MCR0_HASH_EN) { |
944 | iowrite16(hash_table[0], ioaddr + MAR0); | 944 | iowrite16(hash_table[0], ioaddr + MAR0); |
945 | iowrite16(hash_table[1], ioaddr + MAR1); | 945 | iowrite16(hash_table[1], ioaddr + MAR1); |
946 | iowrite16(hash_table[2], ioaddr + MAR2); | 946 | iowrite16(hash_table[2], ioaddr + MAR2); |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 92b45f08858f..6f06aa10f0d7 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -1292,7 +1292,7 @@ static void __rtl8169_check_link_status(struct net_device *dev, | |||
1292 | netif_carrier_off(dev); | 1292 | netif_carrier_off(dev); |
1293 | netif_info(tp, ifdown, dev, "link down\n"); | 1293 | netif_info(tp, ifdown, dev, "link down\n"); |
1294 | if (pm) | 1294 | if (pm) |
1295 | pm_schedule_suspend(&tp->pci_dev->dev, 100); | 1295 | pm_schedule_suspend(&tp->pci_dev->dev, 5000); |
1296 | } | 1296 | } |
1297 | spin_unlock_irqrestore(&tp->lock, flags); | 1297 | spin_unlock_irqrestore(&tp->lock, flags); |
1298 | } | 1298 | } |
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index d2be42aafbef..8843071fe987 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -1937,6 +1937,7 @@ static int __devinit smsc911x_init(struct net_device *dev) | |||
1937 | { | 1937 | { |
1938 | struct smsc911x_data *pdata = netdev_priv(dev); | 1938 | struct smsc911x_data *pdata = netdev_priv(dev); |
1939 | unsigned int byte_test; | 1939 | unsigned int byte_test; |
1940 | unsigned int to = 100; | ||
1940 | 1941 | ||
1941 | SMSC_TRACE(pdata, probe, "Driver Parameters:"); | 1942 | SMSC_TRACE(pdata, probe, "Driver Parameters:"); |
1942 | SMSC_TRACE(pdata, probe, "LAN base: 0x%08lX", | 1943 | SMSC_TRACE(pdata, probe, "LAN base: 0x%08lX", |
@@ -1952,6 +1953,17 @@ static int __devinit smsc911x_init(struct net_device *dev) | |||
1952 | return -ENODEV; | 1953 | return -ENODEV; |
1953 | } | 1954 | } |
1954 | 1955 | ||
1956 | /* | ||
1957 | * poll the READY bit in PMT_CTRL. Any other access to the device is | ||
1958 | * forbidden while this bit isn't set. Try for 100ms | ||
1959 | */ | ||
1960 | while (!(smsc911x_reg_read(pdata, PMT_CTRL) & PMT_CTRL_READY_) && --to) | ||
1961 | udelay(1000); | ||
1962 | if (to == 0) { | ||
1963 | pr_err("Device not READY in 100ms aborting\n"); | ||
1964 | return -ENODEV; | ||
1965 | } | ||
1966 | |||
1955 | /* Check byte ordering */ | 1967 | /* Check byte ordering */ |
1956 | byte_test = smsc911x_reg_read(pdata, BYTE_TEST); | 1968 | byte_test = smsc911x_reg_read(pdata, BYTE_TEST); |
1957 | SMSC_TRACE(pdata, probe, "BYTE_TEST: 0x%08X", byte_test); | 1969 | SMSC_TRACE(pdata, probe, "BYTE_TEST: 0x%08X", byte_test); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c index da66ac511c4c..4d5402a1d262 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c | |||
@@ -39,10 +39,11 @@ static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, u32 dma_tx, | |||
39 | /* DMA SW reset */ | 39 | /* DMA SW reset */ |
40 | value |= DMA_BUS_MODE_SFT_RESET; | 40 | value |= DMA_BUS_MODE_SFT_RESET; |
41 | writel(value, ioaddr + DMA_BUS_MODE); | 41 | writel(value, ioaddr + DMA_BUS_MODE); |
42 | limit = 15000; | 42 | limit = 10; |
43 | while (limit--) { | 43 | while (limit--) { |
44 | if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)) | 44 | if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)) |
45 | break; | 45 | break; |
46 | mdelay(10); | ||
46 | } | 47 | } |
47 | if (limit < 0) | 48 | if (limit < 0) |
48 | return -EBUSY; | 49 | return -EBUSY; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c index 627f656b0f3c..bc17fd08b55d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c | |||
@@ -41,10 +41,11 @@ static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, u32 dma_tx, | |||
41 | /* DMA SW reset */ | 41 | /* DMA SW reset */ |
42 | value |= DMA_BUS_MODE_SFT_RESET; | 42 | value |= DMA_BUS_MODE_SFT_RESET; |
43 | writel(value, ioaddr + DMA_BUS_MODE); | 43 | writel(value, ioaddr + DMA_BUS_MODE); |
44 | limit = 15000; | 44 | limit = 10; |
45 | while (limit--) { | 45 | while (limit--) { |
46 | if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)) | 46 | if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)) |
47 | break; | 47 | break; |
48 | mdelay(10); | ||
48 | } | 49 | } |
49 | if (limit < 0) | 50 | if (limit < 0) |
50 | return -EBUSY; | 51 | return -EBUSY; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 9bafa6cf9e8b..a140a8fbf051 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
@@ -72,7 +72,6 @@ struct stmmac_priv { | |||
72 | spinlock_t lock; | 72 | spinlock_t lock; |
73 | spinlock_t tx_lock; | 73 | spinlock_t tx_lock; |
74 | int wolopts; | 74 | int wolopts; |
75 | int wolenabled; | ||
76 | int wol_irq; | 75 | int wol_irq; |
77 | #ifdef CONFIG_STMMAC_TIMER | 76 | #ifdef CONFIG_STMMAC_TIMER |
78 | struct stmmac_timer *tm; | 77 | struct stmmac_timer *tm; |
@@ -80,6 +79,7 @@ struct stmmac_priv { | |||
80 | struct plat_stmmacenet_data *plat; | 79 | struct plat_stmmacenet_data *plat; |
81 | struct stmmac_counters mmc; | 80 | struct stmmac_counters mmc; |
82 | struct dma_features dma_cap; | 81 | struct dma_features dma_cap; |
82 | int hw_cap_support; | ||
83 | }; | 83 | }; |
84 | 84 | ||
85 | extern int stmmac_mdio_unregister(struct net_device *ndev); | 85 | extern int stmmac_mdio_unregister(struct net_device *ndev); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index e8eff09bbbd7..0395f9eba801 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | |||
@@ -430,6 +430,12 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
430 | struct stmmac_priv *priv = netdev_priv(dev); | 430 | struct stmmac_priv *priv = netdev_priv(dev); |
431 | u32 support = WAKE_MAGIC | WAKE_UCAST; | 431 | u32 support = WAKE_MAGIC | WAKE_UCAST; |
432 | 432 | ||
433 | /* By default almost all GMAC devices support the WoL via | ||
434 | * magic frame but we can disable it if the HW capability | ||
435 | * register shows no support for pmt_magic_frame. */ | ||
436 | if ((priv->hw_cap_support) && (!priv->dma_cap.pmt_magic_frame)) | ||
437 | wol->wolopts &= ~WAKE_MAGIC; | ||
438 | |||
433 | if (!device_can_wakeup(priv->device)) | 439 | if (!device_can_wakeup(priv->device)) |
434 | return -EINVAL; | 440 | return -EINVAL; |
435 | 441 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 20546bbbb8db..8ea770a89f25 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -321,12 +321,10 @@ static int stmmac_init_phy(struct net_device *dev) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | /* Stop Advertising 1000BASE Capability if interface is not GMII */ | 323 | /* Stop Advertising 1000BASE Capability if interface is not GMII */ |
324 | if ((interface) && ((interface == PHY_INTERFACE_MODE_MII) || | 324 | if ((interface == PHY_INTERFACE_MODE_MII) || |
325 | (interface == PHY_INTERFACE_MODE_RMII))) { | 325 | (interface == PHY_INTERFACE_MODE_RMII)) |
326 | phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause | | 326 | phydev->advertising &= ~(SUPPORTED_1000baseT_Half | |
327 | SUPPORTED_Asym_Pause); | 327 | SUPPORTED_1000baseT_Full); |
328 | phydev->advertising = phydev->supported; | ||
329 | } | ||
330 | 328 | ||
331 | /* | 329 | /* |
332 | * Broken HW is sometimes missing the pull-up resistor on the | 330 | * Broken HW is sometimes missing the pull-up resistor on the |
@@ -807,8 +805,29 @@ static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv) | |||
807 | return 0; | 805 | return 0; |
808 | } | 806 | } |
809 | 807 | ||
810 | /* New GMAC chips support a new register to indicate the | 808 | /** |
811 | * presence of the optional feature/functions. | 809 | * stmmac_selec_desc_mode |
810 | * @dev : device pointer | ||
811 | * Description: select the Enhanced/Alternate or Normal descriptors */ | ||
812 | static void stmmac_selec_desc_mode(struct stmmac_priv *priv) | ||
813 | { | ||
814 | if (priv->plat->enh_desc) { | ||
815 | pr_info(" Enhanced/Alternate descriptors\n"); | ||
816 | priv->hw->desc = &enh_desc_ops; | ||
817 | } else { | ||
818 | pr_info(" Normal descriptors\n"); | ||
819 | priv->hw->desc = &ndesc_ops; | ||
820 | } | ||
821 | } | ||
822 | |||
823 | /** | ||
824 | * stmmac_get_hw_features | ||
825 | * @priv : private device pointer | ||
826 | * Description: | ||
827 | * new GMAC chip generations have a new register to indicate the | ||
828 | * presence of the optional feature/functions. | ||
829 | * This can be also used to override the value passed through the | ||
830 | * platform and necessary for old MAC10/100 and GMAC chips. | ||
812 | */ | 831 | */ |
813 | static int stmmac_get_hw_features(struct stmmac_priv *priv) | 832 | static int stmmac_get_hw_features(struct stmmac_priv *priv) |
814 | { | 833 | { |
@@ -829,7 +848,7 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv) | |||
829 | (hw_cap & DMA_HW_FEAT_RWKSEL) >> 9; | 848 | (hw_cap & DMA_HW_FEAT_RWKSEL) >> 9; |
830 | priv->dma_cap.pmt_magic_frame = | 849 | priv->dma_cap.pmt_magic_frame = |
831 | (hw_cap & DMA_HW_FEAT_MGKSEL) >> 10; | 850 | (hw_cap & DMA_HW_FEAT_MGKSEL) >> 10; |
832 | /*MMC*/ | 851 | /* MMC */ |
833 | priv->dma_cap.rmon = (hw_cap & DMA_HW_FEAT_MMCSEL) >> 11; | 852 | priv->dma_cap.rmon = (hw_cap & DMA_HW_FEAT_MMCSEL) >> 11; |
834 | /* IEEE 1588-2002*/ | 853 | /* IEEE 1588-2002*/ |
835 | priv->dma_cap.time_stamp = | 854 | priv->dma_cap.time_stamp = |
@@ -857,8 +876,7 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv) | |||
857 | priv->dma_cap.enh_desc = | 876 | priv->dma_cap.enh_desc = |
858 | (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24; | 877 | (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24; |
859 | 878 | ||
860 | } else | 879 | } |
861 | pr_debug("\tNo HW DMA feature register supported"); | ||
862 | 880 | ||
863 | return hw_cap; | 881 | return hw_cap; |
864 | } | 882 | } |
@@ -913,6 +931,44 @@ static int stmmac_open(struct net_device *dev) | |||
913 | goto open_error; | 931 | goto open_error; |
914 | } | 932 | } |
915 | 933 | ||
934 | stmmac_get_synopsys_id(priv); | ||
935 | |||
936 | priv->hw_cap_support = stmmac_get_hw_features(priv); | ||
937 | |||
938 | if (priv->hw_cap_support) { | ||
939 | pr_info(" Support DMA HW capability register"); | ||
940 | |||
941 | /* We can override some gmac/dma configuration fields: e.g. | ||
942 | * enh_desc, tx_coe (e.g. that are passed through the | ||
943 | * platform) with the values from the HW capability | ||
944 | * register (if supported). | ||
945 | */ | ||
946 | priv->plat->enh_desc = priv->dma_cap.enh_desc; | ||
947 | priv->plat->tx_coe = priv->dma_cap.tx_coe; | ||
948 | priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up; | ||
949 | |||
950 | /* By default disable wol on magic frame if not supported */ | ||
951 | if (!priv->dma_cap.pmt_magic_frame) | ||
952 | priv->wolopts &= ~WAKE_MAGIC; | ||
953 | |||
954 | } else | ||
955 | pr_info(" No HW DMA feature register supported"); | ||
956 | |||
957 | /* Select the enhnaced/normal descriptor structures */ | ||
958 | stmmac_selec_desc_mode(priv); | ||
959 | |||
960 | /* PMT module is not integrated in all the MAC devices. */ | ||
961 | if (priv->plat->pmt) { | ||
962 | pr_info(" Remote wake-up capable\n"); | ||
963 | device_set_wakeup_capable(priv->device, 1); | ||
964 | } | ||
965 | |||
966 | priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr); | ||
967 | if (priv->rx_coe) | ||
968 | pr_info(" Checksum Offload Engine supported\n"); | ||
969 | if (priv->plat->tx_coe) | ||
970 | pr_info(" Checksum insertion supported\n"); | ||
971 | |||
916 | /* Create and initialize the TX/RX descriptors chains. */ | 972 | /* Create and initialize the TX/RX descriptors chains. */ |
917 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); | 973 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); |
918 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); | 974 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); |
@@ -935,15 +991,6 @@ static int stmmac_open(struct net_device *dev) | |||
935 | /* Initialize the MAC Core */ | 991 | /* Initialize the MAC Core */ |
936 | priv->hw->mac->core_init(priv->ioaddr); | 992 | priv->hw->mac->core_init(priv->ioaddr); |
937 | 993 | ||
938 | stmmac_get_synopsys_id(priv); | ||
939 | |||
940 | stmmac_get_hw_features(priv); | ||
941 | |||
942 | priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr); | ||
943 | if (priv->rx_coe) | ||
944 | pr_info("stmmac: Rx Checksum Offload Engine supported\n"); | ||
945 | if (priv->plat->tx_coe) | ||
946 | pr_info("\tTX Checksum insertion supported\n"); | ||
947 | netdev_update_features(dev); | 994 | netdev_update_features(dev); |
948 | 995 | ||
949 | /* Request the IRQ lines */ | 996 | /* Request the IRQ lines */ |
@@ -1489,9 +1536,7 @@ static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1489 | if (!priv->phydev) | 1536 | if (!priv->phydev) |
1490 | return -EINVAL; | 1537 | return -EINVAL; |
1491 | 1538 | ||
1492 | spin_lock(&priv->lock); | ||
1493 | ret = phy_mii_ioctl(priv->phydev, rq, cmd); | 1539 | ret = phy_mii_ioctl(priv->phydev, rq, cmd); |
1494 | spin_unlock(&priv->lock); | ||
1495 | 1540 | ||
1496 | return ret; | 1541 | return ret; |
1497 | } | 1542 | } |
@@ -1558,7 +1603,7 @@ static int stmmac_sysfs_dma_cap_read(struct seq_file *seq, void *v) | |||
1558 | struct net_device *dev = seq->private; | 1603 | struct net_device *dev = seq->private; |
1559 | struct stmmac_priv *priv = netdev_priv(dev); | 1604 | struct stmmac_priv *priv = netdev_priv(dev); |
1560 | 1605 | ||
1561 | if (!stmmac_get_hw_features(priv)) { | 1606 | if (!priv->hw_cap_support) { |
1562 | seq_printf(seq, "DMA HW features not supported\n"); | 1607 | seq_printf(seq, "DMA HW features not supported\n"); |
1563 | return 0; | 1608 | return 0; |
1564 | } | 1609 | } |
@@ -1766,12 +1811,6 @@ static int stmmac_mac_device_setup(struct net_device *dev) | |||
1766 | if (!device) | 1811 | if (!device) |
1767 | return -ENOMEM; | 1812 | return -ENOMEM; |
1768 | 1813 | ||
1769 | if (priv->plat->enh_desc) { | ||
1770 | device->desc = &enh_desc_ops; | ||
1771 | pr_info("\tEnhanced descriptor structure\n"); | ||
1772 | } else | ||
1773 | device->desc = &ndesc_ops; | ||
1774 | |||
1775 | priv->hw = device; | 1814 | priv->hw = device; |
1776 | priv->hw->ring = &ring_mode_ops; | 1815 | priv->hw->ring = &ring_mode_ops; |
1777 | 1816 | ||
@@ -1845,11 +1884,6 @@ static int stmmac_dvr_probe(struct platform_device *pdev) | |||
1845 | 1884 | ||
1846 | priv->ioaddr = addr; | 1885 | priv->ioaddr = addr; |
1847 | 1886 | ||
1848 | /* PMT module is not integrated in all the MAC devices. */ | ||
1849 | if (plat_dat->pmt) { | ||
1850 | pr_info("\tPMT module supported\n"); | ||
1851 | device_set_wakeup_capable(&pdev->dev, 1); | ||
1852 | } | ||
1853 | /* | 1887 | /* |
1854 | * On some platforms e.g. SPEAr the wake up irq differs from the mac irq | 1888 | * On some platforms e.g. SPEAr the wake up irq differs from the mac irq |
1855 | * The external wake up irq can be passed through the platform code | 1889 | * The external wake up irq can be passed through the platform code |
@@ -1862,7 +1896,6 @@ static int stmmac_dvr_probe(struct platform_device *pdev) | |||
1862 | if (priv->wol_irq == -ENXIO) | 1896 | if (priv->wol_irq == -ENXIO) |
1863 | priv->wol_irq = ndev->irq; | 1897 | priv->wol_irq = ndev->irq; |
1864 | 1898 | ||
1865 | |||
1866 | platform_set_drvdata(pdev, ndev); | 1899 | platform_set_drvdata(pdev, ndev); |
1867 | 1900 | ||
1868 | /* Set the I/O base addr */ | 1901 | /* Set the I/O base addr */ |
@@ -1875,7 +1908,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev) | |||
1875 | goto out_free_ndev; | 1908 | goto out_free_ndev; |
1876 | } | 1909 | } |
1877 | 1910 | ||
1878 | /* MAC HW revice detection */ | 1911 | /* MAC HW device detection */ |
1879 | ret = stmmac_mac_device_setup(ndev); | 1912 | ret = stmmac_mac_device_setup(ndev); |
1880 | if (ret < 0) | 1913 | if (ret < 0) |
1881 | goto out_plat_exit; | 1914 | goto out_plat_exit; |
@@ -1978,12 +2011,13 @@ static int stmmac_suspend(struct device *dev) | |||
1978 | if (!ndev || !netif_running(ndev)) | 2011 | if (!ndev || !netif_running(ndev)) |
1979 | return 0; | 2012 | return 0; |
1980 | 2013 | ||
2014 | if (priv->phydev) | ||
2015 | phy_stop(priv->phydev); | ||
2016 | |||
1981 | spin_lock(&priv->lock); | 2017 | spin_lock(&priv->lock); |
1982 | 2018 | ||
1983 | netif_device_detach(ndev); | 2019 | netif_device_detach(ndev); |
1984 | netif_stop_queue(ndev); | 2020 | netif_stop_queue(ndev); |
1985 | if (priv->phydev) | ||
1986 | phy_stop(priv->phydev); | ||
1987 | 2021 | ||
1988 | #ifdef CONFIG_STMMAC_TIMER | 2022 | #ifdef CONFIG_STMMAC_TIMER |
1989 | priv->tm->timer_stop(); | 2023 | priv->tm->timer_stop(); |
@@ -2041,12 +2075,13 @@ static int stmmac_resume(struct device *dev) | |||
2041 | #endif | 2075 | #endif |
2042 | napi_enable(&priv->napi); | 2076 | napi_enable(&priv->napi); |
2043 | 2077 | ||
2044 | if (priv->phydev) | ||
2045 | phy_start(priv->phydev); | ||
2046 | |||
2047 | netif_start_queue(ndev); | 2078 | netif_start_queue(ndev); |
2048 | 2079 | ||
2049 | spin_unlock(&priv->lock); | 2080 | spin_unlock(&priv->lock); |
2081 | |||
2082 | if (priv->phydev) | ||
2083 | phy_start(priv->phydev); | ||
2084 | |||
2050 | return 0; | 2085 | return 0; |
2051 | } | 2086 | } |
2052 | 2087 | ||
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index c517dac02ae1..cf14ab9db576 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c | |||
@@ -2637,7 +2637,7 @@ static int __devinit happy_meal_sbus_probe_one(struct platform_device *op, int i | |||
2637 | sbus_dp = op->dev.parent->of_node; | 2637 | sbus_dp = op->dev.parent->of_node; |
2638 | 2638 | ||
2639 | /* We can match PCI devices too, do not accept those here. */ | 2639 | /* We can match PCI devices too, do not accept those here. */ |
2640 | if (strcmp(sbus_dp->name, "sbus")) | 2640 | if (strcmp(sbus_dp->name, "sbus") && strcmp(sbus_dp->name, "sbi")) |
2641 | return err; | 2641 | return err; |
2642 | 2642 | ||
2643 | if (is_qfe) { | 2643 | if (is_qfe) { |
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index caf3659e173c..2681b53820ee 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c | |||
@@ -114,6 +114,7 @@ void temac_indirect_out32(struct temac_local *lp, int reg, u32 value) | |||
114 | return; | 114 | return; |
115 | temac_iow(lp, XTE_LSW0_OFFSET, value); | 115 | temac_iow(lp, XTE_LSW0_OFFSET, value); |
116 | temac_iow(lp, XTE_CTL0_OFFSET, CNTLREG_WRITE_ENABLE_MASK | reg); | 116 | temac_iow(lp, XTE_CTL0_OFFSET, CNTLREG_WRITE_ENABLE_MASK | reg); |
117 | temac_indirect_busywait(lp); | ||
117 | } | 118 | } |
118 | 119 | ||
119 | /** | 120 | /** |
@@ -203,6 +204,9 @@ static void temac_dma_bd_release(struct net_device *ndev) | |||
203 | struct temac_local *lp = netdev_priv(ndev); | 204 | struct temac_local *lp = netdev_priv(ndev); |
204 | int i; | 205 | int i; |
205 | 206 | ||
207 | /* Reset Local Link (DMA) */ | ||
208 | lp->dma_out(lp, DMA_CONTROL_REG, DMA_CONTROL_RST); | ||
209 | |||
206 | for (i = 0; i < RX_BD_NUM; i++) { | 210 | for (i = 0; i < RX_BD_NUM; i++) { |
207 | if (!lp->rx_skb[i]) | 211 | if (!lp->rx_skb[i]) |
208 | break; | 212 | break; |
@@ -860,6 +864,8 @@ static int temac_open(struct net_device *ndev) | |||
860 | phy_start(lp->phy_dev); | 864 | phy_start(lp->phy_dev); |
861 | } | 865 | } |
862 | 866 | ||
867 | temac_device_reset(ndev); | ||
868 | |||
863 | rc = request_irq(lp->tx_irq, ll_temac_tx_irq, 0, ndev->name, ndev); | 869 | rc = request_irq(lp->tx_irq, ll_temac_tx_irq, 0, ndev->name, ndev); |
864 | if (rc) | 870 | if (rc) |
865 | goto err_tx_irq; | 871 | goto err_tx_irq; |
@@ -867,7 +873,6 @@ static int temac_open(struct net_device *ndev) | |||
867 | if (rc) | 873 | if (rc) |
868 | goto err_rx_irq; | 874 | goto err_rx_irq; |
869 | 875 | ||
870 | temac_device_reset(ndev); | ||
871 | return 0; | 876 | return 0; |
872 | 877 | ||
873 | err_rx_irq: | 878 | err_rx_irq: |
diff --git a/drivers/net/hippi/Kconfig b/drivers/net/hippi/Kconfig index 7393eb732ee6..95eb34fdbba7 100644 --- a/drivers/net/hippi/Kconfig +++ b/drivers/net/hippi/Kconfig | |||
@@ -36,4 +36,4 @@ config ROADRUNNER_LARGE_RINGS | |||
36 | kernel code or by user space programs. Say Y here only if you have | 36 | kernel code or by user space programs. Say Y here only if you have |
37 | the memory. | 37 | the memory. |
38 | 38 | ||
39 | endif /* HIPPI */ | 39 | endif # HIPPI |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index e81e22e3d1d2..e6fed4d4cb77 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <linux/usb/usbnet.h> | 36 | #include <linux/usb/usbnet.h> |
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | 38 | ||
39 | #define DRIVER_VERSION "26-Sep-2011" | 39 | #define DRIVER_VERSION "08-Nov-2011" |
40 | #define DRIVER_NAME "asix" | 40 | #define DRIVER_NAME "asix" |
41 | 41 | ||
42 | /* ASIX AX8817X based USB 2.0 Ethernet Devices */ | 42 | /* ASIX AX8817X based USB 2.0 Ethernet Devices */ |
@@ -163,7 +163,7 @@ | |||
163 | #define MARVELL_CTRL_TXDELAY 0x0002 | 163 | #define MARVELL_CTRL_TXDELAY 0x0002 |
164 | #define MARVELL_CTRL_RXDELAY 0x0080 | 164 | #define MARVELL_CTRL_RXDELAY 0x0080 |
165 | 165 | ||
166 | #define PHY_MODE_RTL8211CL 0x0004 | 166 | #define PHY_MODE_RTL8211CL 0x000C |
167 | 167 | ||
168 | /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ | 168 | /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ |
169 | struct asix_data { | 169 | struct asix_data { |
@@ -652,9 +652,17 @@ static u32 asix_get_phyid(struct usbnet *dev) | |||
652 | { | 652 | { |
653 | int phy_reg; | 653 | int phy_reg; |
654 | u32 phy_id; | 654 | u32 phy_id; |
655 | int i; | ||
655 | 656 | ||
656 | phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1); | 657 | /* Poll for the rare case the FW or phy isn't ready yet. */ |
657 | if (phy_reg < 0) | 658 | for (i = 0; i < 100; i++) { |
659 | phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1); | ||
660 | if (phy_reg != 0 && phy_reg != 0xFFFF) | ||
661 | break; | ||
662 | mdelay(1); | ||
663 | } | ||
664 | |||
665 | if (phy_reg <= 0 || phy_reg == 0xFFFF) | ||
658 | return 0; | 666 | return 0; |
659 | 667 | ||
660 | phy_id = (phy_reg & 0xffff) << 16; | 668 | phy_id = (phy_reg & 0xffff) << 16; |
@@ -1075,7 +1083,7 @@ static const struct net_device_ops ax88772_netdev_ops = { | |||
1075 | 1083 | ||
1076 | static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | 1084 | static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) |
1077 | { | 1085 | { |
1078 | int ret; | 1086 | int ret, embd_phy; |
1079 | struct asix_data *data = (struct asix_data *)&dev->data; | 1087 | struct asix_data *data = (struct asix_data *)&dev->data; |
1080 | u8 buf[ETH_ALEN]; | 1088 | u8 buf[ETH_ALEN]; |
1081 | u32 phyid; | 1089 | u32 phyid; |
@@ -1100,16 +1108,36 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1100 | dev->mii.reg_num_mask = 0x1f; | 1108 | dev->mii.reg_num_mask = 0x1f; |
1101 | dev->mii.phy_id = asix_get_phy_addr(dev); | 1109 | dev->mii.phy_id = asix_get_phy_addr(dev); |
1102 | 1110 | ||
1103 | phyid = asix_get_phyid(dev); | ||
1104 | dbg("PHYID=0x%08x", phyid); | ||
1105 | |||
1106 | dev->net->netdev_ops = &ax88772_netdev_ops; | 1111 | dev->net->netdev_ops = &ax88772_netdev_ops; |
1107 | dev->net->ethtool_ops = &ax88772_ethtool_ops; | 1112 | dev->net->ethtool_ops = &ax88772_ethtool_ops; |
1108 | 1113 | ||
1109 | ret = ax88772_reset(dev); | 1114 | embd_phy = ((dev->mii.phy_id & 0x1f) == 0x10 ? 1 : 0); |
1115 | |||
1116 | /* Reset the PHY to normal operation mode */ | ||
1117 | ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL); | ||
1118 | if (ret < 0) { | ||
1119 | dbg("Select PHY #1 failed: %d", ret); | ||
1120 | return ret; | ||
1121 | } | ||
1122 | |||
1123 | ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL); | ||
1124 | if (ret < 0) | ||
1125 | return ret; | ||
1126 | |||
1127 | msleep(150); | ||
1128 | |||
1129 | ret = asix_sw_reset(dev, AX_SWRESET_CLEAR); | ||
1110 | if (ret < 0) | 1130 | if (ret < 0) |
1111 | return ret; | 1131 | return ret; |
1112 | 1132 | ||
1133 | msleep(150); | ||
1134 | |||
1135 | ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE); | ||
1136 | |||
1137 | /* Read PHYID register *AFTER* the PHY was reset properly */ | ||
1138 | phyid = asix_get_phyid(dev); | ||
1139 | dbg("PHYID=0x%08x", phyid); | ||
1140 | |||
1113 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ | 1141 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ |
1114 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { | 1142 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { |
1115 | /* hard_mtu is still the default - the device does not support | 1143 | /* hard_mtu is still the default - the device does not support |
@@ -1220,6 +1248,7 @@ static int ax88178_reset(struct usbnet *dev) | |||
1220 | __le16 eeprom; | 1248 | __le16 eeprom; |
1221 | u8 status; | 1249 | u8 status; |
1222 | int gpio0 = 0; | 1250 | int gpio0 = 0; |
1251 | u32 phyid; | ||
1223 | 1252 | ||
1224 | asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); | 1253 | asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); |
1225 | dbg("GPIO Status: 0x%04x", status); | 1254 | dbg("GPIO Status: 0x%04x", status); |
@@ -1235,12 +1264,13 @@ static int ax88178_reset(struct usbnet *dev) | |||
1235 | data->ledmode = 0; | 1264 | data->ledmode = 0; |
1236 | gpio0 = 1; | 1265 | gpio0 = 1; |
1237 | } else { | 1266 | } else { |
1238 | data->phymode = le16_to_cpu(eeprom) & 7; | 1267 | data->phymode = le16_to_cpu(eeprom) & 0x7F; |
1239 | data->ledmode = le16_to_cpu(eeprom) >> 8; | 1268 | data->ledmode = le16_to_cpu(eeprom) >> 8; |
1240 | gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; | 1269 | gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; |
1241 | } | 1270 | } |
1242 | dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); | 1271 | dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); |
1243 | 1272 | ||
1273 | /* Power up external GigaPHY through AX88178 GPIO pin */ | ||
1244 | asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); | 1274 | asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); |
1245 | if ((le16_to_cpu(eeprom) >> 8) != 1) { | 1275 | if ((le16_to_cpu(eeprom) >> 8) != 1) { |
1246 | asix_write_gpio(dev, 0x003c, 30); | 1276 | asix_write_gpio(dev, 0x003c, 30); |
@@ -1252,6 +1282,13 @@ static int ax88178_reset(struct usbnet *dev) | |||
1252 | asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30); | 1282 | asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30); |
1253 | } | 1283 | } |
1254 | 1284 | ||
1285 | /* Read PHYID register *AFTER* powering up PHY */ | ||
1286 | phyid = asix_get_phyid(dev); | ||
1287 | dbg("PHYID=0x%08x", phyid); | ||
1288 | |||
1289 | /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */ | ||
1290 | asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0, 0, 0, NULL); | ||
1291 | |||
1255 | asix_sw_reset(dev, 0); | 1292 | asix_sw_reset(dev, 0); |
1256 | msleep(150); | 1293 | msleep(150); |
1257 | 1294 | ||
@@ -1396,7 +1433,6 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1396 | { | 1433 | { |
1397 | int ret; | 1434 | int ret; |
1398 | u8 buf[ETH_ALEN]; | 1435 | u8 buf[ETH_ALEN]; |
1399 | u32 phyid; | ||
1400 | struct asix_data *data = (struct asix_data *)&dev->data; | 1436 | struct asix_data *data = (struct asix_data *)&dev->data; |
1401 | 1437 | ||
1402 | data->eeprom_len = AX88772_EEPROM_LEN; | 1438 | data->eeprom_len = AX88772_EEPROM_LEN; |
@@ -1423,12 +1459,12 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1423 | dev->net->netdev_ops = &ax88178_netdev_ops; | 1459 | dev->net->netdev_ops = &ax88178_netdev_ops; |
1424 | dev->net->ethtool_ops = &ax88178_ethtool_ops; | 1460 | dev->net->ethtool_ops = &ax88178_ethtool_ops; |
1425 | 1461 | ||
1426 | phyid = asix_get_phyid(dev); | 1462 | /* Blink LEDS so users know driver saw dongle */ |
1427 | dbg("PHYID=0x%08x", phyid); | 1463 | asix_sw_reset(dev, 0); |
1464 | msleep(150); | ||
1428 | 1465 | ||
1429 | ret = ax88178_reset(dev); | 1466 | asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD); |
1430 | if (ret < 0) | 1467 | msleep(150); |
1431 | return ret; | ||
1432 | 1468 | ||
1433 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ | 1469 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ |
1434 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { | 1470 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index c924ea2bce07..99ed6eb4dfaf 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -567,7 +567,7 @@ static const struct usb_device_id products [] = { | |||
567 | { | 567 | { |
568 | USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, | 568 | USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, |
569 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | 569 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), |
570 | .driver_info = (unsigned long)&wwan_info, | 570 | .driver_info = 0, |
571 | }, | 571 | }, |
572 | 572 | ||
573 | /* | 573 | /* |
diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c index d43db32f9478..9c26c6390d69 100644 --- a/drivers/net/usb/lg-vl600.c +++ b/drivers/net/usb/lg-vl600.c | |||
@@ -144,10 +144,11 @@ static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | frame = (struct vl600_frame_hdr *) buf->data; | 146 | frame = (struct vl600_frame_hdr *) buf->data; |
147 | /* NOTE: Should check that frame->magic == 0x53544448? | 147 | /* Yes, check that frame->magic == 0x53544448 (or 0x44544d48), |
148 | * Otherwise if we receive garbage at the beginning of the frame | 148 | * otherwise we may run out of memory w/a bad packet */ |
149 | * we may end up allocating a huge buffer and saving all the | 149 | if (ntohl(frame->magic) != 0x53544448 && |
150 | * future incoming data into it. */ | 150 | ntohl(frame->magic) != 0x44544d48) |
151 | goto error; | ||
151 | 152 | ||
152 | if (buf->len < sizeof(*frame) || | 153 | if (buf->len < sizeof(*frame) || |
153 | buf->len != le32_to_cpup(&frame->len)) { | 154 | buf->len != le32_to_cpup(&frame->len)) { |
@@ -296,6 +297,11 @@ encapsulate: | |||
296 | * overwrite the remaining fields. | 297 | * overwrite the remaining fields. |
297 | */ | 298 | */ |
298 | packet = (struct vl600_pkt_hdr *) skb->data; | 299 | packet = (struct vl600_pkt_hdr *) skb->data; |
300 | /* The VL600 wants IPv6 packets to have an IPv4 ethertype | ||
301 | * Since this modem only supports IPv4 and IPv6, just set all | ||
302 | * frames to 0x0800 (ETH_P_IP) | ||
303 | */ | ||
304 | packet->h_proto = htons(ETH_P_IP); | ||
299 | memset(&packet->dummy, 0, sizeof(packet->dummy)); | 305 | memset(&packet->dummy, 0, sizeof(packet->dummy)); |
300 | packet->len = cpu_to_le32(orig_len); | 306 | packet->len = cpu_to_le32(orig_len); |
301 | 307 | ||
@@ -308,21 +314,12 @@ encapsulate: | |||
308 | if (skb->len < full_len) /* Pad */ | 314 | if (skb->len < full_len) /* Pad */ |
309 | skb_put(skb, full_len - skb->len); | 315 | skb_put(skb, full_len - skb->len); |
310 | 316 | ||
311 | /* The VL600 wants IPv6 packets to have an IPv4 ethertype | ||
312 | * Check if this is an IPv6 packet, and set the ethertype | ||
313 | * to 0x800 | ||
314 | */ | ||
315 | if ((skb->data[sizeof(struct vl600_pkt_hdr *) + 0x22] & 0xf0) == 0x60) { | ||
316 | skb->data[sizeof(struct vl600_pkt_hdr *) + 0x20] = 0x08; | ||
317 | skb->data[sizeof(struct vl600_pkt_hdr *) + 0x21] = 0; | ||
318 | } | ||
319 | |||
320 | return skb; | 317 | return skb; |
321 | } | 318 | } |
322 | 319 | ||
323 | static const struct driver_info vl600_info = { | 320 | static const struct driver_info vl600_info = { |
324 | .description = "LG VL600 modem", | 321 | .description = "LG VL600 modem", |
325 | .flags = FLAG_ETHER | FLAG_RX_ASSEMBLE, | 322 | .flags = FLAG_RX_ASSEMBLE | FLAG_WWAN, |
326 | .bind = vl600_bind, | 323 | .bind = vl600_bind, |
327 | .unbind = vl600_unbind, | 324 | .unbind = vl600_unbind, |
328 | .status = usbnet_cdc_status, | 325 | .status = usbnet_cdc_status, |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 22a7cf951e72..a5b9b12ef268 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #define USB_VENDOR_ID_SMSC (0x0424) | 51 | #define USB_VENDOR_ID_SMSC (0x0424) |
52 | #define USB_PRODUCT_ID_LAN7500 (0x7500) | 52 | #define USB_PRODUCT_ID_LAN7500 (0x7500) |
53 | #define USB_PRODUCT_ID_LAN7505 (0x7505) | 53 | #define USB_PRODUCT_ID_LAN7505 (0x7505) |
54 | #define RXW_PADDING 2 | ||
54 | 55 | ||
55 | #define check_warn(ret, fmt, args...) \ | 56 | #define check_warn(ret, fmt, args...) \ |
56 | ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); }) | 57 | ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); }) |
@@ -1088,13 +1089,13 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
1088 | 1089 | ||
1089 | memcpy(&rx_cmd_b, skb->data, sizeof(rx_cmd_b)); | 1090 | memcpy(&rx_cmd_b, skb->data, sizeof(rx_cmd_b)); |
1090 | le32_to_cpus(&rx_cmd_b); | 1091 | le32_to_cpus(&rx_cmd_b); |
1091 | skb_pull(skb, 4 + NET_IP_ALIGN); | 1092 | skb_pull(skb, 4 + RXW_PADDING); |
1092 | 1093 | ||
1093 | packet = skb->data; | 1094 | packet = skb->data; |
1094 | 1095 | ||
1095 | /* get the packet length */ | 1096 | /* get the packet length */ |
1096 | size = (rx_cmd_a & RX_CMD_A_LEN) - NET_IP_ALIGN; | 1097 | size = (rx_cmd_a & RX_CMD_A_LEN) - RXW_PADDING; |
1097 | align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4; | 1098 | align_count = (4 - ((size + RXW_PADDING) % 4)) % 4; |
1098 | 1099 | ||
1099 | if (unlikely(rx_cmd_a & RX_CMD_A_RED)) { | 1100 | if (unlikely(rx_cmd_a & RX_CMD_A_RED)) { |
1100 | netif_dbg(dev, rx_err, dev->net, | 1101 | netif_dbg(dev, rx_err, dev->net, |
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c index 85fa9cc73502..65ecb5bab25a 100644 --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c | |||
@@ -254,6 +254,8 @@ ath_reg_apply_active_scan_flags(struct wiphy *wiphy, | |||
254 | int r; | 254 | int r; |
255 | 255 | ||
256 | sband = wiphy->bands[IEEE80211_BAND_2GHZ]; | 256 | sband = wiphy->bands[IEEE80211_BAND_2GHZ]; |
257 | if (!sband) | ||
258 | return; | ||
257 | 259 | ||
258 | /* | 260 | /* |
259 | * If no country IE has been received always enable active scan | 261 | * If no country IE has been received always enable active scan |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 58ea0e5fabfd..5f77cbe0b6aa 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -175,6 +175,7 @@ void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp, | |||
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | /* TODO: verify if needed for SSLPN or LCN */ | ||
178 | static u16 b43_generate_tx_phy_ctl1(struct b43_wldev *dev, u8 bitrate) | 179 | static u16 b43_generate_tx_phy_ctl1(struct b43_wldev *dev, u8 bitrate) |
179 | { | 180 | { |
180 | const struct b43_phy *phy = &dev->phy; | 181 | const struct b43_phy *phy = &dev->phy; |
@@ -256,6 +257,9 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
256 | unsigned int plcp_fragment_len; | 257 | unsigned int plcp_fragment_len; |
257 | u32 mac_ctl = 0; | 258 | u32 mac_ctl = 0; |
258 | u16 phy_ctl = 0; | 259 | u16 phy_ctl = 0; |
260 | bool fill_phy_ctl1 = (phy->type == B43_PHYTYPE_LP || | ||
261 | phy->type == B43_PHYTYPE_N || | ||
262 | phy->type == B43_PHYTYPE_HT); | ||
259 | u8 extra_ft = 0; | 263 | u8 extra_ft = 0; |
260 | struct ieee80211_rate *txrate; | 264 | struct ieee80211_rate *txrate; |
261 | struct ieee80211_tx_rate *rates; | 265 | struct ieee80211_tx_rate *rates; |
@@ -531,7 +535,7 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
531 | extra_ft |= B43_TXH_EFT_RTSFB_CCK; | 535 | extra_ft |= B43_TXH_EFT_RTSFB_CCK; |
532 | 536 | ||
533 | if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS && | 537 | if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS && |
534 | phy->type == B43_PHYTYPE_N) { | 538 | fill_phy_ctl1) { |
535 | txhdr->phy_ctl1_rts = cpu_to_le16( | 539 | txhdr->phy_ctl1_rts = cpu_to_le16( |
536 | b43_generate_tx_phy_ctl1(dev, rts_rate)); | 540 | b43_generate_tx_phy_ctl1(dev, rts_rate)); |
537 | txhdr->phy_ctl1_rts_fb = cpu_to_le16( | 541 | txhdr->phy_ctl1_rts_fb = cpu_to_le16( |
@@ -552,7 +556,7 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
552 | break; | 556 | break; |
553 | } | 557 | } |
554 | 558 | ||
555 | if (phy->type == B43_PHYTYPE_N) { | 559 | if (fill_phy_ctl1) { |
556 | txhdr->phy_ctl1 = | 560 | txhdr->phy_ctl1 = |
557 | cpu_to_le16(b43_generate_tx_phy_ctl1(dev, rate)); | 561 | cpu_to_le16(b43_generate_tx_phy_ctl1(dev, rate)); |
558 | txhdr->phy_ctl1_fb = | 562 | txhdr->phy_ctl1_fb = |
@@ -736,7 +740,14 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
736 | 740 | ||
737 | /* Link quality statistics */ | 741 | /* Link quality statistics */ |
738 | switch (chanstat & B43_RX_CHAN_PHYTYPE) { | 742 | switch (chanstat & B43_RX_CHAN_PHYTYPE) { |
743 | case B43_PHYTYPE_HT: | ||
744 | /* TODO: is max the right choice? */ | ||
745 | status.signal = max_t(__s8, | ||
746 | max(rxhdr->phy_ht_power0, rxhdr->phy_ht_power1), | ||
747 | rxhdr->phy_ht_power2); | ||
748 | break; | ||
739 | case B43_PHYTYPE_N: | 749 | case B43_PHYTYPE_N: |
750 | /* Broadcom has code for min and avg, but always uses max */ | ||
740 | if (rxhdr->power0 == 16 || rxhdr->power0 == 32) | 751 | if (rxhdr->power0 == 16 || rxhdr->power0 == 32) |
741 | status.signal = max(rxhdr->power1, rxhdr->power2); | 752 | status.signal = max(rxhdr->power1, rxhdr->power2); |
742 | else | 753 | else |
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h index 16c514d54afa..98d90747836a 100644 --- a/drivers/net/wireless/b43/xmit.h +++ b/drivers/net/wireless/b43/xmit.h | |||
@@ -249,6 +249,12 @@ struct b43_rxhdr_fw4 { | |||
249 | } __packed; | 249 | } __packed; |
250 | } __packed; | 250 | } __packed; |
251 | union { | 251 | union { |
252 | /* HT-PHY */ | ||
253 | struct { | ||
254 | PAD_BYTES(1); | ||
255 | __s8 phy_ht_power0; | ||
256 | } __packed; | ||
257 | |||
252 | /* RSSI for N-PHYs */ | 258 | /* RSSI for N-PHYs */ |
253 | struct { | 259 | struct { |
254 | __s8 power2; | 260 | __s8 power2; |
@@ -257,7 +263,15 @@ struct b43_rxhdr_fw4 { | |||
257 | 263 | ||
258 | __le16 phy_status2; /* PHY RX Status 2 */ | 264 | __le16 phy_status2; /* PHY RX Status 2 */ |
259 | } __packed; | 265 | } __packed; |
260 | __le16 phy_status3; /* PHY RX Status 3 */ | 266 | union { |
267 | /* HT-PHY */ | ||
268 | struct { | ||
269 | __s8 phy_ht_power1; | ||
270 | __s8 phy_ht_power2; | ||
271 | } __packed; | ||
272 | |||
273 | __le16 phy_status3; /* PHY RX Status 3 */ | ||
274 | } __packed; | ||
261 | union { | 275 | union { |
262 | /* Tested with 598.314, 644.1001 and 666.2 */ | 276 | /* Tested with 598.314, 644.1001 and 666.2 */ |
263 | struct { | 277 | struct { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c index b56a30297c26..6ebec8f42846 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c | |||
@@ -358,13 +358,14 @@ static uint nrxdactive(struct dma_info *di, uint h, uint t) | |||
358 | 358 | ||
359 | static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags) | 359 | static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags) |
360 | { | 360 | { |
361 | uint dmactrlflags = di->dma.dmactrlflags; | 361 | uint dmactrlflags; |
362 | 362 | ||
363 | if (di == NULL) { | 363 | if (di == NULL) { |
364 | DMA_ERROR(("%s: _dma_ctrlflags: NULL dma handle\n", di->name)); | 364 | DMA_ERROR(("_dma_ctrlflags: NULL dma handle\n")); |
365 | return 0; | 365 | return 0; |
366 | } | 366 | } |
367 | 367 | ||
368 | dmactrlflags = di->dma.dmactrlflags; | ||
368 | dmactrlflags &= ~mask; | 369 | dmactrlflags &= ~mask; |
369 | dmactrlflags |= flags; | 370 | dmactrlflags |= flags; |
370 | 371 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c index da3411057afc..ce918980e977 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | |||
@@ -990,29 +990,16 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans) | |||
990 | return 0; | 990 | return 0; |
991 | } | 991 | } |
992 | 992 | ||
993 | static void iwl_trans_pcie_disable_sync_irq(struct iwl_trans *trans) | 993 | static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) |
994 | { | 994 | { |
995 | unsigned long flags; | 995 | unsigned long flags; |
996 | struct iwl_trans_pcie *trans_pcie = | 996 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
997 | IWL_TRANS_GET_PCIE_TRANS(trans); | ||
998 | 997 | ||
998 | /* tell the device to stop sending interrupts */ | ||
999 | spin_lock_irqsave(&trans->shrd->lock, flags); | 999 | spin_lock_irqsave(&trans->shrd->lock, flags); |
1000 | iwl_disable_interrupts(trans); | 1000 | iwl_disable_interrupts(trans); |
1001 | spin_unlock_irqrestore(&trans->shrd->lock, flags); | 1001 | spin_unlock_irqrestore(&trans->shrd->lock, flags); |
1002 | 1002 | ||
1003 | /* wait to make sure we flush pending tasklet*/ | ||
1004 | synchronize_irq(bus(trans)->irq); | ||
1005 | tasklet_kill(&trans_pcie->irq_tasklet); | ||
1006 | } | ||
1007 | |||
1008 | static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) | ||
1009 | { | ||
1010 | /* stop and reset the on-board processor */ | ||
1011 | iwl_write32(bus(trans), CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); | ||
1012 | |||
1013 | /* tell the device to stop sending interrupts */ | ||
1014 | iwl_trans_pcie_disable_sync_irq(trans); | ||
1015 | |||
1016 | /* device going down, Stop using ICT table */ | 1003 | /* device going down, Stop using ICT table */ |
1017 | iwl_disable_ict(trans); | 1004 | iwl_disable_ict(trans); |
1018 | 1005 | ||
@@ -1039,6 +1026,20 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) | |||
1039 | 1026 | ||
1040 | /* Stop the device, and put it in low power state */ | 1027 | /* Stop the device, and put it in low power state */ |
1041 | iwl_apm_stop(priv(trans)); | 1028 | iwl_apm_stop(priv(trans)); |
1029 | |||
1030 | /* Upon stop, the APM issues an interrupt if HW RF kill is set. | ||
1031 | * Clean again the interrupt here | ||
1032 | */ | ||
1033 | spin_lock_irqsave(&trans->shrd->lock, flags); | ||
1034 | iwl_disable_interrupts(trans); | ||
1035 | spin_unlock_irqrestore(&trans->shrd->lock, flags); | ||
1036 | |||
1037 | /* wait to make sure we flush pending tasklet*/ | ||
1038 | synchronize_irq(bus(trans)->irq); | ||
1039 | tasklet_kill(&trans_pcie->irq_tasklet); | ||
1040 | |||
1041 | /* stop and reset the on-board processor */ | ||
1042 | iwl_write32(bus(trans), CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); | ||
1042 | } | 1043 | } |
1043 | 1044 | ||
1044 | static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | 1045 | static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, |
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 4fcd653bddc4..a7f1ab28940d 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -634,7 +634,7 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy, | |||
634 | if (channel && | 634 | if (channel && |
635 | !(channel->flags & IEEE80211_CHAN_DISABLED)) | 635 | !(channel->flags & IEEE80211_CHAN_DISABLED)) |
636 | cfg80211_inform_bss(wiphy, channel, | 636 | cfg80211_inform_bss(wiphy, channel, |
637 | bssid, le64_to_cpu(*(__le64 *)tsfdesc), | 637 | bssid, get_unaligned_le64(tsfdesc), |
638 | capa, intvl, ie, ielen, | 638 | capa, intvl, ie, ielen, |
639 | LBS_SCAN_RSSI_TO_MBM(rssi), | 639 | LBS_SCAN_RSSI_TO_MBM(rssi), |
640 | GFP_KERNEL); | 640 | GFP_KERNEL); |
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c index 11b69b300dc0..728baa445259 100644 --- a/drivers/net/wireless/libertas/if_spi.c +++ b/drivers/net/wireless/libertas/if_spi.c | |||
@@ -995,6 +995,7 @@ static int if_spi_host_to_card(struct lbs_private *priv, | |||
995 | spin_unlock_irqrestore(&card->buffer_lock, flags); | 995 | spin_unlock_irqrestore(&card->buffer_lock, flags); |
996 | break; | 996 | break; |
997 | default: | 997 | default: |
998 | kfree(packet); | ||
998 | netdev_err(priv->dev, "can't transfer buffer of type %d\n", | 999 | netdev_err(priv->dev, "can't transfer buffer of type %d\n", |
999 | type); | 1000 | type); |
1000 | err = -EINVAL; | 1001 | err = -EINVAL; |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index dae8dbb24a03..8d3ab378662b 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -819,8 +819,10 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv, | |||
819 | wildcard_ssid_tlv->header.len = cpu_to_le16( | 819 | wildcard_ssid_tlv->header.len = cpu_to_le16( |
820 | (u16) (ssid_len + sizeof(wildcard_ssid_tlv-> | 820 | (u16) (ssid_len + sizeof(wildcard_ssid_tlv-> |
821 | max_ssid_length))); | 821 | max_ssid_length))); |
822 | wildcard_ssid_tlv->max_ssid_length = | 822 | |
823 | user_scan_in->ssid_list[ssid_idx].max_len; | 823 | /* max_ssid_length = 0 tells firmware to perform |
824 | specific scan for the SSID filled */ | ||
825 | wildcard_ssid_tlv->max_ssid_length = 0; | ||
824 | 826 | ||
825 | memcpy(wildcard_ssid_tlv->ssid, | 827 | memcpy(wildcard_ssid_tlv->ssid, |
826 | user_scan_in->ssid_list[ssid_idx].ssid, | 828 | user_scan_in->ssid_list[ssid_idx].ssid, |
@@ -1469,7 +1471,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv, u8 *bssid, | |||
1469 | s32 rssi, const u8 *ie_buf, size_t ie_len, | 1471 | s32 rssi, const u8 *ie_buf, size_t ie_len, |
1470 | u16 beacon_period, u16 cap_info_bitmap, u8 band) | 1472 | u16 beacon_period, u16 cap_info_bitmap, u8 band) |
1471 | { | 1473 | { |
1472 | struct mwifiex_bssdescriptor *bss_desc = NULL; | 1474 | struct mwifiex_bssdescriptor *bss_desc; |
1473 | int ret; | 1475 | int ret; |
1474 | unsigned long flags; | 1476 | unsigned long flags; |
1475 | u8 *beacon_ie; | 1477 | u8 *beacon_ie; |
@@ -1484,6 +1486,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv, u8 *bssid, | |||
1484 | 1486 | ||
1485 | beacon_ie = kmemdup(ie_buf, ie_len, GFP_KERNEL); | 1487 | beacon_ie = kmemdup(ie_buf, ie_len, GFP_KERNEL); |
1486 | if (!beacon_ie) { | 1488 | if (!beacon_ie) { |
1489 | kfree(bss_desc); | ||
1487 | dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n"); | 1490 | dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n"); |
1488 | return -ENOMEM; | 1491 | return -ENOMEM; |
1489 | } | 1492 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index f1565792f270..377876315b8d 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -919,6 +919,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
919 | { USB_DEVICE(0x050d, 0x935b) }, | 919 | { USB_DEVICE(0x050d, 0x935b) }, |
920 | /* Buffalo */ | 920 | /* Buffalo */ |
921 | { USB_DEVICE(0x0411, 0x00e8) }, | 921 | { USB_DEVICE(0x0411, 0x00e8) }, |
922 | { USB_DEVICE(0x0411, 0x0158) }, | ||
922 | { USB_DEVICE(0x0411, 0x016f) }, | 923 | { USB_DEVICE(0x0411, 0x016f) }, |
923 | { USB_DEVICE(0x0411, 0x01a2) }, | 924 | { USB_DEVICE(0x0411, 0x01a2) }, |
924 | /* Corega */ | 925 | /* Corega */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 2ec5c00235e6..99ff12d0c29d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -943,6 +943,7 @@ struct rt2x00_dev { | |||
943 | * Powersaving work | 943 | * Powersaving work |
944 | */ | 944 | */ |
945 | struct delayed_work autowakeup_work; | 945 | struct delayed_work autowakeup_work; |
946 | struct work_struct sleep_work; | ||
946 | 947 | ||
947 | /* | 948 | /* |
948 | * Data queue arrays for RX, TX, Beacon and ATIM. | 949 | * Data queue arrays for RX, TX, Beacon and ATIM. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index e1fb2a8569be..edd317fa7c0a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -465,6 +465,23 @@ static u8 *rt2x00lib_find_ie(u8 *data, unsigned int len, u8 ie) | |||
465 | return NULL; | 465 | return NULL; |
466 | } | 466 | } |
467 | 467 | ||
468 | static void rt2x00lib_sleep(struct work_struct *work) | ||
469 | { | ||
470 | struct rt2x00_dev *rt2x00dev = | ||
471 | container_of(work, struct rt2x00_dev, sleep_work); | ||
472 | |||
473 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
474 | return; | ||
475 | |||
476 | /* | ||
477 | * Check again is powersaving is enabled, to prevent races from delayed | ||
478 | * work execution. | ||
479 | */ | ||
480 | if (!test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) | ||
481 | rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, | ||
482 | IEEE80211_CONF_CHANGE_PS); | ||
483 | } | ||
484 | |||
468 | static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev, | 485 | static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev, |
469 | struct sk_buff *skb, | 486 | struct sk_buff *skb, |
470 | struct rxdone_entry_desc *rxdesc) | 487 | struct rxdone_entry_desc *rxdesc) |
@@ -512,8 +529,7 @@ static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev, | |||
512 | cam |= (tim_ie->bitmap_ctrl & 0x01); | 529 | cam |= (tim_ie->bitmap_ctrl & 0x01); |
513 | 530 | ||
514 | if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) | 531 | if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) |
515 | rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, | 532 | queue_work(rt2x00dev->workqueue, &rt2x00dev->sleep_work); |
516 | IEEE80211_CONF_CHANGE_PS); | ||
517 | } | 533 | } |
518 | 534 | ||
519 | static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev, | 535 | static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev, |
@@ -1141,6 +1157,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1141 | 1157 | ||
1142 | INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); | 1158 | INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); |
1143 | INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); | 1159 | INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); |
1160 | INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); | ||
1144 | 1161 | ||
1145 | /* | 1162 | /* |
1146 | * Let the driver probe the device to detect the capabilities. | 1163 | * Let the driver probe the device to detect the capabilities. |
@@ -1197,6 +1214,7 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
1197 | */ | 1214 | */ |
1198 | cancel_work_sync(&rt2x00dev->intf_work); | 1215 | cancel_work_sync(&rt2x00dev->intf_work); |
1199 | cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); | 1216 | cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); |
1217 | cancel_work_sync(&rt2x00dev->sleep_work); | ||
1200 | if (rt2x00_is_usb(rt2x00dev)) { | 1218 | if (rt2x00_is_usb(rt2x00dev)) { |
1201 | del_timer_sync(&rt2x00dev->txstatus_timer); | 1219 | del_timer_sync(&rt2x00dev->txstatus_timer); |
1202 | cancel_work_sync(&rt2x00dev->rxdone_work); | 1220 | cancel_work_sync(&rt2x00dev->rxdone_work); |
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c index 128ccb79318c..fc29c671cf3b 100644 --- a/drivers/net/wireless/wl12xx/scan.c +++ b/drivers/net/wireless/wl12xx/scan.c | |||
@@ -559,7 +559,7 @@ wl12xx_scan_sched_scan_ssid_list(struct wl1271 *wl, | |||
559 | break; | 559 | break; |
560 | } | 560 | } |
561 | /* Fail if SSID isn't present in the filters */ | 561 | /* Fail if SSID isn't present in the filters */ |
562 | if (j == req->n_ssids) { | 562 | if (j == cmd->n_ssids) { |
563 | ret = -EINVAL; | 563 | ret = -EINVAL; |
564 | goto out_free; | 564 | goto out_free; |
565 | } | 565 | } |
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 6d3dd3988d0f..791270b8bd1c 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
@@ -60,27 +60,27 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map); | |||
60 | */ | 60 | */ |
61 | struct device_node *of_irq_find_parent(struct device_node *child) | 61 | struct device_node *of_irq_find_parent(struct device_node *child) |
62 | { | 62 | { |
63 | struct device_node *p, *c = child; | 63 | struct device_node *p; |
64 | const __be32 *parp; | 64 | const __be32 *parp; |
65 | 65 | ||
66 | if (!of_node_get(c)) | 66 | if (!of_node_get(child)) |
67 | return NULL; | 67 | return NULL; |
68 | 68 | ||
69 | do { | 69 | do { |
70 | parp = of_get_property(c, "interrupt-parent", NULL); | 70 | parp = of_get_property(child, "interrupt-parent", NULL); |
71 | if (parp == NULL) | 71 | if (parp == NULL) |
72 | p = of_get_parent(c); | 72 | p = of_get_parent(child); |
73 | else { | 73 | else { |
74 | if (of_irq_workarounds & OF_IMAP_NO_PHANDLE) | 74 | if (of_irq_workarounds & OF_IMAP_NO_PHANDLE) |
75 | p = of_node_get(of_irq_dflt_pic); | 75 | p = of_node_get(of_irq_dflt_pic); |
76 | else | 76 | else |
77 | p = of_find_node_by_phandle(be32_to_cpup(parp)); | 77 | p = of_find_node_by_phandle(be32_to_cpup(parp)); |
78 | } | 78 | } |
79 | of_node_put(c); | 79 | of_node_put(child); |
80 | c = p; | 80 | child = p; |
81 | } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL); | 81 | } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL); |
82 | 82 | ||
83 | return (p == child) ? NULL : p; | 83 | return p; |
84 | } | 84 | } |
85 | 85 | ||
86 | /** | 86 | /** |
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index b6f9749b4fa7..f02b5235056d 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig | |||
@@ -76,6 +76,7 @@ config PCI_IOV | |||
76 | 76 | ||
77 | config PCI_PRI | 77 | config PCI_PRI |
78 | bool "PCI PRI support" | 78 | bool "PCI PRI support" |
79 | depends on PCI | ||
79 | select PCI_ATS | 80 | select PCI_ATS |
80 | help | 81 | help |
81 | PRI is the PCI Page Request Interface. It allows PCI devices that are | 82 | PRI is the PCI Page Request Interface. It allows PCI devices that are |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 596172b4ae95..fce1c54a0c8d 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -459,8 +459,17 @@ static int add_bridge(acpi_handle handle) | |||
459 | { | 459 | { |
460 | acpi_status status; | 460 | acpi_status status; |
461 | unsigned long long tmp; | 461 | unsigned long long tmp; |
462 | struct acpi_pci_root *root; | ||
462 | acpi_handle dummy_handle; | 463 | acpi_handle dummy_handle; |
463 | 464 | ||
465 | /* | ||
466 | * We shouldn't use this bridge if PCIe native hotplug control has been | ||
467 | * granted by the BIOS for it. | ||
468 | */ | ||
469 | root = acpi_pci_find_root(handle); | ||
470 | if (root && (root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)) | ||
471 | return -ENODEV; | ||
472 | |||
464 | /* if the bridge doesn't have _STA, we assume it is always there */ | 473 | /* if the bridge doesn't have _STA, we assume it is always there */ |
465 | status = acpi_get_handle(handle, "_STA", &dummy_handle); | 474 | status = acpi_get_handle(handle, "_STA", &dummy_handle); |
466 | if (ACPI_SUCCESS(status)) { | 475 | if (ACPI_SUCCESS(status)) { |
@@ -1376,13 +1385,23 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, | |||
1376 | static acpi_status | 1385 | static acpi_status |
1377 | find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) | 1386 | find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) |
1378 | { | 1387 | { |
1388 | struct acpi_pci_root *root; | ||
1379 | int *count = (int *)context; | 1389 | int *count = (int *)context; |
1380 | 1390 | ||
1381 | if (acpi_is_root_bridge(handle)) { | 1391 | if (!acpi_is_root_bridge(handle)) |
1382 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | 1392 | return AE_OK; |
1383 | handle_hotplug_event_bridge, NULL); | 1393 | |
1384 | (*count)++; | 1394 | root = acpi_pci_find_root(handle); |
1385 | } | 1395 | if (!root) |
1396 | return AE_OK; | ||
1397 | |||
1398 | if (root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL) | ||
1399 | return AE_OK; | ||
1400 | |||
1401 | (*count)++; | ||
1402 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
1403 | handle_hotplug_event_bridge, NULL); | ||
1404 | |||
1386 | return AE_OK ; | 1405 | return AE_OK ; |
1387 | } | 1406 | } |
1388 | 1407 | ||
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 1e9c9aacc3a6..085dbb5fc168 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -213,9 +213,6 @@ static int board_added(struct slot *p_slot) | |||
213 | goto err_exit; | 213 | goto err_exit; |
214 | } | 214 | } |
215 | 215 | ||
216 | /* Wait for 1 second after checking link training status */ | ||
217 | msleep(1000); | ||
218 | |||
219 | /* Check for a power fault */ | 216 | /* Check for a power fault */ |
220 | if (ctrl->power_fault_detected || pciehp_query_power_fault(p_slot)) { | 217 | if (ctrl->power_fault_detected || pciehp_query_power_fault(p_slot)) { |
221 | ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot)); | 218 | ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot)); |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 96dc4734e4af..7b1414810ae3 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -280,6 +280,14 @@ int pciehp_check_link_status(struct controller *ctrl) | |||
280 | else | 280 | else |
281 | msleep(1000); | 281 | msleep(1000); |
282 | 282 | ||
283 | /* | ||
284 | * Need to wait for 1000 ms after Data Link Layer Link Active | ||
285 | * (DLLLA) bit reads 1b before sending configuration request. | ||
286 | * We need it before checking Link Training (LT) bit becuase | ||
287 | * LT is still set even after DLLLA bit is set on some platform. | ||
288 | */ | ||
289 | msleep(1000); | ||
290 | |||
283 | retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status); | 291 | retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status); |
284 | if (retval) { | 292 | if (retval) { |
285 | ctrl_err(ctrl, "Cannot read LNKSTATUS register\n"); | 293 | ctrl_err(ctrl, "Cannot read LNKSTATUS register\n"); |
@@ -294,6 +302,16 @@ int pciehp_check_link_status(struct controller *ctrl) | |||
294 | return retval; | 302 | return retval; |
295 | } | 303 | } |
296 | 304 | ||
305 | /* | ||
306 | * If the port supports Link speeds greater than 5.0 GT/s, we | ||
307 | * must wait for 100 ms after Link training completes before | ||
308 | * sending configuration request. | ||
309 | */ | ||
310 | if (ctrl->pcie->port->subordinate->max_bus_speed > PCIE_SPEED_5_0GT) | ||
311 | msleep(100); | ||
312 | |||
313 | pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status); | ||
314 | |||
297 | return retval; | 315 | return retval; |
298 | } | 316 | } |
299 | 317 | ||
@@ -484,7 +502,6 @@ int pciehp_power_on_slot(struct slot * slot) | |||
484 | u16 slot_cmd; | 502 | u16 slot_cmd; |
485 | u16 cmd_mask; | 503 | u16 cmd_mask; |
486 | u16 slot_status; | 504 | u16 slot_status; |
487 | u16 lnk_status; | ||
488 | int retval = 0; | 505 | int retval = 0; |
489 | 506 | ||
490 | /* Clear sticky power-fault bit from previous power failures */ | 507 | /* Clear sticky power-fault bit from previous power failures */ |
@@ -516,14 +533,6 @@ int pciehp_power_on_slot(struct slot * slot) | |||
516 | ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, | 533 | ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, |
517 | pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd); | 534 | pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd); |
518 | 535 | ||
519 | retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status); | ||
520 | if (retval) { | ||
521 | ctrl_err(ctrl, "%s: Cannot read LNKSTA register\n", | ||
522 | __func__); | ||
523 | return retval; | ||
524 | } | ||
525 | pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status); | ||
526 | |||
527 | return retval; | 536 | return retval; |
528 | } | 537 | } |
529 | 538 | ||
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index aca972bbfb4c..dd7e0c51a33e 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -278,8 +278,8 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) | |||
278 | 278 | ||
279 | static int is_shpc_capable(struct pci_dev *dev) | 279 | static int is_shpc_capable(struct pci_dev *dev) |
280 | { | 280 | { |
281 | if ((dev->vendor == PCI_VENDOR_ID_AMD) || (dev->device == | 281 | if (dev->vendor == PCI_VENDOR_ID_AMD && |
282 | PCI_DEVICE_ID_AMD_GOLAM_7450)) | 282 | dev->device == PCI_DEVICE_ID_AMD_GOLAM_7450) |
283 | return 1; | 283 | return 1; |
284 | if (!pci_find_capability(dev, PCI_CAP_ID_SHPC)) | 284 | if (!pci_find_capability(dev, PCI_CAP_ID_SHPC)) |
285 | return 0; | 285 | return 0; |
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c index 36547f0ce305..75ba2311b54f 100644 --- a/drivers/pci/hotplug/shpchp_hpc.c +++ b/drivers/pci/hotplug/shpchp_hpc.c | |||
@@ -944,8 +944,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) | |||
944 | ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */ | 944 | ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */ |
945 | ctrl_dbg(ctrl, "Hotplug Controller:\n"); | 945 | ctrl_dbg(ctrl, "Hotplug Controller:\n"); |
946 | 946 | ||
947 | if ((pdev->vendor == PCI_VENDOR_ID_AMD) || (pdev->device == | 947 | if (pdev->vendor == PCI_VENDOR_ID_AMD && |
948 | PCI_DEVICE_ID_AMD_GOLAM_7450)) { | 948 | pdev->device == PCI_DEVICE_ID_AMD_GOLAM_7450) { |
949 | /* amd shpc driver doesn't use Base Offset; assume 0 */ | 949 | /* amd shpc driver doesn't use Base Offset; assume 0 */ |
950 | ctrl->mmio_base = pci_resource_start(pdev, 0); | 950 | ctrl->mmio_base = pci_resource_start(pdev, 0); |
951 | ctrl->mmio_size = pci_resource_len(pdev, 0); | 951 | ctrl->mmio_size = pci_resource_len(pdev, 0); |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index a43cfd906c6d..d93e962f2610 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -589,14 +589,14 @@ static const struct backlight_ops dell_ops = { | |||
589 | .update_status = dell_send_intensity, | 589 | .update_status = dell_send_intensity, |
590 | }; | 590 | }; |
591 | 591 | ||
592 | static void touchpad_led_on() | 592 | static void touchpad_led_on(void) |
593 | { | 593 | { |
594 | int command = 0x97; | 594 | int command = 0x97; |
595 | char data = 1; | 595 | char data = 1; |
596 | i8042_command(&data, command | 1 << 12); | 596 | i8042_command(&data, command | 1 << 12); |
597 | } | 597 | } |
598 | 598 | ||
599 | static void touchpad_led_off() | 599 | static void touchpad_led_off(void) |
600 | { | 600 | { |
601 | int command = 0x97; | 601 | int command = 0x97; |
602 | char data = 2; | 602 | char data = 2; |
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index 66d2d60b436a..b552aae55b41 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
@@ -664,10 +664,10 @@ static int tps65910_set_voltage_dcdc(struct regulator_dev *dev, | |||
664 | 664 | ||
665 | switch (id) { | 665 | switch (id) { |
666 | case TPS65910_REG_VDD1: | 666 | case TPS65910_REG_VDD1: |
667 | dcdc_mult = (selector / VDD1_2_NUM_VOLTS) + 1; | 667 | dcdc_mult = (selector / VDD1_2_NUM_VOLT_FINE) + 1; |
668 | if (dcdc_mult == 1) | 668 | if (dcdc_mult == 1) |
669 | dcdc_mult--; | 669 | dcdc_mult--; |
670 | vsel = (selector % VDD1_2_NUM_VOLTS) + 3; | 670 | vsel = (selector % VDD1_2_NUM_VOLT_FINE) + 3; |
671 | 671 | ||
672 | tps65910_modify_bits(pmic, TPS65910_VDD1, | 672 | tps65910_modify_bits(pmic, TPS65910_VDD1, |
673 | (dcdc_mult << VDD1_VGAIN_SEL_SHIFT), | 673 | (dcdc_mult << VDD1_VGAIN_SEL_SHIFT), |
@@ -675,10 +675,10 @@ static int tps65910_set_voltage_dcdc(struct regulator_dev *dev, | |||
675 | tps65910_reg_write(pmic, TPS65910_VDD1_OP, vsel); | 675 | tps65910_reg_write(pmic, TPS65910_VDD1_OP, vsel); |
676 | break; | 676 | break; |
677 | case TPS65910_REG_VDD2: | 677 | case TPS65910_REG_VDD2: |
678 | dcdc_mult = (selector / VDD1_2_NUM_VOLTS) + 1; | 678 | dcdc_mult = (selector / VDD1_2_NUM_VOLT_FINE) + 1; |
679 | if (dcdc_mult == 1) | 679 | if (dcdc_mult == 1) |
680 | dcdc_mult--; | 680 | dcdc_mult--; |
681 | vsel = (selector % VDD1_2_NUM_VOLTS) + 3; | 681 | vsel = (selector % VDD1_2_NUM_VOLT_FINE) + 3; |
682 | 682 | ||
683 | tps65910_modify_bits(pmic, TPS65910_VDD2, | 683 | tps65910_modify_bits(pmic, TPS65910_VDD2, |
684 | (dcdc_mult << VDD2_VGAIN_SEL_SHIFT), | 684 | (dcdc_mult << VDD2_VGAIN_SEL_SHIFT), |
@@ -756,9 +756,9 @@ static int tps65910_list_voltage_dcdc(struct regulator_dev *dev, | |||
756 | switch (id) { | 756 | switch (id) { |
757 | case TPS65910_REG_VDD1: | 757 | case TPS65910_REG_VDD1: |
758 | case TPS65910_REG_VDD2: | 758 | case TPS65910_REG_VDD2: |
759 | mult = (selector / VDD1_2_NUM_VOLTS) + 1; | 759 | mult = (selector / VDD1_2_NUM_VOLT_FINE) + 1; |
760 | volt = VDD1_2_MIN_VOLT + | 760 | volt = VDD1_2_MIN_VOLT + |
761 | (selector % VDD1_2_NUM_VOLTS) * VDD1_2_OFFSET; | 761 | (selector % VDD1_2_NUM_VOLT_FINE) * VDD1_2_OFFSET; |
762 | break; | 762 | break; |
763 | case TPS65911_REG_VDDCTRL: | 763 | case TPS65911_REG_VDDCTRL: |
764 | volt = VDDCTRL_MIN_VOLT + (selector * VDDCTRL_OFFSET); | 764 | volt = VDDCTRL_MIN_VOLT + (selector * VDDCTRL_OFFSET); |
@@ -947,6 +947,8 @@ static __devinit int tps65910_probe(struct platform_device *pdev) | |||
947 | 947 | ||
948 | if (i == TPS65910_REG_VDD1 || i == TPS65910_REG_VDD2) { | 948 | if (i == TPS65910_REG_VDD1 || i == TPS65910_REG_VDD2) { |
949 | pmic->desc[i].ops = &tps65910_ops_dcdc; | 949 | pmic->desc[i].ops = &tps65910_ops_dcdc; |
950 | pmic->desc[i].n_voltages = VDD1_2_NUM_VOLT_FINE * | ||
951 | VDD1_2_NUM_VOLT_COARSE; | ||
950 | } else if (i == TPS65910_REG_VDD3) { | 952 | } else if (i == TPS65910_REG_VDD3) { |
951 | if (tps65910_chip_id(tps65910) == TPS65910) | 953 | if (tps65910_chip_id(tps65910) == TPS65910) |
952 | pmic->desc[i].ops = &tps65910_ops_vdd3; | 954 | pmic->desc[i].ops = &tps65910_ops_vdd3; |
diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c index b3eba3cddd42..e4b6880aabd0 100644 --- a/drivers/rtc/rtc-puv3.c +++ b/drivers/rtc/rtc-puv3.c | |||
@@ -220,7 +220,7 @@ static void puv3_rtc_enable(struct platform_device *pdev, int en) | |||
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | static int puv3_rtc_remove(struct platform_device *dev) | 223 | static int __devexit puv3_rtc_remove(struct platform_device *dev) |
224 | { | 224 | { |
225 | struct rtc_device *rtc = platform_get_drvdata(dev); | 225 | struct rtc_device *rtc = platform_get_drvdata(dev); |
226 | 226 | ||
@@ -236,7 +236,7 @@ static int puv3_rtc_remove(struct platform_device *dev) | |||
236 | return 0; | 236 | return 0; |
237 | } | 237 | } |
238 | 238 | ||
239 | static int puv3_rtc_probe(struct platform_device *pdev) | 239 | static int __devinit puv3_rtc_probe(struct platform_device *pdev) |
240 | { | 240 | { |
241 | struct rtc_device *rtc; | 241 | struct rtc_device *rtc; |
242 | struct resource *res; | 242 | struct resource *res; |
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c index 43068fbd0baa..1b6d9247fdc7 100644 --- a/drivers/s390/char/zcore.c +++ b/drivers/s390/char/zcore.c | |||
@@ -641,6 +641,8 @@ static int __init zcore_init(void) | |||
641 | 641 | ||
642 | if (ipl_info.type != IPL_TYPE_FCP_DUMP) | 642 | if (ipl_info.type != IPL_TYPE_FCP_DUMP) |
643 | return -ENODATA; | 643 | return -ENODATA; |
644 | if (OLDMEM_BASE) | ||
645 | return -ENODATA; | ||
644 | 646 | ||
645 | zcore_dbf = debug_register("zcore", 4, 1, 4 * sizeof(long)); | 647 | zcore_dbf = debug_register("zcore", 4, 1, 4 * sizeof(long)); |
646 | debug_register_view(zcore_dbf, &debug_sprintf_view); | 648 | debug_register_view(zcore_dbf, &debug_sprintf_view); |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index b77ae519d79c..ec94f049e995 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -1271,18 +1271,16 @@ ap_config_timeout(unsigned long ptr) | |||
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | /** | 1273 | /** |
1274 | * ap_schedule_poll_timer(): Schedule poll timer. | 1274 | * __ap_schedule_poll_timer(): Schedule poll timer. |
1275 | * | 1275 | * |
1276 | * Set up the timer to run the poll tasklet | 1276 | * Set up the timer to run the poll tasklet |
1277 | */ | 1277 | */ |
1278 | static inline void ap_schedule_poll_timer(void) | 1278 | static inline void __ap_schedule_poll_timer(void) |
1279 | { | 1279 | { |
1280 | ktime_t hr_time; | 1280 | ktime_t hr_time; |
1281 | 1281 | ||
1282 | spin_lock_bh(&ap_poll_timer_lock); | 1282 | spin_lock_bh(&ap_poll_timer_lock); |
1283 | if (ap_using_interrupts() || ap_suspend_flag) | 1283 | if (hrtimer_is_queued(&ap_poll_timer) || ap_suspend_flag) |
1284 | goto out; | ||
1285 | if (hrtimer_is_queued(&ap_poll_timer)) | ||
1286 | goto out; | 1284 | goto out; |
1287 | if (ktime_to_ns(hrtimer_expires_remaining(&ap_poll_timer)) <= 0) { | 1285 | if (ktime_to_ns(hrtimer_expires_remaining(&ap_poll_timer)) <= 0) { |
1288 | hr_time = ktime_set(0, poll_timeout); | 1286 | hr_time = ktime_set(0, poll_timeout); |
@@ -1294,6 +1292,18 @@ out: | |||
1294 | } | 1292 | } |
1295 | 1293 | ||
1296 | /** | 1294 | /** |
1295 | * ap_schedule_poll_timer(): Schedule poll timer. | ||
1296 | * | ||
1297 | * Set up the timer to run the poll tasklet | ||
1298 | */ | ||
1299 | static inline void ap_schedule_poll_timer(void) | ||
1300 | { | ||
1301 | if (ap_using_interrupts()) | ||
1302 | return; | ||
1303 | __ap_schedule_poll_timer(); | ||
1304 | } | ||
1305 | |||
1306 | /** | ||
1297 | * ap_poll_read(): Receive pending reply messages from an AP device. | 1307 | * ap_poll_read(): Receive pending reply messages from an AP device. |
1298 | * @ap_dev: pointer to the AP device | 1308 | * @ap_dev: pointer to the AP device |
1299 | * @flags: pointer to control flags, bit 2^0 is set if another poll is | 1309 | * @flags: pointer to control flags, bit 2^0 is set if another poll is |
@@ -1374,8 +1384,9 @@ static int ap_poll_write(struct ap_device *ap_dev, unsigned long *flags) | |||
1374 | *flags |= 1; | 1384 | *flags |= 1; |
1375 | *flags |= 2; | 1385 | *flags |= 2; |
1376 | break; | 1386 | break; |
1377 | case AP_RESPONSE_Q_FULL: | ||
1378 | case AP_RESPONSE_RESET_IN_PROGRESS: | 1387 | case AP_RESPONSE_RESET_IN_PROGRESS: |
1388 | __ap_schedule_poll_timer(); | ||
1389 | case AP_RESPONSE_Q_FULL: | ||
1379 | *flags |= 2; | 1390 | *flags |= 2; |
1380 | break; | 1391 | break; |
1381 | case AP_RESPONSE_MESSAGE_TOO_BIG: | 1392 | case AP_RESPONSE_MESSAGE_TOO_BIG: |
diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig index fa80ba1f0344..9b66d2d1809b 100644 --- a/drivers/s390/net/Kconfig +++ b/drivers/s390/net/Kconfig | |||
@@ -4,7 +4,7 @@ menu "S/390 network device drivers" | |||
4 | config LCS | 4 | config LCS |
5 | def_tristate m | 5 | def_tristate m |
6 | prompt "Lan Channel Station Interface" | 6 | prompt "Lan Channel Station Interface" |
7 | depends on CCW && NETDEVICES && (NET_ETHERNET || TR || FDDI) | 7 | depends on CCW && NETDEVICES && (ETHERNET || TR || FDDI) |
8 | help | 8 | help |
9 | Select this option if you want to use LCS networking on IBM System z. | 9 | Select this option if you want to use LCS networking on IBM System z. |
10 | This device driver supports Token Ring (IEEE 802.5), | 10 | This device driver supports Token Ring (IEEE 802.5), |
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index c28713da1ec5..863fc2197155 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #include "lcs.h" | 50 | #include "lcs.h" |
51 | 51 | ||
52 | 52 | ||
53 | #if !defined(CONFIG_NET_ETHERNET) && \ | 53 | #if !defined(CONFIG_ETHERNET) && \ |
54 | !defined(CONFIG_TR) && !defined(CONFIG_FDDI) | 54 | !defined(CONFIG_TR) && !defined(CONFIG_FDDI) |
55 | #error Cannot compile lcs.c without some net devices switched on. | 55 | #error Cannot compile lcs.c without some net devices switched on. |
56 | #endif | 56 | #endif |
@@ -1634,7 +1634,7 @@ lcs_startlan_auto(struct lcs_card *card) | |||
1634 | int rc; | 1634 | int rc; |
1635 | 1635 | ||
1636 | LCS_DBF_TEXT(2, trace, "strtauto"); | 1636 | LCS_DBF_TEXT(2, trace, "strtauto"); |
1637 | #ifdef CONFIG_NET_ETHERNET | 1637 | #ifdef CONFIG_ETHERNET |
1638 | card->lan_type = LCS_FRAME_TYPE_ENET; | 1638 | card->lan_type = LCS_FRAME_TYPE_ENET; |
1639 | rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); | 1639 | rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); |
1640 | if (rc == 0) | 1640 | if (rc == 0) |
@@ -2166,7 +2166,7 @@ lcs_new_device(struct ccwgroup_device *ccwgdev) | |||
2166 | goto netdev_out; | 2166 | goto netdev_out; |
2167 | } | 2167 | } |
2168 | switch (card->lan_type) { | 2168 | switch (card->lan_type) { |
2169 | #ifdef CONFIG_NET_ETHERNET | 2169 | #ifdef CONFIG_ETHERNET |
2170 | case LCS_FRAME_TYPE_ENET: | 2170 | case LCS_FRAME_TYPE_ENET: |
2171 | card->lan_type_trans = eth_type_trans; | 2171 | card->lan_type_trans = eth_type_trans; |
2172 | dev = alloc_etherdev(0); | 2172 | dev = alloc_etherdev(0); |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 3251333a23df..b6a6356d09b3 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -1994,6 +1994,8 @@ static struct net_device *netiucv_init_netdevice(char *username) | |||
1994 | netiucv_setup_netdevice); | 1994 | netiucv_setup_netdevice); |
1995 | if (!dev) | 1995 | if (!dev) |
1996 | return NULL; | 1996 | return NULL; |
1997 | if (dev_alloc_name(dev, dev->name) < 0) | ||
1998 | goto out_netdev; | ||
1997 | 1999 | ||
1998 | privptr = netdev_priv(dev); | 2000 | privptr = netdev_priv(dev); |
1999 | privptr->fsm = init_fsm("netiucvdev", dev_state_names, | 2001 | privptr->fsm = init_fsm("netiucvdev", dev_state_names, |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index b77c65ed1381..4abc79d3963f 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -236,8 +236,7 @@ static inline int qeth_is_ipa_enabled(struct qeth_ipa_info *ipa, | |||
236 | #define QETH_IN_BUF_COUNT_MAX 128 | 236 | #define QETH_IN_BUF_COUNT_MAX 128 |
237 | #define QETH_MAX_BUFFER_ELEMENTS(card) ((card)->qdio.in_buf_size >> 12) | 237 | #define QETH_MAX_BUFFER_ELEMENTS(card) ((card)->qdio.in_buf_size >> 12) |
238 | #define QETH_IN_BUF_REQUEUE_THRESHOLD(card) \ | 238 | #define QETH_IN_BUF_REQUEUE_THRESHOLD(card) \ |
239 | ((card)->ssqd.qdioac1 & AC1_SIGA_INPUT_NEEDED ? 1 : \ | 239 | ((card)->qdio.in_buf_pool.buf_count / 2) |
240 | ((card)->qdio.in_buf_pool.buf_count / 2)) | ||
241 | 240 | ||
242 | /* buffers we have to be behind before we get a PCI */ | 241 | /* buffers we have to be behind before we get a PCI */ |
243 | #define QETH_PCI_THRESHOLD_A(card) ((card)->qdio.in_buf_pool.buf_count+1) | 242 | #define QETH_PCI_THRESHOLD_A(card) ((card)->qdio.in_buf_pool.buf_count+1) |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 81534437373a..fff57de78943 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -881,7 +881,6 @@ EXPORT_SYMBOL_GPL(qeth_do_run_thread); | |||
881 | void qeth_schedule_recovery(struct qeth_card *card) | 881 | void qeth_schedule_recovery(struct qeth_card *card) |
882 | { | 882 | { |
883 | QETH_CARD_TEXT(card, 2, "startrec"); | 883 | QETH_CARD_TEXT(card, 2, "startrec"); |
884 | WARN_ON(1); | ||
885 | if (qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD) == 0) | 884 | if (qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD) == 0) |
886 | schedule_work(&card->kernel_thread_starter); | 885 | schedule_work(&card->kernel_thread_starter); |
887 | } | 886 | } |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index e4c1176ee25b..4d5307ddbe55 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -2756,11 +2756,13 @@ int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb) | |||
2756 | struct neighbour *n = NULL; | 2756 | struct neighbour *n = NULL; |
2757 | struct dst_entry *dst; | 2757 | struct dst_entry *dst; |
2758 | 2758 | ||
2759 | rcu_read_lock(); | ||
2759 | dst = skb_dst(skb); | 2760 | dst = skb_dst(skb); |
2760 | if (dst) | 2761 | if (dst) |
2761 | n = dst_get_neighbour(dst); | 2762 | n = dst_get_neighbour(dst); |
2762 | if (n) { | 2763 | if (n) { |
2763 | cast_type = n->type; | 2764 | cast_type = n->type; |
2765 | rcu_read_unlock(); | ||
2764 | if ((cast_type == RTN_BROADCAST) || | 2766 | if ((cast_type == RTN_BROADCAST) || |
2765 | (cast_type == RTN_MULTICAST) || | 2767 | (cast_type == RTN_MULTICAST) || |
2766 | (cast_type == RTN_ANYCAST)) | 2768 | (cast_type == RTN_ANYCAST)) |
@@ -2768,6 +2770,8 @@ int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb) | |||
2768 | else | 2770 | else |
2769 | return RTN_UNSPEC; | 2771 | return RTN_UNSPEC; |
2770 | } | 2772 | } |
2773 | rcu_read_unlock(); | ||
2774 | |||
2771 | /* try something else */ | 2775 | /* try something else */ |
2772 | if (skb->protocol == ETH_P_IPV6) | 2776 | if (skb->protocol == ETH_P_IPV6) |
2773 | return (skb_network_header(skb)[24] == 0xff) ? | 2777 | return (skb_network_header(skb)[24] == 0xff) ? |
@@ -2847,6 +2851,8 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | |||
2847 | } | 2851 | } |
2848 | 2852 | ||
2849 | hdr->hdr.l3.length = skb->len - sizeof(struct qeth_hdr); | 2853 | hdr->hdr.l3.length = skb->len - sizeof(struct qeth_hdr); |
2854 | |||
2855 | rcu_read_lock(); | ||
2850 | dst = skb_dst(skb); | 2856 | dst = skb_dst(skb); |
2851 | if (dst) | 2857 | if (dst) |
2852 | n = dst_get_neighbour(dst); | 2858 | n = dst_get_neighbour(dst); |
@@ -2893,6 +2899,7 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | |||
2893 | QETH_CAST_UNICAST | QETH_HDR_PASSTHRU; | 2899 | QETH_CAST_UNICAST | QETH_HDR_PASSTHRU; |
2894 | } | 2900 | } |
2895 | } | 2901 | } |
2902 | rcu_read_unlock(); | ||
2896 | } | 2903 | } |
2897 | 2904 | ||
2898 | static inline void qeth_l3_hdr_csum(struct qeth_card *card, | 2905 | static inline void qeth_l3_hdr_csum(struct qeth_card *card, |
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c index 0ea2fbfe0e99..d979bb26522f 100644 --- a/drivers/s390/net/qeth_l3_sys.c +++ b/drivers/s390/net/qeth_l3_sys.c | |||
@@ -335,10 +335,10 @@ static ssize_t qeth_l3_dev_sniffer_store(struct device *dev, | |||
335 | QETH_IN_BUF_COUNT_MAX) | 335 | QETH_IN_BUF_COUNT_MAX) |
336 | qeth_realloc_buffer_pool(card, | 336 | qeth_realloc_buffer_pool(card, |
337 | QETH_IN_BUF_COUNT_MAX); | 337 | QETH_IN_BUF_COUNT_MAX); |
338 | break; | ||
339 | } else | 338 | } else |
340 | rc = -EPERM; | 339 | rc = -EPERM; |
341 | default: /* fall through */ | 340 | break; |
341 | default: | ||
342 | rc = -EINVAL; | 342 | rc = -EINVAL; |
343 | } | 343 | } |
344 | out: | 344 | out: |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 4aa76d6f11df..705e13e470af 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/module.h> | 38 | #include <linux/module.h> |
39 | #include <linux/moduleparam.h> | 39 | #include <linux/moduleparam.h> |
40 | #include <linux/pci.h> | 40 | #include <linux/pci.h> |
41 | #include <linux/pci-aspm.h> | ||
41 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
42 | #include <linux/mutex.h> | 43 | #include <linux/mutex.h> |
43 | #include <linux/spinlock.h> | 44 | #include <linux/spinlock.h> |
@@ -1109,6 +1110,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
1109 | unique_id++; | 1110 | unique_id++; |
1110 | } | 1111 | } |
1111 | 1112 | ||
1113 | pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | | ||
1114 | PCIE_LINK_STATE_CLKPM); | ||
1115 | |||
1112 | error = pci_enable_device(pdev); | 1116 | error = pci_enable_device(pdev); |
1113 | if (error) | 1117 | if (error) |
1114 | goto out; | 1118 | goto out; |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index e76107b2ade3..865d452542be 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/pci-aspm.h> | ||
26 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
28 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
@@ -3922,6 +3923,10 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h) | |||
3922 | dev_warn(&h->pdev->dev, "controller appears to be disabled\n"); | 3923 | dev_warn(&h->pdev->dev, "controller appears to be disabled\n"); |
3923 | return -ENODEV; | 3924 | return -ENODEV; |
3924 | } | 3925 | } |
3926 | |||
3927 | pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S | | ||
3928 | PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM); | ||
3929 | |||
3925 | err = pci_enable_device(h->pdev); | 3930 | err = pci_enable_device(h->pdev); |
3926 | if (err) { | 3931 | if (err) { |
3927 | dev_warn(&h->pdev->dev, "unable to enable PCI device\n"); | 3932 | dev_warn(&h->pdev->dev, "unable to enable PCI device\n"); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 8889b1babcac..4e041f6d808c 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -2802,6 +2802,11 @@ _scsih_error_recovery_delete_devices(struct MPT2SAS_ADAPTER *ioc) | |||
2802 | 2802 | ||
2803 | if (ioc->is_driver_loading) | 2803 | if (ioc->is_driver_loading) |
2804 | return; | 2804 | return; |
2805 | |||
2806 | fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC); | ||
2807 | if (!fw_event) | ||
2808 | return; | ||
2809 | |||
2805 | fw_event->event = MPT2SAS_REMOVE_UNRESPONDING_DEVICES; | 2810 | fw_event->event = MPT2SAS_REMOVE_UNRESPONDING_DEVICES; |
2806 | fw_event->ioc = ioc; | 2811 | fw_event->ioc = ioc; |
2807 | _scsih_fw_event_add(ioc, fw_event); | 2812 | _scsih_fw_event_add(ioc, fw_event); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 06bc26554a67..f85cfa6c47b5 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1409,6 +1409,8 @@ static void scsi_kill_request(struct request *req, struct request_queue *q) | |||
1409 | 1409 | ||
1410 | blk_start_request(req); | 1410 | blk_start_request(req); |
1411 | 1411 | ||
1412 | scmd_printk(KERN_INFO, cmd, "killing request\n"); | ||
1413 | |||
1412 | sdev = cmd->device; | 1414 | sdev = cmd->device; |
1413 | starget = scsi_target(sdev); | 1415 | starget = scsi_target(sdev); |
1414 | shost = sdev->host; | 1416 | shost = sdev->host; |
@@ -1490,7 +1492,6 @@ static void scsi_request_fn(struct request_queue *q) | |||
1490 | struct request *req; | 1492 | struct request *req; |
1491 | 1493 | ||
1492 | if (!sdev) { | 1494 | if (!sdev) { |
1493 | printk("scsi: killing requests for dead queue\n"); | ||
1494 | while ((req = blk_peek_request(q)) != NULL) | 1495 | while ((req = blk_peek_request(q)) != NULL) |
1495 | scsi_kill_request(req, q); | 1496 | scsi_kill_request(req, q); |
1496 | return; | 1497 | return; |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 72273a0e5666..b3c6d957fbd8 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -319,11 +319,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, | |||
319 | return sdev; | 319 | return sdev; |
320 | 320 | ||
321 | out_device_destroy: | 321 | out_device_destroy: |
322 | scsi_device_set_state(sdev, SDEV_DEL); | 322 | __scsi_remove_device(sdev); |
323 | transport_destroy_device(&sdev->sdev_gendev); | ||
324 | put_device(&sdev->sdev_dev); | ||
325 | scsi_free_queue(sdev->request_queue); | ||
326 | put_device(&sdev->sdev_gendev); | ||
327 | out: | 323 | out: |
328 | if (display_failure_msg) | 324 | if (display_failure_msg) |
329 | printk(ALLOC_FAILURE_MSG, __func__); | 325 | printk(ALLOC_FAILURE_MSG, __func__); |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index f103e470cb63..5559b2299198 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -2184,6 +2184,12 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2184 | goto err_clk_prep; | 2184 | goto err_clk_prep; |
2185 | } | 2185 | } |
2186 | 2186 | ||
2187 | status = clk_enable(pl022->clk); | ||
2188 | if (status) { | ||
2189 | dev_err(&adev->dev, "could not enable SSP/SPI bus clock\n"); | ||
2190 | goto err_no_clk_en; | ||
2191 | } | ||
2192 | |||
2187 | /* Disable SSP */ | 2193 | /* Disable SSP */ |
2188 | writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), | 2194 | writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), |
2189 | SSP_CR1(pl022->virtbase)); | 2195 | SSP_CR1(pl022->virtbase)); |
@@ -2237,6 +2243,8 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2237 | 2243 | ||
2238 | free_irq(adev->irq[0], pl022); | 2244 | free_irq(adev->irq[0], pl022); |
2239 | err_no_irq: | 2245 | err_no_irq: |
2246 | clk_disable(pl022->clk); | ||
2247 | err_no_clk_en: | ||
2240 | clk_unprepare(pl022->clk); | 2248 | clk_unprepare(pl022->clk); |
2241 | err_clk_prep: | 2249 | err_clk_prep: |
2242 | clk_put(pl022->clk); | 2250 | clk_put(pl022->clk); |
diff --git a/drivers/staging/et131x/Kconfig b/drivers/staging/et131x/Kconfig index 9e1864c6dfd0..8190f2aaf53b 100644 --- a/drivers/staging/et131x/Kconfig +++ b/drivers/staging/et131x/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config ET131X | 1 | config ET131X |
2 | tristate "Agere ET-1310 Gigabit Ethernet support" | 2 | tristate "Agere ET-1310 Gigabit Ethernet support" |
3 | depends on PCI | 3 | depends on PCI && NET && NETDEVICES |
4 | select PHYLIB | ||
4 | default n | 5 | default n |
5 | ---help--- | 6 | ---help--- |
6 | This driver supports Agere ET-1310 ethernet adapters. | 7 | This driver supports Agere ET-1310 ethernet adapters. |
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index f5f44a02456f..0c1c6ca8c379 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c | |||
@@ -4469,6 +4469,12 @@ static int et131x_resume(struct device *dev) | |||
4469 | return 0; | 4469 | return 0; |
4470 | } | 4470 | } |
4471 | 4471 | ||
4472 | static SIMPLE_DEV_PM_OPS(et131x_pm_ops, et131x_suspend, et131x_resume); | ||
4473 | #define ET131X_PM_OPS (&et131x_pm_ops) | ||
4474 | #else | ||
4475 | #define ET131X_PM_OPS NULL | ||
4476 | #endif | ||
4477 | |||
4472 | /* ISR functions */ | 4478 | /* ISR functions */ |
4473 | 4479 | ||
4474 | /** | 4480 | /** |
@@ -5470,12 +5476,6 @@ err_out: | |||
5470 | return result; | 5476 | return result; |
5471 | } | 5477 | } |
5472 | 5478 | ||
5473 | static SIMPLE_DEV_PM_OPS(et131x_pm_ops, et131x_suspend, et131x_resume); | ||
5474 | #define ET131X_PM_OPS (&et131x_pm_ops) | ||
5475 | #else | ||
5476 | #define ET131X_PM_OPS NULL | ||
5477 | #endif | ||
5478 | |||
5479 | static DEFINE_PCI_DEVICE_TABLE(et131x_pci_table) = { | 5479 | static DEFINE_PCI_DEVICE_TABLE(et131x_pci_table) = { |
5480 | { PCI_VDEVICE(ATT, ET131X_PCI_DEVICE_ID_GIG), 0UL}, | 5480 | { PCI_VDEVICE(ATT, ET131X_PCI_DEVICE_ID_GIG), 0UL}, |
5481 | { PCI_VDEVICE(ATT, ET131X_PCI_DEVICE_ID_FAST), 0UL}, | 5481 | { PCI_VDEVICE(ATT, ET131X_PCI_DEVICE_ID_FAST), 0UL}, |
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c index 326e967d54ef..26564094e33b 100644 --- a/drivers/staging/iio/industrialio-core.c +++ b/drivers/staging/iio/industrialio-core.c | |||
@@ -242,6 +242,8 @@ static const struct file_operations iio_event_chrdev_fileops = { | |||
242 | 242 | ||
243 | static int iio_event_getfd(struct iio_dev *indio_dev) | 243 | static int iio_event_getfd(struct iio_dev *indio_dev) |
244 | { | 244 | { |
245 | int fd; | ||
246 | |||
245 | if (indio_dev->event_interface == NULL) | 247 | if (indio_dev->event_interface == NULL) |
246 | return -ENODEV; | 248 | return -ENODEV; |
247 | 249 | ||
@@ -252,9 +254,15 @@ static int iio_event_getfd(struct iio_dev *indio_dev) | |||
252 | return -EBUSY; | 254 | return -EBUSY; |
253 | } | 255 | } |
254 | mutex_unlock(&indio_dev->event_interface->event_list_lock); | 256 | mutex_unlock(&indio_dev->event_interface->event_list_lock); |
255 | return anon_inode_getfd("iio:event", | 257 | fd = anon_inode_getfd("iio:event", |
256 | &iio_event_chrdev_fileops, | 258 | &iio_event_chrdev_fileops, |
257 | indio_dev->event_interface, O_RDONLY); | 259 | indio_dev->event_interface, O_RDONLY); |
260 | if (fd < 0) { | ||
261 | mutex_lock(&indio_dev->event_interface->event_list_lock); | ||
262 | clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); | ||
263 | mutex_unlock(&indio_dev->event_interface->event_list_lock); | ||
264 | } | ||
265 | return fd; | ||
258 | } | 266 | } |
259 | 267 | ||
260 | static int __init iio_init(void) | 268 | static int __init iio_init(void) |
diff --git a/drivers/staging/media/as102/as102_drv.c b/drivers/staging/media/as102/as102_drv.c index d335c7d6fa0f..828526d4c289 100644 --- a/drivers/staging/media/as102/as102_drv.c +++ b/drivers/staging/media/as102/as102_drv.c | |||
@@ -32,8 +32,8 @@ | |||
32 | #include "as102_fw.h" | 32 | #include "as102_fw.h" |
33 | #include "dvbdev.h" | 33 | #include "dvbdev.h" |
34 | 34 | ||
35 | int debug; | 35 | int as102_debug; |
36 | module_param_named(debug, debug, int, 0644); | 36 | module_param_named(debug, as102_debug, int, 0644); |
37 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default: off)"); | 37 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default: off)"); |
38 | 38 | ||
39 | int dual_tuner; | 39 | int dual_tuner; |
diff --git a/drivers/staging/media/as102/as102_drv.h b/drivers/staging/media/as102/as102_drv.h index bcda635b5a99..fd33f5a12dcc 100644 --- a/drivers/staging/media/as102/as102_drv.h +++ b/drivers/staging/media/as102/as102_drv.h | |||
@@ -37,7 +37,8 @@ extern struct spi_driver as102_spi_driver; | |||
37 | #define DRIVER_FULL_NAME "Abilis Systems as10x usb driver" | 37 | #define DRIVER_FULL_NAME "Abilis Systems as10x usb driver" |
38 | #define DRIVER_NAME "as10x_usb" | 38 | #define DRIVER_NAME "as10x_usb" |
39 | 39 | ||
40 | extern int debug; | 40 | extern int as102_debug; |
41 | #define debug as102_debug | ||
41 | 42 | ||
42 | #define dprintk(debug, args...) \ | 43 | #define dprintk(debug, args...) \ |
43 | do { if (debug) { \ | 44 | do { if (debug) { \ |
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index b445cd63f901..2542c3743904 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c | |||
@@ -275,7 +275,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) | |||
275 | CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64; | 275 | CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64; |
276 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 276 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
277 | struct skb_frag_struct *fs = skb_shinfo(skb)->frags + i; | 277 | struct skb_frag_struct *fs = skb_shinfo(skb)->frags + i; |
278 | hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)(page_address(fs->page) + fs->page_offset)); | 278 | hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)(page_address(fs->page.p) + fs->page_offset)); |
279 | hw_buffer.s.size = fs->size; | 279 | hw_buffer.s.size = fs->size; |
280 | CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64; | 280 | CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64; |
281 | } | 281 | } |
diff --git a/drivers/staging/slicoss/Kconfig b/drivers/staging/slicoss/Kconfig index 5cde96b2e6e1..5c2a15b42dfe 100644 --- a/drivers/staging/slicoss/Kconfig +++ b/drivers/staging/slicoss/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config SLICOSS | 1 | config SLICOSS |
2 | tristate "Alacritech Gigabit IS-NIC support" | 2 | tristate "Alacritech Gigabit IS-NIC support" |
3 | depends on PCI && X86 | 3 | depends on PCI && X86 && NET |
4 | default n | 4 | default n |
5 | help | 5 | help |
6 | This driver supports Alacritech's IS-NIC gigabit ethernet cards. | 6 | This driver supports Alacritech's IS-NIC gigabit ethernet cards. |
diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c index 435f6facbc23..44fbebab5075 100644 --- a/drivers/tty/hvc/hvc_dcc.c +++ b/drivers/tty/hvc/hvc_dcc.c | |||
@@ -46,6 +46,7 @@ static inline char __dcc_getchar(void) | |||
46 | 46 | ||
47 | asm volatile("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg" | 47 | asm volatile("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg" |
48 | : "=r" (__c)); | 48 | : "=r" (__c)); |
49 | isb(); | ||
49 | 50 | ||
50 | return __c; | 51 | return __c; |
51 | } | 52 | } |
@@ -55,6 +56,7 @@ static inline void __dcc_putchar(char c) | |||
55 | asm volatile("mcr p14, 0, %0, c0, c5, 0 @ write a char" | 56 | asm volatile("mcr p14, 0, %0, c0, c5, 0 @ write a char" |
56 | : /* no output register */ | 57 | : /* no output register */ |
57 | : "r" (c)); | 58 | : "r" (c)); |
59 | isb(); | ||
58 | } | 60 | } |
59 | 61 | ||
60 | static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count) | 62 | static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count) |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 5f479dada6f2..925a1e547a83 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -1560,7 +1560,7 @@ config SERIAL_IFX6X60 | |||
1560 | Support for the IFX6x60 modem devices on Intel MID platforms. | 1560 | Support for the IFX6x60 modem devices on Intel MID platforms. |
1561 | 1561 | ||
1562 | config SERIAL_PCH_UART | 1562 | config SERIAL_PCH_UART |
1563 | tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) UART" | 1563 | tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) UART" |
1564 | depends on PCI | 1564 | depends on PCI |
1565 | select SERIAL_CORE | 1565 | select SERIAL_CORE |
1566 | help | 1566 | help |
@@ -1568,12 +1568,12 @@ config SERIAL_PCH_UART | |||
1568 | which is an IOH(Input/Output Hub) for x86 embedded processor. | 1568 | which is an IOH(Input/Output Hub) for x86 embedded processor. |
1569 | Enabling PCH_DMA, this PCH UART works as DMA mode. | 1569 | Enabling PCH_DMA, this PCH UART works as DMA mode. |
1570 | 1570 | ||
1571 | This driver also can be used for OKI SEMICONDUCTOR IOH(Input/ | 1571 | This driver also can be used for LAPIS Semiconductor IOH(Input/ |
1572 | Output Hub), ML7213 and ML7223. | 1572 | Output Hub), ML7213, ML7223 and ML7831. |
1573 | ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is | 1573 | ML7213 IOH is for IVI(In-Vehicle Infotainment) use, ML7223 IOH is |
1574 | for MP(Media Phone) use. | 1574 | for MP(Media Phone) use and ML7831 IOH is for general purpose use. |
1575 | ML7213/ML7223 is companion chip for Intel Atom E6xx series. | 1575 | ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series. |
1576 | ML7213/ML7223 is completely compatible for Intel EG20T PCH. | 1576 | ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH. |
1577 | 1577 | ||
1578 | config SERIAL_MSM_SMD | 1578 | config SERIAL_MSM_SMD |
1579 | bool "Enable tty device interface for some SMD ports" | 1579 | bool "Enable tty device interface for some SMD ports" |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 4a0f86fa1e90..4c823f341d98 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -228,7 +228,7 @@ void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf) | |||
228 | if (rs485conf->flags & SER_RS485_ENABLED) { | 228 | if (rs485conf->flags & SER_RS485_ENABLED) { |
229 | dev_dbg(port->dev, "Setting UART to RS485\n"); | 229 | dev_dbg(port->dev, "Setting UART to RS485\n"); |
230 | atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; | 230 | atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; |
231 | if (rs485conf->flags & SER_RS485_RTS_AFTER_SEND) | 231 | if ((rs485conf->delay_rts_after_send) > 0) |
232 | UART_PUT_TTGR(port, rs485conf->delay_rts_after_send); | 232 | UART_PUT_TTGR(port, rs485conf->delay_rts_after_send); |
233 | mode |= ATMEL_US_USMODE_RS485; | 233 | mode |= ATMEL_US_USMODE_RS485; |
234 | } else { | 234 | } else { |
@@ -304,7 +304,7 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl) | |||
304 | 304 | ||
305 | if (atmel_port->rs485.flags & SER_RS485_ENABLED) { | 305 | if (atmel_port->rs485.flags & SER_RS485_ENABLED) { |
306 | dev_dbg(port->dev, "Setting UART to RS485\n"); | 306 | dev_dbg(port->dev, "Setting UART to RS485\n"); |
307 | if (atmel_port->rs485.flags & SER_RS485_RTS_AFTER_SEND) | 307 | if ((atmel_port->rs485.delay_rts_after_send) > 0) |
308 | UART_PUT_TTGR(port, | 308 | UART_PUT_TTGR(port, |
309 | atmel_port->rs485.delay_rts_after_send); | 309 | atmel_port->rs485.delay_rts_after_send); |
310 | mode |= ATMEL_US_USMODE_RS485; | 310 | mode |= ATMEL_US_USMODE_RS485; |
@@ -1228,7 +1228,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1228 | 1228 | ||
1229 | if (atmel_port->rs485.flags & SER_RS485_ENABLED) { | 1229 | if (atmel_port->rs485.flags & SER_RS485_ENABLED) { |
1230 | dev_dbg(port->dev, "Setting UART to RS485\n"); | 1230 | dev_dbg(port->dev, "Setting UART to RS485\n"); |
1231 | if (atmel_port->rs485.flags & SER_RS485_RTS_AFTER_SEND) | 1231 | if ((atmel_port->rs485.delay_rts_after_send) > 0) |
1232 | UART_PUT_TTGR(port, | 1232 | UART_PUT_TTGR(port, |
1233 | atmel_port->rs485.delay_rts_after_send); | 1233 | atmel_port->rs485.delay_rts_after_send); |
1234 | mode |= ATMEL_US_USMODE_RS485; | 1234 | mode |= ATMEL_US_USMODE_RS485; |
@@ -1447,16 +1447,6 @@ static void __devinit atmel_of_init_port(struct atmel_uart_port *atmel_port, | |||
1447 | rs485conf->delay_rts_after_send = rs485_delay[1]; | 1447 | rs485conf->delay_rts_after_send = rs485_delay[1]; |
1448 | rs485conf->flags = 0; | 1448 | rs485conf->flags = 0; |
1449 | 1449 | ||
1450 | if (rs485conf->delay_rts_before_send == 0 && | ||
1451 | rs485conf->delay_rts_after_send == 0) { | ||
1452 | rs485conf->flags |= SER_RS485_RTS_ON_SEND; | ||
1453 | } else { | ||
1454 | if (rs485conf->delay_rts_before_send) | ||
1455 | rs485conf->flags |= SER_RS485_RTS_BEFORE_SEND; | ||
1456 | if (rs485conf->delay_rts_after_send) | ||
1457 | rs485conf->flags |= SER_RS485_RTS_AFTER_SEND; | ||
1458 | } | ||
1459 | |||
1460 | if (of_get_property(np, "rs485-rx-during-tx", NULL)) | 1450 | if (of_get_property(np, "rs485-rx-during-tx", NULL)) |
1461 | rs485conf->flags |= SER_RS485_RX_DURING_TX; | 1451 | rs485conf->flags |= SER_RS485_RX_DURING_TX; |
1462 | 1452 | ||
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index b7435043f2fe..1dfba7b779c8 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c | |||
@@ -3234,9 +3234,8 @@ rs_write(struct tty_struct *tty, | |||
3234 | e100_disable_rx(info); | 3234 | e100_disable_rx(info); |
3235 | e100_enable_rx_irq(info); | 3235 | e100_enable_rx_irq(info); |
3236 | #endif | 3236 | #endif |
3237 | if ((info->rs485.flags & SER_RS485_RTS_BEFORE_SEND) && | 3237 | if (info->rs485.delay_rts_before_send > 0) |
3238 | (info->rs485.delay_rts_before_send > 0)) | 3238 | msleep(info->rs485.delay_rts_before_send); |
3239 | msleep(info->rs485.delay_rts_before_send); | ||
3240 | } | 3239 | } |
3241 | #endif /* CONFIG_ETRAX_RS485 */ | 3240 | #endif /* CONFIG_ETRAX_RS485 */ |
3242 | 3241 | ||
@@ -3693,10 +3692,6 @@ rs_ioctl(struct tty_struct *tty, | |||
3693 | 3692 | ||
3694 | rs485data.delay_rts_before_send = rs485ctrl.delay_rts_before_send; | 3693 | rs485data.delay_rts_before_send = rs485ctrl.delay_rts_before_send; |
3695 | rs485data.flags = 0; | 3694 | rs485data.flags = 0; |
3696 | if (rs485data.delay_rts_before_send != 0) | ||
3697 | rs485data.flags |= SER_RS485_RTS_BEFORE_SEND; | ||
3698 | else | ||
3699 | rs485data.flags &= ~(SER_RS485_RTS_BEFORE_SEND); | ||
3700 | 3695 | ||
3701 | if (rs485ctrl.enabled) | 3696 | if (rs485ctrl.enabled) |
3702 | rs485data.flags |= SER_RS485_ENABLED; | 3697 | rs485data.flags |= SER_RS485_ENABLED; |
@@ -4531,7 +4526,6 @@ static int __init rs_init(void) | |||
4531 | /* Set sane defaults */ | 4526 | /* Set sane defaults */ |
4532 | info->rs485.flags &= ~(SER_RS485_RTS_ON_SEND); | 4527 | info->rs485.flags &= ~(SER_RS485_RTS_ON_SEND); |
4533 | info->rs485.flags |= SER_RS485_RTS_AFTER_SEND; | 4528 | info->rs485.flags |= SER_RS485_RTS_AFTER_SEND; |
4534 | info->rs485.flags &= ~(SER_RS485_RTS_BEFORE_SEND); | ||
4535 | info->rs485.delay_rts_before_send = 0; | 4529 | info->rs485.delay_rts_before_send = 0; |
4536 | info->rs485.flags &= ~(SER_RS485_ENABLED); | 4530 | info->rs485.flags &= ~(SER_RS485_ENABLED); |
4537 | #endif | 4531 | #endif |
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c index 286c386d9c46..e272d3919c67 100644 --- a/drivers/tty/serial/mfd.c +++ b/drivers/tty/serial/mfd.c | |||
@@ -884,7 +884,6 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, | |||
884 | { | 884 | { |
885 | struct uart_hsu_port *up = | 885 | struct uart_hsu_port *up = |
886 | container_of(port, struct uart_hsu_port, port); | 886 | container_of(port, struct uart_hsu_port, port); |
887 | struct tty_struct *tty = port->state->port.tty; | ||
888 | unsigned char cval, fcr = 0; | 887 | unsigned char cval, fcr = 0; |
889 | unsigned long flags; | 888 | unsigned long flags; |
890 | unsigned int baud, quot; | 889 | unsigned int baud, quot; |
@@ -907,8 +906,7 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, | |||
907 | } | 906 | } |
908 | 907 | ||
909 | /* CMSPAR isn't supported by this driver */ | 908 | /* CMSPAR isn't supported by this driver */ |
910 | if (tty) | 909 | termios->c_cflag &= ~CMSPAR; |
911 | tty->termios->c_cflag &= ~CMSPAR; | ||
912 | 910 | ||
913 | if (termios->c_cflag & CSTOPB) | 911 | if (termios->c_cflag & CSTOPB) |
914 | cval |= UART_LCR_STOP; | 912 | cval |= UART_LCR_STOP; |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 21febef926aa..d6aba8c087e4 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | *Copyright (C) 2010 OKI SEMICONDUCTOR CO., LTD. | 2 | *Copyright (C) 2011 LAPIS Semiconductor Co., Ltd. |
3 | * | 3 | * |
4 | *This program is free software; you can redistribute it and/or modify | 4 | *This program is free software; you can redistribute it and/or modify |
5 | *it under the terms of the GNU General Public License as published by | 5 | *it under the terms of the GNU General Public License as published by |
@@ -46,8 +46,8 @@ enum { | |||
46 | 46 | ||
47 | /* Set the max number of UART port | 47 | /* Set the max number of UART port |
48 | * Intel EG20T PCH: 4 port | 48 | * Intel EG20T PCH: 4 port |
49 | * OKI SEMICONDUCTOR ML7213 IOH: 3 port | 49 | * LAPIS Semiconductor ML7213 IOH: 3 port |
50 | * OKI SEMICONDUCTOR ML7223 IOH: 2 port | 50 | * LAPIS Semiconductor ML7223 IOH: 2 port |
51 | */ | 51 | */ |
52 | #define PCH_UART_NR 4 | 52 | #define PCH_UART_NR 4 |
53 | 53 | ||
@@ -258,6 +258,8 @@ enum pch_uart_num_t { | |||
258 | pch_ml7213_uart2, | 258 | pch_ml7213_uart2, |
259 | pch_ml7223_uart0, | 259 | pch_ml7223_uart0, |
260 | pch_ml7223_uart1, | 260 | pch_ml7223_uart1, |
261 | pch_ml7831_uart0, | ||
262 | pch_ml7831_uart1, | ||
261 | }; | 263 | }; |
262 | 264 | ||
263 | static struct pch_uart_driver_data drv_dat[] = { | 265 | static struct pch_uart_driver_data drv_dat[] = { |
@@ -270,6 +272,8 @@ static struct pch_uart_driver_data drv_dat[] = { | |||
270 | [pch_ml7213_uart2] = {PCH_UART_2LINE, 2}, | 272 | [pch_ml7213_uart2] = {PCH_UART_2LINE, 2}, |
271 | [pch_ml7223_uart0] = {PCH_UART_8LINE, 0}, | 273 | [pch_ml7223_uart0] = {PCH_UART_8LINE, 0}, |
272 | [pch_ml7223_uart1] = {PCH_UART_2LINE, 1}, | 274 | [pch_ml7223_uart1] = {PCH_UART_2LINE, 1}, |
275 | [pch_ml7831_uart0] = {PCH_UART_8LINE, 0}, | ||
276 | [pch_ml7831_uart1] = {PCH_UART_2LINE, 1}, | ||
273 | }; | 277 | }; |
274 | 278 | ||
275 | static unsigned int default_baud = 9600; | 279 | static unsigned int default_baud = 9600; |
@@ -628,6 +632,7 @@ static void pch_request_dma(struct uart_port *port) | |||
628 | dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Rx)\n", | 632 | dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Rx)\n", |
629 | __func__); | 633 | __func__); |
630 | dma_release_channel(priv->chan_tx); | 634 | dma_release_channel(priv->chan_tx); |
635 | priv->chan_tx = NULL; | ||
631 | return; | 636 | return; |
632 | } | 637 | } |
633 | 638 | ||
@@ -1215,8 +1220,7 @@ static void pch_uart_shutdown(struct uart_port *port) | |||
1215 | dev_err(priv->port.dev, | 1220 | dev_err(priv->port.dev, |
1216 | "pch_uart_hal_set_fifo Failed(ret=%d)\n", ret); | 1221 | "pch_uart_hal_set_fifo Failed(ret=%d)\n", ret); |
1217 | 1222 | ||
1218 | if (priv->use_dma_flag) | 1223 | pch_free_dma(port); |
1219 | pch_free_dma(port); | ||
1220 | 1224 | ||
1221 | free_irq(priv->port.irq, priv); | 1225 | free_irq(priv->port.irq, priv); |
1222 | } | 1226 | } |
@@ -1280,6 +1284,7 @@ static void pch_uart_set_termios(struct uart_port *port, | |||
1280 | if (rtn) | 1284 | if (rtn) |
1281 | goto out; | 1285 | goto out; |
1282 | 1286 | ||
1287 | pch_uart_set_mctrl(&priv->port, priv->port.mctrl); | ||
1283 | /* Don't rewrite B0 */ | 1288 | /* Don't rewrite B0 */ |
1284 | if (tty_termios_baud_rate(termios)) | 1289 | if (tty_termios_baud_rate(termios)) |
1285 | tty_termios_encode_baud_rate(termios, baud, baud); | 1290 | tty_termios_encode_baud_rate(termios, baud, baud); |
@@ -1552,6 +1557,10 @@ static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = { | |||
1552 | .driver_data = pch_ml7223_uart0}, | 1557 | .driver_data = pch_ml7223_uart0}, |
1553 | {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x800D), | 1558 | {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x800D), |
1554 | .driver_data = pch_ml7223_uart1}, | 1559 | .driver_data = pch_ml7223_uart1}, |
1560 | {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8811), | ||
1561 | .driver_data = pch_ml7831_uart0}, | ||
1562 | {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8812), | ||
1563 | .driver_data = pch_ml7831_uart1}, | ||
1555 | {0,}, | 1564 | {0,}, |
1556 | }; | 1565 | }; |
1557 | 1566 | ||
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 512c49f98e85..8e0924f55446 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #include <linux/kmod.h> | 37 | #include <linux/kmod.h> |
38 | #include <linux/nsproxy.h> | 38 | #include <linux/nsproxy.h> |
39 | #include <linux/ratelimit.h> | ||
39 | 40 | ||
40 | /* | 41 | /* |
41 | * This guards the refcounted line discipline lists. The lock | 42 | * This guards the refcounted line discipline lists. The lock |
@@ -547,15 +548,16 @@ static void tty_ldisc_flush_works(struct tty_struct *tty) | |||
547 | /** | 548 | /** |
548 | * tty_ldisc_wait_idle - wait for the ldisc to become idle | 549 | * tty_ldisc_wait_idle - wait for the ldisc to become idle |
549 | * @tty: tty to wait for | 550 | * @tty: tty to wait for |
551 | * @timeout: for how long to wait at most | ||
550 | * | 552 | * |
551 | * Wait for the line discipline to become idle. The discipline must | 553 | * Wait for the line discipline to become idle. The discipline must |
552 | * have been halted for this to guarantee it remains idle. | 554 | * have been halted for this to guarantee it remains idle. |
553 | */ | 555 | */ |
554 | static int tty_ldisc_wait_idle(struct tty_struct *tty) | 556 | static int tty_ldisc_wait_idle(struct tty_struct *tty, long timeout) |
555 | { | 557 | { |
556 | int ret; | 558 | long ret; |
557 | ret = wait_event_timeout(tty_ldisc_idle, | 559 | ret = wait_event_timeout(tty_ldisc_idle, |
558 | atomic_read(&tty->ldisc->users) == 1, 5 * HZ); | 560 | atomic_read(&tty->ldisc->users) == 1, timeout); |
559 | if (ret < 0) | 561 | if (ret < 0) |
560 | return ret; | 562 | return ret; |
561 | return ret > 0 ? 0 : -EBUSY; | 563 | return ret > 0 ? 0 : -EBUSY; |
@@ -665,7 +667,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) | |||
665 | 667 | ||
666 | tty_ldisc_flush_works(tty); | 668 | tty_ldisc_flush_works(tty); |
667 | 669 | ||
668 | retval = tty_ldisc_wait_idle(tty); | 670 | retval = tty_ldisc_wait_idle(tty, 5 * HZ); |
669 | 671 | ||
670 | tty_lock(); | 672 | tty_lock(); |
671 | mutex_lock(&tty->ldisc_mutex); | 673 | mutex_lock(&tty->ldisc_mutex); |
@@ -762,8 +764,6 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc) | |||
762 | if (IS_ERR(ld)) | 764 | if (IS_ERR(ld)) |
763 | return -1; | 765 | return -1; |
764 | 766 | ||
765 | WARN_ON_ONCE(tty_ldisc_wait_idle(tty)); | ||
766 | |||
767 | tty_ldisc_close(tty, tty->ldisc); | 767 | tty_ldisc_close(tty, tty->ldisc); |
768 | tty_ldisc_put(tty->ldisc); | 768 | tty_ldisc_put(tty->ldisc); |
769 | tty->ldisc = NULL; | 769 | tty->ldisc = NULL; |
@@ -838,7 +838,7 @@ void tty_ldisc_hangup(struct tty_struct *tty) | |||
838 | tty_unlock(); | 838 | tty_unlock(); |
839 | cancel_work_sync(&tty->buf.work); | 839 | cancel_work_sync(&tty->buf.work); |
840 | mutex_unlock(&tty->ldisc_mutex); | 840 | mutex_unlock(&tty->ldisc_mutex); |
841 | 841 | retry: | |
842 | tty_lock(); | 842 | tty_lock(); |
843 | mutex_lock(&tty->ldisc_mutex); | 843 | mutex_lock(&tty->ldisc_mutex); |
844 | 844 | ||
@@ -847,6 +847,22 @@ void tty_ldisc_hangup(struct tty_struct *tty) | |||
847 | it means auditing a lot of other paths so this is | 847 | it means auditing a lot of other paths so this is |
848 | a FIXME */ | 848 | a FIXME */ |
849 | if (tty->ldisc) { /* Not yet closed */ | 849 | if (tty->ldisc) { /* Not yet closed */ |
850 | if (atomic_read(&tty->ldisc->users) != 1) { | ||
851 | char cur_n[TASK_COMM_LEN], tty_n[64]; | ||
852 | long timeout = 3 * HZ; | ||
853 | tty_unlock(); | ||
854 | |||
855 | while (tty_ldisc_wait_idle(tty, timeout) == -EBUSY) { | ||
856 | timeout = MAX_SCHEDULE_TIMEOUT; | ||
857 | printk_ratelimited(KERN_WARNING | ||
858 | "%s: waiting (%s) for %s took too long, but we keep waiting...\n", | ||
859 | __func__, get_task_comm(cur_n, current), | ||
860 | tty_name(tty, tty_n)); | ||
861 | } | ||
862 | mutex_unlock(&tty->ldisc_mutex); | ||
863 | goto retry; | ||
864 | } | ||
865 | |||
850 | if (reset == 0) { | 866 | if (reset == 0) { |
851 | 867 | ||
852 | if (!tty_ldisc_reinit(tty, tty->termios->c_line)) | 868 | if (!tty_ldisc_reinit(tty, tty->termios->c_line)) |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 6960715c5063..e8c564a53346 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -539,7 +539,6 @@ static void acm_port_down(struct acm *acm) | |||
539 | { | 539 | { |
540 | int i; | 540 | int i; |
541 | 541 | ||
542 | mutex_lock(&open_mutex); | ||
543 | if (acm->dev) { | 542 | if (acm->dev) { |
544 | usb_autopm_get_interface(acm->control); | 543 | usb_autopm_get_interface(acm->control); |
545 | acm_set_control(acm, acm->ctrlout = 0); | 544 | acm_set_control(acm, acm->ctrlout = 0); |
@@ -551,14 +550,15 @@ static void acm_port_down(struct acm *acm) | |||
551 | acm->control->needs_remote_wakeup = 0; | 550 | acm->control->needs_remote_wakeup = 0; |
552 | usb_autopm_put_interface(acm->control); | 551 | usb_autopm_put_interface(acm->control); |
553 | } | 552 | } |
554 | mutex_unlock(&open_mutex); | ||
555 | } | 553 | } |
556 | 554 | ||
557 | static void acm_tty_hangup(struct tty_struct *tty) | 555 | static void acm_tty_hangup(struct tty_struct *tty) |
558 | { | 556 | { |
559 | struct acm *acm = tty->driver_data; | 557 | struct acm *acm = tty->driver_data; |
560 | tty_port_hangup(&acm->port); | 558 | tty_port_hangup(&acm->port); |
559 | mutex_lock(&open_mutex); | ||
561 | acm_port_down(acm); | 560 | acm_port_down(acm); |
561 | mutex_unlock(&open_mutex); | ||
562 | } | 562 | } |
563 | 563 | ||
564 | static void acm_tty_close(struct tty_struct *tty, struct file *filp) | 564 | static void acm_tty_close(struct tty_struct *tty, struct file *filp) |
@@ -569,8 +569,9 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) | |||
569 | shutdown */ | 569 | shutdown */ |
570 | if (!acm) | 570 | if (!acm) |
571 | return; | 571 | return; |
572 | |||
573 | mutex_lock(&open_mutex); | ||
572 | if (tty_port_close_start(&acm->port, tty, filp) == 0) { | 574 | if (tty_port_close_start(&acm->port, tty, filp) == 0) { |
573 | mutex_lock(&open_mutex); | ||
574 | if (!acm->dev) { | 575 | if (!acm->dev) { |
575 | tty_port_tty_set(&acm->port, NULL); | 576 | tty_port_tty_set(&acm->port, NULL); |
576 | acm_tty_unregister(acm); | 577 | acm_tty_unregister(acm); |
@@ -582,6 +583,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) | |||
582 | acm_port_down(acm); | 583 | acm_port_down(acm); |
583 | tty_port_close_end(&acm->port, tty); | 584 | tty_port_close_end(&acm->port, tty); |
584 | tty_port_tty_set(&acm->port, NULL); | 585 | tty_port_tty_set(&acm->port, NULL); |
586 | mutex_unlock(&open_mutex); | ||
585 | } | 587 | } |
586 | 588 | ||
587 | static int acm_tty_write(struct tty_struct *tty, | 589 | static int acm_tty_write(struct tty_struct *tty, |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 96f05b29c9ad..79781461eec9 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -813,6 +813,12 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
813 | USB_PORT_FEAT_C_PORT_LINK_STATE); | 813 | USB_PORT_FEAT_C_PORT_LINK_STATE); |
814 | } | 814 | } |
815 | 815 | ||
816 | if ((portchange & USB_PORT_STAT_C_BH_RESET) && | ||
817 | hub_is_superspeed(hub->hdev)) { | ||
818 | need_debounce_delay = true; | ||
819 | clear_port_feature(hub->hdev, port1, | ||
820 | USB_PORT_FEAT_C_BH_PORT_RESET); | ||
821 | } | ||
816 | /* We can forget about a "removed" device when there's a | 822 | /* We can forget about a "removed" device when there's a |
817 | * physical disconnect or the connect status changes. | 823 | * physical disconnect or the connect status changes. |
818 | */ | 824 | */ |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index d6a8d8269bfb..ecf12e15a7ef 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -50,15 +50,42 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
50 | /* Logitech Webcam B/C500 */ | 50 | /* Logitech Webcam B/C500 */ |
51 | { USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME }, | 51 | { USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME }, |
52 | 52 | ||
53 | /* Logitech Webcam C600 */ | ||
54 | { USB_DEVICE(0x046d, 0x0808), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
55 | |||
53 | /* Logitech Webcam Pro 9000 */ | 56 | /* Logitech Webcam Pro 9000 */ |
54 | { USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME }, | 57 | { USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME }, |
55 | 58 | ||
59 | /* Logitech Webcam C905 */ | ||
60 | { USB_DEVICE(0x046d, 0x080a), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
61 | |||
62 | /* Logitech Webcam C210 */ | ||
63 | { USB_DEVICE(0x046d, 0x0819), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
64 | |||
65 | /* Logitech Webcam C260 */ | ||
66 | { USB_DEVICE(0x046d, 0x081a), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
67 | |||
56 | /* Logitech Webcam C310 */ | 68 | /* Logitech Webcam C310 */ |
57 | { USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME }, | 69 | { USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME }, |
58 | 70 | ||
71 | /* Logitech Webcam C910 */ | ||
72 | { USB_DEVICE(0x046d, 0x0821), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
73 | |||
74 | /* Logitech Webcam C160 */ | ||
75 | { USB_DEVICE(0x046d, 0x0824), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
76 | |||
59 | /* Logitech Webcam C270 */ | 77 | /* Logitech Webcam C270 */ |
60 | { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME }, | 78 | { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME }, |
61 | 79 | ||
80 | /* Logitech Quickcam Pro 9000 */ | ||
81 | { USB_DEVICE(0x046d, 0x0990), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
82 | |||
83 | /* Logitech Quickcam E3500 */ | ||
84 | { USB_DEVICE(0x046d, 0x09a4), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
85 | |||
86 | /* Logitech Quickcam Vision Pro */ | ||
87 | { USB_DEVICE(0x046d, 0x09a6), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
88 | |||
62 | /* Logitech Harmony 700-series */ | 89 | /* Logitech Harmony 700-series */ |
63 | { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT }, | 90 | { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT }, |
64 | 91 | ||
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index fa824cfdd2eb..25dbd8614e72 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -1284,6 +1284,7 @@ static int __devinit dwc3_gadget_init_endpoints(struct dwc3 *dwc) | |||
1284 | int ret; | 1284 | int ret; |
1285 | 1285 | ||
1286 | dep->endpoint.maxpacket = 1024; | 1286 | dep->endpoint.maxpacket = 1024; |
1287 | dep->endpoint.max_streams = 15; | ||
1287 | dep->endpoint.ops = &dwc3_gadget_ep_ops; | 1288 | dep->endpoint.ops = &dwc3_gadget_ep_ops; |
1288 | list_add_tail(&dep->endpoint.ep_list, | 1289 | list_add_tail(&dep->endpoint.ep_list, |
1289 | &dwc->gadget.ep_list); | 1290 | &dwc->gadget.ep_list); |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index b21cd376c11a..23a447373c51 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -469,7 +469,7 @@ config USB_LANGWELL | |||
469 | gadget drivers to also be dynamically linked. | 469 | gadget drivers to also be dynamically linked. |
470 | 470 | ||
471 | config USB_EG20T | 471 | config USB_EG20T |
472 | tristate "Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH UDC" | 472 | tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC" |
473 | depends on PCI | 473 | depends on PCI |
474 | select USB_GADGET_DUALSPEED | 474 | select USB_GADGET_DUALSPEED |
475 | help | 475 | help |
@@ -485,10 +485,11 @@ config USB_EG20T | |||
485 | This driver dose not support interrupt transfer or isochronous | 485 | This driver dose not support interrupt transfer or isochronous |
486 | transfer modes. | 486 | transfer modes. |
487 | 487 | ||
488 | This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is | 488 | This driver also can be used for LAPIS Semiconductor's ML7213 which is |
489 | for IVI(In-Vehicle Infotainment) use. | 489 | for IVI(In-Vehicle Infotainment) use. |
490 | ML7213 is companion chip for Intel Atom E6xx series. | 490 | ML7831 is for general purpose use. |
491 | ML7213 is completely compatible for Intel EG20T PCH. | 491 | ML7213/ML7831 is companion chip for Intel Atom E6xx series. |
492 | ML7213/ML7831 is completely compatible for Intel EG20T PCH. | ||
492 | 493 | ||
493 | config USB_CI13XXX_MSM | 494 | config USB_CI13XXX_MSM |
494 | tristate "MIPS USB CI13xxx for MSM" | 495 | tristate "MIPS USB CI13xxx for MSM" |
diff --git a/drivers/usb/gadget/ci13xxx_msm.c b/drivers/usb/gadget/ci13xxx_msm.c index 4eedfe557154..1fc612914c52 100644 --- a/drivers/usb/gadget/ci13xxx_msm.c +++ b/drivers/usb/gadget/ci13xxx_msm.c | |||
@@ -122,3 +122,5 @@ static int __init ci13xxx_msm_init(void) | |||
122 | return platform_driver_register(&ci13xxx_msm_driver); | 122 | return platform_driver_register(&ci13xxx_msm_driver); |
123 | } | 123 | } |
124 | module_init(ci13xxx_msm_init); | 124 | module_init(ci13xxx_msm_init); |
125 | |||
126 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 83428f56253b..9a0c3979ff43 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c | |||
@@ -71,6 +71,9 @@ | |||
71 | /****************************************************************************** | 71 | /****************************************************************************** |
72 | * DEFINE | 72 | * DEFINE |
73 | *****************************************************************************/ | 73 | *****************************************************************************/ |
74 | |||
75 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) | ||
76 | |||
74 | /* ctrl register bank access */ | 77 | /* ctrl register bank access */ |
75 | static DEFINE_SPINLOCK(udc_lock); | 78 | static DEFINE_SPINLOCK(udc_lock); |
76 | 79 | ||
@@ -1434,7 +1437,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | |||
1434 | return -EALREADY; | 1437 | return -EALREADY; |
1435 | 1438 | ||
1436 | mReq->req.status = -EALREADY; | 1439 | mReq->req.status = -EALREADY; |
1437 | if (length && !mReq->req.dma) { | 1440 | if (length && mReq->req.dma == DMA_ADDR_INVALID) { |
1438 | mReq->req.dma = \ | 1441 | mReq->req.dma = \ |
1439 | dma_map_single(mEp->device, mReq->req.buf, | 1442 | dma_map_single(mEp->device, mReq->req.buf, |
1440 | length, mEp->dir ? DMA_TO_DEVICE : | 1443 | length, mEp->dir ? DMA_TO_DEVICE : |
@@ -1453,7 +1456,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | |||
1453 | dma_unmap_single(mEp->device, mReq->req.dma, | 1456 | dma_unmap_single(mEp->device, mReq->req.dma, |
1454 | length, mEp->dir ? DMA_TO_DEVICE : | 1457 | length, mEp->dir ? DMA_TO_DEVICE : |
1455 | DMA_FROM_DEVICE); | 1458 | DMA_FROM_DEVICE); |
1456 | mReq->req.dma = 0; | 1459 | mReq->req.dma = DMA_ADDR_INVALID; |
1457 | mReq->map = 0; | 1460 | mReq->map = 0; |
1458 | } | 1461 | } |
1459 | return -ENOMEM; | 1462 | return -ENOMEM; |
@@ -1549,7 +1552,7 @@ static int _hardware_dequeue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | |||
1549 | if (mReq->map) { | 1552 | if (mReq->map) { |
1550 | dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length, | 1553 | dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length, |
1551 | mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 1554 | mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
1552 | mReq->req.dma = 0; | 1555 | mReq->req.dma = DMA_ADDR_INVALID; |
1553 | mReq->map = 0; | 1556 | mReq->map = 0; |
1554 | } | 1557 | } |
1555 | 1558 | ||
@@ -1610,7 +1613,6 @@ __acquires(mEp->lock) | |||
1610 | * @gadget: gadget | 1613 | * @gadget: gadget |
1611 | * | 1614 | * |
1612 | * This function returns an error code | 1615 | * This function returns an error code |
1613 | * Caller must hold lock | ||
1614 | */ | 1616 | */ |
1615 | static int _gadget_stop_activity(struct usb_gadget *gadget) | 1617 | static int _gadget_stop_activity(struct usb_gadget *gadget) |
1616 | { | 1618 | { |
@@ -2189,6 +2191,7 @@ static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) | |||
2189 | mReq = kzalloc(sizeof(struct ci13xxx_req), gfp_flags); | 2191 | mReq = kzalloc(sizeof(struct ci13xxx_req), gfp_flags); |
2190 | if (mReq != NULL) { | 2192 | if (mReq != NULL) { |
2191 | INIT_LIST_HEAD(&mReq->queue); | 2193 | INIT_LIST_HEAD(&mReq->queue); |
2194 | mReq->req.dma = DMA_ADDR_INVALID; | ||
2192 | 2195 | ||
2193 | mReq->ptr = dma_pool_alloc(mEp->td_pool, gfp_flags, | 2196 | mReq->ptr = dma_pool_alloc(mEp->td_pool, gfp_flags, |
2194 | &mReq->dma); | 2197 | &mReq->dma); |
@@ -2328,7 +2331,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
2328 | if (mReq->map) { | 2331 | if (mReq->map) { |
2329 | dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length, | 2332 | dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length, |
2330 | mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 2333 | mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
2331 | mReq->req.dma = 0; | 2334 | mReq->req.dma = DMA_ADDR_INVALID; |
2332 | mReq->map = 0; | 2335 | mReq->map = 0; |
2333 | } | 2336 | } |
2334 | req->status = -ECONNRESET; | 2337 | req->status = -ECONNRESET; |
@@ -2500,12 +2503,12 @@ static int ci13xxx_wakeup(struct usb_gadget *_gadget) | |||
2500 | spin_lock_irqsave(udc->lock, flags); | 2503 | spin_lock_irqsave(udc->lock, flags); |
2501 | if (!udc->remote_wakeup) { | 2504 | if (!udc->remote_wakeup) { |
2502 | ret = -EOPNOTSUPP; | 2505 | ret = -EOPNOTSUPP; |
2503 | dbg_trace("remote wakeup feature is not enabled\n"); | 2506 | trace("remote wakeup feature is not enabled\n"); |
2504 | goto out; | 2507 | goto out; |
2505 | } | 2508 | } |
2506 | if (!hw_cread(CAP_PORTSC, PORTSC_SUSP)) { | 2509 | if (!hw_cread(CAP_PORTSC, PORTSC_SUSP)) { |
2507 | ret = -EINVAL; | 2510 | ret = -EINVAL; |
2508 | dbg_trace("port is not suspended\n"); | 2511 | trace("port is not suspended\n"); |
2509 | goto out; | 2512 | goto out; |
2510 | } | 2513 | } |
2511 | hw_cwrite(CAP_PORTSC, PORTSC_FPR, PORTSC_FPR); | 2514 | hw_cwrite(CAP_PORTSC, PORTSC_FPR, PORTSC_FPR); |
@@ -2703,7 +2706,9 @@ static int ci13xxx_stop(struct usb_gadget_driver *driver) | |||
2703 | if (udc->udc_driver->notify_event) | 2706 | if (udc->udc_driver->notify_event) |
2704 | udc->udc_driver->notify_event(udc, | 2707 | udc->udc_driver->notify_event(udc, |
2705 | CI13XXX_CONTROLLER_STOPPED_EVENT); | 2708 | CI13XXX_CONTROLLER_STOPPED_EVENT); |
2709 | spin_unlock_irqrestore(udc->lock, flags); | ||
2706 | _gadget_stop_activity(&udc->gadget); | 2710 | _gadget_stop_activity(&udc->gadget); |
2711 | spin_lock_irqsave(udc->lock, flags); | ||
2707 | pm_runtime_put(&udc->gadget.dev); | 2712 | pm_runtime_put(&udc->gadget.dev); |
2708 | } | 2713 | } |
2709 | 2714 | ||
@@ -2850,7 +2855,7 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev, | |||
2850 | struct ci13xxx *udc; | 2855 | struct ci13xxx *udc; |
2851 | int retval = 0; | 2856 | int retval = 0; |
2852 | 2857 | ||
2853 | trace("%p, %p, %p", dev, regs, name); | 2858 | trace("%p, %p, %p", dev, regs, driver->name); |
2854 | 2859 | ||
2855 | if (dev == NULL || regs == NULL || driver == NULL || | 2860 | if (dev == NULL || regs == NULL || driver == NULL || |
2856 | driver->name == NULL) | 2861 | driver->name == NULL) |
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 52583a235330..c39d58860fa0 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
@@ -624,7 +624,8 @@ static int fsg_setup(struct usb_function *f, | |||
624 | if (ctrl->bRequestType != | 624 | if (ctrl->bRequestType != |
625 | (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) | 625 | (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) |
626 | break; | 626 | break; |
627 | if (w_index != fsg->interface_number || w_value != 0) | 627 | if (w_index != fsg->interface_number || w_value != 0 || |
628 | w_length != 0) | ||
628 | return -EDOM; | 629 | return -EDOM; |
629 | 630 | ||
630 | /* | 631 | /* |
@@ -639,7 +640,8 @@ static int fsg_setup(struct usb_function *f, | |||
639 | if (ctrl->bRequestType != | 640 | if (ctrl->bRequestType != |
640 | (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) | 641 | (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) |
641 | break; | 642 | break; |
642 | if (w_index != fsg->interface_number || w_value != 0) | 643 | if (w_index != fsg->interface_number || w_value != 0 || |
644 | w_length != 1) | ||
643 | return -EDOM; | 645 | return -EDOM; |
644 | VDBG(fsg, "get max LUN\n"); | 646 | VDBG(fsg, "get max LUN\n"); |
645 | *(u8 *)req->buf = fsg->common->nluns - 1; | 647 | *(u8 *)req->buf = fsg->common->nluns - 1; |
diff --git a/drivers/usb/gadget/f_midi.c b/drivers/usb/gadget/f_midi.c index 67b222908cf9..3797b3d6c622 100644 --- a/drivers/usb/gadget/f_midi.c +++ b/drivers/usb/gadget/f_midi.c | |||
@@ -95,7 +95,6 @@ static void f_midi_transmit(struct f_midi *midi, struct usb_request *req); | |||
95 | 95 | ||
96 | DECLARE_UAC_AC_HEADER_DESCRIPTOR(1); | 96 | DECLARE_UAC_AC_HEADER_DESCRIPTOR(1); |
97 | DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(1); | 97 | DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(1); |
98 | DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(16); | ||
99 | DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(16); | 98 | DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(16); |
100 | 99 | ||
101 | /* B.3.1 Standard AC Interface Descriptor */ | 100 | /* B.3.1 Standard AC Interface Descriptor */ |
@@ -140,26 +139,6 @@ static struct usb_ms_header_descriptor ms_header_desc __initdata = { | |||
140 | /* .wTotalLength = DYNAMIC */ | 139 | /* .wTotalLength = DYNAMIC */ |
141 | }; | 140 | }; |
142 | 141 | ||
143 | /* B.4.3 Embedded MIDI IN Jack Descriptor */ | ||
144 | static struct usb_midi_in_jack_descriptor jack_in_emb_desc = { | ||
145 | .bLength = USB_DT_MIDI_IN_SIZE, | ||
146 | .bDescriptorType = USB_DT_CS_INTERFACE, | ||
147 | .bDescriptorSubtype = USB_MS_MIDI_IN_JACK, | ||
148 | .bJackType = USB_MS_EMBEDDED, | ||
149 | /* .bJackID = DYNAMIC */ | ||
150 | }; | ||
151 | |||
152 | /* B.4.4 Embedded MIDI OUT Jack Descriptor */ | ||
153 | static struct usb_midi_out_jack_descriptor_16 jack_out_emb_desc = { | ||
154 | /* .bLength = DYNAMIC */ | ||
155 | .bDescriptorType = USB_DT_CS_INTERFACE, | ||
156 | .bDescriptorSubtype = USB_MS_MIDI_OUT_JACK, | ||
157 | .bJackType = USB_MS_EMBEDDED, | ||
158 | /* .bJackID = DYNAMIC */ | ||
159 | /* .bNrInputPins = DYNAMIC */ | ||
160 | /* .pins = DYNAMIC */ | ||
161 | }; | ||
162 | |||
163 | /* B.5.1 Standard Bulk OUT Endpoint Descriptor */ | 142 | /* B.5.1 Standard Bulk OUT Endpoint Descriptor */ |
164 | static struct usb_endpoint_descriptor bulk_out_desc = { | 143 | static struct usb_endpoint_descriptor bulk_out_desc = { |
165 | .bLength = USB_DT_ENDPOINT_AUDIO_SIZE, | 144 | .bLength = USB_DT_ENDPOINT_AUDIO_SIZE, |
@@ -758,9 +737,11 @@ fail: | |||
758 | static int __init | 737 | static int __init |
759 | f_midi_bind(struct usb_configuration *c, struct usb_function *f) | 738 | f_midi_bind(struct usb_configuration *c, struct usb_function *f) |
760 | { | 739 | { |
761 | struct usb_descriptor_header *midi_function[(MAX_PORTS * 2) + 12]; | 740 | struct usb_descriptor_header **midi_function; |
762 | struct usb_midi_in_jack_descriptor jack_in_ext_desc[MAX_PORTS]; | 741 | struct usb_midi_in_jack_descriptor jack_in_ext_desc[MAX_PORTS]; |
742 | struct usb_midi_in_jack_descriptor jack_in_emb_desc[MAX_PORTS]; | ||
763 | struct usb_midi_out_jack_descriptor_1 jack_out_ext_desc[MAX_PORTS]; | 743 | struct usb_midi_out_jack_descriptor_1 jack_out_ext_desc[MAX_PORTS]; |
744 | struct usb_midi_out_jack_descriptor_1 jack_out_emb_desc[MAX_PORTS]; | ||
764 | struct usb_composite_dev *cdev = c->cdev; | 745 | struct usb_composite_dev *cdev = c->cdev; |
765 | struct f_midi *midi = func_to_midi(f); | 746 | struct f_midi *midi = func_to_midi(f); |
766 | int status, n, jack = 1, i = 0; | 747 | int status, n, jack = 1, i = 0; |
@@ -798,6 +779,14 @@ f_midi_bind(struct usb_configuration *c, struct usb_function *f) | |||
798 | goto fail; | 779 | goto fail; |
799 | midi->out_ep->driver_data = cdev; /* claim */ | 780 | midi->out_ep->driver_data = cdev; /* claim */ |
800 | 781 | ||
782 | /* allocate temporary function list */ | ||
783 | midi_function = kcalloc((MAX_PORTS * 4) + 9, sizeof(midi_function), | ||
784 | GFP_KERNEL); | ||
785 | if (!midi_function) { | ||
786 | status = -ENOMEM; | ||
787 | goto fail; | ||
788 | } | ||
789 | |||
801 | /* | 790 | /* |
802 | * construct the function's descriptor set. As the number of | 791 | * construct the function's descriptor set. As the number of |
803 | * input and output MIDI ports is configurable, we have to do | 792 | * input and output MIDI ports is configurable, we have to do |
@@ -811,73 +800,74 @@ f_midi_bind(struct usb_configuration *c, struct usb_function *f) | |||
811 | 800 | ||
812 | /* calculate the header's wTotalLength */ | 801 | /* calculate the header's wTotalLength */ |
813 | n = USB_DT_MS_HEADER_SIZE | 802 | n = USB_DT_MS_HEADER_SIZE |
814 | + (1 + midi->in_ports) * USB_DT_MIDI_IN_SIZE | 803 | + (midi->in_ports + midi->out_ports) * |
815 | + (1 + midi->out_ports) * USB_DT_MIDI_OUT_SIZE(1); | 804 | (USB_DT_MIDI_IN_SIZE + USB_DT_MIDI_OUT_SIZE(1)); |
816 | ms_header_desc.wTotalLength = cpu_to_le16(n); | 805 | ms_header_desc.wTotalLength = cpu_to_le16(n); |
817 | 806 | ||
818 | midi_function[i++] = (struct usb_descriptor_header *) &ms_header_desc; | 807 | midi_function[i++] = (struct usb_descriptor_header *) &ms_header_desc; |
819 | 808 | ||
820 | /* we have one embedded IN jack */ | 809 | /* configure the external IN jacks, each linked to an embedded OUT jack */ |
821 | jack_in_emb_desc.bJackID = jack++; | ||
822 | midi_function[i++] = (struct usb_descriptor_header *) &jack_in_emb_desc; | ||
823 | |||
824 | /* and a dynamic amount of external IN jacks */ | ||
825 | for (n = 0; n < midi->in_ports; n++) { | ||
826 | struct usb_midi_in_jack_descriptor *ext = &jack_in_ext_desc[n]; | ||
827 | |||
828 | ext->bLength = USB_DT_MIDI_IN_SIZE; | ||
829 | ext->bDescriptorType = USB_DT_CS_INTERFACE; | ||
830 | ext->bDescriptorSubtype = USB_MS_MIDI_IN_JACK; | ||
831 | ext->bJackType = USB_MS_EXTERNAL; | ||
832 | ext->bJackID = jack++; | ||
833 | ext->iJack = 0; | ||
834 | |||
835 | midi_function[i++] = (struct usb_descriptor_header *) ext; | ||
836 | } | ||
837 | |||
838 | /* one embedded OUT jack ... */ | ||
839 | jack_out_emb_desc.bLength = USB_DT_MIDI_OUT_SIZE(midi->in_ports); | ||
840 | jack_out_emb_desc.bJackID = jack++; | ||
841 | jack_out_emb_desc.bNrInputPins = midi->in_ports; | ||
842 | /* ... which referencess all external IN jacks */ | ||
843 | for (n = 0; n < midi->in_ports; n++) { | 810 | for (n = 0; n < midi->in_ports; n++) { |
844 | jack_out_emb_desc.pins[n].baSourceID = jack_in_ext_desc[n].bJackID; | 811 | struct usb_midi_in_jack_descriptor *in_ext = &jack_in_ext_desc[n]; |
845 | jack_out_emb_desc.pins[n].baSourcePin = 1; | 812 | struct usb_midi_out_jack_descriptor_1 *out_emb = &jack_out_emb_desc[n]; |
813 | |||
814 | in_ext->bLength = USB_DT_MIDI_IN_SIZE; | ||
815 | in_ext->bDescriptorType = USB_DT_CS_INTERFACE; | ||
816 | in_ext->bDescriptorSubtype = USB_MS_MIDI_IN_JACK; | ||
817 | in_ext->bJackType = USB_MS_EXTERNAL; | ||
818 | in_ext->bJackID = jack++; | ||
819 | in_ext->iJack = 0; | ||
820 | midi_function[i++] = (struct usb_descriptor_header *) in_ext; | ||
821 | |||
822 | out_emb->bLength = USB_DT_MIDI_OUT_SIZE(1); | ||
823 | out_emb->bDescriptorType = USB_DT_CS_INTERFACE; | ||
824 | out_emb->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK; | ||
825 | out_emb->bJackType = USB_MS_EMBEDDED; | ||
826 | out_emb->bJackID = jack++; | ||
827 | out_emb->bNrInputPins = 1; | ||
828 | out_emb->pins[0].baSourcePin = 1; | ||
829 | out_emb->pins[0].baSourceID = in_ext->bJackID; | ||
830 | out_emb->iJack = 0; | ||
831 | midi_function[i++] = (struct usb_descriptor_header *) out_emb; | ||
832 | |||
833 | /* link it to the endpoint */ | ||
834 | ms_in_desc.baAssocJackID[n] = out_emb->bJackID; | ||
846 | } | 835 | } |
847 | 836 | ||
848 | midi_function[i++] = (struct usb_descriptor_header *) &jack_out_emb_desc; | 837 | /* configure the external OUT jacks, each linked to an embedded IN jack */ |
849 | |||
850 | /* and multiple external OUT jacks ... */ | ||
851 | for (n = 0; n < midi->out_ports; n++) { | 838 | for (n = 0; n < midi->out_ports; n++) { |
852 | struct usb_midi_out_jack_descriptor_1 *ext = &jack_out_ext_desc[n]; | 839 | struct usb_midi_in_jack_descriptor *in_emb = &jack_in_emb_desc[n]; |
853 | int m; | 840 | struct usb_midi_out_jack_descriptor_1 *out_ext = &jack_out_ext_desc[n]; |
854 | 841 | ||
855 | ext->bLength = USB_DT_MIDI_OUT_SIZE(1); | 842 | in_emb->bLength = USB_DT_MIDI_IN_SIZE; |
856 | ext->bDescriptorType = USB_DT_CS_INTERFACE; | 843 | in_emb->bDescriptorType = USB_DT_CS_INTERFACE; |
857 | ext->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK; | 844 | in_emb->bDescriptorSubtype = USB_MS_MIDI_IN_JACK; |
858 | ext->bJackType = USB_MS_EXTERNAL; | 845 | in_emb->bJackType = USB_MS_EMBEDDED; |
859 | ext->bJackID = jack++; | 846 | in_emb->bJackID = jack++; |
860 | ext->bNrInputPins = 1; | 847 | in_emb->iJack = 0; |
861 | ext->iJack = 0; | 848 | midi_function[i++] = (struct usb_descriptor_header *) in_emb; |
862 | /* ... which all reference the same embedded IN jack */ | 849 | |
863 | for (m = 0; m < midi->out_ports; m++) { | 850 | out_ext->bLength = USB_DT_MIDI_OUT_SIZE(1); |
864 | ext->pins[m].baSourceID = jack_in_emb_desc.bJackID; | 851 | out_ext->bDescriptorType = USB_DT_CS_INTERFACE; |
865 | ext->pins[m].baSourcePin = 1; | 852 | out_ext->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK; |
866 | } | 853 | out_ext->bJackType = USB_MS_EXTERNAL; |
867 | 854 | out_ext->bJackID = jack++; | |
868 | midi_function[i++] = (struct usb_descriptor_header *) ext; | 855 | out_ext->bNrInputPins = 1; |
856 | out_ext->iJack = 0; | ||
857 | out_ext->pins[0].baSourceID = in_emb->bJackID; | ||
858 | out_ext->pins[0].baSourcePin = 1; | ||
859 | midi_function[i++] = (struct usb_descriptor_header *) out_ext; | ||
860 | |||
861 | /* link it to the endpoint */ | ||
862 | ms_out_desc.baAssocJackID[n] = in_emb->bJackID; | ||
869 | } | 863 | } |
870 | 864 | ||
871 | /* configure the endpoint descriptors ... */ | 865 | /* configure the endpoint descriptors ... */ |
872 | ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports); | 866 | ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports); |
873 | ms_out_desc.bNumEmbMIDIJack = midi->in_ports; | 867 | ms_out_desc.bNumEmbMIDIJack = midi->in_ports; |
874 | for (n = 0; n < midi->in_ports; n++) | ||
875 | ms_out_desc.baAssocJackID[n] = jack_in_emb_desc.bJackID; | ||
876 | 868 | ||
877 | ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports); | 869 | ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports); |
878 | ms_in_desc.bNumEmbMIDIJack = midi->out_ports; | 870 | ms_in_desc.bNumEmbMIDIJack = midi->out_ports; |
879 | for (n = 0; n < midi->out_ports; n++) | ||
880 | ms_in_desc.baAssocJackID[n] = jack_out_emb_desc.bJackID; | ||
881 | 871 | ||
882 | /* ... and add them to the list */ | 872 | /* ... and add them to the list */ |
883 | midi_function[i++] = (struct usb_descriptor_header *) &bulk_out_desc; | 873 | midi_function[i++] = (struct usb_descriptor_header *) &bulk_out_desc; |
@@ -901,6 +891,8 @@ f_midi_bind(struct usb_configuration *c, struct usb_function *f) | |||
901 | f->descriptors = usb_copy_descriptors(midi_function); | 891 | f->descriptors = usb_copy_descriptors(midi_function); |
902 | } | 892 | } |
903 | 893 | ||
894 | kfree(midi_function); | ||
895 | |||
904 | return 0; | 896 | return 0; |
905 | 897 | ||
906 | fail: | 898 | fail: |
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 349077033338..16a509ae517b 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c | |||
@@ -346,7 +346,7 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req) | |||
346 | } | 346 | } |
347 | 347 | ||
348 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, | 348 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, |
349 | skb->len == 0, req->actual); | 349 | skb->len <= 1, req->actual); |
350 | page = NULL; | 350 | page = NULL; |
351 | 351 | ||
352 | if (req->actual < req->length) { /* Last fragment */ | 352 | if (req->actual < req->length) { /* Last fragment */ |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index f7e39b0365ce..11b5196284ae 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -859,7 +859,7 @@ static int class_setup_req(struct fsg_dev *fsg, | |||
859 | if (ctrl->bRequestType != (USB_DIR_OUT | | 859 | if (ctrl->bRequestType != (USB_DIR_OUT | |
860 | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) | 860 | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) |
861 | break; | 861 | break; |
862 | if (w_index != 0 || w_value != 0) { | 862 | if (w_index != 0 || w_value != 0 || w_length != 0) { |
863 | value = -EDOM; | 863 | value = -EDOM; |
864 | break; | 864 | break; |
865 | } | 865 | } |
@@ -875,7 +875,7 @@ static int class_setup_req(struct fsg_dev *fsg, | |||
875 | if (ctrl->bRequestType != (USB_DIR_IN | | 875 | if (ctrl->bRequestType != (USB_DIR_IN | |
876 | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) | 876 | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) |
877 | break; | 877 | break; |
878 | if (w_index != 0 || w_value != 0) { | 878 | if (w_index != 0 || w_value != 0 || w_length != 1) { |
879 | value = -EDOM; | 879 | value = -EDOM; |
880 | break; | 880 | break; |
881 | } | 881 | } |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index b2c44e1d5813..b3b3d83b7c33 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -1717,7 +1717,7 @@ static void dtd_complete_irq(struct fsl_udc *udc) | |||
1717 | 1717 | ||
1718 | static inline enum usb_device_speed portscx_device_speed(u32 reg) | 1718 | static inline enum usb_device_speed portscx_device_speed(u32 reg) |
1719 | { | 1719 | { |
1720 | switch (speed & PORTSCX_PORT_SPEED_MASK) { | 1720 | switch (reg & PORTSCX_PORT_SPEED_MASK) { |
1721 | case PORTSCX_PORT_SPEED_HIGH: | 1721 | case PORTSCX_PORT_SPEED_HIGH: |
1722 | return USB_SPEED_HIGH; | 1722 | return USB_SPEED_HIGH; |
1723 | case PORTSCX_PORT_SPEED_FULL: | 1723 | case PORTSCX_PORT_SPEED_FULL: |
@@ -2480,8 +2480,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev) | |||
2480 | 2480 | ||
2481 | #ifndef CONFIG_ARCH_MXC | 2481 | #ifndef CONFIG_ARCH_MXC |
2482 | if (pdata->have_sysif_regs) | 2482 | if (pdata->have_sysif_regs) |
2483 | usb_sys_regs = (struct usb_sys_interface *) | 2483 | usb_sys_regs = (void *)dr_regs + USB_DR_SYS_OFFSET; |
2484 | ((u32)dr_regs + USB_DR_SYS_OFFSET); | ||
2485 | #endif | 2484 | #endif |
2486 | 2485 | ||
2487 | /* Initialize USB clocks */ | 2486 | /* Initialize USB clocks */ |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index a392ec0d2d51..6ccae2707e59 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1730,8 +1730,9 @@ static void | |||
1730 | gadgetfs_disconnect (struct usb_gadget *gadget) | 1730 | gadgetfs_disconnect (struct usb_gadget *gadget) |
1731 | { | 1731 | { |
1732 | struct dev_data *dev = get_gadget_data (gadget); | 1732 | struct dev_data *dev = get_gadget_data (gadget); |
1733 | unsigned long flags; | ||
1733 | 1734 | ||
1734 | spin_lock (&dev->lock); | 1735 | spin_lock_irqsave (&dev->lock, flags); |
1735 | if (dev->state == STATE_DEV_UNCONNECTED) | 1736 | if (dev->state == STATE_DEV_UNCONNECTED) |
1736 | goto exit; | 1737 | goto exit; |
1737 | dev->state = STATE_DEV_UNCONNECTED; | 1738 | dev->state = STATE_DEV_UNCONNECTED; |
@@ -1740,7 +1741,7 @@ gadgetfs_disconnect (struct usb_gadget *gadget) | |||
1740 | next_event (dev, GADGETFS_DISCONNECT); | 1741 | next_event (dev, GADGETFS_DISCONNECT); |
1741 | ep0_readable (dev); | 1742 | ep0_readable (dev); |
1742 | exit: | 1743 | exit: |
1743 | spin_unlock (&dev->lock); | 1744 | spin_unlock_irqrestore (&dev->lock, flags); |
1744 | } | 1745 | } |
1745 | 1746 | ||
1746 | static void | 1747 | static void |
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c index 550d6dcdf104..5048a0c07640 100644 --- a/drivers/usb/gadget/pch_udc.c +++ b/drivers/usb/gadget/pch_udc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 OKI SEMICONDUCTOR CO., LTD. | 2 | * Copyright (C) 2011 LAPIS Semiconductor Co., Ltd. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -354,6 +354,7 @@ struct pch_udc_dev { | |||
354 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 | 354 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 |
355 | #define PCI_VENDOR_ID_ROHM 0x10DB | 355 | #define PCI_VENDOR_ID_ROHM 0x10DB |
356 | #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D | 356 | #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D |
357 | #define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808 | ||
357 | 358 | ||
358 | static const char ep0_string[] = "ep0in"; | 359 | static const char ep0_string[] = "ep0in"; |
359 | static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */ | 360 | static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */ |
@@ -2970,6 +2971,11 @@ static DEFINE_PCI_DEVICE_TABLE(pch_udc_pcidev_id) = { | |||
2970 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | 2971 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, |
2971 | .class_mask = 0xffffffff, | 2972 | .class_mask = 0xffffffff, |
2972 | }, | 2973 | }, |
2974 | { | ||
2975 | PCI_DEVICE(PCI_VENDOR_ID_ROHM, PCI_DEVICE_ID_ML7831_IOH_UDC), | ||
2976 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | ||
2977 | .class_mask = 0xffffffff, | ||
2978 | }, | ||
2973 | { 0 }, | 2979 | { 0 }, |
2974 | }; | 2980 | }; |
2975 | 2981 | ||
@@ -2999,5 +3005,5 @@ static void __exit pch_udc_pci_exit(void) | |||
2999 | module_exit(pch_udc_pci_exit); | 3005 | module_exit(pch_udc_pci_exit); |
3000 | 3006 | ||
3001 | MODULE_DESCRIPTION("Intel EG20T USB Device Controller"); | 3007 | MODULE_DESCRIPTION("Intel EG20T USB Device Controller"); |
3002 | MODULE_AUTHOR("OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com>"); | 3008 | MODULE_AUTHOR("LAPIS Semiconductor, <tomoya-linux@dsn.lapis-semi.com>"); |
3003 | MODULE_LICENSE("GPL"); | 3009 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 68a826a1b866..24f84b210ce1 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c | |||
@@ -1718,6 +1718,8 @@ static void r8a66597_fifo_flush(struct usb_ep *_ep) | |||
1718 | if (list_empty(&ep->queue) && !ep->busy) { | 1718 | if (list_empty(&ep->queue) && !ep->busy) { |
1719 | pipe_stop(ep->r8a66597, ep->pipenum); | 1719 | pipe_stop(ep->r8a66597, ep->pipenum); |
1720 | r8a66597_bclr(ep->r8a66597, BCLR, ep->fifoctr); | 1720 | r8a66597_bclr(ep->r8a66597, BCLR, ep->fifoctr); |
1721 | r8a66597_write(ep->r8a66597, ACLRM, ep->pipectr); | ||
1722 | r8a66597_write(ep->r8a66597, 0, ep->pipectr); | ||
1721 | } | 1723 | } |
1722 | spin_unlock_irqrestore(&ep->r8a66597->lock, flags); | 1724 | spin_unlock_irqrestore(&ep->r8a66597->lock, flags); |
1723 | } | 1725 | } |
@@ -1742,7 +1744,6 @@ static int r8a66597_start(struct usb_gadget *gadget, | |||
1742 | struct usb_gadget_driver *driver) | 1744 | struct usb_gadget_driver *driver) |
1743 | { | 1745 | { |
1744 | struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); | 1746 | struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); |
1745 | int retval; | ||
1746 | 1747 | ||
1747 | if (!driver | 1748 | if (!driver |
1748 | || driver->speed != USB_SPEED_HIGH | 1749 | || driver->speed != USB_SPEED_HIGH |
@@ -1752,16 +1753,7 @@ static int r8a66597_start(struct usb_gadget *gadget, | |||
1752 | return -ENODEV; | 1753 | return -ENODEV; |
1753 | 1754 | ||
1754 | /* hook up the driver */ | 1755 | /* hook up the driver */ |
1755 | driver->driver.bus = NULL; | ||
1756 | r8a66597->driver = driver; | 1756 | r8a66597->driver = driver; |
1757 | r8a66597->gadget.dev.driver = &driver->driver; | ||
1758 | |||
1759 | retval = device_add(&r8a66597->gadget.dev); | ||
1760 | if (retval) { | ||
1761 | dev_err(r8a66597_to_dev(r8a66597), "device_add error (%d)\n", | ||
1762 | retval); | ||
1763 | goto error; | ||
1764 | } | ||
1765 | 1757 | ||
1766 | init_controller(r8a66597); | 1758 | init_controller(r8a66597); |
1767 | r8a66597_bset(r8a66597, VBSE, INTENB0); | 1759 | r8a66597_bset(r8a66597, VBSE, INTENB0); |
@@ -1775,12 +1767,6 @@ static int r8a66597_start(struct usb_gadget *gadget, | |||
1775 | } | 1767 | } |
1776 | 1768 | ||
1777 | return 0; | 1769 | return 0; |
1778 | |||
1779 | error: | ||
1780 | r8a66597->driver = NULL; | ||
1781 | r8a66597->gadget.dev.driver = NULL; | ||
1782 | |||
1783 | return retval; | ||
1784 | } | 1770 | } |
1785 | 1771 | ||
1786 | static int r8a66597_stop(struct usb_gadget *gadget, | 1772 | static int r8a66597_stop(struct usb_gadget *gadget, |
@@ -1794,7 +1780,6 @@ static int r8a66597_stop(struct usb_gadget *gadget, | |||
1794 | disable_controller(r8a66597); | 1780 | disable_controller(r8a66597); |
1795 | spin_unlock_irqrestore(&r8a66597->lock, flags); | 1781 | spin_unlock_irqrestore(&r8a66597->lock, flags); |
1796 | 1782 | ||
1797 | device_del(&r8a66597->gadget.dev); | ||
1798 | r8a66597->driver = NULL; | 1783 | r8a66597->driver = NULL; |
1799 | return 0; | 1784 | return 0; |
1800 | } | 1785 | } |
@@ -1845,6 +1830,7 @@ static int __exit r8a66597_remove(struct platform_device *pdev) | |||
1845 | clk_put(r8a66597->clk); | 1830 | clk_put(r8a66597->clk); |
1846 | } | 1831 | } |
1847 | #endif | 1832 | #endif |
1833 | device_unregister(&r8a66597->gadget.dev); | ||
1848 | kfree(r8a66597); | 1834 | kfree(r8a66597); |
1849 | return 0; | 1835 | return 0; |
1850 | } | 1836 | } |
@@ -1924,13 +1910,17 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
1924 | r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW; | 1910 | r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW; |
1925 | 1911 | ||
1926 | r8a66597->gadget.ops = &r8a66597_gadget_ops; | 1912 | r8a66597->gadget.ops = &r8a66597_gadget_ops; |
1927 | device_initialize(&r8a66597->gadget.dev); | ||
1928 | dev_set_name(&r8a66597->gadget.dev, "gadget"); | 1913 | dev_set_name(&r8a66597->gadget.dev, "gadget"); |
1929 | r8a66597->gadget.is_dualspeed = 1; | 1914 | r8a66597->gadget.is_dualspeed = 1; |
1930 | r8a66597->gadget.dev.parent = &pdev->dev; | 1915 | r8a66597->gadget.dev.parent = &pdev->dev; |
1931 | r8a66597->gadget.dev.dma_mask = pdev->dev.dma_mask; | 1916 | r8a66597->gadget.dev.dma_mask = pdev->dev.dma_mask; |
1932 | r8a66597->gadget.dev.release = pdev->dev.release; | 1917 | r8a66597->gadget.dev.release = pdev->dev.release; |
1933 | r8a66597->gadget.name = udc_name; | 1918 | r8a66597->gadget.name = udc_name; |
1919 | ret = device_register(&r8a66597->gadget.dev); | ||
1920 | if (ret < 0) { | ||
1921 | dev_err(&pdev->dev, "device_register failed\n"); | ||
1922 | goto clean_up; | ||
1923 | } | ||
1934 | 1924 | ||
1935 | init_timer(&r8a66597->timer); | 1925 | init_timer(&r8a66597->timer); |
1936 | r8a66597->timer.function = r8a66597_timer; | 1926 | r8a66597->timer.function = r8a66597_timer; |
@@ -1945,7 +1935,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
1945 | dev_err(&pdev->dev, "cannot get clock \"%s\"\n", | 1935 | dev_err(&pdev->dev, "cannot get clock \"%s\"\n", |
1946 | clk_name); | 1936 | clk_name); |
1947 | ret = PTR_ERR(r8a66597->clk); | 1937 | ret = PTR_ERR(r8a66597->clk); |
1948 | goto clean_up; | 1938 | goto clean_up_dev; |
1949 | } | 1939 | } |
1950 | clk_enable(r8a66597->clk); | 1940 | clk_enable(r8a66597->clk); |
1951 | } | 1941 | } |
@@ -2014,7 +2004,9 @@ clean_up2: | |||
2014 | clk_disable(r8a66597->clk); | 2004 | clk_disable(r8a66597->clk); |
2015 | clk_put(r8a66597->clk); | 2005 | clk_put(r8a66597->clk); |
2016 | } | 2006 | } |
2007 | clean_up_dev: | ||
2017 | #endif | 2008 | #endif |
2009 | device_unregister(&r8a66597->gadget.dev); | ||
2018 | clean_up: | 2010 | clean_up: |
2019 | if (r8a66597) { | 2011 | if (r8a66597) { |
2020 | if (r8a66597->sudmac_reg) | 2012 | if (r8a66597->sudmac_reg) |
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 022baeca7c94..6939e17f4580 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
@@ -210,10 +210,10 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) | |||
210 | kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); | 210 | kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); |
211 | 211 | ||
212 | if (udc_is_newstyle(udc)) { | 212 | if (udc_is_newstyle(udc)) { |
213 | usb_gadget_disconnect(udc->gadget); | 213 | udc->driver->disconnect(udc->gadget); |
214 | udc->driver->unbind(udc->gadget); | 214 | udc->driver->unbind(udc->gadget); |
215 | usb_gadget_udc_stop(udc->gadget, udc->driver); | 215 | usb_gadget_udc_stop(udc->gadget, udc->driver); |
216 | 216 | usb_gadget_disconnect(udc->gadget); | |
217 | } else { | 217 | } else { |
218 | usb_gadget_stop(udc->gadget, udc->driver); | 218 | usb_gadget_stop(udc->gadget, udc->driver); |
219 | } | 219 | } |
@@ -344,7 +344,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_unregister_driver); | |||
344 | static ssize_t usb_udc_srp_store(struct device *dev, | 344 | static ssize_t usb_udc_srp_store(struct device *dev, |
345 | struct device_attribute *attr, const char *buf, size_t n) | 345 | struct device_attribute *attr, const char *buf, size_t n) |
346 | { | 346 | { |
347 | struct usb_udc *udc = dev_get_drvdata(dev); | 347 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); |
348 | 348 | ||
349 | if (sysfs_streq(buf, "1")) | 349 | if (sysfs_streq(buf, "1")) |
350 | usb_gadget_wakeup(udc->gadget); | 350 | usb_gadget_wakeup(udc->gadget); |
@@ -378,7 +378,7 @@ static ssize_t usb_udc_speed_show(struct device *dev, | |||
378 | return snprintf(buf, PAGE_SIZE, "%s\n", | 378 | return snprintf(buf, PAGE_SIZE, "%s\n", |
379 | usb_speed_string(udc->gadget->speed)); | 379 | usb_speed_string(udc->gadget->speed)); |
380 | } | 380 | } |
381 | static DEVICE_ATTR(speed, S_IRUSR, usb_udc_speed_show, NULL); | 381 | static DEVICE_ATTR(speed, S_IRUGO, usb_udc_speed_show, NULL); |
382 | 382 | ||
383 | #define USB_UDC_ATTR(name) \ | 383 | #define USB_UDC_ATTR(name) \ |
384 | ssize_t usb_udc_##name##_show(struct device *dev, \ | 384 | ssize_t usb_udc_##name##_show(struct device *dev, \ |
@@ -389,7 +389,7 @@ ssize_t usb_udc_##name##_show(struct device *dev, \ | |||
389 | \ | 389 | \ |
390 | return snprintf(buf, PAGE_SIZE, "%d\n", gadget->name); \ | 390 | return snprintf(buf, PAGE_SIZE, "%d\n", gadget->name); \ |
391 | } \ | 391 | } \ |
392 | static DEVICE_ATTR(name, S_IRUSR, usb_udc_##name##_show, NULL) | 392 | static DEVICE_ATTR(name, S_IRUGO, usb_udc_##name##_show, NULL) |
393 | 393 | ||
394 | static USB_UDC_ATTR(is_dualspeed); | 394 | static USB_UDC_ATTR(is_dualspeed); |
395 | static USB_UDC_ATTR(is_otg); | 395 | static USB_UDC_ATTR(is_otg); |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 2e829fae6482..56a32033adb3 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1479,10 +1479,15 @@ iso_stream_schedule ( | |||
1479 | 1479 | ||
1480 | /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */ | 1480 | /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */ |
1481 | 1481 | ||
1482 | /* find a uframe slot with enough bandwidth */ | 1482 | /* find a uframe slot with enough bandwidth. |
1483 | next = start + period; | 1483 | * Early uframes are more precious because full-speed |
1484 | for (; start < next; start++) { | 1484 | * iso IN transfers can't use late uframes, |
1485 | 1485 | * and therefore they should be allocated last. | |
1486 | */ | ||
1487 | next = start; | ||
1488 | start += period; | ||
1489 | do { | ||
1490 | start--; | ||
1486 | /* check schedule: enough space? */ | 1491 | /* check schedule: enough space? */ |
1487 | if (stream->highspeed) { | 1492 | if (stream->highspeed) { |
1488 | if (itd_slot_ok(ehci, mod, start, | 1493 | if (itd_slot_ok(ehci, mod, start, |
@@ -1495,7 +1500,7 @@ iso_stream_schedule ( | |||
1495 | start, sched, period)) | 1500 | start, sched, period)) |
1496 | break; | 1501 | break; |
1497 | } | 1502 | } |
1498 | } | 1503 | } while (start > next); |
1499 | 1504 | ||
1500 | /* no room in the schedule */ | 1505 | /* no room in the schedule */ |
1501 | if (start == next) { | 1506 | if (start == next) { |
diff --git a/drivers/usb/host/ehci-xls.c b/drivers/usb/host/ehci-xls.c index fe74bd676018..b4fb511d24bc 100644 --- a/drivers/usb/host/ehci-xls.c +++ b/drivers/usb/host/ehci-xls.c | |||
@@ -19,7 +19,7 @@ static int ehci_xls_setup(struct usb_hcd *hcd) | |||
19 | 19 | ||
20 | ehci->caps = hcd->regs; | 20 | ehci->caps = hcd->regs; |
21 | ehci->regs = hcd->regs + | 21 | ehci->regs = hcd->regs + |
22 | HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 22 | HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase)); |
23 | dbg_hcs_params(ehci, "reset"); | 23 | dbg_hcs_params(ehci, "reset"); |
24 | dbg_hcc_params(ehci, "reset"); | 24 | dbg_hcc_params(ehci, "reset"); |
25 | 25 | ||
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index ba3a46b78b75..95a9fec38e89 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -223,6 +223,9 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int | |||
223 | if (port < 0 || port >= 2) | 223 | if (port < 0 || port >= 2) |
224 | return; | 224 | return; |
225 | 225 | ||
226 | if (pdata->vbus_pin[port] <= 0) | ||
227 | return; | ||
228 | |||
226 | gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable); | 229 | gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable); |
227 | } | 230 | } |
228 | 231 | ||
@@ -231,6 +234,9 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) | |||
231 | if (port < 0 || port >= 2) | 234 | if (port < 0 || port >= 2) |
232 | return -EINVAL; | 235 | return -EINVAL; |
233 | 236 | ||
237 | if (pdata->vbus_pin[port] <= 0) | ||
238 | return -EINVAL; | ||
239 | |||
234 | return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted; | 240 | return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted; |
235 | } | 241 | } |
236 | 242 | ||
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 34efd479e068..b2639191549e 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -389,17 +389,14 @@ ohci_shutdown (struct usb_hcd *hcd) | |||
389 | struct ohci_hcd *ohci; | 389 | struct ohci_hcd *ohci; |
390 | 390 | ||
391 | ohci = hcd_to_ohci (hcd); | 391 | ohci = hcd_to_ohci (hcd); |
392 | ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); | 392 | ohci_writel(ohci, (u32) ~0, &ohci->regs->intrdisable); |
393 | ohci->hc_control = ohci_readl(ohci, &ohci->regs->control); | ||
394 | 393 | ||
395 | /* If the SHUTDOWN quirk is set, don't put the controller in RESET */ | 394 | /* Software reset, after which the controller goes into SUSPEND */ |
396 | ohci->hc_control &= (ohci->flags & OHCI_QUIRK_SHUTDOWN ? | 395 | ohci_writel(ohci, OHCI_HCR, &ohci->regs->cmdstatus); |
397 | OHCI_CTRL_RWC | OHCI_CTRL_HCFS : | 396 | ohci_readl(ohci, &ohci->regs->cmdstatus); /* flush the writes */ |
398 | OHCI_CTRL_RWC); | 397 | udelay(10); |
399 | ohci_writel(ohci, ohci->hc_control, &ohci->regs->control); | ||
400 | 398 | ||
401 | /* flush the writes */ | 399 | ohci_writel(ohci, ohci->fminterval, &ohci->regs->fminterval); |
402 | (void) ohci_readl (ohci, &ohci->regs->control); | ||
403 | } | 400 | } |
404 | 401 | ||
405 | static int check_ed(struct ohci_hcd *ohci, struct ed *ed) | 402 | static int check_ed(struct ohci_hcd *ohci, struct ed *ed) |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index ad8166c681e2..bc01b064585a 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -175,28 +175,6 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd) | |||
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
177 | 177 | ||
178 | /* nVidia controllers continue to drive Reset signalling on the bus | ||
179 | * even after system shutdown, wasting power. This flag tells the | ||
180 | * shutdown routine to leave the controller OPERATIONAL instead of RESET. | ||
181 | */ | ||
182 | static int ohci_quirk_nvidia_shutdown(struct usb_hcd *hcd) | ||
183 | { | ||
184 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
185 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
186 | |||
187 | /* Evidently nVidia fixed their later hardware; this is a guess at | ||
188 | * the changeover point. | ||
189 | */ | ||
190 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_USB 0x026d | ||
191 | |||
192 | if (pdev->device < PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_USB) { | ||
193 | ohci->flags |= OHCI_QUIRK_SHUTDOWN; | ||
194 | ohci_dbg(ohci, "enabled nVidia shutdown quirk\n"); | ||
195 | } | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | static void sb800_prefetch(struct ohci_hcd *ohci, int on) | 178 | static void sb800_prefetch(struct ohci_hcd *ohci, int on) |
201 | { | 179 | { |
202 | struct pci_dev *pdev; | 180 | struct pci_dev *pdev; |
@@ -260,10 +238,6 @@ static const struct pci_device_id ohci_pci_quirks[] = { | |||
260 | PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399), | 238 | PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399), |
261 | .driver_data = (unsigned long)ohci_quirk_amd700, | 239 | .driver_data = (unsigned long)ohci_quirk_amd700, |
262 | }, | 240 | }, |
263 | { | ||
264 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID), | ||
265 | .driver_data = (unsigned long) ohci_quirk_nvidia_shutdown, | ||
266 | }, | ||
267 | 241 | ||
268 | /* FIXME for some of the early AMD 760 southbridges, OHCI | 242 | /* FIXME for some of the early AMD 760 southbridges, OHCI |
269 | * won't work at all. blacklist them. | 243 | * won't work at all. blacklist them. |
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 35e5fd640ce7..0795b934d00c 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
@@ -403,7 +403,6 @@ struct ohci_hcd { | |||
403 | #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */ | 403 | #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */ |
404 | #define OHCI_QUIRK_AMD_PLL 0x200 /* AMD PLL quirk*/ | 404 | #define OHCI_QUIRK_AMD_PLL 0x200 /* AMD PLL quirk*/ |
405 | #define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */ | 405 | #define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */ |
406 | #define OHCI_QUIRK_SHUTDOWN 0x800 /* nVidia power bug */ | ||
407 | // there are also chip quirks/bugs in init logic | 406 | // there are also chip quirks/bugs in init logic |
408 | 407 | ||
409 | struct work_struct nec_work; /* Worker for NEC quirk */ | 408 | struct work_struct nec_work; /* Worker for NEC quirk */ |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 27a3dec32fa2..caf87428ca43 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #define OHCI_INTRENABLE 0x10 | 37 | #define OHCI_INTRENABLE 0x10 |
38 | #define OHCI_INTRDISABLE 0x14 | 38 | #define OHCI_INTRDISABLE 0x14 |
39 | #define OHCI_FMINTERVAL 0x34 | 39 | #define OHCI_FMINTERVAL 0x34 |
40 | #define OHCI_HCFS (3 << 6) /* hc functional state */ | ||
40 | #define OHCI_HCR (1 << 0) /* host controller reset */ | 41 | #define OHCI_HCR (1 << 0) /* host controller reset */ |
41 | #define OHCI_OCR (1 << 3) /* ownership change request */ | 42 | #define OHCI_OCR (1 << 3) /* ownership change request */ |
42 | #define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */ | 43 | #define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */ |
@@ -466,6 +467,8 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
466 | { | 467 | { |
467 | void __iomem *base; | 468 | void __iomem *base; |
468 | u32 control; | 469 | u32 control; |
470 | u32 fminterval; | ||
471 | int cnt; | ||
469 | 472 | ||
470 | if (!mmio_resource_enabled(pdev, 0)) | 473 | if (!mmio_resource_enabled(pdev, 0)) |
471 | return; | 474 | return; |
@@ -498,41 +501,32 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
498 | } | 501 | } |
499 | #endif | 502 | #endif |
500 | 503 | ||
501 | /* reset controller, preserving RWC (and possibly IR) */ | 504 | /* disable interrupts */ |
502 | writel(control & OHCI_CTRL_MASK, base + OHCI_CONTROL); | 505 | writel((u32) ~0, base + OHCI_INTRDISABLE); |
503 | readl(base + OHCI_CONTROL); | ||
504 | 506 | ||
505 | /* Some NVIDIA controllers stop working if kept in RESET for too long */ | 507 | /* Reset the USB bus, if the controller isn't already in RESET */ |
506 | if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) { | 508 | if (control & OHCI_HCFS) { |
507 | u32 fminterval; | 509 | /* Go into RESET, preserving RWC (and possibly IR) */ |
508 | int cnt; | 510 | writel(control & OHCI_CTRL_MASK, base + OHCI_CONTROL); |
511 | readl(base + OHCI_CONTROL); | ||
509 | 512 | ||
510 | /* drive reset for at least 50 ms (7.1.7.5) */ | 513 | /* drive bus reset for at least 50 ms (7.1.7.5) */ |
511 | msleep(50); | 514 | msleep(50); |
515 | } | ||
512 | 516 | ||
513 | /* software reset of the controller, preserving HcFmInterval */ | 517 | /* software reset of the controller, preserving HcFmInterval */ |
514 | fminterval = readl(base + OHCI_FMINTERVAL); | 518 | fminterval = readl(base + OHCI_FMINTERVAL); |
515 | writel(OHCI_HCR, base + OHCI_CMDSTATUS); | 519 | writel(OHCI_HCR, base + OHCI_CMDSTATUS); |
516 | 520 | ||
517 | /* reset requires max 10 us delay */ | 521 | /* reset requires max 10 us delay */ |
518 | for (cnt = 30; cnt > 0; --cnt) { /* ... allow extra time */ | 522 | for (cnt = 30; cnt > 0; --cnt) { /* ... allow extra time */ |
519 | if ((readl(base + OHCI_CMDSTATUS) & OHCI_HCR) == 0) | 523 | if ((readl(base + OHCI_CMDSTATUS) & OHCI_HCR) == 0) |
520 | break; | 524 | break; |
521 | udelay(1); | 525 | udelay(1); |
522 | } | ||
523 | writel(fminterval, base + OHCI_FMINTERVAL); | ||
524 | |||
525 | /* Now we're in the SUSPEND state with all devices reset | ||
526 | * and wakeups and interrupts disabled | ||
527 | */ | ||
528 | } | 526 | } |
527 | writel(fminterval, base + OHCI_FMINTERVAL); | ||
529 | 528 | ||
530 | /* | 529 | /* Now the controller is safely in SUSPEND and nothing can wake it up */ |
531 | * disable interrupts | ||
532 | */ | ||
533 | writel(~(u32)0, base + OHCI_INTRDISABLE); | ||
534 | writel(~(u32)0, base + OHCI_INTRSTATUS); | ||
535 | |||
536 | iounmap(base); | 530 | iounmap(base); |
537 | } | 531 | } |
538 | 532 | ||
@@ -627,7 +621,7 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev) | |||
627 | void __iomem *base, *op_reg_base; | 621 | void __iomem *base, *op_reg_base; |
628 | u32 hcc_params, cap, val; | 622 | u32 hcc_params, cap, val; |
629 | u8 offset, cap_length; | 623 | u8 offset, cap_length; |
630 | int wait_time, delta, count = 256/4; | 624 | int wait_time, count = 256/4; |
631 | 625 | ||
632 | if (!mmio_resource_enabled(pdev, 0)) | 626 | if (!mmio_resource_enabled(pdev, 0)) |
633 | return; | 627 | return; |
@@ -673,11 +667,10 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev) | |||
673 | writel(val, op_reg_base + EHCI_USBCMD); | 667 | writel(val, op_reg_base + EHCI_USBCMD); |
674 | 668 | ||
675 | wait_time = 2000; | 669 | wait_time = 2000; |
676 | delta = 100; | ||
677 | do { | 670 | do { |
678 | writel(0x3f, op_reg_base + EHCI_USBSTS); | 671 | writel(0x3f, op_reg_base + EHCI_USBSTS); |
679 | udelay(delta); | 672 | udelay(100); |
680 | wait_time -= delta; | 673 | wait_time -= 100; |
681 | val = readl(op_reg_base + EHCI_USBSTS); | 674 | val = readl(op_reg_base + EHCI_USBSTS); |
682 | if ((val == ~(u32)0) || (val & EHCI_USBSTS_HALTED)) { | 675 | if ((val == ~(u32)0) || (val & EHCI_USBSTS_HALTED)) { |
683 | break; | 676 | break; |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 42a22b8e6922..0e4b25fa3bcd 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -982,7 +982,6 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud | |||
982 | struct xhci_virt_device *dev; | 982 | struct xhci_virt_device *dev; |
983 | struct xhci_ep_ctx *ep0_ctx; | 983 | struct xhci_ep_ctx *ep0_ctx; |
984 | struct xhci_slot_ctx *slot_ctx; | 984 | struct xhci_slot_ctx *slot_ctx; |
985 | struct xhci_input_control_ctx *ctrl_ctx; | ||
986 | u32 port_num; | 985 | u32 port_num; |
987 | struct usb_device *top_dev; | 986 | struct usb_device *top_dev; |
988 | 987 | ||
@@ -994,12 +993,8 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud | |||
994 | return -EINVAL; | 993 | return -EINVAL; |
995 | } | 994 | } |
996 | ep0_ctx = xhci_get_ep_ctx(xhci, dev->in_ctx, 0); | 995 | ep0_ctx = xhci_get_ep_ctx(xhci, dev->in_ctx, 0); |
997 | ctrl_ctx = xhci_get_input_control_ctx(xhci, dev->in_ctx); | ||
998 | slot_ctx = xhci_get_slot_ctx(xhci, dev->in_ctx); | 996 | slot_ctx = xhci_get_slot_ctx(xhci, dev->in_ctx); |
999 | 997 | ||
1000 | /* 2) New slot context and endpoint 0 context are valid*/ | ||
1001 | ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG); | ||
1002 | |||
1003 | /* 3) Only the control endpoint is valid - one endpoint context */ | 998 | /* 3) Only the control endpoint is valid - one endpoint context */ |
1004 | slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | udev->route); | 999 | slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | udev->route); |
1005 | switch (udev->speed) { | 1000 | switch (udev->speed) { |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 940321b3ec68..9f1d4b15d818 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -816,23 +816,24 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg) | |||
816 | struct xhci_ring *ring; | 816 | struct xhci_ring *ring; |
817 | struct xhci_td *cur_td; | 817 | struct xhci_td *cur_td; |
818 | int ret, i, j; | 818 | int ret, i, j; |
819 | unsigned long flags; | ||
819 | 820 | ||
820 | ep = (struct xhci_virt_ep *) arg; | 821 | ep = (struct xhci_virt_ep *) arg; |
821 | xhci = ep->xhci; | 822 | xhci = ep->xhci; |
822 | 823 | ||
823 | spin_lock(&xhci->lock); | 824 | spin_lock_irqsave(&xhci->lock, flags); |
824 | 825 | ||
825 | ep->stop_cmds_pending--; | 826 | ep->stop_cmds_pending--; |
826 | if (xhci->xhc_state & XHCI_STATE_DYING) { | 827 | if (xhci->xhc_state & XHCI_STATE_DYING) { |
827 | xhci_dbg(xhci, "Stop EP timer ran, but another timer marked " | 828 | xhci_dbg(xhci, "Stop EP timer ran, but another timer marked " |
828 | "xHCI as DYING, exiting.\n"); | 829 | "xHCI as DYING, exiting.\n"); |
829 | spin_unlock(&xhci->lock); | 830 | spin_unlock_irqrestore(&xhci->lock, flags); |
830 | return; | 831 | return; |
831 | } | 832 | } |
832 | if (!(ep->stop_cmds_pending == 0 && (ep->ep_state & EP_HALT_PENDING))) { | 833 | if (!(ep->stop_cmds_pending == 0 && (ep->ep_state & EP_HALT_PENDING))) { |
833 | xhci_dbg(xhci, "Stop EP timer ran, but no command pending, " | 834 | xhci_dbg(xhci, "Stop EP timer ran, but no command pending, " |
834 | "exiting.\n"); | 835 | "exiting.\n"); |
835 | spin_unlock(&xhci->lock); | 836 | spin_unlock_irqrestore(&xhci->lock, flags); |
836 | return; | 837 | return; |
837 | } | 838 | } |
838 | 839 | ||
@@ -844,11 +845,11 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg) | |||
844 | xhci->xhc_state |= XHCI_STATE_DYING; | 845 | xhci->xhc_state |= XHCI_STATE_DYING; |
845 | /* Disable interrupts from the host controller and start halting it */ | 846 | /* Disable interrupts from the host controller and start halting it */ |
846 | xhci_quiesce(xhci); | 847 | xhci_quiesce(xhci); |
847 | spin_unlock(&xhci->lock); | 848 | spin_unlock_irqrestore(&xhci->lock, flags); |
848 | 849 | ||
849 | ret = xhci_halt(xhci); | 850 | ret = xhci_halt(xhci); |
850 | 851 | ||
851 | spin_lock(&xhci->lock); | 852 | spin_lock_irqsave(&xhci->lock, flags); |
852 | if (ret < 0) { | 853 | if (ret < 0) { |
853 | /* This is bad; the host is not responding to commands and it's | 854 | /* This is bad; the host is not responding to commands and it's |
854 | * not allowing itself to be halted. At least interrupts are | 855 | * not allowing itself to be halted. At least interrupts are |
@@ -896,7 +897,7 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg) | |||
896 | } | 897 | } |
897 | } | 898 | } |
898 | } | 899 | } |
899 | spin_unlock(&xhci->lock); | 900 | spin_unlock_irqrestore(&xhci->lock, flags); |
900 | xhci_dbg(xhci, "Calling usb_hc_died()\n"); | 901 | xhci_dbg(xhci, "Calling usb_hc_died()\n"); |
901 | usb_hc_died(xhci_to_hcd(xhci)->primary_hcd); | 902 | usb_hc_died(xhci_to_hcd(xhci)->primary_hcd); |
902 | xhci_dbg(xhci, "xHCI host controller is dead.\n"); | 903 | xhci_dbg(xhci, "xHCI host controller is dead.\n"); |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 1ff95a0df576..aa94c0195791 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -799,7 +799,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
799 | u32 command, temp = 0; | 799 | u32 command, temp = 0; |
800 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 800 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
801 | struct usb_hcd *secondary_hcd; | 801 | struct usb_hcd *secondary_hcd; |
802 | int retval; | 802 | int retval = 0; |
803 | 803 | ||
804 | /* Wait a bit if either of the roothubs need to settle from the | 804 | /* Wait a bit if either of the roothubs need to settle from the |
805 | * transition into bus suspend. | 805 | * transition into bus suspend. |
@@ -809,6 +809,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
809 | xhci->bus_state[1].next_statechange)) | 809 | xhci->bus_state[1].next_statechange)) |
810 | msleep(100); | 810 | msleep(100); |
811 | 811 | ||
812 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
813 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); | ||
814 | |||
812 | spin_lock_irq(&xhci->lock); | 815 | spin_lock_irq(&xhci->lock); |
813 | if (xhci->quirks & XHCI_RESET_ON_RESUME) | 816 | if (xhci->quirks & XHCI_RESET_ON_RESUME) |
814 | hibernated = true; | 817 | hibernated = true; |
@@ -878,20 +881,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
878 | return retval; | 881 | return retval; |
879 | xhci_dbg(xhci, "Start the primary HCD\n"); | 882 | xhci_dbg(xhci, "Start the primary HCD\n"); |
880 | retval = xhci_run(hcd->primary_hcd); | 883 | retval = xhci_run(hcd->primary_hcd); |
881 | if (retval) | ||
882 | goto failed_restart; | ||
883 | |||
884 | xhci_dbg(xhci, "Start the secondary HCD\n"); | ||
885 | retval = xhci_run(secondary_hcd); | ||
886 | if (!retval) { | 884 | if (!retval) { |
887 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | 885 | xhci_dbg(xhci, "Start the secondary HCD\n"); |
888 | set_bit(HCD_FLAG_HW_ACCESSIBLE, | 886 | retval = xhci_run(secondary_hcd); |
889 | &xhci->shared_hcd->flags); | ||
890 | } | 887 | } |
891 | failed_restart: | ||
892 | hcd->state = HC_STATE_SUSPENDED; | 888 | hcd->state = HC_STATE_SUSPENDED; |
893 | xhci->shared_hcd->state = HC_STATE_SUSPENDED; | 889 | xhci->shared_hcd->state = HC_STATE_SUSPENDED; |
894 | return retval; | 890 | goto done; |
895 | } | 891 | } |
896 | 892 | ||
897 | /* step 4: set Run/Stop bit */ | 893 | /* step 4: set Run/Stop bit */ |
@@ -910,11 +906,14 @@ failed_restart: | |||
910 | * Running endpoints by ringing their doorbells | 906 | * Running endpoints by ringing their doorbells |
911 | */ | 907 | */ |
912 | 908 | ||
913 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
914 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); | ||
915 | |||
916 | spin_unlock_irq(&xhci->lock); | 909 | spin_unlock_irq(&xhci->lock); |
917 | return 0; | 910 | |
911 | done: | ||
912 | if (retval == 0) { | ||
913 | usb_hcd_resume_root_hub(hcd); | ||
914 | usb_hcd_resume_root_hub(xhci->shared_hcd); | ||
915 | } | ||
916 | return retval; | ||
918 | } | 917 | } |
919 | #endif /* CONFIG_PM */ | 918 | #endif /* CONFIG_PM */ |
920 | 919 | ||
@@ -3504,6 +3503,10 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
3504 | /* Otherwise, update the control endpoint ring enqueue pointer. */ | 3503 | /* Otherwise, update the control endpoint ring enqueue pointer. */ |
3505 | else | 3504 | else |
3506 | xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev); | 3505 | xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev); |
3506 | ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx); | ||
3507 | ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG); | ||
3508 | ctrl_ctx->drop_flags = 0; | ||
3509 | |||
3507 | xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); | 3510 | xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); |
3508 | xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); | 3511 | xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); |
3509 | 3512 | ||
@@ -3585,7 +3588,6 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
3585 | virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK) | 3588 | virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK) |
3586 | + 1; | 3589 | + 1; |
3587 | /* Zero the input context control for later use */ | 3590 | /* Zero the input context control for later use */ |
3588 | ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx); | ||
3589 | ctrl_ctx->add_flags = 0; | 3591 | ctrl_ctx->add_flags = 0; |
3590 | ctrl_ctx->drop_flags = 0; | 3592 | ctrl_ctx->drop_flags = 0; |
3591 | 3593 | ||
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index fc34b8b11910..07a03460a598 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -11,6 +11,7 @@ config USB_MUSB_HDRC | |||
11 | select TWL4030_USB if MACH_OMAP_3430SDP | 11 | select TWL4030_USB if MACH_OMAP_3430SDP |
12 | select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA | 12 | select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA |
13 | select USB_OTG_UTILS | 13 | select USB_OTG_UTILS |
14 | select USB_GADGET_DUALSPEED | ||
14 | tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' | 15 | tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' |
15 | help | 16 | help |
16 | Say Y here if your system has a dual role high speed USB | 17 | Say Y here if your system has a dual role high speed USB |
@@ -60,7 +61,7 @@ config USB_MUSB_BLACKFIN | |||
60 | 61 | ||
61 | config USB_MUSB_UX500 | 62 | config USB_MUSB_UX500 |
62 | tristate "U8500 and U5500" | 63 | tristate "U8500 and U5500" |
63 | depends on (ARCH_U8500 && AB8500_USB) || (ARCH_U5500) | 64 | depends on (ARCH_U8500 && AB8500_USB) |
64 | 65 | ||
65 | endchoice | 66 | endchoice |
66 | 67 | ||
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 08f1d0b662a3..e233d2b7d335 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/module.h> | ||
30 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
31 | #include <linux/io.h> | 32 | #include <linux/io.h> |
32 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 4da7492ddbdb..2613bfdb09b6 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/module.h> | ||
30 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
31 | #include <linux/io.h> | 32 | #include <linux/io.h> |
32 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 20a28731c338..c1fa12ec7a9a 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1477,8 +1477,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) | |||
1477 | /*-------------------------------------------------------------------------*/ | 1477 | /*-------------------------------------------------------------------------*/ |
1478 | 1478 | ||
1479 | #if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) || \ | 1479 | #if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) || \ |
1480 | defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_ARCH_U8500) || \ | 1480 | defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_ARCH_U8500) |
1481 | defined(CONFIG_ARCH_U5500) | ||
1482 | 1481 | ||
1483 | static irqreturn_t generic_interrupt(int irq, void *__hci) | 1482 | static irqreturn_t generic_interrupt(int irq, void *__hci) |
1484 | { | 1483 | { |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index ae4a20acef6c..d51043acfe1a 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -1999,10 +1999,6 @@ static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver) | |||
1999 | nuke(&hw_ep->ep_out, -ESHUTDOWN); | 1999 | nuke(&hw_ep->ep_out, -ESHUTDOWN); |
2000 | } | 2000 | } |
2001 | } | 2001 | } |
2002 | |||
2003 | spin_unlock(&musb->lock); | ||
2004 | driver->disconnect(&musb->g); | ||
2005 | spin_lock(&musb->lock); | ||
2006 | } | 2002 | } |
2007 | } | 2003 | } |
2008 | 2004 | ||
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index d2e2efaba658..08c679c0dde5 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c | |||
@@ -405,7 +405,7 @@ int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev) | |||
405 | /* | 405 | /* |
406 | * platform functions | 406 | * platform functions |
407 | */ | 407 | */ |
408 | static int __devinit usbhs_probe(struct platform_device *pdev) | 408 | static int usbhs_probe(struct platform_device *pdev) |
409 | { | 409 | { |
410 | struct renesas_usbhs_platform_info *info = pdev->dev.platform_data; | 410 | struct renesas_usbhs_platform_info *info = pdev->dev.platform_data; |
411 | struct renesas_usbhs_driver_callback *dfunc; | 411 | struct renesas_usbhs_driver_callback *dfunc; |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 8da685e796d1..ffdf5d15085e 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -820,7 +820,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done) | |||
820 | if (len % 4) /* 32bit alignment */ | 820 | if (len % 4) /* 32bit alignment */ |
821 | goto usbhsf_pio_prepare_push; | 821 | goto usbhsf_pio_prepare_push; |
822 | 822 | ||
823 | if ((*(u32 *) pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ | 823 | if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ |
824 | goto usbhsf_pio_prepare_push; | 824 | goto usbhsf_pio_prepare_push; |
825 | 825 | ||
826 | /* get enable DMA fifo */ | 826 | /* get enable DMA fifo */ |
@@ -897,7 +897,7 @@ static int usbhsf_dma_try_pop(struct usbhs_pkt *pkt, int *is_done) | |||
897 | if (!fifo) | 897 | if (!fifo) |
898 | goto usbhsf_pio_prepare_pop; | 898 | goto usbhsf_pio_prepare_pop; |
899 | 899 | ||
900 | if ((*(u32 *) pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ | 900 | if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ |
901 | goto usbhsf_pio_prepare_pop; | 901 | goto usbhsf_pio_prepare_pop; |
902 | 902 | ||
903 | ret = usbhsf_fifo_select(pipe, fifo, 0); | 903 | ret = usbhsf_fifo_select(pipe, fifo, 0); |
diff --git a/drivers/usb/renesas_usbhs/mod.h b/drivers/usb/renesas_usbhs/mod.h index 8ae3733031cd..6c6875533f01 100644 --- a/drivers/usb/renesas_usbhs/mod.h +++ b/drivers/usb/renesas_usbhs/mod.h | |||
@@ -143,8 +143,8 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod); | |||
143 | */ | 143 | */ |
144 | #if defined(CONFIG_USB_RENESAS_USBHS_HCD) || \ | 144 | #if defined(CONFIG_USB_RENESAS_USBHS_HCD) || \ |
145 | defined(CONFIG_USB_RENESAS_USBHS_HCD_MODULE) | 145 | defined(CONFIG_USB_RENESAS_USBHS_HCD_MODULE) |
146 | extern int __devinit usbhs_mod_host_probe(struct usbhs_priv *priv); | 146 | extern int usbhs_mod_host_probe(struct usbhs_priv *priv); |
147 | extern int __devexit usbhs_mod_host_remove(struct usbhs_priv *priv); | 147 | extern int usbhs_mod_host_remove(struct usbhs_priv *priv); |
148 | #else | 148 | #else |
149 | static inline int usbhs_mod_host_probe(struct usbhs_priv *priv) | 149 | static inline int usbhs_mod_host_probe(struct usbhs_priv *priv) |
150 | { | 150 | { |
@@ -157,8 +157,8 @@ static inline void usbhs_mod_host_remove(struct usbhs_priv *priv) | |||
157 | 157 | ||
158 | #if defined(CONFIG_USB_RENESAS_USBHS_UDC) || \ | 158 | #if defined(CONFIG_USB_RENESAS_USBHS_UDC) || \ |
159 | defined(CONFIG_USB_RENESAS_USBHS_UDC_MODULE) | 159 | defined(CONFIG_USB_RENESAS_USBHS_UDC_MODULE) |
160 | extern int __devinit usbhs_mod_gadget_probe(struct usbhs_priv *priv); | 160 | extern int usbhs_mod_gadget_probe(struct usbhs_priv *priv); |
161 | extern void __devexit usbhs_mod_gadget_remove(struct usbhs_priv *priv); | 161 | extern void usbhs_mod_gadget_remove(struct usbhs_priv *priv); |
162 | #else | 162 | #else |
163 | static inline int usbhs_mod_gadget_probe(struct usbhs_priv *priv) | 163 | static inline int usbhs_mod_gadget_probe(struct usbhs_priv *priv) |
164 | { | 164 | { |
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 4cc7ee0babc6..d9717e0bc1ff 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c | |||
@@ -830,7 +830,7 @@ static int usbhsg_stop(struct usbhs_priv *priv) | |||
830 | return usbhsg_try_stop(priv, USBHSG_STATUS_STARTED); | 830 | return usbhsg_try_stop(priv, USBHSG_STATUS_STARTED); |
831 | } | 831 | } |
832 | 832 | ||
833 | int __devinit usbhs_mod_gadget_probe(struct usbhs_priv *priv) | 833 | int usbhs_mod_gadget_probe(struct usbhs_priv *priv) |
834 | { | 834 | { |
835 | struct usbhsg_gpriv *gpriv; | 835 | struct usbhsg_gpriv *gpriv; |
836 | struct usbhsg_uep *uep; | 836 | struct usbhsg_uep *uep; |
@@ -927,7 +927,7 @@ usbhs_mod_gadget_probe_err_gpriv: | |||
927 | return ret; | 927 | return ret; |
928 | } | 928 | } |
929 | 929 | ||
930 | void __devexit usbhs_mod_gadget_remove(struct usbhs_priv *priv) | 930 | void usbhs_mod_gadget_remove(struct usbhs_priv *priv) |
931 | { | 931 | { |
932 | struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); | 932 | struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); |
933 | 933 | ||
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index 1a7208a50afc..bade761a1e52 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c | |||
@@ -103,7 +103,7 @@ struct usbhsh_hpriv { | |||
103 | 103 | ||
104 | u32 port_stat; /* USB_PORT_STAT_xxx */ | 104 | u32 port_stat; /* USB_PORT_STAT_xxx */ |
105 | 105 | ||
106 | struct completion *done; | 106 | struct completion setup_ack_done; |
107 | 107 | ||
108 | /* see usbhsh_req_alloc/free */ | 108 | /* see usbhsh_req_alloc/free */ |
109 | struct list_head ureq_link_active; | 109 | struct list_head ureq_link_active; |
@@ -355,6 +355,7 @@ static void usbhsh_device_free(struct usbhsh_hpriv *hpriv, | |||
355 | struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, | 355 | struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, |
356 | struct usbhsh_device *udev, | 356 | struct usbhsh_device *udev, |
357 | struct usb_host_endpoint *ep, | 357 | struct usb_host_endpoint *ep, |
358 | int dir_in_req, | ||
358 | gfp_t mem_flags) | 359 | gfp_t mem_flags) |
359 | { | 360 | { |
360 | struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv); | 361 | struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv); |
@@ -364,27 +365,38 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, | |||
364 | struct usbhs_pipe *pipe, *best_pipe; | 365 | struct usbhs_pipe *pipe, *best_pipe; |
365 | struct device *dev = usbhsh_hcd_to_dev(hcd); | 366 | struct device *dev = usbhsh_hcd_to_dev(hcd); |
366 | struct usb_endpoint_descriptor *desc = &ep->desc; | 367 | struct usb_endpoint_descriptor *desc = &ep->desc; |
367 | int type, i; | 368 | int type, i, dir_in; |
368 | unsigned int min_usr; | 369 | unsigned int min_usr; |
369 | 370 | ||
371 | dir_in_req = !!dir_in_req; | ||
372 | |||
370 | uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags); | 373 | uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags); |
371 | if (!uep) { | 374 | if (!uep) { |
372 | dev_err(dev, "usbhsh_ep alloc fail\n"); | 375 | dev_err(dev, "usbhsh_ep alloc fail\n"); |
373 | return NULL; | 376 | return NULL; |
374 | } | 377 | } |
375 | type = usb_endpoint_type(desc); | 378 | |
379 | if (usb_endpoint_xfer_control(desc)) { | ||
380 | best_pipe = usbhsh_hpriv_to_dcp(hpriv); | ||
381 | goto usbhsh_endpoint_alloc_find_pipe; | ||
382 | } | ||
376 | 383 | ||
377 | /* | 384 | /* |
378 | * find best pipe for endpoint | 385 | * find best pipe for endpoint |
379 | * see | 386 | * see |
380 | * HARDWARE LIMITATION | 387 | * HARDWARE LIMITATION |
381 | */ | 388 | */ |
389 | type = usb_endpoint_type(desc); | ||
382 | min_usr = ~0; | 390 | min_usr = ~0; |
383 | best_pipe = NULL; | 391 | best_pipe = NULL; |
384 | usbhs_for_each_pipe_with_dcp(pipe, priv, i) { | 392 | usbhs_for_each_pipe(pipe, priv, i) { |
385 | if (!usbhs_pipe_type_is(pipe, type)) | 393 | if (!usbhs_pipe_type_is(pipe, type)) |
386 | continue; | 394 | continue; |
387 | 395 | ||
396 | dir_in = !!usbhs_pipe_is_dir_in(pipe); | ||
397 | if (0 != (dir_in - dir_in_req)) | ||
398 | continue; | ||
399 | |||
388 | info = usbhsh_pipe_info(pipe); | 400 | info = usbhsh_pipe_info(pipe); |
389 | 401 | ||
390 | if (min_usr > info->usr_cnt) { | 402 | if (min_usr > info->usr_cnt) { |
@@ -398,7 +410,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, | |||
398 | kfree(uep); | 410 | kfree(uep); |
399 | return NULL; | 411 | return NULL; |
400 | } | 412 | } |
401 | 413 | usbhsh_endpoint_alloc_find_pipe: | |
402 | /* | 414 | /* |
403 | * init uep | 415 | * init uep |
404 | */ | 416 | */ |
@@ -423,6 +435,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, | |||
423 | * see | 435 | * see |
424 | * DCPMAXP/PIPEMAXP | 436 | * DCPMAXP/PIPEMAXP |
425 | */ | 437 | */ |
438 | usbhs_pipe_sequence_data0(uep->pipe); | ||
426 | usbhs_pipe_config_update(uep->pipe, | 439 | usbhs_pipe_config_update(uep->pipe, |
427 | usbhsh_device_number(hpriv, udev), | 440 | usbhsh_device_number(hpriv, udev), |
428 | usb_endpoint_num(desc), | 441 | usb_endpoint_num(desc), |
@@ -430,7 +443,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, | |||
430 | 443 | ||
431 | dev_dbg(dev, "%s [%d-%s](%p)\n", __func__, | 444 | dev_dbg(dev, "%s [%d-%s](%p)\n", __func__, |
432 | usbhsh_device_number(hpriv, udev), | 445 | usbhsh_device_number(hpriv, udev), |
433 | usbhs_pipe_name(pipe), uep); | 446 | usbhs_pipe_name(uep->pipe), uep); |
434 | 447 | ||
435 | return uep; | 448 | return uep; |
436 | } | 449 | } |
@@ -549,8 +562,7 @@ static void usbhsh_setup_stage_packet_push(struct usbhsh_hpriv *hpriv, | |||
549 | * usbhsh_irq_setup_ack() | 562 | * usbhsh_irq_setup_ack() |
550 | * usbhsh_irq_setup_err() | 563 | * usbhsh_irq_setup_err() |
551 | */ | 564 | */ |
552 | DECLARE_COMPLETION(done); | 565 | init_completion(&hpriv->setup_ack_done); |
553 | hpriv->done = &done; | ||
554 | 566 | ||
555 | /* copy original request */ | 567 | /* copy original request */ |
556 | memcpy(&req, urb->setup_packet, sizeof(struct usb_ctrlrequest)); | 568 | memcpy(&req, urb->setup_packet, sizeof(struct usb_ctrlrequest)); |
@@ -572,8 +584,7 @@ static void usbhsh_setup_stage_packet_push(struct usbhsh_hpriv *hpriv, | |||
572 | /* | 584 | /* |
573 | * wait setup packet ACK | 585 | * wait setup packet ACK |
574 | */ | 586 | */ |
575 | wait_for_completion(&done); | 587 | wait_for_completion(&hpriv->setup_ack_done); |
576 | hpriv->done = NULL; | ||
577 | 588 | ||
578 | dev_dbg(dev, "%s done\n", __func__); | 589 | dev_dbg(dev, "%s done\n", __func__); |
579 | } | 590 | } |
@@ -724,11 +735,11 @@ static int usbhsh_urb_enqueue(struct usb_hcd *hcd, | |||
724 | struct usbhsh_device *udev, *new_udev = NULL; | 735 | struct usbhsh_device *udev, *new_udev = NULL; |
725 | struct usbhs_pipe *pipe; | 736 | struct usbhs_pipe *pipe; |
726 | struct usbhsh_ep *uep; | 737 | struct usbhsh_ep *uep; |
738 | int is_dir_in = usb_pipein(urb->pipe); | ||
727 | 739 | ||
728 | int ret; | 740 | int ret; |
729 | 741 | ||
730 | dev_dbg(dev, "%s (%s)\n", | 742 | dev_dbg(dev, "%s (%s)\n", __func__, is_dir_in ? "in" : "out"); |
731 | __func__, usb_pipein(urb->pipe) ? "in" : "out"); | ||
732 | 743 | ||
733 | ret = usb_hcd_link_urb_to_ep(hcd, urb); | 744 | ret = usb_hcd_link_urb_to_ep(hcd, urb); |
734 | if (ret) | 745 | if (ret) |
@@ -751,7 +762,8 @@ static int usbhsh_urb_enqueue(struct usb_hcd *hcd, | |||
751 | */ | 762 | */ |
752 | uep = usbhsh_ep_to_uep(ep); | 763 | uep = usbhsh_ep_to_uep(ep); |
753 | if (!uep) { | 764 | if (!uep) { |
754 | uep = usbhsh_endpoint_alloc(hpriv, udev, ep, mem_flags); | 765 | uep = usbhsh_endpoint_alloc(hpriv, udev, ep, |
766 | is_dir_in, mem_flags); | ||
755 | if (!uep) | 767 | if (!uep) |
756 | goto usbhsh_urb_enqueue_error_free_device; | 768 | goto usbhsh_urb_enqueue_error_free_device; |
757 | } | 769 | } |
@@ -1095,10 +1107,7 @@ static int usbhsh_irq_setup_ack(struct usbhs_priv *priv, | |||
1095 | 1107 | ||
1096 | dev_dbg(dev, "setup packet OK\n"); | 1108 | dev_dbg(dev, "setup packet OK\n"); |
1097 | 1109 | ||
1098 | if (unlikely(!hpriv->done)) | 1110 | complete(&hpriv->setup_ack_done); /* see usbhsh_urb_enqueue() */ |
1099 | dev_err(dev, "setup ack happen without necessary data\n"); | ||
1100 | else | ||
1101 | complete(hpriv->done); /* see usbhsh_urb_enqueue() */ | ||
1102 | 1111 | ||
1103 | return 0; | 1112 | return 0; |
1104 | } | 1113 | } |
@@ -1111,10 +1120,7 @@ static int usbhsh_irq_setup_err(struct usbhs_priv *priv, | |||
1111 | 1120 | ||
1112 | dev_dbg(dev, "setup packet Err\n"); | 1121 | dev_dbg(dev, "setup packet Err\n"); |
1113 | 1122 | ||
1114 | if (unlikely(!hpriv->done)) | 1123 | complete(&hpriv->setup_ack_done); /* see usbhsh_urb_enqueue() */ |
1115 | dev_err(dev, "setup err happen without necessary data\n"); | ||
1116 | else | ||
1117 | complete(hpriv->done); /* see usbhsh_urb_enqueue() */ | ||
1118 | 1124 | ||
1119 | return 0; | 1125 | return 0; |
1120 | } | 1126 | } |
@@ -1221,8 +1227,18 @@ static int usbhsh_stop(struct usbhs_priv *priv) | |||
1221 | { | 1227 | { |
1222 | struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv); | 1228 | struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv); |
1223 | struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv); | 1229 | struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv); |
1230 | struct usbhs_mod *mod = usbhs_mod_get_current(priv); | ||
1224 | struct device *dev = usbhs_priv_to_dev(priv); | 1231 | struct device *dev = usbhs_priv_to_dev(priv); |
1225 | 1232 | ||
1233 | /* | ||
1234 | * disable irq callback | ||
1235 | */ | ||
1236 | mod->irq_attch = NULL; | ||
1237 | mod->irq_dtch = NULL; | ||
1238 | mod->irq_sack = NULL; | ||
1239 | mod->irq_sign = NULL; | ||
1240 | usbhs_irq_callback_update(priv, mod); | ||
1241 | |||
1226 | usb_remove_hcd(hcd); | 1242 | usb_remove_hcd(hcd); |
1227 | 1243 | ||
1228 | /* disable sys */ | 1244 | /* disable sys */ |
@@ -1235,7 +1251,7 @@ static int usbhsh_stop(struct usbhs_priv *priv) | |||
1235 | return 0; | 1251 | return 0; |
1236 | } | 1252 | } |
1237 | 1253 | ||
1238 | int __devinit usbhs_mod_host_probe(struct usbhs_priv *priv) | 1254 | int usbhs_mod_host_probe(struct usbhs_priv *priv) |
1239 | { | 1255 | { |
1240 | struct usbhsh_hpriv *hpriv; | 1256 | struct usbhsh_hpriv *hpriv; |
1241 | struct usb_hcd *hcd; | 1257 | struct usb_hcd *hcd; |
@@ -1279,7 +1295,6 @@ int __devinit usbhs_mod_host_probe(struct usbhs_priv *priv) | |||
1279 | hpriv->mod.stop = usbhsh_stop; | 1295 | hpriv->mod.stop = usbhsh_stop; |
1280 | hpriv->pipe_info = pipe_info; | 1296 | hpriv->pipe_info = pipe_info; |
1281 | hpriv->pipe_size = pipe_size; | 1297 | hpriv->pipe_size = pipe_size; |
1282 | hpriv->done = NULL; | ||
1283 | usbhsh_req_list_init(hpriv); | 1298 | usbhsh_req_list_init(hpriv); |
1284 | usbhsh_port_stat_init(hpriv); | 1299 | usbhsh_port_stat_init(hpriv); |
1285 | 1300 | ||
@@ -1299,7 +1314,7 @@ usbhs_mod_host_probe_err: | |||
1299 | return -ENOMEM; | 1314 | return -ENOMEM; |
1300 | } | 1315 | } |
1301 | 1316 | ||
1302 | int __devexit usbhs_mod_host_remove(struct usbhs_priv *priv) | 1317 | int usbhs_mod_host_remove(struct usbhs_priv *priv) |
1303 | { | 1318 | { |
1304 | struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv); | 1319 | struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv); |
1305 | struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv); | 1320 | struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv); |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 5cdb9d912275..18e875b92e00 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -42,7 +42,7 @@ static int debug; | |||
42 | * Version information | 42 | * Version information |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #define DRIVER_VERSION "v0.6" | 45 | #define DRIVER_VERSION "v0.7" |
46 | #define DRIVER_AUTHOR "Bart Hartgers <bart.hartgers+ark3116@gmail.com>" | 46 | #define DRIVER_AUTHOR "Bart Hartgers <bart.hartgers+ark3116@gmail.com>" |
47 | #define DRIVER_DESC "USB ARK3116 serial/IrDA driver" | 47 | #define DRIVER_DESC "USB ARK3116 serial/IrDA driver" |
48 | #define DRIVER_DEV_DESC "ARK3116 RS232/IrDA" | 48 | #define DRIVER_DEV_DESC "ARK3116 RS232/IrDA" |
@@ -380,10 +380,6 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
380 | goto err_out; | 380 | goto err_out; |
381 | } | 381 | } |
382 | 382 | ||
383 | /* setup termios */ | ||
384 | if (tty) | ||
385 | ark3116_set_termios(tty, port, NULL); | ||
386 | |||
387 | /* remove any data still left: also clears error state */ | 383 | /* remove any data still left: also clears error state */ |
388 | ark3116_read_reg(serial, UART_RX, buf); | 384 | ark3116_read_reg(serial, UART_RX, buf); |
389 | 385 | ||
@@ -406,6 +402,10 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
406 | /* enable DMA */ | 402 | /* enable DMA */ |
407 | ark3116_write_reg(port->serial, UART_FCR, UART_FCR_DMA_SELECT); | 403 | ark3116_write_reg(port->serial, UART_FCR, UART_FCR_DMA_SELECT); |
408 | 404 | ||
405 | /* setup termios */ | ||
406 | if (tty) | ||
407 | ark3116_set_termios(tty, port, NULL); | ||
408 | |||
409 | err_out: | 409 | err_out: |
410 | kfree(buf); | 410 | kfree(buf); |
411 | return result; | 411 | return result; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 8fe034d2d3e7..bd4298bb6750 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -2104,13 +2104,19 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2104 | 2104 | ||
2105 | cflag = termios->c_cflag; | 2105 | cflag = termios->c_cflag; |
2106 | 2106 | ||
2107 | /* FIXME -For this cut I don't care if the line is really changing or | 2107 | if (old_termios->c_cflag == termios->c_cflag |
2108 | not - so just do the change regardless - should be able to | 2108 | && old_termios->c_ispeed == termios->c_ispeed |
2109 | compare old_termios and tty->termios */ | 2109 | && old_termios->c_ospeed == termios->c_ospeed) |
2110 | goto no_c_cflag_changes; | ||
2111 | |||
2110 | /* NOTE These routines can get interrupted by | 2112 | /* NOTE These routines can get interrupted by |
2111 | ftdi_sio_read_bulk_callback - need to examine what this means - | 2113 | ftdi_sio_read_bulk_callback - need to examine what this means - |
2112 | don't see any problems yet */ | 2114 | don't see any problems yet */ |
2113 | 2115 | ||
2116 | if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) == | ||
2117 | (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB))) | ||
2118 | goto no_data_parity_stop_changes; | ||
2119 | |||
2114 | /* Set number of data bits, parity, stop bits */ | 2120 | /* Set number of data bits, parity, stop bits */ |
2115 | 2121 | ||
2116 | urb_value = 0; | 2122 | urb_value = 0; |
@@ -2151,6 +2157,7 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2151 | } | 2157 | } |
2152 | 2158 | ||
2153 | /* Now do the baudrate */ | 2159 | /* Now do the baudrate */ |
2160 | no_data_parity_stop_changes: | ||
2154 | if ((cflag & CBAUD) == B0) { | 2161 | if ((cflag & CBAUD) == B0) { |
2155 | /* Disable flow control */ | 2162 | /* Disable flow control */ |
2156 | if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 2163 | if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
@@ -2178,6 +2185,7 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2178 | 2185 | ||
2179 | /* Set flow control */ | 2186 | /* Set flow control */ |
2180 | /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */ | 2187 | /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */ |
2188 | no_c_cflag_changes: | ||
2181 | if (cflag & CRTSCTS) { | 2189 | if (cflag & CRTSCTS) { |
2182 | dbg("%s Setting to CRTSCTS flow control", __func__); | 2190 | dbg("%s Setting to CRTSCTS flow control", __func__); |
2183 | if (usb_control_msg(dev, | 2191 | if (usb_control_msg(dev, |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 89ae1f65e1b1..d865878c9f97 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -156,6 +156,7 @@ static void option_instat_callback(struct urb *urb); | |||
156 | #define HUAWEI_PRODUCT_K4511 0x14CC | 156 | #define HUAWEI_PRODUCT_K4511 0x14CC |
157 | #define HUAWEI_PRODUCT_ETS1220 0x1803 | 157 | #define HUAWEI_PRODUCT_ETS1220 0x1803 |
158 | #define HUAWEI_PRODUCT_E353 0x1506 | 158 | #define HUAWEI_PRODUCT_E353 0x1506 |
159 | #define HUAWEI_PRODUCT_E173S 0x1C05 | ||
159 | 160 | ||
160 | #define QUANTA_VENDOR_ID 0x0408 | 161 | #define QUANTA_VENDOR_ID 0x0408 |
161 | #define QUANTA_PRODUCT_Q101 0xEA02 | 162 | #define QUANTA_PRODUCT_Q101 0xEA02 |
@@ -316,6 +317,9 @@ static void option_instat_callback(struct urb *urb); | |||
316 | #define ZTE_PRODUCT_AC8710 0xfff1 | 317 | #define ZTE_PRODUCT_AC8710 0xfff1 |
317 | #define ZTE_PRODUCT_AC2726 0xfff5 | 318 | #define ZTE_PRODUCT_AC2726 0xfff5 |
318 | #define ZTE_PRODUCT_AC8710T 0xffff | 319 | #define ZTE_PRODUCT_AC8710T 0xffff |
320 | #define ZTE_PRODUCT_MC2718 0xffe8 | ||
321 | #define ZTE_PRODUCT_AD3812 0xffeb | ||
322 | #define ZTE_PRODUCT_MC2716 0xffed | ||
319 | 323 | ||
320 | #define BENQ_VENDOR_ID 0x04a5 | 324 | #define BENQ_VENDOR_ID 0x04a5 |
321 | #define BENQ_PRODUCT_H10 0x4068 | 325 | #define BENQ_PRODUCT_H10 0x4068 |
@@ -468,6 +472,10 @@ static void option_instat_callback(struct urb *urb); | |||
468 | #define YUGA_PRODUCT_CLU528 0x260D | 472 | #define YUGA_PRODUCT_CLU528 0x260D |
469 | #define YUGA_PRODUCT_CLU526 0x260F | 473 | #define YUGA_PRODUCT_CLU526 0x260F |
470 | 474 | ||
475 | /* Viettel products */ | ||
476 | #define VIETTEL_VENDOR_ID 0x2262 | ||
477 | #define VIETTEL_PRODUCT_VT1000 0x0002 | ||
478 | |||
471 | /* some devices interfaces need special handling due to a number of reasons */ | 479 | /* some devices interfaces need special handling due to a number of reasons */ |
472 | enum option_blacklist_reason { | 480 | enum option_blacklist_reason { |
473 | OPTION_BLACKLIST_NONE = 0, | 481 | OPTION_BLACKLIST_NONE = 0, |
@@ -500,6 +508,18 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = { | |||
500 | .reserved = BIT(4), | 508 | .reserved = BIT(4), |
501 | }; | 509 | }; |
502 | 510 | ||
511 | static const struct option_blacklist_info zte_ad3812_z_blacklist = { | ||
512 | .sendsetup = BIT(0) | BIT(1) | BIT(2), | ||
513 | }; | ||
514 | |||
515 | static const struct option_blacklist_info zte_mc2718_z_blacklist = { | ||
516 | .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4), | ||
517 | }; | ||
518 | |||
519 | static const struct option_blacklist_info zte_mc2716_z_blacklist = { | ||
520 | .sendsetup = BIT(1) | BIT(2) | BIT(3), | ||
521 | }; | ||
522 | |||
503 | static const struct option_blacklist_info huawei_cdc12_blacklist = { | 523 | static const struct option_blacklist_info huawei_cdc12_blacklist = { |
504 | .reserved = BIT(1) | BIT(2), | 524 | .reserved = BIT(1) | BIT(2), |
505 | }; | 525 | }; |
@@ -622,6 +642,7 @@ static const struct usb_device_id option_ids[] = { | |||
622 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) }, | 642 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) }, |
623 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) }, | 643 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) }, |
624 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) }, | 644 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) }, |
645 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S, 0xff, 0xff, 0xff) }, | ||
625 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff), | 646 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff), |
626 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, | 647 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, |
627 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), | 648 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), |
@@ -1043,6 +1064,12 @@ static const struct usb_device_id option_ids[] = { | |||
1043 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, | 1064 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, |
1044 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, | 1065 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, |
1045 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, | 1066 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, |
1067 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), | ||
1068 | .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist }, | ||
1069 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff), | ||
1070 | .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, | ||
1071 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), | ||
1072 | .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, | ||
1046 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, | 1073 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, |
1047 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, | 1074 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, |
1048 | { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */ | 1075 | { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */ |
@@ -1141,6 +1168,7 @@ static const struct usb_device_id option_ids[] = { | |||
1141 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU516) }, | 1168 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU516) }, |
1142 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) }, | 1169 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) }, |
1143 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) }, | 1170 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) }, |
1171 | { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) }, | ||
1144 | { } /* Terminating entry */ | 1172 | { } /* Terminating entry */ |
1145 | }; | 1173 | }; |
1146 | MODULE_DEVICE_TABLE(usb, option_ids); | 1174 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 9083d1e616b4..fc2d66f7f4eb 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -91,7 +91,6 @@ static const struct usb_device_id id_table[] = { | |||
91 | { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) }, | 91 | { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) }, |
92 | { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) }, | 92 | { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) }, |
93 | { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) }, | 93 | { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) }, |
94 | { USB_DEVICE(WINCHIPHEAD_VENDOR_ID, WINCHIPHEAD_USBSER_PRODUCT_ID) }, | ||
95 | { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) }, | 94 | { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) }, |
96 | { } /* Terminating entry */ | 95 | { } /* Terminating entry */ |
97 | }; | 96 | }; |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 3d10d7f02072..c38b8c00c06f 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -145,10 +145,6 @@ | |||
145 | #define ADLINK_VENDOR_ID 0x0b63 | 145 | #define ADLINK_VENDOR_ID 0x0b63 |
146 | #define ADLINK_ND6530_PRODUCT_ID 0x6530 | 146 | #define ADLINK_ND6530_PRODUCT_ID 0x6530 |
147 | 147 | ||
148 | /* WinChipHead USB->RS 232 adapter */ | ||
149 | #define WINCHIPHEAD_VENDOR_ID 0x4348 | ||
150 | #define WINCHIPHEAD_USBSER_PRODUCT_ID 0x5523 | ||
151 | |||
152 | /* SMART USB Serial Adapter */ | 148 | /* SMART USB Serial Adapter */ |
153 | #define SMART_VENDOR_ID 0x0b8c | 149 | #define SMART_VENDOR_ID 0x0b8c |
154 | #define SMART_PRODUCT_ID 0x2303 | 150 | #define SMART_PRODUCT_ID 0x2303 |
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c index 4dca3ef0668c..9fbe742343c6 100644 --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c | |||
@@ -1762,10 +1762,9 @@ static int ms_scsi_write(struct us_data *us, struct scsi_cmnd *srb) | |||
1762 | result = ene_send_scsi_cmd(us, FDIR_WRITE, scsi_sglist(srb), 1); | 1762 | result = ene_send_scsi_cmd(us, FDIR_WRITE, scsi_sglist(srb), 1); |
1763 | } else { | 1763 | } else { |
1764 | void *buf; | 1764 | void *buf; |
1765 | int offset; | 1765 | int offset = 0; |
1766 | u16 PhyBlockAddr; | 1766 | u16 PhyBlockAddr; |
1767 | u8 PageNum; | 1767 | u8 PageNum; |
1768 | u32 result; | ||
1769 | u16 len, oldphy, newphy; | 1768 | u16 len, oldphy, newphy; |
1770 | 1769 | ||
1771 | buf = kmalloc(blenByte, GFP_KERNEL); | 1770 | buf = kmalloc(blenByte, GFP_KERNEL); |
diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c index 93c1a4d86f51..82dd834709c7 100644 --- a/drivers/usb/storage/protocol.c +++ b/drivers/usb/storage/protocol.c | |||
@@ -59,7 +59,9 @@ | |||
59 | 59 | ||
60 | void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us) | 60 | void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us) |
61 | { | 61 | { |
62 | /* Pad the SCSI command with zeros out to 12 bytes | 62 | /* |
63 | * Pad the SCSI command with zeros out to 12 bytes. If the | ||
64 | * command already is 12 bytes or longer, leave it alone. | ||
63 | * | 65 | * |
64 | * NOTE: This only works because a scsi_cmnd struct field contains | 66 | * NOTE: This only works because a scsi_cmnd struct field contains |
65 | * a unsigned char cmnd[16], so we know we have storage available | 67 | * a unsigned char cmnd[16], so we know we have storage available |
@@ -67,9 +69,6 @@ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us) | |||
67 | for (; srb->cmd_len<12; srb->cmd_len++) | 69 | for (; srb->cmd_len<12; srb->cmd_len++) |
68 | srb->cmnd[srb->cmd_len] = 0; | 70 | srb->cmnd[srb->cmd_len] = 0; |
69 | 71 | ||
70 | /* set command length to 12 bytes */ | ||
71 | srb->cmd_len = 12; | ||
72 | |||
73 | /* send the command to the transport layer */ | 72 | /* send the command to the transport layer */ |
74 | usb_stor_invoke_transport(srb, us); | 73 | usb_stor_invoke_transport(srb, us); |
75 | } | 74 | } |
diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig index 816ed08e7cf3..1a61939b85fc 100644 --- a/drivers/virtio/Kconfig +++ b/drivers/virtio/Kconfig | |||
@@ -37,7 +37,7 @@ config VIRTIO_BALLOON | |||
37 | 37 | ||
38 | config VIRTIO_MMIO | 38 | config VIRTIO_MMIO |
39 | tristate "Platform bus driver for memory mapped virtio devices (EXPERIMENTAL)" | 39 | tristate "Platform bus driver for memory mapped virtio devices (EXPERIMENTAL)" |
40 | depends on EXPERIMENTAL | 40 | depends on HAS_IOMEM && EXPERIMENTAL |
41 | select VIRTIO | 41 | select VIRTIO |
42 | select VIRTIO_RING | 42 | select VIRTIO_RING |
43 | ---help--- | 43 | ---help--- |
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index acc5e43c373e..7317dc2ec426 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c | |||
@@ -118,7 +118,7 @@ static void vm_finalize_features(struct virtio_device *vdev) | |||
118 | vring_transport_features(vdev); | 118 | vring_transport_features(vdev); |
119 | 119 | ||
120 | for (i = 0; i < ARRAY_SIZE(vdev->features); i++) { | 120 | for (i = 0; i < ARRAY_SIZE(vdev->features); i++) { |
121 | writel(i, vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES_SET); | 121 | writel(i, vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES_SEL); |
122 | writel(vdev->features[i], | 122 | writel(vdev->features[i], |
123 | vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES); | 123 | vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES); |
124 | } | 124 | } |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 3d1bf41e8892..03d1984bd363 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -169,11 +169,29 @@ static void vp_set_status(struct virtio_device *vdev, u8 status) | |||
169 | iowrite8(status, vp_dev->ioaddr + VIRTIO_PCI_STATUS); | 169 | iowrite8(status, vp_dev->ioaddr + VIRTIO_PCI_STATUS); |
170 | } | 170 | } |
171 | 171 | ||
172 | /* wait for pending irq handlers */ | ||
173 | static void vp_synchronize_vectors(struct virtio_device *vdev) | ||
174 | { | ||
175 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | ||
176 | int i; | ||
177 | |||
178 | if (vp_dev->intx_enabled) | ||
179 | synchronize_irq(vp_dev->pci_dev->irq); | ||
180 | |||
181 | for (i = 0; i < vp_dev->msix_vectors; ++i) | ||
182 | synchronize_irq(vp_dev->msix_entries[i].vector); | ||
183 | } | ||
184 | |||
172 | static void vp_reset(struct virtio_device *vdev) | 185 | static void vp_reset(struct virtio_device *vdev) |
173 | { | 186 | { |
174 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | 187 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); |
175 | /* 0 status means a reset. */ | 188 | /* 0 status means a reset. */ |
176 | iowrite8(0, vp_dev->ioaddr + VIRTIO_PCI_STATUS); | 189 | iowrite8(0, vp_dev->ioaddr + VIRTIO_PCI_STATUS); |
190 | /* Flush out the status write, and flush in device writes, | ||
191 | * including MSi-X interrupts, if any. */ | ||
192 | ioread8(vp_dev->ioaddr + VIRTIO_PCI_STATUS); | ||
193 | /* Flush pending VQ/configuration callbacks. */ | ||
194 | vp_synchronize_vectors(vdev); | ||
177 | } | 195 | } |
178 | 196 | ||
179 | /* the notify function used when creating a virt queue */ | 197 | /* the notify function used when creating a virt queue */ |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 6285867a9356..79fd606b7cd5 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -314,13 +314,6 @@ config NUC900_WATCHDOG | |||
314 | To compile this driver as a module, choose M here: the | 314 | To compile this driver as a module, choose M here: the |
315 | module will be called nuc900_wdt. | 315 | module will be called nuc900_wdt. |
316 | 316 | ||
317 | config ADX_WATCHDOG | ||
318 | tristate "Avionic Design Xanthos watchdog" | ||
319 | depends on ARCH_PXA_ADX | ||
320 | help | ||
321 | Say Y here if you want support for the watchdog timer on Avionic | ||
322 | Design Xanthos boards. | ||
323 | |||
324 | config TS72XX_WATCHDOG | 317 | config TS72XX_WATCHDOG |
325 | tristate "TS-72XX SBC Watchdog" | 318 | tristate "TS-72XX SBC Watchdog" |
326 | depends on MACH_TS72XX | 319 | depends on MACH_TS72XX |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 55bd5740e910..fe893e91935b 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -51,7 +51,6 @@ obj-$(CONFIG_ORION_WATCHDOG) += orion_wdt.o | |||
51 | obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o | 51 | obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o |
52 | obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o | 52 | obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o |
53 | obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o | 53 | obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o |
54 | obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o | ||
55 | obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o | 54 | obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o |
56 | obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o | 55 | obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o |
57 | 56 | ||
diff --git a/drivers/watchdog/adx_wdt.c b/drivers/watchdog/adx_wdt.c deleted file mode 100644 index af6e6b16475a..000000000000 --- a/drivers/watchdog/adx_wdt.c +++ /dev/null | |||
@@ -1,355 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008-2009 Avionic Design GmbH | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include <linux/fs.h> | ||
10 | #include <linux/gfp.h> | ||
11 | #include <linux/io.h> | ||
12 | #include <linux/miscdevice.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/uaccess.h> | ||
17 | #include <linux/watchdog.h> | ||
18 | |||
19 | #define WATCHDOG_NAME "adx-wdt" | ||
20 | |||
21 | /* register offsets */ | ||
22 | #define ADX_WDT_CONTROL 0x00 | ||
23 | #define ADX_WDT_CONTROL_ENABLE (1 << 0) | ||
24 | #define ADX_WDT_CONTROL_nRESET (1 << 1) | ||
25 | #define ADX_WDT_TIMEOUT 0x08 | ||
26 | |||
27 | static struct platform_device *adx_wdt_dev; | ||
28 | static unsigned long driver_open; | ||
29 | |||
30 | #define WDT_STATE_STOP 0 | ||
31 | #define WDT_STATE_START 1 | ||
32 | |||
33 | struct adx_wdt { | ||
34 | void __iomem *base; | ||
35 | unsigned long timeout; | ||
36 | unsigned int state; | ||
37 | unsigned int wake; | ||
38 | spinlock_t lock; | ||
39 | }; | ||
40 | |||
41 | static const struct watchdog_info adx_wdt_info = { | ||
42 | .identity = "Avionic Design Xanthos Watchdog", | ||
43 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | ||
44 | }; | ||
45 | |||
46 | static void adx_wdt_start_locked(struct adx_wdt *wdt) | ||
47 | { | ||
48 | u32 ctrl; | ||
49 | |||
50 | ctrl = readl(wdt->base + ADX_WDT_CONTROL); | ||
51 | ctrl |= ADX_WDT_CONTROL_ENABLE; | ||
52 | writel(ctrl, wdt->base + ADX_WDT_CONTROL); | ||
53 | wdt->state = WDT_STATE_START; | ||
54 | } | ||
55 | |||
56 | static void adx_wdt_start(struct adx_wdt *wdt) | ||
57 | { | ||
58 | unsigned long flags; | ||
59 | |||
60 | spin_lock_irqsave(&wdt->lock, flags); | ||
61 | adx_wdt_start_locked(wdt); | ||
62 | spin_unlock_irqrestore(&wdt->lock, flags); | ||
63 | } | ||
64 | |||
65 | static void adx_wdt_stop_locked(struct adx_wdt *wdt) | ||
66 | { | ||
67 | u32 ctrl; | ||
68 | |||
69 | ctrl = readl(wdt->base + ADX_WDT_CONTROL); | ||
70 | ctrl &= ~ADX_WDT_CONTROL_ENABLE; | ||
71 | writel(ctrl, wdt->base + ADX_WDT_CONTROL); | ||
72 | wdt->state = WDT_STATE_STOP; | ||
73 | } | ||
74 | |||
75 | static void adx_wdt_stop(struct adx_wdt *wdt) | ||
76 | { | ||
77 | unsigned long flags; | ||
78 | |||
79 | spin_lock_irqsave(&wdt->lock, flags); | ||
80 | adx_wdt_stop_locked(wdt); | ||
81 | spin_unlock_irqrestore(&wdt->lock, flags); | ||
82 | } | ||
83 | |||
84 | static void adx_wdt_set_timeout(struct adx_wdt *wdt, unsigned long seconds) | ||
85 | { | ||
86 | unsigned long timeout = seconds * 1000; | ||
87 | unsigned long flags; | ||
88 | unsigned int state; | ||
89 | |||
90 | spin_lock_irqsave(&wdt->lock, flags); | ||
91 | state = wdt->state; | ||
92 | adx_wdt_stop_locked(wdt); | ||
93 | writel(timeout, wdt->base + ADX_WDT_TIMEOUT); | ||
94 | |||
95 | if (state == WDT_STATE_START) | ||
96 | adx_wdt_start_locked(wdt); | ||
97 | |||
98 | wdt->timeout = timeout; | ||
99 | spin_unlock_irqrestore(&wdt->lock, flags); | ||
100 | } | ||
101 | |||
102 | static void adx_wdt_get_timeout(struct adx_wdt *wdt, unsigned long *seconds) | ||
103 | { | ||
104 | *seconds = wdt->timeout / 1000; | ||
105 | } | ||
106 | |||
107 | static void adx_wdt_keepalive(struct adx_wdt *wdt) | ||
108 | { | ||
109 | unsigned long flags; | ||
110 | |||
111 | spin_lock_irqsave(&wdt->lock, flags); | ||
112 | writel(wdt->timeout, wdt->base + ADX_WDT_TIMEOUT); | ||
113 | spin_unlock_irqrestore(&wdt->lock, flags); | ||
114 | } | ||
115 | |||
116 | static int adx_wdt_open(struct inode *inode, struct file *file) | ||
117 | { | ||
118 | struct adx_wdt *wdt = platform_get_drvdata(adx_wdt_dev); | ||
119 | |||
120 | if (test_and_set_bit(0, &driver_open)) | ||
121 | return -EBUSY; | ||
122 | |||
123 | file->private_data = wdt; | ||
124 | adx_wdt_set_timeout(wdt, 30); | ||
125 | adx_wdt_start(wdt); | ||
126 | |||
127 | return nonseekable_open(inode, file); | ||
128 | } | ||
129 | |||
130 | static int adx_wdt_release(struct inode *inode, struct file *file) | ||
131 | { | ||
132 | struct adx_wdt *wdt = file->private_data; | ||
133 | |||
134 | adx_wdt_stop(wdt); | ||
135 | clear_bit(0, &driver_open); | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | static long adx_wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
141 | { | ||
142 | struct adx_wdt *wdt = file->private_data; | ||
143 | void __user *argp = (void __user *)arg; | ||
144 | unsigned long __user *p = argp; | ||
145 | unsigned long seconds = 0; | ||
146 | unsigned int options; | ||
147 | long ret = -EINVAL; | ||
148 | |||
149 | switch (cmd) { | ||
150 | case WDIOC_GETSUPPORT: | ||
151 | if (copy_to_user(argp, &adx_wdt_info, sizeof(adx_wdt_info))) | ||
152 | return -EFAULT; | ||
153 | else | ||
154 | return 0; | ||
155 | |||
156 | case WDIOC_GETSTATUS: | ||
157 | case WDIOC_GETBOOTSTATUS: | ||
158 | return put_user(0, p); | ||
159 | |||
160 | case WDIOC_KEEPALIVE: | ||
161 | adx_wdt_keepalive(wdt); | ||
162 | return 0; | ||
163 | |||
164 | case WDIOC_SETTIMEOUT: | ||
165 | if (get_user(seconds, p)) | ||
166 | return -EFAULT; | ||
167 | |||
168 | adx_wdt_set_timeout(wdt, seconds); | ||
169 | |||
170 | /* fallthrough */ | ||
171 | case WDIOC_GETTIMEOUT: | ||
172 | adx_wdt_get_timeout(wdt, &seconds); | ||
173 | return put_user(seconds, p); | ||
174 | |||
175 | case WDIOC_SETOPTIONS: | ||
176 | if (copy_from_user(&options, argp, sizeof(options))) | ||
177 | return -EFAULT; | ||
178 | |||
179 | if (options & WDIOS_DISABLECARD) { | ||
180 | adx_wdt_stop(wdt); | ||
181 | ret = 0; | ||
182 | } | ||
183 | |||
184 | if (options & WDIOS_ENABLECARD) { | ||
185 | adx_wdt_start(wdt); | ||
186 | ret = 0; | ||
187 | } | ||
188 | |||
189 | return ret; | ||
190 | |||
191 | default: | ||
192 | break; | ||
193 | } | ||
194 | |||
195 | return -ENOTTY; | ||
196 | } | ||
197 | |||
198 | static ssize_t adx_wdt_write(struct file *file, const char __user *data, | ||
199 | size_t len, loff_t *ppos) | ||
200 | { | ||
201 | struct adx_wdt *wdt = file->private_data; | ||
202 | |||
203 | if (len) | ||
204 | adx_wdt_keepalive(wdt); | ||
205 | |||
206 | return len; | ||
207 | } | ||
208 | |||
209 | static const struct file_operations adx_wdt_fops = { | ||
210 | .owner = THIS_MODULE, | ||
211 | .llseek = no_llseek, | ||
212 | .open = adx_wdt_open, | ||
213 | .release = adx_wdt_release, | ||
214 | .unlocked_ioctl = adx_wdt_ioctl, | ||
215 | .write = adx_wdt_write, | ||
216 | }; | ||
217 | |||
218 | static struct miscdevice adx_wdt_miscdev = { | ||
219 | .minor = WATCHDOG_MINOR, | ||
220 | .name = "watchdog", | ||
221 | .fops = &adx_wdt_fops, | ||
222 | }; | ||
223 | |||
224 | static int __devinit adx_wdt_probe(struct platform_device *pdev) | ||
225 | { | ||
226 | struct resource *res; | ||
227 | struct adx_wdt *wdt; | ||
228 | int ret = 0; | ||
229 | u32 ctrl; | ||
230 | |||
231 | wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); | ||
232 | if (!wdt) { | ||
233 | dev_err(&pdev->dev, "cannot allocate WDT structure\n"); | ||
234 | return -ENOMEM; | ||
235 | } | ||
236 | |||
237 | spin_lock_init(&wdt->lock); | ||
238 | |||
239 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
240 | if (!res) { | ||
241 | dev_err(&pdev->dev, "cannot obtain I/O memory region\n"); | ||
242 | return -ENXIO; | ||
243 | } | ||
244 | |||
245 | res = devm_request_mem_region(&pdev->dev, res->start, | ||
246 | resource_size(res), res->name); | ||
247 | if (!res) { | ||
248 | dev_err(&pdev->dev, "cannot request I/O memory region\n"); | ||
249 | return -ENXIO; | ||
250 | } | ||
251 | |||
252 | wdt->base = devm_ioremap_nocache(&pdev->dev, res->start, | ||
253 | resource_size(res)); | ||
254 | if (!wdt->base) { | ||
255 | dev_err(&pdev->dev, "cannot remap I/O memory region\n"); | ||
256 | return -ENXIO; | ||
257 | } | ||
258 | |||
259 | /* disable watchdog and reboot on timeout */ | ||
260 | ctrl = readl(wdt->base + ADX_WDT_CONTROL); | ||
261 | ctrl &= ~ADX_WDT_CONTROL_ENABLE; | ||
262 | ctrl &= ~ADX_WDT_CONTROL_nRESET; | ||
263 | writel(ctrl, wdt->base + ADX_WDT_CONTROL); | ||
264 | |||
265 | platform_set_drvdata(pdev, wdt); | ||
266 | adx_wdt_dev = pdev; | ||
267 | |||
268 | ret = misc_register(&adx_wdt_miscdev); | ||
269 | if (ret) { | ||
270 | dev_err(&pdev->dev, "cannot register miscdev on minor %d " | ||
271 | "(err=%d)\n", WATCHDOG_MINOR, ret); | ||
272 | return ret; | ||
273 | } | ||
274 | |||
275 | return 0; | ||
276 | } | ||
277 | |||
278 | static int __devexit adx_wdt_remove(struct platform_device *pdev) | ||
279 | { | ||
280 | struct adx_wdt *wdt = platform_get_drvdata(pdev); | ||
281 | |||
282 | misc_deregister(&adx_wdt_miscdev); | ||
283 | adx_wdt_stop(wdt); | ||
284 | platform_set_drvdata(pdev, NULL); | ||
285 | |||
286 | return 0; | ||
287 | } | ||
288 | |||
289 | static void adx_wdt_shutdown(struct platform_device *pdev) | ||
290 | { | ||
291 | struct adx_wdt *wdt = platform_get_drvdata(pdev); | ||
292 | adx_wdt_stop(wdt); | ||
293 | } | ||
294 | |||
295 | #ifdef CONFIG_PM | ||
296 | static int adx_wdt_suspend(struct device *dev) | ||
297 | { | ||
298 | struct platform_device *pdev = to_platform_device(dev); | ||
299 | struct adx_wdt *wdt = platform_get_drvdata(pdev); | ||
300 | |||
301 | wdt->wake = (wdt->state == WDT_STATE_START) ? 1 : 0; | ||
302 | adx_wdt_stop(wdt); | ||
303 | |||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | static int adx_wdt_resume(struct device *dev) | ||
308 | { | ||
309 | struct platform_device *pdev = to_platform_device(dev); | ||
310 | struct adx_wdt *wdt = platform_get_drvdata(pdev); | ||
311 | |||
312 | if (wdt->wake) | ||
313 | adx_wdt_start(wdt); | ||
314 | |||
315 | return 0; | ||
316 | } | ||
317 | |||
318 | static const struct dev_pm_ops adx_wdt_pm_ops = { | ||
319 | .suspend = adx_wdt_suspend, | ||
320 | .resume = adx_wdt_resume, | ||
321 | }; | ||
322 | |||
323 | # define ADX_WDT_PM_OPS (&adx_wdt_pm_ops) | ||
324 | #else | ||
325 | # define ADX_WDT_PM_OPS NULL | ||
326 | #endif | ||
327 | |||
328 | static struct platform_driver adx_wdt_driver = { | ||
329 | .probe = adx_wdt_probe, | ||
330 | .remove = __devexit_p(adx_wdt_remove), | ||
331 | .shutdown = adx_wdt_shutdown, | ||
332 | .driver = { | ||
333 | .name = WATCHDOG_NAME, | ||
334 | .owner = THIS_MODULE, | ||
335 | .pm = ADX_WDT_PM_OPS, | ||
336 | }, | ||
337 | }; | ||
338 | |||
339 | static int __init adx_wdt_init(void) | ||
340 | { | ||
341 | return platform_driver_register(&adx_wdt_driver); | ||
342 | } | ||
343 | |||
344 | static void __exit adx_wdt_exit(void) | ||
345 | { | ||
346 | platform_driver_unregister(&adx_wdt_driver); | ||
347 | } | ||
348 | |||
349 | module_init(adx_wdt_init); | ||
350 | module_exit(adx_wdt_exit); | ||
351 | |||
352 | MODULE_DESCRIPTION("Avionic Design Xanthos Watchdog Driver"); | ||
353 | MODULE_LICENSE("GPL v2"); | ||
354 | MODULE_AUTHOR("Thierry Reding <thierry.reding@avionic-design.de>"); | ||
355 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 5de7e4fa5b8a..a79e3840782a 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c | |||
@@ -401,8 +401,8 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev) | |||
401 | 401 | ||
402 | dev_info(dev, "watchdog %sactive, reset %sabled, irq %sabled\n", | 402 | dev_info(dev, "watchdog %sactive, reset %sabled, irq %sabled\n", |
403 | (wtcon & S3C2410_WTCON_ENABLE) ? "" : "in", | 403 | (wtcon & S3C2410_WTCON_ENABLE) ? "" : "in", |
404 | (wtcon & S3C2410_WTCON_RSTEN) ? "" : "dis", | 404 | (wtcon & S3C2410_WTCON_RSTEN) ? "en" : "dis", |
405 | (wtcon & S3C2410_WTCON_INTEN) ? "" : "en"); | 405 | (wtcon & S3C2410_WTCON_INTEN) ? "en" : "dis"); |
406 | 406 | ||
407 | return 0; | 407 | return 0; |
408 | 408 | ||
diff --git a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c index 7be38556aed0..e789a47db41f 100644 --- a/drivers/watchdog/wm831x_wdt.c +++ b/drivers/watchdog/wm831x_wdt.c | |||
@@ -150,7 +150,7 @@ static int wm831x_wdt_set_timeout(struct watchdog_device *wdt_dev, | |||
150 | if (wm831x_wdt_cfgs[i].time == timeout) | 150 | if (wm831x_wdt_cfgs[i].time == timeout) |
151 | break; | 151 | break; |
152 | if (i == ARRAY_SIZE(wm831x_wdt_cfgs)) | 152 | if (i == ARRAY_SIZE(wm831x_wdt_cfgs)) |
153 | ret = -EINVAL; | 153 | return -EINVAL; |
154 | 154 | ||
155 | ret = wm831x_reg_unlock(wm831x); | 155 | ret = wm831x_reg_unlock(wm831x); |
156 | if (ret == 0) { | 156 | if (ret == 0) { |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index a767884a6c7a..31ab82fda38a 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -501,7 +501,7 @@ EXPORT_SYMBOL_GPL(balloon_set_new_target); | |||
501 | * alloc_xenballooned_pages - get pages that have been ballooned out | 501 | * alloc_xenballooned_pages - get pages that have been ballooned out |
502 | * @nr_pages: Number of pages to get | 502 | * @nr_pages: Number of pages to get |
503 | * @pages: pages returned | 503 | * @pages: pages returned |
504 | * @highmem: highmem or lowmem pages | 504 | * @highmem: allow highmem pages |
505 | * @return 0 on success, error otherwise | 505 | * @return 0 on success, error otherwise |
506 | */ | 506 | */ |
507 | int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem) | 507 | int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem) |
@@ -511,7 +511,7 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem) | |||
511 | mutex_lock(&balloon_mutex); | 511 | mutex_lock(&balloon_mutex); |
512 | while (pgno < nr_pages) { | 512 | while (pgno < nr_pages) { |
513 | page = balloon_retrieve(highmem); | 513 | page = balloon_retrieve(highmem); |
514 | if (page && PageHighMem(page) == highmem) { | 514 | if (page && (highmem || !PageHighMem(page))) { |
515 | pages[pgno++] = page; | 515 | pages[pgno++] = page; |
516 | } else { | 516 | } else { |
517 | enum bp_state st; | 517 | enum bp_state st; |
diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c index e8ea56583b4c..e2400c8963fa 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c | |||
@@ -141,7 +141,7 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op, | |||
141 | /* Grant foreign access to the page. */ | 141 | /* Grant foreign access to the page. */ |
142 | gref->gref_id = gnttab_grant_foreign_access(op->domid, | 142 | gref->gref_id = gnttab_grant_foreign_access(op->domid, |
143 | pfn_to_mfn(page_to_pfn(gref->page)), readonly); | 143 | pfn_to_mfn(page_to_pfn(gref->page)), readonly); |
144 | if (gref->gref_id < 0) { | 144 | if ((int)gref->gref_id < 0) { |
145 | rc = gref->gref_id; | 145 | rc = gref->gref_id; |
146 | goto undo; | 146 | goto undo; |
147 | } | 147 | } |
@@ -290,7 +290,7 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv, | |||
290 | goto out; | 290 | goto out; |
291 | } | 291 | } |
292 | 292 | ||
293 | gref_ids = kzalloc(sizeof(gref_ids[0]) * op.count, GFP_TEMPORARY); | 293 | gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_TEMPORARY); |
294 | if (!gref_ids) { | 294 | if (!gref_ids) { |
295 | rc = -ENOMEM; | 295 | rc = -ENOMEM; |
296 | goto out; | 296 | goto out; |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index a7308559a26a..f52f661f8f82 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -114,11 +114,11 @@ static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) | |||
114 | if (NULL == add) | 114 | if (NULL == add) |
115 | return NULL; | 115 | return NULL; |
116 | 116 | ||
117 | add->grants = kzalloc(sizeof(add->grants[0]) * count, GFP_KERNEL); | 117 | add->grants = kcalloc(count, sizeof(add->grants[0]), GFP_KERNEL); |
118 | add->map_ops = kzalloc(sizeof(add->map_ops[0]) * count, GFP_KERNEL); | 118 | add->map_ops = kcalloc(count, sizeof(add->map_ops[0]), GFP_KERNEL); |
119 | add->unmap_ops = kzalloc(sizeof(add->unmap_ops[0]) * count, GFP_KERNEL); | 119 | add->unmap_ops = kcalloc(count, sizeof(add->unmap_ops[0]), GFP_KERNEL); |
120 | add->kmap_ops = kzalloc(sizeof(add->kmap_ops[0]) * count, GFP_KERNEL); | 120 | add->kmap_ops = kcalloc(count, sizeof(add->kmap_ops[0]), GFP_KERNEL); |
121 | add->pages = kzalloc(sizeof(add->pages[0]) * count, GFP_KERNEL); | 121 | add->pages = kcalloc(count, sizeof(add->pages[0]), GFP_KERNEL); |
122 | if (NULL == add->grants || | 122 | if (NULL == add->grants || |
123 | NULL == add->map_ops || | 123 | NULL == add->map_ops || |
124 | NULL == add->unmap_ops || | 124 | NULL == add->unmap_ops || |
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c index 81c3ce6b8bbe..1906125eab49 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/vmalloc.h> | 35 | #include <linux/vmalloc.h> |
36 | #include <linux/export.h> | 36 | #include <linux/export.h> |
37 | #include <asm/xen/hypervisor.h> | 37 | #include <asm/xen/hypervisor.h> |
38 | #include <asm/xen/page.h> | ||
38 | #include <xen/interface/xen.h> | 39 | #include <xen/interface/xen.h> |
39 | #include <xen/interface/event_channel.h> | 40 | #include <xen/interface/event_channel.h> |
40 | #include <xen/events.h> | 41 | #include <xen/events.h> |
@@ -436,19 +437,20 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn); | |||
436 | int xenbus_map_ring_valloc(struct xenbus_device *dev, int gnt_ref, void **vaddr) | 437 | int xenbus_map_ring_valloc(struct xenbus_device *dev, int gnt_ref, void **vaddr) |
437 | { | 438 | { |
438 | struct gnttab_map_grant_ref op = { | 439 | struct gnttab_map_grant_ref op = { |
439 | .flags = GNTMAP_host_map, | 440 | .flags = GNTMAP_host_map | GNTMAP_contains_pte, |
440 | .ref = gnt_ref, | 441 | .ref = gnt_ref, |
441 | .dom = dev->otherend_id, | 442 | .dom = dev->otherend_id, |
442 | }; | 443 | }; |
443 | struct vm_struct *area; | 444 | struct vm_struct *area; |
445 | pte_t *pte; | ||
444 | 446 | ||
445 | *vaddr = NULL; | 447 | *vaddr = NULL; |
446 | 448 | ||
447 | area = alloc_vm_area(PAGE_SIZE); | 449 | area = alloc_vm_area(PAGE_SIZE, &pte); |
448 | if (!area) | 450 | if (!area) |
449 | return -ENOMEM; | 451 | return -ENOMEM; |
450 | 452 | ||
451 | op.host_addr = (unsigned long)area->addr; | 453 | op.host_addr = arbitrary_virt_to_machine(pte).maddr; |
452 | 454 | ||
453 | if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1)) | 455 | if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1)) |
454 | BUG(); | 456 | BUG(); |
@@ -527,6 +529,7 @@ int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr) | |||
527 | struct gnttab_unmap_grant_ref op = { | 529 | struct gnttab_unmap_grant_ref op = { |
528 | .host_addr = (unsigned long)vaddr, | 530 | .host_addr = (unsigned long)vaddr, |
529 | }; | 531 | }; |
532 | unsigned int level; | ||
530 | 533 | ||
531 | /* It'd be nice if linux/vmalloc.h provided a find_vm_area(void *addr) | 534 | /* It'd be nice if linux/vmalloc.h provided a find_vm_area(void *addr) |
532 | * method so that we don't have to muck with vmalloc internals here. | 535 | * method so that we don't have to muck with vmalloc internals here. |
@@ -548,6 +551,8 @@ int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr) | |||
548 | } | 551 | } |
549 | 552 | ||
550 | op.handle = (grant_handle_t)area->phys_addr; | 553 | op.handle = (grant_handle_t)area->phys_addr; |
554 | op.host_addr = arbitrary_virt_to_machine( | ||
555 | lookup_address((unsigned long)vaddr, &level)).maddr; | ||
551 | 556 | ||
552 | if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1)) | 557 | if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1)) |
553 | BUG(); | 558 | BUG(); |
@@ -337,7 +337,7 @@ static void bio_fs_destructor(struct bio *bio) | |||
337 | * RETURNS: | 337 | * RETURNS: |
338 | * Pointer to new bio on success, NULL on failure. | 338 | * Pointer to new bio on success, NULL on failure. |
339 | */ | 339 | */ |
340 | struct bio *bio_alloc(gfp_t gfp_mask, int nr_iovecs) | 340 | struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) |
341 | { | 341 | { |
342 | struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); | 342 | struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); |
343 | 343 | ||
@@ -365,7 +365,7 @@ static void bio_kmalloc_destructor(struct bio *bio) | |||
365 | * %__GFP_WAIT, the allocation is guaranteed to succeed. | 365 | * %__GFP_WAIT, the allocation is guaranteed to succeed. |
366 | * | 366 | * |
367 | **/ | 367 | **/ |
368 | struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs) | 368 | struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs) |
369 | { | 369 | { |
370 | struct bio *bio; | 370 | struct bio *bio; |
371 | 371 | ||
@@ -696,7 +696,8 @@ static void bio_free_map_data(struct bio_map_data *bmd) | |||
696 | kfree(bmd); | 696 | kfree(bmd); |
697 | } | 697 | } |
698 | 698 | ||
699 | static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count, | 699 | static struct bio_map_data *bio_alloc_map_data(int nr_segs, |
700 | unsigned int iov_count, | ||
700 | gfp_t gfp_mask) | 701 | gfp_t gfp_mask) |
701 | { | 702 | { |
702 | struct bio_map_data *bmd; | 703 | struct bio_map_data *bmd; |
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 8855aad3929c..22c64fff1bd5 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -683,7 +683,7 @@ static int inode_to_path(u64 inum, struct btrfs_inode_ref *iref, | |||
683 | return PTR_ERR(fspath); | 683 | return PTR_ERR(fspath); |
684 | 684 | ||
685 | if (fspath > fspath_min) { | 685 | if (fspath > fspath_min) { |
686 | ipath->fspath->val[i] = (u64)fspath; | 686 | ipath->fspath->val[i] = (u64)(unsigned long)fspath; |
687 | ++ipath->fspath->elem_cnt; | 687 | ++ipath->fspath->elem_cnt; |
688 | ipath->fspath->bytes_left = fspath - fspath_min; | 688 | ipath->fspath->bytes_left = fspath - fspath_min; |
689 | } else { | 689 | } else { |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 0fe615e4ea38..dede441bdeee 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -514,10 +514,25 @@ static inline int should_cow_block(struct btrfs_trans_handle *trans, | |||
514 | struct btrfs_root *root, | 514 | struct btrfs_root *root, |
515 | struct extent_buffer *buf) | 515 | struct extent_buffer *buf) |
516 | { | 516 | { |
517 | /* ensure we can see the force_cow */ | ||
518 | smp_rmb(); | ||
519 | |||
520 | /* | ||
521 | * We do not need to cow a block if | ||
522 | * 1) this block is not created or changed in this transaction; | ||
523 | * 2) this block does not belong to TREE_RELOC tree; | ||
524 | * 3) the root is not forced COW. | ||
525 | * | ||
526 | * What is forced COW: | ||
527 | * when we create snapshot during commiting the transaction, | ||
528 | * after we've finished coping src root, we must COW the shared | ||
529 | * block to ensure the metadata consistency. | ||
530 | */ | ||
517 | if (btrfs_header_generation(buf) == trans->transid && | 531 | if (btrfs_header_generation(buf) == trans->transid && |
518 | !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN) && | 532 | !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN) && |
519 | !(root->root_key.objectid != BTRFS_TREE_RELOC_OBJECTID && | 533 | !(root->root_key.objectid != BTRFS_TREE_RELOC_OBJECTID && |
520 | btrfs_header_flag(buf, BTRFS_HEADER_FLAG_RELOC))) | 534 | btrfs_header_flag(buf, BTRFS_HEADER_FLAG_RELOC)) && |
535 | !root->force_cow) | ||
521 | return 0; | 536 | return 0; |
522 | return 1; | 537 | return 1; |
523 | } | 538 | } |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index b9ba59ff9292..04a5dfcee5a1 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -848,7 +848,8 @@ struct btrfs_free_cluster { | |||
848 | enum btrfs_caching_type { | 848 | enum btrfs_caching_type { |
849 | BTRFS_CACHE_NO = 0, | 849 | BTRFS_CACHE_NO = 0, |
850 | BTRFS_CACHE_STARTED = 1, | 850 | BTRFS_CACHE_STARTED = 1, |
851 | BTRFS_CACHE_FINISHED = 2, | 851 | BTRFS_CACHE_FAST = 2, |
852 | BTRFS_CACHE_FINISHED = 3, | ||
852 | }; | 853 | }; |
853 | 854 | ||
854 | enum btrfs_disk_cache_state { | 855 | enum btrfs_disk_cache_state { |
@@ -1271,6 +1272,8 @@ struct btrfs_root { | |||
1271 | * for stat. It may be used for more later | 1272 | * for stat. It may be used for more later |
1272 | */ | 1273 | */ |
1273 | dev_t anon_dev; | 1274 | dev_t anon_dev; |
1275 | |||
1276 | int force_cow; | ||
1274 | }; | 1277 | }; |
1275 | 1278 | ||
1276 | struct btrfs_ioctl_defrag_range_args { | 1279 | struct btrfs_ioctl_defrag_range_args { |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 62afe5c5694e..632f8f3cc9db 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -620,7 +620,7 @@ out: | |||
620 | 620 | ||
621 | static int btree_io_failed_hook(struct bio *failed_bio, | 621 | static int btree_io_failed_hook(struct bio *failed_bio, |
622 | struct page *page, u64 start, u64 end, | 622 | struct page *page, u64 start, u64 end, |
623 | u64 mirror_num, struct extent_state *state) | 623 | int mirror_num, struct extent_state *state) |
624 | { | 624 | { |
625 | struct extent_io_tree *tree; | 625 | struct extent_io_tree *tree; |
626 | unsigned long len; | 626 | unsigned long len; |
@@ -2573,22 +2573,10 @@ static int write_dev_supers(struct btrfs_device *device, | |||
2573 | int errors = 0; | 2573 | int errors = 0; |
2574 | u32 crc; | 2574 | u32 crc; |
2575 | u64 bytenr; | 2575 | u64 bytenr; |
2576 | int last_barrier = 0; | ||
2577 | 2576 | ||
2578 | if (max_mirrors == 0) | 2577 | if (max_mirrors == 0) |
2579 | max_mirrors = BTRFS_SUPER_MIRROR_MAX; | 2578 | max_mirrors = BTRFS_SUPER_MIRROR_MAX; |
2580 | 2579 | ||
2581 | /* make sure only the last submit_bh does a barrier */ | ||
2582 | if (do_barriers) { | ||
2583 | for (i = 0; i < max_mirrors; i++) { | ||
2584 | bytenr = btrfs_sb_offset(i); | ||
2585 | if (bytenr + BTRFS_SUPER_INFO_SIZE >= | ||
2586 | device->total_bytes) | ||
2587 | break; | ||
2588 | last_barrier = i; | ||
2589 | } | ||
2590 | } | ||
2591 | |||
2592 | for (i = 0; i < max_mirrors; i++) { | 2580 | for (i = 0; i < max_mirrors; i++) { |
2593 | bytenr = btrfs_sb_offset(i); | 2581 | bytenr = btrfs_sb_offset(i); |
2594 | if (bytenr + BTRFS_SUPER_INFO_SIZE >= device->total_bytes) | 2582 | if (bytenr + BTRFS_SUPER_INFO_SIZE >= device->total_bytes) |
@@ -2634,17 +2622,136 @@ static int write_dev_supers(struct btrfs_device *device, | |||
2634 | bh->b_end_io = btrfs_end_buffer_write_sync; | 2622 | bh->b_end_io = btrfs_end_buffer_write_sync; |
2635 | } | 2623 | } |
2636 | 2624 | ||
2637 | if (i == last_barrier && do_barriers) | 2625 | /* |
2638 | ret = submit_bh(WRITE_FLUSH_FUA, bh); | 2626 | * we fua the first super. The others we allow |
2639 | else | 2627 | * to go down lazy. |
2640 | ret = submit_bh(WRITE_SYNC, bh); | 2628 | */ |
2641 | 2629 | ret = submit_bh(WRITE_FUA, bh); | |
2642 | if (ret) | 2630 | if (ret) |
2643 | errors++; | 2631 | errors++; |
2644 | } | 2632 | } |
2645 | return errors < i ? 0 : -1; | 2633 | return errors < i ? 0 : -1; |
2646 | } | 2634 | } |
2647 | 2635 | ||
2636 | /* | ||
2637 | * endio for the write_dev_flush, this will wake anyone waiting | ||
2638 | * for the barrier when it is done | ||
2639 | */ | ||
2640 | static void btrfs_end_empty_barrier(struct bio *bio, int err) | ||
2641 | { | ||
2642 | if (err) { | ||
2643 | if (err == -EOPNOTSUPP) | ||
2644 | set_bit(BIO_EOPNOTSUPP, &bio->bi_flags); | ||
2645 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | ||
2646 | } | ||
2647 | if (bio->bi_private) | ||
2648 | complete(bio->bi_private); | ||
2649 | bio_put(bio); | ||
2650 | } | ||
2651 | |||
2652 | /* | ||
2653 | * trigger flushes for one the devices. If you pass wait == 0, the flushes are | ||
2654 | * sent down. With wait == 1, it waits for the previous flush. | ||
2655 | * | ||
2656 | * any device where the flush fails with eopnotsupp are flagged as not-barrier | ||
2657 | * capable | ||
2658 | */ | ||
2659 | static int write_dev_flush(struct btrfs_device *device, int wait) | ||
2660 | { | ||
2661 | struct bio *bio; | ||
2662 | int ret = 0; | ||
2663 | |||
2664 | if (device->nobarriers) | ||
2665 | return 0; | ||
2666 | |||
2667 | if (wait) { | ||
2668 | bio = device->flush_bio; | ||
2669 | if (!bio) | ||
2670 | return 0; | ||
2671 | |||
2672 | wait_for_completion(&device->flush_wait); | ||
2673 | |||
2674 | if (bio_flagged(bio, BIO_EOPNOTSUPP)) { | ||
2675 | printk("btrfs: disabling barriers on dev %s\n", | ||
2676 | device->name); | ||
2677 | device->nobarriers = 1; | ||
2678 | } | ||
2679 | if (!bio_flagged(bio, BIO_UPTODATE)) { | ||
2680 | ret = -EIO; | ||
2681 | } | ||
2682 | |||
2683 | /* drop the reference from the wait == 0 run */ | ||
2684 | bio_put(bio); | ||
2685 | device->flush_bio = NULL; | ||
2686 | |||
2687 | return ret; | ||
2688 | } | ||
2689 | |||
2690 | /* | ||
2691 | * one reference for us, and we leave it for the | ||
2692 | * caller | ||
2693 | */ | ||
2694 | device->flush_bio = NULL;; | ||
2695 | bio = bio_alloc(GFP_NOFS, 0); | ||
2696 | if (!bio) | ||
2697 | return -ENOMEM; | ||
2698 | |||
2699 | bio->bi_end_io = btrfs_end_empty_barrier; | ||
2700 | bio->bi_bdev = device->bdev; | ||
2701 | init_completion(&device->flush_wait); | ||
2702 | bio->bi_private = &device->flush_wait; | ||
2703 | device->flush_bio = bio; | ||
2704 | |||
2705 | bio_get(bio); | ||
2706 | submit_bio(WRITE_FLUSH, bio); | ||
2707 | |||
2708 | return 0; | ||
2709 | } | ||
2710 | |||
2711 | /* | ||
2712 | * send an empty flush down to each device in parallel, | ||
2713 | * then wait for them | ||
2714 | */ | ||
2715 | static int barrier_all_devices(struct btrfs_fs_info *info) | ||
2716 | { | ||
2717 | struct list_head *head; | ||
2718 | struct btrfs_device *dev; | ||
2719 | int errors = 0; | ||
2720 | int ret; | ||
2721 | |||
2722 | /* send down all the barriers */ | ||
2723 | head = &info->fs_devices->devices; | ||
2724 | list_for_each_entry_rcu(dev, head, dev_list) { | ||
2725 | if (!dev->bdev) { | ||
2726 | errors++; | ||
2727 | continue; | ||
2728 | } | ||
2729 | if (!dev->in_fs_metadata || !dev->writeable) | ||
2730 | continue; | ||
2731 | |||
2732 | ret = write_dev_flush(dev, 0); | ||
2733 | if (ret) | ||
2734 | errors++; | ||
2735 | } | ||
2736 | |||
2737 | /* wait for all the barriers */ | ||
2738 | list_for_each_entry_rcu(dev, head, dev_list) { | ||
2739 | if (!dev->bdev) { | ||
2740 | errors++; | ||
2741 | continue; | ||
2742 | } | ||
2743 | if (!dev->in_fs_metadata || !dev->writeable) | ||
2744 | continue; | ||
2745 | |||
2746 | ret = write_dev_flush(dev, 1); | ||
2747 | if (ret) | ||
2748 | errors++; | ||
2749 | } | ||
2750 | if (errors) | ||
2751 | return -EIO; | ||
2752 | return 0; | ||
2753 | } | ||
2754 | |||
2648 | int write_all_supers(struct btrfs_root *root, int max_mirrors) | 2755 | int write_all_supers(struct btrfs_root *root, int max_mirrors) |
2649 | { | 2756 | { |
2650 | struct list_head *head; | 2757 | struct list_head *head; |
@@ -2666,6 +2773,10 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
2666 | 2773 | ||
2667 | mutex_lock(&root->fs_info->fs_devices->device_list_mutex); | 2774 | mutex_lock(&root->fs_info->fs_devices->device_list_mutex); |
2668 | head = &root->fs_info->fs_devices->devices; | 2775 | head = &root->fs_info->fs_devices->devices; |
2776 | |||
2777 | if (do_barriers) | ||
2778 | barrier_all_devices(root->fs_info); | ||
2779 | |||
2669 | list_for_each_entry_rcu(dev, head, dev_list) { | 2780 | list_for_each_entry_rcu(dev, head, dev_list) { |
2670 | if (!dev->bdev) { | 2781 | if (!dev->bdev) { |
2671 | total_errors++; | 2782 | total_errors++; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index b232150b5b6b..930ae8949737 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -467,13 +467,59 @@ static int cache_block_group(struct btrfs_block_group_cache *cache, | |||
467 | struct btrfs_root *root, | 467 | struct btrfs_root *root, |
468 | int load_cache_only) | 468 | int load_cache_only) |
469 | { | 469 | { |
470 | DEFINE_WAIT(wait); | ||
470 | struct btrfs_fs_info *fs_info = cache->fs_info; | 471 | struct btrfs_fs_info *fs_info = cache->fs_info; |
471 | struct btrfs_caching_control *caching_ctl; | 472 | struct btrfs_caching_control *caching_ctl; |
472 | int ret = 0; | 473 | int ret = 0; |
473 | 474 | ||
474 | smp_mb(); | 475 | caching_ctl = kzalloc(sizeof(*caching_ctl), GFP_NOFS); |
475 | if (cache->cached != BTRFS_CACHE_NO) | 476 | BUG_ON(!caching_ctl); |
477 | |||
478 | INIT_LIST_HEAD(&caching_ctl->list); | ||
479 | mutex_init(&caching_ctl->mutex); | ||
480 | init_waitqueue_head(&caching_ctl->wait); | ||
481 | caching_ctl->block_group = cache; | ||
482 | caching_ctl->progress = cache->key.objectid; | ||
483 | atomic_set(&caching_ctl->count, 1); | ||
484 | caching_ctl->work.func = caching_thread; | ||
485 | |||
486 | spin_lock(&cache->lock); | ||
487 | /* | ||
488 | * This should be a rare occasion, but this could happen I think in the | ||
489 | * case where one thread starts to load the space cache info, and then | ||
490 | * some other thread starts a transaction commit which tries to do an | ||
491 | * allocation while the other thread is still loading the space cache | ||
492 | * info. The previous loop should have kept us from choosing this block | ||
493 | * group, but if we've moved to the state where we will wait on caching | ||
494 | * block groups we need to first check if we're doing a fast load here, | ||
495 | * so we can wait for it to finish, otherwise we could end up allocating | ||
496 | * from a block group who's cache gets evicted for one reason or | ||
497 | * another. | ||
498 | */ | ||
499 | while (cache->cached == BTRFS_CACHE_FAST) { | ||
500 | struct btrfs_caching_control *ctl; | ||
501 | |||
502 | ctl = cache->caching_ctl; | ||
503 | atomic_inc(&ctl->count); | ||
504 | prepare_to_wait(&ctl->wait, &wait, TASK_UNINTERRUPTIBLE); | ||
505 | spin_unlock(&cache->lock); | ||
506 | |||
507 | schedule(); | ||
508 | |||
509 | finish_wait(&ctl->wait, &wait); | ||
510 | put_caching_control(ctl); | ||
511 | spin_lock(&cache->lock); | ||
512 | } | ||
513 | |||
514 | if (cache->cached != BTRFS_CACHE_NO) { | ||
515 | spin_unlock(&cache->lock); | ||
516 | kfree(caching_ctl); | ||
476 | return 0; | 517 | return 0; |
518 | } | ||
519 | WARN_ON(cache->caching_ctl); | ||
520 | cache->caching_ctl = caching_ctl; | ||
521 | cache->cached = BTRFS_CACHE_FAST; | ||
522 | spin_unlock(&cache->lock); | ||
477 | 523 | ||
478 | /* | 524 | /* |
479 | * We can't do the read from on-disk cache during a commit since we need | 525 | * We can't do the read from on-disk cache during a commit since we need |
@@ -484,56 +530,51 @@ static int cache_block_group(struct btrfs_block_group_cache *cache, | |||
484 | if (trans && (!trans->transaction->in_commit) && | 530 | if (trans && (!trans->transaction->in_commit) && |
485 | (root && root != root->fs_info->tree_root) && | 531 | (root && root != root->fs_info->tree_root) && |
486 | btrfs_test_opt(root, SPACE_CACHE)) { | 532 | btrfs_test_opt(root, SPACE_CACHE)) { |
487 | spin_lock(&cache->lock); | ||
488 | if (cache->cached != BTRFS_CACHE_NO) { | ||
489 | spin_unlock(&cache->lock); | ||
490 | return 0; | ||
491 | } | ||
492 | cache->cached = BTRFS_CACHE_STARTED; | ||
493 | spin_unlock(&cache->lock); | ||
494 | |||
495 | ret = load_free_space_cache(fs_info, cache); | 533 | ret = load_free_space_cache(fs_info, cache); |
496 | 534 | ||
497 | spin_lock(&cache->lock); | 535 | spin_lock(&cache->lock); |
498 | if (ret == 1) { | 536 | if (ret == 1) { |
537 | cache->caching_ctl = NULL; | ||
499 | cache->cached = BTRFS_CACHE_FINISHED; | 538 | cache->cached = BTRFS_CACHE_FINISHED; |
500 | cache->last_byte_to_unpin = (u64)-1; | 539 | cache->last_byte_to_unpin = (u64)-1; |
501 | } else { | 540 | } else { |
502 | cache->cached = BTRFS_CACHE_NO; | 541 | if (load_cache_only) { |
542 | cache->caching_ctl = NULL; | ||
543 | cache->cached = BTRFS_CACHE_NO; | ||
544 | } else { | ||
545 | cache->cached = BTRFS_CACHE_STARTED; | ||
546 | } | ||
503 | } | 547 | } |
504 | spin_unlock(&cache->lock); | 548 | spin_unlock(&cache->lock); |
549 | wake_up(&caching_ctl->wait); | ||
505 | if (ret == 1) { | 550 | if (ret == 1) { |
551 | put_caching_control(caching_ctl); | ||
506 | free_excluded_extents(fs_info->extent_root, cache); | 552 | free_excluded_extents(fs_info->extent_root, cache); |
507 | return 0; | 553 | return 0; |
508 | } | 554 | } |
555 | } else { | ||
556 | /* | ||
557 | * We are not going to do the fast caching, set cached to the | ||
558 | * appropriate value and wakeup any waiters. | ||
559 | */ | ||
560 | spin_lock(&cache->lock); | ||
561 | if (load_cache_only) { | ||
562 | cache->caching_ctl = NULL; | ||
563 | cache->cached = BTRFS_CACHE_NO; | ||
564 | } else { | ||
565 | cache->cached = BTRFS_CACHE_STARTED; | ||
566 | } | ||
567 | spin_unlock(&cache->lock); | ||
568 | wake_up(&caching_ctl->wait); | ||
509 | } | 569 | } |
510 | 570 | ||
511 | if (load_cache_only) | 571 | if (load_cache_only) { |
512 | return 0; | 572 | put_caching_control(caching_ctl); |
513 | |||
514 | caching_ctl = kzalloc(sizeof(*caching_ctl), GFP_NOFS); | ||
515 | BUG_ON(!caching_ctl); | ||
516 | |||
517 | INIT_LIST_HEAD(&caching_ctl->list); | ||
518 | mutex_init(&caching_ctl->mutex); | ||
519 | init_waitqueue_head(&caching_ctl->wait); | ||
520 | caching_ctl->block_group = cache; | ||
521 | caching_ctl->progress = cache->key.objectid; | ||
522 | /* one for caching kthread, one for caching block group list */ | ||
523 | atomic_set(&caching_ctl->count, 2); | ||
524 | caching_ctl->work.func = caching_thread; | ||
525 | |||
526 | spin_lock(&cache->lock); | ||
527 | if (cache->cached != BTRFS_CACHE_NO) { | ||
528 | spin_unlock(&cache->lock); | ||
529 | kfree(caching_ctl); | ||
530 | return 0; | 573 | return 0; |
531 | } | 574 | } |
532 | cache->caching_ctl = caching_ctl; | ||
533 | cache->cached = BTRFS_CACHE_STARTED; | ||
534 | spin_unlock(&cache->lock); | ||
535 | 575 | ||
536 | down_write(&fs_info->extent_commit_sem); | 576 | down_write(&fs_info->extent_commit_sem); |
577 | atomic_inc(&caching_ctl->count); | ||
537 | list_add_tail(&caching_ctl->list, &fs_info->caching_block_groups); | 578 | list_add_tail(&caching_ctl->list, &fs_info->caching_block_groups); |
538 | up_write(&fs_info->extent_commit_sem); | 579 | up_write(&fs_info->extent_commit_sem); |
539 | 580 | ||
@@ -5178,13 +5219,15 @@ search: | |||
5178 | } | 5219 | } |
5179 | 5220 | ||
5180 | have_block_group: | 5221 | have_block_group: |
5181 | if (unlikely(block_group->cached == BTRFS_CACHE_NO)) { | 5222 | cached = block_group_cache_done(block_group); |
5223 | if (unlikely(!cached)) { | ||
5182 | u64 free_percent; | 5224 | u64 free_percent; |
5183 | 5225 | ||
5226 | found_uncached_bg = true; | ||
5184 | ret = cache_block_group(block_group, trans, | 5227 | ret = cache_block_group(block_group, trans, |
5185 | orig_root, 1); | 5228 | orig_root, 1); |
5186 | if (block_group->cached == BTRFS_CACHE_FINISHED) | 5229 | if (block_group->cached == BTRFS_CACHE_FINISHED) |
5187 | goto have_block_group; | 5230 | goto alloc; |
5188 | 5231 | ||
5189 | free_percent = btrfs_block_group_used(&block_group->item); | 5232 | free_percent = btrfs_block_group_used(&block_group->item); |
5190 | free_percent *= 100; | 5233 | free_percent *= 100; |
@@ -5206,7 +5249,6 @@ have_block_group: | |||
5206 | orig_root, 0); | 5249 | orig_root, 0); |
5207 | BUG_ON(ret); | 5250 | BUG_ON(ret); |
5208 | } | 5251 | } |
5209 | found_uncached_bg = true; | ||
5210 | 5252 | ||
5211 | /* | 5253 | /* |
5212 | * If loop is set for cached only, try the next block | 5254 | * If loop is set for cached only, try the next block |
@@ -5216,10 +5258,7 @@ have_block_group: | |||
5216 | goto loop; | 5258 | goto loop; |
5217 | } | 5259 | } |
5218 | 5260 | ||
5219 | cached = block_group_cache_done(block_group); | 5261 | alloc: |
5220 | if (unlikely(!cached)) | ||
5221 | found_uncached_bg = true; | ||
5222 | |||
5223 | if (unlikely(block_group->ro)) | 5262 | if (unlikely(block_group->ro)) |
5224 | goto loop; | 5263 | goto loop; |
5225 | 5264 | ||
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 1f87c4d0e7a0..9472d3de5e52 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2285,8 +2285,8 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
2285 | clean_io_failure(start, page); | 2285 | clean_io_failure(start, page); |
2286 | } | 2286 | } |
2287 | if (!uptodate) { | 2287 | if (!uptodate) { |
2288 | u64 failed_mirror; | 2288 | int failed_mirror; |
2289 | failed_mirror = (u64)bio->bi_bdev; | 2289 | failed_mirror = (int)(unsigned long)bio->bi_bdev; |
2290 | if (tree->ops && tree->ops->readpage_io_failed_hook) | 2290 | if (tree->ops && tree->ops->readpage_io_failed_hook) |
2291 | ret = tree->ops->readpage_io_failed_hook( | 2291 | ret = tree->ops->readpage_io_failed_hook( |
2292 | bio, page, start, end, | 2292 | bio, page, start, end, |
@@ -3366,6 +3366,9 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
3366 | return -ENOMEM; | 3366 | return -ENOMEM; |
3367 | path->leave_spinning = 1; | 3367 | path->leave_spinning = 1; |
3368 | 3368 | ||
3369 | start = ALIGN(start, BTRFS_I(inode)->root->sectorsize); | ||
3370 | len = ALIGN(len, BTRFS_I(inode)->root->sectorsize); | ||
3371 | |||
3369 | /* | 3372 | /* |
3370 | * lookup the last file extent. We're not using i_size here | 3373 | * lookup the last file extent. We're not using i_size here |
3371 | * because there might be preallocation past i_size | 3374 | * because there might be preallocation past i_size |
@@ -3413,7 +3416,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
3413 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, | 3416 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, |
3414 | &cached_state, GFP_NOFS); | 3417 | &cached_state, GFP_NOFS); |
3415 | 3418 | ||
3416 | em = get_extent_skip_holes(inode, off, last_for_get_extent, | 3419 | em = get_extent_skip_holes(inode, start, last_for_get_extent, |
3417 | get_extent); | 3420 | get_extent); |
3418 | if (!em) | 3421 | if (!em) |
3419 | goto out; | 3422 | goto out; |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index feb9be0e23bc..7604c3001322 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -70,7 +70,7 @@ struct extent_io_ops { | |||
70 | unsigned long bio_flags); | 70 | unsigned long bio_flags); |
71 | int (*readpage_io_hook)(struct page *page, u64 start, u64 end); | 71 | int (*readpage_io_hook)(struct page *page, u64 start, u64 end); |
72 | int (*readpage_io_failed_hook)(struct bio *bio, struct page *page, | 72 | int (*readpage_io_failed_hook)(struct bio *bio, struct page *page, |
73 | u64 start, u64 end, u64 failed_mirror, | 73 | u64 start, u64 end, int failed_mirror, |
74 | struct extent_state *state); | 74 | struct extent_state *state); |
75 | int (*writepage_io_failed_hook)(struct bio *bio, struct page *page, | 75 | int (*writepage_io_failed_hook)(struct bio *bio, struct page *page, |
76 | u64 start, u64 end, | 76 | u64 start, u64 end, |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 181760f9d2ab..6e5b7e463698 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -351,6 +351,11 @@ static int io_ctl_prepare_pages(struct io_ctl *io_ctl, struct inode *inode, | |||
351 | } | 351 | } |
352 | } | 352 | } |
353 | 353 | ||
354 | for (i = 0; i < io_ctl->num_pages; i++) { | ||
355 | clear_page_dirty_for_io(io_ctl->pages[i]); | ||
356 | set_page_extent_mapped(io_ctl->pages[i]); | ||
357 | } | ||
358 | |||
354 | return 0; | 359 | return 0; |
355 | } | 360 | } |
356 | 361 | ||
@@ -1844,7 +1849,13 @@ again: | |||
1844 | info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset), | 1849 | info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset), |
1845 | 1, 0); | 1850 | 1, 0); |
1846 | if (!info) { | 1851 | if (!info) { |
1847 | WARN_ON(1); | 1852 | /* the tree logging code might be calling us before we |
1853 | * have fully loaded the free space rbtree for this | ||
1854 | * block group. So it is possible the entry won't | ||
1855 | * be in the rbtree yet at all. The caching code | ||
1856 | * will make sure not to put it in the rbtree if | ||
1857 | * the logging code has pinned it. | ||
1858 | */ | ||
1848 | goto out_lock; | 1859 | goto out_lock; |
1849 | } | 1860 | } |
1850 | } | 1861 | } |
@@ -2451,16 +2462,23 @@ setup_cluster_bitmap(struct btrfs_block_group_cache *block_group, | |||
2451 | { | 2462 | { |
2452 | struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; | 2463 | struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; |
2453 | struct btrfs_free_space *entry; | 2464 | struct btrfs_free_space *entry; |
2454 | struct rb_node *node; | ||
2455 | int ret = -ENOSPC; | 2465 | int ret = -ENOSPC; |
2466 | u64 bitmap_offset = offset_to_bitmap(ctl, offset); | ||
2456 | 2467 | ||
2457 | if (ctl->total_bitmaps == 0) | 2468 | if (ctl->total_bitmaps == 0) |
2458 | return -ENOSPC; | 2469 | return -ENOSPC; |
2459 | 2470 | ||
2460 | /* | 2471 | /* |
2461 | * First check our cached list of bitmaps and see if there is an entry | 2472 | * The bitmap that covers offset won't be in the list unless offset |
2462 | * here that will work. | 2473 | * is just its start offset. |
2463 | */ | 2474 | */ |
2475 | entry = list_first_entry(bitmaps, struct btrfs_free_space, list); | ||
2476 | if (entry->offset != bitmap_offset) { | ||
2477 | entry = tree_search_offset(ctl, bitmap_offset, 1, 0); | ||
2478 | if (entry && list_empty(&entry->list)) | ||
2479 | list_add(&entry->list, bitmaps); | ||
2480 | } | ||
2481 | |||
2464 | list_for_each_entry(entry, bitmaps, list) { | 2482 | list_for_each_entry(entry, bitmaps, list) { |
2465 | if (entry->bytes < min_bytes) | 2483 | if (entry->bytes < min_bytes) |
2466 | continue; | 2484 | continue; |
@@ -2471,38 +2489,10 @@ setup_cluster_bitmap(struct btrfs_block_group_cache *block_group, | |||
2471 | } | 2489 | } |
2472 | 2490 | ||
2473 | /* | 2491 | /* |
2474 | * If we do have entries on our list and we are here then we didn't find | 2492 | * The bitmaps list has all the bitmaps that record free space |
2475 | * anything, so go ahead and get the next entry after the last entry in | 2493 | * starting after offset, so no more search is required. |
2476 | * this list and start the search from there. | ||
2477 | */ | 2494 | */ |
2478 | if (!list_empty(bitmaps)) { | 2495 | return -ENOSPC; |
2479 | entry = list_entry(bitmaps->prev, struct btrfs_free_space, | ||
2480 | list); | ||
2481 | node = rb_next(&entry->offset_index); | ||
2482 | if (!node) | ||
2483 | return -ENOSPC; | ||
2484 | entry = rb_entry(node, struct btrfs_free_space, offset_index); | ||
2485 | goto search; | ||
2486 | } | ||
2487 | |||
2488 | entry = tree_search_offset(ctl, offset_to_bitmap(ctl, offset), 0, 1); | ||
2489 | if (!entry) | ||
2490 | return -ENOSPC; | ||
2491 | |||
2492 | search: | ||
2493 | node = &entry->offset_index; | ||
2494 | do { | ||
2495 | entry = rb_entry(node, struct btrfs_free_space, offset_index); | ||
2496 | node = rb_next(&entry->offset_index); | ||
2497 | if (!entry->bitmap) | ||
2498 | continue; | ||
2499 | if (entry->bytes < min_bytes) | ||
2500 | continue; | ||
2501 | ret = btrfs_bitmap_cluster(block_group, entry, cluster, offset, | ||
2502 | bytes, min_bytes); | ||
2503 | } while (ret && node); | ||
2504 | |||
2505 | return ret; | ||
2506 | } | 2496 | } |
2507 | 2497 | ||
2508 | /* | 2498 | /* |
@@ -2520,8 +2510,8 @@ int btrfs_find_space_cluster(struct btrfs_trans_handle *trans, | |||
2520 | u64 offset, u64 bytes, u64 empty_size) | 2510 | u64 offset, u64 bytes, u64 empty_size) |
2521 | { | 2511 | { |
2522 | struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; | 2512 | struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; |
2523 | struct list_head bitmaps; | ||
2524 | struct btrfs_free_space *entry, *tmp; | 2513 | struct btrfs_free_space *entry, *tmp; |
2514 | LIST_HEAD(bitmaps); | ||
2525 | u64 min_bytes; | 2515 | u64 min_bytes; |
2526 | int ret; | 2516 | int ret; |
2527 | 2517 | ||
@@ -2560,7 +2550,6 @@ int btrfs_find_space_cluster(struct btrfs_trans_handle *trans, | |||
2560 | goto out; | 2550 | goto out; |
2561 | } | 2551 | } |
2562 | 2552 | ||
2563 | INIT_LIST_HEAD(&bitmaps); | ||
2564 | ret = setup_cluster_no_bitmap(block_group, cluster, &bitmaps, offset, | 2553 | ret = setup_cluster_no_bitmap(block_group, cluster, &bitmaps, offset, |
2565 | bytes, min_bytes); | 2554 | bytes, min_bytes); |
2566 | if (ret) | 2555 | if (ret) |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 116ab67a06df..526dd51a1966 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -6794,11 +6794,13 @@ static int btrfs_getattr(struct vfsmount *mnt, | |||
6794 | struct dentry *dentry, struct kstat *stat) | 6794 | struct dentry *dentry, struct kstat *stat) |
6795 | { | 6795 | { |
6796 | struct inode *inode = dentry->d_inode; | 6796 | struct inode *inode = dentry->d_inode; |
6797 | u32 blocksize = inode->i_sb->s_blocksize; | ||
6798 | |||
6797 | generic_fillattr(inode, stat); | 6799 | generic_fillattr(inode, stat); |
6798 | stat->dev = BTRFS_I(inode)->root->anon_dev; | 6800 | stat->dev = BTRFS_I(inode)->root->anon_dev; |
6799 | stat->blksize = PAGE_CACHE_SIZE; | 6801 | stat->blksize = PAGE_CACHE_SIZE; |
6800 | stat->blocks = (inode_get_bytes(inode) + | 6802 | stat->blocks = (ALIGN(inode_get_bytes(inode), blocksize) + |
6801 | BTRFS_I(inode)->delalloc_bytes) >> 9; | 6803 | ALIGN(BTRFS_I(inode)->delalloc_bytes, blocksize)) >> 9; |
6802 | return 0; | 6804 | return 0; |
6803 | } | 6805 | } |
6804 | 6806 | ||
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 4a34c472f126..a90e749ed6d2 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1216,12 +1216,12 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root, | |||
1216 | *devstr = '\0'; | 1216 | *devstr = '\0'; |
1217 | devstr = vol_args->name; | 1217 | devstr = vol_args->name; |
1218 | devid = simple_strtoull(devstr, &end, 10); | 1218 | devid = simple_strtoull(devstr, &end, 10); |
1219 | printk(KERN_INFO "resizing devid %llu\n", | 1219 | printk(KERN_INFO "btrfs: resizing devid %llu\n", |
1220 | (unsigned long long)devid); | 1220 | (unsigned long long)devid); |
1221 | } | 1221 | } |
1222 | device = btrfs_find_device(root, devid, NULL, NULL); | 1222 | device = btrfs_find_device(root, devid, NULL, NULL); |
1223 | if (!device) { | 1223 | if (!device) { |
1224 | printk(KERN_INFO "resizer unable to find device %llu\n", | 1224 | printk(KERN_INFO "btrfs: resizer unable to find device %llu\n", |
1225 | (unsigned long long)devid); | 1225 | (unsigned long long)devid); |
1226 | ret = -EINVAL; | 1226 | ret = -EINVAL; |
1227 | goto out_unlock; | 1227 | goto out_unlock; |
@@ -1267,7 +1267,7 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root, | |||
1267 | do_div(new_size, root->sectorsize); | 1267 | do_div(new_size, root->sectorsize); |
1268 | new_size *= root->sectorsize; | 1268 | new_size *= root->sectorsize; |
1269 | 1269 | ||
1270 | printk(KERN_INFO "new size for %s is %llu\n", | 1270 | printk(KERN_INFO "btrfs: new size for %s is %llu\n", |
1271 | device->name, (unsigned long long)new_size); | 1271 | device->name, (unsigned long long)new_size); |
1272 | 1272 | ||
1273 | if (new_size > old_size) { | 1273 | if (new_size > old_size) { |
@@ -2930,11 +2930,13 @@ static long btrfs_ioctl_ino_to_path(struct btrfs_root *root, void __user *arg) | |||
2930 | goto out; | 2930 | goto out; |
2931 | 2931 | ||
2932 | for (i = 0; i < ipath->fspath->elem_cnt; ++i) { | 2932 | for (i = 0; i < ipath->fspath->elem_cnt; ++i) { |
2933 | rel_ptr = ipath->fspath->val[i] - (u64)ipath->fspath->val; | 2933 | rel_ptr = ipath->fspath->val[i] - |
2934 | (u64)(unsigned long)ipath->fspath->val; | ||
2934 | ipath->fspath->val[i] = rel_ptr; | 2935 | ipath->fspath->val[i] = rel_ptr; |
2935 | } | 2936 | } |
2936 | 2937 | ||
2937 | ret = copy_to_user((void *)ipa->fspath, (void *)ipath->fspath, size); | 2938 | ret = copy_to_user((void *)(unsigned long)ipa->fspath, |
2939 | (void *)(unsigned long)ipath->fspath, size); | ||
2938 | if (ret) { | 2940 | if (ret) { |
2939 | ret = -EFAULT; | 2941 | ret = -EFAULT; |
2940 | goto out; | 2942 | goto out; |
@@ -3017,7 +3019,8 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_root *root, | |||
3017 | if (ret < 0) | 3019 | if (ret < 0) |
3018 | goto out; | 3020 | goto out; |
3019 | 3021 | ||
3020 | ret = copy_to_user((void *)loi->inodes, (void *)inodes, size); | 3022 | ret = copy_to_user((void *)(unsigned long)loi->inodes, |
3023 | (void *)(unsigned long)inodes, size); | ||
3021 | if (ret) | 3024 | if (ret) |
3022 | ret = -EFAULT; | 3025 | ret = -EFAULT; |
3023 | 3026 | ||
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index f4190f22edfb..fab420db5121 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -272,7 +272,7 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root, void *ctx) | |||
272 | swarn->logical, swarn->dev->name, | 272 | swarn->logical, swarn->dev->name, |
273 | (unsigned long long)swarn->sector, root, inum, offset, | 273 | (unsigned long long)swarn->sector, root, inum, offset, |
274 | min(isize - offset, (u64)PAGE_SIZE), nlink, | 274 | min(isize - offset, (u64)PAGE_SIZE), nlink, |
275 | (char *)ipath->fspath->val[i]); | 275 | (char *)(unsigned long)ipath->fspath->val[i]); |
276 | 276 | ||
277 | free_ipath(ipath); | 277 | free_ipath(ipath); |
278 | return 0; | 278 | return 0; |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 8bd9d6d0e07a..17ee7fc5e64e 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -825,13 +825,9 @@ static char *setup_root_args(char *args) | |||
825 | static struct dentry *mount_subvol(const char *subvol_name, int flags, | 825 | static struct dentry *mount_subvol(const char *subvol_name, int flags, |
826 | const char *device_name, char *data) | 826 | const char *device_name, char *data) |
827 | { | 827 | { |
828 | struct super_block *s; | ||
829 | struct dentry *root; | 828 | struct dentry *root; |
830 | struct vfsmount *mnt; | 829 | struct vfsmount *mnt; |
831 | struct mnt_namespace *ns_private; | ||
832 | char *newargs; | 830 | char *newargs; |
833 | struct path path; | ||
834 | int error; | ||
835 | 831 | ||
836 | newargs = setup_root_args(data); | 832 | newargs = setup_root_args(data); |
837 | if (!newargs) | 833 | if (!newargs) |
@@ -842,39 +838,17 @@ static struct dentry *mount_subvol(const char *subvol_name, int flags, | |||
842 | if (IS_ERR(mnt)) | 838 | if (IS_ERR(mnt)) |
843 | return ERR_CAST(mnt); | 839 | return ERR_CAST(mnt); |
844 | 840 | ||
845 | ns_private = create_mnt_ns(mnt); | 841 | root = mount_subtree(mnt, subvol_name); |
846 | if (IS_ERR(ns_private)) { | ||
847 | mntput(mnt); | ||
848 | return ERR_CAST(ns_private); | ||
849 | } | ||
850 | 842 | ||
851 | /* | 843 | if (!IS_ERR(root) && !is_subvolume_inode(root->d_inode)) { |
852 | * This will trigger the automount of the subvol so we can just | 844 | struct super_block *s = root->d_sb; |
853 | * drop the mnt we have here and return the dentry that we | 845 | dput(root); |
854 | * found. | 846 | root = ERR_PTR(-EINVAL); |
855 | */ | 847 | deactivate_locked_super(s); |
856 | error = vfs_path_lookup(mnt->mnt_root, mnt, subvol_name, | ||
857 | LOOKUP_FOLLOW, &path); | ||
858 | put_mnt_ns(ns_private); | ||
859 | if (error) | ||
860 | return ERR_PTR(error); | ||
861 | |||
862 | if (!is_subvolume_inode(path.dentry->d_inode)) { | ||
863 | path_put(&path); | ||
864 | mntput(mnt); | ||
865 | error = -EINVAL; | ||
866 | printk(KERN_ERR "btrfs: '%s' is not a valid subvolume\n", | 848 | printk(KERN_ERR "btrfs: '%s' is not a valid subvolume\n", |
867 | subvol_name); | 849 | subvol_name); |
868 | return ERR_PTR(-EINVAL); | ||
869 | } | 850 | } |
870 | 851 | ||
871 | /* Get a ref to the sb and the dentry we found and return it */ | ||
872 | s = path.mnt->mnt_sb; | ||
873 | atomic_inc(&s->s_active); | ||
874 | root = dget(path.dentry); | ||
875 | path_put(&path); | ||
876 | down_write(&s->s_umount); | ||
877 | |||
878 | return root; | 852 | return root; |
879 | } | 853 | } |
880 | 854 | ||
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 6a0574e923bc..81376d94cd3c 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -785,6 +785,10 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans, | |||
785 | 785 | ||
786 | btrfs_save_ino_cache(root, trans); | 786 | btrfs_save_ino_cache(root, trans); |
787 | 787 | ||
788 | /* see comments in should_cow_block() */ | ||
789 | root->force_cow = 0; | ||
790 | smp_wmb(); | ||
791 | |||
788 | if (root->commit_root != root->node) { | 792 | if (root->commit_root != root->node) { |
789 | mutex_lock(&root->fs_commit_mutex); | 793 | mutex_lock(&root->fs_commit_mutex); |
790 | switch_commit_root(root); | 794 | switch_commit_root(root); |
@@ -947,6 +951,10 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
947 | btrfs_tree_unlock(old); | 951 | btrfs_tree_unlock(old); |
948 | free_extent_buffer(old); | 952 | free_extent_buffer(old); |
949 | 953 | ||
954 | /* see comments in should_cow_block() */ | ||
955 | root->force_cow = 1; | ||
956 | smp_wmb(); | ||
957 | |||
950 | btrfs_set_root_node(new_root_item, tmp); | 958 | btrfs_set_root_node(new_root_item, tmp); |
951 | /* record when the snapshot was created in key.offset */ | 959 | /* record when the snapshot was created in key.offset */ |
952 | key.offset = trans->transid; | 960 | key.offset = trans->transid; |
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index ab5b1c49f352..78f2d4d4f37f 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h | |||
@@ -100,6 +100,12 @@ struct btrfs_device { | |||
100 | struct reada_zone *reada_curr_zone; | 100 | struct reada_zone *reada_curr_zone; |
101 | struct radix_tree_root reada_zones; | 101 | struct radix_tree_root reada_zones; |
102 | struct radix_tree_root reada_extents; | 102 | struct radix_tree_root reada_extents; |
103 | |||
104 | /* for sending down flush barriers */ | ||
105 | struct bio *flush_bio; | ||
106 | struct completion flush_wait; | ||
107 | int nobarriers; | ||
108 | |||
103 | }; | 109 | }; |
104 | 110 | ||
105 | struct btrfs_fs_devices { | 111 | struct btrfs_fs_devices { |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 2abd0dfad7f8..bca3948e9dbf 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -1143,7 +1143,7 @@ static void ceph_d_prune(struct dentry *dentry) | |||
1143 | { | 1143 | { |
1144 | struct ceph_dentry_info *di; | 1144 | struct ceph_dentry_info *di; |
1145 | 1145 | ||
1146 | dout("d_release %p\n", dentry); | 1146 | dout("ceph_d_prune %p\n", dentry); |
1147 | 1147 | ||
1148 | /* do we have a valid parent? */ | 1148 | /* do we have a valid parent? */ |
1149 | if (!dentry->d_parent || IS_ROOT(dentry)) | 1149 | if (!dentry->d_parent || IS_ROOT(dentry)) |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index e392bfce84a3..116f36502f17 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -1328,12 +1328,13 @@ int ceph_inode_set_size(struct inode *inode, loff_t size) | |||
1328 | */ | 1328 | */ |
1329 | void ceph_queue_writeback(struct inode *inode) | 1329 | void ceph_queue_writeback(struct inode *inode) |
1330 | { | 1330 | { |
1331 | ihold(inode); | ||
1331 | if (queue_work(ceph_inode_to_client(inode)->wb_wq, | 1332 | if (queue_work(ceph_inode_to_client(inode)->wb_wq, |
1332 | &ceph_inode(inode)->i_wb_work)) { | 1333 | &ceph_inode(inode)->i_wb_work)) { |
1333 | dout("ceph_queue_writeback %p\n", inode); | 1334 | dout("ceph_queue_writeback %p\n", inode); |
1334 | ihold(inode); | ||
1335 | } else { | 1335 | } else { |
1336 | dout("ceph_queue_writeback %p failed\n", inode); | 1336 | dout("ceph_queue_writeback %p failed\n", inode); |
1337 | iput(inode); | ||
1337 | } | 1338 | } |
1338 | } | 1339 | } |
1339 | 1340 | ||
@@ -1353,12 +1354,13 @@ static void ceph_writeback_work(struct work_struct *work) | |||
1353 | */ | 1354 | */ |
1354 | void ceph_queue_invalidate(struct inode *inode) | 1355 | void ceph_queue_invalidate(struct inode *inode) |
1355 | { | 1356 | { |
1357 | ihold(inode); | ||
1356 | if (queue_work(ceph_inode_to_client(inode)->pg_inv_wq, | 1358 | if (queue_work(ceph_inode_to_client(inode)->pg_inv_wq, |
1357 | &ceph_inode(inode)->i_pg_inv_work)) { | 1359 | &ceph_inode(inode)->i_pg_inv_work)) { |
1358 | dout("ceph_queue_invalidate %p\n", inode); | 1360 | dout("ceph_queue_invalidate %p\n", inode); |
1359 | ihold(inode); | ||
1360 | } else { | 1361 | } else { |
1361 | dout("ceph_queue_invalidate %p failed\n", inode); | 1362 | dout("ceph_queue_invalidate %p failed\n", inode); |
1363 | iput(inode); | ||
1362 | } | 1364 | } |
1363 | } | 1365 | } |
1364 | 1366 | ||
@@ -1434,13 +1436,14 @@ void ceph_queue_vmtruncate(struct inode *inode) | |||
1434 | { | 1436 | { |
1435 | struct ceph_inode_info *ci = ceph_inode(inode); | 1437 | struct ceph_inode_info *ci = ceph_inode(inode); |
1436 | 1438 | ||
1439 | ihold(inode); | ||
1437 | if (queue_work(ceph_sb_to_client(inode->i_sb)->trunc_wq, | 1440 | if (queue_work(ceph_sb_to_client(inode->i_sb)->trunc_wq, |
1438 | &ci->i_vmtruncate_work)) { | 1441 | &ci->i_vmtruncate_work)) { |
1439 | dout("ceph_queue_vmtruncate %p\n", inode); | 1442 | dout("ceph_queue_vmtruncate %p\n", inode); |
1440 | ihold(inode); | ||
1441 | } else { | 1443 | } else { |
1442 | dout("ceph_queue_vmtruncate %p failed, pending=%d\n", | 1444 | dout("ceph_queue_vmtruncate %p failed, pending=%d\n", |
1443 | inode, ci->i_truncate_pending); | 1445 | inode, ci->i_truncate_pending); |
1446 | iput(inode); | ||
1444 | } | 1447 | } |
1445 | } | 1448 | } |
1446 | 1449 | ||
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index a90846fac759..8dc73a594a90 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -638,10 +638,12 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc, | |||
638 | if (err == 0) { | 638 | if (err == 0) { |
639 | dout("open_root_inode success\n"); | 639 | dout("open_root_inode success\n"); |
640 | if (ceph_ino(req->r_target_inode) == CEPH_INO_ROOT && | 640 | if (ceph_ino(req->r_target_inode) == CEPH_INO_ROOT && |
641 | fsc->sb->s_root == NULL) | 641 | fsc->sb->s_root == NULL) { |
642 | root = d_alloc_root(req->r_target_inode); | 642 | root = d_alloc_root(req->r_target_inode); |
643 | else | 643 | ceph_init_dentry(root); |
644 | } else { | ||
644 | root = d_obtain_alias(req->r_target_inode); | 645 | root = d_obtain_alias(req->r_target_inode); |
646 | } | ||
645 | req->r_target_inode = NULL; | 647 | req->r_target_inode = NULL; |
646 | dout("open_root_inode success, root dentry is %p\n", root); | 648 | dout("open_root_inode success, root dentry is %p\n", root); |
647 | } else { | 649 | } else { |
diff --git a/fs/dcache.c b/fs/dcache.c index a901c6901bce..10ba92def3f6 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/bit_spinlock.h> | 36 | #include <linux/bit_spinlock.h> |
37 | #include <linux/rculist_bl.h> | 37 | #include <linux/rculist_bl.h> |
38 | #include <linux/prefetch.h> | 38 | #include <linux/prefetch.h> |
39 | #include <linux/ratelimit.h> | ||
39 | #include "internal.h" | 40 | #include "internal.h" |
40 | 41 | ||
41 | /* | 42 | /* |
@@ -2383,8 +2384,16 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) | |||
2383 | actual = __d_unalias(inode, dentry, alias); | 2384 | actual = __d_unalias(inode, dentry, alias); |
2384 | } | 2385 | } |
2385 | write_sequnlock(&rename_lock); | 2386 | write_sequnlock(&rename_lock); |
2386 | if (IS_ERR(actual)) | 2387 | if (IS_ERR(actual)) { |
2388 | if (PTR_ERR(actual) == -ELOOP) | ||
2389 | pr_warn_ratelimited( | ||
2390 | "VFS: Lookup of '%s' in %s %s" | ||
2391 | " would have caused loop\n", | ||
2392 | dentry->d_name.name, | ||
2393 | inode->i_sb->s_type->name, | ||
2394 | inode->i_sb->s_id); | ||
2387 | dput(alias); | 2395 | dput(alias); |
2396 | } | ||
2388 | goto out_nolock; | 2397 | goto out_nolock; |
2389 | } | 2398 | } |
2390 | } | 2399 | } |
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 58609bde3b9f..2a834255c75d 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -967,7 +967,7 @@ static void ecryptfs_set_default_crypt_stat_vals( | |||
967 | 967 | ||
968 | /** | 968 | /** |
969 | * ecryptfs_new_file_context | 969 | * ecryptfs_new_file_context |
970 | * @ecryptfs_dentry: The eCryptfs dentry | 970 | * @ecryptfs_inode: The eCryptfs inode |
971 | * | 971 | * |
972 | * If the crypto context for the file has not yet been established, | 972 | * If the crypto context for the file has not yet been established, |
973 | * this is where we do that. Establishing a new crypto context | 973 | * this is where we do that. Establishing a new crypto context |
@@ -984,13 +984,13 @@ static void ecryptfs_set_default_crypt_stat_vals( | |||
984 | * | 984 | * |
985 | * Returns zero on success; non-zero otherwise | 985 | * Returns zero on success; non-zero otherwise |
986 | */ | 986 | */ |
987 | int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry) | 987 | int ecryptfs_new_file_context(struct inode *ecryptfs_inode) |
988 | { | 988 | { |
989 | struct ecryptfs_crypt_stat *crypt_stat = | 989 | struct ecryptfs_crypt_stat *crypt_stat = |
990 | &ecryptfs_inode_to_private(ecryptfs_dentry->d_inode)->crypt_stat; | 990 | &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; |
991 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat = | 991 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat = |
992 | &ecryptfs_superblock_to_private( | 992 | &ecryptfs_superblock_to_private( |
993 | ecryptfs_dentry->d_sb)->mount_crypt_stat; | 993 | ecryptfs_inode->i_sb)->mount_crypt_stat; |
994 | int cipher_name_len; | 994 | int cipher_name_len; |
995 | int rc = 0; | 995 | int rc = 0; |
996 | 996 | ||
@@ -1299,12 +1299,12 @@ static int ecryptfs_write_headers_virt(char *page_virt, size_t max, | |||
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | static int | 1301 | static int |
1302 | ecryptfs_write_metadata_to_contents(struct dentry *ecryptfs_dentry, | 1302 | ecryptfs_write_metadata_to_contents(struct inode *ecryptfs_inode, |
1303 | char *virt, size_t virt_len) | 1303 | char *virt, size_t virt_len) |
1304 | { | 1304 | { |
1305 | int rc; | 1305 | int rc; |
1306 | 1306 | ||
1307 | rc = ecryptfs_write_lower(ecryptfs_dentry->d_inode, virt, | 1307 | rc = ecryptfs_write_lower(ecryptfs_inode, virt, |
1308 | 0, virt_len); | 1308 | 0, virt_len); |
1309 | if (rc < 0) | 1309 | if (rc < 0) |
1310 | printk(KERN_ERR "%s: Error attempting to write header " | 1310 | printk(KERN_ERR "%s: Error attempting to write header " |
@@ -1338,7 +1338,8 @@ static unsigned long ecryptfs_get_zeroed_pages(gfp_t gfp_mask, | |||
1338 | 1338 | ||
1339 | /** | 1339 | /** |
1340 | * ecryptfs_write_metadata | 1340 | * ecryptfs_write_metadata |
1341 | * @ecryptfs_dentry: The eCryptfs dentry | 1341 | * @ecryptfs_dentry: The eCryptfs dentry, which should be negative |
1342 | * @ecryptfs_inode: The newly created eCryptfs inode | ||
1342 | * | 1343 | * |
1343 | * Write the file headers out. This will likely involve a userspace | 1344 | * Write the file headers out. This will likely involve a userspace |
1344 | * callout, in which the session key is encrypted with one or more | 1345 | * callout, in which the session key is encrypted with one or more |
@@ -1348,10 +1349,11 @@ static unsigned long ecryptfs_get_zeroed_pages(gfp_t gfp_mask, | |||
1348 | * | 1349 | * |
1349 | * Returns zero on success; non-zero on error | 1350 | * Returns zero on success; non-zero on error |
1350 | */ | 1351 | */ |
1351 | int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry) | 1352 | int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry, |
1353 | struct inode *ecryptfs_inode) | ||
1352 | { | 1354 | { |
1353 | struct ecryptfs_crypt_stat *crypt_stat = | 1355 | struct ecryptfs_crypt_stat *crypt_stat = |
1354 | &ecryptfs_inode_to_private(ecryptfs_dentry->d_inode)->crypt_stat; | 1356 | &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; |
1355 | unsigned int order; | 1357 | unsigned int order; |
1356 | char *virt; | 1358 | char *virt; |
1357 | size_t virt_len; | 1359 | size_t virt_len; |
@@ -1391,7 +1393,7 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry) | |||
1391 | rc = ecryptfs_write_metadata_to_xattr(ecryptfs_dentry, virt, | 1393 | rc = ecryptfs_write_metadata_to_xattr(ecryptfs_dentry, virt, |
1392 | size); | 1394 | size); |
1393 | else | 1395 | else |
1394 | rc = ecryptfs_write_metadata_to_contents(ecryptfs_dentry, virt, | 1396 | rc = ecryptfs_write_metadata_to_contents(ecryptfs_inode, virt, |
1395 | virt_len); | 1397 | virt_len); |
1396 | if (rc) { | 1398 | if (rc) { |
1397 | printk(KERN_ERR "%s: Error writing metadata out to lower file; " | 1399 | printk(KERN_ERR "%s: Error writing metadata out to lower file; " |
@@ -1943,7 +1945,7 @@ static unsigned char *portable_filename_chars = ("-.0123456789ABCD" | |||
1943 | 1945 | ||
1944 | /* We could either offset on every reverse map or just pad some 0x00's | 1946 | /* We could either offset on every reverse map or just pad some 0x00's |
1945 | * at the front here */ | 1947 | * at the front here */ |
1946 | static const unsigned char filename_rev_map[] = { | 1948 | static const unsigned char filename_rev_map[256] = { |
1947 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 7 */ | 1949 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 7 */ |
1948 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 15 */ | 1950 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 15 */ |
1949 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 23 */ | 1951 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 23 */ |
@@ -1959,7 +1961,7 @@ static const unsigned char filename_rev_map[] = { | |||
1959 | 0x00, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, /* 103 */ | 1961 | 0x00, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, /* 103 */ |
1960 | 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, /* 111 */ | 1962 | 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, /* 111 */ |
1961 | 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, /* 119 */ | 1963 | 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, /* 119 */ |
1962 | 0x3D, 0x3E, 0x3F | 1964 | 0x3D, 0x3E, 0x3F /* 123 - 255 initialized to 0x00 */ |
1963 | }; | 1965 | }; |
1964 | 1966 | ||
1965 | /** | 1967 | /** |
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 54481a3b2c79..a9f29b12fbf2 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -584,9 +584,10 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat); | |||
584 | int ecryptfs_write_inode_size_to_metadata(struct inode *ecryptfs_inode); | 584 | int ecryptfs_write_inode_size_to_metadata(struct inode *ecryptfs_inode); |
585 | int ecryptfs_encrypt_page(struct page *page); | 585 | int ecryptfs_encrypt_page(struct page *page); |
586 | int ecryptfs_decrypt_page(struct page *page); | 586 | int ecryptfs_decrypt_page(struct page *page); |
587 | int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry); | 587 | int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry, |
588 | struct inode *ecryptfs_inode); | ||
588 | int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry); | 589 | int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry); |
589 | int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry); | 590 | int ecryptfs_new_file_context(struct inode *ecryptfs_inode); |
590 | void ecryptfs_write_crypt_stat_flags(char *page_virt, | 591 | void ecryptfs_write_crypt_stat_flags(char *page_virt, |
591 | struct ecryptfs_crypt_stat *crypt_stat, | 592 | struct ecryptfs_crypt_stat *crypt_stat, |
592 | size_t *written); | 593 | size_t *written); |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index c6ac98cf9baa..d3f95f941c47 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -139,6 +139,27 @@ out: | |||
139 | return rc; | 139 | return rc; |
140 | } | 140 | } |
141 | 141 | ||
142 | static void ecryptfs_vma_close(struct vm_area_struct *vma) | ||
143 | { | ||
144 | filemap_write_and_wait(vma->vm_file->f_mapping); | ||
145 | } | ||
146 | |||
147 | static const struct vm_operations_struct ecryptfs_file_vm_ops = { | ||
148 | .close = ecryptfs_vma_close, | ||
149 | .fault = filemap_fault, | ||
150 | }; | ||
151 | |||
152 | static int ecryptfs_file_mmap(struct file *file, struct vm_area_struct *vma) | ||
153 | { | ||
154 | int rc; | ||
155 | |||
156 | rc = generic_file_mmap(file, vma); | ||
157 | if (!rc) | ||
158 | vma->vm_ops = &ecryptfs_file_vm_ops; | ||
159 | |||
160 | return rc; | ||
161 | } | ||
162 | |||
142 | struct kmem_cache *ecryptfs_file_info_cache; | 163 | struct kmem_cache *ecryptfs_file_info_cache; |
143 | 164 | ||
144 | /** | 165 | /** |
@@ -349,7 +370,7 @@ const struct file_operations ecryptfs_main_fops = { | |||
349 | #ifdef CONFIG_COMPAT | 370 | #ifdef CONFIG_COMPAT |
350 | .compat_ioctl = ecryptfs_compat_ioctl, | 371 | .compat_ioctl = ecryptfs_compat_ioctl, |
351 | #endif | 372 | #endif |
352 | .mmap = generic_file_mmap, | 373 | .mmap = ecryptfs_file_mmap, |
353 | .open = ecryptfs_open, | 374 | .open = ecryptfs_open, |
354 | .flush = ecryptfs_flush, | 375 | .flush = ecryptfs_flush, |
355 | .release = ecryptfs_release, | 376 | .release = ecryptfs_release, |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index a36d327f1521..32f90a3ae63e 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -172,22 +172,23 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode, | |||
172 | * it. It will also update the eCryptfs directory inode to mimic the | 172 | * it. It will also update the eCryptfs directory inode to mimic the |
173 | * stat of the lower directory inode. | 173 | * stat of the lower directory inode. |
174 | * | 174 | * |
175 | * Returns zero on success; non-zero on error condition | 175 | * Returns the new eCryptfs inode on success; an ERR_PTR on error condition |
176 | */ | 176 | */ |
177 | static int | 177 | static struct inode * |
178 | ecryptfs_do_create(struct inode *directory_inode, | 178 | ecryptfs_do_create(struct inode *directory_inode, |
179 | struct dentry *ecryptfs_dentry, int mode) | 179 | struct dentry *ecryptfs_dentry, int mode) |
180 | { | 180 | { |
181 | int rc; | 181 | int rc; |
182 | struct dentry *lower_dentry; | 182 | struct dentry *lower_dentry; |
183 | struct dentry *lower_dir_dentry; | 183 | struct dentry *lower_dir_dentry; |
184 | struct inode *inode; | ||
184 | 185 | ||
185 | lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); | 186 | lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); |
186 | lower_dir_dentry = lock_parent(lower_dentry); | 187 | lower_dir_dentry = lock_parent(lower_dentry); |
187 | if (IS_ERR(lower_dir_dentry)) { | 188 | if (IS_ERR(lower_dir_dentry)) { |
188 | ecryptfs_printk(KERN_ERR, "Error locking directory of " | 189 | ecryptfs_printk(KERN_ERR, "Error locking directory of " |
189 | "dentry\n"); | 190 | "dentry\n"); |
190 | rc = PTR_ERR(lower_dir_dentry); | 191 | inode = ERR_CAST(lower_dir_dentry); |
191 | goto out; | 192 | goto out; |
192 | } | 193 | } |
193 | rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode, | 194 | rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode, |
@@ -195,20 +196,19 @@ ecryptfs_do_create(struct inode *directory_inode, | |||
195 | if (rc) { | 196 | if (rc) { |
196 | printk(KERN_ERR "%s: Failure to create dentry in lower fs; " | 197 | printk(KERN_ERR "%s: Failure to create dentry in lower fs; " |
197 | "rc = [%d]\n", __func__, rc); | 198 | "rc = [%d]\n", __func__, rc); |
199 | inode = ERR_PTR(rc); | ||
198 | goto out_lock; | 200 | goto out_lock; |
199 | } | 201 | } |
200 | rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry, | 202 | inode = __ecryptfs_get_inode(lower_dentry->d_inode, |
201 | directory_inode->i_sb); | 203 | directory_inode->i_sb); |
202 | if (rc) { | 204 | if (IS_ERR(inode)) |
203 | ecryptfs_printk(KERN_ERR, "Failure in ecryptfs_interpose\n"); | ||
204 | goto out_lock; | 205 | goto out_lock; |
205 | } | ||
206 | fsstack_copy_attr_times(directory_inode, lower_dir_dentry->d_inode); | 206 | fsstack_copy_attr_times(directory_inode, lower_dir_dentry->d_inode); |
207 | fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode); | 207 | fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode); |
208 | out_lock: | 208 | out_lock: |
209 | unlock_dir(lower_dir_dentry); | 209 | unlock_dir(lower_dir_dentry); |
210 | out: | 210 | out: |
211 | return rc; | 211 | return inode; |
212 | } | 212 | } |
213 | 213 | ||
214 | /** | 214 | /** |
@@ -219,26 +219,26 @@ out: | |||
219 | * | 219 | * |
220 | * Returns zero on success | 220 | * Returns zero on success |
221 | */ | 221 | */ |
222 | static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry) | 222 | static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry, |
223 | struct inode *ecryptfs_inode) | ||
223 | { | 224 | { |
224 | struct ecryptfs_crypt_stat *crypt_stat = | 225 | struct ecryptfs_crypt_stat *crypt_stat = |
225 | &ecryptfs_inode_to_private(ecryptfs_dentry->d_inode)->crypt_stat; | 226 | &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; |
226 | int rc = 0; | 227 | int rc = 0; |
227 | 228 | ||
228 | if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) { | 229 | if (S_ISDIR(ecryptfs_inode->i_mode)) { |
229 | ecryptfs_printk(KERN_DEBUG, "This is a directory\n"); | 230 | ecryptfs_printk(KERN_DEBUG, "This is a directory\n"); |
230 | crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED); | 231 | crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED); |
231 | goto out; | 232 | goto out; |
232 | } | 233 | } |
233 | ecryptfs_printk(KERN_DEBUG, "Initializing crypto context\n"); | 234 | ecryptfs_printk(KERN_DEBUG, "Initializing crypto context\n"); |
234 | rc = ecryptfs_new_file_context(ecryptfs_dentry); | 235 | rc = ecryptfs_new_file_context(ecryptfs_inode); |
235 | if (rc) { | 236 | if (rc) { |
236 | ecryptfs_printk(KERN_ERR, "Error creating new file " | 237 | ecryptfs_printk(KERN_ERR, "Error creating new file " |
237 | "context; rc = [%d]\n", rc); | 238 | "context; rc = [%d]\n", rc); |
238 | goto out; | 239 | goto out; |
239 | } | 240 | } |
240 | rc = ecryptfs_get_lower_file(ecryptfs_dentry, | 241 | rc = ecryptfs_get_lower_file(ecryptfs_dentry, ecryptfs_inode); |
241 | ecryptfs_dentry->d_inode); | ||
242 | if (rc) { | 242 | if (rc) { |
243 | printk(KERN_ERR "%s: Error attempting to initialize " | 243 | printk(KERN_ERR "%s: Error attempting to initialize " |
244 | "the lower file for the dentry with name " | 244 | "the lower file for the dentry with name " |
@@ -246,10 +246,10 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry) | |||
246 | ecryptfs_dentry->d_name.name, rc); | 246 | ecryptfs_dentry->d_name.name, rc); |
247 | goto out; | 247 | goto out; |
248 | } | 248 | } |
249 | rc = ecryptfs_write_metadata(ecryptfs_dentry); | 249 | rc = ecryptfs_write_metadata(ecryptfs_dentry, ecryptfs_inode); |
250 | if (rc) | 250 | if (rc) |
251 | printk(KERN_ERR "Error writing headers; rc = [%d]\n", rc); | 251 | printk(KERN_ERR "Error writing headers; rc = [%d]\n", rc); |
252 | ecryptfs_put_lower_file(ecryptfs_dentry->d_inode); | 252 | ecryptfs_put_lower_file(ecryptfs_inode); |
253 | out: | 253 | out: |
254 | return rc; | 254 | return rc; |
255 | } | 255 | } |
@@ -269,18 +269,28 @@ static int | |||
269 | ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, | 269 | ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, |
270 | int mode, struct nameidata *nd) | 270 | int mode, struct nameidata *nd) |
271 | { | 271 | { |
272 | struct inode *ecryptfs_inode; | ||
272 | int rc; | 273 | int rc; |
273 | 274 | ||
274 | /* ecryptfs_do_create() calls ecryptfs_interpose() */ | 275 | ecryptfs_inode = ecryptfs_do_create(directory_inode, ecryptfs_dentry, |
275 | rc = ecryptfs_do_create(directory_inode, ecryptfs_dentry, mode); | 276 | mode); |
276 | if (unlikely(rc)) { | 277 | if (unlikely(IS_ERR(ecryptfs_inode))) { |
277 | ecryptfs_printk(KERN_WARNING, "Failed to create file in" | 278 | ecryptfs_printk(KERN_WARNING, "Failed to create file in" |
278 | "lower filesystem\n"); | 279 | "lower filesystem\n"); |
280 | rc = PTR_ERR(ecryptfs_inode); | ||
279 | goto out; | 281 | goto out; |
280 | } | 282 | } |
281 | /* At this point, a file exists on "disk"; we need to make sure | 283 | /* At this point, a file exists on "disk"; we need to make sure |
282 | * that this on disk file is prepared to be an ecryptfs file */ | 284 | * that this on disk file is prepared to be an ecryptfs file */ |
283 | rc = ecryptfs_initialize_file(ecryptfs_dentry); | 285 | rc = ecryptfs_initialize_file(ecryptfs_dentry, ecryptfs_inode); |
286 | if (rc) { | ||
287 | drop_nlink(ecryptfs_inode); | ||
288 | unlock_new_inode(ecryptfs_inode); | ||
289 | iput(ecryptfs_inode); | ||
290 | goto out; | ||
291 | } | ||
292 | d_instantiate(ecryptfs_dentry, ecryptfs_inode); | ||
293 | unlock_new_inode(ecryptfs_inode); | ||
284 | out: | 294 | out: |
285 | return rc; | 295 | return rc; |
286 | } | 296 | } |
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index f6dba4505f1c..12ccacda44e0 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -565,7 +565,7 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb) | |||
565 | brelse(bitmap_bh); | 565 | brelse(bitmap_bh); |
566 | printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu" | 566 | printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu" |
567 | ", computed = %llu, %llu\n", | 567 | ", computed = %llu, %llu\n", |
568 | EXT4_B2C(sbi, ext4_free_blocks_count(es)), | 568 | EXT4_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)), |
569 | desc_count, bitmap_count); | 569 | desc_count, bitmap_count); |
570 | return bitmap_count; | 570 | return bitmap_count; |
571 | #else | 571 | #else |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 240f6e2dc7ee..fffec40d5996 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2270,6 +2270,7 @@ retry: | |||
2270 | ext4_msg(inode->i_sb, KERN_CRIT, "%s: jbd2_start: " | 2270 | ext4_msg(inode->i_sb, KERN_CRIT, "%s: jbd2_start: " |
2271 | "%ld pages, ino %lu; err %d", __func__, | 2271 | "%ld pages, ino %lu; err %d", __func__, |
2272 | wbc->nr_to_write, inode->i_ino, ret); | 2272 | wbc->nr_to_write, inode->i_ino, ret); |
2273 | blk_finish_plug(&plug); | ||
2273 | goto out_writepages; | 2274 | goto out_writepages; |
2274 | } | 2275 | } |
2275 | 2276 | ||
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 9953d80145ad..3858767ec672 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1683,7 +1683,9 @@ static int parse_options(char *options, struct super_block *sb, | |||
1683 | data_opt = EXT4_MOUNT_WRITEBACK_DATA; | 1683 | data_opt = EXT4_MOUNT_WRITEBACK_DATA; |
1684 | datacheck: | 1684 | datacheck: |
1685 | if (is_remount) { | 1685 | if (is_remount) { |
1686 | if (test_opt(sb, DATA_FLAGS) != data_opt) { | 1686 | if (!sbi->s_journal) |
1687 | ext4_msg(sb, KERN_WARNING, "Remounting file system with no journal so ignoring journalled data option"); | ||
1688 | else if (test_opt(sb, DATA_FLAGS) != data_opt) { | ||
1687 | ext4_msg(sb, KERN_ERR, | 1689 | ext4_msg(sb, KERN_ERR, |
1688 | "Cannot change data mode on remount"); | 1690 | "Cannot change data mode on remount"); |
1689 | return 0; | 1691 | return 0; |
@@ -3099,8 +3101,6 @@ static void ext4_destroy_lazyinit_thread(void) | |||
3099 | } | 3101 | } |
3100 | 3102 | ||
3101 | static int ext4_fill_super(struct super_block *sb, void *data, int silent) | 3103 | static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
3102 | __releases(kernel_lock) | ||
3103 | __acquires(kernel_lock) | ||
3104 | { | 3104 | { |
3105 | char *orig_data = kstrdup(data, GFP_KERNEL); | 3105 | char *orig_data = kstrdup(data, GFP_KERNEL); |
3106 | struct buffer_head *bh; | 3106 | struct buffer_head *bh; |
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c index 3f32bcb0d9bd..ef175cb8cfd8 100644 --- a/fs/minix/bitmap.c +++ b/fs/minix/bitmap.c | |||
@@ -16,38 +16,26 @@ | |||
16 | #include <linux/bitops.h> | 16 | #include <linux/bitops.h> |
17 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
18 | 18 | ||
19 | static const int nibblemap[] = { 4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0 }; | ||
20 | |||
21 | static DEFINE_SPINLOCK(bitmap_lock); | 19 | static DEFINE_SPINLOCK(bitmap_lock); |
22 | 20 | ||
23 | static unsigned long count_free(struct buffer_head *map[], unsigned numblocks, __u32 numbits) | 21 | /* |
22 | * bitmap consists of blocks filled with 16bit words | ||
23 | * bit set == busy, bit clear == free | ||
24 | * endianness is a mess, but for counting zero bits it really doesn't matter... | ||
25 | */ | ||
26 | static __u32 count_free(struct buffer_head *map[], unsigned blocksize, __u32 numbits) | ||
24 | { | 27 | { |
25 | unsigned i, j, sum = 0; | 28 | __u32 sum = 0; |
26 | struct buffer_head *bh; | 29 | unsigned blocks = DIV_ROUND_UP(numbits, blocksize * 8); |
27 | |||
28 | for (i=0; i<numblocks-1; i++) { | ||
29 | if (!(bh=map[i])) | ||
30 | return(0); | ||
31 | for (j=0; j<bh->b_size; j++) | ||
32 | sum += nibblemap[bh->b_data[j] & 0xf] | ||
33 | + nibblemap[(bh->b_data[j]>>4) & 0xf]; | ||
34 | } | ||
35 | 30 | ||
36 | if (numblocks==0 || !(bh=map[numblocks-1])) | 31 | while (blocks--) { |
37 | return(0); | 32 | unsigned words = blocksize / 2; |
38 | i = ((numbits - (numblocks-1) * bh->b_size * 8) / 16) * 2; | 33 | __u16 *p = (__u16 *)(*map++)->b_data; |
39 | for (j=0; j<i; j++) { | 34 | while (words--) |
40 | sum += nibblemap[bh->b_data[j] & 0xf] | 35 | sum += 16 - hweight16(*p++); |
41 | + nibblemap[(bh->b_data[j]>>4) & 0xf]; | ||
42 | } | 36 | } |
43 | 37 | ||
44 | i = numbits%16; | 38 | return sum; |
45 | if (i!=0) { | ||
46 | i = *(__u16 *)(&bh->b_data[j]) | ~((1<<i) - 1); | ||
47 | sum += nibblemap[i & 0xf] + nibblemap[(i>>4) & 0xf]; | ||
48 | sum += nibblemap[(i>>8) & 0xf] + nibblemap[(i>>12) & 0xf]; | ||
49 | } | ||
50 | return(sum); | ||
51 | } | 39 | } |
52 | 40 | ||
53 | void minix_free_block(struct inode *inode, unsigned long block) | 41 | void minix_free_block(struct inode *inode, unsigned long block) |
@@ -105,10 +93,12 @@ int minix_new_block(struct inode * inode) | |||
105 | return 0; | 93 | return 0; |
106 | } | 94 | } |
107 | 95 | ||
108 | unsigned long minix_count_free_blocks(struct minix_sb_info *sbi) | 96 | unsigned long minix_count_free_blocks(struct super_block *sb) |
109 | { | 97 | { |
110 | return (count_free(sbi->s_zmap, sbi->s_zmap_blocks, | 98 | struct minix_sb_info *sbi = minix_sb(sb); |
111 | sbi->s_nzones - sbi->s_firstdatazone + 1) | 99 | u32 bits = sbi->s_nzones - (sbi->s_firstdatazone + 1); |
100 | |||
101 | return (count_free(sbi->s_zmap, sb->s_blocksize, bits) | ||
112 | << sbi->s_log_zone_size); | 102 | << sbi->s_log_zone_size); |
113 | } | 103 | } |
114 | 104 | ||
@@ -273,7 +263,10 @@ struct inode *minix_new_inode(const struct inode *dir, int mode, int *error) | |||
273 | return inode; | 263 | return inode; |
274 | } | 264 | } |
275 | 265 | ||
276 | unsigned long minix_count_free_inodes(struct minix_sb_info *sbi) | 266 | unsigned long minix_count_free_inodes(struct super_block *sb) |
277 | { | 267 | { |
278 | return count_free(sbi->s_imap, sbi->s_imap_blocks, sbi->s_ninodes + 1); | 268 | struct minix_sb_info *sbi = minix_sb(sb); |
269 | u32 bits = sbi->s_ninodes + 1; | ||
270 | |||
271 | return count_free(sbi->s_imap, sb->s_blocksize, bits); | ||
279 | } | 272 | } |
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 64cdcd662ffc..1d9e33966db0 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
@@ -279,6 +279,27 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | |||
279 | else if (sbi->s_mount_state & MINIX_ERROR_FS) | 279 | else if (sbi->s_mount_state & MINIX_ERROR_FS) |
280 | printk("MINIX-fs: mounting file system with errors, " | 280 | printk("MINIX-fs: mounting file system with errors, " |
281 | "running fsck is recommended\n"); | 281 | "running fsck is recommended\n"); |
282 | |||
283 | /* Apparently minix can create filesystems that allocate more blocks for | ||
284 | * the bitmaps than needed. We simply ignore that, but verify it didn't | ||
285 | * create one with not enough blocks and bail out if so. | ||
286 | */ | ||
287 | block = minix_blocks_needed(sbi->s_ninodes, s->s_blocksize); | ||
288 | if (sbi->s_imap_blocks < block) { | ||
289 | printk("MINIX-fs: file system does not have enough " | ||
290 | "imap blocks allocated. Refusing to mount\n"); | ||
291 | goto out_iput; | ||
292 | } | ||
293 | |||
294 | block = minix_blocks_needed( | ||
295 | (sbi->s_nzones - (sbi->s_firstdatazone + 1)), | ||
296 | s->s_blocksize); | ||
297 | if (sbi->s_zmap_blocks < block) { | ||
298 | printk("MINIX-fs: file system does not have enough " | ||
299 | "zmap blocks allocated. Refusing to mount.\n"); | ||
300 | goto out_iput; | ||
301 | } | ||
302 | |||
282 | return 0; | 303 | return 0; |
283 | 304 | ||
284 | out_iput: | 305 | out_iput: |
@@ -339,10 +360,10 @@ static int minix_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
339 | buf->f_type = sb->s_magic; | 360 | buf->f_type = sb->s_magic; |
340 | buf->f_bsize = sb->s_blocksize; | 361 | buf->f_bsize = sb->s_blocksize; |
341 | buf->f_blocks = (sbi->s_nzones - sbi->s_firstdatazone) << sbi->s_log_zone_size; | 362 | buf->f_blocks = (sbi->s_nzones - sbi->s_firstdatazone) << sbi->s_log_zone_size; |
342 | buf->f_bfree = minix_count_free_blocks(sbi); | 363 | buf->f_bfree = minix_count_free_blocks(sb); |
343 | buf->f_bavail = buf->f_bfree; | 364 | buf->f_bavail = buf->f_bfree; |
344 | buf->f_files = sbi->s_ninodes; | 365 | buf->f_files = sbi->s_ninodes; |
345 | buf->f_ffree = minix_count_free_inodes(sbi); | 366 | buf->f_ffree = minix_count_free_inodes(sb); |
346 | buf->f_namelen = sbi->s_namelen; | 367 | buf->f_namelen = sbi->s_namelen; |
347 | buf->f_fsid.val[0] = (u32)id; | 368 | buf->f_fsid.val[0] = (u32)id; |
348 | buf->f_fsid.val[1] = (u32)(id >> 32); | 369 | buf->f_fsid.val[1] = (u32)(id >> 32); |
diff --git a/fs/minix/minix.h b/fs/minix/minix.h index 341e2122879a..26bbd55e82ea 100644 --- a/fs/minix/minix.h +++ b/fs/minix/minix.h | |||
@@ -48,10 +48,10 @@ extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, stru | |||
48 | extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **); | 48 | extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **); |
49 | extern struct inode * minix_new_inode(const struct inode *, int, int *); | 49 | extern struct inode * minix_new_inode(const struct inode *, int, int *); |
50 | extern void minix_free_inode(struct inode * inode); | 50 | extern void minix_free_inode(struct inode * inode); |
51 | extern unsigned long minix_count_free_inodes(struct minix_sb_info *sbi); | 51 | extern unsigned long minix_count_free_inodes(struct super_block *sb); |
52 | extern int minix_new_block(struct inode * inode); | 52 | extern int minix_new_block(struct inode * inode); |
53 | extern void minix_free_block(struct inode *inode, unsigned long block); | 53 | extern void minix_free_block(struct inode *inode, unsigned long block); |
54 | extern unsigned long minix_count_free_blocks(struct minix_sb_info *sbi); | 54 | extern unsigned long minix_count_free_blocks(struct super_block *sb); |
55 | extern int minix_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 55 | extern int minix_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
56 | extern int minix_prepare_chunk(struct page *page, loff_t pos, unsigned len); | 56 | extern int minix_prepare_chunk(struct page *page, loff_t pos, unsigned len); |
57 | 57 | ||
@@ -88,6 +88,11 @@ static inline struct minix_inode_info *minix_i(struct inode *inode) | |||
88 | return list_entry(inode, struct minix_inode_info, vfs_inode); | 88 | return list_entry(inode, struct minix_inode_info, vfs_inode); |
89 | } | 89 | } |
90 | 90 | ||
91 | static inline unsigned minix_blocks_needed(unsigned bits, unsigned blocksize) | ||
92 | { | ||
93 | return DIV_ROUND_UP(bits, blocksize * 8); | ||
94 | } | ||
95 | |||
91 | #if defined(CONFIG_MINIX_FS_NATIVE_ENDIAN) && \ | 96 | #if defined(CONFIG_MINIX_FS_NATIVE_ENDIAN) && \ |
92 | defined(CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED) | 97 | defined(CONFIG_MINIX_FS_BIG_ENDIAN_16BIT_INDEXED) |
93 | 98 | ||
@@ -125,7 +130,7 @@ static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size) | |||
125 | if (!size) | 130 | if (!size) |
126 | return 0; | 131 | return 0; |
127 | 132 | ||
128 | size = (size >> 4) + ((size & 15) > 0); | 133 | size >>= 4; |
129 | while (*p++ == 0xffff) { | 134 | while (*p++ == 0xffff) { |
130 | if (--size == 0) | 135 | if (--size == 0) |
131 | return (p - addr) << 4; | 136 | return (p - addr) << 4; |
diff --git a/fs/namespace.c b/fs/namespace.c index e5e1c7d1839b..6d3a1963879b 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -2483,11 +2483,43 @@ struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt) | |||
2483 | __mnt_make_longterm(mnt); | 2483 | __mnt_make_longterm(mnt); |
2484 | new_ns->root = mnt; | 2484 | new_ns->root = mnt; |
2485 | list_add(&new_ns->list, &new_ns->root->mnt_list); | 2485 | list_add(&new_ns->list, &new_ns->root->mnt_list); |
2486 | } else { | ||
2487 | mntput(mnt); | ||
2486 | } | 2488 | } |
2487 | return new_ns; | 2489 | return new_ns; |
2488 | } | 2490 | } |
2489 | EXPORT_SYMBOL(create_mnt_ns); | 2491 | EXPORT_SYMBOL(create_mnt_ns); |
2490 | 2492 | ||
2493 | struct dentry *mount_subtree(struct vfsmount *mnt, const char *name) | ||
2494 | { | ||
2495 | struct mnt_namespace *ns; | ||
2496 | struct super_block *s; | ||
2497 | struct path path; | ||
2498 | int err; | ||
2499 | |||
2500 | ns = create_mnt_ns(mnt); | ||
2501 | if (IS_ERR(ns)) | ||
2502 | return ERR_CAST(ns); | ||
2503 | |||
2504 | err = vfs_path_lookup(mnt->mnt_root, mnt, | ||
2505 | name, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path); | ||
2506 | |||
2507 | put_mnt_ns(ns); | ||
2508 | |||
2509 | if (err) | ||
2510 | return ERR_PTR(err); | ||
2511 | |||
2512 | /* trade a vfsmount reference for active sb one */ | ||
2513 | s = path.mnt->mnt_sb; | ||
2514 | atomic_inc(&s->s_active); | ||
2515 | mntput(path.mnt); | ||
2516 | /* lock the sucker */ | ||
2517 | down_write(&s->s_umount); | ||
2518 | /* ... and return the root of (sub)tree on it */ | ||
2519 | return path.dentry; | ||
2520 | } | ||
2521 | EXPORT_SYMBOL(mount_subtree); | ||
2522 | |||
2491 | SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, | 2523 | SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, |
2492 | char __user *, type, unsigned long, flags, void __user *, data) | 2524 | char __user *, type, unsigned long, flags, void __user *, data) |
2493 | { | 2525 | { |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index b238d95ac48c..ac2899098147 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1468,12 +1468,12 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry | |||
1468 | res = NULL; | 1468 | res = NULL; |
1469 | goto out; | 1469 | goto out; |
1470 | /* This turned out not to be a regular file */ | 1470 | /* This turned out not to be a regular file */ |
1471 | case -EISDIR: | ||
1471 | case -ENOTDIR: | 1472 | case -ENOTDIR: |
1472 | goto no_open; | 1473 | goto no_open; |
1473 | case -ELOOP: | 1474 | case -ELOOP: |
1474 | if (!(nd->intent.open.flags & O_NOFOLLOW)) | 1475 | if (!(nd->intent.open.flags & O_NOFOLLOW)) |
1475 | goto no_open; | 1476 | goto no_open; |
1476 | /* case -EISDIR: */ | ||
1477 | /* case -EINVAL: */ | 1477 | /* case -EINVAL: */ |
1478 | default: | 1478 | default: |
1479 | res = ERR_CAST(inode); | 1479 | res = ERR_CAST(inode); |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 0a1f8312b4dc..eca56d4b39c0 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -40,48 +40,8 @@ | |||
40 | 40 | ||
41 | #define NFSDBG_FACILITY NFSDBG_FILE | 41 | #define NFSDBG_FACILITY NFSDBG_FILE |
42 | 42 | ||
43 | static int nfs_file_open(struct inode *, struct file *); | ||
44 | static int nfs_file_release(struct inode *, struct file *); | ||
45 | static loff_t nfs_file_llseek(struct file *file, loff_t offset, int origin); | ||
46 | static int nfs_file_mmap(struct file *, struct vm_area_struct *); | ||
47 | static ssize_t nfs_file_splice_read(struct file *filp, loff_t *ppos, | ||
48 | struct pipe_inode_info *pipe, | ||
49 | size_t count, unsigned int flags); | ||
50 | static ssize_t nfs_file_read(struct kiocb *, const struct iovec *iov, | ||
51 | unsigned long nr_segs, loff_t pos); | ||
52 | static ssize_t nfs_file_splice_write(struct pipe_inode_info *pipe, | ||
53 | struct file *filp, loff_t *ppos, | ||
54 | size_t count, unsigned int flags); | ||
55 | static ssize_t nfs_file_write(struct kiocb *, const struct iovec *iov, | ||
56 | unsigned long nr_segs, loff_t pos); | ||
57 | static int nfs_file_flush(struct file *, fl_owner_t id); | ||
58 | static int nfs_file_fsync(struct file *, loff_t, loff_t, int datasync); | ||
59 | static int nfs_check_flags(int flags); | ||
60 | static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl); | ||
61 | static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl); | ||
62 | static int nfs_setlease(struct file *file, long arg, struct file_lock **fl); | ||
63 | |||
64 | static const struct vm_operations_struct nfs_file_vm_ops; | 43 | static const struct vm_operations_struct nfs_file_vm_ops; |
65 | 44 | ||
66 | const struct file_operations nfs_file_operations = { | ||
67 | .llseek = nfs_file_llseek, | ||
68 | .read = do_sync_read, | ||
69 | .write = do_sync_write, | ||
70 | .aio_read = nfs_file_read, | ||
71 | .aio_write = nfs_file_write, | ||
72 | .mmap = nfs_file_mmap, | ||
73 | .open = nfs_file_open, | ||
74 | .flush = nfs_file_flush, | ||
75 | .release = nfs_file_release, | ||
76 | .fsync = nfs_file_fsync, | ||
77 | .lock = nfs_lock, | ||
78 | .flock = nfs_flock, | ||
79 | .splice_read = nfs_file_splice_read, | ||
80 | .splice_write = nfs_file_splice_write, | ||
81 | .check_flags = nfs_check_flags, | ||
82 | .setlease = nfs_setlease, | ||
83 | }; | ||
84 | |||
85 | const struct inode_operations nfs_file_inode_operations = { | 45 | const struct inode_operations nfs_file_inode_operations = { |
86 | .permission = nfs_permission, | 46 | .permission = nfs_permission, |
87 | .getattr = nfs_getattr, | 47 | .getattr = nfs_getattr, |
@@ -886,3 +846,54 @@ static int nfs_setlease(struct file *file, long arg, struct file_lock **fl) | |||
886 | file->f_path.dentry->d_name.name, arg); | 846 | file->f_path.dentry->d_name.name, arg); |
887 | return -EINVAL; | 847 | return -EINVAL; |
888 | } | 848 | } |
849 | |||
850 | const struct file_operations nfs_file_operations = { | ||
851 | .llseek = nfs_file_llseek, | ||
852 | .read = do_sync_read, | ||
853 | .write = do_sync_write, | ||
854 | .aio_read = nfs_file_read, | ||
855 | .aio_write = nfs_file_write, | ||
856 | .mmap = nfs_file_mmap, | ||
857 | .open = nfs_file_open, | ||
858 | .flush = nfs_file_flush, | ||
859 | .release = nfs_file_release, | ||
860 | .fsync = nfs_file_fsync, | ||
861 | .lock = nfs_lock, | ||
862 | .flock = nfs_flock, | ||
863 | .splice_read = nfs_file_splice_read, | ||
864 | .splice_write = nfs_file_splice_write, | ||
865 | .check_flags = nfs_check_flags, | ||
866 | .setlease = nfs_setlease, | ||
867 | }; | ||
868 | |||
869 | #ifdef CONFIG_NFS_V4 | ||
870 | static int | ||
871 | nfs4_file_open(struct inode *inode, struct file *filp) | ||
872 | { | ||
873 | /* | ||
874 | * NFSv4 opens are handled in d_lookup and d_revalidate. If we get to | ||
875 | * this point, then something is very wrong | ||
876 | */ | ||
877 | dprintk("NFS: %s called! inode=%p filp=%p\n", __func__, inode, filp); | ||
878 | return -ENOTDIR; | ||
879 | } | ||
880 | |||
881 | const struct file_operations nfs4_file_operations = { | ||
882 | .llseek = nfs_file_llseek, | ||
883 | .read = do_sync_read, | ||
884 | .write = do_sync_write, | ||
885 | .aio_read = nfs_file_read, | ||
886 | .aio_write = nfs_file_write, | ||
887 | .mmap = nfs_file_mmap, | ||
888 | .open = nfs4_file_open, | ||
889 | .flush = nfs_file_flush, | ||
890 | .release = nfs_file_release, | ||
891 | .fsync = nfs_file_fsync, | ||
892 | .lock = nfs_lock, | ||
893 | .flock = nfs_flock, | ||
894 | .splice_read = nfs_file_splice_read, | ||
895 | .splice_write = nfs_file_splice_write, | ||
896 | .check_flags = nfs_check_flags, | ||
897 | .setlease = nfs_setlease, | ||
898 | }; | ||
899 | #endif /* CONFIG_NFS_V4 */ | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index c07a55aec838..50a15fa8cf98 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -291,7 +291,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) | |||
291 | */ | 291 | */ |
292 | inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->file_inode_ops; | 292 | inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->file_inode_ops; |
293 | if (S_ISREG(inode->i_mode)) { | 293 | if (S_ISREG(inode->i_mode)) { |
294 | inode->i_fop = &nfs_file_operations; | 294 | inode->i_fop = NFS_SB(sb)->nfs_client->rpc_ops->file_ops; |
295 | inode->i_data.a_ops = &nfs_file_aops; | 295 | inode->i_data.a_ops = &nfs_file_aops; |
296 | inode->i_data.backing_dev_info = &NFS_SB(sb)->backing_dev_info; | 296 | inode->i_data.backing_dev_info = &NFS_SB(sb)->backing_dev_info; |
297 | } else if (S_ISDIR(inode->i_mode)) { | 297 | } else if (S_ISDIR(inode->i_mode)) { |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index c1a1bd8ddf1c..3f4d95751d52 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -299,6 +299,8 @@ extern void nfs_read_prepare(struct rpc_task *task, void *calldata); | |||
299 | extern int nfs_generic_pagein(struct nfs_pageio_descriptor *desc, | 299 | extern int nfs_generic_pagein(struct nfs_pageio_descriptor *desc, |
300 | struct list_head *head); | 300 | struct list_head *head); |
301 | 301 | ||
302 | extern void nfs_pageio_init_read_mds(struct nfs_pageio_descriptor *pgio, | ||
303 | struct inode *inode); | ||
302 | extern void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio); | 304 | extern void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio); |
303 | extern void nfs_readdata_release(struct nfs_read_data *rdata); | 305 | extern void nfs_readdata_release(struct nfs_read_data *rdata); |
304 | 306 | ||
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 85f1690ca08c..d4bc9ed91748 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -853,6 +853,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = { | |||
853 | .dentry_ops = &nfs_dentry_operations, | 853 | .dentry_ops = &nfs_dentry_operations, |
854 | .dir_inode_ops = &nfs3_dir_inode_operations, | 854 | .dir_inode_ops = &nfs3_dir_inode_operations, |
855 | .file_inode_ops = &nfs3_file_inode_operations, | 855 | .file_inode_ops = &nfs3_file_inode_operations, |
856 | .file_ops = &nfs_file_operations, | ||
856 | .getroot = nfs3_proc_get_root, | 857 | .getroot = nfs3_proc_get_root, |
857 | .getattr = nfs3_proc_getattr, | 858 | .getattr = nfs3_proc_getattr, |
858 | .setattr = nfs3_proc_setattr, | 859 | .setattr = nfs3_proc_setattr, |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b60fddf606f7..be2bbac13817 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2464,8 +2464,7 @@ static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qst | |||
2464 | case -NFS4ERR_BADNAME: | 2464 | case -NFS4ERR_BADNAME: |
2465 | return -ENOENT; | 2465 | return -ENOENT; |
2466 | case -NFS4ERR_MOVED: | 2466 | case -NFS4ERR_MOVED: |
2467 | err = nfs4_get_referral(dir, name, fattr, fhandle); | 2467 | return nfs4_get_referral(dir, name, fattr, fhandle); |
2468 | break; | ||
2469 | case -NFS4ERR_WRONGSEC: | 2468 | case -NFS4ERR_WRONGSEC: |
2470 | nfs_fixup_secinfo_attributes(fattr, fhandle); | 2469 | nfs_fixup_secinfo_attributes(fattr, fhandle); |
2471 | } | 2470 | } |
@@ -6253,6 +6252,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { | |||
6253 | .dentry_ops = &nfs4_dentry_operations, | 6252 | .dentry_ops = &nfs4_dentry_operations, |
6254 | .dir_inode_ops = &nfs4_dir_inode_operations, | 6253 | .dir_inode_ops = &nfs4_dir_inode_operations, |
6255 | .file_inode_ops = &nfs4_file_inode_operations, | 6254 | .file_inode_ops = &nfs4_file_inode_operations, |
6255 | .file_ops = &nfs4_file_operations, | ||
6256 | .getroot = nfs4_proc_get_root, | 6256 | .getroot = nfs4_proc_get_root, |
6257 | .getattr = nfs4_proc_getattr, | 6257 | .getattr = nfs4_proc_getattr, |
6258 | .setattr = nfs4_proc_setattr, | 6258 | .setattr = nfs4_proc_setattr, |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index baf73536bc04..8e672a2b2d69 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1260,6 +1260,25 @@ pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) | |||
1260 | } | 1260 | } |
1261 | EXPORT_SYMBOL_GPL(pnfs_generic_pg_writepages); | 1261 | EXPORT_SYMBOL_GPL(pnfs_generic_pg_writepages); |
1262 | 1262 | ||
1263 | static void pnfs_ld_handle_read_error(struct nfs_read_data *data) | ||
1264 | { | ||
1265 | struct nfs_pageio_descriptor pgio; | ||
1266 | |||
1267 | put_lseg(data->lseg); | ||
1268 | data->lseg = NULL; | ||
1269 | dprintk("pnfs write error = %d\n", data->pnfs_error); | ||
1270 | |||
1271 | nfs_pageio_init_read_mds(&pgio, data->inode); | ||
1272 | |||
1273 | while (!list_empty(&data->pages)) { | ||
1274 | struct nfs_page *req = nfs_list_entry(data->pages.next); | ||
1275 | |||
1276 | nfs_list_remove_request(req); | ||
1277 | nfs_pageio_add_request(&pgio, req); | ||
1278 | } | ||
1279 | nfs_pageio_complete(&pgio); | ||
1280 | } | ||
1281 | |||
1263 | /* | 1282 | /* |
1264 | * Called by non rpc-based layout drivers | 1283 | * Called by non rpc-based layout drivers |
1265 | */ | 1284 | */ |
@@ -1268,11 +1287,8 @@ void pnfs_ld_read_done(struct nfs_read_data *data) | |||
1268 | if (likely(!data->pnfs_error)) { | 1287 | if (likely(!data->pnfs_error)) { |
1269 | __nfs4_read_done_cb(data); | 1288 | __nfs4_read_done_cb(data); |
1270 | data->mds_ops->rpc_call_done(&data->task, data); | 1289 | data->mds_ops->rpc_call_done(&data->task, data); |
1271 | } else { | 1290 | } else |
1272 | put_lseg(data->lseg); | 1291 | pnfs_ld_handle_read_error(data); |
1273 | data->lseg = NULL; | ||
1274 | dprintk("pnfs write error = %d\n", data->pnfs_error); | ||
1275 | } | ||
1276 | data->mds_ops->rpc_release(data); | 1292 | data->mds_ops->rpc_release(data); |
1277 | } | 1293 | } |
1278 | EXPORT_SYMBOL_GPL(pnfs_ld_read_done); | 1294 | EXPORT_SYMBOL_GPL(pnfs_ld_read_done); |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index ac40b8535d7e..f48125da198a 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -710,6 +710,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = { | |||
710 | .dentry_ops = &nfs_dentry_operations, | 710 | .dentry_ops = &nfs_dentry_operations, |
711 | .dir_inode_ops = &nfs_dir_inode_operations, | 711 | .dir_inode_ops = &nfs_dir_inode_operations, |
712 | .file_inode_ops = &nfs_file_inode_operations, | 712 | .file_inode_ops = &nfs_file_inode_operations, |
713 | .file_ops = &nfs_file_operations, | ||
713 | .getroot = nfs_proc_get_root, | 714 | .getroot = nfs_proc_get_root, |
714 | .getattr = nfs_proc_getattr, | 715 | .getattr = nfs_proc_getattr, |
715 | .setattr = nfs_proc_setattr, | 716 | .setattr = nfs_proc_setattr, |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 8b48ec63f722..cfa175c223dc 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -109,7 +109,7 @@ static void nfs_readpage_truncate_uninitialised_page(struct nfs_read_data *data) | |||
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | static void nfs_pageio_init_read_mds(struct nfs_pageio_descriptor *pgio, | 112 | void nfs_pageio_init_read_mds(struct nfs_pageio_descriptor *pgio, |
113 | struct inode *inode) | 113 | struct inode *inode) |
114 | { | 114 | { |
115 | nfs_pageio_init(pgio, inode, &nfs_pageio_read_ops, | 115 | nfs_pageio_init(pgio, inode, &nfs_pageio_read_ops, |
@@ -534,23 +534,13 @@ static void nfs_readpage_result_full(struct rpc_task *task, void *calldata) | |||
534 | static void nfs_readpage_release_full(void *calldata) | 534 | static void nfs_readpage_release_full(void *calldata) |
535 | { | 535 | { |
536 | struct nfs_read_data *data = calldata; | 536 | struct nfs_read_data *data = calldata; |
537 | struct nfs_pageio_descriptor pgio; | ||
538 | 537 | ||
539 | if (data->pnfs_error) { | ||
540 | nfs_pageio_init_read_mds(&pgio, data->inode); | ||
541 | pgio.pg_recoalesce = 1; | ||
542 | } | ||
543 | while (!list_empty(&data->pages)) { | 538 | while (!list_empty(&data->pages)) { |
544 | struct nfs_page *req = nfs_list_entry(data->pages.next); | 539 | struct nfs_page *req = nfs_list_entry(data->pages.next); |
545 | 540 | ||
546 | nfs_list_remove_request(req); | 541 | nfs_list_remove_request(req); |
547 | if (!data->pnfs_error) | 542 | nfs_readpage_release(req); |
548 | nfs_readpage_release(req); | ||
549 | else | ||
550 | nfs_pageio_add_request(&pgio, req); | ||
551 | } | 543 | } |
552 | if (data->pnfs_error) | ||
553 | nfs_pageio_complete(&pgio); | ||
554 | nfs_readdata_release(calldata); | 544 | nfs_readdata_release(calldata); |
555 | } | 545 | } |
556 | 546 | ||
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 480b3b6bf71e..134777406ee3 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -2787,43 +2787,18 @@ static void nfs_referral_loop_unprotect(void) | |||
2787 | static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt, | 2787 | static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt, |
2788 | const char *export_path) | 2788 | const char *export_path) |
2789 | { | 2789 | { |
2790 | struct mnt_namespace *ns_private; | ||
2791 | struct super_block *s; | ||
2792 | struct dentry *dentry; | 2790 | struct dentry *dentry; |
2793 | struct path path; | 2791 | int ret = nfs_referral_loop_protect(); |
2794 | int ret; | ||
2795 | |||
2796 | ns_private = create_mnt_ns(root_mnt); | ||
2797 | ret = PTR_ERR(ns_private); | ||
2798 | if (IS_ERR(ns_private)) | ||
2799 | goto out_mntput; | ||
2800 | |||
2801 | ret = nfs_referral_loop_protect(); | ||
2802 | if (ret != 0) | ||
2803 | goto out_put_mnt_ns; | ||
2804 | 2792 | ||
2805 | ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt, | 2793 | if (ret) { |
2806 | export_path, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path); | 2794 | mntput(root_mnt); |
2795 | return ERR_PTR(ret); | ||
2796 | } | ||
2807 | 2797 | ||
2798 | dentry = mount_subtree(root_mnt, export_path); | ||
2808 | nfs_referral_loop_unprotect(); | 2799 | nfs_referral_loop_unprotect(); |
2809 | put_mnt_ns(ns_private); | ||
2810 | |||
2811 | if (ret != 0) | ||
2812 | goto out_err; | ||
2813 | |||
2814 | s = path.mnt->mnt_sb; | ||
2815 | atomic_inc(&s->s_active); | ||
2816 | dentry = dget(path.dentry); | ||
2817 | 2800 | ||
2818 | path_put(&path); | ||
2819 | down_write(&s->s_umount); | ||
2820 | return dentry; | 2801 | return dentry; |
2821 | out_put_mnt_ns: | ||
2822 | put_mnt_ns(ns_private); | ||
2823 | out_mntput: | ||
2824 | mntput(root_mnt); | ||
2825 | out_err: | ||
2826 | return ERR_PTR(ret); | ||
2827 | } | 2802 | } |
2828 | 2803 | ||
2829 | static struct dentry *nfs4_try_mount(int flags, const char *dev_name, | 2804 | static struct dentry *nfs4_try_mount(int flags, const char *dev_name, |
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index 5cff443f6cdb..0bbb1a41998b 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
@@ -674,7 +674,8 @@ xfs_qm_dqattach_one( | |||
674 | * disk and we didn't ask it to allocate; | 674 | * disk and we didn't ask it to allocate; |
675 | * ESRCH if quotas got turned off suddenly. | 675 | * ESRCH if quotas got turned off suddenly. |
676 | */ | 676 | */ |
677 | error = xfs_qm_dqget(ip->i_mount, ip, id, type, XFS_QMOPT_DOWARN, &dqp); | 677 | error = xfs_qm_dqget(ip->i_mount, ip, id, type, |
678 | doalloc | XFS_QMOPT_DOWARN, &dqp); | ||
678 | if (error) | 679 | if (error) |
679 | return error; | 680 | return error; |
680 | 681 | ||
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index d30bedfeb7ef..ddd46db65b57 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h | |||
@@ -235,6 +235,8 @@ struct drm_mode_fb_cmd { | |||
235 | #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 | 235 | #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 |
236 | #define DRM_MODE_FB_DIRTY_FLAGS 0x03 | 236 | #define DRM_MODE_FB_DIRTY_FLAGS 0x03 |
237 | 237 | ||
238 | #define DRM_MODE_FB_DIRTY_MAX_CLIPS 256 | ||
239 | |||
238 | /* | 240 | /* |
239 | * Mark a region of a framebuffer as dirty. | 241 | * Mark a region of a framebuffer as dirty. |
240 | * | 242 | * |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 3d53efd25ab9..f81676f1b310 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -4,6 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | #define radeon_PCI_IDS \ | 5 | #define radeon_PCI_IDS \ |
6 | {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ | 6 | {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ |
7 | {0x1002, 0x3151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
7 | {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 8 | {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
8 | {0x1002, 0x3154, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 9 | {0x1002, 0x3154, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
9 | {0x1002, 0x3155, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 10 | {0x1002, 0x3155, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
@@ -55,6 +56,7 @@ | |||
55 | {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ | 56 | {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ |
56 | {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ | 57 | {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ |
57 | {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ | 58 | {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ |
59 | {0x1002, 0x4C6E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \ | ||
58 | {0x1002, 0x4E44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ | 60 | {0x1002, 0x4E44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ |
59 | {0x1002, 0x4E45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ | 61 | {0x1002, 0x4E45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ |
60 | {0x1002, 0x4E46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ | 62 | {0x1002, 0x4E46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ |
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index b65be6054a18..be94be6d6f17 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
@@ -874,6 +874,10 @@ struct drm_radeon_gem_pwrite { | |||
874 | 874 | ||
875 | #define RADEON_CHUNK_ID_RELOCS 0x01 | 875 | #define RADEON_CHUNK_ID_RELOCS 0x01 |
876 | #define RADEON_CHUNK_ID_IB 0x02 | 876 | #define RADEON_CHUNK_ID_IB 0x02 |
877 | #define RADEON_CHUNK_ID_FLAGS 0x03 | ||
878 | |||
879 | /* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ | ||
880 | #define RADEON_CS_KEEP_TILING_FLAGS 0x01 | ||
877 | 881 | ||
878 | struct drm_radeon_cs_chunk { | 882 | struct drm_radeon_cs_chunk { |
879 | uint32_t chunk_id; | 883 | uint32_t chunk_id; |
diff --git a/include/linux/bio.h b/include/linux/bio.h index a3c071c9e189..847994aef0e9 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -211,8 +211,8 @@ extern void bio_pair_release(struct bio_pair *dbio); | |||
211 | extern struct bio_set *bioset_create(unsigned int, unsigned int); | 211 | extern struct bio_set *bioset_create(unsigned int, unsigned int); |
212 | extern void bioset_free(struct bio_set *); | 212 | extern void bioset_free(struct bio_set *); |
213 | 213 | ||
214 | extern struct bio *bio_alloc(gfp_t, int); | 214 | extern struct bio *bio_alloc(gfp_t, unsigned int); |
215 | extern struct bio *bio_kmalloc(gfp_t, int); | 215 | extern struct bio *bio_kmalloc(gfp_t, unsigned int); |
216 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); | 216 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); |
217 | extern void bio_put(struct bio *); | 217 | extern void bio_put(struct bio *); |
218 | extern void bio_free(struct bio *, struct bio_set *); | 218 | extern void bio_free(struct bio *, struct bio_set *); |
@@ -519,7 +519,11 @@ extern void bio_integrity_init(void); | |||
519 | #define bioset_integrity_create(a, b) (0) | 519 | #define bioset_integrity_create(a, b) (0) |
520 | #define bio_integrity_prep(a) (0) | 520 | #define bio_integrity_prep(a) (0) |
521 | #define bio_integrity_enabled(a) (0) | 521 | #define bio_integrity_enabled(a) (0) |
522 | #define bio_integrity_clone(a, b, c, d) (0) | 522 | static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src, |
523 | gfp_t gfp_mask, struct bio_set *bs) | ||
524 | { | ||
525 | return 0; | ||
526 | } | ||
523 | #define bioset_integrity_free(a) do { } while (0) | 527 | #define bioset_integrity_free(a) do { } while (0) |
524 | #define bio_integrity_free(a, b) do { } while (0) | 528 | #define bio_integrity_free(a, b) do { } while (0) |
525 | #define bio_integrity_endio(a, b) do { } while (0) | 529 | #define bio_integrity_endio(a, b) do { } while (0) |
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index f88eacb111d4..7c05ac202d90 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
@@ -10,6 +10,12 @@ | |||
10 | #include "osdmap.h" | 10 | #include "osdmap.h" |
11 | #include "messenger.h" | 11 | #include "messenger.h" |
12 | 12 | ||
13 | /* | ||
14 | * Maximum object name size | ||
15 | * (must be at least as big as RBD_MAX_MD_NAME_LEN -- currently 100) | ||
16 | */ | ||
17 | #define MAX_OBJ_NAME_SIZE 100 | ||
18 | |||
13 | struct ceph_msg; | 19 | struct ceph_msg; |
14 | struct ceph_snap_context; | 20 | struct ceph_snap_context; |
15 | struct ceph_osd_request; | 21 | struct ceph_osd_request; |
@@ -75,7 +81,7 @@ struct ceph_osd_request { | |||
75 | struct inode *r_inode; /* for use by callbacks */ | 81 | struct inode *r_inode; /* for use by callbacks */ |
76 | void *r_priv; /* ditto */ | 82 | void *r_priv; /* ditto */ |
77 | 83 | ||
78 | char r_oid[40]; /* object name */ | 84 | char r_oid[MAX_OBJ_NAME_SIZE]; /* object name */ |
79 | int r_oid_len; | 85 | int r_oid_len; |
80 | unsigned long r_stamp; /* send OR check time */ | 86 | unsigned long r_stamp; /* send OR check time */ |
81 | 87 | ||
diff --git a/include/linux/device.h b/include/linux/device.h index ffbcf95cd97d..3136ede5a1e1 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -69,7 +69,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | |||
69 | * @resume: Called to bring a device on this bus out of sleep mode. | 69 | * @resume: Called to bring a device on this bus out of sleep mode. |
70 | * @pm: Power management operations of this bus, callback the specific | 70 | * @pm: Power management operations of this bus, callback the specific |
71 | * device driver's pm-ops. | 71 | * device driver's pm-ops. |
72 | * @iommu_ops IOMMU specific operations for this bus, used to attach IOMMU | 72 | * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU |
73 | * driver implementations to a bus and allow the driver to do | 73 | * driver implementations to a bus and allow the driver to do |
74 | * bus-specific setup | 74 | * bus-specific setup |
75 | * @p: The private data of the driver core, only the driver core can | 75 | * @p: The private data of the driver core, only the driver core can |
@@ -682,6 +682,11 @@ static inline bool device_async_suspend_enabled(struct device *dev) | |||
682 | return !!dev->power.async_suspend; | 682 | return !!dev->power.async_suspend; |
683 | } | 683 | } |
684 | 684 | ||
685 | static inline void pm_suspend_ignore_children(struct device *dev, bool enable) | ||
686 | { | ||
687 | dev->power.ignore_children = enable; | ||
688 | } | ||
689 | |||
685 | static inline void device_lock(struct device *dev) | 690 | static inline void device_lock(struct device *dev) |
686 | { | 691 | { |
687 | mutex_lock(&dev->mutex); | 692 | mutex_lock(&dev->mutex); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 0c4df261af7e..e3130220ce3e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1886,6 +1886,7 @@ extern struct dentry *mount_single(struct file_system_type *fs_type, | |||
1886 | extern struct dentry *mount_nodev(struct file_system_type *fs_type, | 1886 | extern struct dentry *mount_nodev(struct file_system_type *fs_type, |
1887 | int flags, void *data, | 1887 | int flags, void *data, |
1888 | int (*fill_super)(struct super_block *, void *, int)); | 1888 | int (*fill_super)(struct super_block *, void *, int)); |
1889 | extern struct dentry *mount_subtree(struct vfsmount *mnt, const char *path); | ||
1889 | void generic_shutdown_super(struct super_block *sb); | 1890 | void generic_shutdown_super(struct super_block *sb); |
1890 | void kill_block_super(struct super_block *sb); | 1891 | void kill_block_super(struct super_block *sb); |
1891 | void kill_anon_super(struct super_block *sb); | 1892 | void kill_anon_super(struct super_block *sb); |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 9de31bc98c88..6d18f3531f18 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -21,8 +21,6 @@ | |||
21 | #define dev_to_part(device) container_of((device), struct hd_struct, __dev) | 21 | #define dev_to_part(device) container_of((device), struct hd_struct, __dev) |
22 | #define disk_to_dev(disk) (&(disk)->part0.__dev) | 22 | #define disk_to_dev(disk) (&(disk)->part0.__dev) |
23 | #define part_to_dev(part) (&((part)->__dev)) | 23 | #define part_to_dev(part) (&((part)->__dev)) |
24 | #define alias_name(disk) ((disk)->alias ? (disk)->alias : \ | ||
25 | (disk)->disk_name) | ||
26 | 24 | ||
27 | extern struct device_type part_type; | 25 | extern struct device_type part_type; |
28 | extern struct kobject *block_depr; | 26 | extern struct kobject *block_depr; |
@@ -60,7 +58,6 @@ enum { | |||
60 | 58 | ||
61 | #define DISK_MAX_PARTS 256 | 59 | #define DISK_MAX_PARTS 256 |
62 | #define DISK_NAME_LEN 32 | 60 | #define DISK_NAME_LEN 32 |
63 | #define ALIAS_LEN 256 | ||
64 | 61 | ||
65 | #include <linux/major.h> | 62 | #include <linux/major.h> |
66 | #include <linux/device.h> | 63 | #include <linux/device.h> |
@@ -166,7 +163,6 @@ struct gendisk { | |||
166 | * disks that can't be partitioned. */ | 163 | * disks that can't be partitioned. */ |
167 | 164 | ||
168 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ | 165 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ |
169 | char *alias; /* alias name of disk */ | ||
170 | char *(*devnode)(struct gendisk *gd, mode_t *mode); | 166 | char *(*devnode)(struct gendisk *gd, mode_t *mode); |
171 | 167 | ||
172 | unsigned int events; /* supported events */ | 168 | unsigned int events; /* supported events */ |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 19644e0016bd..d9d6c868b86b 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -110,11 +110,6 @@ static inline void copy_huge_page(struct page *dst, struct page *src) | |||
110 | 110 | ||
111 | #define hugetlb_change_protection(vma, address, end, newprot) | 111 | #define hugetlb_change_protection(vma, address, end, newprot) |
112 | 112 | ||
113 | #ifndef HPAGE_MASK | ||
114 | #define HPAGE_MASK PAGE_MASK /* Keep the compiler happy */ | ||
115 | #define HPAGE_SIZE PAGE_SIZE | ||
116 | #endif | ||
117 | |||
118 | #endif /* !CONFIG_HUGETLB_PAGE */ | 113 | #endif /* !CONFIG_HUGETLB_PAGE */ |
119 | 114 | ||
120 | #define HUGETLB_ANON_FILE "anon_hugepage" | 115 | #define HUGETLB_ANON_FILE "anon_hugepage" |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index a81bf6d23b3e..07d103a06d64 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -432,9 +432,6 @@ void i2c_unlock_adapter(struct i2c_adapter *); | |||
432 | /* Internal numbers to terminate lists */ | 432 | /* Internal numbers to terminate lists */ |
433 | #define I2C_CLIENT_END 0xfffeU | 433 | #define I2C_CLIENT_END 0xfffeU |
434 | 434 | ||
435 | /* The numbers to use to set I2C bus address */ | ||
436 | #define ANY_I2C_BUS 0xffff | ||
437 | |||
438 | /* Construct an I2C_CLIENT_END-terminated array of i2c addresses */ | 435 | /* Construct an I2C_CLIENT_END-terminated array of i2c addresses */ |
439 | #define I2C_ADDRS(addr, addrs...) \ | 436 | #define I2C_ADDRS(addr, addrs...) \ |
440 | ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END }) | 437 | ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END }) |
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h index 80b480c97532..abf5028db981 100644 --- a/include/linux/inet_diag.h +++ b/include/linux/inet_diag.h | |||
@@ -98,9 +98,10 @@ enum { | |||
98 | INET_DIAG_VEGASINFO, | 98 | INET_DIAG_VEGASINFO, |
99 | INET_DIAG_CONG, | 99 | INET_DIAG_CONG, |
100 | INET_DIAG_TOS, | 100 | INET_DIAG_TOS, |
101 | INET_DIAG_TCLASS, | ||
101 | }; | 102 | }; |
102 | 103 | ||
103 | #define INET_DIAG_MAX INET_DIAG_TOS | 104 | #define INET_DIAG_MAX INET_DIAG_TCLASS |
104 | 105 | ||
105 | 106 | ||
106 | /* INET_DIAG_MEM */ | 107 | /* INET_DIAG_MEM */ |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 08ffab01e76c..94b1e356c02a 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -184,7 +184,6 @@ extern struct cred init_cred; | |||
184 | [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ | 184 | [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ |
185 | }, \ | 185 | }, \ |
186 | .thread_group = LIST_HEAD_INIT(tsk.thread_group), \ | 186 | .thread_group = LIST_HEAD_INIT(tsk.thread_group), \ |
187 | .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ | ||
188 | INIT_IDS \ | 187 | INIT_IDS \ |
189 | INIT_PERF_EVENTS(tsk) \ | 188 | INIT_PERF_EVENTS(tsk) \ |
190 | INIT_TRACE_IRQFLAGS \ | 189 | INIT_TRACE_IRQFLAGS \ |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index f47fcd30273d..c3892fc1d538 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -555,7 +555,6 @@ struct kvm_ppc_pvinfo { | |||
555 | #define KVM_CAP_PPC_SMT 64 | 555 | #define KVM_CAP_PPC_SMT 64 |
556 | #define KVM_CAP_PPC_RMA 65 | 556 | #define KVM_CAP_PPC_RMA 65 |
557 | #define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ | 557 | #define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ |
558 | #define KVM_CAP_PPC_HIOR 67 | ||
559 | #define KVM_CAP_PPC_PAPR 68 | 558 | #define KVM_CAP_PPC_PAPR 68 |
560 | #define KVM_CAP_S390_GMAP 71 | 559 | #define KVM_CAP_S390_GMAP 71 |
561 | 560 | ||
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index 82b4c8801a4f..8bf2cb9502dd 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h | |||
@@ -243,7 +243,8 @@ | |||
243 | 243 | ||
244 | 244 | ||
245 | /*Registers VDD1, VDD2 voltage values definitions */ | 245 | /*Registers VDD1, VDD2 voltage values definitions */ |
246 | #define VDD1_2_NUM_VOLTS 73 | 246 | #define VDD1_2_NUM_VOLT_FINE 73 |
247 | #define VDD1_2_NUM_VOLT_COARSE 3 | ||
247 | #define VDD1_2_MIN_VOLT 6000 | 248 | #define VDD1_2_MIN_VOLT 6000 |
248 | #define VDD1_2_OFFSET 125 | 249 | #define VDD1_2_OFFSET 125 |
249 | 250 | ||
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index ab2c6343361a..92ecf5585fac 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -410,6 +410,9 @@ extern const struct inode_operations nfs_file_inode_operations; | |||
410 | extern const struct inode_operations nfs3_file_inode_operations; | 410 | extern const struct inode_operations nfs3_file_inode_operations; |
411 | #endif /* CONFIG_NFS_V3 */ | 411 | #endif /* CONFIG_NFS_V3 */ |
412 | extern const struct file_operations nfs_file_operations; | 412 | extern const struct file_operations nfs_file_operations; |
413 | #ifdef CONFIG_NFS_V4 | ||
414 | extern const struct file_operations nfs4_file_operations; | ||
415 | #endif /* CONFIG_NFS_V4 */ | ||
413 | extern const struct address_space_operations nfs_file_aops; | 416 | extern const struct address_space_operations nfs_file_aops; |
414 | extern const struct address_space_operations nfs_dir_aops; | 417 | extern const struct address_space_operations nfs_dir_aops; |
415 | 418 | ||
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index c74595ba7094..2a7c533be5dd 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -1192,6 +1192,7 @@ struct nfs_rpc_ops { | |||
1192 | const struct dentry_operations *dentry_ops; | 1192 | const struct dentry_operations *dentry_ops; |
1193 | const struct inode_operations *dir_inode_ops; | 1193 | const struct inode_operations *dir_inode_ops; |
1194 | const struct inode_operations *file_inode_ops; | 1194 | const struct inode_operations *file_inode_ops; |
1195 | const struct file_operations *file_ops; | ||
1195 | 1196 | ||
1196 | int (*getroot) (struct nfs_server *, struct nfs_fh *, | 1197 | int (*getroot) (struct nfs_server *, struct nfs_fh *, |
1197 | struct nfs_fsinfo *); | 1198 | struct nfs_fsinfo *); |
diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h index e3d0b3890249..7ef68724f0f0 100644 --- a/include/linux/pci-ats.h +++ b/include/linux/pci-ats.h | |||
@@ -12,7 +12,7 @@ struct pci_ats { | |||
12 | unsigned int is_enabled:1; /* Enable bit is set */ | 12 | unsigned int is_enabled:1; /* Enable bit is set */ |
13 | }; | 13 | }; |
14 | 14 | ||
15 | #ifdef CONFIG_PCI_IOV | 15 | #ifdef CONFIG_PCI_ATS |
16 | 16 | ||
17 | extern int pci_enable_ats(struct pci_dev *dev, int ps); | 17 | extern int pci_enable_ats(struct pci_dev *dev, int ps); |
18 | extern void pci_disable_ats(struct pci_dev *dev); | 18 | extern void pci_disable_ats(struct pci_dev *dev); |
@@ -29,7 +29,7 @@ static inline int pci_ats_enabled(struct pci_dev *dev) | |||
29 | return dev->ats && dev->ats->is_enabled; | 29 | return dev->ats && dev->ats->is_enabled; |
30 | } | 30 | } |
31 | 31 | ||
32 | #else /* CONFIG_PCI_IOV */ | 32 | #else /* CONFIG_PCI_ATS */ |
33 | 33 | ||
34 | static inline int pci_enable_ats(struct pci_dev *dev, int ps) | 34 | static inline int pci_enable_ats(struct pci_dev *dev, int ps) |
35 | { | 35 | { |
@@ -50,7 +50,7 @@ static inline int pci_ats_enabled(struct pci_dev *dev) | |||
50 | return 0; | 50 | return 0; |
51 | } | 51 | } |
52 | 52 | ||
53 | #endif /* CONFIG_PCI_IOV */ | 53 | #endif /* CONFIG_PCI_ATS */ |
54 | 54 | ||
55 | #ifdef CONFIG_PCI_PRI | 55 | #ifdef CONFIG_PCI_PRI |
56 | 56 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 337df0d5d5f7..7cda65b5f798 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -338,7 +338,7 @@ struct pci_dev { | |||
338 | struct list_head msi_list; | 338 | struct list_head msi_list; |
339 | #endif | 339 | #endif |
340 | struct pci_vpd *vpd; | 340 | struct pci_vpd *vpd; |
341 | #ifdef CONFIG_PCI_IOV | 341 | #ifdef CONFIG_PCI_ATS |
342 | union { | 342 | union { |
343 | struct pci_sriov *sriov; /* SR-IOV capability related */ | 343 | struct pci_sriov *sriov; /* SR-IOV capability related */ |
344 | struct pci_dev *physfn; /* the PF this VF is associated with */ | 344 | struct pci_dev *physfn; /* the PF this VF is associated with */ |
diff --git a/include/linux/pm.h b/include/linux/pm.h index f15acb646813..5c4c8b18c8b7 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -447,6 +447,7 @@ struct dev_pm_info { | |||
447 | unsigned int async_suspend:1; | 447 | unsigned int async_suspend:1; |
448 | bool is_prepared:1; /* Owned by the PM core */ | 448 | bool is_prepared:1; /* Owned by the PM core */ |
449 | bool is_suspended:1; /* Ditto */ | 449 | bool is_suspended:1; /* Ditto */ |
450 | bool ignore_children:1; | ||
450 | spinlock_t lock; | 451 | spinlock_t lock; |
451 | #ifdef CONFIG_PM_SLEEP | 452 | #ifdef CONFIG_PM_SLEEP |
452 | struct list_head entry; | 453 | struct list_head entry; |
@@ -464,7 +465,6 @@ struct dev_pm_info { | |||
464 | atomic_t usage_count; | 465 | atomic_t usage_count; |
465 | atomic_t child_count; | 466 | atomic_t child_count; |
466 | unsigned int disable_depth:3; | 467 | unsigned int disable_depth:3; |
467 | unsigned int ignore_children:1; | ||
468 | unsigned int idle_notification:1; | 468 | unsigned int idle_notification:1; |
469 | unsigned int request_pending:1; | 469 | unsigned int request_pending:1; |
470 | unsigned int deferred_resume:1; | 470 | unsigned int deferred_resume:1; |
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index d8d903619642..d3085e72a0ee 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
@@ -52,11 +52,6 @@ static inline bool pm_children_suspended(struct device *dev) | |||
52 | || !atomic_read(&dev->power.child_count); | 52 | || !atomic_read(&dev->power.child_count); |
53 | } | 53 | } |
54 | 54 | ||
55 | static inline void pm_suspend_ignore_children(struct device *dev, bool enable) | ||
56 | { | ||
57 | dev->power.ignore_children = enable; | ||
58 | } | ||
59 | |||
60 | static inline void pm_runtime_get_noresume(struct device *dev) | 55 | static inline void pm_runtime_get_noresume(struct device *dev) |
61 | { | 56 | { |
62 | atomic_inc(&dev->power.usage_count); | 57 | atomic_inc(&dev->power.usage_count); |
@@ -130,7 +125,6 @@ static inline void pm_runtime_allow(struct device *dev) {} | |||
130 | static inline void pm_runtime_forbid(struct device *dev) {} | 125 | static inline void pm_runtime_forbid(struct device *dev) {} |
131 | 126 | ||
132 | static inline bool pm_children_suspended(struct device *dev) { return false; } | 127 | static inline bool pm_children_suspended(struct device *dev) { return false; } |
133 | static inline void pm_suspend_ignore_children(struct device *dev, bool en) {} | ||
134 | static inline void pm_runtime_get_noresume(struct device *dev) {} | 128 | static inline void pm_runtime_get_noresume(struct device *dev) {} |
135 | static inline void pm_runtime_put_noidle(struct device *dev) {} | 129 | static inline void pm_runtime_put_noidle(struct device *dev) {} |
136 | static inline bool device_run_wake(struct device *dev) { return false; } | 130 | static inline bool device_run_wake(struct device *dev) { return false; } |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 68daf4f27e2c..1c4f3e9b9bc5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1521,7 +1521,6 @@ struct task_struct { | |||
1521 | #ifdef CONFIG_FAULT_INJECTION | 1521 | #ifdef CONFIG_FAULT_INJECTION |
1522 | int make_it_fail; | 1522 | int make_it_fail; |
1523 | #endif | 1523 | #endif |
1524 | struct prop_local_single dirties; | ||
1525 | /* | 1524 | /* |
1526 | * when (nr_dirtied >= nr_dirtied_pause), it's time to call | 1525 | * when (nr_dirtied >= nr_dirtied_pause), it's time to call |
1527 | * balance_dirty_pages() for some dirty throttling pause | 1526 | * balance_dirty_pages() for some dirty throttling pause |
diff --git a/include/linux/serial.h b/include/linux/serial.h index 97ff8e27a6cc..3d86517fe7d5 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h | |||
@@ -207,13 +207,15 @@ struct serial_icounter_struct { | |||
207 | 207 | ||
208 | struct serial_rs485 { | 208 | struct serial_rs485 { |
209 | __u32 flags; /* RS485 feature flags */ | 209 | __u32 flags; /* RS485 feature flags */ |
210 | #define SER_RS485_ENABLED (1 << 0) | 210 | #define SER_RS485_ENABLED (1 << 0) /* If enabled */ |
211 | #define SER_RS485_RTS_ON_SEND (1 << 1) | 211 | #define SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for |
212 | #define SER_RS485_RTS_AFTER_SEND (1 << 2) | 212 | RTS pin when |
213 | #define SER_RS485_RTS_BEFORE_SEND (1 << 3) | 213 | sending */ |
214 | #define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for | ||
215 | RTS pin after sent*/ | ||
214 | #define SER_RS485_RX_DURING_TX (1 << 4) | 216 | #define SER_RS485_RX_DURING_TX (1 << 4) |
215 | __u32 delay_rts_before_send; /* Milliseconds */ | 217 | __u32 delay_rts_before_send; /* Delay before send (milliseconds) */ |
216 | __u32 delay_rts_after_send; /* Milliseconds */ | 218 | __u32 delay_rts_after_send; /* Delay after send (milliseconds) */ |
217 | __u32 padding[5]; /* Memory is cheap, new structs | 219 | __u32 padding[5]; /* Memory is cheap, new structs |
218 | are a royal PITA .. */ | 220 | are a royal PITA .. */ |
219 | }; | 221 | }; |
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index add4790b21fe..e9e72bda1b72 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
@@ -85,6 +85,8 @@ | |||
85 | * @reset: reset the device | 85 | * @reset: reset the device |
86 | * vdev: the virtio device | 86 | * vdev: the virtio device |
87 | * After this, status and feature negotiation must be done again | 87 | * After this, status and feature negotiation must be done again |
88 | * Device must not be reset from its vq/config callbacks, or in | ||
89 | * parallel with being added/removed. | ||
88 | * @find_vqs: find virtqueues and instantiate them. | 90 | * @find_vqs: find virtqueues and instantiate them. |
89 | * vdev: the virtio_device | 91 | * vdev: the virtio_device |
90 | * nvqs: the number of virtqueues to find | 92 | * nvqs: the number of virtqueues to find |
diff --git a/include/linux/virtio_mmio.h b/include/linux/virtio_mmio.h index 27c7edefbc86..5c7b6f0daef8 100644 --- a/include/linux/virtio_mmio.h +++ b/include/linux/virtio_mmio.h | |||
@@ -63,7 +63,7 @@ | |||
63 | #define VIRTIO_MMIO_GUEST_FEATURES 0x020 | 63 | #define VIRTIO_MMIO_GUEST_FEATURES 0x020 |
64 | 64 | ||
65 | /* Activated features set selector - Write Only */ | 65 | /* Activated features set selector - Write Only */ |
66 | #define VIRTIO_MMIO_GUEST_FEATURES_SET 0x024 | 66 | #define VIRTIO_MMIO_GUEST_FEATURES_SEL 0x024 |
67 | 67 | ||
68 | /* Guest's memory page size in bytes - Write Only */ | 68 | /* Guest's memory page size in bytes - Write Only */ |
69 | #define VIRTIO_MMIO_GUEST_PAGE_SIZE 0x028 | 69 | #define VIRTIO_MMIO_GUEST_PAGE_SIZE 0x028 |
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 687fb11e2010..4bde182fcf93 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
@@ -119,7 +119,7 @@ unmap_kernel_range(unsigned long addr, unsigned long size) | |||
119 | #endif | 119 | #endif |
120 | 120 | ||
121 | /* Allocate/destroy a 'vmalloc' VM area. */ | 121 | /* Allocate/destroy a 'vmalloc' VM area. */ |
122 | extern struct vm_struct *alloc_vm_area(size_t size); | 122 | extern struct vm_struct *alloc_vm_area(size_t size, pte_t **ptes); |
123 | extern void free_vm_area(struct vm_struct *area); | 123 | extern void free_vm_area(struct vm_struct *area); |
124 | 124 | ||
125 | /* for /dev/kmem */ | 125 | /* for /dev/kmem */ |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index ab90ae0970a6..6cc18f371675 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -39,8 +39,11 @@ | |||
39 | #define L2CAP_DEFAULT_ACK_TO 200 | 39 | #define L2CAP_DEFAULT_ACK_TO 200 |
40 | #define L2CAP_LE_DEFAULT_MTU 23 | 40 | #define L2CAP_LE_DEFAULT_MTU 23 |
41 | 41 | ||
42 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 42 | #define L2CAP_DISC_TIMEOUT (100) |
43 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ | 43 | #define L2CAP_DISC_REJ_TIMEOUT (5000) /* 5 seconds */ |
44 | #define L2CAP_ENC_TIMEOUT (5000) /* 5 seconds */ | ||
45 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | ||
46 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ | ||
44 | 47 | ||
45 | /* L2CAP socket address */ | 48 | /* L2CAP socket address */ |
46 | struct sockaddr_l2 { | 49 | struct sockaddr_l2 { |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 92cf1c2c30c9..95852e36713b 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -456,6 +456,9 @@ enum station_parameters_apply_mask { | |||
456 | * as the AC bitmap in the QoS info field | 456 | * as the AC bitmap in the QoS info field |
457 | * @max_sp: max Service Period. same format as the MAX_SP in the | 457 | * @max_sp: max Service Period. same format as the MAX_SP in the |
458 | * QoS info field (but already shifted down) | 458 | * QoS info field (but already shifted down) |
459 | * @sta_modify_mask: bitmap indicating which parameters changed | ||
460 | * (for those that don't have a natural "no change" value), | ||
461 | * see &enum station_parameters_apply_mask | ||
459 | */ | 462 | */ |
460 | struct station_parameters { | 463 | struct station_parameters { |
461 | u8 *supported_rates; | 464 | u8 *supported_rates; |
@@ -615,6 +618,7 @@ struct sta_bss_parameters { | |||
615 | * user space MLME/SME implementation. The information is provided for | 618 | * user space MLME/SME implementation. The information is provided for |
616 | * the cfg80211_new_sta() calls to notify user space of the IEs. | 619 | * the cfg80211_new_sta() calls to notify user space of the IEs. |
617 | * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. | 620 | * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. |
621 | * @sta_flags: station flags mask & values | ||
618 | */ | 622 | */ |
619 | struct station_info { | 623 | struct station_info { |
620 | u32 filled; | 624 | u32 filled; |
diff --git a/include/xen/platform_pci.h b/include/xen/platform_pci.h index a785a3b0c8c7..438c256c274b 100644 --- a/include/xen/platform_pci.h +++ b/include/xen/platform_pci.h | |||
@@ -29,8 +29,7 @@ | |||
29 | static inline int xen_must_unplug_nics(void) { | 29 | static inline int xen_must_unplug_nics(void) { |
30 | #if (defined(CONFIG_XEN_NETDEV_FRONTEND) || \ | 30 | #if (defined(CONFIG_XEN_NETDEV_FRONTEND) || \ |
31 | defined(CONFIG_XEN_NETDEV_FRONTEND_MODULE)) && \ | 31 | defined(CONFIG_XEN_NETDEV_FRONTEND_MODULE)) && \ |
32 | (defined(CONFIG_XEN_PLATFORM_PCI) || \ | 32 | defined(CONFIG_XEN_PVHVM) |
33 | defined(CONFIG_XEN_PLATFORM_PCI_MODULE)) | ||
34 | return 1; | 33 | return 1; |
35 | #else | 34 | #else |
36 | return 0; | 35 | return 0; |
@@ -40,8 +39,7 @@ static inline int xen_must_unplug_nics(void) { | |||
40 | static inline int xen_must_unplug_disks(void) { | 39 | static inline int xen_must_unplug_disks(void) { |
41 | #if (defined(CONFIG_XEN_BLKDEV_FRONTEND) || \ | 40 | #if (defined(CONFIG_XEN_BLKDEV_FRONTEND) || \ |
42 | defined(CONFIG_XEN_BLKDEV_FRONTEND_MODULE)) && \ | 41 | defined(CONFIG_XEN_BLKDEV_FRONTEND_MODULE)) && \ |
43 | (defined(CONFIG_XEN_PLATFORM_PCI) || \ | 42 | defined(CONFIG_XEN_PVHVM) |
44 | defined(CONFIG_XEN_PLATFORM_PCI_MODULE)) | ||
45 | return 1; | 43 | return 1; |
46 | #else | 44 | #else |
47 | return 0; | 45 | return 0; |
diff --git a/kernel/fork.c b/kernel/fork.c index ba0d17261329..da4a6a10d088 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -162,7 +162,6 @@ static void account_kernel_stack(struct thread_info *ti, int account) | |||
162 | 162 | ||
163 | void free_task(struct task_struct *tsk) | 163 | void free_task(struct task_struct *tsk) |
164 | { | 164 | { |
165 | prop_local_destroy_single(&tsk->dirties); | ||
166 | account_kernel_stack(tsk->stack, -1); | 165 | account_kernel_stack(tsk->stack, -1); |
167 | free_thread_info(tsk->stack); | 166 | free_thread_info(tsk->stack); |
168 | rt_mutex_debug_task_free(tsk); | 167 | rt_mutex_debug_task_free(tsk); |
@@ -274,10 +273,6 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
274 | 273 | ||
275 | tsk->stack = ti; | 274 | tsk->stack = ti; |
276 | 275 | ||
277 | err = prop_local_init_single(&tsk->dirties); | ||
278 | if (err) | ||
279 | goto out; | ||
280 | |||
281 | setup_thread_stack(tsk, orig); | 276 | setup_thread_stack(tsk, orig); |
282 | clear_user_return_notifier(tsk); | 277 | clear_user_return_notifier(tsk); |
283 | clear_tsk_need_resched(tsk); | 278 | clear_tsk_need_resched(tsk); |
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index aa57d5da18c1..b5f4742693c0 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c | |||
@@ -115,7 +115,7 @@ static int misrouted_irq(int irq) | |||
115 | struct irq_desc *desc; | 115 | struct irq_desc *desc; |
116 | int i, ok = 0; | 116 | int i, ok = 0; |
117 | 117 | ||
118 | if (atomic_inc_return(&irq_poll_active) == 1) | 118 | if (atomic_inc_return(&irq_poll_active) != 1) |
119 | goto out; | 119 | goto out; |
120 | 120 | ||
121 | irq_poll_cpu = smp_processor_id(); | 121 | irq_poll_cpu = smp_processor_id(); |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index b4511b6d3ef9..196c01268ebd 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -55,6 +55,8 @@ enum { | |||
55 | 55 | ||
56 | static int hibernation_mode = HIBERNATION_SHUTDOWN; | 56 | static int hibernation_mode = HIBERNATION_SHUTDOWN; |
57 | 57 | ||
58 | static bool freezer_test_done; | ||
59 | |||
58 | static const struct platform_hibernation_ops *hibernation_ops; | 60 | static const struct platform_hibernation_ops *hibernation_ops; |
59 | 61 | ||
60 | /** | 62 | /** |
@@ -347,6 +349,17 @@ int hibernation_snapshot(int platform_mode) | |||
347 | if (error) | 349 | if (error) |
348 | goto Close; | 350 | goto Close; |
349 | 351 | ||
352 | if (hibernation_test(TEST_FREEZER) || | ||
353 | hibernation_testmode(HIBERNATION_TESTPROC)) { | ||
354 | |||
355 | /* | ||
356 | * Indicate to the caller that we are returning due to a | ||
357 | * successful freezer test. | ||
358 | */ | ||
359 | freezer_test_done = true; | ||
360 | goto Close; | ||
361 | } | ||
362 | |||
350 | error = dpm_prepare(PMSG_FREEZE); | 363 | error = dpm_prepare(PMSG_FREEZE); |
351 | if (error) | 364 | if (error) |
352 | goto Complete_devices; | 365 | goto Complete_devices; |
@@ -641,15 +654,13 @@ int hibernate(void) | |||
641 | if (error) | 654 | if (error) |
642 | goto Finish; | 655 | goto Finish; |
643 | 656 | ||
644 | if (hibernation_test(TEST_FREEZER)) | ||
645 | goto Thaw; | ||
646 | |||
647 | if (hibernation_testmode(HIBERNATION_TESTPROC)) | ||
648 | goto Thaw; | ||
649 | |||
650 | error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM); | 657 | error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM); |
651 | if (error) | 658 | if (error) |
652 | goto Thaw; | 659 | goto Thaw; |
660 | if (freezer_test_done) { | ||
661 | freezer_test_done = false; | ||
662 | goto Thaw; | ||
663 | } | ||
653 | 664 | ||
654 | if (in_suspend) { | 665 | if (in_suspend) { |
655 | unsigned int flags = 0; | 666 | unsigned int flags = 0; |
diff --git a/kernel/power/main.c b/kernel/power/main.c index 71f49fe4377e..36e0f0903c32 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -290,13 +290,14 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
290 | if (*s && len == strlen(*s) && !strncmp(buf, *s, len)) | 290 | if (*s && len == strlen(*s) && !strncmp(buf, *s, len)) |
291 | break; | 291 | break; |
292 | } | 292 | } |
293 | if (state < PM_SUSPEND_MAX && *s) | 293 | if (state < PM_SUSPEND_MAX && *s) { |
294 | error = enter_state(state); | 294 | error = enter_state(state); |
295 | if (error) { | 295 | if (error) { |
296 | suspend_stats.fail++; | 296 | suspend_stats.fail++; |
297 | dpm_save_failed_errno(error); | 297 | dpm_save_failed_errno(error); |
298 | } else | 298 | } else |
299 | suspend_stats.success++; | 299 | suspend_stats.success++; |
300 | } | ||
300 | #endif | 301 | #endif |
301 | 302 | ||
302 | Exit: | 303 | Exit: |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index a0860640378d..71034f41a2ba 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -724,6 +724,14 @@ void bdi_destroy(struct backing_dev_info *bdi) | |||
724 | 724 | ||
725 | bdi_unregister(bdi); | 725 | bdi_unregister(bdi); |
726 | 726 | ||
727 | /* | ||
728 | * If bdi_unregister() had already been called earlier, the | ||
729 | * wakeup_timer could still be armed because bdi_prune_sb() | ||
730 | * can race with the bdi_wakeup_thread_delayed() calls from | ||
731 | * __mark_inode_dirty(). | ||
732 | */ | ||
733 | del_timer_sync(&bdi->wb.wakeup_timer); | ||
734 | |||
727 | for (i = 0; i < NR_BDI_STAT_ITEMS; i++) | 735 | for (i = 0; i < NR_BDI_STAT_ITEMS; i++) |
728 | percpu_counter_destroy(&bdi->bdi_stat[i]); | 736 | percpu_counter_destroy(&bdi->bdi_stat[i]); |
729 | 737 | ||
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index dae27ba3be2c..bb28a5f9db8d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2422,6 +2422,8 @@ retry_avoidcopy: | |||
2422 | * anon_vma prepared. | 2422 | * anon_vma prepared. |
2423 | */ | 2423 | */ |
2424 | if (unlikely(anon_vma_prepare(vma))) { | 2424 | if (unlikely(anon_vma_prepare(vma))) { |
2425 | page_cache_release(new_page); | ||
2426 | page_cache_release(old_page); | ||
2425 | /* Caller expects lock to be held */ | 2427 | /* Caller expects lock to be held */ |
2426 | spin_lock(&mm->page_table_lock); | 2428 | spin_lock(&mm->page_table_lock); |
2427 | return VM_FAULT_OOM; | 2429 | return VM_FAULT_OOM; |
diff --git a/mm/nommu.c b/mm/nommu.c index 73419c55eda6..b982290fd962 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -454,7 +454,7 @@ void __attribute__((weak)) vmalloc_sync_all(void) | |||
454 | * between processes, it syncs the pagetable across all | 454 | * between processes, it syncs the pagetable across all |
455 | * processes. | 455 | * processes. |
456 | */ | 456 | */ |
457 | struct vm_struct *alloc_vm_area(size_t size) | 457 | struct vm_struct *alloc_vm_area(size_t size, pte_t **ptes) |
458 | { | 458 | { |
459 | BUG(); | 459 | BUG(); |
460 | return NULL; | 460 | return NULL; |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 471dedb463ab..76f2c5ae908e 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -185,6 +185,11 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, | |||
185 | if (!p) | 185 | if (!p) |
186 | return 0; | 186 | return 0; |
187 | 187 | ||
188 | if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) { | ||
189 | task_unlock(p); | ||
190 | return 0; | ||
191 | } | ||
192 | |||
188 | /* | 193 | /* |
189 | * The memory controller may have a limit of 0 bytes, so avoid a divide | 194 | * The memory controller may have a limit of 0 bytes, so avoid a divide |
190 | * by zero, if necessary. | 195 | * by zero, if necessary. |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index a3278f005230..71252486bc6f 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -128,7 +128,6 @@ unsigned long global_dirty_limit; | |||
128 | * | 128 | * |
129 | */ | 129 | */ |
130 | static struct prop_descriptor vm_completions; | 130 | static struct prop_descriptor vm_completions; |
131 | static struct prop_descriptor vm_dirties; | ||
132 | 131 | ||
133 | /* | 132 | /* |
134 | * couple the period to the dirty_ratio: | 133 | * couple the period to the dirty_ratio: |
@@ -154,7 +153,6 @@ static void update_completion_period(void) | |||
154 | { | 153 | { |
155 | int shift = calc_period_shift(); | 154 | int shift = calc_period_shift(); |
156 | prop_change_shift(&vm_completions, shift); | 155 | prop_change_shift(&vm_completions, shift); |
157 | prop_change_shift(&vm_dirties, shift); | ||
158 | 156 | ||
159 | writeback_set_ratelimit(); | 157 | writeback_set_ratelimit(); |
160 | } | 158 | } |
@@ -235,11 +233,6 @@ void bdi_writeout_inc(struct backing_dev_info *bdi) | |||
235 | } | 233 | } |
236 | EXPORT_SYMBOL_GPL(bdi_writeout_inc); | 234 | EXPORT_SYMBOL_GPL(bdi_writeout_inc); |
237 | 235 | ||
238 | void task_dirty_inc(struct task_struct *tsk) | ||
239 | { | ||
240 | prop_inc_single(&vm_dirties, &tsk->dirties); | ||
241 | } | ||
242 | |||
243 | /* | 236 | /* |
244 | * Obtain an accurate fraction of the BDI's portion. | 237 | * Obtain an accurate fraction of the BDI's portion. |
245 | */ | 238 | */ |
@@ -1133,17 +1126,17 @@ pause: | |||
1133 | pages_dirtied, | 1126 | pages_dirtied, |
1134 | pause, | 1127 | pause, |
1135 | start_time); | 1128 | start_time); |
1136 | __set_current_state(TASK_UNINTERRUPTIBLE); | 1129 | __set_current_state(TASK_KILLABLE); |
1137 | io_schedule_timeout(pause); | 1130 | io_schedule_timeout(pause); |
1138 | 1131 | ||
1139 | dirty_thresh = hard_dirty_limit(dirty_thresh); | ||
1140 | /* | 1132 | /* |
1141 | * max-pause area. If dirty exceeded but still within this | 1133 | * This is typically equal to (nr_dirty < dirty_thresh) and can |
1142 | * area, no need to sleep for more than 200ms: (a) 8 pages per | 1134 | * also keep "1000+ dd on a slow USB stick" under control. |
1143 | * 200ms is typically more than enough to curb heavy dirtiers; | ||
1144 | * (b) the pause time limit makes the dirtiers more responsive. | ||
1145 | */ | 1135 | */ |
1146 | if (nr_dirty < dirty_thresh) | 1136 | if (task_ratelimit) |
1137 | break; | ||
1138 | |||
1139 | if (fatal_signal_pending(current)) | ||
1147 | break; | 1140 | break; |
1148 | } | 1141 | } |
1149 | 1142 | ||
@@ -1395,7 +1388,6 @@ void __init page_writeback_init(void) | |||
1395 | 1388 | ||
1396 | shift = calc_period_shift(); | 1389 | shift = calc_period_shift(); |
1397 | prop_descriptor_init(&vm_completions, shift); | 1390 | prop_descriptor_init(&vm_completions, shift); |
1398 | prop_descriptor_init(&vm_dirties, shift); | ||
1399 | } | 1391 | } |
1400 | 1392 | ||
1401 | /** | 1393 | /** |
@@ -1724,7 +1716,6 @@ void account_page_dirtied(struct page *page, struct address_space *mapping) | |||
1724 | __inc_zone_page_state(page, NR_DIRTIED); | 1716 | __inc_zone_page_state(page, NR_DIRTIED); |
1725 | __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE); | 1717 | __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE); |
1726 | __inc_bdi_stat(mapping->backing_dev_info, BDI_DIRTIED); | 1718 | __inc_bdi_stat(mapping->backing_dev_info, BDI_DIRTIED); |
1727 | task_dirty_inc(current); | ||
1728 | task_io_account_write(PAGE_CACHE_SIZE); | 1719 | task_io_account_write(PAGE_CACHE_SIZE); |
1729 | } | 1720 | } |
1730 | } | 1721 | } |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index b669aa6f6caf..3231bf332878 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -2141,23 +2141,30 @@ void __attribute__((weak)) vmalloc_sync_all(void) | |||
2141 | 2141 | ||
2142 | static int f(pte_t *pte, pgtable_t table, unsigned long addr, void *data) | 2142 | static int f(pte_t *pte, pgtable_t table, unsigned long addr, void *data) |
2143 | { | 2143 | { |
2144 | /* apply_to_page_range() does all the hard work. */ | 2144 | pte_t ***p = data; |
2145 | |||
2146 | if (p) { | ||
2147 | *(*p) = pte; | ||
2148 | (*p)++; | ||
2149 | } | ||
2145 | return 0; | 2150 | return 0; |
2146 | } | 2151 | } |
2147 | 2152 | ||
2148 | /** | 2153 | /** |
2149 | * alloc_vm_area - allocate a range of kernel address space | 2154 | * alloc_vm_area - allocate a range of kernel address space |
2150 | * @size: size of the area | 2155 | * @size: size of the area |
2156 | * @ptes: returns the PTEs for the address space | ||
2151 | * | 2157 | * |
2152 | * Returns: NULL on failure, vm_struct on success | 2158 | * Returns: NULL on failure, vm_struct on success |
2153 | * | 2159 | * |
2154 | * This function reserves a range of kernel address space, and | 2160 | * This function reserves a range of kernel address space, and |
2155 | * allocates pagetables to map that range. No actual mappings | 2161 | * allocates pagetables to map that range. No actual mappings |
2156 | * are created. If the kernel address space is not shared | 2162 | * are created. |
2157 | * between processes, it syncs the pagetable across all | 2163 | * |
2158 | * processes. | 2164 | * If @ptes is non-NULL, pointers to the PTEs (in init_mm) |
2165 | * allocated for the VM area are returned. | ||
2159 | */ | 2166 | */ |
2160 | struct vm_struct *alloc_vm_area(size_t size) | 2167 | struct vm_struct *alloc_vm_area(size_t size, pte_t **ptes) |
2161 | { | 2168 | { |
2162 | struct vm_struct *area; | 2169 | struct vm_struct *area; |
2163 | 2170 | ||
@@ -2171,19 +2178,11 @@ struct vm_struct *alloc_vm_area(size_t size) | |||
2171 | * of kernel virtual address space and mapped into init_mm. | 2178 | * of kernel virtual address space and mapped into init_mm. |
2172 | */ | 2179 | */ |
2173 | if (apply_to_page_range(&init_mm, (unsigned long)area->addr, | 2180 | if (apply_to_page_range(&init_mm, (unsigned long)area->addr, |
2174 | area->size, f, NULL)) { | 2181 | size, f, ptes ? &ptes : NULL)) { |
2175 | free_vm_area(area); | 2182 | free_vm_area(area); |
2176 | return NULL; | 2183 | return NULL; |
2177 | } | 2184 | } |
2178 | 2185 | ||
2179 | /* | ||
2180 | * If the allocated address space is passed to a hypercall | ||
2181 | * before being used then we cannot rely on a page fault to | ||
2182 | * trigger an update of the page tables. So sync all the page | ||
2183 | * tables here. | ||
2184 | */ | ||
2185 | vmalloc_sync_all(); | ||
2186 | |||
2187 | return area; | 2186 | return area; |
2188 | } | 2187 | } |
2189 | EXPORT_SYMBOL_GPL(alloc_vm_area); | 2188 | EXPORT_SYMBOL_GPL(alloc_vm_area); |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index c1c597e3e198..e0af7237cd92 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -673,7 +673,7 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
673 | goto encrypt; | 673 | goto encrypt; |
674 | 674 | ||
675 | auth: | 675 | auth: |
676 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) | 676 | if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) |
677 | return 0; | 677 | return 0; |
678 | 678 | ||
679 | if (!hci_conn_auth(conn, sec_level, auth_type)) | 679 | if (!hci_conn_auth(conn, sec_level, auth_type)) |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 8cd12917733b..5ea94a1eecf2 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -251,7 +251,7 @@ static void l2cap_chan_timeout(unsigned long arg) | |||
251 | 251 | ||
252 | if (sock_owned_by_user(sk)) { | 252 | if (sock_owned_by_user(sk)) { |
253 | /* sk is owned by user. Try again later */ | 253 | /* sk is owned by user. Try again later */ |
254 | __set_chan_timer(chan, HZ / 5); | 254 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
255 | bh_unlock_sock(sk); | 255 | bh_unlock_sock(sk); |
256 | chan_put(chan); | 256 | chan_put(chan); |
257 | return; | 257 | return; |
@@ -2488,7 +2488,7 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
2488 | if (sock_owned_by_user(sk)) { | 2488 | if (sock_owned_by_user(sk)) { |
2489 | l2cap_state_change(chan, BT_DISCONN); | 2489 | l2cap_state_change(chan, BT_DISCONN); |
2490 | __clear_chan_timer(chan); | 2490 | __clear_chan_timer(chan); |
2491 | __set_chan_timer(chan, HZ / 5); | 2491 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
2492 | break; | 2492 | break; |
2493 | } | 2493 | } |
2494 | 2494 | ||
@@ -2661,7 +2661,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
2661 | 2661 | ||
2662 | default: | 2662 | default: |
2663 | sk->sk_err = ECONNRESET; | 2663 | sk->sk_err = ECONNRESET; |
2664 | __set_chan_timer(chan, HZ * 5); | 2664 | __set_chan_timer(chan, L2CAP_DISC_REJ_TIMEOUT); |
2665 | l2cap_send_disconn_req(conn, chan, ECONNRESET); | 2665 | l2cap_send_disconn_req(conn, chan, ECONNRESET); |
2666 | goto done; | 2666 | goto done; |
2667 | } | 2667 | } |
@@ -2718,7 +2718,7 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd | |||
2718 | if (sock_owned_by_user(sk)) { | 2718 | if (sock_owned_by_user(sk)) { |
2719 | l2cap_state_change(chan, BT_DISCONN); | 2719 | l2cap_state_change(chan, BT_DISCONN); |
2720 | __clear_chan_timer(chan); | 2720 | __clear_chan_timer(chan); |
2721 | __set_chan_timer(chan, HZ / 5); | 2721 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
2722 | bh_unlock_sock(sk); | 2722 | bh_unlock_sock(sk); |
2723 | return 0; | 2723 | return 0; |
2724 | } | 2724 | } |
@@ -2752,7 +2752,7 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, struct l2cap_cmd | |||
2752 | if (sock_owned_by_user(sk)) { | 2752 | if (sock_owned_by_user(sk)) { |
2753 | l2cap_state_change(chan,BT_DISCONN); | 2753 | l2cap_state_change(chan,BT_DISCONN); |
2754 | __clear_chan_timer(chan); | 2754 | __clear_chan_timer(chan); |
2755 | __set_chan_timer(chan, HZ / 5); | 2755 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
2756 | bh_unlock_sock(sk); | 2756 | bh_unlock_sock(sk); |
2757 | return 0; | 2757 | return 0; |
2758 | } | 2758 | } |
@@ -3998,7 +3998,7 @@ static inline void l2cap_check_encryption(struct l2cap_chan *chan, u8 encrypt) | |||
3998 | if (encrypt == 0x00) { | 3998 | if (encrypt == 0x00) { |
3999 | if (chan->sec_level == BT_SECURITY_MEDIUM) { | 3999 | if (chan->sec_level == BT_SECURITY_MEDIUM) { |
4000 | __clear_chan_timer(chan); | 4000 | __clear_chan_timer(chan); |
4001 | __set_chan_timer(chan, HZ * 5); | 4001 | __set_chan_timer(chan, L2CAP_ENC_TIMEOUT); |
4002 | } else if (chan->sec_level == BT_SECURITY_HIGH) | 4002 | } else if (chan->sec_level == BT_SECURITY_HIGH) |
4003 | l2cap_chan_close(chan, ECONNREFUSED); | 4003 | l2cap_chan_close(chan, ECONNREFUSED); |
4004 | } else { | 4004 | } else { |
@@ -4066,7 +4066,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) | |||
4066 | L2CAP_CONN_REQ, sizeof(req), &req); | 4066 | L2CAP_CONN_REQ, sizeof(req), &req); |
4067 | } else { | 4067 | } else { |
4068 | __clear_chan_timer(chan); | 4068 | __clear_chan_timer(chan); |
4069 | __set_chan_timer(chan, HZ / 10); | 4069 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
4070 | } | 4070 | } |
4071 | } else if (chan->state == BT_CONNECT2) { | 4071 | } else if (chan->state == BT_CONNECT2) { |
4072 | struct l2cap_conn_rsp rsp; | 4072 | struct l2cap_conn_rsp rsp; |
@@ -4086,7 +4086,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) | |||
4086 | } | 4086 | } |
4087 | } else { | 4087 | } else { |
4088 | l2cap_state_change(chan, BT_DISCONN); | 4088 | l2cap_state_change(chan, BT_DISCONN); |
4089 | __set_chan_timer(chan, HZ / 10); | 4089 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
4090 | res = L2CAP_CR_SEC_BLOCK; | 4090 | res = L2CAP_CR_SEC_BLOCK; |
4091 | stat = L2CAP_CS_NO_INFO; | 4091 | stat = L2CAP_CS_NO_INFO; |
4092 | } | 4092 | } |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 995cbe0ac0b2..a5f4e5769809 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1501,6 +1501,8 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
1501 | 1501 | ||
1502 | __skb_pull(skb2, offset); | 1502 | __skb_pull(skb2, offset); |
1503 | skb_reset_transport_header(skb2); | 1503 | skb_reset_transport_header(skb2); |
1504 | skb_postpull_rcsum(skb2, skb_network_header(skb2), | ||
1505 | skb_network_header_len(skb2)); | ||
1504 | 1506 | ||
1505 | icmp6_type = icmp6_hdr(skb2)->icmp6_type; | 1507 | icmp6_type = icmp6_hdr(skb2)->icmp6_type; |
1506 | 1508 | ||
@@ -1770,7 +1772,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val) | |||
1770 | int err = 0; | 1772 | int err = 0; |
1771 | struct net_bridge_mdb_htable *mdb; | 1773 | struct net_bridge_mdb_htable *mdb; |
1772 | 1774 | ||
1773 | spin_lock(&br->multicast_lock); | 1775 | spin_lock_bh(&br->multicast_lock); |
1774 | if (br->multicast_disabled == !val) | 1776 | if (br->multicast_disabled == !val) |
1775 | goto unlock; | 1777 | goto unlock; |
1776 | 1778 | ||
@@ -1806,7 +1808,7 @@ rollback: | |||
1806 | } | 1808 | } |
1807 | 1809 | ||
1808 | unlock: | 1810 | unlock: |
1809 | spin_unlock(&br->multicast_lock); | 1811 | spin_unlock_bh(&br->multicast_lock); |
1810 | 1812 | ||
1811 | return err; | 1813 | return err; |
1812 | } | 1814 | } |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 733e46008b89..f4f3f58f5234 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -244,7 +244,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, | |||
244 | ceph_pagelist_init(req->r_trail); | 244 | ceph_pagelist_init(req->r_trail); |
245 | } | 245 | } |
246 | /* create request message; allow space for oid */ | 246 | /* create request message; allow space for oid */ |
247 | msg_size += 40; | 247 | msg_size += MAX_OBJ_NAME_SIZE; |
248 | if (snapc) | 248 | if (snapc) |
249 | msg_size += sizeof(u64) * snapc->num_snaps; | 249 | msg_size += sizeof(u64) * snapc->num_snaps; |
250 | if (use_mempool) | 250 | if (use_mempool) |
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index c1f4154552fc..36d14406261e 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -136,8 +136,6 @@ static void ah_output_done(struct crypto_async_request *base, int err) | |||
136 | memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); | 136 | memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); |
137 | } | 137 | } |
138 | 138 | ||
139 | err = ah->nexthdr; | ||
140 | |||
141 | kfree(AH_SKB_CB(skb)->tmp); | 139 | kfree(AH_SKB_CB(skb)->tmp); |
142 | xfrm_output_resume(skb, err); | 140 | xfrm_output_resume(skb, err); |
143 | } | 141 | } |
@@ -264,12 +262,12 @@ static void ah_input_done(struct crypto_async_request *base, int err) | |||
264 | if (err) | 262 | if (err) |
265 | goto out; | 263 | goto out; |
266 | 264 | ||
265 | err = ah->nexthdr; | ||
266 | |||
267 | skb->network_header += ah_hlen; | 267 | skb->network_header += ah_hlen; |
268 | memcpy(skb_network_header(skb), work_iph, ihl); | 268 | memcpy(skb_network_header(skb), work_iph, ihl); |
269 | __skb_pull(skb, ah_hlen + ihl); | 269 | __skb_pull(skb, ah_hlen + ihl); |
270 | skb_set_transport_header(skb, -ihl); | 270 | skb_set_transport_header(skb, -ihl); |
271 | |||
272 | err = ah->nexthdr; | ||
273 | out: | 271 | out: |
274 | kfree(AH_SKB_CB(skb)->tmp); | 272 | kfree(AH_SKB_CB(skb)->tmp); |
275 | xfrm_input_resume(skb, err); | 273 | xfrm_input_resume(skb, err); |
@@ -371,8 +369,6 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) | |||
371 | if (err == -EINPROGRESS) | 369 | if (err == -EINPROGRESS) |
372 | goto out; | 370 | goto out; |
373 | 371 | ||
374 | if (err == -EBUSY) | ||
375 | err = NET_XMIT_DROP; | ||
376 | goto out_free; | 372 | goto out_free; |
377 | } | 373 | } |
378 | 374 | ||
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index f5e2bdaef949..68e8ac514383 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -133,8 +133,8 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
133 | &np->rcv_saddr); | 133 | &np->rcv_saddr); |
134 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, | 134 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, |
135 | &np->daddr); | 135 | &np->daddr); |
136 | if (ext & (1 << (INET_DIAG_TOS - 1))) | 136 | if (ext & (1 << (INET_DIAG_TCLASS - 1))) |
137 | RTA_PUT_U8(skb, INET_DIAG_TOS, np->tclass); | 137 | RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass); |
138 | } | 138 | } |
139 | #endif | 139 | #endif |
140 | 140 | ||
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index ec93335901dd..05d20cca9d66 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -640,6 +640,7 @@ int ip_options_rcv_srr(struct sk_buff *skb) | |||
640 | } | 640 | } |
641 | if (srrptr <= srrspace) { | 641 | if (srrptr <= srrspace) { |
642 | opt->srr_is_hit = 1; | 642 | opt->srr_is_hit = 1; |
643 | iph->daddr = nexthop; | ||
643 | opt->is_changed = 1; | 644 | opt->is_changed = 1; |
644 | } | 645 | } |
645 | return 0; | 646 | return 0; |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index a06f73fdb3c0..43d4c3b22369 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -339,7 +339,6 @@ void ping_err(struct sk_buff *skb, u32 info) | |||
339 | sk = ping_v4_lookup(net, iph->daddr, iph->saddr, | 339 | sk = ping_v4_lookup(net, iph->daddr, iph->saddr, |
340 | ntohs(icmph->un.echo.id), skb->dev->ifindex); | 340 | ntohs(icmph->un.echo.id), skb->dev->ifindex); |
341 | if (sk == NULL) { | 341 | if (sk == NULL) { |
342 | ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); | ||
343 | pr_debug("no socket, dropping\n"); | 342 | pr_debug("no socket, dropping\n"); |
344 | return; /* No socket for error */ | 343 | return; /* No socket for error */ |
345 | } | 344 | } |
@@ -679,7 +678,6 @@ static int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
679 | pr_debug("ping_queue_rcv_skb(sk=%p,sk->num=%d,skb=%p)\n", | 678 | pr_debug("ping_queue_rcv_skb(sk=%p,sk->num=%d,skb=%p)\n", |
680 | inet_sk(sk), inet_sk(sk)->inet_num, skb); | 679 | inet_sk(sk), inet_sk(sk)->inet_num, skb); |
681 | if (sock_queue_rcv_skb(sk, skb) < 0) { | 680 | if (sock_queue_rcv_skb(sk, skb) < 0) { |
682 | ICMP_INC_STATS_BH(sock_net(sk), ICMP_MIB_INERRORS); | ||
683 | kfree_skb(skb); | 681 | kfree_skb(skb); |
684 | pr_debug("ping_queue_rcv_skb -> failed\n"); | 682 | pr_debug("ping_queue_rcv_skb -> failed\n"); |
685 | return -1; | 683 | return -1; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 155138d8ec8b..0c74da8a0473 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1304,16 +1304,42 @@ static void rt_del(unsigned hash, struct rtable *rt) | |||
1304 | spin_unlock_bh(rt_hash_lock_addr(hash)); | 1304 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) | ||
1308 | { | ||
1309 | struct rtable *rt = (struct rtable *) dst; | ||
1310 | __be32 orig_gw = rt->rt_gateway; | ||
1311 | struct neighbour *n, *old_n; | ||
1312 | |||
1313 | dst_confirm(&rt->dst); | ||
1314 | |||
1315 | rt->rt_gateway = peer->redirect_learned.a4; | ||
1316 | |||
1317 | n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway); | ||
1318 | if (IS_ERR(n)) | ||
1319 | return PTR_ERR(n); | ||
1320 | old_n = xchg(&rt->dst._neighbour, n); | ||
1321 | if (old_n) | ||
1322 | neigh_release(old_n); | ||
1323 | if (!n || !(n->nud_state & NUD_VALID)) { | ||
1324 | if (n) | ||
1325 | neigh_event_send(n, NULL); | ||
1326 | rt->rt_gateway = orig_gw; | ||
1327 | return -EAGAIN; | ||
1328 | } else { | ||
1329 | rt->rt_flags |= RTCF_REDIRECTED; | ||
1330 | call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n); | ||
1331 | } | ||
1332 | return 0; | ||
1333 | } | ||
1334 | |||
1307 | /* called in rcu_read_lock() section */ | 1335 | /* called in rcu_read_lock() section */ |
1308 | void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | 1336 | void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, |
1309 | __be32 saddr, struct net_device *dev) | 1337 | __be32 saddr, struct net_device *dev) |
1310 | { | 1338 | { |
1311 | int s, i; | 1339 | int s, i; |
1312 | struct in_device *in_dev = __in_dev_get_rcu(dev); | 1340 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
1313 | struct rtable *rt; | ||
1314 | __be32 skeys[2] = { saddr, 0 }; | 1341 | __be32 skeys[2] = { saddr, 0 }; |
1315 | int ikeys[2] = { dev->ifindex, 0 }; | 1342 | int ikeys[2] = { dev->ifindex, 0 }; |
1316 | struct flowi4 fl4; | ||
1317 | struct inet_peer *peer; | 1343 | struct inet_peer *peer; |
1318 | struct net *net; | 1344 | struct net *net; |
1319 | 1345 | ||
@@ -1336,33 +1362,42 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1336 | goto reject_redirect; | 1362 | goto reject_redirect; |
1337 | } | 1363 | } |
1338 | 1364 | ||
1339 | memset(&fl4, 0, sizeof(fl4)); | ||
1340 | fl4.daddr = daddr; | ||
1341 | for (s = 0; s < 2; s++) { | 1365 | for (s = 0; s < 2; s++) { |
1342 | for (i = 0; i < 2; i++) { | 1366 | for (i = 0; i < 2; i++) { |
1343 | fl4.flowi4_oif = ikeys[i]; | 1367 | unsigned int hash; |
1344 | fl4.saddr = skeys[s]; | 1368 | struct rtable __rcu **rthp; |
1345 | rt = __ip_route_output_key(net, &fl4); | 1369 | struct rtable *rt; |
1346 | if (IS_ERR(rt)) | 1370 | |
1347 | continue; | 1371 | hash = rt_hash(daddr, skeys[s], ikeys[i], rt_genid(net)); |
1348 | 1372 | ||
1349 | if (rt->dst.error || rt->dst.dev != dev || | 1373 | rthp = &rt_hash_table[hash].chain; |
1350 | rt->rt_gateway != old_gw) { | 1374 | |
1351 | ip_rt_put(rt); | 1375 | while ((rt = rcu_dereference(*rthp)) != NULL) { |
1352 | continue; | 1376 | rthp = &rt->dst.rt_next; |
1353 | } | 1377 | |
1378 | if (rt->rt_key_dst != daddr || | ||
1379 | rt->rt_key_src != skeys[s] || | ||
1380 | rt->rt_oif != ikeys[i] || | ||
1381 | rt_is_input_route(rt) || | ||
1382 | rt_is_expired(rt) || | ||
1383 | !net_eq(dev_net(rt->dst.dev), net) || | ||
1384 | rt->dst.error || | ||
1385 | rt->dst.dev != dev || | ||
1386 | rt->rt_gateway != old_gw) | ||
1387 | continue; | ||
1354 | 1388 | ||
1355 | if (!rt->peer) | 1389 | if (!rt->peer) |
1356 | rt_bind_peer(rt, rt->rt_dst, 1); | 1390 | rt_bind_peer(rt, rt->rt_dst, 1); |
1357 | 1391 | ||
1358 | peer = rt->peer; | 1392 | peer = rt->peer; |
1359 | if (peer) { | 1393 | if (peer) { |
1360 | peer->redirect_learned.a4 = new_gw; | 1394 | if (peer->redirect_learned.a4 != new_gw) { |
1361 | atomic_inc(&__rt_peer_genid); | 1395 | peer->redirect_learned.a4 = new_gw; |
1396 | atomic_inc(&__rt_peer_genid); | ||
1397 | } | ||
1398 | check_peer_redir(&rt->dst, peer); | ||
1399 | } | ||
1362 | } | 1400 | } |
1363 | |||
1364 | ip_rt_put(rt); | ||
1365 | return; | ||
1366 | } | 1401 | } |
1367 | } | 1402 | } |
1368 | return; | 1403 | return; |
@@ -1649,33 +1684,6 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) | |||
1649 | } | 1684 | } |
1650 | } | 1685 | } |
1651 | 1686 | ||
1652 | static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) | ||
1653 | { | ||
1654 | struct rtable *rt = (struct rtable *) dst; | ||
1655 | __be32 orig_gw = rt->rt_gateway; | ||
1656 | struct neighbour *n, *old_n; | ||
1657 | |||
1658 | dst_confirm(&rt->dst); | ||
1659 | |||
1660 | rt->rt_gateway = peer->redirect_learned.a4; | ||
1661 | |||
1662 | n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway); | ||
1663 | if (IS_ERR(n)) | ||
1664 | return PTR_ERR(n); | ||
1665 | old_n = xchg(&rt->dst._neighbour, n); | ||
1666 | if (old_n) | ||
1667 | neigh_release(old_n); | ||
1668 | if (!n || !(n->nud_state & NUD_VALID)) { | ||
1669 | if (n) | ||
1670 | neigh_event_send(n, NULL); | ||
1671 | rt->rt_gateway = orig_gw; | ||
1672 | return -EAGAIN; | ||
1673 | } else { | ||
1674 | rt->rt_flags |= RTCF_REDIRECTED; | ||
1675 | call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n); | ||
1676 | } | ||
1677 | return 0; | ||
1678 | } | ||
1679 | 1687 | ||
1680 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | 1688 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) |
1681 | { | 1689 | { |
@@ -2845,7 +2853,7 @@ static int rt_fill_info(struct net *net, | |||
2845 | struct rtable *rt = skb_rtable(skb); | 2853 | struct rtable *rt = skb_rtable(skb); |
2846 | struct rtmsg *r; | 2854 | struct rtmsg *r; |
2847 | struct nlmsghdr *nlh; | 2855 | struct nlmsghdr *nlh; |
2848 | long expires = 0; | 2856 | unsigned long expires = 0; |
2849 | const struct inet_peer *peer = rt->peer; | 2857 | const struct inet_peer *peer = rt->peer; |
2850 | u32 id = 0, ts = 0, tsage = 0, error; | 2858 | u32 id = 0, ts = 0, tsage = 0, error; |
2851 | 2859 | ||
@@ -2902,8 +2910,12 @@ static int rt_fill_info(struct net *net, | |||
2902 | tsage = get_seconds() - peer->tcp_ts_stamp; | 2910 | tsage = get_seconds() - peer->tcp_ts_stamp; |
2903 | } | 2911 | } |
2904 | expires = ACCESS_ONCE(peer->pmtu_expires); | 2912 | expires = ACCESS_ONCE(peer->pmtu_expires); |
2905 | if (expires) | 2913 | if (expires) { |
2906 | expires -= jiffies; | 2914 | if (time_before(jiffies, expires)) |
2915 | expires -= jiffies; | ||
2916 | else | ||
2917 | expires = 0; | ||
2918 | } | ||
2907 | } | 2919 | } |
2908 | 2920 | ||
2909 | if (rt_is_input_route(rt)) { | 2921 | if (rt_is_input_route(rt)) { |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a7443159c400..a9db4b1a2215 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1510,6 +1510,7 @@ exit: | |||
1510 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); | 1510 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); |
1511 | return NULL; | 1511 | return NULL; |
1512 | put_and_exit: | 1512 | put_and_exit: |
1513 | tcp_clear_xmit_timers(newsk); | ||
1513 | bh_unlock_sock(newsk); | 1514 | bh_unlock_sock(newsk); |
1514 | sock_put(newsk); | 1515 | sock_put(newsk); |
1515 | goto exit; | 1516 | goto exit; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 980b98f6288c..63170e297540 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1382,7 +1382,7 @@ static inline int tcp_minshall_check(const struct tcp_sock *tp) | |||
1382 | /* Return 0, if packet can be sent now without violation Nagle's rules: | 1382 | /* Return 0, if packet can be sent now without violation Nagle's rules: |
1383 | * 1. It is full sized. | 1383 | * 1. It is full sized. |
1384 | * 2. Or it contains FIN. (already checked by caller) | 1384 | * 2. Or it contains FIN. (already checked by caller) |
1385 | * 3. Or TCP_NODELAY was set. | 1385 | * 3. Or TCP_CORK is not set, and TCP_NODELAY is set. |
1386 | * 4. Or TCP_CORK is not set, and all sent packets are ACKed. | 1386 | * 4. Or TCP_CORK is not set, and all sent packets are ACKed. |
1387 | * With Minshall's modification: all sent small packets are ACKed. | 1387 | * With Minshall's modification: all sent small packets are ACKed. |
1388 | */ | 1388 | */ |
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index 2195ae651923..4c0f894d0843 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -324,8 +324,6 @@ static void ah6_output_done(struct crypto_async_request *base, int err) | |||
324 | #endif | 324 | #endif |
325 | } | 325 | } |
326 | 326 | ||
327 | err = ah->nexthdr; | ||
328 | |||
329 | kfree(AH_SKB_CB(skb)->tmp); | 327 | kfree(AH_SKB_CB(skb)->tmp); |
330 | xfrm_output_resume(skb, err); | 328 | xfrm_output_resume(skb, err); |
331 | } | 329 | } |
@@ -466,12 +464,12 @@ static void ah6_input_done(struct crypto_async_request *base, int err) | |||
466 | if (err) | 464 | if (err) |
467 | goto out; | 465 | goto out; |
468 | 466 | ||
467 | err = ah->nexthdr; | ||
468 | |||
469 | skb->network_header += ah_hlen; | 469 | skb->network_header += ah_hlen; |
470 | memcpy(skb_network_header(skb), work_iph, hdr_len); | 470 | memcpy(skb_network_header(skb), work_iph, hdr_len); |
471 | __skb_pull(skb, ah_hlen + hdr_len); | 471 | __skb_pull(skb, ah_hlen + hdr_len); |
472 | skb_set_transport_header(skb, -hdr_len); | 472 | skb_set_transport_header(skb, -hdr_len); |
473 | |||
474 | err = ah->nexthdr; | ||
475 | out: | 473 | out: |
476 | kfree(AH_SKB_CB(skb)->tmp); | 474 | kfree(AH_SKB_CB(skb)->tmp); |
477 | xfrm_input_resume(skb, err); | 475 | xfrm_input_resume(skb, err); |
@@ -583,8 +581,6 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
583 | if (err == -EINPROGRESS) | 581 | if (err == -EINPROGRESS) |
584 | goto out; | 582 | goto out; |
585 | 583 | ||
586 | if (err == -EBUSY) | ||
587 | err = NET_XMIT_DROP; | ||
588 | goto out_free; | 584 | goto out_free; |
589 | } | 585 | } |
590 | 586 | ||
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 027c7ff6f1e5..a46c64eb0a66 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -111,6 +111,14 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
111 | ipv6_addr_loopback(&hdr->daddr)) | 111 | ipv6_addr_loopback(&hdr->daddr)) |
112 | goto err; | 112 | goto err; |
113 | 113 | ||
114 | /* | ||
115 | * RFC4291 2.7 | ||
116 | * Multicast addresses must not be used as source addresses in IPv6 | ||
117 | * packets or appear in any Routing header. | ||
118 | */ | ||
119 | if (ipv6_addr_is_multicast(&hdr->saddr)) | ||
120 | goto err; | ||
121 | |||
114 | skb->transport_header = skb->network_header + sizeof(*hdr); | 122 | skb->transport_header = skb->network_header + sizeof(*hdr); |
115 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); | 123 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); |
116 | 124 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index bdc15c9003d7..4e2e9ff67ef2 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -289,6 +289,8 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct ip6_tnl_parm *p) | |||
289 | if ((err = register_netdevice(dev)) < 0) | 289 | if ((err = register_netdevice(dev)) < 0) |
290 | goto failed_free; | 290 | goto failed_free; |
291 | 291 | ||
292 | strcpy(t->parms.name, dev->name); | ||
293 | |||
292 | dev_hold(dev); | 294 | dev_hold(dev); |
293 | ip6_tnl_link(ip6n, t); | 295 | ip6_tnl_link(ip6n, t); |
294 | return t; | 296 | return t; |
@@ -1407,7 +1409,6 @@ ip6_tnl_dev_init_gen(struct net_device *dev) | |||
1407 | struct ip6_tnl *t = netdev_priv(dev); | 1409 | struct ip6_tnl *t = netdev_priv(dev); |
1408 | 1410 | ||
1409 | t->dev = dev; | 1411 | t->dev = dev; |
1410 | strcpy(t->parms.name, dev->name); | ||
1411 | dev->tstats = alloc_percpu(struct pcpu_tstats); | 1412 | dev->tstats = alloc_percpu(struct pcpu_tstats); |
1412 | if (!dev->tstats) | 1413 | if (!dev->tstats) |
1413 | return -ENOMEM; | 1414 | return -ENOMEM; |
@@ -1487,6 +1488,7 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n) | |||
1487 | static int __net_init ip6_tnl_init_net(struct net *net) | 1488 | static int __net_init ip6_tnl_init_net(struct net *net) |
1488 | { | 1489 | { |
1489 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); | 1490 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); |
1491 | struct ip6_tnl *t = NULL; | ||
1490 | int err; | 1492 | int err; |
1491 | 1493 | ||
1492 | ip6n->tnls[0] = ip6n->tnls_wc; | 1494 | ip6n->tnls[0] = ip6n->tnls_wc; |
@@ -1507,6 +1509,10 @@ static int __net_init ip6_tnl_init_net(struct net *net) | |||
1507 | err = register_netdev(ip6n->fb_tnl_dev); | 1509 | err = register_netdev(ip6n->fb_tnl_dev); |
1508 | if (err < 0) | 1510 | if (err < 0) |
1509 | goto err_register; | 1511 | goto err_register; |
1512 | |||
1513 | t = netdev_priv(ip6n->fb_tnl_dev); | ||
1514 | |||
1515 | strcpy(t->parms.name, ip6n->fb_tnl_dev->name); | ||
1510 | return 0; | 1516 | return 0; |
1511 | 1517 | ||
1512 | err_register: | 1518 | err_register: |
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index bf8d50c67931..cf0f308abf5e 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -756,9 +756,6 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb, | |||
756 | goto error; | 756 | goto error; |
757 | } | 757 | } |
758 | 758 | ||
759 | /* Point to L2TP header */ | ||
760 | optr = ptr = skb->data; | ||
761 | |||
762 | /* Trace packet contents, if enabled */ | 759 | /* Trace packet contents, if enabled */ |
763 | if (tunnel->debug & L2TP_MSG_DATA) { | 760 | if (tunnel->debug & L2TP_MSG_DATA) { |
764 | length = min(32u, skb->len); | 761 | length = min(32u, skb->len); |
@@ -769,12 +766,15 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb, | |||
769 | 766 | ||
770 | offset = 0; | 767 | offset = 0; |
771 | do { | 768 | do { |
772 | printk(" %02X", ptr[offset]); | 769 | printk(" %02X", skb->data[offset]); |
773 | } while (++offset < length); | 770 | } while (++offset < length); |
774 | 771 | ||
775 | printk("\n"); | 772 | printk("\n"); |
776 | } | 773 | } |
777 | 774 | ||
775 | /* Point to L2TP header */ | ||
776 | optr = ptr = skb->data; | ||
777 | |||
778 | /* Get L2TP header flags */ | 778 | /* Get L2TP header flags */ |
779 | hdrflags = ntohs(*(__be16 *) ptr); | 779 | hdrflags = ntohs(*(__be16 *) ptr); |
780 | 780 | ||
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 72c8bea81a6c..b1b1bb368f70 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1487,6 +1487,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, | |||
1487 | int i, j, err; | 1487 | int i, j, err; |
1488 | bool have_higher_than_11mbit = false; | 1488 | bool have_higher_than_11mbit = false; |
1489 | u16 ap_ht_cap_flags; | 1489 | u16 ap_ht_cap_flags; |
1490 | int min_rate = INT_MAX, min_rate_index = -1; | ||
1490 | 1491 | ||
1491 | /* AssocResp and ReassocResp have identical structure */ | 1492 | /* AssocResp and ReassocResp have identical structure */ |
1492 | 1493 | ||
@@ -1553,6 +1554,10 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, | |||
1553 | rates |= BIT(j); | 1554 | rates |= BIT(j); |
1554 | if (is_basic) | 1555 | if (is_basic) |
1555 | basic_rates |= BIT(j); | 1556 | basic_rates |= BIT(j); |
1557 | if (rate < min_rate) { | ||
1558 | min_rate = rate; | ||
1559 | min_rate_index = j; | ||
1560 | } | ||
1556 | break; | 1561 | break; |
1557 | } | 1562 | } |
1558 | } | 1563 | } |
@@ -1570,11 +1575,25 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, | |||
1570 | rates |= BIT(j); | 1575 | rates |= BIT(j); |
1571 | if (is_basic) | 1576 | if (is_basic) |
1572 | basic_rates |= BIT(j); | 1577 | basic_rates |= BIT(j); |
1578 | if (rate < min_rate) { | ||
1579 | min_rate = rate; | ||
1580 | min_rate_index = j; | ||
1581 | } | ||
1573 | break; | 1582 | break; |
1574 | } | 1583 | } |
1575 | } | 1584 | } |
1576 | } | 1585 | } |
1577 | 1586 | ||
1587 | /* | ||
1588 | * some buggy APs don't advertise basic_rates. use the lowest | ||
1589 | * supported rate instead. | ||
1590 | */ | ||
1591 | if (unlikely(!basic_rates) && min_rate_index >= 0) { | ||
1592 | printk(KERN_DEBUG "%s: No basic rates in AssocResp. " | ||
1593 | "Using min supported rate instead.\n", sdata->name); | ||
1594 | basic_rates = BIT(min_rate_index); | ||
1595 | } | ||
1596 | |||
1578 | sta->sta.supp_rates[wk->chan->band] = rates; | 1597 | sta->sta.supp_rates[wk->chan->band] = rates; |
1579 | sdata->vif.bss_conf.basic_rates = basic_rates; | 1598 | sdata->vif.bss_conf.basic_rates = basic_rates; |
1580 | 1599 | ||
@@ -2269,6 +2288,7 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata) | |||
2269 | 2288 | ||
2270 | cancel_work_sync(&ifmgd->request_smps_work); | 2289 | cancel_work_sync(&ifmgd->request_smps_work); |
2271 | 2290 | ||
2291 | cancel_work_sync(&ifmgd->monitor_work); | ||
2272 | cancel_work_sync(&ifmgd->beacon_connection_loss_work); | 2292 | cancel_work_sync(&ifmgd->beacon_connection_loss_work); |
2273 | if (del_timer_sync(&ifmgd->timer)) | 2293 | if (del_timer_sync(&ifmgd->timer)) |
2274 | set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); | 2294 | set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); |
@@ -2277,7 +2297,6 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata) | |||
2277 | if (del_timer_sync(&ifmgd->chswitch_timer)) | 2297 | if (del_timer_sync(&ifmgd->chswitch_timer)) |
2278 | set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running); | 2298 | set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running); |
2279 | 2299 | ||
2280 | cancel_work_sync(&ifmgd->monitor_work); | ||
2281 | /* these will just be re-established on connection */ | 2300 | /* these will just be re-established on connection */ |
2282 | del_timer_sync(&ifmgd->conn_mon_timer); | 2301 | del_timer_sync(&ifmgd->conn_mon_timer); |
2283 | del_timer_sync(&ifmgd->bcn_mon_timer); | 2302 | del_timer_sync(&ifmgd->bcn_mon_timer); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index bb53726cb04a..fb123e2e081a 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -141,8 +141,9 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
141 | pos++; | 141 | pos++; |
142 | 142 | ||
143 | /* IEEE80211_RADIOTAP_RATE */ | 143 | /* IEEE80211_RADIOTAP_RATE */ |
144 | if (status->flag & RX_FLAG_HT) { | 144 | if (!rate || status->flag & RX_FLAG_HT) { |
145 | /* | 145 | /* |
146 | * Without rate information don't add it. If we have, | ||
146 | * MCS information is a separate field in radiotap, | 147 | * MCS information is a separate field in radiotap, |
147 | * added below. The byte here is needed as padding | 148 | * added below. The byte here is needed as padding |
148 | * for the channel though, so initialise it to 0. | 149 | * for the channel though, so initialise it to 0. |
@@ -163,12 +164,14 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
163 | else if (status->flag & RX_FLAG_HT) | 164 | else if (status->flag & RX_FLAG_HT) |
164 | put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ, | 165 | put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ, |
165 | pos); | 166 | pos); |
166 | else if (rate->flags & IEEE80211_RATE_ERP_G) | 167 | else if (rate && rate->flags & IEEE80211_RATE_ERP_G) |
167 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ, | 168 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ, |
168 | pos); | 169 | pos); |
169 | else | 170 | else if (rate) |
170 | put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ, | 171 | put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ, |
171 | pos); | 172 | pos); |
173 | else | ||
174 | put_unaligned_le16(IEEE80211_CHAN_2GHZ, pos); | ||
172 | pos += 2; | 175 | pos += 2; |
173 | 176 | ||
174 | /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ | 177 | /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index ce962d2c8782..8eaa746ec7a2 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -1354,12 +1354,12 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta, | |||
1354 | * Use MoreData flag to indicate whether there are | 1354 | * Use MoreData flag to indicate whether there are |
1355 | * more buffered frames for this STA | 1355 | * more buffered frames for this STA |
1356 | */ | 1356 | */ |
1357 | if (!more_data) | 1357 | if (more_data || !skb_queue_empty(&frames)) |
1358 | hdr->frame_control &= | ||
1359 | cpu_to_le16(~IEEE80211_FCTL_MOREDATA); | ||
1360 | else | ||
1361 | hdr->frame_control |= | 1358 | hdr->frame_control |= |
1362 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); | 1359 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); |
1360 | else | ||
1361 | hdr->frame_control &= | ||
1362 | cpu_to_le16(~IEEE80211_FCTL_MOREDATA); | ||
1363 | 1363 | ||
1364 | if (ieee80211_is_data_qos(hdr->frame_control) || | 1364 | if (ieee80211_is_data_qos(hdr->frame_control) || |
1365 | ieee80211_is_qos_nullfunc(hdr->frame_control)) | 1365 | ieee80211_is_qos_nullfunc(hdr->frame_control)) |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 51e256c5fb78..eca0fad09709 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -881,6 +881,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | |||
881 | skb = ieee80211_probereq_get(&local->hw, &sdata->vif, | 881 | skb = ieee80211_probereq_get(&local->hw, &sdata->vif, |
882 | ssid, ssid_len, | 882 | ssid, ssid_len, |
883 | buf, buf_len); | 883 | buf, buf_len); |
884 | if (!skb) | ||
885 | goto out; | ||
884 | 886 | ||
885 | if (dst) { | 887 | if (dst) { |
886 | mgmt = (struct ieee80211_mgmt *) skb->data; | 888 | mgmt = (struct ieee80211_mgmt *) skb->data; |
@@ -889,6 +891,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | |||
889 | } | 891 | } |
890 | 892 | ||
891 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 893 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
894 | |||
895 | out: | ||
892 | kfree(buf); | 896 | kfree(buf); |
893 | 897 | ||
894 | return skb; | 898 | return skb; |
diff --git a/net/rds/Kconfig b/net/rds/Kconfig index 4cf6dc7910e4..ec753b3ae72a 100644 --- a/net/rds/Kconfig +++ b/net/rds/Kconfig | |||
@@ -9,7 +9,6 @@ config RDS | |||
9 | 9 | ||
10 | config RDS_RDMA | 10 | config RDS_RDMA |
11 | tristate "RDS over Infiniband and iWARP" | 11 | tristate "RDS over Infiniband and iWARP" |
12 | select LLIST | ||
13 | depends on RDS && INFINIBAND && INFINIBAND_ADDR_TRANS | 12 | depends on RDS && INFINIBAND && INFINIBAND_ADDR_TRANS |
14 | ---help--- | 13 | ---help--- |
15 | Allow RDS to use Infiniband and iWARP as a transport. | 14 | Allow RDS to use Infiniband and iWARP as a transport. |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index d7f97ef26590..2d78d95955ab 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -2530,8 +2530,10 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args, | |||
2530 | int err; | 2530 | int err; |
2531 | err = xs_init_anyaddr(args->dstaddr->sa_family, | 2531 | err = xs_init_anyaddr(args->dstaddr->sa_family, |
2532 | (struct sockaddr *)&new->srcaddr); | 2532 | (struct sockaddr *)&new->srcaddr); |
2533 | if (err != 0) | 2533 | if (err != 0) { |
2534 | xprt_free(xprt); | ||
2534 | return ERR_PTR(err); | 2535 | return ERR_PTR(err); |
2536 | } | ||
2535 | } | 2537 | } |
2536 | 2538 | ||
2537 | return xprt; | 2539 | return xprt; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 48260c2d092a..b3a476fe8272 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -132,8 +132,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
132 | [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED }, | 132 | [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED }, |
133 | [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG }, | 133 | [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG }, |
134 | 134 | ||
135 | [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY, | 135 | [NL80211_ATTR_HT_CAPABILITY] = { .len = NL80211_HT_CAPABILITY_LEN }, |
136 | .len = NL80211_HT_CAPABILITY_LEN }, | ||
137 | 136 | ||
138 | [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 }, | 137 | [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 }, |
139 | [NL80211_ATTR_IE] = { .type = NLA_BINARY, | 138 | [NL80211_ATTR_IE] = { .type = NLA_BINARY, |
@@ -1253,6 +1252,12 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
1253 | goto bad_res; | 1252 | goto bad_res; |
1254 | } | 1253 | } |
1255 | 1254 | ||
1255 | if (netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && | ||
1256 | netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { | ||
1257 | result = -EINVAL; | ||
1258 | goto bad_res; | ||
1259 | } | ||
1260 | |||
1256 | nla_for_each_nested(nl_txq_params, | 1261 | nla_for_each_nested(nl_txq_params, |
1257 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], | 1262 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], |
1258 | rem_txq_params) { | 1263 | rem_txq_params) { |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 6acba9d18cc8..e71f5a66574e 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -2265,6 +2265,9 @@ void /* __init_or_exit */ regulatory_exit(void) | |||
2265 | 2265 | ||
2266 | kfree(last_request); | 2266 | kfree(last_request); |
2267 | 2267 | ||
2268 | last_request = NULL; | ||
2269 | dev_set_uevent_suppress(®_pdev->dev, true); | ||
2270 | |||
2268 | platform_device_unregister(reg_pdev); | 2271 | platform_device_unregister(reg_pdev); |
2269 | 2272 | ||
2270 | spin_lock_bh(®_pending_beacons_lock); | 2273 | spin_lock_bh(®_pending_beacons_lock); |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 0fb142410404..dc23b31594e0 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -259,17 +259,20 @@ static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2) | |||
259 | { | 259 | { |
260 | const u8 *ie1 = cfg80211_find_ie(num, ies1, len1); | 260 | const u8 *ie1 = cfg80211_find_ie(num, ies1, len1); |
261 | const u8 *ie2 = cfg80211_find_ie(num, ies2, len2); | 261 | const u8 *ie2 = cfg80211_find_ie(num, ies2, len2); |
262 | int r; | ||
263 | 262 | ||
263 | /* equal if both missing */ | ||
264 | if (!ie1 && !ie2) | 264 | if (!ie1 && !ie2) |
265 | return 0; | 265 | return 0; |
266 | if (!ie1 || !ie2) | 266 | /* sort missing IE before (left of) present IE */ |
267 | if (!ie1) | ||
267 | return -1; | 268 | return -1; |
269 | if (!ie2) | ||
270 | return 1; | ||
268 | 271 | ||
269 | r = memcmp(ie1 + 2, ie2 + 2, min(ie1[1], ie2[1])); | 272 | /* sort by length first, then by contents */ |
270 | if (r == 0 && ie1[1] != ie2[1]) | 273 | if (ie1[1] != ie2[1]) |
271 | return ie2[1] - ie1[1]; | 274 | return ie2[1] - ie1[1]; |
272 | return r; | 275 | return memcmp(ie1 + 2, ie2 + 2, ie1[1]); |
273 | } | 276 | } |
274 | 277 | ||
275 | static bool is_bss(struct cfg80211_bss *a, | 278 | static bool is_bss(struct cfg80211_bss *a, |
diff --git a/security/keys/encrypted-keys/Makefile b/security/keys/encrypted-keys/Makefile index 6bc7a86d1027..d6f8433250a5 100644 --- a/security/keys/encrypted-keys/Makefile +++ b/security/keys/encrypted-keys/Makefile | |||
@@ -2,5 +2,9 @@ | |||
2 | # Makefile for encrypted keys | 2 | # Makefile for encrypted keys |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_ENCRYPTED_KEYS) += encrypted.o ecryptfs_format.o | 5 | obj-$(CONFIG_ENCRYPTED_KEYS) += encrypted-keys.o |
6 | obj-$(CONFIG_TRUSTED_KEYS) += masterkey_trusted.o | 6 | |
7 | encrypted-keys-y := encrypted.o ecryptfs_format.o | ||
8 | masterkey-$(CONFIG_TRUSTED_KEYS) := masterkey_trusted.o | ||
9 | masterkey-$(CONFIG_TRUSTED_KEYS)-$(CONFIG_ENCRYPTED_KEYS) := masterkey_trusted.o | ||
10 | encrypted-keys-y += $(masterkey-y) $(masterkey-m-m) | ||
diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c index dcc843cb0f80..41144f71d615 100644 --- a/security/keys/encrypted-keys/encrypted.c +++ b/security/keys/encrypted-keys/encrypted.c | |||
@@ -444,7 +444,7 @@ static struct key *request_master_key(struct encrypted_key_payload *epayload, | |||
444 | goto out; | 444 | goto out; |
445 | 445 | ||
446 | if (IS_ERR(mkey)) { | 446 | if (IS_ERR(mkey)) { |
447 | int ret = PTR_ERR(epayload); | 447 | int ret = PTR_ERR(mkey); |
448 | 448 | ||
449 | if (ret == -ENOTSUPP) | 449 | if (ret == -ENOTSUPP) |
450 | pr_info("encrypted_key: key %s not supported", | 450 | pr_info("encrypted_key: key %s not supported", |
diff --git a/security/keys/encrypted-keys/encrypted.h b/security/keys/encrypted-keys/encrypted.h index b6ade8945250..8136a2d44c63 100644 --- a/security/keys/encrypted-keys/encrypted.h +++ b/security/keys/encrypted-keys/encrypted.h | |||
@@ -2,7 +2,8 @@ | |||
2 | #define __ENCRYPTED_KEY_H | 2 | #define __ENCRYPTED_KEY_H |
3 | 3 | ||
4 | #define ENCRYPTED_DEBUG 0 | 4 | #define ENCRYPTED_DEBUG 0 |
5 | #ifdef CONFIG_TRUSTED_KEYS | 5 | #if defined(CONFIG_TRUSTED_KEYS) || \ |
6 | (defined(CONFIG_TRUSTED_KEYS_MODULE) && defined(CONFIG_ENCRYPTED_KEYS_MODULE)) | ||
6 | extern struct key *request_trusted_key(const char *trusted_desc, | 7 | extern struct key *request_trusted_key(const char *trusted_desc, |
7 | u8 **master_key, size_t *master_keylen); | 8 | u8 **master_key, size_t *master_keylen); |
8 | #else | 9 | #else |
diff --git a/security/keys/user_defined.c b/security/keys/user_defined.c index 5b366d7af3c4..69ff52c08e97 100644 --- a/security/keys/user_defined.c +++ b/security/keys/user_defined.c | |||
@@ -102,7 +102,8 @@ int user_update(struct key *key, const void *data, size_t datalen) | |||
102 | key->expiry = 0; | 102 | key->expiry = 0; |
103 | } | 103 | } |
104 | 104 | ||
105 | kfree_rcu(zap, rcu); | 105 | if (zap) |
106 | kfree_rcu(zap, rcu); | ||
106 | 107 | ||
107 | error: | 108 | error: |
108 | return ret; | 109 | return ret; |
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 6aceef518a41..5c32f36ff706 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c | |||
@@ -102,9 +102,6 @@ static int smk_cipso_doi_value = SMACK_CIPSO_DOI_DEFAULT; | |||
102 | 102 | ||
103 | const char *smack_cipso_option = SMACK_CIPSO_OPTION; | 103 | const char *smack_cipso_option = SMACK_CIPSO_OPTION; |
104 | 104 | ||
105 | |||
106 | #define SEQ_READ_FINISHED ((loff_t)-1) | ||
107 | |||
108 | /* | 105 | /* |
109 | * Values for parsing cipso rules | 106 | * Values for parsing cipso rules |
110 | * SMK_DIGITLEN: Length of a digit field in a rule. | 107 | * SMK_DIGITLEN: Length of a digit field in a rule. |
@@ -357,10 +354,12 @@ static ssize_t smk_write_load_list(struct file *file, const char __user *buf, | |||
357 | 354 | ||
358 | rc = count; | 355 | rc = count; |
359 | /* | 356 | /* |
357 | * If this is "load" as opposed to "load-self" and a new rule | ||
358 | * it needs to get added for reporting. | ||
360 | * smk_set_access returns true if there was already a rule | 359 | * smk_set_access returns true if there was already a rule |
361 | * for the subject/object pair, and false if it was new. | 360 | * for the subject/object pair, and false if it was new. |
362 | */ | 361 | */ |
363 | if (!smk_set_access(rule, rule_list, rule_lock)) { | 362 | if (load && !smk_set_access(rule, rule_list, rule_lock)) { |
364 | smlp = kzalloc(sizeof(*smlp), GFP_KERNEL); | 363 | smlp = kzalloc(sizeof(*smlp), GFP_KERNEL); |
365 | if (smlp != NULL) { | 364 | if (smlp != NULL) { |
366 | smlp->smk_rule = rule; | 365 | smlp->smk_rule = rule; |
@@ -377,12 +376,12 @@ out: | |||
377 | return rc; | 376 | return rc; |
378 | } | 377 | } |
379 | 378 | ||
380 | |||
381 | /* | 379 | /* |
382 | * Seq_file read operations for /smack/load | 380 | * Core logic for smackfs seq list operations. |
383 | */ | 381 | */ |
384 | 382 | ||
385 | static void *load_seq_start(struct seq_file *s, loff_t *pos) | 383 | static void *smk_seq_start(struct seq_file *s, loff_t *pos, |
384 | struct list_head *head) | ||
386 | { | 385 | { |
387 | struct list_head *list; | 386 | struct list_head *list; |
388 | 387 | ||
@@ -390,7 +389,7 @@ static void *load_seq_start(struct seq_file *s, loff_t *pos) | |||
390 | * This is 0 the first time through. | 389 | * This is 0 the first time through. |
391 | */ | 390 | */ |
392 | if (s->index == 0) | 391 | if (s->index == 0) |
393 | s->private = &smack_rule_list; | 392 | s->private = head; |
394 | 393 | ||
395 | if (s->private == NULL) | 394 | if (s->private == NULL) |
396 | return NULL; | 395 | return NULL; |
@@ -404,11 +403,12 @@ static void *load_seq_start(struct seq_file *s, loff_t *pos) | |||
404 | return list; | 403 | return list; |
405 | } | 404 | } |
406 | 405 | ||
407 | static void *load_seq_next(struct seq_file *s, void *v, loff_t *pos) | 406 | static void *smk_seq_next(struct seq_file *s, void *v, loff_t *pos, |
407 | struct list_head *head) | ||
408 | { | 408 | { |
409 | struct list_head *list = v; | 409 | struct list_head *list = v; |
410 | 410 | ||
411 | if (list_is_last(list, &smack_rule_list)) { | 411 | if (list_is_last(list, head)) { |
412 | s->private = NULL; | 412 | s->private = NULL; |
413 | return NULL; | 413 | return NULL; |
414 | } | 414 | } |
@@ -416,6 +416,25 @@ static void *load_seq_next(struct seq_file *s, void *v, loff_t *pos) | |||
416 | return list->next; | 416 | return list->next; |
417 | } | 417 | } |
418 | 418 | ||
419 | static void smk_seq_stop(struct seq_file *s, void *v) | ||
420 | { | ||
421 | /* No-op */ | ||
422 | } | ||
423 | |||
424 | /* | ||
425 | * Seq_file read operations for /smack/load | ||
426 | */ | ||
427 | |||
428 | static void *load_seq_start(struct seq_file *s, loff_t *pos) | ||
429 | { | ||
430 | return smk_seq_start(s, pos, &smack_rule_list); | ||
431 | } | ||
432 | |||
433 | static void *load_seq_next(struct seq_file *s, void *v, loff_t *pos) | ||
434 | { | ||
435 | return smk_seq_next(s, v, pos, &smack_rule_list); | ||
436 | } | ||
437 | |||
419 | static int load_seq_show(struct seq_file *s, void *v) | 438 | static int load_seq_show(struct seq_file *s, void *v) |
420 | { | 439 | { |
421 | struct list_head *list = v; | 440 | struct list_head *list = v; |
@@ -446,16 +465,11 @@ static int load_seq_show(struct seq_file *s, void *v) | |||
446 | return 0; | 465 | return 0; |
447 | } | 466 | } |
448 | 467 | ||
449 | static void load_seq_stop(struct seq_file *s, void *v) | ||
450 | { | ||
451 | /* No-op */ | ||
452 | } | ||
453 | |||
454 | static const struct seq_operations load_seq_ops = { | 468 | static const struct seq_operations load_seq_ops = { |
455 | .start = load_seq_start, | 469 | .start = load_seq_start, |
456 | .next = load_seq_next, | 470 | .next = load_seq_next, |
457 | .show = load_seq_show, | 471 | .show = load_seq_show, |
458 | .stop = load_seq_stop, | 472 | .stop = smk_seq_stop, |
459 | }; | 473 | }; |
460 | 474 | ||
461 | /** | 475 | /** |
@@ -574,28 +588,12 @@ static void smk_unlbl_ambient(char *oldambient) | |||
574 | 588 | ||
575 | static void *cipso_seq_start(struct seq_file *s, loff_t *pos) | 589 | static void *cipso_seq_start(struct seq_file *s, loff_t *pos) |
576 | { | 590 | { |
577 | if (*pos == SEQ_READ_FINISHED) | 591 | return smk_seq_start(s, pos, &smack_known_list); |
578 | return NULL; | ||
579 | if (list_empty(&smack_known_list)) | ||
580 | return NULL; | ||
581 | |||
582 | return smack_known_list.next; | ||
583 | } | 592 | } |
584 | 593 | ||
585 | static void *cipso_seq_next(struct seq_file *s, void *v, loff_t *pos) | 594 | static void *cipso_seq_next(struct seq_file *s, void *v, loff_t *pos) |
586 | { | 595 | { |
587 | struct list_head *list = v; | 596 | return smk_seq_next(s, v, pos, &smack_known_list); |
588 | |||
589 | /* | ||
590 | * labels with no associated cipso value wont be printed | ||
591 | * in cipso_seq_show | ||
592 | */ | ||
593 | if (list_is_last(list, &smack_known_list)) { | ||
594 | *pos = SEQ_READ_FINISHED; | ||
595 | return NULL; | ||
596 | } | ||
597 | |||
598 | return list->next; | ||
599 | } | 597 | } |
600 | 598 | ||
601 | /* | 599 | /* |
@@ -634,16 +632,11 @@ static int cipso_seq_show(struct seq_file *s, void *v) | |||
634 | return 0; | 632 | return 0; |
635 | } | 633 | } |
636 | 634 | ||
637 | static void cipso_seq_stop(struct seq_file *s, void *v) | ||
638 | { | ||
639 | /* No-op */ | ||
640 | } | ||
641 | |||
642 | static const struct seq_operations cipso_seq_ops = { | 635 | static const struct seq_operations cipso_seq_ops = { |
643 | .start = cipso_seq_start, | 636 | .start = cipso_seq_start, |
644 | .stop = cipso_seq_stop, | ||
645 | .next = cipso_seq_next, | 637 | .next = cipso_seq_next, |
646 | .show = cipso_seq_show, | 638 | .show = cipso_seq_show, |
639 | .stop = smk_seq_stop, | ||
647 | }; | 640 | }; |
648 | 641 | ||
649 | /** | 642 | /** |
@@ -788,23 +781,12 @@ static const struct file_operations smk_cipso_ops = { | |||
788 | 781 | ||
789 | static void *netlbladdr_seq_start(struct seq_file *s, loff_t *pos) | 782 | static void *netlbladdr_seq_start(struct seq_file *s, loff_t *pos) |
790 | { | 783 | { |
791 | if (*pos == SEQ_READ_FINISHED) | 784 | return smk_seq_start(s, pos, &smk_netlbladdr_list); |
792 | return NULL; | ||
793 | if (list_empty(&smk_netlbladdr_list)) | ||
794 | return NULL; | ||
795 | return smk_netlbladdr_list.next; | ||
796 | } | 785 | } |
797 | 786 | ||
798 | static void *netlbladdr_seq_next(struct seq_file *s, void *v, loff_t *pos) | 787 | static void *netlbladdr_seq_next(struct seq_file *s, void *v, loff_t *pos) |
799 | { | 788 | { |
800 | struct list_head *list = v; | 789 | return smk_seq_next(s, v, pos, &smk_netlbladdr_list); |
801 | |||
802 | if (list_is_last(list, &smk_netlbladdr_list)) { | ||
803 | *pos = SEQ_READ_FINISHED; | ||
804 | return NULL; | ||
805 | } | ||
806 | |||
807 | return list->next; | ||
808 | } | 790 | } |
809 | #define BEBITS (sizeof(__be32) * 8) | 791 | #define BEBITS (sizeof(__be32) * 8) |
810 | 792 | ||
@@ -828,16 +810,11 @@ static int netlbladdr_seq_show(struct seq_file *s, void *v) | |||
828 | return 0; | 810 | return 0; |
829 | } | 811 | } |
830 | 812 | ||
831 | static void netlbladdr_seq_stop(struct seq_file *s, void *v) | ||
832 | { | ||
833 | /* No-op */ | ||
834 | } | ||
835 | |||
836 | static const struct seq_operations netlbladdr_seq_ops = { | 813 | static const struct seq_operations netlbladdr_seq_ops = { |
837 | .start = netlbladdr_seq_start, | 814 | .start = netlbladdr_seq_start, |
838 | .stop = netlbladdr_seq_stop, | ||
839 | .next = netlbladdr_seq_next, | 815 | .next = netlbladdr_seq_next, |
840 | .show = netlbladdr_seq_show, | 816 | .show = netlbladdr_seq_show, |
817 | .stop = smk_seq_stop, | ||
841 | }; | 818 | }; |
842 | 819 | ||
843 | /** | 820 | /** |
@@ -1405,23 +1382,14 @@ static void *load_self_seq_start(struct seq_file *s, loff_t *pos) | |||
1405 | { | 1382 | { |
1406 | struct task_smack *tsp = current_security(); | 1383 | struct task_smack *tsp = current_security(); |
1407 | 1384 | ||
1408 | if (*pos == SEQ_READ_FINISHED) | 1385 | return smk_seq_start(s, pos, &tsp->smk_rules); |
1409 | return NULL; | ||
1410 | if (list_empty(&tsp->smk_rules)) | ||
1411 | return NULL; | ||
1412 | return tsp->smk_rules.next; | ||
1413 | } | 1386 | } |
1414 | 1387 | ||
1415 | static void *load_self_seq_next(struct seq_file *s, void *v, loff_t *pos) | 1388 | static void *load_self_seq_next(struct seq_file *s, void *v, loff_t *pos) |
1416 | { | 1389 | { |
1417 | struct task_smack *tsp = current_security(); | 1390 | struct task_smack *tsp = current_security(); |
1418 | struct list_head *list = v; | ||
1419 | 1391 | ||
1420 | if (list_is_last(list, &tsp->smk_rules)) { | 1392 | return smk_seq_next(s, v, pos, &tsp->smk_rules); |
1421 | *pos = SEQ_READ_FINISHED; | ||
1422 | return NULL; | ||
1423 | } | ||
1424 | return list->next; | ||
1425 | } | 1393 | } |
1426 | 1394 | ||
1427 | static int load_self_seq_show(struct seq_file *s, void *v) | 1395 | static int load_self_seq_show(struct seq_file *s, void *v) |
@@ -1453,16 +1421,11 @@ static int load_self_seq_show(struct seq_file *s, void *v) | |||
1453 | return 0; | 1421 | return 0; |
1454 | } | 1422 | } |
1455 | 1423 | ||
1456 | static void load_self_seq_stop(struct seq_file *s, void *v) | ||
1457 | { | ||
1458 | /* No-op */ | ||
1459 | } | ||
1460 | |||
1461 | static const struct seq_operations load_self_seq_ops = { | 1424 | static const struct seq_operations load_self_seq_ops = { |
1462 | .start = load_self_seq_start, | 1425 | .start = load_self_seq_start, |
1463 | .next = load_self_seq_next, | 1426 | .next = load_self_seq_next, |
1464 | .show = load_self_seq_show, | 1427 | .show = load_self_seq_show, |
1465 | .stop = load_self_seq_stop, | 1428 | .stop = smk_seq_stop, |
1466 | }; | 1429 | }; |
1467 | 1430 | ||
1468 | 1431 | ||
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 1c8ddf547a2d..7ae7578bdcc0 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -297,10 +297,18 @@ static int hdmi_update_eld(struct hdmi_eld *e, | |||
297 | buf + ELD_FIXED_BYTES + mnl + 3 * i); | 297 | buf + ELD_FIXED_BYTES + mnl + 3 * i); |
298 | } | 298 | } |
299 | 299 | ||
300 | /* | ||
301 | * HDMI sink's ELD info cannot always be retrieved for now, e.g. | ||
302 | * in console or for audio devices. Assume the highest speakers | ||
303 | * configuration, to _not_ prohibit multi-channel audio playback. | ||
304 | */ | ||
305 | if (!e->spk_alloc) | ||
306 | e->spk_alloc = 0xffff; | ||
307 | |||
308 | e->eld_valid = true; | ||
300 | return 0; | 309 | return 0; |
301 | 310 | ||
302 | out_fail: | 311 | out_fail: |
303 | e->eld_ver = 0; | ||
304 | return -EINVAL; | 312 | return -EINVAL; |
305 | } | 313 | } |
306 | 314 | ||
@@ -323,9 +331,6 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
323 | * ELD is valid, actual eld_size is assigned in hdmi_update_eld() | 331 | * ELD is valid, actual eld_size is assigned in hdmi_update_eld() |
324 | */ | 332 | */ |
325 | 333 | ||
326 | if (!eld->eld_valid) | ||
327 | return -ENOENT; | ||
328 | |||
329 | size = snd_hdmi_get_eld_size(codec, nid); | 334 | size = snd_hdmi_get_eld_size(codec, nid); |
330 | if (size == 0) { | 335 | if (size == 0) { |
331 | /* wfg: workaround for ASUS P5E-VM HDMI board */ | 336 | /* wfg: workaround for ASUS P5E-VM HDMI board */ |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 6579e0f2bb57..618ddad17236 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -653,6 +653,9 @@ struct hdmi_eld { | |||
653 | int spk_alloc; | 653 | int spk_alloc; |
654 | int sad_count; | 654 | int sad_count; |
655 | struct cea_sad sad[ELD_MAX_SAD]; | 655 | struct cea_sad sad[ELD_MAX_SAD]; |
656 | /* | ||
657 | * all fields above eld_buffer will be cleared before updating ELD | ||
658 | */ | ||
656 | char eld_buffer[ELD_MAX_SIZE]; | 659 | char eld_buffer[ELD_MAX_SIZE]; |
657 | #ifdef CONFIG_PROC_FS | 660 | #ifdef CONFIG_PROC_FS |
658 | struct snd_info_entry *proc_entry; | 661 | struct snd_info_entry *proc_entry; |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 2a2d8645ba09..2fbab8e29576 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -237,6 +237,15 @@ static int cs_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
237 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | 237 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
238 | } | 238 | } |
239 | 239 | ||
240 | static void cs_update_input_select(struct hda_codec *codec) | ||
241 | { | ||
242 | struct cs_spec *spec = codec->spec; | ||
243 | if (spec->cur_adc) | ||
244 | snd_hda_codec_write(codec, spec->cur_adc, 0, | ||
245 | AC_VERB_SET_CONNECT_SEL, | ||
246 | spec->adc_idx[spec->cur_input]); | ||
247 | } | ||
248 | |||
240 | /* | 249 | /* |
241 | * Analog capture | 250 | * Analog capture |
242 | */ | 251 | */ |
@@ -250,6 +259,7 @@ static int cs_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
250 | spec->cur_adc = spec->adc_nid[spec->cur_input]; | 259 | spec->cur_adc = spec->adc_nid[spec->cur_input]; |
251 | spec->cur_adc_stream_tag = stream_tag; | 260 | spec->cur_adc_stream_tag = stream_tag; |
252 | spec->cur_adc_format = format; | 261 | spec->cur_adc_format = format; |
262 | cs_update_input_select(codec); | ||
253 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); | 263 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
254 | return 0; | 264 | return 0; |
255 | } | 265 | } |
@@ -689,10 +699,8 @@ static int change_cur_input(struct hda_codec *codec, unsigned int idx, | |||
689 | spec->cur_adc_stream_tag, 0, | 699 | spec->cur_adc_stream_tag, 0, |
690 | spec->cur_adc_format); | 700 | spec->cur_adc_format); |
691 | } | 701 | } |
692 | snd_hda_codec_write(codec, spec->cur_adc, 0, | ||
693 | AC_VERB_SET_CONNECT_SEL, | ||
694 | spec->adc_idx[idx]); | ||
695 | spec->cur_input = idx; | 702 | spec->cur_input = idx; |
703 | cs_update_input_select(codec); | ||
696 | return 1; | 704 | return 1; |
697 | } | 705 | } |
698 | 706 | ||
@@ -973,10 +981,7 @@ static void cs_automic(struct hda_codec *codec) | |||
973 | } else { | 981 | } else { |
974 | spec->cur_input = spec->last_input; | 982 | spec->cur_input = spec->last_input; |
975 | } | 983 | } |
976 | 984 | cs_update_input_select(codec); | |
977 | snd_hda_codec_write_cache(codec, spec->cur_adc, 0, | ||
978 | AC_VERB_SET_CONNECT_SEL, | ||
979 | spec->adc_idx[spec->cur_input]); | ||
980 | } else { | 985 | } else { |
981 | if (present) | 986 | if (present) |
982 | change_cur_input(codec, spec->automic_idx, 0); | 987 | change_cur_input(codec, spec->automic_idx, 0); |
@@ -1073,9 +1078,7 @@ static void init_input(struct hda_codec *codec) | |||
1073 | cs_automic(codec); | 1078 | cs_automic(codec); |
1074 | else { | 1079 | else { |
1075 | spec->cur_adc = spec->adc_nid[spec->cur_input]; | 1080 | spec->cur_adc = spec->adc_nid[spec->cur_input]; |
1076 | snd_hda_codec_write(codec, spec->cur_adc, 0, | 1081 | cs_update_input_select(codec); |
1077 | AC_VERB_SET_CONNECT_SEL, | ||
1078 | spec->adc_idx[spec->cur_input]); | ||
1079 | } | 1082 | } |
1080 | } else { | 1083 | } else { |
1081 | change_cur_input(codec, spec->cur_input, 1); | 1084 | change_cur_input(codec, spec->cur_input, 1); |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 81b7b791b3c3..9850c5b481ea 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -65,7 +65,10 @@ struct hdmi_spec_per_pin { | |||
65 | hda_nid_t pin_nid; | 65 | hda_nid_t pin_nid; |
66 | int num_mux_nids; | 66 | int num_mux_nids; |
67 | hda_nid_t mux_nids[HDA_MAX_CONNECTIONS]; | 67 | hda_nid_t mux_nids[HDA_MAX_CONNECTIONS]; |
68 | |||
69 | struct hda_codec *codec; | ||
68 | struct hdmi_eld sink_eld; | 70 | struct hdmi_eld sink_eld; |
71 | struct delayed_work work; | ||
69 | }; | 72 | }; |
70 | 73 | ||
71 | struct hdmi_spec { | 74 | struct hdmi_spec { |
@@ -745,8 +748,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, | |||
745 | * Unsolicited events | 748 | * Unsolicited events |
746 | */ | 749 | */ |
747 | 750 | ||
748 | static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid, | 751 | static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry); |
749 | struct hdmi_eld *eld); | ||
750 | 752 | ||
751 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | 753 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) |
752 | { | 754 | { |
@@ -755,7 +757,6 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | |||
755 | int pd = !!(res & AC_UNSOL_RES_PD); | 757 | int pd = !!(res & AC_UNSOL_RES_PD); |
756 | int eldv = !!(res & AC_UNSOL_RES_ELDV); | 758 | int eldv = !!(res & AC_UNSOL_RES_ELDV); |
757 | int pin_idx; | 759 | int pin_idx; |
758 | struct hdmi_eld *eld; | ||
759 | 760 | ||
760 | printk(KERN_INFO | 761 | printk(KERN_INFO |
761 | "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | 762 | "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", |
@@ -764,17 +765,8 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | |||
764 | pin_idx = pin_nid_to_pin_index(spec, pin_nid); | 765 | pin_idx = pin_nid_to_pin_index(spec, pin_nid); |
765 | if (pin_idx < 0) | 766 | if (pin_idx < 0) |
766 | return; | 767 | return; |
767 | eld = &spec->pins[pin_idx].sink_eld; | ||
768 | |||
769 | hdmi_present_sense(codec, pin_nid, eld); | ||
770 | 768 | ||
771 | /* | 769 | hdmi_present_sense(&spec->pins[pin_idx], true); |
772 | * HDMI sink's ELD info cannot always be retrieved for now, e.g. | ||
773 | * in console or for audio devices. Assume the highest speakers | ||
774 | * configuration, to _not_ prohibit multi-channel audio playback. | ||
775 | */ | ||
776 | if (!eld->spk_alloc) | ||
777 | eld->spk_alloc = 0xffff; | ||
778 | } | 770 | } |
779 | 771 | ||
780 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | 772 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) |
@@ -968,9 +960,11 @@ static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx) | |||
968 | return 0; | 960 | return 0; |
969 | } | 961 | } |
970 | 962 | ||
971 | static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid, | 963 | static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry) |
972 | struct hdmi_eld *eld) | ||
973 | { | 964 | { |
965 | struct hda_codec *codec = per_pin->codec; | ||
966 | struct hdmi_eld *eld = &per_pin->sink_eld; | ||
967 | hda_nid_t pin_nid = per_pin->pin_nid; | ||
974 | /* | 968 | /* |
975 | * Always execute a GetPinSense verb here, even when called from | 969 | * Always execute a GetPinSense verb here, even when called from |
976 | * hdmi_intrinsic_event; for some NVIDIA HW, the unsolicited | 970 | * hdmi_intrinsic_event; for some NVIDIA HW, the unsolicited |
@@ -980,26 +974,39 @@ static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid, | |||
980 | * the unsolicited response to avoid custom WARs. | 974 | * the unsolicited response to avoid custom WARs. |
981 | */ | 975 | */ |
982 | int present = snd_hda_pin_sense(codec, pin_nid); | 976 | int present = snd_hda_pin_sense(codec, pin_nid); |
977 | bool eld_valid = false; | ||
983 | 978 | ||
984 | memset(eld, 0, sizeof(*eld)); | 979 | memset(eld, 0, offsetof(struct hdmi_eld, eld_buffer)); |
985 | 980 | ||
986 | eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); | 981 | eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); |
987 | if (eld->monitor_present) | 982 | if (eld->monitor_present) |
988 | eld->eld_valid = !!(present & AC_PINSENSE_ELDV); | 983 | eld_valid = !!(present & AC_PINSENSE_ELDV); |
989 | else | ||
990 | eld->eld_valid = 0; | ||
991 | 984 | ||
992 | printk(KERN_INFO | 985 | printk(KERN_INFO |
993 | "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | 986 | "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", |
994 | codec->addr, pin_nid, eld->monitor_present, eld->eld_valid); | 987 | codec->addr, pin_nid, eld->monitor_present, eld_valid); |
995 | 988 | ||
996 | if (eld->eld_valid) | 989 | if (eld_valid) { |
997 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) | 990 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) |
998 | snd_hdmi_show_eld(eld); | 991 | snd_hdmi_show_eld(eld); |
992 | else if (retry) { | ||
993 | queue_delayed_work(codec->bus->workq, | ||
994 | &per_pin->work, | ||
995 | msecs_to_jiffies(300)); | ||
996 | } | ||
997 | } | ||
999 | 998 | ||
1000 | snd_hda_input_jack_report(codec, pin_nid); | 999 | snd_hda_input_jack_report(codec, pin_nid); |
1001 | } | 1000 | } |
1002 | 1001 | ||
1002 | static void hdmi_repoll_eld(struct work_struct *work) | ||
1003 | { | ||
1004 | struct hdmi_spec_per_pin *per_pin = | ||
1005 | container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); | ||
1006 | |||
1007 | hdmi_present_sense(per_pin, false); | ||
1008 | } | ||
1009 | |||
1003 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | 1010 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) |
1004 | { | 1011 | { |
1005 | struct hdmi_spec *spec = codec->spec; | 1012 | struct hdmi_spec *spec = codec->spec; |
@@ -1228,7 +1235,7 @@ static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx) | |||
1228 | if (err < 0) | 1235 | if (err < 0) |
1229 | return err; | 1236 | return err; |
1230 | 1237 | ||
1231 | hdmi_present_sense(codec, per_pin->pin_nid, &per_pin->sink_eld); | 1238 | hdmi_present_sense(per_pin, false); |
1232 | return 0; | 1239 | return 0; |
1233 | } | 1240 | } |
1234 | 1241 | ||
@@ -1279,6 +1286,8 @@ static int generic_hdmi_init(struct hda_codec *codec) | |||
1279 | AC_VERB_SET_UNSOLICITED_ENABLE, | 1286 | AC_VERB_SET_UNSOLICITED_ENABLE, |
1280 | AC_USRSP_EN | pin_nid); | 1287 | AC_USRSP_EN | pin_nid); |
1281 | 1288 | ||
1289 | per_pin->codec = codec; | ||
1290 | INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld); | ||
1282 | snd_hda_eld_proc_new(codec, eld, pin_idx); | 1291 | snd_hda_eld_proc_new(codec, eld, pin_idx); |
1283 | } | 1292 | } |
1284 | return 0; | 1293 | return 0; |
@@ -1293,10 +1302,12 @@ static void generic_hdmi_free(struct hda_codec *codec) | |||
1293 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; | 1302 | struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; |
1294 | struct hdmi_eld *eld = &per_pin->sink_eld; | 1303 | struct hdmi_eld *eld = &per_pin->sink_eld; |
1295 | 1304 | ||
1305 | cancel_delayed_work(&per_pin->work); | ||
1296 | snd_hda_eld_proc_free(codec, eld); | 1306 | snd_hda_eld_proc_free(codec, eld); |
1297 | } | 1307 | } |
1298 | snd_hda_input_jack_free(codec); | 1308 | snd_hda_input_jack_free(codec); |
1299 | 1309 | ||
1310 | flush_workqueue(codec->bus->workq); | ||
1300 | kfree(spec); | 1311 | kfree(spec); |
1301 | } | 1312 | } |
1302 | 1313 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 308bb575bc06..336d14eb72af 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1452,7 +1452,7 @@ static void alc_apply_fixup(struct hda_codec *codec, int action) | |||
1452 | switch (fix->type) { | 1452 | switch (fix->type) { |
1453 | case ALC_FIXUP_SKU: | 1453 | case ALC_FIXUP_SKU: |
1454 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) | 1454 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
1455 | break;; | 1455 | break; |
1456 | snd_printdd(KERN_INFO "hda_codec: %s: " | 1456 | snd_printdd(KERN_INFO "hda_codec: %s: " |
1457 | "Apply sku override for %s\n", | 1457 | "Apply sku override for %s\n", |
1458 | codec->chip_name, modelname); | 1458 | codec->chip_name, modelname); |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index edc2b7bc177c..470f6f286e81 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -227,7 +227,6 @@ struct sigmatel_spec { | |||
227 | 227 | ||
228 | /* power management */ | 228 | /* power management */ |
229 | unsigned int num_pwrs; | 229 | unsigned int num_pwrs; |
230 | const unsigned int *pwr_mapping; | ||
231 | const hda_nid_t *pwr_nids; | 230 | const hda_nid_t *pwr_nids; |
232 | const hda_nid_t *dac_list; | 231 | const hda_nid_t *dac_list; |
233 | 232 | ||
@@ -374,18 +373,15 @@ static const unsigned long stac92hd73xx_capvols[] = { | |||
374 | 373 | ||
375 | #define STAC92HD83_DAC_COUNT 3 | 374 | #define STAC92HD83_DAC_COUNT 3 |
376 | 375 | ||
377 | static const hda_nid_t stac92hd83xxx_pwr_nids[4] = { | 376 | static const hda_nid_t stac92hd83xxx_pwr_nids[7] = { |
378 | 0xa, 0xb, 0xd, 0xe, | 377 | 0x0a, 0x0b, 0x0c, 0xd, 0x0e, |
378 | 0x0f, 0x10 | ||
379 | }; | 379 | }; |
380 | 380 | ||
381 | static const hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { | 381 | static const hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { |
382 | 0x1e, 0, | 382 | 0x1e, 0, |
383 | }; | 383 | }; |
384 | 384 | ||
385 | static const unsigned int stac92hd83xxx_pwr_mapping[4] = { | ||
386 | 0x03, 0x0c, 0x20, 0x40, | ||
387 | }; | ||
388 | |||
389 | static const hda_nid_t stac92hd83xxx_dmic_nids[] = { | 385 | static const hda_nid_t stac92hd83xxx_dmic_nids[] = { |
390 | 0x11, 0x20, | 386 | 0x11, 0x20, |
391 | }; | 387 | }; |
@@ -4470,8 +4466,12 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4470 | stac_toggle_power_map(codec, nid, 1); | 4466 | stac_toggle_power_map(codec, nid, 1); |
4471 | continue; | 4467 | continue; |
4472 | } | 4468 | } |
4473 | if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) | 4469 | if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) { |
4474 | stac_issue_unsol_event(codec, nid); | 4470 | stac_issue_unsol_event(codec, nid); |
4471 | continue; | ||
4472 | } | ||
4473 | /* none of the above, turn the port OFF */ | ||
4474 | stac_toggle_power_map(codec, nid, 0); | ||
4475 | } | 4475 | } |
4476 | 4476 | ||
4477 | /* sync mute LED */ | 4477 | /* sync mute LED */ |
@@ -4727,11 +4727,7 @@ static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, | |||
4727 | if (idx >= spec->num_pwrs) | 4727 | if (idx >= spec->num_pwrs) |
4728 | return; | 4728 | return; |
4729 | 4729 | ||
4730 | /* several codecs have two power down bits */ | 4730 | idx = 1 << idx; |
4731 | if (spec->pwr_mapping) | ||
4732 | idx = spec->pwr_mapping[idx]; | ||
4733 | else | ||
4734 | idx = 1 << idx; | ||
4735 | 4731 | ||
4736 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; | 4732 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; |
4737 | if (enable) | 4733 | if (enable) |
@@ -5629,9 +5625,6 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
5629 | snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e); | 5625 | snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e); |
5630 | } | 5626 | } |
5631 | 5627 | ||
5632 | /* reset pin power-down; Windows may leave these bits after reboot */ | ||
5633 | snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7EC, 0); | ||
5634 | snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7ED, 0); | ||
5635 | codec->no_trigger_sense = 1; | 5628 | codec->no_trigger_sense = 1; |
5636 | codec->spec = spec; | 5629 | codec->spec = spec; |
5637 | 5630 | ||
@@ -5641,7 +5634,6 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
5641 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; | 5634 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; |
5642 | spec->digbeep_nid = 0x21; | 5635 | spec->digbeep_nid = 0x21; |
5643 | spec->pwr_nids = stac92hd83xxx_pwr_nids; | 5636 | spec->pwr_nids = stac92hd83xxx_pwr_nids; |
5644 | spec->pwr_mapping = stac92hd83xxx_pwr_mapping; | ||
5645 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); | 5637 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); |
5646 | spec->multiout.dac_nids = spec->dac_nids; | 5638 | spec->multiout.dac_nids = spec->dac_nids; |
5647 | spec->init = stac92hd83xxx_core_init; | 5639 | spec->init = stac92hd83xxx_core_init; |
@@ -5658,9 +5650,6 @@ again: | |||
5658 | stac92xx_set_config_regs(codec, | 5650 | stac92xx_set_config_regs(codec, |
5659 | stac92hd83xxx_brd_tbl[spec->board_config]); | 5651 | stac92hd83xxx_brd_tbl[spec->board_config]); |
5660 | 5652 | ||
5661 | if (spec->board_config != STAC_92HD83XXX_PWR_REF) | ||
5662 | spec->num_pwrs = 0; | ||
5663 | |||
5664 | codec->patch_ops = stac92xx_patch_ops; | 5653 | codec->patch_ops = stac92xx_patch_ops; |
5665 | 5654 | ||
5666 | if (find_mute_led_gpio(codec, 0)) | 5655 | if (find_mute_led_gpio(codec, 0)) |
@@ -5869,8 +5858,6 @@ again: | |||
5869 | (codec->revision_id & 0xf) == 1) | 5858 | (codec->revision_id & 0xf) == 1) |
5870 | spec->stream_delay = 40; /* 40 milliseconds */ | 5859 | spec->stream_delay = 40; /* 40 milliseconds */ |
5871 | 5860 | ||
5872 | /* no output amps */ | ||
5873 | spec->num_pwrs = 0; | ||
5874 | /* disable VSW */ | 5861 | /* disable VSW */ |
5875 | spec->init = stac92hd71bxx_core_init; | 5862 | spec->init = stac92hd71bxx_core_init; |
5876 | unmute_init++; | 5863 | unmute_init++; |
@@ -5885,8 +5872,6 @@ again: | |||
5885 | if ((codec->revision_id & 0xf) == 1) | 5872 | if ((codec->revision_id & 0xf) == 1) |
5886 | spec->stream_delay = 40; /* 40 milliseconds */ | 5873 | spec->stream_delay = 40; /* 40 milliseconds */ |
5887 | 5874 | ||
5888 | /* no output amps */ | ||
5889 | spec->num_pwrs = 0; | ||
5890 | /* fallthru */ | 5875 | /* fallthru */ |
5891 | default: | 5876 | default: |
5892 | spec->init = stac92hd71bxx_core_init; | 5877 | spec->init = stac92hd71bxx_core_init; |
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 30e2befd6f2a..8b4c2535b266 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -747,6 +747,18 @@ sub __eval_option { | |||
747 | # Add space to evaluate the character before $ | 747 | # Add space to evaluate the character before $ |
748 | $option = " $option"; | 748 | $option = " $option"; |
749 | my $retval = ""; | 749 | my $retval = ""; |
750 | my $repeated = 0; | ||
751 | my $parent = 0; | ||
752 | |||
753 | foreach my $test (keys %repeat_tests) { | ||
754 | if ($i >= $test && | ||
755 | $i < $test + $repeat_tests{$test}) { | ||
756 | |||
757 | $repeated = 1; | ||
758 | $parent = $test; | ||
759 | last; | ||
760 | } | ||
761 | } | ||
750 | 762 | ||
751 | while ($option =~ /(.*?[^\\])\$\{(.*?)\}(.*)/) { | 763 | while ($option =~ /(.*?[^\\])\$\{(.*?)\}(.*)/) { |
752 | my $start = $1; | 764 | my $start = $1; |
@@ -760,10 +772,14 @@ sub __eval_option { | |||
760 | # otherwise see if the default OPT (without [$i]) exists. | 772 | # otherwise see if the default OPT (without [$i]) exists. |
761 | 773 | ||
762 | my $o = "$var\[$i\]"; | 774 | my $o = "$var\[$i\]"; |
775 | my $parento = "$var\[$parent\]"; | ||
763 | 776 | ||
764 | if (defined($opt{$o})) { | 777 | if (defined($opt{$o})) { |
765 | $o = $opt{$o}; | 778 | $o = $opt{$o}; |
766 | $retval = "$retval$o"; | 779 | $retval = "$retval$o"; |
780 | } elsif ($repeated && defined($opt{$parento})) { | ||
781 | $o = $opt{$parento}; | ||
782 | $retval = "$retval$o"; | ||
767 | } elsif (defined($opt{$var})) { | 783 | } elsif (defined($opt{$var})) { |
768 | $o = $opt{$var}; | 784 | $o = $opt{$var}; |
769 | $retval = "$retval$o"; | 785 | $retval = "$retval$o"; |